Переглянути джерело

1.全局用户列表。 2.报故完善

jiaxiaoqiang 1 рік тому
батько
коміт
70bd3e2550

+ 1 - 1
src/plugins/permission.ts

@@ -16,7 +16,7 @@ export function setupPermission() {
         NProgress.done();
       } else {
         const dictStore = useDictionaryStore();
-        dictStore.checkDicts();
+        dictStore.checkAllData();
         next();
         NProgress.done();
       }

+ 14 - 4
src/store/modules/dictionary.ts

@@ -1,12 +1,15 @@
 import { store } from "@/store";
 import { defineStore } from "pinia";
-import { getUserDicts } from "@/api/auth";
+import { getUserDicts, getUserList } from "@/api/auth";
 
 export const useDictionaryStore = defineStore("dictionaryStore", () => {
-  const types = ["unqualified_type", "stage"];
+  const types = ["unqualified_type", "stage", "process_state"];
   const dicts = ref<{ string?: any[] }>({});
 
-  function checkDicts() {
+  // 所有的用户列表
+  const allUsers = ref<any[]>([]);
+
+  function checkAllData() {
     if (JSON.stringify(dicts.value) === "{}") {
       getUserDicts(types).then((res) => {
         if (res.data) {
@@ -14,6 +17,12 @@ export const useDictionaryStore = defineStore("dictionaryStore", () => {
         }
       });
     }
+
+    if (allUsers.value.length === 0) {
+      getUserList().then((res) => {
+        allUsers.value = res.data || [];
+      });
+    }
   }
 
   function getLableByValue(type: string, value: string) {
@@ -28,7 +37,8 @@ export const useDictionaryStore = defineStore("dictionaryStore", () => {
   return {
     types,
     dicts,
-    checkDicts,
+    allUsers,
+    checkAllData,
     getLableByValue,
   };
 });

+ 43 - 32
src/views/pro-operation/report-break/index.vue

@@ -1,7 +1,9 @@
 <template>
   <el-drawer
     v-model="drawerVisible"
+    :close-on-click-modal="false"
     :show-close="false"
+    destroy-on-close
     direction="rtl"
     size="972px"
   >
@@ -26,6 +28,10 @@
                   <div class="item-value">{{ infoData?.materialName }}</div>
                 </div>
                 <div class="info-item">
+                  <div class="item-label">产品型号</div>
+                  <div class="item-value">{{ infoData?.spec }}</div>
+                </div>
+                <div class="info-item">
                   <div class="item-label">阶段</div>
                   <div class="item-value">
                     {{
@@ -43,27 +49,27 @@
               </div>
             </el-form-item>
             <el-form-item
-              :label="`报故数量[${formLabelAlign.seqNo.length}]`"
-              prop="escalationItemList"
+              :label="`报故数量[${formLabelAlign.seqNoList.length}]`"
+              prop="seqNoList"
             >
               <el-select
-                v-model="formLabelAlign.seqNo"
+                v-model="formLabelAlign.seqNoList"
                 multiple
                 placeholder="请选择"
-                value-key="seqNo"
+                value-key="value"
                 @change="selectProcessWorkSeqChange"
               >
                 <el-option
                   v-for="item in infoData?.processWorkSeq"
-                  :key="item.seqNo"
-                  :label="item.seqNo"
-                  :value="item.seqNo"
+                  :key="item"
+                  :label="item"
+                  :value="item"
                 />
               </el-select>
             </el-form-item>
-            <el-form-item label="不合格原因分类" prop="reason">
+            <el-form-item label="不合格原因分类" prop="reasonList">
               <el-select
-                v-model="formLabelAlign.reason"
+                v-model="formLabelAlign.reasonList"
                 multiple
                 placeholder="请选择"
                 value-key="dictValue"
@@ -82,9 +88,9 @@
                 <el-radio :value="1" border size="large">是</el-radio>
               </el-radio-group>
             </el-form-item>
-            <el-form-item label="不合格品分布情况及工序" prop="processes">
+            <el-form-item label="不合格品分布情况及工序" prop="processesList">
               <el-select
-                v-model="formLabelAlign.processes"
+                v-model="formLabelAlign.processesList"
                 multiple
                 placeholder="请选择"
                 value-key="operationId"
@@ -108,7 +114,7 @@
                     value-key="id"
                   >
                     <el-option
-                      v-for="item in allUsers"
+                      v-for="item in dictStroe.allUsers"
                       :key="item.id"
                       :label="item.userName"
                       :value="item.userName"
@@ -125,7 +131,7 @@
                     value-key="id"
                   >
                     <el-option
-                      v-for="item in allUsers"
+                      v-for="item in dictStroe.allUsers"
                       :key="item.id"
                       :label="item.userName"
                       :value="item.userName"
@@ -174,7 +180,7 @@ import {
 } from "@/api/process/reportBreak";
 import { useProcessStore } from "@/store/modules/processView";
 import { useDictionaryStore } from "@/store/modules/dictionary";
-import { getUserList } from "@/api/auth";
+import { getProcessInfo } from "@/api/prosteps";
 
 const processStore = useProcessStore();
 const dictStroe = useDictionaryStore();
@@ -185,9 +191,9 @@ const infoData = ref<any>({});
 
 const formRef = ref<InstanceType<typeof ElForm>>();
 const formLabelAlign = reactive({
-  seqNo: [],
-  reason: [],
-  processes: [],
+  seqNoList: [],
+  reasonList: [],
+  processesList: [],
   firstInspection: 0,
   personResponsible: "",
   userName: "",
@@ -206,26 +212,28 @@ const rules = reactive({
   archiveNumber: [
     { required: true, message: "请输入 归档编号", trigger: "blur" },
   ],
-  escalationItemList: [{ required: true, message: "请选择 ", trigger: "blur" }],
+  seqNoList: [{ required: true, message: "请选择 ", trigger: "blur" }],
 });
 
-// 获取所有用户列表
-const allUsers = ref<any[]>([]);
-
 const openReportBreakDrawer = () => {
-  drawerVisible.value = true;
-  breakReportInfoById(processStore.scanInfo.id).then((res) => {
-    infoData.value = res.data;
-  });
-  getUserList().then((res) => {
-    allUsers.value = res.data || [];
+  getProcessInfo(processStore.scanInfo.id).then((res) => {
+    processStore.scanInfo.currentState = res.data.currentState;
+    if (res.data.currentState === "start") {
+      ElMessage.error("当前工单状态不允许报故");
+      return;
+    } else {
+      drawerVisible.value = true;
+      breakReportInfoById(processStore.scanInfo.id).then((res) => {
+        infoData.value = res.data;
+      });
+    }
   });
 };
 
 // 报故数量,选择工序号相关. 选择之后获取工序列表
 const operationList = ref<any[]>([]);
 const selectProcessWorkSeqChange = useDebounceFn(() => {
-  operationListByIds(formLabelAlign.escalationItemList).then((res) => {
+  operationListByIds(formLabelAlign.seqNoList).then((res) => {
     operationList.value = res.data;
   });
 }, 2000);
@@ -270,17 +278,16 @@ defineExpose({
 }
 
 .base-info {
-  height: 351px;
   width: 100%;
   background: #e3e5e7;
   border-radius: 16px 16px 16px 16px;
+  padding: 0 30px;
 
   .info-item {
     display: flex;
     justify-content: space-between;
     align-items: center;
     height: 64px;
-    padding: 0 30px;
 
     .item-label {
       font-size: 20px;
@@ -293,13 +300,17 @@ defineExpose({
       color: rgba(0, 0, 0, 0.9);
     }
   }
+
+  .info-item:not(:last-child) {
+    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
+  }
 }
 
 .bottom-btns {
   display: flex;
   justify-content: center;
-  margin-top: 20px;
-  margin-bottom: 20px;
+  //margin-top: 20px;
+  //margin-bottom: 20px;
 
   .button {
     margin-right: 20px;