huminmin
15 小时以前 f70ee8845ef75c346fee1ff5e8f576640f6a2d00
src/views/productionManagement/workOrder/index.vue
@@ -12,6 +12,17 @@
                    clearable
                    prefix-icon="Search"/>
        </div>
        <div class="search-item">
          <span class="search_title">生产订单号:</span>
          <el-input v-model="searchForm.productOrderNpsNo"
                    style="width: 240px"
                    placeholder="请输入"
                    @change="handleQuery"
                    clearable
                    prefix-icon="Search"/>
        </div>
        <div class="search-item">
          <el-button type="primary"
                     @click="handleQuery">搜索
@@ -25,6 +36,7 @@
                :tableData="tableData"
                :page="page"
                :tableLoading="tableLoading"
                :rowClassName="rowClassName"
                @pagination="pagination">
        <template #completionStatus="{ row }">
          <el-progress :percentage="toProgressPercentage(row?.completionStatus)"
@@ -170,47 +182,57 @@
    </el-dialog>
    <el-dialog v-model="reportDialogVisible"
               title="报工"
               width="500px">
               width="800px">
      <el-form ref="reportFormRef"
               :model="reportForm"
               :rules="reportFormRules"
               label-width="120px">
        <el-form-item label="待生产数量">
          <el-input v-model="reportForm.planQuantity"
                    readonly
                    style="width: 300px"/>
        </el-form-item>
        <el-form-item label="本次生产数量" prop="quantity">
          <el-input v-model.number="reportForm.quantity"
                    type="number"
                    min="1"
                    step="1"
                    style="width: 300px"
                    placeholder="请输入本次生产数量"
                    @input="handleQuantityInput"/>
        </el-form-item>
        <el-form-item label="报废数量" prop="scrapQty">
          <el-input v-model.number="reportForm.scrapQty"
                    type="number"
                    min="0"
                    step="1"
                    style="width: 300px"
                    placeholder="请输入报废数量"
                    @input="handleScrapQtyInput"/>
        </el-form-item>
        <el-form-item label="班组信息">
          <el-select v-model="reportForm.userId"
                     style="width: 300px"
                     placeholder="请选择班组信息"
                     clearable
                     filterable
                     @change="handleUserChange">
            <el-option v-for="user in userOptions"
                       :key="user.userId"
                       :label="user.userName"
                       :value="user.userId"/>
          </el-select>
        </el-form-item>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="待生产数量">
              <el-input v-model="reportForm.planQuantity"
                        readonly
                        style="width: 100%"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="本次生产数量" prop="quantity">
              <el-input v-model.number="reportForm.quantity"
                        type="number"
                        min="1"
                        step="1"
                        style="width: 100%"
                        placeholder="请输入本次生产数量"
                        @input="handleQuantityInput"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="报废数量" prop="scrapQty">
              <el-input v-model.number="reportForm.scrapQty"
                        type="number"
                        min="0"
                        step="1"
                        style="width: 100%"
                        placeholder="请输入报废数量"
                        @input="handleScrapQtyInput"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="班组信息">
              <el-select v-model="reportForm.userId"
                         style="width: 100%"
                         placeholder="请选择班组信息"
                         clearable
                         filterable
                         @change="handleUserChange">
                <el-option v-for="user in userOptions"
                           :key="user.userId"
                           :label="user.userName"
                           :value="user.userId"/>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <ProductionRecordForm ref="productionRecordFormRef" :list="processParamList"/>
      </el-form>
      <template #footer>
@@ -231,6 +253,12 @@
    <VoltageSortingForm
        v-if="voltageSortingFormVisible"
        v-model:isShow="voltageSortingFormVisible"
        :isEdit="true"
        :row="currentReportRowData"
        @refreshData="getList"/>
    <GranulationForm
        v-if="granulationFormVisible"
        v-model:isShow="granulationFormVisible"
        :isEdit="true"
        :row="currentReportRowData"
        @refreshData="getList"/>
@@ -261,6 +289,7 @@
const CopperPrintingForm = defineAsyncComponent(() => import("./components/CopperPrintingForm.vue"));
const VoltageSortingForm = defineAsyncComponent(() => import("./components/VoltageSortingForm.vue"));
const ProductionRecordForm = defineAsyncComponent(() => import("./components/ProductionRecordForm.vue"));
const GranulationForm = defineAsyncComponent(() => import("./components/GranulationForm.vue"));
const tableColumn = ref([
  {
    label: "优先级",
@@ -388,6 +417,7 @@
const editDialogVisible = ref(false);
const copperPrintingFormVisible = ref(false);
const voltageSortingFormVisible = ref(false);
const granulationFormVisible = ref(false);
const transferCardVisible = ref(false);
const transferCardData = ref([]);
const transferCardQrUrl = ref("");
@@ -406,7 +436,9 @@
  productProcessRouteItemId: "",
  userId: "",
  productMainId: null,
  otherData: {}
  otherData: {
    rows: [],
  }
});
const productionRecordFormRef = ref();
@@ -448,6 +480,13 @@
  scrapQty: [
    {validator: validateScrapQty, trigger: 'blur'}
  ]
};
const rowClassName = ({row}) => {
  if (Number(row.completionStatus) > 0 && Number(row.actualQualifiedRate) < Number(row.processQualifiedRate)) {
    return 'danger-row';
  }
  return '';
};
// 处理本次生产数量输入,限制必须大于等于1
@@ -513,6 +552,7 @@
const data = reactive({
  searchForm: {
    workOrderNo: "",
    productOrderNpsNo: "",
  },
});
const {searchForm} = toRefs(data);
@@ -663,6 +703,10 @@
    voltageSortingFormVisible.value = true
    return;
  }
  if (row.processName === '造粒') {
    granulationFormVisible.value = true
    return;
  }
  processParamList.value = await getProcessParamList(row)
  reportForm.planQuantity = row.planQuantity;
  reportForm.quantity = row.quantity !== undefined && row.quantity !== null ? row.quantity : null;
@@ -695,7 +739,10 @@
const handleReport = async () => {
  const data = await productionRecordFormRef.value.submitData()
  reportForm.otherData = JSON.stringify(data || {});
  if (!data) {
    return;
  }
  reportForm.otherData.rows = data || [];
  reportFormRef.value?.validate((valid) => {
    if (!valid) {
      return false;
@@ -747,7 +794,8 @@
    const submitData = {
      ...reportForm,
      quantity: quantity,
      scrapQty: scrapQty
      scrapQty: scrapQty,
      otherData: JSON.stringify(reportForm.otherData)
    };
    // console.log(submitData);
@@ -860,7 +908,11 @@
}
</style>
<style lang="scss">
<style lang="scss" scoped>
:deep(.danger-row td) {
  color: #e95a66 !important;
}
@media print {
  @page {
    size: landscape;
@@ -944,4 +996,4 @@
    height: 140px !important;
  }
}
</style>
</style>