src/views/productionManagement/productionReporting/index.vue
@@ -7,20 +7,25 @@
                              style="width: 200px;"
                              @change="handleQuery" />
            </el-form-item>
            <el-form-item label="项目名称:">
               <el-input v-model="searchForm.projectName" placeholder="请输入" clearable prefix-icon="Search"
            <el-form-item label="合同号:">
               <el-input v-model="searchForm.salesContractNo" placeholder="请输入" clearable prefix-icon="Search"
                              style="width: 200px;"
                              @change="handleQuery" />
            </el-form-item>
<!--            <el-form-item label="项目名称:">-->
<!--               <el-input v-model="searchForm.projectName" placeholder="请输入" clearable prefix-icon="Search"-->
<!--                              style="width: 200px;"-->
<!--                              @change="handleQuery" />-->
<!--            </el-form-item>-->
            <el-form-item label="排产日期:">
               <el-date-picker v-model="searchForm.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange"
                                       placeholder="请选择" clearable @change="changeDaterange" />
            </el-form-item>
            <el-form-item label="状态:">
               <el-select v-model="searchForm.status" placeholder="请选择状态" style="width: 140px" clearable>
                  <el-option label="待生产" :value="1"></el-option>
                  <el-option label="待报工" :value="1"></el-option>
                  <el-option label="已报工" :value="3"></el-option>
                  <el-option label="生产中" :value="2"></el-option>
                  <!-- <el-option label="生产中" :value="2"></el-option> -->
               </el-select>
            </el-form-item>
            <el-form-item>
@@ -31,6 +36,7 @@
      <div class="table_list">
         <div style="text-align: right" class="mb10">
            <el-button type="primary" @click="openForm('add')">生产报工</el-button>
            <el-button @click="handleOut">导出</el-button>
         </div>
         <PIMTable
            rowKey="id"
@@ -133,7 +139,7 @@
</template>
<script setup>
import {onMounted, ref} from "vue";
import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick} from "vue";
import FormDia from "@/views/productionManagement/productionReporting/components/formDia.vue";
import {staffJoinDel, staffJoinListPage} from "@/api/personnelManagement/onboarding.js";
import {ElMessageBox} from "element-plus";
@@ -147,13 +153,13 @@
const data = reactive({
   searchForm: {
      staffName: "",
      entryDate: [
         dayjs().format("YYYY-MM-DD"),
         dayjs().add(1, "day").format("YYYY-MM-DD"),
      ], // 录入日期
      customerName: "",
      salesContractNo: "",
      projectName: "",
      status: "",
      entryDate: [dayjs().format("YYYY-MM-DD"), dayjs().format("YYYY-MM-DD")], // 录入日期,默认当天
      entryDateStart: dayjs().format("YYYY-MM-DD"),
      entryDateEnd: dayjs().add(1, "day").format("YYYY-MM-DD"),
      entryDateEnd: dayjs().format("YYYY-MM-DD"),
   },
});
const { searchForm } = toRefs(data);
@@ -174,7 +180,7 @@
         if (params == 3) {
            return "已报工";
         } else if (params == 1) {
            return "待生产";
            return "待报工";
         } else {
            return '生产中';
         }
@@ -199,25 +205,29 @@
      prop: "schedulingUserName",
   },
   {
      label: "产线",
      prop: "productionLine",
   },
   {
      label: "合同号",
      prop: "salesContractNo",
      width: 200,
   },
   {
      label: "客户合同号",
      prop: "customerContractNo",
      width: 200,
   },
   // {
   //    label: "客户合同号",
   //    prop: "customerContractNo",
   //    width: 200,
   // },
   {
      label: "客户名称",
      prop: "customerName",
      width: 200,
   },
   {
      label: "项目名称",
      prop: "projectName",
      width:300
   },
   // {
   //    label: "项目名称",
   //    prop: "projectName",
   //    width:300
   // },
   {
      label: "产品大类",
      prop: "productCategory",
@@ -229,12 +239,27 @@
      width: 150,
   },
   {
      label: "绑定机器",
      prop: "speculativeTradingName",
      width: 220,
   },
   {
      label: "单位",
      prop: "unit",
   },
   {
      label: "工序",
      prop: "process",
   },
   // {
   //    label: "口味分类",
   //    prop: "type",
   //    width: 150,
   // },
   {
      label: "损耗",
      prop: "loss",
      width: 150,
   },
   {
      label: "排产数量",
@@ -247,9 +272,14 @@
      width: 100,
   },
   {
      label: "待生产数量",
      label: "待报工数量",
      prop: "pendingFinishNum",
      width: 100,
   },
   {
      label: "备注",
      prop: "remark",
      width: 200,
   },
]);
const tableData = ref([]);
@@ -370,16 +400,21 @@
};
// 打开弹框
const openForm = (type, row) => {
   if (selectedRows.value.length !== 1) {
      proxy.$message.error("请选择一条数据");
   if (selectedRows.value.length === 0) {
      proxy.$message.error("请至少选择一条数据");
      return;
   }
   if (selectedRows.value[0].pendingFinishNum == 0) {
      proxy.$message.warning("无需再报工");
   // 过滤掉待报工数量为0的数据
   const validRows = selectedRows.value.filter(item => item.pendingFinishNum > 0);
   if (validRows.length === 0) {
      proxy.$message.warning("所选数据均无需再报工");
      return;
   }
   if (validRows.length < selectedRows.value.length) {
      proxy.$message.warning(`已过滤 ${selectedRows.value.length - validRows.length} 条无需报工的数据`);
   }
   nextTick(() => {
      const rowInfo = type === 'add' ? selectedRows.value[0] : row
      const rowInfo = type === 'add' ? validRows : (row ? [row] : [])
      formDia.value?.openDialog(type, rowInfo)
   })
};
@@ -416,7 +451,7 @@
      type: "warning",
   })
      .then(() => {
         proxy.download("/staff/staffJoinLeaveRecord/export", {staffState: 1}, "人员入职.xlsx");
         proxy.download("/salesLedger/work/export", {}, "生产报工.xlsx");
      })
      .catch(() => {
         proxy.$modal.msg("已取消");