gongchunyi
2026-08-08 8fb21c6343dcb703fb504fac6d5b2a0b7a584c36
src/views/productionManagement/workOrderManagement/index.vue
@@ -12,6 +12,20 @@
                    prefix-icon="Search" />
        </div>
        <div class="search-item">
          <span class="search_title">报工人:</span>
          <el-select v-model="searchForm.workerName"
                     style="width: 240px"
                     placeholder="请选择"
                     clearable
                     filterable
                     @change="handleQuery">
            <el-option v-for="user in userOptions"
                       :key="user.userId"
                       :label="user.nickName"
                       :value="user.nickName" />
          </el-select>
        </div>
        <div class="search-item">
          <el-button type="primary"
                     @click="handleQuery">搜索</el-button>
        </div>
@@ -158,6 +172,7 @@
      <template #footer>
        <span class="dialog-footer">
          <el-button type="primary"
                     :loading="reportSubmitting"
                     @click="handleReport">确定</el-button>
          <el-button @click="reportDialogVisible = false">取消</el-button>
        </span>
@@ -254,6 +269,18 @@
      width: "140",
    },
    {
      label: "报工人",
      prop: "workerName",
      width: "120",
      formatter: row => row?.workerName || (row?.workerId ? row.workerId : "-"),
    },
    {
      label: "交接人",
      prop: "handoverUserName",
      width: "120",
      formatter: row => row?.handoverUserName || (row?.handoverUserId ? row.handoverUserId : "-"),
    },
    {
      label: "操作",
      width: "200",
      align: "center",
@@ -290,6 +317,7 @@
  const transferCardQrUrl = ref("");
  const transferCardRowData = ref(null);
  const reportDialogVisible = ref(false);
  const reportSubmitting = ref(false);
  const workOrderFilesRef = ref(null);
  const reportFormRef = ref(null);
  const userOptions = ref([]);
@@ -405,6 +433,7 @@
  const data = reactive({
    searchForm: {
      workOrderNo: "",
      workerName: "",
    },
  });
  const { searchForm } = toRefs(data);
@@ -548,6 +577,9 @@
  };
  const handleReport = () => {
    if (reportSubmitting.value) {
      return;
    }
    reportFormRef.value?.validate(valid => {
      if (!valid) {
        return false;
@@ -615,6 +647,8 @@
        productMainId: reportForm.productMainId,
      };
      reportSubmitting.value = true;
      addProductMain(params)
        .then(res => {
          proxy.$modal.msgSuccess("报工成功");
@@ -622,9 +656,12 @@
          getList();
        })
        .catch(() => {
          ElMessageBox.alert("报工失败", "提示", {
            confirmButtonText: "确定",
          });
          // ElMessageBox.alert("报工失败", "提示", {
          //   confirmButtonText: "确定",
          // });
        })
        .finally(() => {
          reportSubmitting.value = false;
        });
    });
  };