Bladeren bron

Merge remote-tracking branch 'origin/master'

guoyujia 10 maanden geleden
bovenliggende
commit
55a2c13972

+ 10 - 0
babel.config.js

@@ -0,0 +1,10 @@
+module.exports = {
+  "plugins": [
+    [
+      "jsx",
+      {
+        "preserve": true
+      }
+    ]
+  ]
+}

+ 3 - 1
package.json

@@ -38,10 +38,12 @@
     "sortablejs": "^1.15.2",
     "vue": "3.2.45",
     "vue-cropper": "1.0.3",
-    "vue-router": "4.1.4"
+    "vue-router": "4.1.4",
+    "vxe-table": "^4.7.59"
   },
   "devDependencies": {
     "@vitejs/plugin-vue": "3.1.0",
+    "@vue/babel-preset-jsx": "^1.4.0",
     "@vue/compiler-sfc": "3.2.45",
     "sass": "1.56.1",
     "unplugin-auto-import": "0.11.4",

+ 40 - 0
src/api/business/beforeCheckoutVerify.js

@@ -0,0 +1,40 @@
+import request from '@/utils/request'
+
+const baseUrl = import.meta.env.VITE_APP_PRODUCTION_API
+
+/**
+ * 获取 生产批次 列表
+ * @param {*} data
+ * @returns
+ */
+export function listCheckoutInspection(query) {
+  return request({
+    url: baseUrl + '/business/beforeCheckoutVerify/list',
+    method: 'get',
+    params: query
+  })
+}
+
+export function confirmInspection(data) {
+  return request({
+    url: baseUrl + '/business/beforeCheckoutVerify/confirm',
+    method: 'post',
+    data: data
+  })
+}
+
+export function rejectInspection(data) {
+  return request({
+    url: baseUrl + '/business/beforeCheckoutVerify/reject',
+    method: 'post',
+    data: data
+  })
+}
+
+export function checkFurnace(data) {
+  return request({
+    url: baseUrl + '/business/beforeCheckoutVerify/checkFurnace',
+    method: 'post',
+    data: data
+  })
+}

+ 68 - 0
src/api/business/outsourceBalanceAccount.js

@@ -0,0 +1,68 @@
+import request from '@/utils/request'
+const baseUrl = import.meta.env.VITE_APP_PRODUCTION_API
+
+// 查询外协结算列表
+export function listBalanceAccount(query) {
+  return request({
+    url: baseUrl + '/business/balanceAccount/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询外协结算详细
+export function getBalanceAccount(id) {
+  return request({
+    url: baseUrl + '/business/balanceAccount/' + id,
+    method: 'get'
+  })
+}
+
+// 新增外协结算
+export function addBalanceAccount(data) {
+  return request({
+    url: baseUrl + '/business/balanceAccount',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改外协结算
+export function updateBalanceAccount(data) {
+  return request({
+    url: baseUrl + '/business/balanceAccount',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除外协结算
+export function delBalanceAccount(id) {
+  return request({
+    url: baseUrl + '/business/balanceAccount/' + id,
+    method: 'delete'
+  })
+}
+// 结算
+export function checkout(data) {
+  return request({
+    url: baseUrl + '/business/balanceAccount/confirm',
+    method: 'post',
+    data: data
+  })
+}
+// 取消结算
+export function discheckout(data) {
+  return request({
+    url: baseUrl + '/business/balanceAccount/cancel',
+    method: 'post',
+    data: data
+  })
+}
+export function saveBatchBalanceAccount(data) {
+  return request({
+    url: baseUrl + '/business/balanceAccount/saveBatch',
+    method: 'post',
+    data: data
+  })
+}

+ 53 - 0
src/api/business/outsourceBalanceMonth.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+const baseUrl = import.meta.env.VITE_APP_BASE_API
+// 查询外协结算月设置列表
+export function listOutsourceBalanceMonth(query) {
+  return request({
+    url: baseUrl + '/business/outsourceBalanceMonth/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询外协结算月设置详细
+export function getOutsourceBalanceMonth(id) {
+  return request({
+    url: baseUrl + '/business/outsourceBalanceMonth/' + id,
+    method: 'get'
+  })
+}
+
+// 新增外协结算月设置
+export function addOutsourceBalanceMonth(data) {
+  return request({
+    url: baseUrl + '/business/outsourceBalanceMonth',
+    method: 'post',
+    data: data
+  })
+}
+
+// 新增外协结算月设置
+export function saveOutsourceBalanceMonth(data) {
+  return request({
+    url: baseUrl + '/business/outsourceBalanceMonth/save',
+    method: 'post',
+    data: data
+  })
+}
+// 修改外协结算月设置
+export function updateOutsourceBalanceMonth(data) {
+  return request({
+    url: baseUrl + '/business/outsourceBalanceMonth',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除外协结算月设置
+export function delOutsourceBalanceMonth(id) {
+  return request({
+    url: baseUrl + '/business/outsourceBalanceMonth/' + id,
+    method: 'delete'
+  })
+}

+ 8 - 0
src/api/business/returnReceipt.js

@@ -43,3 +43,11 @@ export function delReceipt(id) {
 		method: 'delete'
 	})
 }
+
+export function checkFurnace(data) {
+	return request({
+		url: baseUrl + '/business/returnReceipt/checkFurnace',
+		method: 'post',
+		data: data
+	})
+}

+ 7 - 0
src/main.js

@@ -5,6 +5,11 @@ import Cookies from 'js-cookie'
 import ElementPlus from 'element-plus'
 import locale from 'element-plus/lib/locale/lang/zh-cn' // 中文语言
 
+import VxeTable from 'vxe-table'
+import 'vxe-table/lib/style.css'
+import VxeUI from 'vxe-pc-ui'
+import 'vxe-pc-ui/lib/style.css'
+
 import moment from 'moment'
 moment.locale('zh-cn')
 
@@ -85,6 +90,8 @@ app.use(router)
 app.use(store)
 app.use(plugins)
 app.use(elementIcons)
+app.use(VxeTable)
+app.use(VxeUI)
 app.component('svg-icon', SvgIcon)
 
 directive(app)

+ 1 - 1
src/router/index.js

@@ -200,7 +200,7 @@ export const dynamicRoutes = [
     path: '/drawing',
     component: Layout,
     hidden: true,
-    permissions: ['business:drawing:query'],
+    permissions: ['business:electronicDrawings:query'],
     children: [
       {
         // 假设您要传递的三个参数

+ 1 - 1
src/utils/request.js

@@ -18,7 +18,7 @@ const service = axios.create({
   // 因为对应了多个后端服务,这里不要统一定义前缀
   baseURL: '', //import.meta.env.VITE_APP_BASE_API
   // 超时
-  timeout: 100000
+  timeout: 1000000
 })
 
 // request拦截器

+ 658 - 0
src/views/business/dayworkSelect/form.vue

@@ -0,0 +1,658 @@
+<template>
+  <!-- 添加或修改项目信息对话框 -->
+  <el-drawer
+    v-model="visible"
+    size="80%"
+    direction="rtl"
+    :close-on-press-escape="false"
+  >
+    <div class="page-container form-container">
+      <div class="form-btns-container">
+        <span class="title-label"
+          ><el-icon>
+            <Document />
+          </el-icon>
+          报工详情</span
+        >
+        <el-button icon="Close" @click="handleCancel">取 消 </el-button>
+      </div>
+      <!-- 主表 -->
+      <el-form
+        ref="dayworkItemRef"
+        class="master-container"
+        :model="form"
+        :rules="rules"
+        :show-message="true"
+      >
+        <el-row :gutter="20">
+          <el-col :span="7">
+            <el-form-item label="开始时间:" prop="startTime">
+              <el-date-picker
+                v-model="form.startTime"
+                :disabled="true"
+                type="datetime"
+                value-format="YYYY-MM-DD HH:mm:ss "
+                :clearable="false"
+                :editable="false"
+                placeholder="请选择开始时间"
+                @change="handleTotalTime"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="9">
+            <el-form-item
+              label="工序名称:"
+              prop="processId"
+              label-width="90px"
+            >
+              <el-select-v2
+                v-model="form.processId"
+                clearable
+                :disabled="true"
+                :options="processList"
+                placeholder="请选择工序"
+                style="width: 220px"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="生产状态:" prop="status" align="center">
+              <el-select
+                v-model="form.status"
+                placeholder="请选择生产状态"
+                :disabled="true"
+                style="width: 220px"
+                @change="handleChangeStatus"
+              >
+                <el-option
+                  v-for="dict in dynamicOptions"
+                  :key="dict.value"
+                  :label="dict.label"
+                  :value="dict.value"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="7">
+            <el-form-item label="结束时间:" prop="endTime">
+              <el-date-picker
+                v-model="form.endTime"
+                :disabled="true"
+                type="datetime"
+                value-format="YYYY-MM-DD HH:mm:ss "
+                :editable="false"
+                :clearable="false"
+                placeholder="请选择结束时间"
+                @change="handleTotalTime"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="9">
+            <el-form-item label="操作者:" prop="nickName" label-width="82px">
+              <el-input
+                v-model.trim="form.nickName"
+                placeholder="请输入操作者"
+                :disabled="true"
+                readonly
+                :clearable="true"
+                style="width: 220px; margin-left: 8px"
+              >
+                <template #append>
+                  <el-button
+                    icon="Search"
+                    @click="handleSelectUserSingle"
+                  /> </template
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="投产量:" prop="prodNum" label-width="82px">
+              <el-input-number
+                v-model.trim="form.prodNum"
+                :disabled="true"
+                :precision="0"
+                controls-position="right"
+                style="width: 220px"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="7">
+            <el-form-item
+              label="总工时:"
+              prop="workingHoursTime"
+              label-width="82px"
+            >
+              <el-input
+                v-model.trim="workingHoursTime"
+                :disabled="true"
+                style="width: 220px; margin-left: 0px"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="9">
+            <el-form-item
+              label="合格数:"
+              prop="qualifiedNum"
+              label-width="90px"
+              style="padding-right: 0px"
+            >
+              <el-input-number
+                v-model.trim="form.qualifiedNum"
+                :disabled="true"
+                :precision="0"
+                controls-position="right"
+                style="width: 220px"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item
+              label="设备:"
+              prop="equipmentDetailId"
+              label-width="82px"
+            >
+              <el-select-v2
+                v-model="form.equipmentDetailId"
+                :disabled="true"
+                :options="equipmentList"
+                placeholder="请选择设备"
+                style="width: 220px"
+              >
+              </el-select-v2>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <!-- 搜索区域 -->
+      <el-form class="list-search-container" :inline="true">
+        <el-form-item class="section-title" label="废品信息" />
+      </el-form>
+      <!-- 列表区 -->
+      <div class="el-table-container">
+        <el-table
+          ref="dayworkItemRejectTable"
+          v-loading="loading"
+          row-key="id"
+          :data="form.groupRejectList"
+          height="100%"
+        >
+          <el-table-column type="index" label="行号" width="60" align="center">
+            <template #default="scope">
+              {{ scope.$index + 1 }}
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="废品数量"
+            width="200px"
+            prop="rejectNum"
+            align="center"
+          >
+            <template #default="scope">
+              <el-input-number
+                v-model.trim="scope.row.rejectNum"
+                placeholder="废品数量"
+                :disabled="!editStatus"
+                :precision="0"
+                :min="0"
+                controls-position="right"
+              />
+            </template>
+          </el-table-column>
+          <el-table-column prop="reason" label="废品原因" align="center">
+            <template #default="scope">
+              <el-select
+                v-model="scope.row.reason"
+                :disabled="!editStatus"
+                placeholder="请选择废品原因"
+              >
+                <el-option
+                  v-for="cause in waste_causes"
+                  :key="cause.value"
+                  :label="cause.label"
+                  :value="cause.value"
+                ></el-option>
+              </el-select>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+    </div>
+  </el-drawer>
+</template>
+<script setup>
+import {
+  getProcessList,
+  getDayworkItemRejectList,
+  updateDayworkItemInfoForNum,
+  getEquipmentInfo,
+  getIsFirstOrder,
+} from "@/api/business/daywork.js";
+import { ref } from "vue";
+
+const { proxy } = getCurrentInstance();
+const emit = defineEmits(["handleSaveSuccess"]);
+/** 字典 */
+const { daywork_status_edit } = proxy.useDict("daywork_status_edit");
+const { daywork_status_first } = proxy.useDict("daywork_status_first");
+const { daywork_status_second } = proxy.useDict("daywork_status_second");
+const { waste_causes } = proxy.useDict("waste_causes");
+const detailInfo = ref({});
+const loading = ref(false);
+const processList = ref([]);
+const lotId = ref(null);
+const equipmentList = ref([]);
+const visible = ref(false);
+const isFirst = ref(true); //是否为首序
+const editStatus = ref(false);
+const currentDept = ref(false);
+const rejectAmount = ref(0);
+const dynamicOptions = ref([]);
+const workingHoursTime = ref("");
+const maxQuailifiedNum = ref(0);
+const detailsRow = {
+  id: null,
+  rejectNum: "",
+  reason: "",
+};
+// const validateprodNum = (rule, value, callback) => {
+//   if (value <= 0) {
+//     callback(new Error("投产量应大于0"));
+//   } else {
+//     callback();
+//   }
+// };
+const validateWorkingHours = (rule, value, callback) => {
+  if (form.value.workHoursTimestamp < 0) {
+    callback(new Error("结束时间应晚于开始时间"));
+  } else {
+    callback();
+  }
+};
+const validateQualifiedNum = (rule, value, callback) => {
+  const max = maxQuailifiedNum.value;
+  if (value < 0) {
+    callback(new Error("合格数量应大于/等于0"));
+  } else {
+    callback();
+  }
+
+  // else if (
+  //   value > max &&
+  //   detailInfo.value.firstProcessId != form.value.processId
+  // ) {
+  //   callback(new Error("合格数量不应大于投产量的103%,即" + max));
+  // }
+};
+const validateEndTime = (rule, value, callback) => {
+  if (form.value.status > 1) {
+    if (form.value.endTime == null) {
+      callback(new Error("结束时间不能为空"));
+    } else {
+      callback();
+    }
+  } else {
+    if (form.value.endTime != null) {
+      callback(new Error("该状态结束时间应为空"));
+    } else {
+      callback();
+    }
+  }
+};
+const validateStartTime = (rule, value, callback) => {
+  if (form.value.status > 1) {
+    if (form.value.startTime == null) {
+      callback(new Error("开始时间不能为空"));
+    } else {
+      callback();
+    }
+  } else {
+    callback();
+  }
+};
+const data = reactive({
+  form: {
+    groupRejectList: [],
+    nickName: "",
+    processId: "",
+    processAlias: "",
+    prodNum: 0,
+    qualifiedNum: 0,
+    rejectNum: 0,
+    startTime: "",
+    endTime: "",
+    workingHours: 0,
+    status: "",
+    workHoursTimestamp: 0,
+  },
+  rules: {
+    // prodNum: [
+    //   { required: true, message: "投产量不能为空", trigger: "blur" },
+    //   { validator: validateprodNum, trigger: "blur" },
+    // ],
+    startTime: [{ validator: validateStartTime, trigger: "blur" }],
+    endTime: [{ validator: validateEndTime, trigger: "blur" }],
+    workingHoursTime: [{ validator: validateWorkingHours, trigger: "change" }],
+    qualifiedNum: [
+      { required: true, message: "合格数量不能为空", trigger: "blur" },
+      { validator: validateQualifiedNum, trigger: "blur" },
+    ],
+  },
+});
+
+const { form, rules } = toRefs(data);
+
+/***********************  方法区  ****************************/
+/** 打开抽屉 */
+const open = (row) => {
+  reset();
+  loading.value = true;
+  if (row.id) {
+    //查询是否为首序
+    getIsFirstOrder(row.dayworkId).then((res) => {
+      isFirst.value = res.data.isFirstOrder;
+    });
+    lotId.value = row.lotId;
+    //页面操作是编辑还是删除
+    console.log("row", row);
+    detailInfo.value = proxy.deepClone(row);
+    console.log(detailInfo.value);
+    //是否是当前工序
+    currentDept.value = row.currentDept;
+    form.value.id = row.id;
+    form.value.startTime = row.startTime;
+    form.value.endTime = row.endTime;
+    workingHoursTime.value = row.workingHours;
+    form.value.nickName = row.nickName;
+    form.value.productDescription = row.productDescription;
+    form.value.lotCode = row.lotCode;
+    form.value.technologyVersion = row.technologyVersion;
+    form.value.productionPlanNo = row.productionPlanNo;
+    form.value.status = row.status;
+    editStatus.value = row.status < 2 ? false : true;
+    form.value.processId = row.processId;
+    form.value.productionPlanDetailId = row.productionPlanDetailId;
+    if (form.value.status == 0 || form.value.status == 1) {
+      dynamicOptions.value = daywork_status_first.value;
+    } else if (form.value.status == 2 || form.value.status == 3) {
+      dynamicOptions.value = daywork_status_edit.value;
+    } else {
+      dynamicOptions.value = daywork_status_second.value;
+    }
+    form.value.qualifiedNum = row.qualifiedNum;
+    //合格数最大能修改数值
+    maxQuailifiedNum.value = row.maxQuailifiedNum;
+    form.value.workHoursTimestamp = 0;
+    form.value.prodNum = row.prodNum;
+    // technologicalProcessId: row.technologicalProcessId
+    getProcessList({
+      technologicalProcessId: row.technologicalProcessId,
+      isAmend: row.isAmend,
+      isWasteRecycling: row.isWasteRecycling,
+      lotId: row.lotId,
+    }).then((res) => {
+      processList.value = res.data;
+      for (let i = 0; i < processList.value.length; i++) {
+        if (processList.value[i].label === row.processAlias.trim()) {
+          form.value.processId = processList.value[i].value;
+        }
+      }
+    });
+    getDayworkItemRejectList({ dayworkItemId: detailInfo.value.id }).then(
+      (response) => {
+        if (response.code == 200) {
+          for (let i = 0; i < response.data.length; i++) {
+            response.data[i].rejectNum = parseInt(response.data[i].rejectNum);
+          }
+          form.value.groupRejectList = response.data;
+        }
+      }
+    );
+    //查询能够选择的设备信息
+    let productionPlanDetailId = parseInt(row.productionPlanDetailId);
+    getEquipmentInfo({
+      commonCode: row.userName,
+      productionPlanDetailId: productionPlanDetailId,
+      dayworkItemId: row.id,
+      deptId: row.deptId,
+    }).then((equipmentRef) => {
+      if (equipmentRef.code == 200) {
+        if (equipmentRef.rows.length > 0) {
+          equipmentList.value = equipmentRef.rows;
+          for (let i = 0; i < equipmentList.value.length; i++) {
+            if (row.equipmentDetailCode == equipmentList.value[i].label) {
+              form.value.equipmentDetailId = equipmentList.value[i].value;
+            }
+          }
+        } else {
+          equipmentList.value = [];
+        }
+      }
+    });
+    loading.value = false;
+    visible.value = true;
+  }
+};
+function handleSelectUserSingle() {}
+/**
+ * 对话框关闭 事件
+ */
+function close() {
+  reset();
+  visible.value = false;
+}
+
+/** 表单重置 */
+function reset() {
+  form.value = {
+    groupRejectList: [],
+    nickName: "",
+    processId: null,
+    processAlias: "",
+    prodNum: 0,
+    qualifiedNum: 0,
+    rejectNum: 0,
+    startTime: "",
+    endTime: "",
+    workingHours: 0,
+  };
+  proxy.resetForm("dayworkItemRef");
+}
+
+/** 提交按钮 */
+const handleSave = () => {
+  proxy.$refs["dayworkItemRef"].validate((valid) => {
+    if (valid) {
+      rejectAmount.value = 0;
+      var reasonList = [];
+      var flag = true;
+      for (let i = 0; i < form.value.groupRejectList.length; i++) {
+        rejectAmount.value += form.value.groupRejectList[i].rejectNum;
+        if (form.value.groupRejectList[i].rejectNum <= 0) {
+          flag = false;
+          proxy.$modal.msgError("第" + (i + 1) + "废品数应大于0");
+          return;
+        }
+        if (!form.value.groupRejectList[i].reason) {
+          flag = false;
+          proxy.$modal.msgError("第" + (i + 1) + "行废品原因不能为空");
+
+          return;
+        }
+        if (reasonList.indexOf(form.value.groupRejectList[i].reason) >= 0) {
+          flag = false;
+          proxy.$modal.msgError(
+            "第" +
+              (i + 1) +
+              "行废品原因与" +
+              (reasonList.indexOf(form.value.groupRejectList[i].reason) + 1) +
+              "行相同"
+          );
+          return;
+        }
+        reasonList.push(form.value.groupRejectList[i].reason);
+      }
+      if (rejectAmount.value > form.value.prodNum) {
+        flag = false;
+        proxy.$modal.msgError(
+          "废品总数不能超过投产数,当前废品总数为" + rejectAmount.value
+        );
+      }
+
+      form.value.workingHours = form.value.workHoursTimestamp;
+      //设备id和code
+      for (let i = 0; i < equipmentList.value.length; i++) {
+        if (form.value.equipmentDetailId == equipmentList.value[i].value) {
+          form.value.equipmentDetailCode = equipmentList.value[i].label;
+        }
+      }
+      if (flag) {
+        if (form.value.groupRejectList.length > 0) {
+          form.value.groupRejectList.forEach((item) => {
+            item.deptId = detailInfo.value.deptId;
+            item.processId = detailInfo.value.processId;
+          });
+        }
+        form.value.dayworkId = detailInfo.value.dayworkId;
+        //同工序的所有合格数
+        form.value.temporaryProcessQualifiedNum =
+          detailInfo.value.totalQuailifiedNum + form.value.qualifiedNum;
+        //如果状态从工序已完成改成结束报工,传给后端一个标记,如果为true,则删除中间表对应的数据
+        if (detailInfo.value.status == 3 && form.value.status == 2) {
+          form.value.dayworkId = detailInfo.value.dayworkId;
+          form.value.flag = true;
+        }
+        let data = form.value;
+        data.lotId = lotId.value;
+
+        const max = maxQuailifiedNum.value;
+        let sunm =
+          detailInfo.value.totalQuailifiedNum + form.value.qualifiedNum; //计算总合格数
+        let num = sunm - form.value.prodNum; //多出来的数量
+        let percent = (sunm / form.value.prodNum) * 100; //合格率
+        percent = Math.ceil(percent * 100) / 100; //只入不舍
+        //判断是否超过投产量
+        if (sunm > form.value.prodNum) {
+          //判断是否为首序
+          if (isFirst.value) {
+            // 弹出确认对话框
+            proxy.$modal
+              .confirm(
+                "合格数为投产量" +
+                  percent +
+                  "%,超出投产量" +
+                  num +
+                  "。 是否继续保存!"
+              )
+              .then(function () {
+                updateDayworkItem();
+              })
+              .then(() => {
+                return;
+              })
+              .catch(() => {
+                return;
+              });
+          } else {
+            if (form.value.qualifiedNum <= max) {
+              updateDayworkItem();
+            } else {
+              proxy.$modal.msgError(
+                "合格数不能超过投产量的103%,最大合格数为" + max
+              );
+            }
+          }
+        } else {
+          updateDayworkItem();
+        }
+      }
+    }
+  });
+};
+
+//页面提交方法
+function updateDayworkItem() {
+  updateDayworkItemInfoForNum(form.value).then((res) => {
+    if (res.code == 200) {
+      proxy.$modal.msgSuccess("保存成功!");
+      visible.value = false;
+      emit("handleSaveSuccess");
+    } else {
+      proxy.$modal.msgError("保存失败!");
+    }
+  });
+}
+
+//删除废弃信息
+function handleDeleteReject(row) {
+  form.value.groupRejectList.splice(form.value.groupRejectList.indexOf(row), 1);
+}
+
+//添加废弃信息
+function handleAddReject() {
+  const newDetail = JSON.parse(JSON.stringify(detailsRow));
+  newDetail.rejectNum = 0;
+  newDetail.dayworkId = detailInfo.value.dayworkId;
+  newDetail.dayworkItemId = detailInfo.value.id;
+  newDetail.lotId = detailInfo.value.lotId;
+  form.value.groupRejectList.push(newDetail);
+}
+
+//计算总工时
+function handleTotalTime() {
+  if (form.value.endTime == null) {
+    workingHoursTime.value = "0小时0分钟0秒";
+    form.value.workHoursTimestamp = 0;
+  } else {
+    form.value.workHoursTimestamp =
+      new Date(form.value.endTime) - new Date(form.value.startTime);
+    let seconds = Math.floor((form.value.workHoursTimestamp / 1000) % 60);
+    let minutes = Math.floor(
+      (form.value.workHoursTimestamp / (1000 * 60)) % 60
+    );
+    let hours = Math.floor(form.value.workHoursTimestamp / (1000 * 60 * 60));
+    let time = `${hours}小时${minutes}分钟${seconds}秒`;
+    workingHoursTime.value = time;
+  }
+}
+
+//当生产状态为未开始、生产中时,结束时间为空,合格数为0,废弃信息为空
+function handleChangeStatus() {
+  if (form.value.status == 1) {
+    form.value.endTime = null;
+    workingHoursTime.value = "0小时0分钟0秒";
+    form.value.workingHours = 0;
+    form.value.groupRejectList = [];
+    form.value.qualifiedNum = 0;
+  }
+  if (form.value.status == 0) {
+    form.value.endTime = null;
+    form.value.startTime = null;
+    workingHoursTime.value = "0小时0分钟0秒";
+    form.value.workingHours = 0;
+    form.value.groupRejectList = [];
+    form.value.qualifiedNum = 0;
+    form.value.equipmentDetailId = null;
+    form.value.equipmentDetailCode = null;
+  }
+}
+
+/** 取消按钮 */
+const handleCancel = () => {
+  visible.value = false;
+  reset();
+};
+
+/** 暴露给父组件的方法 */
+defineExpose({
+  open,
+});
+</script>
+<style scoped>
+.el-select-v2__placeholder {
+  display: flex !important;
+}
+</style>

+ 622 - 0
src/views/business/dayworkSelect/index.vue

@@ -0,0 +1,622 @@
+<template>
+  <div class="page-container row-container">
+    <!-- 左侧区域 -->
+    <section class="list-part-container" style="flex: 3">
+      <!-- 搜索区 -->
+      <el-form
+        class="list-search-container"
+        :model="queryDayworkParams"
+        ref="queryRef"
+        :inline="true"
+        style="margin-right: 0px"
+      >
+        <el-form-item class="section-title" label="生产批次" />
+        <el-form-item label="生产计划单号:">
+          <el-input
+            placeholder="请输入生产计划单号/批次号"
+            v-model.trim="queryDayworkParams.productionPlanNo"
+            @keydown.enter.prevent
+            clearable
+            style="width: 200px"
+          />
+        </el-form-item>
+        <el-form-item label="产品描述:">
+          <el-input
+            placeholder="请输入产品描述"
+            v-model.trim="queryDayworkParams.productDescription"
+            @keydown.enter.prevent
+            clearable
+            style="width: 130px"
+          />
+        </el-form-item>
+        <el-form-item style="margin-left: 0">
+          <el-button type="info" icon="Search" @click="handleQuery"
+            >搜索
+          </el-button>
+        </el-form-item>
+      </el-form>
+      <div class="el-table-container">
+        <div class="el-table-inner-container">
+          <el-table
+            ref="dayworkTable"
+            :data="dayworkList"
+            v-loading="dayworkLoading"
+            highlight-current-row
+            height="100%"
+            @current-change="handleDayworkCurrentChange"
+          >
+            <el-table-column
+              label="客户简称"
+              prop="companyAlias"
+              width="120"
+              align="center"
+            />
+            <el-table-column
+              label="生产计划单号"
+              prop="productionPlanNo"
+              width="100"
+              align="center"
+            />
+            <el-table-column
+              label="批次号"
+              min-width="120"
+              prop="lotCode"
+              align="center"
+            >
+              <template #default="scope">
+                <el-button
+                  v-if="permissionFlag || useUserStore().user.userId == 1"
+                  link
+                  type="primary"
+                  @click="handleColumnClick(scope.row)"
+                  ><span>{{ scope.row.lotCode }}</span></el-button
+                >
+                <span v-else>{{ scope.row.lotCode }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column
+              label="产品描述"
+              prop="productDescription"
+              align="center"
+            />
+            <el-table-column
+              label="图纸版本"
+              prop="technologyVersion"
+              width="60"
+              align="center"
+            />
+            <el-table-column
+              label="投产量"
+              prop="productionQuantity"
+              width="60"
+              align="center"
+            />
+            <el-table-column
+              label="下达日期"
+              prop="createTime"
+              width="100"
+              align="center"
+            >
+              <template #default="scope">
+                <span>{{
+                  proxy.moment(scope.row.createTime).format("YYYY-MM-DD")
+                }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column
+              label="报工总时长"
+              prop="totalWorkingHours"
+              width="150"
+              align="center"
+            />
+          </el-table>
+        </div>
+      </div>
+      <!-- 分页 -->
+      <pagination
+        v-show="total > 0"
+        :total="total"
+        v-model:page="queryDayworkParams.pageNum"
+        v-model:limit="queryDayworkParams.pageSize"
+        @pagination="getDayworks"
+      />
+    </section>
+    <!-- 右侧区域 -->
+    <section class="list-part-container" style="flex: 2">
+      <el-form class="list-search-container" :inline="true">
+        <el-form-item class="section-title" label="报工信息" />
+        <el-form-item
+          class="section-title"
+          label="请选择工序:"
+          prop="processId"
+        >
+          <el-select-v2
+            v-model="queryItemParams.processId"
+            clearable
+            :options="processList"
+            placeholder="请选择工序"
+            style="width: 100%"
+            @change="handleProcessChange"
+          />
+        </el-form-item>
+      </el-form>
+
+      <div class="el-table-container">
+        <div class="el-table-inner-container">
+          <el-table
+            :data="dayworkItemList"
+            v-loading="dayworkItemLoading"
+            height="100%"
+          >
+            <el-table-column
+              label="操作者"
+              prop="nickName"
+              width="60"
+              align="center"
+            />
+            <el-table-column
+              label="工序名称"
+              prop="processAlias"
+              align="center"
+            />
+            <el-table-column
+              label="投产量"
+              prop="prodNum"
+              width="60"
+              align="center"
+            />
+            <el-table-column
+              label="合格数"
+              prop="qualifiedNum"
+              width="60"
+              align="center"
+            />
+            <el-table-column
+              label="废品数"
+              prop="rejectNum"
+              width="60"
+              align="center"
+            />
+            <el-table-column
+              label="开始时间"
+              prop="startTime"
+              width="160"
+              align="center"
+            />
+            <el-table-column
+              label="结束时间"
+              prop="endTime"
+              width="160"
+              align="center"
+            />
+            <el-table-column
+              label="总工时"
+              prop="workingHours"
+              width="160"
+              align="center"
+            />
+            <el-table-column
+              label="生产状态"
+              prop="status"
+              width="100"
+              align="center"
+            >
+              <template #default="scope">
+                <dict-tag :options="daywork_status" :value="scope.row.status" />
+              </template>
+            </el-table-column>
+            <el-table-column
+              fixed="right"
+              label="操作"
+              align="center"
+              width="200px"
+            >
+              <template #default="scope">
+                <el-button
+                  link
+                  type="primary"
+                  icon="View"
+                  @click="handleSelectDayworkItem(scope.row)"
+                  >查看
+                </el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+      </div>
+      <!-- 分页 -->
+      <pagination
+        v-show="itemTotal > 0"
+        :total="itemTotal"
+        v-model:page="queryItemParams.pageNum"
+        v-model:limit="queryItemParams.pageSize"
+        @pagination="getDayworkItems"
+      />
+    </section>
+    <!-- 报工信息表单 -->
+    <daywork-item-form
+      ref="dayworkItemRef"
+      @handleSaveSuccess="handleGetDayworkItems"
+    />
+    <!-- 分选报工信息表单 -->
+    <sort-item-form
+      ref="sortItemRef"
+      @handleSaveSuccess="handleGetDayworkItems"
+    />
+    <!-- 报工历史修改表单 -->
+    <dialog-daywork-item-history ref="dialogDayworkItemHistoryRef" />
+  </div>
+</template>
+
+<script setup>
+import {
+  listDaywork,
+  listDayworkItem,
+  getProcessList,
+  delDayworkItem,
+} from "@/api/business/daywork.js";
+import { listDeptProcess } from "@/api/business/deptProcess";
+import { selectUserPermissionList } from "@/api/system/user.js";
+import router from "@/router";
+import dayworkItemForm from "./form";
+import sortItemForm from "./sortForm";
+import useUserStore from "@/store/modules/user";
+
+const { proxy } = getCurrentInstance();
+
+/** 字典 */
+const { daywork_status } = proxy.useDict("daywork_status");
+
+/** 生产批次 */
+const dayworkList = ref([]);
+const dayworkTable = ref(null);
+const currentDaywork = ref({});
+const dayworkLoading = ref(false);
+const total = ref(0);
+/**工段 */
+const permissionFlag = ref(false);
+const loading = ref(false);
+/** 报工信息 */
+const dayworkItemList = ref([]);
+const dayworkItemLoading = ref(false);
+const itemTotal = ref(0);
+const lastStatus = ref(null);
+const latestProcessId = ref(null);
+const latestDeptId = ref(null);
+const permissionList = ref(null);
+const deptProcessList = ref([]);
+/**工序 */
+const processList = ref([]);
+/** 查询对象 */
+const queryDayworkParams = ref({
+  productDescription: "",
+  deptId: "",
+  lotCode: "",
+  pageNum: 1,
+  pageSize: 10,
+});
+const queryItemParams = ref({
+  dayworkId: "0",
+  isAmend: 0,
+  isWasteRecycling: 0,
+  pageNum: 1,
+  pageSize: 10,
+  technologicalProcessDetailId: null,
+});
+
+/***********************  工段相关事件  ****************************/
+function getList() {
+  loading.value = true;
+  getPremission();
+  getDayworks();
+}
+
+//切换工段
+function handleDeptChange() {
+  getDayworks();
+}
+
+/***********************  生产批次相关事件  ****************************/
+
+/** 查询计划明细 */
+function getDayworks() {
+  dayworkLoading.value = true;
+  listDaywork(queryDayworkParams.value).then((res) => {
+    dayworkList.value = res.rows;
+    for (var i = 0; i < dayworkList.value.length; i++) {
+      let timeStamp = dayworkList.value[i].totalWorkingHours;
+      let seconds = Math.floor((timeStamp / 1000) % 60);
+      let minutes = Math.floor((timeStamp / (1000 * 60)) % 60);
+      let hours = Math.floor(timeStamp / (1000 * 60 * 60));
+      let time = `${hours}小时${minutes}分钟${seconds}秒`;
+      dayworkList.value[i].totalWorkingHours = time;
+    }
+    total.value = res.total;
+    dayworkLoading.value = false;
+    // 批次
+    if (dayworkList.value.length > 0) {
+      proxy.$refs.dayworkTable.setCurrentRow(dayworkList.value[0]);
+      console.log(dayworkList.value[0]);
+    } else {
+      dayworkItemList.value = [];
+      itemTotal.value = 0;
+    }
+  });
+}
+function getPremission() {
+  console.log("888");
+  selectUserPermissionList({ userId: useUserStore().user.userId }).then(
+    (res) => {
+      permissionList.value = res.data;
+      console.log(permissionList.value);
+      if (permissionList.value.indexOf("business:productionPlan:query") != -1) {
+        permissionFlag.value = true;
+      } else {
+        permissionFlag.value = false;
+      }
+    }
+  );
+}
+
+/** 打开批次详情页 */
+function handleColumnClick(row) {
+  router.push({ path: "/reviseBath/lotFormParticulars/" + row.lotCode });
+}
+// 打开历史修改弹窗
+function handleOpenHistory() {
+  proxy.$refs.dialogDayworkItemHistoryRef.open(currentDaywork.value.id);
+}
+
+/** 生产计划明细 current-change 事件 */
+function handleDayworkCurrentChange(row) {
+  if (row) {
+    queryItemParams.value.processId = null;
+    currentDaywork.value = row;
+    queryItemParams.value.dayworkId = currentDaywork.value.id;
+    queryItemParams.value.isAmend = row.isAmend;
+    queryItemParams.value.isWasteRecycling = row.isWasteRecycling;
+    queryItemParams.value.technologicalProcessDetailId = null;
+    queryItemParams.value.technologicalProcessId = row.technologicalProcessId;
+    getDayworkItems();
+    getProcess();
+  } else {
+    dayworkItemList.value = [];
+    itemTotal.value = 0;
+  }
+}
+
+/***********************  报工信息相关事件  ****************************/
+//查询报工信息数据
+function handleGetDayworkItems() {
+  dayworkLoading.value = true;
+  listDaywork(queryDayworkParams.value).then((res) => {
+    dayworkList.value = res.rows;
+    for (var i = 0; i < dayworkList.value.length; i++) {
+      let timeStamp = dayworkList.value[i].totalWorkingHours;
+      let seconds = Math.floor((timeStamp / 1000) % 60);
+      let minutes = Math.floor((timeStamp / (1000 * 60)) % 60);
+      let hours = Math.floor(timeStamp / (1000 * 60 * 60));
+      let time = `${hours}小时${minutes}分钟${seconds}秒`;
+      dayworkList.value[i].totalWorkingHours = time;
+    }
+    total.value = res.total;
+    dayworkLoading.value = false;
+    if (dayworkList.value.length > 0) {
+      for (var i = 0; i < dayworkList.value.length; i++) {
+        if (dayworkList.value[i].id == currentDaywork.value.id) {
+          var index = i;
+          break;
+        }
+      }
+    }
+    proxy.$refs.dayworkTable.setCurrentRow(dayworkList.value[index]);
+  });
+}
+//删除报工信息
+function handleDeletedItem(id) {
+  proxy.$modal.confirm("是否确认删除选中的数据项?").then(function () {
+    delDayworkItem(id).then((res) => {
+      if (res.code == 200) {
+        proxy.$modal.msgSuccess("删除成功");
+        listDaywork(queryDayworkParams.value).then((res) => {
+          dayworkList.value = res.rows;
+          for (var i = 0; i < dayworkList.value.length; i++) {
+            let timeStamp = dayworkList.value[i].totalWorkingHours;
+            let seconds = Math.floor((timeStamp / 1000) % 60);
+            let minutes = Math.floor((timeStamp / (1000 * 60)) % 60);
+            let hours = Math.floor(timeStamp / (1000 * 60 * 60));
+            let time = `${hours}小时${minutes}分钟${seconds}秒`;
+            dayworkList.value[i].totalWorkingHours = time;
+          }
+          total.value = res.total;
+          // 批次
+          proxy.$refs.dayworkTable.setCurrentRow(
+            dayworkList.value[
+              dayworkList.value.findIndex(
+                (daywork) => daywork.id == currentDaywork.value.id
+              )
+            ]
+          );
+        });
+      }
+    });
+  });
+}
+//修改报工信息
+function handleSelectDayworkItem(row) {
+  //同工序下状态是否有工序已完成
+  let processFinish = false;
+  //除了编辑此条以外的同工序合格数
+  let totalQuailifiedNum = 0;
+  for (let i = 0; i < dayworkItemList.value.length; i++) {
+    if (
+      row.processId == dayworkItemList.value[i].processId &&
+      (dayworkItemList.value[i].status == 2 ||
+        dayworkItemList.value[i].status == 3) &&
+      row.id != dayworkItemList.value[i].id
+    ) {
+      totalQuailifiedNum += dayworkItemList.value[i].qualifiedNum;
+    }
+    if (
+      row.processId == dayworkItemList.value[i].processId &&
+      dayworkItemList.value[i].status == 3 &&
+      row.id != dayworkItemList.value[i].id
+    ) {
+      processFinish = true;
+    }
+  }
+  let maxQuailifiedNum =
+    Math.floor(row.prodNum * 1.03 - totalQuailifiedNum) > 0
+      ? Math.floor(row.prodNum * 1.03 - totalQuailifiedNum)
+      : 0;
+  //该daywork合格数总数不能超过投产数的103%
+  row.technologicalProcessId = queryItemParams.value.technologicalProcessId;
+  row.deptId = queryDayworkParams.value.deptId;
+  row.productionPlanNo = currentDaywork.value.productionPlanNo;
+  row.productDescription = currentDaywork.value.productDescription;
+  row.productionPlanDetailId = currentDaywork.value.productionPlanDetailId;
+  row.dayworkId = currentDaywork.value.id;
+  row.lotId = currentDaywork.value.lotId;
+  row.isAmend = currentDaywork.value.isAmend;
+  row.isWasteRecycling = currentDaywork.value.isWasteRecycling;
+  row.maxQuailifiedNum = maxQuailifiedNum;
+  row.technologyVersion = currentDaywork.value.technologyVersion;
+  row.lotCode = currentDaywork.value.lotCode;
+  row.totalQuailifiedNum = totalQuailifiedNum;
+  // console.log(row, currentDaywork)
+  row.productId = currentDaywork.value.productId;
+  //判断是否是当前工段
+  if (row.deptId == currentDaywork.value.deptId) {
+    row.currentDept = true;
+  } else {
+    row.currentDept = false;
+  }
+  //如果为true,则同工序已有工序已完成
+  row.processFinish = processFinish;
+  if (row.isSort == 0) {
+    proxy.$refs.dayworkItemRef.open(row);
+  } else {
+    proxy.$refs.sortItemRef.open(row);
+  }
+}
+
+//查看报工信息
+function handleCheckDayworkItem(row) {
+  row.technologicalProcessId = queryItemParams.value.technologicalProcessId;
+  row.deptId = queryDayworkParams.value.deptId;
+  row.productionPlanDetailId = currentDaywork.value.productionPlanDetailId;
+  row.isAmend = currentDaywork.value.isAmend;
+  row.isWasteRecycling = currentDaywork.value.isWasteRecycling;
+  row.dayworkId = currentDaywork.value.id;
+  row.lotId = currentDaywork.value.lotId;
+  //判断是否是当前工段
+  if (row.deptId == currentDaywork.value.deptId) {
+    row.currentDept = true;
+  } else {
+    row.currentDept = false;
+  }
+  //修改向form表单传一个状态值
+  row.editStatus = false;
+  // row.returnFlag = false;
+  // //如果是最新工序的已接收,则传一个状态值,给form表单一个退回按钮
+  // if (row.processId == latestProcessId.value && row.status == 7) {
+  //   row.returnFlag = true;
+  // }
+  if (row.isSort == 0) {
+    proxy.$refs.dayworkItemRef.open(row);
+  } else {
+    proxy.$refs.sortItemRef.open(row);
+  }
+}
+
+/**切换工序 */
+function handleProcessChange() {
+  getDayworkItems();
+}
+
+/** 报工详情列表 */
+function getDayworkItems() {
+  dayworkItemLoading.value = true;
+  //查询该工段在工段资源分配时绑定的工序,传一个flag,如果flag有值则后端查询不分页
+  listDeptProcess({ deptId: queryDayworkParams.value.deptId, flag: 1 }).then(
+    (res) => {
+      deptProcessList.value = res.rows;
+      listDayworkItem(queryItemParams.value).then((res) => {
+        console.log(currentDaywork.value);
+        for (let i = 0; i < res.rows.length; i++) {
+          //如果时首序,投产数是单批数
+          if (
+            res.rows[i].processStepNumber === res.others.isFirst &&
+            res.rows[i].prodNum == 0
+          ) {
+            if (currentDaywork.value.isLast == 1) {
+              res.rows[i].prodNum = currentDaywork.value.lastLotQuantity;
+            } else {
+              res.rows[i].prodNum = currentDaywork.value.oneLotQuantity;
+            }
+          }
+          //拿到最新一条报工信息的工序id,只能编辑当前序
+          // if (res.rows[i] == res.rows[res.rows.length - 1]) {
+          //   latestProcessId.value = res.rows[i].processId;
+          // }
+        }
+        if (res.others != null && res.others.latestProcessId != null) {
+          latestProcessId.value = res.others.latestProcessId;
+        }
+        if (res.others != null && res.others.lastItem != null) {
+          latestDeptId.value = res.others.lastItem.deptId;
+          lastStatus.value = res.others.lastItem.status;
+        }
+        for (var i = 0; i < res.rows.length; i++) {
+          let timeStamp = res.rows[i].workingHours;
+          let seconds = Math.floor((timeStamp / 1000) % 60);
+          let minutes = Math.floor((timeStamp / (1000 * 60)) % 60);
+          let hours = Math.floor(timeStamp / (1000 * 60 * 60));
+          let time = `${hours}小时${minutes}分钟${seconds}秒`;
+          res.rows[i].workingHours = time;
+          res.rows[i].deptProcessStatus = false;
+          //报工记录的工序id是该工段绑定的工序时,允许编辑
+          for (var item = 0; item < deptProcessList.value.length; item++) {
+            if (
+              res.rows[i].processId == deptProcessList.value[item].processId
+            ) {
+              res.rows[i].deptProcessStatus = true;
+            }
+          }
+          console.log(res.rows[i].deptProcessStatus);
+        }
+        dayworkItemList.value = res.rows;
+        getProcess();
+        itemTotal.value = res.total;
+        dayworkItemLoading.value = false;
+      });
+    }
+  );
+}
+//工序信息
+function getProcess() {
+  //工序下拉框
+  getProcessList({
+    technologicalProcessId: queryItemParams.value.technologicalProcessId,
+    isWasteRecycling: currentDaywork.value.isWasteRecycling,
+    isAmend: currentDaywork.value.isAmend,
+    lotId: currentDaywork.value.lotId,
+  }).then((res) => {
+    processList.value = res.data;
+  });
+}
+
+/** 搜索按钮操作 */
+function handleQuery() {
+  getDayworks();
+}
+
+onMounted(() => {
+  getList();
+});
+</script>
+<style scoped>
+.el-form--inline .el-form-item {
+  margin-right: 20px;
+}
+</style>

+ 779 - 0
src/views/business/dayworkSelect/sortForm.vue

@@ -0,0 +1,779 @@
+<template>
+  <!-- 添加或修改项目信息对话框 -->
+  <el-drawer
+    v-model="visible"
+    size="80%"
+    direction="rtl"
+    :close-on-press-escape="false"
+  >
+    <div class="page-container form-container">
+      <div class="form-btns-container">
+        <span class="title-label"
+          ><el-icon>
+            <Document />
+          </el-icon>
+          报工详情</span
+        >
+        <el-button icon="Close" @click="handleCancel">取 消 </el-button>
+      </div>
+      <!-- 主表 -->
+      <el-form
+        ref="dayworkItemRef"
+        class="master-container"
+        :model="form"
+        :rules="rules"
+        :show-message="true"
+      >
+        <el-row :gutter="20">
+          <el-col :span="7">
+            <el-form-item label="开始时间:" prop="startTime">
+              <el-date-picker
+                v-model="form.startTime"
+                :disabled="true"
+                type="datetime"
+                value-format="YYYY-MM-DD HH:mm:ss "
+                :clearable="false"
+                :editable="false"
+                placeholder="请选择开始时间"
+                @change="handleTotalTime"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="9">
+            <el-form-item
+              label="工序名称:"
+              prop="processId"
+              label-width="90px"
+            >
+              <el-select-v2
+                v-model="form.processId"
+                clearable
+                :disabled="true"
+                :options="processList"
+                placeholder="请选择工序"
+                style="width: 220px"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="生产状态:" prop="status" align="center">
+              <el-select
+                v-model="form.status"
+                placeholder="请选择生产状态"
+                :disabled="true"
+                style="width: 220px"
+                @change="handleChangeStatus"
+              >
+                <el-option
+                  v-for="dict in dynamicOptions"
+                  :key="dict.value"
+                  :label="dict.label"
+                  :value="dict.value"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="7">
+            <el-form-item label="结束时间:" prop="endTime">
+              <el-date-picker
+                v-model="form.endTime"
+                :disabled="true"
+                type="datetime"
+                value-format="YYYY-MM-DD HH:mm:ss "
+                :editable="false"
+                :clearable="false"
+                placeholder="请选择结束时间"
+                @change="handleTotalTime"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="9">
+            <el-form-item label="操作者:" prop="nickName" label-width="82px">
+              <el-input
+                v-model.trim="form.nickName"
+                placeholder="请输入操作者"
+                :disabled="true"
+                readonly
+                :clearable="true"
+                style="width: 220px; margin-left: 8px"
+              >
+                <template #append>
+                  <el-button icon="Search" @click="handleSelectUserSingle" />
+                </template>
+              </el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="投产量:" prop="prodNum" label-width="82px">
+              <el-input-number
+                v-model.trim="form.prodNum"
+                :disabled="true"
+                :precision="0"
+                controls-position="right"
+                style="width: 220px"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="7">
+            <el-form-item
+              label="总工时:"
+              prop="workingHoursTime"
+              label-width="82px"
+            >
+              <el-input
+                v-model.trim="workingHoursTime"
+                :disabled="true"
+                style="width: 220px; margin-left: 0px"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="9">
+            <el-form-item
+              label="合格数:"
+              prop="qualifiedNum"
+              label-width="90px"
+              style="padding-right: 0px"
+            >
+              <el-input-number
+                v-model.trim="form.qualifiedNum"
+                :disabled="true"
+                :precision="0"
+                controls-position="right"
+                style="width: 220px"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item
+              label="设备:"
+              prop="equipmentDetailId"
+              label-width="82px"
+            >
+              <el-select-v2
+                v-model="form.equipmentDetailId"
+                :disabled="true"
+                :options="equipmentList"
+                placeholder="请选择设备"
+                style="width: 220px"
+              >
+              </el-select-v2>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <!-- 搜索区域 -->
+      <el-form class="list-search-container" :inline="true">
+        <el-form-item class="section-title" label="废品信息" />
+      </el-form>
+      <!-- 列表区 -->
+      <div class="el-table-container">
+        <el-table
+          ref="dayworkItemRejectTable"
+          v-loading="loading"
+          row-key="id"
+          :data="form.groupRejectList"
+          height="100%"
+        >
+          <el-table-column type="index" label="行号" width="60" align="center">
+            <template #default="scope">
+              {{ scope.$index + 1 }}
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="type"
+            label="分选检查类型"
+            align="center"
+            width="150px"
+          >
+            <template #default="scope">
+              <el-select
+                v-model="scope.row.type"
+                :disabled="true"
+                placeholder="请选择分选检查类型"
+                @change="(arg) => handleChangeType(scope.row, arg)"
+              >
+                <el-option
+                  v-for="cause in sort_standard_type"
+                  :key="cause.value"
+                  :label="cause.label"
+                  :value="cause.value"
+                ></el-option>
+              </el-select>
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="sortStandard"
+            label="分选检查标准"
+            align="center"
+            width="300px"
+          >
+            <template #default="scope">
+              <el-select
+                v-model="scope.row.sortStandard"
+                :disabled="true"
+                placeholder="请选择分选检查标准"
+              >
+                <el-option
+                  v-for="cause in scope.row.standardList"
+                  :key="cause.value"
+                  :label="cause.label"
+                  :value="cause.value"
+                ></el-option>
+              </el-select>
+            </template>
+          </el-table-column>
+          <el-table-column prop="reason" label="检查结果" align="center">
+            <template #default="scope">
+              <el-input
+                v-model.trim="scope.row.reason"
+                placeholder="请输入检查结果"
+                :disabled="true"
+                :clearable="true"
+                style="margin-left: 8px"
+              />
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="废品数量"
+            width="200px"
+            prop="rejectNum"
+            align="center"
+          >
+            <template #default="scope">
+              <el-input-number
+                v-model.trim="scope.row.rejectNum"
+                placeholder="废品数量"
+                :disabled="true"
+                :precision="0"
+                :min="0"
+                controls-position="right"
+              />
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+    </div>
+  </el-drawer>
+</template>
+<script setup>
+import {
+  getProcessList,
+  getDayworkItemRejectList,
+  updateDayworkItemInfoForNum,
+  getEquipmentInfo,
+  getIsFirstOrder,
+} from "@/api/business/daywork.js";
+import { listInspectionInstruction } from "@/api/business/productInspectionInstruction.js";
+import { ref } from "vue";
+
+const { proxy } = getCurrentInstance();
+const emit = defineEmits(["handleSaveSuccess"]);
+/** 字典 */
+const { daywork_status_edit } = proxy.useDict("daywork_status_edit");
+const { daywork_status_first } = proxy.useDict("daywork_status_first");
+const { daywork_status_second } = proxy.useDict("daywork_status_second");
+const { sort_standard_type } = proxy.useDict("sort_standard_type");
+const detailInfo = ref({});
+const loading = ref(false);
+const processList = ref([]);
+const lotId = ref(null);
+const equipmentList = ref([]);
+const isFirst = ref(true); //是否为首序
+const visible = ref(false);
+const editStatus = ref(false);
+const currentDept = ref(false);
+const rejectAmount = ref(0);
+const dynamicOptions = ref([]);
+const workingHoursTime = ref("");
+const maxQuailifiedNum = ref(0);
+const sortProductInspection = ref([]);
+const detailsRow = {
+  id: null,
+  type: null,
+  rejectNum: "",
+  checkResult: "",
+  checkStandard: "",
+};
+// const validateprodNum = (rule, value, callback) => {
+//   if (value <= 0) {
+//     callback(new Error("投产量应大于0"));
+//   } else {
+//     callback();
+//   }
+// };
+const validateWorkingHours = (rule, value, callback) => {
+  if (form.value.workHoursTimestamp < 0) {
+    callback(new Error("结束时间应晚于开始时间"));
+  } else {
+    callback();
+  }
+};
+const validateQualifiedNum = (rule, value, callback) => {
+  const max = maxQuailifiedNum.value;
+  if (value < 0) {
+    callback(new Error("合格数量应大于/等于0"));
+  } else {
+    callback();
+  }
+
+  // else if (
+  //   value > max &&
+  //   detailInfo.value.firstProcessId != form.value.processId
+  // ) {
+  //   callback(new Error("合格数量不应大于投产量的103%,即" + max));
+  // }
+};
+const validateEndTime = (rule, value, callback) => {
+  if (form.value.status > 1) {
+    if (form.value.endTime == null) {
+      callback(new Error("结束时间不能为空"));
+    } else {
+      callback();
+    }
+  } else {
+    if (form.value.endTime != null) {
+      callback(new Error("该状态结束时间应为空"));
+    } else {
+      callback();
+    }
+  }
+};
+const validateStartTime = (rule, value, callback) => {
+  if (form.value.status > 1) {
+    if (form.value.startTime == null) {
+      callback(new Error("开始时间不能为空"));
+    } else {
+      callback();
+    }
+  } else {
+    callback();
+  }
+};
+const data = reactive({
+  form: {
+    groupRejectList: [],
+    nickName: "",
+    processId: "",
+    processAlias: "",
+    prodNum: 0,
+    qualifiedNum: 0,
+    rejectNum: 0,
+    startTime: "",
+    endTime: "",
+    workingHours: 0,
+    status: "",
+    workHoursTimestamp: 0,
+  },
+  rules: {
+    // prodNum: [
+    //   { required: true, message: "投产量不能为空", trigger: "blur" },
+    //   { validator: validateprodNum, trigger: "blur" },
+    // ],
+    startTime: [{ validator: validateStartTime, trigger: "blur" }],
+    endTime: [{ validator: validateEndTime, trigger: "blur" }],
+    workingHoursTime: [{ validator: validateWorkingHours, trigger: "change" }],
+    qualifiedNum: [
+      { required: true, message: "合格数量不能为空", trigger: "blur" },
+      { validator: validateQualifiedNum, trigger: "blur" },
+    ],
+  },
+});
+
+const { form, rules } = toRefs(data);
+/***********************  方法区  ****************************/
+/** 打开抽屉 */
+const open = (row) => {
+  reset();
+  loading.value = true;
+  if (row.id) {
+    //查询是否为首序
+    getIsFirstOrder(row.dayworkId).then((res) => {
+      isFirst.value = res.data.isFirstOrder;
+    });
+    lotId.value = row.lotId;
+    //页面操作是编辑还是删除
+    console.log("row", row);
+    detailInfo.value = proxy.deepClone(row);
+    console.log(detailInfo.value);
+    //是否是当前工序
+    currentDept.value = row.currentDept;
+    form.value.id = row.id;
+    form.value.startTime = row.startTime;
+    form.value.endTime = row.endTime;
+    workingHoursTime.value = row.workingHours;
+    form.value.nickName = row.nickName;
+    form.value.status = row.status;
+    editStatus.value = row.status < 2 ? false : true;
+    form.value.processId = row.processId;
+    form.value.productId = row.productId;
+    form.value.technologyVersion = row.technologyVersion;
+    form.value.productionPlanNo = row.productionPlanNo;
+    form.value.productDescription = row.productDescription;
+    form.value.lotCode = row.lotCode;
+    form.value.productionPlanDetailId = row.productionPlanDetailId;
+    if (form.value.status == 0 || form.value.status == 1) {
+      dynamicOptions.value = daywork_status_first.value;
+    } else if (form.value.status == 2 || form.value.status == 3) {
+      dynamicOptions.value = daywork_status_edit.value;
+    } else {
+      dynamicOptions.value = daywork_status_second.value;
+    }
+    form.value.qualifiedNum = row.qualifiedNum;
+    //合格数最大能修改数值
+    maxQuailifiedNum.value = row.maxQuailifiedNum;
+    form.value.workHoursTimestamp = 0;
+    form.value.prodNum = row.prodNum;
+    // technologicalProcessId: row.technologicalProcessId
+    getProcessList({
+      technologicalProcessId: row.technologicalProcessId,
+      isAmend: row.isAmend,
+      isWasteRecycling: row.isWasteRecycling,
+      lotId: row.lotId,
+    }).then((res) => {
+      processList.value = res.data;
+      for (let i = 0; i < processList.value.length; i++) {
+        if (processList.value[i].label === row.processAlias.trim()) {
+          form.value.processId = processList.value[i].value;
+        }
+      }
+    });
+
+    //查询该工序的分选标准
+    listInspectionInstruction({
+      productId: form.value.productId,
+      processId: form.value.processId,
+      technologyVersion: form.value.technologyVersion,
+    }).then((res) => {
+      if (res.code == 200) {
+        sortProductInspection.value = res.rows;
+        //查询废品原因
+        handleQueryReject();
+      }
+    });
+    //查询能够选择的设备信息
+    let productionPlanDetailId = parseInt(row.productionPlanDetailId);
+    getEquipmentInfo({
+      commonCode: row.userName,
+      productionPlanDetailId: productionPlanDetailId,
+      dayworkItemId: row.id,
+      deptId: row.deptId,
+    }).then((equipmentRef) => {
+      if (equipmentRef.code == 200) {
+        if (equipmentRef.rows.length > 0) {
+          equipmentList.value = equipmentRef.rows;
+          for (let i = 0; i < equipmentList.value.length; i++) {
+            if (row.equipmentDetailCode == equipmentList.value[i].label) {
+              form.value.equipmentDetailId = equipmentList.value[i].value;
+            }
+          }
+        } else {
+          equipmentList.value = [];
+        }
+      }
+    });
+    loading.value = false;
+    visible.value = true;
+  }
+};
+/**
+ * 对话框关闭 事件
+ */
+function close() {
+  reset();
+  visible.value = false;
+}
+
+function handleSelectUserSingle() {}
+
+/** 表单重置 */
+function reset() {
+  form.value = {
+    groupRejectList: [],
+    nickName: "",
+    processId: null,
+    processAlias: "",
+    prodNum: 0,
+    qualifiedNum: 0,
+    rejectNum: 0,
+    startTime: "",
+    endTime: "",
+    workingHours: 0,
+  };
+  proxy.resetForm("dayworkItemRef");
+}
+
+/** 提交按钮 */
+const handleSave = () => {
+  proxy.$refs["dayworkItemRef"].validate((valid) => {
+    if (valid) {
+      console.log(form.value.groupRejectList);
+      rejectAmount.value = 0;
+      var reasonList = [];
+      var flag = true;
+      //判断工序是否是尾序
+      var lastProcess = false;
+      if (
+        form.value.processId ==
+        processList.value[processList.value.length - 1].value
+      ) {
+        lastProcess = true;
+      }
+      if (lastProcess) {
+        if (form.value.status > 3) {
+          flag = false;
+          proxy.$modal.msgError("尾序不能选择该状态");
+        }
+      }
+      //判断这个item是否能选择工序已完成
+      if (detailInfo.value.processFinish && form.value.status == 3) {
+        flag = false;
+        proxy.$modal.msgError("该道序状态已有工序已完成");
+      }
+      for (let i = 0; i < form.value.groupRejectList.length; i++) {
+        rejectAmount.value += form.value.groupRejectList[i].rejectNum;
+        if (form.value.groupRejectList[i].rejectNum <= 0) {
+          flag = false;
+          proxy.$modal.msgError("第" + (i + 1) + "废品数应大于0");
+          return;
+        }
+        if (!form.value.groupRejectList[i].sortStandard) {
+          flag = false;
+          proxy.$modal.msgError("第" + (i + 1) + "行分选检查标准不能为空");
+
+          return;
+        }
+        if (
+          reasonList.indexOf(form.value.groupRejectList[i].sortStandard) >= 0
+        ) {
+          flag = false;
+          proxy.$modal.msgError(
+            "第" +
+              (i + 1) +
+              "行分选检查标准与" +
+              (reasonList.indexOf(form.value.groupRejectList[i].sortStandard) +
+                1) +
+              "行相同"
+          );
+          return;
+        }
+        reasonList.push(form.value.groupRejectList[i].sortStandard);
+      }
+      if (rejectAmount.value > form.value.prodNum) {
+        flag = false;
+        proxy.$modal.msgError(
+          "废品总数不能超过投产数,当前废品总数为" + rejectAmount.value
+        );
+      }
+      form.value.workingHours = form.value.workHoursTimestamp;
+      //设备id和code
+      for (let i = 0; i < equipmentList.value.length; i++) {
+        if (form.value.equipmentDetailId == equipmentList.value[i].value) {
+          form.value.equipmentDetailCode = equipmentList.value[i].label;
+        }
+      }
+      if (flag) {
+        if (form.value.groupRejectList.length > 0) {
+          form.value.rejectNum = 0;
+          form.value.groupRejectList.forEach((item) => {
+            item.deptId = detailInfo.value.deptId;
+            item.inspectionInstructionId = item.sortStandard;
+            let checkStandard = item.standardList.filter(
+              (info) => info.value == item.sortStandard
+            )[0];
+            console.log(checkStandard);
+            item.checkStandard = checkStandard.label;
+            item.processId = detailInfo.value.processId;
+            //计算废品总数
+            form.value.rejectNum += item.rejectNum;
+          });
+        }
+        console.log("rejectList", form.value.groupRejectList);
+        form.value.dayworkId = detailInfo.value.dayworkId;
+
+        //同工序的所有合格数
+        form.value.temporaryProcessQualifiedNum =
+          detailInfo.value.totalQuailifiedNum + form.value.qualifiedNum;
+        //如果状态从工序已完成改成结束报工,传给后端一个标记,如果为true,则删除中间表对应的数据
+        if (detailInfo.value.status == 3 && form.value.status == 2) {
+          form.value.dayworkId = detailInfo.value.dayworkId;
+          form.value.flag = true;
+        }
+        let data = form.value;
+        data.lotId = lotId.value;
+
+        const max = maxQuailifiedNum.value;
+        let sunm =
+          detailInfo.value.totalQuailifiedNum + form.value.qualifiedNum; //计算总合格数
+        let num = sunm - form.value.prodNum; //多出来的数量
+        let percent = (sunm / form.value.prodNum) * 100; //合格率
+        percent = Math.ceil(percent * 100) / 100; //只入不舍
+        //判断是否超过投产量
+        if (sunm > form.value.prodNum) {
+          //判断是否为首序
+          if (isFirst.value) {
+            // 弹出确认对话框
+            proxy.$modal
+              .confirm(
+                "合格数为投产量" +
+                  percent +
+                  "%,超出投产量" +
+                  num +
+                  "。 是否继续保存!"
+              )
+              .then(function () {
+                updateDayworkItem();
+              })
+              .then(() => {
+                return;
+              })
+              .catch(() => {
+                return;
+              });
+          } else {
+            if (form.value.qualifiedNum <= max) {
+              updateDayworkItem();
+            } else {
+              proxy.$modal.msgError(
+                "合格数不能超过投产量的103%,最大合格数为" + max
+              );
+            }
+          }
+        } else {
+          updateDayworkItem();
+        }
+      }
+    }
+  });
+};
+
+//页面提交方法
+function updateDayworkItem() {
+  updateDayworkItemInfoForNum(form.value).then((res) => {
+    if (res.code == 200) {
+      proxy.$modal.msgSuccess("保存成功!");
+      visible.value = false;
+      emit("handleSaveSuccess");
+    } else {
+      proxy.$modal.msgError("保存失败!");
+    }
+  });
+}
+
+//删除废弃信息
+function handleDeleteReject(row) {
+  form.value.groupRejectList.splice(form.value.groupRejectList.indexOf(row), 1);
+}
+//查询废品信息
+function handleQueryReject() {
+  getDayworkItemRejectList({ dayworkItemId: detailInfo.value.id }).then(
+    (response) => {
+      if (response.code == 200) {
+        for (let i = 0; i < response.data.length; i++) {
+          response.data[i].rejectNum = parseInt(response.data[i].rejectNum);
+          response.data[i].type = response.data[i].type + "";
+          if (sortProductInspection.value.length > 0) {
+            response.data[i].standardList = sortProductInspection.value
+              .filter((item) => response.data[i].type == item.type)
+              .map((item) => {
+                return {
+                  value: item.inspectionInstructionId,
+                  label: item.standard,
+                };
+              });
+            response.data[i].sortStandard = response.data[
+              i
+            ].standardList.filter(
+              (item) => response.data[i].checkStandard == item.label
+            )[0].value;
+            console.log(response.data[i].sortStandard);
+          }
+        }
+        form.value.groupRejectList = response.data;
+      }
+    }
+  );
+}
+
+//添加废弃信息
+function handleAddReject() {
+  const newDetail = JSON.parse(JSON.stringify(detailsRow));
+  newDetail.rejectNum = 0;
+  newDetail.dayworkId = detailInfo.value.dayworkId;
+  newDetail.dayworkItemId = detailInfo.value.id;
+  newDetail.lotId = detailInfo.value.lotId;
+  form.value.groupRejectList.push(newDetail);
+}
+
+//计算总工时
+function handleTotalTime() {
+  if (form.value.endTime == null) {
+    workingHoursTime.value = "0小时0分钟0秒";
+    form.value.workHoursTimestamp = 0;
+  } else {
+    form.value.workHoursTimestamp =
+      new Date(form.value.endTime) - new Date(form.value.startTime);
+    let seconds = Math.floor((form.value.workHoursTimestamp / 1000) % 60);
+    let minutes = Math.floor(
+      (form.value.workHoursTimestamp / (1000 * 60)) % 60
+    );
+    let hours = Math.floor(form.value.workHoursTimestamp / (1000 * 60 * 60));
+    let time = `${hours}小时${minutes}分钟${seconds}秒`;
+    workingHoursTime.value = time;
+  }
+}
+
+//当生产状态为未开始、生产中时,结束时间为空,合格数为0,废弃信息为空
+function handleChangeStatus() {
+  if (form.value.status == 1) {
+    form.value.endTime = null;
+    workingHoursTime.value = "0小时0分钟0秒";
+    form.value.workingHours = 0;
+    form.value.groupRejectList = [];
+    form.value.qualifiedNum = 0;
+  }
+  if (form.value.status == 0) {
+    form.value.endTime = null;
+    form.value.startTime = null;
+    workingHoursTime.value = "0小时0分钟0秒";
+    form.value.workingHours = 0;
+    form.value.groupRejectList = [];
+    form.value.qualifiedNum = 0;
+    form.value.equipmentDetailId = null;
+    form.value.equipmentDetailCode = null;
+  }
+}
+
+function handleChangeType(row, arg) {
+  row.checkStandard = null;
+  if (sortProductInspection.value.length > 0) {
+    row.standardList = sortProductInspection.value
+      .filter((item) => row.type == item.type)
+      .map((item) => {
+        return { value: item.inspectionInstructionId, label: item.standard };
+      });
+    row.sortStandard = row.standardList.filter(
+      (item) => row.checkStandard == item.label
+    )[0];
+  }
+}
+
+/** 取消按钮 */
+const handleCancel = () => {
+  visible.value = false;
+  reset();
+};
+
+/** 暴露给父组件的方法 */
+defineExpose({
+  open,
+});
+</script>
+<style scoped>
+.el-select-v2__placeholder {
+  display: flex !important;
+}
+</style>

+ 524 - 0
src/views/business/outsourceBalanceAccounts/index.vue

@@ -0,0 +1,524 @@
+<template>
+  <div class="page-container column-container">
+    <div
+      style="position: absolute;  top: 0;  bottom: 0;  left: 0;  right: 0;z-index: 10; background-color: rgba(255, 255, 255, 0.5);"
+      v-if="showMask"></div>
+    <el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true">
+      <el-form-item label="结算日期:">
+        <el-date-picker v-model="queryParams.checkoutDate" type="date" value-format="YYYY-MM-DD" :clearable="true"
+          placeholder="结算日期" style="width: 130px" @change="handleDateChange" />
+      </el-form-item>
+      <el-form-item label="结束日期:">
+        <el-date-picker v-model="queryParams.endDate" type="date" value-format="YYYY-MM-DD" :clearable="true"
+          placeholder="结束日期" style="width: 130px" :disabled-date="(arg) => disabledDateHandler(arg, 'endDate')" />
+      </el-form-item>
+      <el-form-item label="结算月:">
+        <el-date-picker v-model="form.checkMonth" type="month" value-format="YYYY-MM-01" format="YYYY年MM月"
+          :clearable="true" placeholder="结算月" style="width: 130px" readonly />
+      </el-form-item>
+      <el-form-item label="外协单位:">
+        <el-input v-model.trim="queryParams.supplierName" placeholder="外协单位" style="width: 130px" />
+      </el-form-item>
+      <el-form-item label="结算状态:">
+        <el-select v-model="queryParams.status" placeholder="结算状态" style="width: 130px">
+          <el-option v-for="dict in outsource_checkout_status" :key="dict.value" :label="dict.label"
+            :value="dict.value" />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="info" icon="Search" @click="handleQuery">搜索</el-button>
+      </el-form-item>
+    </el-form>
+    <!-- 功能按钮区 -->
+    <div class="list-btns-container">
+      <!-- <el-button type="primary" icon="DocumentChecked" @click="handleSave"
+        v-hasPermi="['business:balanceAccount:save']">
+        保存
+      </el-button> -->
+      <el-button type="success" icon="Plus" @click="handleBalance" v-hasPermi="['business:balanceAccount:confirm']">
+        结算
+      </el-button>
+      <el-button type="primary" icon="Select" @click="handleCheckAll">
+        全选
+      </el-button>
+      <el-button type="info" icon="Close" @click="handleDisbalance" v-hasPermi="['business:balanceAccount:cancel']">
+        取消结算
+      </el-button>
+      <el-button type="warning" icon="Download" @click="handleExport" v-hasPermi="['business:balanceAccount:export']">
+        导出
+      </el-button>
+    </div>
+    <!-- 渲染数据区 -->
+    <div class="el-table-container" style="flex-basis: 1;">
+      <div class="el-table-inner-container">
+        <vxe-table ref="tableRef" border height="100%" :loading="loading" size="small" :row-config="{ isHover: true }"
+          :data="tableData" :checkbox-config="{ highlight: true }" :scroll-y="{ enabled: true }" show-overflow
+          :column-config="{ resizable: true }" keep-source :filter-config="{ showIcon: false }"
+          :edit-config="{ trigger: 'click', mode: 'row', showStatus: true, beforeEditMethod: beforeEditCheck, showIcon: false }"
+          @checkbox-change="handleSelectChange" @checkbox-all="handleCheckAllChange" @edit-closed="handleEditClosed">
+          <vxe-column type="checkbox" width="50" align="center"></vxe-column>
+          <vxe-column field="supplierName" title="外协商简称" align="center" width="110">
+          </vxe-column>
+          <vxe-column field="outsourceNo" title="发出单号" align="center" width="120">
+          </vxe-column>
+          <vxe-column field="lotCode" title="批次号" align="center" width="120">
+          </vxe-column>
+          <vxe-column field="productDescription" title="产品描述" align="center" width="220">
+          </vxe-column>
+          <vxe-column field="processAlias" title="工序名称" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="status" title="状态" align="center" width="100">
+            <template #default="scope">
+              <div>{{ scope.row.status === 0 ? '已审核' : '已结算' }}</div>
+            </template>
+          </vxe-column>
+          <vxe-colgroup title="工序单价" align="center">
+            <template #header="scope">
+              <div><el-icon>
+                  <Edit />
+                </el-icon>工序单价</div>
+            </template>
+            <vxe-column field="processPrice" align="center" :filters="processOptions" :edit-render="{}"
+              :filter-method="processPriceFilterMethod" width="100">
+              <template #header="{ column }">
+                <vxe-select v-for="(option, index) in column.filters" :key="index" v-model="option.data"
+                  :options="priceFilterList" @change="confirmFilterEvent(option)" placeholder="请选择" transfer
+                  style="width: 100%;"></vxe-select>
+              </template>
+              <template #edit="scope">
+                <el-input-number v-model="scope.row.processPrice" :controls="false" :min="0" :precision="4"
+                  style="width: 100%;" @blur="handleBlur(scope.row)" />
+              </template>
+            </vxe-column>
+          </vxe-colgroup>
+          <!-- <vxe-column field="processPrice" title="工序单价" align="center" :edit-render="{}" width="100">
+            <template #edit="scope">
+              <el-input-number v-model="scope.row.processPrice" :controls="false" :min="0" :precision="4"
+                style="width: 100%;" @blur="handleBlur(scope.row)" />
+            </template>
+          </vxe-column> -->
+          <vxe-column field="otherCost" title="其他扣款" align="center" :edit-render="{}" width="100">
+            <template #header="scope">
+              <div><el-icon>
+                  <Edit />
+                </el-icon>其他扣款</div>
+            </template>
+            <template #edit="scope">
+              <el-input-number v-model="scope.row.otherCost" :controls="false" :min="0" :precision="4"
+                style="width: 100%;" @blur="handleBlur(scope.row)" />
+            </template>
+          </vxe-column>
+          <vxe-column field="fillDifferencePrice" title="差补额" align="center" :edit-render="{}" width="100">
+            <template #header="scope">
+              <div><el-icon>
+                  <Edit />
+                </el-icon>补差额</div>
+            </template>
+            <template #edit="scope">
+              <el-input-number v-model="scope.row.fillDifferencePrice" :controls="false" :min="0" :precision="4"
+                style="width: 100%;" @blur="handleBlur(scope.row)" />
+            </template>
+          </vxe-column>
+          <vxe-column field="productNum" title="投入数量" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="outputNum" title="发出数量" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="receiptNum" title="收回数量" align="center" width="100">
+          </vxe-column>
+          <vxe-colgroup title="实投料量" align="center">
+            <vxe-column field="actualInventory" :filters="InventoryOptions" align="center"
+              :filter-method="actualInventoryFilterMethod" width="100">
+              <template #header="{ column }">
+                <vxe-select v-for="(option, index) in column.filters" :key="index" v-model="option.data"
+                  :options="actualInventoryList" @change="confirmFilterEvent(option)" placeholder="请选择" transfer
+                  style="width: 100%;"></vxe-select>
+              </template>
+            </vxe-column>
+          </vxe-colgroup>
+          <!-- <vxe-column field="actualInventory" title="实投料量" align="center" width="100">
+          </vxe-column> -->
+          <vxe-column field="materialLoss" title="料损数量" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="materialLossAmount" title="扣料金额" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="planAmount" title="应得金额" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="acutalAmount" title="实得金额" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="taxAmount" title="含税金额" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="freightAmount" title="运费" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="materialPrice" title="材料单价" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="salePrice" title="销售单价" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="wastePrice" title="废品单价" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="carrierNum" title="箱数" align="center" width="100">
+          </vxe-column>
+          <!-- 该序号是工序的的序号 -->
+          <vxe-column field="processSort" title="序号" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="processCode" title="工序代码" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="checkoutDate" title="结算日期" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="auditDate" title="审核日期" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="returnDate" title="收回日期" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="returnNo" title="收回单号" align="center" width="120">
+          </vxe-column>
+          <vxe-column field="settlementType" title="结算方式" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="furnaceNum" title="炉数" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="checkDate" title="检查日期" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="supplierCode" title="外协单位码" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="inspectionNo" title="检查单号" align="center" width="130">
+          </vxe-column>
+          <vxe-column field="productCode" title="产品编码" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="materialLossRatio" title="料损率" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="surfaceTreatment" title="表面" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="length" title="长度" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="materialDiameter" title="材料直径" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="tolerance" title="公差" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="utilizationRatio" title="利用率" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="currency" title="币别" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="taxRate" title="税率" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="year" title="结算年" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="month" title="结算月" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="wastePriceCategory" title="废品价类别" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="rawMaterialCode" title="材料编码" align="center" width="140">
+          </vxe-column>
+          <vxe-column field="density" title="密度" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="shape" title="形状" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="type" title="类别" align="center" width="100">
+          </vxe-column>
+        </vxe-table>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script setup>
+import { ref } from 'vue'
+// import region from '@/utils/region.js'
+import { listBalanceAccount, checkout, discheckout, saveBatchBalanceAccount, updateBalanceAccount } from '@/api/business/outsourceBalanceAccount'
+import { listOutsourceBalanceMonth } from '@/api/business/outsourceBalanceMonth.js'
+const { proxy } = getCurrentInstance();
+const tableData = ref([])
+const tableRef = ref(null)
+const selected = ref([])
+const loading = ref(false)
+const total = ref(0)
+let rows = []
+const form = ref({
+  checkMonth: null
+})
+const processOptions = ref([{
+  data: ''
+}])
+const InventoryOptions = ref([{
+  data: ''
+}])
+const priceFilterList = ref([
+  { label: '全部', value: '' },
+  { label: '有价', value: '1' },
+  { label: '无价', value: '0' }
+])
+const actualInventoryList = ref([
+  { label: '全部', value: '' },
+  { label: '大于0', value: '1' },
+  { label: '小于等于0', value: '0' }
+])
+const showMask = ref(true)
+const balanceMonth = ref(null)
+
+// const { outsource_checkout_status } = proxy.useDict("outsource_checkout_status");
+const outsource_checkout_status = ref([{
+  label: '全部', value: ''
+}, {
+  label: '已审核', value: 0
+}, {
+  label: '已结算', value: 1
+}])
+
+const queryParams = ref({
+  pageSize: 5000,
+  pageNum: 0
+})
+const checkBalanceAccount = () => {
+  // 判断是否有结算月,假设未设置则显示遮罩层
+  listOutsourceBalanceMonth({}).then(res => {
+    if (res.rows.length == 0) {
+      proxy.$modal.msgError('未进设置外协月结期间不能进行结算')
+      showMask.value = true
+    } else {
+      balanceMonth.value = res.rows[0]
+      showMask.value = false
+    }
+    // showMask.value = true
+  }).catch(_ => {
+  })
+}
+const getList = () => {
+  listBalanceAccount(queryParams.value).then(res => {
+    tableData.value = res.rows
+    total.value = res.total
+  })
+}
+const getListAll = () => {
+  // 每次查500条,直到查齐
+  queryParams.value.pageNum++
+  listBalanceAccount(queryParams.value).then(res => {
+    rows.push(...res.rows)
+    total.value = res.total
+    if (rows.length < total.value) {
+      getListAll()
+    } else {
+      tableData.value.push(...rows)
+      loading.value = false
+    }
+  })
+}
+const handleQuery = () => {
+  // 判断假设没有结算日期则提示选择结算日期
+  if (queryParams.value.checkoutDate == null) {
+    proxy.$modal.msgError('请选择结算日期')
+    return
+  }
+  queryParams.value.pageNum = 0
+  tableData.value = []
+  rows = []
+  loading.value = true
+  getListAll()
+}
+const changeCellEvent = (params) => {
+  const $table = tableRef.value
+  if ($table) {
+    $table.updateStatus(params)
+  }
+  // console.log(tableData.value)
+}
+
+const handleBalance = () => {
+  if (selected.value.length == 0) {
+    proxy.$modal.msgError('请选择结算单')
+    return
+  }
+  if (form.value.checkMonth == null) {
+    proxy.$modal.msgError('请选择结算月份')
+    return
+  }
+  // 判断已选择结算单是否已经结算,已经结算则不能再次结算。
+  if (selected.value.some(e => e.status == 1)) {
+    proxy.$modal.msgError('选中结算单存在已结算')
+    return
+  }
+  selected.value.forEach(item => {
+    item.year = proxy.moment(form.value.checkMonth).format('YYYY')
+    item.month = proxy.moment(form.value.checkMonth).format('MM')
+    item.checkoutDate = queryParams.value.checkoutDate
+  })
+  checkout(selected.value).then(res => {
+    proxy.$modal.msgSuccess('结算成功')
+    handleQuery()
+  })
+}
+
+const handleDisbalance = () => {
+  if (selected.value.length == 0) {
+    proxy.$modal.msgError('请选择要取消的结算单')
+    return
+  }
+  selected.value.forEach(item => {
+    item.year = ''
+    item.month = ''
+  })
+  // console.log(selected.value.length)
+  if (selected.value.length > 100) {
+    proxy.$modal.msgError('一次只能操作100条数据')
+    return
+  }
+  discheckout(selected.value).then(res => {
+    proxy.$modal.msgSuccess('取消结算成功')
+    handleQuery()
+  })
+}
+
+const handleCheckAll = () => {
+  const $table = tableRef.value
+  if ($table) {
+    $table.setAllCheckboxRow(true)
+    selected.value = $table.getCheckboxRecords(true)
+    // console.log(selected.value)
+  }
+}
+
+const handleExport = () => {
+  const $table = tableRef.value
+  if ($table) {
+    $table.exportData({
+      type: 'xlsx',
+      filename: '外协结算信息'
+    })
+  }
+}
+
+const handleSelectChange = ({ checked, row, rowIndex, records }) => {
+  // console.log('select-one: ', checked, records, row, rowIndex)
+  // selected.value = records
+  // 判断选中的是否是按炉结算假设是按炉结算则同时选中该炉的所有批次
+  const $table = tableRef.value
+  if (row.settlementType == 2 && $table != null) {
+    // console.log(row.outsourceOrderId)
+    const selects = tableData.value.filter(e => e.outsourceOrderId == row.outsourceOrderId)
+    // console.log(selects.length)
+    $table.setCheckboxRow(selects, checked)
+    selected.value = $table.getCheckboxRecords(true)
+    // console.log(selected.value.length)
+  }
+}
+const handleCheckAllChange = ({ checked, records }) => {
+  // console.log('select-all', checked, records)
+  selected.value = records
+}
+
+const handleDateChange = (arg) => {
+  // 获取结算日期的月份自动填入结算月
+  form.value.checkMonth = proxy.moment(arg).format('YYYY-MM-01')
+  // console.log(arg)
+  // console.log(form.value.checkMonth)
+}
+
+const disabledDateHandler = (date, type) => {
+  if (type === 'endDate') {
+    // console.log(queryParams.value.checkoutDate)
+    // console.log(proxy.moment(date).format('MM'), proxy.moment(queryParams.value.checkoutDate).format('MM'))
+    if (queryParams.value.checkoutDate == null || proxy.moment(date).format('MM') != proxy.moment(queryParams.value.checkoutDate).format('MM')) return true
+    else return false
+  }
+}
+
+const handleSave = () => {
+  const params = tableRef.value.getUpdateRecords()
+  // console.log(params)
+  saveBatchBalanceAccount(params).then(res => {
+    proxy.$modal.msgSuccess('保存成功')
+    handleQuery()
+  })
+}
+
+const beforeEditCheck = ({ row }) => {
+  // 判断当结算月小于当前结算期开始日期时不能编辑
+  if (row.checkoutDate != null && proxy.moment(row.checkoutDate).isBefore(balanceMonth.value.startDate)) {
+    return false
+  }
+  return true
+}
+const handleBlur = (params) => {
+  // console.log(params)
+  // 计算应收金额,实收金额
+  let planAmount = 0
+  let acutalAmount = 0
+  let taxAmount = 0
+  if (params.settlementType == 1) {
+    if (params.surfaceTreatment == 'N') {
+      // 没有表面处理
+      if (params.supplierCode == '99024' && params.prouctCode != '99000') {
+        planAmount = (params.outputNum * params.processPrice * (1 + params.taxRate / 100)).toFixed(4)
+      } else {
+        planAmount = (params.receiptNum * params.processPrice * (1 + params.taxRate / 100)).toFixed(4)
+      }
+    } else {
+      // 有表面处理
+      if (params.supplierCode == '99024') {
+        planAmount = (params.outputNum * params.processPrice * (1 + params.taxRate / 100)).toFixed(4)
+      } else {
+        planAmount = (params.receiptNum * params.processPrice * (1 + params.taxRate / 100)).toFixed(4)
+      }
+    }
+  } else {
+    planAmount = (1 * params.processPrice * (1 + params.taxRate / 100)).toFixed(4)
+  }
+  taxAmount = (planAmount - params.otherCost + params.fillDifferencePrice - params.freightAmount - params.materialLossAmount).toFixed(4)
+  acutalAmount = ((planAmount - params.otherCost + params.fillDifferencePrice - params.freightAmount - params.materialLossAmount) / (1 + params.taxRate / 100)).toFixed(4)
+  params.planAmount = planAmount
+  params.acutalAmount = acutalAmount
+  params.taxAmount = taxAmount
+}
+
+const saveRow = (row) => {
+  updateBalanceAccount(row).then(res => {
+    const $table = tableRef.value
+    if (res.code === 200) {
+      // proxy.$modal.msgSuccess('保存成功')
+      if ($table != null) {
+        $table.reloadRow(row, res.data)
+      }
+    } else {
+      proxy.$modal.msgError(res.msg)
+    }
+  })
+}
+
+const processPriceFilterMethod = ({ option, row, column }) => {
+  if (option.data != '') {
+    return option.data == '0' ? row[column.field] <= 0 : row[column.field] > 0
+  }
+  return true
+}
+const actualInventoryFilterMethod = ({ option, row, column }) => {
+  if (option.data != '') {
+    return option.data == '0' ? row[column.field] <= 0 : row[column.field] > 0
+  }
+  return true
+}
+const confirmFilterEvent = (option) => {
+  const $table = tableRef.value
+  if ($table) {
+    // 设置为选中状态
+    option.checked = true
+    // 修改条件之后,需要手动调用 updateData 处理表格数据
+    $table.updateData()
+  }
+}
+const handleEditClosed = (params) => {
+  // console.log(params)
+  const { row, column } = params
+  const field = column.field
+  // 判断是否真有需要保存的部分
+
+  const updates = tableRef.value.getUpdateRecords()
+  console.log(updates)
+  if (updates.length > 0) {
+    saveRow(row)
+  }
+}
+// const handleScroll = (params) => {
+//   // console.log('scroll')
+//   if (params.scrollTop + params.bodyHeight >= params.scrollHeight) {
+//     console.log('已经到底部了')
+//   }
+// }
+checkBalanceAccount()
+// getList()
+</script>

+ 83 - 0
src/views/business/outsourceBalanceMonth/index.vue

@@ -0,0 +1,83 @@
+<template>
+  <div class="page-container column-container">
+    <el-form class="list-search-container" :model="form" ref="queryRef" :inline="true">
+      <el-form-item label="外协结算月设置">
+      </el-form-item>
+      <el-form-item label="开始日期:" style="margin-left: 50px;">
+        <el-date-picker v-model="form.startDate" type="date" value-format="YYYY-MM-DD" :editable="false"
+          :clearable="false" placeholder="结算日期" style="width: 130px" @change="handleDateChange"
+          :disabled-date="(arg) => disabledDateHandler(arg, 'startDate')" />
+      </el-form-item>
+      <el-form-item label="结束日期:">
+        <el-date-picker v-model="form.endDate" type="date" value-format="YYYY-MM-DD" :editable="false"
+          :clearable="false" placeholder="结束日期" style="width: 130px" @change="handleDateChange"
+          :disabled-date="(arg) => disabledDateHandler(arg, 'endDate')" />
+      </el-form-item>
+      <el-form-item style="margin-left: 200px;">
+        <el-button type="primary" @click="setMonth">设置</el-button>
+      </el-form-item>
+    </el-form>
+  </div>
+</template>
+
+<script setup>
+import { ref } from 'vue'
+const { proxy } = getCurrentInstance();
+import { listOutsourceBalanceMonth, saveOutsourceBalanceMonth } from '@/api/business/outsourceBalanceMonth.js'
+
+const form = ref({
+  startDate: null,
+  endDate: null
+})
+
+const getList = () => {
+  listOutsourceBalanceMonth({}).then(res => {
+    if (res.rows.length > 0) {
+      form.value.startDate = res.rows.length > 0 ? res.rows[0].startDate : ''
+      form.value.endDate = res.rows.length > 0 ? res.rows[0].endDate : ''
+    } else {
+      form.value = {
+        startDate: null,
+        endDate: null
+      }
+    }
+  })
+}
+const setMonth = () => {
+  if (form.value.startDate == null || form.value.endDate == null) {
+    proxy.$modal.msgError('请选择开始日期和结束日期')
+    return
+  }
+  proxy.$confirm('确定要设置外协结算月吗?', '提示', {
+    confirmButtonText: '确定',
+    cancelButtonText: '取消',
+    type: 'warning'
+  }).then(res => {
+    saveOutsourceBalanceMonth(form.value).then(res => {
+      if (res.code === 200) {
+        proxy.$modal.msgSuccess('设置成功')
+        getList()
+      }
+    })
+  }).catch(_ => {
+    proxy.$modal.msgError('取消设置')
+  })
+}
+
+const handleDateChange = () => {
+  console.log(form.value.startDate, form.value.endDate)
+}
+
+
+function disabledDateHandler(date, field) {
+  if (field === 'startDate') {
+    if (form.value.endDate != null && date >= proxy.moment(form.value.endDate)) return true
+    else return false
+  } else if (field === 'endDate') {
+    if (form.value.startDate != null && date <= proxy.moment(form.value.startDate)) return true
+    else return false
+  }
+}
+
+getList()
+</script>

+ 209 - 0
src/views/business/outsourceInspectionVerify/index.vue

@@ -0,0 +1,209 @@
+<!-- 外协结算前审核 -->
+<template>
+  <div class="page-container column-container">
+    <!-- 搜索区 -->
+    <el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true">
+      <el-form-item label="单据号:" prop="outsourcedInspectionNo">
+        <el-input v-model="queryParams.outsourcedInspectionNo" placeholder="请输入单据号" style="width: 144px" clearable
+          @keyup.enter="handleQuery" />
+      </el-form-item>
+      <el-form-item label="检查日期:" prop="startTime">
+        <!-- <el-input v-model="queryParams.startTime" placeholder="" style="width: 144px" clearable
+          @keyup.enter="handleQuery" /> -->
+        <el-date-picker v-model="queryParams.startTime" type="date" placeholder="选择日期" style="width: 144px" clearable
+          @keyup.enter="handleQuery" />
+      </el-form-item>
+      <el-form-item label="外协商名称:" prop="supplierName">
+        <el-input v-model="queryParams.supplierName" placeholder="请输入外协商名称" style="width: 144px" clearable
+          @keyup.enter="handleQuery" />
+      </el-form-item>
+      <el-form-item label="批次号:" prop="lotCode">
+        <el-input v-model="queryParams.lotCode" placeholder="请输入批次号" style="width: 144px" clearable
+          @keyup.enter="handleQuery" />
+      </el-form-item>
+      <el-form-item label="状态:" prop="auditStatus">
+        <el-select v-model="queryParams.auditStatus" style="width: 144px" clearable placeholder="请选择">
+          <el-option v-for="dict in outsource_before_checkout_verify_status" :key="dict.value" :label="dict.label"
+            :value="dict.value" />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
+        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <!-- 功能按钮区 -->
+    <!-- <div class="list-btns-container">
+    </div> -->
+
+    <!-- 渲染数据区 -->
+    <div class="el-table-container">
+      <div class="el-table-inner-container">
+        <el-table v-loading="loading" :data="orderList" size="small" border height="100%"
+          @selection-change="handleSelectionChange">
+          <el-table-column type="selection" width="48" align="center" />
+          <el-table-column label="外协单位" align="center" prop="outsourcedOrderDetail.supplierName" width="320" />
+          <el-table-column label="批次号" align="center" prop="lotCode" width="100" />
+          <el-table-column label="产品描述" align="center" prop="productDescription" width="320" />
+          <el-table-column label="质检单号" align="center" prop="outsourcedInspectionNo" width="120" />
+          <el-table-column label="检查状态" align="center" prop="status" width="120">
+            <template #default="scope">
+              <dict-tag :options="process_inspection_status" :value="scope.row.status" />
+            </template>
+          </el-table-column>
+          <el-table-column label="外协工序" align="center" prop="processNames" width="120" />
+          <el-table-column label="外协日期" align="center" prop="outsourcedOrderDetail.formDate" width="120">
+            <template #default="scope">
+              {{ parseTime(scope.row.outsourcedOrderDetail.formDate, "{y}-{m}-{d}") }}
+            </template>
+          </el-table-column>
+          <el-table-column label="发出量" align="center" prop="outsourcedOrderDetail.productNum" width="120" />
+          <el-table-column label="收回日期" align="center" prop="returnReceiptDetail.formDate" width="120" />
+          <el-table-column label="收回量" align="center" prop="returnReceiptDetail.auditNum" width="120" />
+          <el-table-column label="状态" align="center" prop="auditStatus" width="120">
+            <template #default="scope">
+              <dict-tag :options="outsource_before_checkout_verify_status" :value="scope.row.auditStatus" />
+            </template>
+          </el-table-column>
+          <el-table-column label="备注" align="center" prop="remark" />
+          <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
+            <template #default="scope">
+              <el-button v-if="scope.row.auditStatus == 0 || scope.row.auditStatus == 2" link type="warning"
+                icon="Check" @click="handleConfirm(scope.row)" v-hasPermi="['business:beforeCheckoutVerify:edit']">
+                通过
+              </el-button>
+              <el-button v-if="scope.row.auditStatus == 0 || scope.row.auditStatus == 1" link type="primary"
+                icon="Close" @click="handleReject(scope.row)" v-hasPermi="['business:beforeCheckoutVerify:edit']">
+                不通过
+              </el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+    </div>
+
+    <!-- 分页 -->
+    <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
+      v-model:limit="queryParams.pageSize" @pagination="getList" />
+  </div>
+</template>
+
+<script setup name="Order">
+import {
+  listCheckoutInspection,
+  rejectInspection,
+  confirmInspection,
+  checkFurnace
+} from '@/api/business/beforeCheckoutVerify'
+import { nextTick } from "vue";
+const { proxy } = getCurrentInstance();
+/** 字典数组区 */
+const { outsource_before_checkout_verify_status } = proxy.useDict("outsource_before_checkout_verify_status");
+
+const { process_inspection_status } = proxy.useDict("process_inspection_status");
+
+const orderList = ref([]);
+const loading = ref(true);
+const ids = ref([]);
+const single = ref(true);
+const multiple = ref(true);
+const total = ref(0);
+const printCarriers = ref([])
+const webHost = import.meta.env.VITE_APP_PRODUCTION_API;
+/** 查询对象 */
+const queryParams = ref({
+  pageNum: 1,
+  pageSize: 10,
+  formCode: null,
+  formDate: null,
+  startTime: null,
+  endTime: null,
+  supplierName: null,
+  deliveryMethod: null,
+  packagingMethod: null,
+  freightPrice: null,
+  freightAmount: null,
+  isFirstProcess: 0
+});
+
+/***********************  方法区  ****************************/
+
+/** 查询外协单主 带箱方式,是整单的。如果换新箱子,明细中,都需要更换箱子列表 */
+function getList() {
+  loading.value = true;
+  listCheckoutInspection(queryParams.value).then((response) => {
+    orderList.value = response.rows;
+    total.value = response.total;
+    loading.value = false;
+  });
+}
+
+/** 搜索按钮操作 */
+function handleQuery() {
+  queryParams.value.pageNum = 1;
+  getList();
+}
+
+/** 重置按钮操作 */
+function resetQuery() {
+  proxy.resetForm("queryRef");
+  handleQuery();
+}
+
+// 多选框选中数据
+function handleSelectionChange(selection) {
+  ids.value = selection.map((item) => item.id);
+  single.value = selection.length != 1;
+  multiple.value = !selection.length;
+}
+
+function handleConfirm(row) {
+  checkFurnace(row).then(res => {
+    if (res.code === 200) {
+      if (res.data.length === 1) {
+        proxy.$confirm('是否确认通过?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          confirmInspection(res.data).then(res => {
+            getList()
+          })
+        });
+      } else {
+        proxy.$confirm('该炉已全部质检,是否全部确认通过?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          confirmInspection(res.data).then(res => {
+            getList()
+          })
+        });
+      }
+    } else {
+      proxy.$msgError(res.msg)
+    }
+  })
+}
+
+function handleReject(row) {
+  checkFurnace(row).then(res => {
+    if (res.code === 200) {
+      proxy.$confirm('是否确认不通过?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        rejectInspection(res.data).then(res => {
+          getList();
+        })
+      });
+    }
+  })
+}
+
+
+getList();
+</script>

+ 11 - 3
src/views/business/returnReceipt/form.vue

@@ -94,7 +94,7 @@
                     --el-switch-on-color: #13ce66;
                     --el-switch-off-color: #ff4949;
                   " :active-value="1" :inactive-value="0" active-text="已审核" inactive-text="未审核"
-                  :disabled="scope.row.productionDeptId != 0 || (scope.row.processInspecionList && scope.row.processInspecionList.length > 0)"
+                  :disabled="scope.row.productionDeptId != 0 || (scope.row.isApproved === 0 && scope.row.processInspecionList && scope.row.processInspecionList.length > 0)"
                   @change="handleChangeAuditStatus(scope.row)" />
               </template>
             </el-table-column>
@@ -120,6 +120,7 @@ import {
   getReceipt,
   addReceipt,
   updateReceipt,
+  checkFurnace
 } from "@/api/business/returnReceipt";
 import { getP2NeedCheckProcess } from '@/api/business/p2'
 import dialogOutsourceDetails from "./DialogOutsourceDetails";
@@ -261,7 +262,7 @@ function handleChangeAuditStatus(row) {
 }
 /** 提交按钮 */
 function submitForm() {
-  proxy.$refs["formRef"].validate((valid) => {
+  proxy.$refs["formRef"].validate(async (valid) => {
     if (valid) {
       var flag = true;
       var confirmFlag = false;
@@ -303,6 +304,13 @@ function submitForm() {
         flag = false
         proxy.$modal.msgError("收回明细中载具箱号不能为空")
       }
+
+      // 判断是否按炉结算
+      const checkRes = await checkFurnace(form.value.details);
+      if (!checkRes.data) {
+        flag = false
+        proxy.$modal.msgError(checkRes.msg)
+      }
       if (flag) {
         //赋值(因为收回明细是一个批次一条,所以后端传回来两个集合,一个页面显示,一个后端保存)
         handleSetAuditStatus();
@@ -406,7 +414,7 @@ function handleSetAuditStatus() {
 
 function getP2NeedCheck() {
   getP2NeedCheckProcess("Y").then(res => {
-    processList.value = res.row.map(v => v.prcode.trim())
+    processList.value = res.rows.map(v => v.prcode.trim())
   })
 }
 /** 暴露给父组件的方法 */

+ 31 - 4
src/views/business/specialDaywork/form.vue

@@ -669,7 +669,7 @@
               placeholder="请选择载具"
               value-key="value"
               :remote-method="
-                (arg) => remoteCarriers(arg, daywork.dayworkCarriers)
+                (arg) => handleInput(arg, daywork.dayworkCarriers)
               "
               :loading="loadingCarrier"
               @change="(arg) => handleCarrierChange(arg)"
@@ -746,7 +746,18 @@
                   :key="item.userId"
                   :label="item.nickName"
                   :value="item"
-                />
+                >
+                  <span style="float: left">{{ item.nickName }}</span>
+                  <span
+                    style="
+                      float: right;
+                      color: var(--el-text-color-secondary);
+                      font-size: 13px;
+                    "
+                  >
+                    {{ item.userName }}
+                  </span>
+                </el-option>
               </el-select>
               <span v-show="daywork.itemStatus >= 4">
                 {{ scope.row.nickName }}
@@ -918,6 +929,7 @@ import {
 } from "@/api/business/specialDaywork";
 import { getFurnaceNoInfo } from "@/api/business/p2";
 import useUserStore from "@/store/modules/user";
+import { debounce } from "lodash";
 import rejectDialog from "./rejectDialog";
 import processDialog from "./processDialog";
 
@@ -1053,7 +1065,7 @@ function handleFirstSelectProduction(row) {
       daywork.value.productDescription = row.productDescription;
       daywork.value.productionPlanNo = row.productionPlanNo;
       daywork.value.lineNumber = row.lineNumber;
-      getProcessInfo(batchNo.value);
+
       getFurnaceInfo(batchNo.value);
     } else {
       batchNo.value = res.rows[0];
@@ -1161,6 +1173,7 @@ function handleFirstLotClick() {
     .then(function () {
       certainLotInfo(batchNo.value).then((res) => {
         if ((res.code = 200)) {
+          getProcessInfo(batchNo.value);
           // 使用 filter 方法来保留那些 id 等于 specifiedId 的项目
           productList.value = productList.value.filter(
             (item) => item.id === lot.productionPlanDetailId
@@ -1208,12 +1221,18 @@ function getFurnaceInfo(data) {
   });
 }
 
+const debouncedRemoteCarriers = debounce(remoteCarriers, 500);
+
+function handleInput(queryString, choiced) {
+  debouncedRemoteCarriers(queryString, choiced);
+}
+
 /** 报工箱号输入框搜索 */
 function remoteCarriers(queryString, choiced) {
+  console.log("choiced", choiced);
   loadingCarrier.value = true;
   listCarriers({
     isAbandoned: 0,
-    pageSize: 50,
     code: queryString != "" ? queryString : null,
     lotId: daywork.value.lotId,
   }).then((res) => {
@@ -1223,7 +1242,15 @@ function remoteCarriers(queryString, choiced) {
         label: v.code,
         category: v.categoryId,
       }));
+
       if (choiced) {
+        if (choiced.length > 0 && choiced[0].id != undefined) {
+          choiced = choiced.map((v) => ({
+            value: v.carrierId,
+            label: v.carrierCode,
+            category: v.category,
+          }));
+        }
         carriers.value.push(
           ...choiced
             .filter(

+ 15 - 22
src/views/business/specialDaywork/index.vue

@@ -51,20 +51,6 @@
         </el-select>
       </el-form-item>
       <el-form-item class="section-title" label="请选择工段:">
-        <!-- <el-select
-          v-model="queryParams.deptId"
-          clearable
-          placeholder="请选择工段"
-          style="width: 120px"
-          @change="handleDeptChange"
-        >
-          <el-option
-            v-for="dict in deptList"
-            :key="dict.value"
-            :label="dict.label"
-            :value="dict.value"
-          ></el-option>
-        </el-select> -->
         <el-select-v2
           v-model="queryParams.deptId"
           filterable
@@ -186,7 +172,7 @@
             label="产品描述"
             align="center"
             prop="formDate"
-            width="200"
+            min-width="200"
           >
             <template #default="scope">
               {{ scope.row.productionPlanDetail.productDescription }}
@@ -196,7 +182,7 @@
             label="图纸版本"
             align="center"
             prop="formDate"
-            width="120"
+            width="65"
           >
             <template #default="scope">
               {{ scope.row.productionPlanDetail.technologyVersion }}
@@ -229,21 +215,21 @@
             label="投产量"
             align="center"
             prop="prodNum"
-            width="120"
+            width="60"
           >
           </el-table-column>
           <el-table-column
             label="合格量"
             align="center"
             prop="qualifiedNum"
-            width="120"
+            width="60"
           >
           </el-table-column>
           <el-table-column
             label="废品量"
             align="center"
             prop="rejectSum"
-            width="120"
+            width="60"
           >
           </el-table-column>
           <el-table-column
@@ -254,10 +240,17 @@
           >
           </el-table-column>
           <el-table-column
-            label="操作人"
+            label="操作者"
+            align="center"
+            prop="itemNames"
+            width="200"
+          >
+          </el-table-column>
+          <el-table-column
+            label="创建人"
             align="center"
             prop="nickName"
-            width="120"
+            width="80"
           >
           </el-table-column>
 
@@ -446,7 +439,7 @@ function handleNoTurnoverInfo(row) {
 }
 
 function handleDeptChange(arg) {
-  const dept = deptList.value.filter((v) => (v.value = arg));
+  const dept = deptList.value.filter((v) => v.value == arg);
   queryParams.value.deptName = dept[0].label;
   queryParams.value.deptId = dept[0].value;
 }

+ 4 - 1
src/views/business/specialDaywork/rejectDialog.vue

@@ -179,7 +179,6 @@ function reset() {
 function handleSave() {
   var reasonList = [];
   for (let i = 0; i < rejectList.value.length; i++) {
-    rejectAmount.value += rejectList.value[i].rejectNum;
     if (rejectList.value[i].rejectNum <= 0) {
       proxy.$modal.msgError("第" + (i + 1) + "废品数应大于0");
       return;
@@ -201,6 +200,10 @@ function handleSave() {
     }
     reasonList.push(rejectList.value[i].reason);
   }
+  for (let i = 0; i < rejectList.value.length; i++) {
+    rejectAmount.value += rejectList.value[i].rejectNum;
+  }
+
   console.log("rejectAmount1", rejectAmount.value);
   daywork.value.rejectAmount = rejectAmount.value;
 

+ 412 - 306
src/views/business/standards/detail.vue

@@ -1,367 +1,473 @@
 <template>
-    <div class="page-container column-container">
-        <section class="list-part-container">
-            <!-- 搜索区域 -->
-            <el-form class="list-search-container" :inline="true">
-                <el-form-item class="section-title" label="产品信息" />
-                <el-form-item label="客户:">
-                    {{ currentProduct.companyAlias }}
-                </el-form-item>
-                <el-form-item label="图号:">
-                    {{ currentProduct.drawingNumber }}
-                </el-form-item>
-                <el-form-item label="规格:">
-                    {{ currentProduct.specification }}
-                </el-form-item>
-                <el-form-item label="产品描述:">
-                    {{ currentProduct.description }}
-                </el-form-item>
-                <el-form-item>
-
-                </el-form-item>
-                <el-form-item class="section-title" label="工艺版本:">
-                    {{ currentTechnological.productVersion }}
-                </el-form-item>
-                <el-form-item class="section-title" label="当前工序:">
-                    <el-select-v2 v-model="technologicalDetailId" clearable :options="technologicalProcessDetailsList"
-                        placeholder="请选择工序" style="width: 160px" @change="handleDetailsChange" />
-
-
-                </el-form-item>
-            </el-form>
-
-        </section>
-        <div class="page-container row-container">
-            <section class="list-part-container" style="flex: 1">
-                <div class="list-btns-container">
-                    <el-button type="success" v-hasPermi="['business:standards:add']" @click="handelAdd()">新增
+  <div class="page-container column-container">
+    <section class="list-part-container">
+      <!-- 搜索区域 -->
+      <el-form class="list-search-container" :inline="true">
+        <el-form-item class="section-title" label="产品信息" />
+        <el-form-item label="客户:">
+          {{ currentProduct.companyAlias }}
+        </el-form-item>
+        <el-form-item label="图号:">
+          {{ currentProduct.drawingNumber }}
+        </el-form-item>
+        <el-form-item label="规格:">
+          {{ currentProduct.specification }}
+        </el-form-item>
+        <el-form-item label="产品描述:">
+          {{ currentProduct.description }}
+        </el-form-item>
+        <el-form-item> </el-form-item>
+        <el-form-item class="section-title" label="工艺版本:">
+          {{ currentTechnological.productVersion }}
+        </el-form-item>
+        <el-form-item class="section-title" label="当前工序:">
+          <el-select-v2
+            v-model="technologicalDetailId"
+            clearable
+            :options="technologicalProcessDetailsList"
+            placeholder="请选择工序"
+            style="width: 160px"
+            @change="handleDetailsChange"
+          />
+        </el-form-item>
+      </el-form>
+    </section>
+    <div class="page-container row-container">
+      <section class="list-part-container" style="flex: 1">
+        <div class="list-btns-container">
+          <el-button
+            type="success"
+            v-hasPermi="['business:standards:add']"
+            @click="handelAdd()"
+            >新增
+          </el-button>
+          <el-button
+            type="danger"
+            v-hasPermi="['business:standards:remove']"
+            :disabled="multiple"
+            @click="handleDelete"
+            >删除
+          </el-button>
+        </div>
+        <div class="el-table-container">
+          <!-- 列表区 -->
+          <div class="el-table-inner-container">
+            <el-table
+              ref="standardsTable"
+              v-loading="loading"
+              row-key="id"
+              highlight-current-row
+              @current-change="handleChange"
+              :data="standardsList"
+              @selection-change="handleSelectionChange"
+              height="600px"
+            >
+              <el-table-column type="selection" width="40" align="center" />
+              <el-table-column
+                type="index"
+                label="行号"
+                width="50"
+                align="center"
+              />
+
+              <el-table-column label="检查标准" prop="standard" align="center">
+                <template #default="scope">
+                  <span v-if="!scope.row.editStatus">{{
+                    scope.row.standard
+                  }}</span>
+                  <el-input
+                    v-else
+                    v-model="scope.row.standard"
+                    placeholder="请输入检查标准"
+                  />
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="检查仪器"
+                prop="instrument"
+                align="center"
+                width="200"
+              >
+                <template #default="scope">
+                  <span v-if="!scope.row.editStatus">{{
+                    scope.row.instrument
+                  }}</span>
+                  <el-input
+                    v-else
+                    v-model="scope.row.instrument"
+                    placeholder="请输入检查仪器"
+                  />
+                </template>
+              </el-table-column>
+
+              <template
+                v-for="column in sortCheckStandardList"
+                :key="column.id"
+              >
+                <el-table-column
+                  :prop="column.code"
+                  :label="column.name"
+                  width="60"
+                  align="center"
+                >
+                  <template #default="scope">
+                    <!-- {{ getSortCheck(scope.row.checkStandardList,column.inspectionInstructionId) }} -->
+                    <el-checkbox
+                      :disabled="!scope.row.editStatus"
+                      v-model="scope.row[column.code]"
+                    />
+                  </template>
+                </el-table-column>
+              </template>
+
+              <el-table-column
+                fixed="right"
+                width="200"
+                label="操作"
+                align="center"
+              >
+                <template #default="scope">
+                  <el-button-group
+                    style="
+                      display: flex;
+                      align-items: center;
+                      justify-content: center;
+                      flex-wrap: nowrap;
+                    "
+                  >
+                    <el-button
+                      v-if="!scope.row.editStatus"
+                      link
+                      type="primary"
+                      v-hasPermi="['business:standards:edit']"
+                      @click="handelEdit(scope.row, 'edit')"
+                      >编辑
                     </el-button>
-                    <el-button type="danger" v-hasPermi="['business:standards:remove']" :disabled="multiple" @click="handleDelete">删除
+                    <el-button
+                      v-if="scope.row.editStatus"
+                      link
+                      type="success"
+                      plain
+                      v-hasPermi="['business:standards:add']"
+                      @click="handlePreview(scope.row)"
+                      >保存</el-button
+                    >
+
+                    <el-button
+                      v-if="scope.row.editStatus"
+                      link
+                      type="warning"
+                      v-hasPermi="['business:standards:edit']"
+                      @click="handelEdit(scope.row, 'cancel')"
+                      >取消
                     </el-button>
-                </div>
-                <div class="page-container form-container">
-
-
-                    <!-- 列表区 -->
-                    <div class="el-table-container">
-                        <el-table ref="standardsTable" v-loading="loading" row-key="id" highlight-current-row
-                            @current-change="handleChange" :data="standardsList"  @selection-change="handleSelectionChange" height="600px">
-                            <el-table-column type="selection" width="40" align="center" />
-                            <el-table-column type="index" label="行号" width="50" align="center" />
-
-                            <el-table-column label="检查标准" prop="standard" align="center" width="500">
-                                <template #default="scope">
-                                    <span v-if="!scope.row.editStatus">{{ scope.row.standard }}</span>
-                                    <el-input v-else v-model="scope.row.standard" placeholder="请输入检查标准" />
-                                </template>
-                            </el-table-column>
-                            <el-table-column label="检查仪器" prop="instrument" align="center" width="500">
-                                <template #default="scope">
-                                    <span v-if="!scope.row.editStatus">{{ scope.row.instrument }}</span>
-                                    <el-input v-else v-model="scope.row.instrument" placeholder="请输入检查仪器" />
-                                </template>
-                            </el-table-column>
-
-                            <template v-for="column in sortCheckStandardList" :key="column.id">
-                                <el-table-column :prop="column.code" :label="column.name" width="80px" align="center">
-                                    <template #default="scope">
-                                        <!-- {{ getSortCheck(scope.row.checkStandardList,column.inspectionInstructionId) }} -->
-                                        <el-checkbox :disabled="!scope.row.editStatus" v-model="scope.row[column.code]"  />
-                                    </template>
-                                </el-table-column>
-                            </template>
-
-                            <el-table-column fixed="right" label="操作" align="center" width="220">
-                                <template #default="scope">
-                                    <el-button-group
-                                        style="display: flex;align-items: center; justify-content: center;  flex-wrap: nowrap;">
-                                        <el-button v-if="!scope.row.editStatus" link type="primary"
-                                            v-hasPermi="['business:standards:edit']"
-                                            @click="handelEdit(scope.row, 'edit')">编辑
-                                        </el-button>
-                                        <el-button v-if="scope.row.editStatus" link type="success" plain
-                                            v-hasPermi="['business:standards:add']"
-                                            @click="handlePreview(scope.row)">保存</el-button>
-
-
-                                        <el-button v-if="scope.row.editStatus" link type="warning"
-                                            v-hasPermi="['business:standards:edit']"
-                                            @click="handelEdit(scope.row, 'cancel')">取消
-                                        </el-button>
-
-
-                                        <el-button v-if="!scope.row.editStatus" link type="danger"
-                                            v-hasPermi="['business:standards:remove']"
-                                            @click="handleDelete(scope.row)">删除
-                                        </el-button>
-                                    </el-button-group>
-                                </template>
-                            </el-table-column>
-                        </el-table>
-                    </div>
-                    <!-- 分页 -->
-                    <pagination v-show="total > 0" :total="total" v-model:page="queryparams.pageNum"
-                        v-model:limit="queryparams.pageSize" @pagination="getStandards" />
-                </div>
-            </section>
-
-
 
+                    <el-button
+                      v-if="!scope.row.editStatus"
+                      link
+                      type="danger"
+                      v-hasPermi="['business:standards:remove']"
+                      @click="handleDelete(scope.row)"
+                      >删除
+                    </el-button>
+                  </el-button-group>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
         </div>
-
-
+        <!-- 分页 -->
+        <pagination
+          v-show="total > 0"
+          :total="total"
+          v-model:page="queryparams.pageNum"
+          v-model:limit="queryparams.pageSize"
+          @pagination="getStandards"
+        />
+      </section>
     </div>
+  </div>
 </template>
 <script setup name="drawingDetails">
 import { ref } from "vue";
-import { getToken } from '@/utils/auth'
-import { listCheck,listRoleCheck } from "@/api/business/check";
-import { listStandards, addStandards,delStandards } from "@/api/business/standards";
-
-import useUserStore from '@/store/modules/user'
-import { getTechnological, getById } from '@/api/business/product'
-import { getTechnologicalProcessDetails } from '@/api/business/technologicalProcessDetail'
-
-const drawingUrl = ref('')
+import { getToken } from "@/utils/auth";
+import { listCheck, listRoleCheck } from "@/api/business/check";
+import {
+  listStandards,
+  addStandards,
+  delStandards,
+} from "@/api/business/standards";
+
+import useUserStore from "@/store/modules/user";
+import { getTechnological, getById } from "@/api/business/product";
+import { getTechnologicalProcessDetails } from "@/api/business/technologicalProcessDetail";
+
+const drawingUrl = ref("");
 const { proxy } = getCurrentInstance();
-const total = ref(0)
+const total = ref(0);
 const route = useRoute();
-const coverName = ref("")
-const currentProduct = ref({})
-const currentTechnological = ref({})
-const currentTechnologicalDetail = ref({})
-const technologicalProcessList = ref([])
-const technologicalProcessDetailsList = ref([])
-const technologicalDetailId = ref(null)
-const repeatingDrawings = ref([])
-const standardsTable = ref(null)
+const coverName = ref("");
+const editStatus = ref(false);
+const currentProduct = ref({});
+const currentTechnological = ref({});
+const currentTechnologicalDetail = ref({});
+const technologicalProcessList = ref([]);
+const technologicalProcessDetailsList = ref([]);
+const technologicalDetailId = ref(null);
+const repeatingDrawings = ref([]);
+const standardsTable = ref(null);
 const loading = ref(false);
-const standardsList = ref([])
-const productId = ref(null)
-const ids = ref([])
+const standardsList = ref([]);
+const productId = ref(null);
+const ids = ref([]);
 const single = ref(true);
 const multiple = ref(true);
-const processCode = ref(null)
-const processId = ref(null)
-const productVersion = ref(null)
-const sortCheckStandardList = ref([])
+const processCode = ref(null);
+const processId = ref(null);
+const productVersion = ref(null);
+const sortCheckStandardList = ref([]);
 /** 查询对象 */
 const data = reactive({
-    queryparams: {
-        pageNum: 1,
-        pageSize: 10,
-        technologicalProcessDetailId: null
-    },
-    form: {
-        pageNum: 1,
-        pageSize: 10,
-        parentId: null,
-        technologicalProcessDetailId: null,
-        groupDetailList: [],
-        code: "",
-        remark: "",
-        type: false
-    },
-    rules: {
-        technologicalProcessDetailId: [{ required: true, message: "工序不能为空", trigger: "blur" }],
-    },
+  queryparams: {
+    pageNum: 1,
+    pageSize: 10,
+    technologicalProcessDetailId: null,
+  },
+  form: {
+    pageNum: 1,
+    pageSize: 10,
+    parentId: null,
+    technologicalProcessDetailId: null,
+    groupDetailList: [],
+    code: "",
+    remark: "",
+    type: false,
+  },
+  rules: {
+    technologicalProcessDetailId: [
+      { required: true, message: "工序不能为空", trigger: "blur" },
+    ],
+  },
 });
 const { form, rules, queryparams } = toRefs(data);
 const detailsRow = {
-    standard: '',
-    instrument: '',
-    editStatus: true
-}
+  standard: "",
+  instrument: "",
+  editStatus: true,
+};
 function getList() {
-
-
-    productId.value = route.params.productId
-    productVersion.value = route.params.productVersion
-
-    if (route.params.processCode) {
-        processCode.value = route.params.processCode
-    } else {
-        technologicalDetailId.value = null
+  loading.value = true;
+  productId.value = route.params.productId;
+  productVersion.value = route.params.productVersion;
+
+  if (!processCode.value && route.params.processCode) {
+    processCode.value = route.params.processCode;
+  } else {
+    technologicalDetailId.value = null;
+  }
+  //查询产品
+  getById(productId.value).then((resMsg) => {
+    if (resMsg.code == 200) {
+      currentProduct.value = resMsg.data;
     }
-    //查询产品
-    getById(productId.value).then(resMsg => {
-        if (resMsg.code == 200) {
-            currentProduct.value = resMsg.data
+  });
+
+  //查询工艺版本
+  getTechnological({ productId: productId.value }).then((res) => {
+    if (res.code == 200) {
+      technologicalProcessList.value = res.data;
+      //版本下拉框默认值
+      currentTechnological.value.productVersion = productVersion.value;
+
+      //查询工艺工序
+      getTechnologicalProcessDetails({
+        technologyVersion: currentTechnological.value.productVersion,
+        productId: productId.value,
+      }).then((response) => {
+        if (response.code == 200) {
+          technologicalProcessDetailsList.value = response.data;
+          if (
+            processCode.value !== undefined &&
+            processCode.value !== null &&
+            processCode.value !== "undefined"
+          ) {
+            technologicalDetailId.value = response.data.find(
+              (detail) => detail.code == processCode.value
+            ).value;
+            currentTechnologicalDetail.value.id = response.data.find(
+              (detail) => detail.code === processCode.value
+            ).value;
+            processId.value = response.data.find(
+              (detail) => detail.code == processCode.value
+            ).processId;
+          } else {
+            technologicalDetailId.value = null;
+          }
+          getStandards();
         }
-    })
-
-    //查询工艺版本
-    getTechnological({ productId: productId.value }).then(res => {
-        if (res.code == 200) {
-            technologicalProcessList.value = res.data
-            //版本下拉框默认值
-            currentTechnological.value.productVersion = productVersion.value
-
-            //查询工艺工序
-            getTechnologicalProcessDetails({ technologyVersion: currentTechnological.value.productVersion, productId: productId.value }).then(response => {
-                if (response.code == 200) {
-                    technologicalProcessDetailsList.value = response.data
-                    if (processCode.value !== undefined && processCode.value !== null && processCode.value !== 'undefined') {
-                        technologicalDetailId.value = response.data.find(detail => detail.code == processCode.value).value;
-                        currentTechnologicalDetail.value.id = response.data.find(detail => detail.code === processCode.value).value;
-                        processId.value =  response.data.find(detail => detail.code == processCode.value).processId;
-                    } else {
-                        technologicalDetailId.value = null
-                    }
-                    getStandards()
-                }
-            })
-        }
-    })
-
+      });
+    }
+  });
 }
 
-
-
-
-
 // 多选框选中数据
 function handleSelectionChange(selection) {
-    ids.value = selection.map(item => item.id);
-    single.value = selection.length != 1;
-    multiple.value = !selection.length;
-    console.log(ids.value)
-}
-
-function handleChange(row){
-
+  ids.value = selection.map((item) => item.id);
+  single.value = selection.length != 1;
+  multiple.value = !selection.length;
+  console.log(ids.value);
 }
 
+function handleChange(row) {}
 
 /** 删除按钮操作 */
 function handleDelete(row) {
-    const _ids = row.id || ids.value;
-    console.log(ids.value)
-    proxy.$modal.confirm('是否确认删除选中的数据项?').then(function () {
-        return delStandards(_ids);
-    }).then(() => {
-        getList();
-        proxy.$modal.msgSuccess("删除成功!");
-    }).catch(() => { });
+  const _ids = row.id || ids.value;
+  console.log(ids.value);
+  proxy.$modal
+    .confirm("是否确认删除选中的数据项?")
+    .then(function () {
+      return delStandards(_ids);
+    })
+    .then(() => {
+      getList();
+      proxy.$modal.msgSuccess("删除成功!");
+    })
+    .catch(() => {});
 }
 function handelAdd() {
-    console.log(standardsList.value)
-    const newDetail = JSON.parse(JSON.stringify(detailsRow))
-
-    sortCheckStandardList.value.forEach(column => {
-        newDetail[column.code] = ''; // 假设默认值是空字符串,根据实际情况调整
-    })
-
-    // 将新行添加到standardsList中
-    standardsList.value.push(newDetail)
-
+  //判断是否处于编辑状态,如果处于编辑状态不可新增
+  if (editStatus.value) {
+    proxy.$modal.msgError("请先保存数据");
+    return;
+  }
+  editStatus.value = true;
+  const newDetail = JSON.parse(JSON.stringify(detailsRow));
+  sortCheckStandardList.value.forEach((column) => {
+    newDetail[column.code] = ""; // 假设默认值是空字符串,根据实际情况调整
+  });
+
+  // 将新行添加到standardsList中
+  standardsList.value.push(newDetail);
 }
 /**获取图纸列表 */
 function getStandards() {
-
-    queryparams.value.productId = productId.value
-    queryparams.value.productVersion = currentTechnological.value.productVersion
-    queryparams.value.processCode = processCode.value
-    // if (currentTechnologicalDetail.value.id !== undefined && currentTechnologicalDetail.value.id !== 'undefined') {
-    //     queryparams.value.technologicalProcessDetailId = currentTechnologicalDetail.value.id
-
-    // }
-    listStandards(queryparams.value).then(res => {
-        if (res.code == 200) {
-            standardsList.value = res.rows
-            console.log(1225, res.rows)
-            if (res.rows.length > 0) {
-                proxy.$refs.standardsTable.setCurrentRow(res.rows[0])
-            } else {
-                drawingUrl.value = null
-            }
-            total.value = res.total
-        }
-    })
-    listRoleCheck({}).then(res => {
-        if (res.code == 200) {
-            sortCheckStandardList.value = res.data
-        }
-    })
+  loading.value = true;
+  queryparams.value.productId = productId.value;
+  queryparams.value.productVersion = currentTechnological.value.productVersion;
+  queryparams.value.processCode = processCode.value;
+  // if (currentTechnologicalDetail.value.id !== undefined && currentTechnologicalDetail.value.id !== 'undefined') {
+  //     queryparams.value.technologicalProcessDetailId = currentTechnologicalDetail.value.id
+
+  // }
+  listStandards(queryparams.value).then((res) => {
+    if (res.code == 200) {
+      standardsList.value = res.rows;
+      console.log(1225, res.rows);
+      if (res.rows.length > 0) {
+        proxy.$refs.standardsTable.setCurrentRow(res.rows[0]);
+      } else {
+        drawingUrl.value = null;
+      }
+      total.value = res.total;
+    }
+    loading.value = false;
+  });
+  listRoleCheck({}).then((res) => {
+    if (res.code == 200) {
+      sortCheckStandardList.value = res.data;
+    }
+  });
 }
 
-
-
 function handelEdit(row, type) {
-    row.editStatus = !row.editStatus
-    console.log(row)
-    if (type == 'cancel' && !row.id) {
-        standardsList.value = standardsList.value.filter(item => item !== row);
+  if (type == "edit") {
+    if (editStatus.value) {
+      proxy.$modal.msgError("请先保存数据");
+      return;
     }
+  }
+  row.editStatus = !row.editStatus;
+  console.log(row);
+
+  if (type == "cancel" && !row.id) {
+    standardsList.value = standardsList.value.filter((item) => item !== row);
+  }
+  if (type == "cancel") {
+    editStatus.value = false;
+    getList();
+  }
 }
 
-
-
-
 /**审核 */
 function handlePreview(row) {
-    var item = row
-    item.productId =productId.value 
-    item.processCode =  processCode.value
-    item.productVersion=productVersion.value 
-    item.processId = processId.value 
-    addStandards(row).then(res => {
-        if (res.code == 200) {
-            proxy.$modal.msgSuccess("操作成功");
-            reset()
-            getList();
-        }
-    })
+  if (!row.standard) {
+    proxy.$modal.msgError("请输入检查标准");
+  } else {
+    var item = row;
+    item.productId = productId.value;
+    item.processCode = processCode.value;
+    item.productVersion = productVersion.value;
+    item.processId = processId.value;
+    addStandards(row).then((res) => {
+      if (res.code == 200) {
+        proxy.$modal.msgSuccess("操作成功");
+        reset();
+        getList();
+        editStatus.value = false;
+      }
+    });
+  }
 }
 function reset() {
-    form.value = {
-        pageNum: 1,
-        pageSize: 10,
-        code: null,
-        remark: null,
-        groupDetailList: [],
-        url: null,
-        drawingName: null,
-        identification: 0,
-        markD: 0,
-        type: false
-    };
-    currentTechnologicalDetail.value = {}
-    coverName.value = ''
-    repeatingDrawings.value = []
-    proxy.resetForm("drawingRef");
+  form.value = {
+    pageNum: 1,
+    pageSize: 10,
+    code: null,
+    remark: null,
+    groupDetailList: [],
+    url: null,
+    drawingName: null,
+    identification: 0,
+    markD: 0,
+    type: false,
+  };
+  currentTechnologicalDetail.value = {};
+  coverName.value = "";
+  repeatingDrawings.value = [];
+  proxy.resetForm("drawingRef");
 }
 
-
 /**工序选择change事件 */
 function handleDetailsChange() {
-    if (technologicalDetailId.value) {
-        var matchingDetail = technologicalProcessDetailsList.value.find(detail => detail.value === technologicalDetailId.value);
-        currentTechnologicalDetail.value.id = technologicalDetailId.value == undefined ? null : technologicalDetailId.value
-        processCode.value = matchingDetail.code
-        processId.value = matchingDetail.processId
-    } else {
-        processCode.value = null
-        drawingUrl.value = null
-    }
-    getStandards()
+  if (technologicalDetailId.value) {
+    var matchingDetail = technologicalProcessDetailsList.value.find(
+      (detail) => detail.value === technologicalDetailId.value
+    );
+    currentTechnologicalDetail.value.id =
+      technologicalDetailId.value == undefined
+        ? null
+        : technologicalDetailId.value;
+    processCode.value = matchingDetail.code;
+    processId.value = matchingDetail.processId;
+  } else {
+    processCode.value = null;
+    drawingUrl.value = null;
+  }
+  getStandards();
 }
 
-
-
-
-
-getList()
+getList();
 </script>
 
 <style scoped>
 :deep(.el-form-item .el-form-item__label) {
-    font-size: 14px !important;
-    padding-right: 0 !important;
+  font-size: 14px !important;
+  padding-right: 0 !important;
 }
 
 :deep(#list-search-container .el-form-item--default .el-form-item__content) {
-    line-height: 32px;
-    font-size: 18px;
+  line-height: 32px;
+  font-size: 18px;
 }
 </style>

+ 381 - 209
src/views/business/standards/index.vue

@@ -1,249 +1,421 @@
 <template>
-	<div class="page-container row-container">
-		<section class="list-part-container column-container" style="flex: 1">
-			<el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true">
-				<el-form-item class="section-title" label="图纸管理" />
-				<el-form-item label="产品类别:">
-					<el-select v-model="queryParams.type" clearable placeholder="请选择类别" style="width: 150px">
-						<el-option v-for="dict in product_type" :key="dict.value" :label="dict.label"
-							:value="dict.value"></el-option>
-					</el-select>
-				</el-form-item>
-				<el-form-item label="客户集团简称:">
-					<el-input placeholder="请输入客户集团简称" v-model.trim="queryParams.companyAlias" clearable
-						@keyup.enter="handleQueryProduct" @keydown.enter.prevent style="width: 150px" />
-				</el-form-item>
-				<el-form-item label="图号:">
-					<el-input placeholder="请输入产品图号" v-model.trim="queryParams.drawingNumber" clearable
-						@keyup.enter="handleQueryProduct" @keydown.enter.prevent style="width: 150px" />
-				</el-form-item>
-				<el-form-item label="规格:">
-					<el-input placeholder="请输入产品规格" v-model.trim="queryParams.specification" clearable
-						@keyup.enter="handleQueryProduct" @keydown.enter.prevent style="width: 150px" />
-				</el-form-item>
-				<el-form-item label="料号:">
-					<el-input placeholder="请输入产品料号" v-model.trim="queryParams.productCode" clearable
-						@keyup.enter="handleQueryProduct" @keydown.enter.prevent style="width: 150px" />
-				</el-form-item>
-				<el-form-item label="产品描述:">
-					<el-input placeholder="请输入产品描述" v-model.trim="queryParams.description" clearable
-						@keyup.enter="handleQueryProduct" @keydown.enter.prevent style="width: 150px" />
-				</el-form-item>
-				<el-form-item>
-					<el-button type="info" icon="Search" @click="handleQueryProduct">搜索</el-button>
-				</el-form-item>
-			</el-form>
-			<!-- 列表区 -->
-			<div class="el-table-container">
-				<div class="el-table-inner-container">
-					<el-table ref="productTable" v-loading="productLoading" :data="productList" row-key="id"
-						highlight-current-row height="100%">
-						<el-table-column type="index" label="行号" width="50" align="center" />
-						<el-table-column label="料号" align="center" prop="productCode" />
-						<el-table-column label="预入仓库" align="center" prop="preStock" />
-						<el-table-column label="类别" align="center" prop="type">
-							<template #default="scope">
-								<dict-tag :options="product_type" :value="scope.row.type" />
-							</template>
-						</el-table-column>
-						<el-table-column label="轴类型大类" width="150px" align="center" prop="shaftBroadCategoryCode">
-							<template #default="scope">
-								<dict-tag :options="product_dtype" :value="scope.row.shaftBroadCategoryCode" />
-							</template>
-						</el-table-column>
-						<el-table-column label="轴类型" align="center" prop="shaftCategoryCode" />
-						<el-table-column label="规格" align="center" prop="specification" />
-						<el-table-column label="图号" align="center" width="110" prop="drawingNumber" />
-						<el-table-column label="客户集团简称" align="center" width="120px" prop="companyAlias" />
-						<el-table-column label="产品描述" align="center" width="200px" prop="description" />
-						<el-table-column label="直径" align="center" prop="diameter" />
-						<el-table-column label="成品长度" align="center" prop="lenght" />
-						<el-table-column label="厚度" align="center" prop="thickness" />
-						<el-table-column label="客户代号" align="center" prop="companyCode" />
-						<el-table-column label="销售员编码" align="center" prop="salesmanCode" />
-						<el-table-column label="保管员编码" align="center" prop="stockKeeperCode" />
-						<el-table-column label="调度员编号" align="center" prop="dispatcherCode" />
-						<el-table-column label="备注" align="center" prop="remark" />
-						<el-table-column label="产品状态" align="center" prop="productStatusCode">
-							<template #default="scope">
-								<dict-tag :options="product_status_code" :value="scope.row.productStatusCode" />
-							</template>
-						</el-table-column>
-						<el-table-column label="生产类型" align="center" prop="productionTypeCode">
-							<template #default="scope">
-								<dict-tag :options="production_type_code" :value="scope.row.productionTypeCode" />
-							</template>
-						</el-table-column>
-						<el-table-column label="技术员编码" align="center" prop="technicianCode" />
-						<el-table-column fixed="right" label="工艺详情" align="center" width="140px">
-							<template #default="scope">
-								<el-button link type="primary" v-hasPermi="['business:electronicDrawings:query']"
-									@click="handleProduct(scope.row)">查看</el-button>
-							</template>
-						</el-table-column>
-					</el-table>
-				</div>
-			</div>
-			<!-- 分页 -->
-			<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
-				v-model:limit="queryParams.pageSize" @pagination="getList" />
-		</section>
-		<el-drawer v-model="openVersoinForm" size="30%" direction="rtl" :close-on-press-escape="false">
-			<div class="page-container form-container">
-				<div class="form-btns-container">
-					<span class="title-label"><el-icon>
-							<Document />
-						</el-icon>
-						电子工艺图纸</span>
-				</div>
-				<!-- 搜索区域 -->
-				<el-form class="list-search-container" :inline="true">
-					<el-form-item>
-						<el-select-v2 v-model="currentTechnological.id" clearable :options="technologicalProcessList"
-							placeholder="请选择版本" @change="handelTechnological" style="width: 220px" />
-					</el-form-item>
-				</el-form>
-			</div>
-			<div class="el-table-inner-container" style="padding-bottom: 30px;">
-				<el-table :data="technologicalprocessDetailList" v-loading="technologicalprocessDetailLoading"
-					:row-key="getRowKey" highlight-current-row height="100%">
-					<el-table-column label="工序步骤编号" width="100px" align="center" prop="processStepNumber">
-						<template #default="scope">
-
-							<div>{{ scope.row.processStepNumber }}</div>
-						</template>
-					</el-table-column>
-					<el-table-column label="工序编码" width="80px" align="center" prop="processCode" />
-					<el-table-column label="工序简称" align="center" prop="processAlias" />
-					<el-table-column label="图纸个数" align="center" width="60px" prop="drawingNum" />
-					<el-table-column label="操作" width="80px" align="center">
-						<template #default="scope">
-							<el-button link type="primary" v-hasPermi="['business:electronicDrawings:query']"
-								@click="handelDrawing(scope.row)">编辑</el-button>
-						</template>
-					</el-table-column>
-				</el-table>
-			</div>
-		</el-drawer>
-	</div>
+  <div class="page-container row-container">
+    <section class="list-part-container column-container" style="flex: 1">
+      <el-form
+        class="list-search-container"
+        :model="queryParams"
+        ref="queryRef"
+        :inline="true"
+      >
+        <!-- <el-form-item class="section-title" label="图纸管理" /> -->
+        <el-form-item label="产品类别:">
+          <el-select
+            v-model="queryParams.type"
+            clearable
+            placeholder="请选择类别"
+            style="width: 150px"
+          >
+            <el-option
+              v-for="dict in product_type"
+              :key="dict.value"
+              :label="dict.label"
+              :value="dict.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="客户集团简称:">
+          <el-input
+            placeholder="请输入客户集团简称"
+            v-model.trim="queryParams.companyAlias"
+            clearable
+            @keyup.enter="handleQueryProduct"
+            @keydown.enter.prevent
+            style="width: 150px"
+          />
+        </el-form-item>
+        <el-form-item label="图号:">
+          <el-input
+            placeholder="请输入产品图号"
+            v-model.trim="queryParams.drawingNumber"
+            clearable
+            @keyup.enter="handleQueryProduct"
+            @keydown.enter.prevent
+            style="width: 150px"
+          />
+        </el-form-item>
+        <el-form-item label="规格:">
+          <el-input
+            placeholder="请输入产品规格"
+            v-model.trim="queryParams.specification"
+            clearable
+            @keyup.enter="handleQueryProduct"
+            @keydown.enter.prevent
+            style="width: 150px"
+          />
+        </el-form-item>
+        <el-form-item label="料号:">
+          <el-input
+            placeholder="请输入产品料号"
+            v-model.trim="queryParams.productCode"
+            clearable
+            @keyup.enter="handleQueryProduct"
+            @keydown.enter.prevent
+            style="width: 150px"
+          />
+        </el-form-item>
+        <el-form-item label="产品描述:">
+          <el-input
+            placeholder="请输入产品描述"
+            v-model.trim="queryParams.description"
+            clearable
+            @keyup.enter="handleQueryProduct"
+            @keydown.enter.prevent
+            style="width: 150px"
+          />
+        </el-form-item>
+        <el-form-item>
+          <el-button type="info" icon="Search" @click="handleQueryProduct"
+            >搜索</el-button
+          >
+        </el-form-item>
+      </el-form>
+      <!-- 列表区 -->
+      <div class="el-table-container">
+        <div class="el-table-inner-container">
+          <el-table
+            ref="productTable"
+            v-loading="productLoading"
+            :data="productList"
+            row-key="id"
+            highlight-current-row
+            height="100%"
+          >
+            <el-table-column
+              type="index"
+              label="行号"
+              width="50"
+              align="center"
+            />
+            <el-table-column label="料号" align="center" prop="productCode" />
+            <el-table-column label="预入仓库" align="center" prop="preStock" />
+            <el-table-column label="类别" align="center" prop="type">
+              <template #default="scope">
+                <dict-tag :options="product_type" :value="scope.row.type" />
+              </template>
+            </el-table-column>
+            <el-table-column
+              label="轴类型大类"
+              width="150px"
+              align="center"
+              prop="shaftBroadCategoryCode"
+            >
+              <template #default="scope">
+                <dict-tag
+                  :options="product_dtype"
+                  :value="scope.row.shaftBroadCategoryCode"
+                />
+              </template>
+            </el-table-column>
+            <el-table-column
+              label="轴类型"
+              align="center"
+              prop="shaftCategoryCode"
+            />
+            <el-table-column label="规格" align="center" prop="specification" />
+            <el-table-column
+              label="图号"
+              align="center"
+              width="110"
+              prop="drawingNumber"
+            />
+            <el-table-column
+              label="客户集团简称"
+              align="center"
+              width="120px"
+              prop="companyAlias"
+            />
+            <el-table-column
+              label="产品描述"
+              align="center"
+              width="200px"
+              prop="description"
+            />
+            <el-table-column label="直径" align="center" prop="diameter" />
+            <el-table-column label="成品长度" align="center" prop="lenght" />
+            <el-table-column label="厚度" align="center" prop="thickness" />
+            <el-table-column
+              label="客户代号"
+              align="center"
+              prop="companyCode"
+            />
+            <el-table-column
+              label="销售员编码"
+              align="center"
+              prop="salesmanCode"
+            />
+            <el-table-column
+              label="保管员编码"
+              align="center"
+              prop="stockKeeperCode"
+            />
+            <el-table-column
+              label="调度员编号"
+              align="center"
+              prop="dispatcherCode"
+            />
+            <el-table-column label="备注" align="center" prop="remark" />
+            <el-table-column
+              label="产品状态"
+              align="center"
+              prop="productStatusCode"
+            >
+              <template #default="scope">
+                <dict-tag
+                  :options="product_status_code"
+                  :value="scope.row.productStatusCode"
+                />
+              </template>
+            </el-table-column>
+            <el-table-column
+              label="生产类型"
+              align="center"
+              prop="productionTypeCode"
+            >
+              <template #default="scope">
+                <dict-tag
+                  :options="production_type_code"
+                  :value="scope.row.productionTypeCode"
+                />
+              </template>
+            </el-table-column>
+            <el-table-column
+              label="技术员编码"
+              align="center"
+              prop="technicianCode"
+            />
+            <el-table-column
+              fixed="right"
+              label="工艺详情"
+              align="center"
+              width="140px"
+            >
+              <template #default="scope">
+                <el-button
+                  link
+                  type="primary"
+                  v-hasPermi="['business:standards:query']"
+                  @click="handleProduct(scope.row)"
+                  >查看</el-button
+                >
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+      </div>
+      <!-- 分页 -->
+      <pagination
+        v-show="total > 0"
+        :total="total"
+        v-model:page="queryParams.pageNum"
+        v-model:limit="queryParams.pageSize"
+        @pagination="getList"
+      />
+    </section>
+    <el-drawer
+      v-model="openVersoinForm"
+      size="30%"
+      direction="rtl"
+      :close-on-press-escape="false"
+    >
+      <div class="page-container form-container">
+        <div class="form-btns-container">
+          <span class="title-label"
+            ><el-icon>
+              <Document />
+            </el-icon>
+            检查标准维护</span
+          >
+        </div>
+        <!-- 搜索区域 -->
+        <el-form class="list-search-container" :inline="true">
+          <el-form-item label="图纸版本:">
+            <el-select-v2
+              v-model="currentTechnological.id"
+              clearable
+              :options="technologicalProcessList"
+              placeholder="请选择版本"
+              @change="handelTechnological"
+              style="width: 220px"
+            />
+          </el-form-item>
+        </el-form>
+      </div>
+      <div class="el-table-inner-container" style="padding-bottom: 30px">
+        <el-table
+          :data="technologicalprocessDetailList"
+          v-loading="technologicalprocessDetailLoading"
+          :row-key="getRowKey"
+          highlight-current-row
+          height="100%"
+        >
+          <el-table-column
+            label="工序步骤编号"
+            width="100px"
+            align="center"
+            prop="processStepNumber"
+          >
+            <template #default="scope">
+              <div>{{ scope.row.processStepNumber }}</div>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="工序编码"
+            width="80px"
+            align="center"
+            prop="processCode"
+          />
+          <el-table-column
+            label="工序简称"
+            align="center"
+            prop="processAlias"
+          />
+          <!-- <el-table-column
+            label="图纸个数"
+            align="center"
+            width="60px"
+            prop="drawingNum"
+          /> -->
+          <el-table-column label="操作" width="80px" align="center">
+            <template #default="scope">
+              <el-button
+                link
+                type="primary"
+                v-hasPermi="['business:standards:edit']"
+                @click="handelDrawing(scope.row)"
+                >编辑</el-button
+              >
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+    </el-drawer>
+  </div>
 </template>
 
 <script setup name="Process">
-import { listProduct, getTechnological } from '@/api/business/product'
-import { listTechnologicalProcessDetail } from '@/api/business/technologicalProcessDetail'
+import { listProduct, getTechnological } from "@/api/business/product";
+import { listTechnologicalProcessDetail } from "@/api/business/technologicalProcessDetail";
 import router from "@/router";
 
-const { proxy } = getCurrentInstance()
+const { proxy } = getCurrentInstance();
 /**字典 */
-const { product_type } = proxy.useDict('product_type')
-const { product_dtype } = proxy.useDict('product_dtype')
-const { product_status_code } = proxy.useDict('product_status_code')
-const { production_type_code } = proxy.useDict('production_type_code')
+const { product_type } = proxy.useDict("product_type");
+const { product_dtype } = proxy.useDict("product_dtype");
+const { product_status_code } = proxy.useDict("product_status_code");
+const { production_type_code } = proxy.useDict("production_type_code");
 //产品
-const productList = ref([])
-const productLoading = ref(false)
-const total = ref(0)
-const openVersoinForm = ref(false)
-const currentProduct = ref({})
-const ids = ref([])
-const currentTechnological = ref({})
+const productList = ref([]);
+const productLoading = ref(false);
+const total = ref(0);
+const openVersoinForm = ref(false);
+const currentProduct = ref({});
+const ids = ref([]);
+const currentTechnological = ref({});
 //版本
-const technologicalProcessList = ref([])
+const technologicalProcessList = ref([]);
 /** 工序变量 */
-const technologicalprocessDetailList = ref([])
-const technologicalprocessDetailLoading = ref(false)
+const technologicalprocessDetailList = ref([]);
+const technologicalprocessDetailLoading = ref(false);
 /** 查询对象 */
 const queryParams = ref({
-	pageNum: 1,
-	pageSize: 10,
-	code: '',
-	name: '',
-	combinedValue: null,
-	productCode: ''
-})
+  pageNum: 1,
+  pageSize: 10,
+  code: "",
+  name: "",
+  combinedValue: null,
+  productCode: "",
+});
 
 const yesOrNo = [
-	{ label: '是', value: '1', elTagType: 'primary', elTagClass: '' },
-	{ label: '否', value: '0', elTagType: 'danger', elTagClass: '' },
-]
+  { label: "是", value: "1", elTagType: "primary", elTagClass: "" },
+  { label: "否", value: "0", elTagType: "danger", elTagClass: "" },
+];
 
 /***********************  方法区  ****************************/
 /***********************  部门管理相关事件  ****************************/
 /** 查询产品列表 */
 function getList() {
-	currentTechnological.value = {}
-	currentProduct.value = {}
-	productLoading.value = true
-	listProduct(queryParams.value).then((response) => {
-		productList.value = response.rows
-		total.value = response.total
-		productLoading.value = false
-
-	})
+  currentTechnological.value = {};
+  currentProduct.value = {};
+  productLoading.value = true;
+  listProduct(queryParams.value).then((response) => {
+    productList.value = response.rows;
+    total.value = response.total;
+    productLoading.value = false;
+  });
 }
 /**产品查询 */
 function handleQueryProduct() {
-	queryParams.value.pageNum = 1
-	getList()
+  queryParams.value.pageNum = 1;
+  getList();
 }
 function handleProduct(row) {
-	technologicalprocessDetailList.value = []
-	openVersoinForm.value = true
-	currentTechnological.value = {}
-	console.log(row)
-	currentProduct.value = row
-	var technological = {}
-	technological.productId = row.id
-	getTechnological(technological).then(res => {
-		if (res.code == 200) {
-			technologicalProcessList.value = res.data
-
-			if (technologicalProcessList.value.length > 0) {
-				currentProduct.value.technologicalprocessId = technologicalProcessList.value[0].value
-				currentProduct.value.productVersion = technologicalProcessList.value[0].label
-				currentTechnological.value.id = technologicalProcessList.value[0].value
-				currentTechnological.value.productVersion = technologicalProcessList.value[0].label
-				handelDetails()
-			}
-		}
-	})
+  technologicalprocessDetailList.value = [];
+  openVersoinForm.value = true;
+  currentTechnological.value = {};
+  console.log(row);
+  currentProduct.value = row;
+  var technological = {};
+  technological.productId = row.id;
+  getTechnological(technological).then((res) => {
+    if (res.code == 200) {
+      technologicalProcessList.value = res.data;
 
+      if (technologicalProcessList.value.length > 0) {
+        currentProduct.value.technologicalprocessId =
+          technologicalProcessList.value[0].value;
+        currentProduct.value.productVersion =
+          technologicalProcessList.value[0].label;
+        currentTechnological.value.id = technologicalProcessList.value[0].value;
+        currentTechnological.value.productVersion =
+          technologicalProcessList.value[0].label;
+        handelDetails();
+      }
+    }
+  });
 }
 
 function handelTechnological() {
-	if (currentTechnological.value.id) {
-		currentProduct.value.technologicalprocessId = currentTechnological.value.id
-		currentProduct.value.productVersion =  technologicalProcessList.value.find(item => item.value === currentTechnological.value.id).label;
-		handelDetails()
-	}
+  if (currentTechnological.value.id) {
+    currentProduct.value.technologicalprocessId = currentTechnological.value.id;
+    currentProduct.value.productVersion = technologicalProcessList.value.find(
+      (item) => item.value === currentTechnological.value.id
+    ).label;
+    handelDetails();
+  }
 }
 
 function handelDetails() {
-	technologicalprocessDetailLoading.value = true
-	listTechnologicalProcessDetail({
-		technologicalProcessId: currentTechnological.value.id
-	}).then((res) => {
-		technologicalprocessDetailList.value = res.rows
-		technologicalprocessDetailLoading.value = false
-	})
+  technologicalprocessDetailLoading.value = true;
+  listTechnologicalProcessDetail({
+    technologicalProcessId: currentTechnological.value.id,
+  }).then((res) => {
+    technologicalprocessDetailList.value = res.rows;
+    technologicalprocessDetailLoading.value = false;
+  });
 }
 
 function handelDrawing(row) {
-
-		currentProduct.value.processCode = row.processCode
-		router.push({
-			path: `/standards/detail/${currentProduct.value.id}/${currentProduct.value.productVersion}/${row.processCode}`
-		});
-
-	
-
-
+  currentProduct.value.processCode = row.processCode;
+  router.push({
+    path: `/standards/detail/${currentProduct.value.id}/${currentProduct.value.productVersion}/${row.processCode}`,
+  });
 }
 /** 获取行 id */
 function getRowKey(row) {
-	return row.id
+  return row.id;
 }
 onMounted(() => {
-	getList()
-})
+  getList();
+});
 </script>

+ 5 - 0
vite.config.js

@@ -65,6 +65,11 @@ export default defineConfig(({ mode, command }) => {
           }
         ]
       }
+    },
+    esbuild: {
+      jsxFactory: 'h',
+      jsxFragment: 'Fragment',
+      // jsxInject: `import { h } from 'vue';`,
     }
   }
 })