ezhizao_zx 3 months ago
parent
commit
a179c3f009

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

@@ -166,3 +166,11 @@ export function recoverBatches(data) {
     data: data
   })
 }
+
+export function checkLotCarrierCategory(data) {
+  return request({
+    url: baseUrl + '/business/lot/checkLotCarrierCategory',
+    method: 'post',
+    data: data
+  })
+}

+ 7 - 1
src/store/modules/user.js

@@ -9,7 +9,8 @@ const useUserStore = defineStore('user', {
     name: '',
     avatar: '',
     roles: [],
-    permissions: []
+    permissions: [],
+    depts: []
   }),
   actions: {
     // 登录
@@ -50,6 +51,11 @@ const useUserStore = defineStore('user', {
             this.user = user
             this.name = user.userName
             this.avatar = avatar
+            if (res.depts != null) {
+              this.depts = res.depts
+            } else {
+              this.depts = []
+            }
             resolve(res)
           })
           .catch((error) => {

+ 46 - 2
src/views/business/lot/index.vue

@@ -160,6 +160,11 @@ import onceChange from "@/views/business/reviseBath/onceSingleChangeDialog.vue";
 import InBatchesDialog from "@/views/business/lot/InBatchesDialog.vue";
 import { ref } from "vue";
 import lotStore from "@/store/modules/lot";
+import auth from '@/plugins/auth'
+import useUserStore from "@/store/modules/user";
+import {
+  checkLotCarrierCategory
+} from '@/api/business/lot.js'
 
 const route = useRoute();
 const { proxy } = getCurrentInstance();
@@ -268,7 +273,27 @@ function handleMultiSingleChange() {
     proxy.$modal.msgError("多批单改只能修改未修改过的批次");
     return;
   }
-  proxy.$refs.multiChangeRef.open(selections);
+
+  // 判断是否有全工段单批单改权限
+  // 没有该权限则判断当前是否在当前工段
+  // 不在当前工段返回错误
+  // 在当前工段向下进行。
+  if (!auth.hasPermi('business:lot:singleChangeForAll')) {
+    if (selections.value.some(v => useUserStore().depts.findIndex(t => t.deptId == v.deptId) < 0)) {
+      proxy.$message.error("您不在当前工段,无法进行多批单改操作");
+      return
+    }
+  }
+  checkLotCarrierCategory(selections.value.map(e => ({ id: e.lotId }))).then(res => {
+    if (res.code == 200) {
+      proxy.$refs.multiChangeRef.open(selections);
+    } else {
+      proxy.$message.error("修改批次有绑定一箱多批的载具,请更换普通载具进行修改");
+    }
+  }).catch(err => {
+    // console.log(err)
+  })
+  // proxy.$refs.multiChangeRef.open(selections);
 }
 
 /** 打开批次详情页 */
@@ -282,8 +307,27 @@ function handleOnceSingleChange() {
     proxy.$message.error("批废不能再进行操作");
     return;
   }
+  // 判断当前工段是否可以单批单改
+  // 判断是否有全工段单批单改权限
+  // 没有该权限则判断当前是否在当前工段
+  // 不在当前工段返回错误
+  // 在当前工段向下进行。
+  console.log(useUserStore().depts)
+  if (!auth.hasPermi('business:lot:singleChangeForAll')) {
+    if (useUserStore().depts.findIndex(t => t.deptId == selections.value[0].deptId) < 0) {
+      proxy.$message.error("您不在当前工段,无法进行单批单改操作");
+      return
+    }
+  }
 
-  proxy.$refs.onceChangeRef.open(selections.value[0].lotCode);
+  checkLotCarrierCategory(selections.value.map(e => ({ id: e.lotId }))).then(res => {
+    if (res.code == 200) {
+      proxy.$refs.onceChangeRef.open(selections.value[0].lotCode);
+    } else {
+      proxy.$message.error("修改批次有绑定一箱多批的载具,请更换普通载具进行修改");
+    }
+  })
+  // proxy.$refs.onceChangeRef.open(selections.value[0].lotCode);
 }
 
 /**获取生产计划列表 */

+ 45 - 110
src/views/business/reviseBath/lotFormParticulars.vue

@@ -1,12 +1,6 @@
 <template>
   <div v-if="!loading" class="page-container column-container">
-    <el-form
-      class="list-search"
-      style=""
-      :model="lot"
-      ref="queryRef"
-      :inline="true"
-    >
+    <el-form class="list-search" style="" :model="lot" ref="queryRef" :inline="true">
       <el-row style="margin-top: 10px">
         <el-form-item class="bold-large">
           <span>{{ "批次号:" }}</span>
@@ -22,12 +16,7 @@
           <el-tag v-if="lot.isAmend == 1" class="spacing" type="danger">{{
             "工艺修改"
           }}</el-tag>
-          <el-tag
-            v-if="lot.isWasteRecycling == 1"
-            class="spacing"
-            type="primary"
-            >{{ "废品回用" }}</el-tag
-          >
+          <el-tag v-if="lot.isWasteRecycling == 1" class="spacing" type="primary">{{ "废品回用" }}</el-tag>
         </el-form-item>
       </el-row>
 
@@ -197,124 +186,50 @@
     </el-form>
     <div style="padding: 16px">
       <span style="font-weight: bold; font-size: 18px">工艺路线</span>
-      <el-button
-        v-if="showVerify(true, 'business:lot:onceSingleChange')"
-        type="primary"
-        style="float: right; margin-left: 10px"
-        @click="handleOnceSingleChange"
-      >
+      <el-button v-if="showVerify(true, 'business:lot:onceSingleChange')" type="primary"
+        style="float: right; margin-left: 10px" @click="handleOnceSingleChange">
         单批单改
       </el-button>
-      <el-button
-        v-if="showVerify(true, 'business:lot:inBatch')"
-        type="primary"
-        style="float: right; margin-left: 10px"
-        @click="handleSplit()"
-      >
+      <el-button v-if="showVerify(true, 'business:lot:inBatch')" type="primary" style="float: right; margin-left: 10px"
+        @click="handleSplit()">
         分批
       </el-button>
-      <el-button
-        v-if="showVerify(true, 'business:lot:waste')"
-        :disabled="lot.isWaste == 1"
-        type="danger"
-        style="float: right; margin-left: 10px"
-        @click="handlelotWaste(route.params.lotCode)"
-      >
+      <el-button v-if="showVerify(true, 'business:lot:waste')" :disabled="lot.isWaste == 1" type="danger"
+        style="float: right; margin-left: 10px" @click="handlelotWaste(route.params.lotCode)">
         批废
       </el-button>
-      <el-button
-        v-if="showVerify(lot.isAmend == 1, 'business:lot:standard')"
-        type="primary"
-        style="float: right; margin-left: 10px"
-        @click="handleStandardProcess(lot.technologicalProcessId)"
-      >
+      <el-button v-if="showVerify(lot.isAmend == 1, 'business:lot:standard')" type="primary"
+        style="float: right; margin-left: 10px" @click="handleStandardProcess(lot.technologicalProcessId)">
         查看标准工艺
       </el-button>
     </div>
     <div class="el-table-container">
       <div class="el-table-inner-container">
-        <el-table
-          height="95%"
-          :data="processDetails"
-          @row-click="handleRowClick"
-        >
-          <el-table-column
-            type="index"
-            label="行号"
-            align="center"
-          ></el-table-column>
-          <el-table-column
-            label="工序名称"
-            prop="processAlias"
-            align="center"
-          ></el-table-column>
+        <el-table height="95%" :data="processDetails" @row-click="handleRowClick">
+          <el-table-column type="index" label="行号" align="center"></el-table-column>
+          <el-table-column label="工序名称" prop="processAlias" align="center"></el-table-column>
           <el-table-column label="状态" prop="status" align="center">
             <template #default="scope">
               <span>{{ getStatusText(scope.row.status) }}</span>
             </template>
           </el-table-column>
-          <el-table-column
-            label="投产量"
-            prop="investNum"
-            align="center"
-          ></el-table-column>
-          <el-table-column
-            label="合格量"
-            prop="qualifiedNum"
-            align="center"
-          ></el-table-column>
-          <el-table-column
-            label="废品量"
-            prop="abandonNum"
-            align="center"
-          ></el-table-column>
-          <el-table-column
-            label="结束日期"
-            prop="endTime"
-            align="center"
-          ></el-table-column>
+          <el-table-column label="投产量" prop="investNum" align="center"></el-table-column>
+          <el-table-column label="合格量" prop="qualifiedNum" align="center"></el-table-column>
+          <el-table-column label="废品量" prop="abandonNum" align="center"></el-table-column>
+          <el-table-column label="结束日期" prop="endTime" align="center"></el-table-column>
         </el-table>
       </div>
     </div>
     <once-change ref="onceChangeRef" @handleSaveSuccess="init" />
     <lot-waste-dialog ref="lotWasteDialogRef" @handleSaveSuccess="init" />
-    <el-dialog
-      title="标准工序"
-      v-model="visible"
-      width="680px"
-      append-to-body
-      draggable
-    >
+    <el-dialog title="标准工序" v-model="visible" width="680px" append-to-body draggable>
       <div class="el-table-inner-container">
-        <el-table
-          style="height: 600px"
-          @selection-change="handleSelectionChange"
-          :data="processList"
-        >
-          <el-table-column
-            type="selection"
-            :selectable="checkSelectable"
-            width="50"
-            align="center"
-          />
-          <el-table-column
-            type="index"
-            label="序号"
-            width="50"
-            align="center"
-          ></el-table-column>
-          <el-table-column
-            label="工序名称"
-            prop="processAlias"
-            align="center"
-          />
-
-          <el-table-column
-            label="工序编号"
-            prop="processStepNumber"
-            width="200"
-            align="center"
-          />
+        <el-table style="height: 600px" @selection-change="handleSelectionChange" :data="processList">
+          <el-table-column type="selection" :selectable="checkSelectable" width="50" align="center" />
+          <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
+          <el-table-column label="工序名称" prop="processAlias" align="center" />
+
+          <el-table-column label="工序编号" prop="processStepNumber" width="200" align="center" />
         </el-table>
       </div>
     </el-dialog>
@@ -334,8 +249,12 @@ import {
   lotParticulars,
   selectStandardProcess,
 } from "@/api/business/technologicalAmend.js";
+import {
+  checkLotCarrierCategory
+} from '@/api/business/lot.js'
 import lotWasteDialog from "./dayworkWasteDialog.vue";
 const { proxy } = getCurrentInstance();
+import auth from '@/plugins/auth'
 
 /** 查询 对象 */
 const processDetails = ref([]);
@@ -368,7 +287,23 @@ function handleOnceSingleChange() {
     proxy.$message.error("批废不能再进行操作");
     return;
   }
-  proxy.$refs.onceChangeRef.open(lot.value.lotCode);
+  // 判断是否有全工段单批单改权限
+  // 没有该权限则判断当前是否在当前工段
+  // 不在当前工段返回错误
+  // 在当前工段向下进行。
+  if (!auth.hasPermi('business:lot:singleChangeForAll')) {
+    if (useUserStore().depts.findIndex(t => t.deptId == lot.value.daywork.deptId) < 0) {
+      proxy.$message.error("您不在当前工段,无法进行单批单改操作");
+      return
+    }
+  }
+  checkLotCarrierCategory([lot.value]).then(res => {
+    if (res.code == 200) {
+      proxy.$refs.onceChangeRef.open(lot.value.lotCode);
+    } else {
+      proxy.$message.error("修改批次有绑定一箱多批的载具,请更换普通载具进行修改");
+    }
+  })
 }
 
 /** 按钮是否显示 */