From 5f18876241777adb7cacce4bc8316779cb16c237 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期五, 03 四月 2026 10:04:58 +0800
Subject: [PATCH] 生产报表联调,并优化页面

---
 src/views/qualityManagement/rawMaterial/index.vue |  165 ++++++++++++++++++++++++++++++++----------------------
 1 files changed, 98 insertions(+), 67 deletions(-)

diff --git a/src/views/qualityManagement/rawMaterial/index.vue b/src/views/qualityManagement/rawMaterial/index.vue
index 089272b..26603d6 100644
--- a/src/views/qualityManagement/rawMaterial/index.vue
+++ b/src/views/qualityManagement/rawMaterial/index.vue
@@ -2,15 +2,38 @@
   <div class="app-container">
     <div class="search_form">
       <div>
-        <span class="search_title">渚涘簲鍟嗭細</span>
+        <span class="search_title">鎵瑰彿锛�</span>
         <el-input
-            v-model="searchForm.supplier"
-            style="width: 240px"
-            placeholder="璇疯緭鍏ヤ緵搴斿晢鎼滅储"
+            v-model="searchForm.batchNo"
+            style="width: 200px"
+            placeholder="璇疯緭鍏�"
             @change="handleQuery"
             clearable
-            :prefix-icon="Search"
+            prefix-icon="Search"
         />
+        <span class="search_title">妫�楠岀被鍨嬶細</span>
+        <el-select
+            v-model="searchForm.checkType"
+            style="width: 200px"
+            placeholder="璇烽�夋嫨"
+            @change="handleQuery"
+            clearable
+        >
+          <el-option label="鍏ュ巶妫�" :value="0" />
+          <el-option label="杞﹂棿妫�" :value="1" />
+          <el-option label="鍑哄巶妫�" :value="2" />
+        </el-select>
+        <span class="search_title">鎻愪氦鐘舵�侊細</span>
+        <el-select
+            v-model="searchForm.inspectState"
+            style="width: 200px"
+            placeholder="璇烽�夋嫨"
+            @change="handleQuery"
+            clearable
+        >
+          <el-option label="鏈彁浜�" :value="0" />
+          <el-option label="宸叉彁浜�" :value="1" />
+        </el-select>
         <span style="margin-left: 10px" class="search_title">妫�娴嬫棩鏈燂細</span>
         <el-date-picker v-model="searchForm.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange"
                         placeholder="璇烽�夋嫨" clearable @change="changeDaterange"/>
@@ -22,7 +45,7 @@
       <div>
         <el-button type="primary" @click="openForm('add')">鏂板</el-button>
         <el-button @click="handleOut">瀵煎嚭</el-button>
-        <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
+        <el-button type="danger" plain @click="handleDelete" v-if="hasRawCancel">鍒犻櫎</el-button>
       </div>
     </div>
     <div class="table_list">
@@ -44,8 +67,8 @@
     <el-dialog v-model="dialogFormVisible" title="缂栬緫妫�楠屽憳" width="30%"
                @close="closeDia">
       <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
-        <el-form-item label="妫�楠屽憳锛�" prop="checkName">
-          <el-select v-model="form.checkName" placeholder="璇烽�夋嫨" clearable>
+        <el-form-item label="妫�楠屽憳锛�" prop="checkUserName">
+          <el-select v-model="form.checkUserName" placeholder="璇烽�夋嫨" clearable>
             <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName"
                        :value="item.nickName"/>
           </el-select>
@@ -63,34 +86,37 @@
 </template>
 
 <script setup>
-import {Search} from "@element-plus/icons-vue";
-import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick} from "vue";
+import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick, computed} from "vue";
 import InspectionFormDia from "@/views/qualityManagement/rawMaterial/components/inspectionFormDia.vue";
 import FormDia from "@/views/qualityManagement/rawMaterial/components/formDia.vue";
 import {ElMessageBox} from "element-plus";
-import {
-  downloadQualityInspect,
-  qualityInspectUpdate,
-  submitQualityInspect
-} from "@/api/qualityManagement/rawMaterialInspection.js";
 import FilesDia from "@/views/qualityManagement/rawMaterial/components/filesDia.vue";
 import dayjs from "dayjs";
 import {userListNoPage} from "@/api/system/user.js";
 import useUserStore from "@/store/modules/user";
-import {deleteRawMaterial, findRawMaterialListPage} from "@/api/qualityManagement/rawMaterial.js";
+import {
+  deleteRawMaterial,
+  findRawMaterialListPage,
+  submitRawMaterial, updateCheckUserName,downloadRawMaterial
+} from "@/api/qualityManagement/rawMaterial.js";
+import { checkPermi } from "@/utils/permission.js";
 
 const data = reactive({
   searchForm: {
-    supplier: "",
+    batchNo: "",
+    checkType: undefined,
+    inspectState: undefined,
     entryDate: undefined, // 褰曞叆鏃ユ湡
     entryDateStart: undefined,
     entryDateEnd: undefined,
   },
   rules: {
-    checkName: [{required: true, message: "璇烽�夋嫨", trigger: "change"}],
+    checkUserName: [{required: true, message: "璇烽�夋嫨", trigger: "change"}],
   },
 });
 const {searchForm, rules} = toRefs(data);
+
+const hasRawCancel = computed(() => checkPermi(["raw_cancel"]));
 const tableColumn = ref([
   {
     label: "妫�娴嬫棩鏈�",
@@ -99,7 +125,7 @@
   },
   {
     label: "妫�楠屽憳",
-    prop: "checkName",
+    prop: "checkUserName",
   },
   {
     label: "浜у搧鍚嶇О",
@@ -110,12 +136,8 @@
     prop: "model",
   },
   {
-    label: "鍗曚綅",
-    prop: "unit",
-  },
-  {
-    label: "鏁伴噺",
-    prop: "quantity",
+    label: "鎵规鍙�",
+    prop: "batchNo",
     width: 120
   },
   {
@@ -128,12 +150,19 @@
     prop: "checkResult",
     dataType: "tag",
     formatType: (params) => {
-      if (params === 1) {
+      if (params === 0) {
         return "danger";
-      } else if (params === 0) {
+      } else if (params === 1) {
         return "success";
       } else {
         return null;
+      }
+    },
+    formatData: (params) => {
+      if (params === 0) {
+        return "涓嶅悎鏍�";
+      } else if (params === 1) {
+        return "鍚堟牸";
       }
     },
   },
@@ -153,23 +182,25 @@
     label: "鎿嶄綔",
     align: "center",
     fixed: "right",
-    width: 280,
+        width: 320,
     operation: [
+          {
+            name: "璇︽儏",
+            type: "text",
+            clickFun: (row) => {
+              openForm("view", row);
+            },
+          },
       {
         name: "缂栬緫",
         type: "text",
         clickFun: (row) => {
           openForm("edit", row);
         },
-				disabled: (row) => {
-					// 宸叉彁浜ゅ垯绂佺敤
-					if (row.inspectState == 1) return true;
-					// 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳界紪杈�
-					if (row.checkName) {
-						return row.checkName !== userStore.nickName;
-					}
-					return false;
-				}
+        disabled: (row) => {
+          // 宸叉彁浜ゅ垯绂佺敤
+          if (row.inspectState == 1&&!hasRawCancel.value) return true;
+        }
       },
       {
         name: "闄勪欢",
@@ -184,30 +215,26 @@
         clickFun: (row) => {
           submit(row.id);
         },
-				disabled: (row) => {
-					// 宸叉彁浜ゅ垯绂佺敤
-					if (row.inspectState == 1) return true;
-					// 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳芥彁浜�
-					if (row.checkName) {
-						return row.checkName !== userStore.nickName;
-					}
-					return false;
-				}
+        disabled: (row) => {
+          // 宸叉彁浜ゅ垯绂佺敤
+          if (row.inspectState == 1) return true;
+          return false;
+        }
       },
-      {
-        name: "鍒嗛厤妫�楠屽憳",
-        type: "text",
-        clickFun: (row) => {
-          if (!row.checkName) {
-            open(row)
-          } else {
-            proxy.$modal.msgError("妫�楠屽憳宸插瓨鍦�");
-          }
-        },
-				disabled: (row) => {
-					return row.inspectState == 1 || row.checkName;
-				}
-      },
+      // {
+      //   name: "鍒嗛厤妫�楠屽憳",
+      //   type: "text",
+      //   clickFun: (row) => {
+      //     if (!row.checkUserName) {
+      //       open(row)
+      //     } else {
+      //       proxy.$modal.msgError("妫�楠屽憳宸插瓨鍦�");
+      //     }
+      //   },
+      //   disabled: (row) => {
+      //     return row.inspectState === 1 || row.checkUserName || row.checkUserName !== '';
+      //   }
+      // },
       {
         name: "涓嬭浇",
         type: "text",
@@ -224,7 +251,7 @@
 const userList = ref([]);
 const dialogFormVisible = ref(false);
 const form = ref({
-  checkName: ""
+  checkUserName: ""
 });
 const page = reactive({
   current: 1,
@@ -319,7 +346,7 @@
     type: "warning",
   })
       .then(() => {
-        proxy.download("/quality/qualityInspect/export", {inspectType: 0}, "鍘熸潗鏂欐楠�.xlsx");
+        proxy.download("/quality/rawMaterial/export", {}, "鍘熸枡妫�.xlsx");
       })
       .catch(() => {
         proxy.$modal.msg("宸插彇娑�");
@@ -328,7 +355,7 @@
 
 // 鎻愪环
 const submit = async (id) => {
-  const res = await submitQualityInspect({id: id})
+  const res = await submitRawMaterial(id)
   if (res.code === 200) {
     proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
     getList();
@@ -347,7 +374,7 @@
       ...form.value,
       id: currentRow.value.id
     }
-    qualityInspectUpdate(data).then(res => {
+    updateCheckUserName(data).then(res => {
       proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
       closeDia();
       getList();
@@ -363,7 +390,7 @@
 }
 
 const downLoadFile = (row) => {
-  downloadQualityInspect({ id: row.id }).then((blobData) => {
+  downloadRawMaterial({id: row.id}).then((blobData) => {
     const blob = new Blob([blobData], {
       type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
     })
@@ -371,7 +398,7 @@
 
     const link = document.createElement('a')
     link.href = downloadUrl
-    link.download = '鍘熸潗鏂欐楠屾姤鍛�.docx'
+    link.download = '鍘熸枡妫�楠屾姤鍛�.docx'
     document.body.appendChild(link)
     link.click()
 
@@ -385,4 +412,8 @@
 });
 </script>
 
-<style scoped></style>
+<style scoped>
+.search_title {
+  margin: 0 10px;
+}
+</style>

--
Gitblit v1.9.3