guoyujia před 10 měsíci
rodič
revize
f53241dd24

+ 7 - 0
src/api/business/processInspecion.js

@@ -17,6 +17,13 @@ export function getInspecion(id) {
     method: 'get'
   })
 }
+export function getDayworkItemInspectionDetail(data) {
+	return request({
+		url: baseUrl + '/business/inspecion/getDayworkItemInspectionDetail',
+		method: 'post',
+		data:data
+	})
+}
 
 // 新增序检主表
 export function addInspecion(data) {

+ 8 - 0
src/api/system/user.js

@@ -126,6 +126,14 @@ export function delDeptUser(data) {
     data: data
   })
 }
+//查询用户分配的权限
+export function selectUserPermissionList(data) {
+  return request({
+    url: baseUrl + '/system/user/selectUserPermissionList',
+    method: 'post',
+    data: data
+  })
+}
 // 修改用户
 export function updateUser(data) {
   return request({

+ 55 - 24
src/views/business/dayworkMaxUpdate/form.vue

@@ -92,9 +92,9 @@
             <el-form-item label="当前载具:" prop="carrierIds" label-width="82px">
               <el-select v-model="form.carrierIds" multiple
             filterable remote reserve-keyword placeholder="请选择载具" value-key="value" style="width: 300px;"
-            :remote-method="(arg) => remoteCarriers(arg, form.carriers)" :loading="loadingCarrier"
+            :remote-method="(arg) => remoteCarriers(arg, form.carrierList)" :loading="loadingCarrier"
             @change="(arg) => handleCarrierChange(arg)">
-            <el-option v-for="item in carriers" :key="item.value" :label="item.label" :value="item.value" />
+            <el-option v-for="item in form.carriers" :key="item.value" :label="item.label" :value="item.value" />
           </el-select>
           <el-popover placement="top-start" effect="dark" trigger="hover"
                                     content="修改载具仅修改最新当前载具,无法修改绑定历史记录。">
@@ -297,9 +297,9 @@ const open = (row) => {
     });
     lotId.value = row.lotId;
     //页面操作是编辑还是删除
-    console.log("row", row);
+    // console.log("row", row);
     detailInfo.value = proxy.deepClone(row);
-    console.log(detailInfo.value);
+    // console.log(detailInfo.value);
     //是否是当前工序
     currentDept.value = row.currentDept;
     form.value.id = row.id;
@@ -367,12 +367,10 @@ function getCarriers() {
         ...res.rows.map((v) => ({ value: v.id, label: v.code }))
       );
       carriers.value.push(...form.value.carriers);
-      console.log(carriers.value);
     }
   });
 }
 function getNowCarriers(data) {
-  console.log(data)
       form.value.carriers =
         data.carrierList && data.carrierList.length > 0
           ? data.carrierList.map((v) => ({
@@ -387,20 +385,30 @@ function getNowCarriers(data) {
           code: v.carrierCode,
         }))
         : []
-        console.log(carriers)
-        console.log()
         const carrierIds =   data.carrierList && data.carrierList.length > 0
           ? data.carrierList.map((v) => (
              v.carrierId
           ))
           : [];
       form.value.carrierIds = carrierIds.filter(v => carriers.some(e => e.id == v));
-      console.log(form.value.carriers)
-      getCarriers()
+      carriers.value = data.carrierList && data.carrierList.length > 0
+        ? data.carrierList.map((v) => ({
+          id: v.carrierId,
+          code: v.carrierCode,
+        }))
+        : []
+      form.value.carrierList = data.carrierList && data.carrierList.length > 0
+        ? data.carrierList.map((v) => ({
+          id: v.carrierId,
+          code: v.carrierCode,
+        }))
+        : []
+      console.log(carriers.value)
+      // getCarriers()
   
 }
 function remoteCarriers(queryString, choiced) {
-  console.log(choiced);
+      console.log(choiced)
   loadingCarrier.value = true;
   getListNotInspectionList({
     isAbandoned: 0,
@@ -408,32 +416,55 @@ function remoteCarriers(queryString, choiced) {
     code: queryString != "" ? queryString : null,
   }).then((res) => {
     if (res.code === 200) {
-      carriers.value = res.rows.map((v) => ({
+      form.value.carriers = res.rows.map((v) => ({
         value: v.id,
         label: v.code,
         category: v.categoryId,
       }));
-      console.log(carriers.value)
-      carriers.value.push(
-        ...choiced
-          .filter((v) => !carriers.value.map((e) => e.value).includes(v.id))
-          .map((v) => ({ value: v.id, label: v.code }))
+      // console.log(form.value.carriers.length)
+      // console.log(carriers.value,"data")
+
+      if(choiced.length>0 &&choiced[0].id != undefined) {
+        choiced =  choiced.map((v) => ({
+        value:v.id,
+        label:v.code
+      }));
+      }
+
+      let distinctList = []
+      choiced.forEach(item => {
+          if(!form.value.carriers.some(v => v.value == item.value) ){
+            distinctList.push(item)
+          }
+      });
+      console.log(distinctList)
+      form.value.carriers.push(
+        ...distinctList
+          // .filter((v) => !carriers.value.map((e) => e.value).includes(v.id))
       );
+      
+      console.log( form.value.carrierList)
     } else {
-      carriers.value = [];
-      carriers.value.push(...choiced);
+      form.value.carriers = [];
+      form.value.carriers.push(...choiced);
     }
+    console.log(res.rows)
+    // console.log(carriers.value)
+    // console.log(form.value.carriers)
     loadingCarrier.value = false;
   });
-  console.log(carriers.value)
 }
 
 function handleCarrierChange(arg) {
-  console.log(arg)
-  form.value.carriers = carriers.value
+  console.log(from.value.carrierIds)
+  console.log(form.value.carriers)
+  console.log(carriers.value)
+  form.value.carriers = form.value.carrierList
     .filter((v) => arg.includes(v.value))
-    .map((v) => ({ id: v.value, code: v.label }));
-    console.log(form.value.carriers)
+    .map((v) => ({ value: v.id, label: v.code }));
+
+    form.value.carrierList = form.value.carrierList
+    .filter((v) => arg.includes(v.value));
 }
 function getEquipmentInfo(data) {
   getEquipmentList({

+ 19 - 17
src/views/business/dayworkMaxUpdate/index.vue

@@ -27,8 +27,9 @@
             <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 link type="primary" v-hasPermi="['business:productionPlan:query']"
+                <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" />
@@ -109,7 +110,8 @@ import {
   delDayworkItem
 } from "@/api/business/daywork.js";
 import { listDeptProcess } from "@/api/business/deptProcess";
-import { getDept } from "@/api/business/planDetailSubDetail.js";
+import { selectUserPermissionList } from "@/api/system/user.js";
+import useUserStore from '@/store/modules/user'
 import router from "@/router";
 import dayworkItemForm from "./form";
 import sortItemForm from "./sortForm"
@@ -126,8 +128,7 @@ const dayworkTable = ref(null);
 const currentDaywork = ref({});
 const dayworkLoading = ref(false);
 const total = ref(0);
-/**工段 */
-const deptList = ref([]);
+const permissionFlag = ref(false);
 const loading = ref(false);
 /** 报工信息 */
 const dayworkItemList = ref([]);
@@ -136,7 +137,7 @@ const itemTotal = ref(0);
 const lastStatus = ref(null)
 const latestProcessId = ref(null);
 const latestDeptId = ref(null)
-const lastProcessStepNumber = ref(null)
+const permissionList = ref(null)
 const deptProcessList = ref([]);
 /**工序 */
 const processList = ref([]);
@@ -160,17 +161,7 @@ const queryItemParams = ref({
 /***********************  工段相关事件  ****************************/
 function getList() {
   loading.value = true;
-  // getDept().then((response) => {
-  //   deptList.value = response.data;
-  //   loading.value = false;
-  //   // if (deptList.value.length > 0) {
-  //   //   queryDayworkParams.value.deptId = deptList.value[0].value;
-  //   //   getDayworks();
-  //   // } else {
-  //   //   dayworkList.value = [];
-  //   // }
-
-  // });
+  getPremission();
   getDayworks()
 }
 
@@ -180,7 +171,18 @@ function handleDeptChange() {
 }
 
 /***********************  生产批次相关事件  ****************************/
-
+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 getDayworks() {
   dayworkLoading.value = true;

+ 54 - 22
src/views/business/dayworkMaxUpdate/sortForm.vue

@@ -82,9 +82,9 @@
             <el-form-item label="载具:" prop="carrierIds" label-width="82px">
               <el-select v-model="form.carrierIds" multiple
             filterable remote reserve-keyword placeholder="请选择载具" value-key="value" style="width: 300px;"
-            :remote-method="(arg) => remoteCarriers(arg, form.carriers)" :loading="loadingCarrier"
+            :remote-method="(arg) => remoteCarriers(arg, form.carrierList)" :loading="loadingCarrier"
             @change="(arg) => handleCarrierChange(arg)">
-            <el-option v-for="item in carriers" :key="item.value" :label="item.label" :value="item.value" />
+            <el-option v-for="item in form.carriers" :key="item.value" :label="item.label" :value="item.value" />
           </el-select>
           <el-popover placement="top-start" effect="dark" trigger="hover"
                                     content="修改载具仅修改最新当前载具,无法修改绑定历史记录。">
@@ -362,8 +362,7 @@ function getCarriers() {
   });
 }
 function getNowCarriers(data) {
-  console.log(data)
-      form.value.carriers =
+  form.value.carriers =
         data.carrierList && data.carrierList.length > 0
           ? data.carrierList.map((v) => ({
             value: v.carrierId,
@@ -377,20 +376,30 @@ function getNowCarriers(data) {
           code: v.carrierCode,
         }))
         : []
-        console.log(carriers)
-        console.log()
         const carrierIds =   data.carrierList && data.carrierList.length > 0
           ? data.carrierList.map((v) => (
              v.carrierId
           ))
           : [];
       form.value.carrierIds = carrierIds.filter(v => carriers.some(e => e.id == v));
-      console.log(form.value.carriers)
-      getCarriers()
+      carriers.value = data.carrierList && data.carrierList.length > 0
+        ? data.carrierList.map((v) => ({
+          id: v.carrierId,
+          code: v.carrierCode,
+        }))
+        : []
+      form.value.carrierList = data.carrierList && data.carrierList.length > 0
+        ? data.carrierList.map((v) => ({
+          id: v.carrierId,
+          code: v.carrierCode,
+        }))
+        : []
+      console.log(carriers.value)
+      // getCarriers()
   
 }
 function remoteCarriers(queryString, choiced) {
-  console.log(choiced);
+  console.log(choiced)
   loadingCarrier.value = true;
   getListNotInspectionList({
     isAbandoned: 0,
@@ -398,32 +407,55 @@ function remoteCarriers(queryString, choiced) {
     code: queryString != "" ? queryString : null,
   }).then((res) => {
     if (res.code === 200) {
-      carriers.value = res.rows.map((v) => ({
+      form.value.carriers = res.rows.map((v) => ({
         value: v.id,
         label: v.code,
         category: v.categoryId,
       }));
-      console.log(carriers.value)
-      carriers.value.push(
-        ...choiced
-          .filter((v) => !carriers.value.map((e) => e.value).includes(v.id))
-          .map((v) => ({ value: v.id, label: v.code }))
+      // console.log(form.value.carriers.length)
+      // console.log(carriers.value,"data")
+
+      if(choiced.length>0 &&choiced[0].id != undefined) {
+        choiced =  choiced.map((v) => ({
+        value:v.id,
+        label:v.code
+      }));
+      }
+
+      let distinctList = []
+      choiced.forEach(item => {
+          if(!form.value.carriers.some(v => v.value == item.value) ){
+            distinctList.push(item)
+          }
+      });
+      console.log(distinctList)
+      form.value.carriers.push(
+        ...distinctList
+          // .filter((v) => !carriers.value.map((e) => e.value).includes(v.id))
       );
+      
+      console.log( form.value.carrierList)
     } else {
-      carriers.value = [];
-      carriers.value.push(...choiced);
+      form.value.carriers = [];
+      form.value.carriers.push(...choiced);
     }
+    console.log(res.rows)
+    // console.log(carriers.value)
+    // console.log(form.value.carriers)
     loadingCarrier.value = false;
   });
-  console.log(carriers.value)
 }
 
 function handleCarrierChange(arg) {
-  console.log(arg)
-  form.value.carriers = carriers.value
+  console.log(from.value.carrierIds)
+  console.log(form.value.carriers)
+  console.log(carriers.value)
+  form.value.carriers = form.value.carrierList
     .filter((v) => arg.includes(v.value))
-    .map((v) => ({ id: v.value, code: v.label }));
-    console.log(form.value.carriers)
+    .map((v) => ({ value: v.id, label: v.code }));
+
+    form.value.carrierList = form.value.carrierList
+    .filter((v) => arg.includes(v.value));
 }
 //查看工艺路线
 function handleViewProcess() {

+ 19 - 15
src/views/business/dayworkUpdate/index.vue

@@ -27,8 +27,9 @@
             <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 link type="primary" v-hasPermi="['business:productionPlan:query']"
+                <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" />
@@ -109,10 +110,11 @@ import {
   delDayworkItem
 } from "@/api/business/daywork.js";
 import { listDeptProcess } from "@/api/business/deptProcess";
-import { getDept } from "@/api/business/planDetailSubDetail.js";
+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'
 import DialogDayworkItemHistory from "./DialogDayworkItemHistory.vue";
 
 const { proxy } = getCurrentInstance();
@@ -127,7 +129,7 @@ const currentDaywork = ref({});
 const dayworkLoading = ref(false);
 const total = ref(0);
 /**工段 */
-const deptList = ref([]);
+const permissionFlag = ref(false);
 const loading = ref(false);
 /** 报工信息 */
 const dayworkItemList = ref([]);
@@ -136,7 +138,7 @@ const itemTotal = ref(0);
 const lastStatus = ref(null)
 const latestProcessId = ref(null);
 const latestDeptId = ref(null)
-const lastProcessStepNumber = ref(null)
+const permissionList = ref(null)
 const deptProcessList = ref([]);
 /**工序 */
 const processList = ref([]);
@@ -160,17 +162,7 @@ const queryItemParams = ref({
 /***********************  工段相关事件  ****************************/
 function getList() {
   loading.value = true;
-  // getDept().then((response) => {
-  //   deptList.value = response.data;
-  //   loading.value = false;
-  //   // if (deptList.value.length > 0) {
-  //   //   queryDayworkParams.value.deptId = deptList.value[0].value;
-  //   //   getDayworks();
-  //   // } else {
-  //   //   dayworkList.value = [];
-  //   // }
-
-  // });
+  getPremission();
   getDayworks()
 }
 
@@ -206,6 +198,18 @@ function getDayworks() {
     }
   });
 }
+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) {