gaoluyang
2 天以前 14f694d913698b5e04b09f6e6df789cbd1102937
src/views/productionManagement/productionDispatching/index.vue
@@ -13,7 +13,7 @@
            />
            <span class="search_title ml10">项目名称:</span>
            <el-input
               v-model="searchForm.customerName"
               v-model="searchForm.projectName"
               style="width: 240px"
               placeholder="请输入"
               @change="handleQuery"
@@ -23,12 +23,11 @@
            <span class="search_title ml10">录入日期:</span>
            <el-date-picker v-model="searchForm.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange"
                                    placeholder="请选择" clearable @change="changeDaterange" />
            <el-button type="primary" @click="handleQuery" style="margin-left: 10px"
            >搜索</el-button
            >
            <el-button type="primary" @click="handleQuery" style="margin-left: 10px">搜索</el-button>
         </div>
         <div>
            <el-button type="primary" @click="openForm('add')">生产派工</el-button>
            <el-button @click="handleOut">导出</el-button>
         </div>
      </div>
      <div class="table_list">
@@ -51,72 +50,73 @@
<script setup>
import {onMounted, ref} from "vue";
import FormDia from "@/views/productionManagement/productionDispatching/components/formDia.vue";
import {staffJoinDel, staffJoinListPage} from "@/api/personnelManagement/onboarding.js";
import {ElMessageBox} from "element-plus";
import dayjs from "dayjs";
import {schedulingListPage} from "@/api/productionManagement/productionOrder.js";
import { ElMessageBox } from "element-plus";
const data = reactive({
   searchForm: {
      staffName: "",
      entryDate: [
         dayjs().format("YYYY-MM-DD"),
         dayjs().add(1, "day").format("YYYY-MM-DD"),
      ], // 录入日期
      entryDateStart: dayjs().format("YYYY-MM-DD"),
      entryDateEnd: dayjs().add(1, "day").format("YYYY-MM-DD"),
      customerName: "",
      projectName: "",
      entryDate: null, // 录入日期
      entryDateStart: undefined,
      entryDateEnd: undefined,
   },
});
const { searchForm } = toRefs(data);
const tableColumn = ref([
   {
      label: "录入日期",
      prop: "staffNo",
      prop: "entryDate",
      width: 120,
   },
   {
      label: "合同号",
      prop: "staffName",
      prop: "salesContractNo",
      width: 220,
   },
   {
      label: "客户合同号",
      prop: "addressPhone",
      prop: "customerContractNo",
      width: 250,
   },
   {
      label: "客户名称",
      prop: "contactPerson",
      prop: "customerName",
      width: 250,
   },
   {
      label: "项目名称",
      prop: "contactPhone",
      width:150
      prop: "projectName",
      width:300
   },
   {
      label: "产品大类",
      prop: "basicBankAccount",
      width: 220,
      prop: "productCategory",
      width: 160,
   },
   {
      label: "规格型号",
      prop: "bankAccount",
      prop: "specificationModel",
      width: 220,
   },
   {
      label: "单位",
      prop: "bankCode",
      width:220
      prop: "unit",
      width:90
   },
   {
      label: "数量",
      prop: "maintainer",
      prop: "quantity",
   },
   {
      label: "排产数量",
      prop: "maintenanceTime",
      prop: "schedulingNum",
      width: 100,
   },
   {
      label: "待排数量",
      prop: "maintenanceTime",
      prop: "pendingQuantity",
      width: 100,
   },
]);
@@ -139,11 +139,11 @@
};
const changeDaterange = (value) => {
   if (value) {
      searchForm.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
      searchForm.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD");
      searchForm.value.entryDateStart = value[0];
      searchForm.value.entryDateEnd = value[1];
   } else {
      searchForm.entryDateStart = undefined;
      searchForm.entryDateEnd = undefined;
      searchForm.value.entryDateStart = undefined;
      searchForm.value.entryDateEnd = undefined;
   }
   handleQuery();
};
@@ -154,11 +154,18 @@
};
const getList = () => {
   tableLoading.value = true;
   staffJoinListPage({...page, ...searchForm.value}).then(res => {
   // 构造一个新的对象,不包含entryDate字段
   const params = { ...searchForm.value, ...page };
   params.entryDate = undefined
   schedulingListPage(params).then((res) => {
      tableLoading.value = false;
      tableData.value = res.data.records
      // 处理每条数据,增加pendingQuantity字段
      tableData.value = res.data.records.map(item => ({
         ...item,
         pendingQuantity: (Number(item.quantity) || 0) - (Number(item.schedulingNum) || 0)
      }));
      page.total = res.data.total;
   }).catch(err => {
   }).catch(() => {
      tableLoading.value = false;
   })
};
@@ -168,44 +175,20 @@
};
// 打开弹框
const openForm = (type, row) => {
const openForm = (type) => {
   if (selectedRows.value.length !== 1) {
      proxy.$message.error("请选择一条数据");
      return;
   }
   if (selectedRows.value[0].unPaymentAmountTotal == 0) {
      proxy.$message.warning("无需再付款");
   if (selectedRows.value[0].pendingQuantity == 0) {
      proxy.$message.warning("无需再派工");
      return;
   }
   nextTick(() => {
      formDia.value?.openDialog(type, row)
      formDia.value?.openDialog(type, selectedRows.value[0])
   })
};
// 删除
const handleDelete = () => {
   let ids = [];
   if (selectedRows.value.length > 0) {
      ids = selectedRows.value.map((item) => item.id);
   } else {
      proxy.$modal.msgWarning("请选择数据");
      return;
   }
   ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "导出", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
   })
      .then(() => {
         staffJoinDel(ids).then((res) => {
            proxy.$modal.msgSuccess("删除成功");
            getList();
         });
      })
      .catch(() => {
         proxy.$modal.msg("已取消");
      });
};
// 导出
const handleOut = () => {
   ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
@@ -214,12 +197,13 @@
      type: "warning",
   })
      .then(() => {
         proxy.download("/staff/staffJoinLeaveRecord/export", {staffState: 1}, "人员入职.xlsx");
         proxy.download("/salesLedger/scheduling/exportOne", {}, "生产派工.xlsx");
      })
      .catch(() => {
         proxy.$modal.msg("已取消");
      });
};
onMounted(() => {
   getList();
});