From 3045d2e0ff01c40d836ae3b64ff15e71563e4ab4 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期四, 07 十二月 2023 08:30:22 +0800
Subject: [PATCH] 添加根据用户权限控制主界面功能

---
 CanadaMes-ui/src/views/home/index.vue |  152 +++++++++++++++++++++++++++++++++-----------------
 1 files changed, 100 insertions(+), 52 deletions(-)

diff --git a/CanadaMes-ui/src/views/home/index.vue b/CanadaMes-ui/src/views/home/index.vue
index 88190e1..68e98c2 100644
--- a/CanadaMes-ui/src/views/home/index.vue
+++ b/CanadaMes-ui/src/views/home/index.vue
@@ -199,9 +199,12 @@
     font-size: 25px;
 }
 
-@media screen and (min-width: 1900px) { 
-    .blocks{transform: scale(1.5,1.05);width: 1210px;}
-} 
+@media screen and (min-width: 1900px) {
+    .blocks {
+        transform: scale(1.5, 1.05);
+        width: 1210px;
+    }
+}
 
 .el-message-box__btns {
     padding: 0px 15px 0;
@@ -228,7 +231,8 @@
             </div>
             <div style="display:flex;justify-content: space-around;width: 9zz5%;margin: 0 auto;">
                 <el-input style="width:15%;" :placeholder="$t('Enter the glass barcode')" v-model="glassid1"></el-input>
-                <el-button type="primary" @click="SelectGlassByGlassIDs(2)">{{ $t('Manually Infeed Glass') }}</el-button>
+                <el-button type="primary" @click="SelectGlassByGlassIDs(2)" :disabled="ManuallyInfeedGlass">
+                    {{ $t('Manually Infeed Glass') }}</el-button>
                 <!-- <el-input style="width:15%;" :placeholder="$t('Enter the Order No')" v-model="order"></el-input>
                 <el-button type="warning" @click="showform1();">{{ $t('Exit the glass by order number') }}</el-button> -->
             </div>
@@ -312,14 +316,19 @@
                         @click="showcageinfo(item['cage'])"></div>
                 </div>
                 <div class="blue gezi"
-                    :style="{ display: 'flex', position: 'absolute', float: 'left', top: 105 + 'px', left: 1050 + 'px', height: loadglassheight + 'px', width: 5 + 'px' }">
+                    :style="{ display: 'flex', position: 'absolute', float: 'left', top: 28 + 'px', left: 1050 + 'px', height: loadglassheight1 + 'px', width: 4 + 'px' }">
+                </div>
+                <div class="blue gezi"
+                    :style="{ display: 'flex', position: 'absolute', float: 'left', top: 105 + 'px', left: 1050 + 'px', height: loadglassheight2 + 'px', width: 4 + 'px' }">
                 </div>
                 <div class="blocks-img" :style="{ left: car1 + 'px', top: '16px' }"></div>
                 <div class="blocks-img" :style="{ left: car2 + 'px', top: '175px' }"></div>
                 <div class="blocks-img2"></div>
                 <div class="blocks-img3"></div>
-                <el-button class="orderbutton1" type="primary" @click="showform2()">{{ $t('OrderInfo') }}</el-button>
-                <el-button class="orderbutton2" type="primary" @click="showform6()">{{ $t('Outing Queue') }}</el-button>
+                <el-button class="orderbutton1" type="primary" @click="showform2()" :disabled="OrderInfo">{{ $t('OrderInfo')
+                }}</el-button>
+                <el-button class="orderbutton2" type="primary" @click="showform6()" :disabled="OutingQueue">
+                    {{ $t('Outing Queue') }}</el-button>
 
                 <!-- <div style="display:flex;position: absolute;float:left;z-index: 999;top:112px;left:328px;">
                     <div :class="getStatusClass(item.state)" v-for="(item,index) in cagelist1" :key="item['date']"
@@ -639,17 +648,20 @@
                 <el-table-column prop="barcode" :label="$t('Frame No')"></el-table-column>
                 <el-table-column :width="280" :label="$t('Operate')">
                     <template slot-scope='scope'>
-                        <el-button type="text" size="small" @click="getTopMove(scope.row, scope.$index)" style="font-size: 15px;"
+                        <el-button type="text" size="small" @click="getTopMove(scope.row, scope.$index)"
+                            style="font-size: 15px;"
                             :disabled="(scope.$index == 0 || isAllowQueue == true || scope.row.state == 1)">
-                            {{$t('Top')}}
+                            {{ $t('Top') }}
                         </el-button>
-                        <el-button type="text" size="small" @click="getUpMove(scope.row, scope.$index)" style="font-size: 15px;"
+                        <el-button type="text" size="small" @click="getUpMove(scope.row, scope.$index)"
+                            style="font-size: 15px;"
                             :disabled="(scope.$index == 0 || isAllowQueue == true || scope.row.state == 1)">
-                            {{$t('Up')}}
+                            {{ $t('Up') }}
                         </el-button>
-                        <el-button type="text" size="small" @click="getDownMove(scope.row, scope.$index)" style="font-size: 15px;"
+                        <el-button type="text" size="small" @click="getDownMove(scope.row, scope.$index)"
+                            style="font-size: 15px;"
                             :disabled="(OutSlice.length - 1 == scope.$index || isAllowQueue == true || scope.row.state == 1)">
-                            {{$t('Down')}}
+                            {{ $t('Down') }}
                         </el-button>
                         <el-button type="primary" style="padding: 4px 10px;font-size: 12px;" :disabled="isAllowQueue"
                             @click="deleteproductionqueueglass(scope.row.barcode)">{{ $t('Delete') }}</el-button>
@@ -702,7 +714,7 @@
 import {
     home, home2, InsertOrder, Addglassid, UpdateTask, SelectAlarmmgInfo, SelectCageInfo, DeleteByGlassID, OutByGlassID, Loadcarlist,
     SelectPassword, SelectGlassByGlassID, Disabled, Inglassid, SelectGlass, InsertQueueGlassId, UpdateQueueState, DeleteQueueGlass, SelectGlassNo,
-    SelectAluminumFrameInfoById, DeleteProductionQueueGlass, AddOutSliceS, isAllowQueues, isConfirmStates
+    SelectAluminumFrameInfoById, DeleteProductionQueueGlass, AddOutSliceS, isAllowQueues, isConfirmStates, SelectPermissionByUserName, currentUsername
 } from "../../api/home";
 
 
@@ -761,7 +773,8 @@
             cageinfo: [],
             cage: 0,
             carlist: [],
-            loadglassheight: 0,
+            loadglassheight1: 0,
+            loadglassheight2: 0,
             password: 1,
             text: "",
             zhuangtai: "",
@@ -776,13 +789,16 @@
             currentPages: 1,  //榛樿鍒濆椤�
             pagesizes: 21,    //姣忛〉榛樿鏄剧ず鐨勬暟鎹�
             pageCounts: 0,
-
             OutSlice: [],
             AluminumFrame: [],
             framebarcode: "",
             isAllowQueue: true,
             FrameNoFlag: "",
-            isConfirm: true
+            isConfirm: true,
+            ManuallyInfeedGlass: true,
+            OutingQueue: true,
+            OrderInfo: true,
+            CageDetails: true
         };
     },
     created() {
@@ -835,32 +851,37 @@
                         this.OutSlice = obj.listoutslice[0];
                     }
                     //鑾峰彇涓婄墖浣嶇幓鐠冧俊鎭�
-                    this.loadglassheight = obj.loadglassheight;
+
                     if (obj.zhuangtai != null) {
                         this.zhuangtai = obj.zhuangtai[0];
                     }
                     //涓婄墖浣嶇幓鐠冧俊鎭�
                     if (obj.form2 != null && obj.form2 != "") {
                         this.form2 = obj.form2[0];
+                        this.loadglassheight2 = 70;
                     } else {
                         this.form2 = {};
                     }
-                    
+
                     //鏄惁闇�瑕佹墜鍔ㄧ‘璁や笂鐗�
                     this.isConfirm = obj.isConfirm[0];
                     //鎵爜浣嶇幓鐠冧俊鎭�
                     if (obj.form3 != null && obj.form3 != "" && obj.state[0] == 1) {
                         this.form3 = obj.form3[0];
+                        this.loadglassheight1 = 70;
                     } else {
                         this.form3 = {};
                     }
                     if (obj.form3 != null && obj.form3 != "" && obj.state[0] == 0) {
+                        this.loadglassheight1 = 70;
                         this.form5 = obj.form3[0];
                         this.showform3();
                         this.Sizerange(this.form5, 3);
-
+                        this.glassid1="";
                     } else {
-                        this.Sizerange(this.form5, 3);
+                        if(this.glassid1==""){
+                            this.DeleteBarcodeGlass();
+                        }
                     }
                     //鏁版嵁搴撹繛鎺ユ槸鍚︽甯�
                     if (obj.dbconnected == "false") {
@@ -888,6 +909,26 @@
             }
         },
         load() {
+            //鍔犺浇鐢ㄦ埛鏉冮檺
+            currentUsername().then(res => {
+                SelectPermissionByUserName(res.data).then(res => {
+                    res.data.permission.forEach(item => {
+                        if (item.permissionId == "32" && item.state == 1) {
+                            this.ManuallyInfeedGlass = false;
+                        }
+                        if (item.permissionId == "32" && item.state == 1) {
+                            this.OutingQueue = false;
+                        }
+                        if (item.permissionId == "33" && item.state == 1) {
+                            this.OrderInfo = false;
+                        }
+                        if (item.permissionId == "34" && item.state == 1) {
+                            this.CageDetails = false;
+                        }
+                    });
+                });
+
+            });
             //鍔犺浇绗煎瓙浣跨敤鎯呭喌鏁版嵁
             home().then(res => {
                 this.tableData = res.data.list;
@@ -1139,12 +1180,17 @@
         },
         //鏄剧ず鐞嗙墖绗艰鎯呬俊鎭�
         showcageinfo(cage) {
-            cage = this.cageglassid;
-            SelectCageInfo(cage).then(res => {
-                this.cageinfo = res.data.cageinfo;
-                this.currentPages = 1;
-                this.dialogFormVisible3 = true;
-            });
+            if (this.CageDetails == false) {
+                cage = this.cageglassid;
+                SelectCageInfo(cage).then(res => {
+                    this.cageinfo = res.data.cageinfo;
+                    this.currentPages = 1;
+                    this.dialogFormVisible3 = true;
+                });
+            } else {
+                this.$message.error(this.$t('You do not have this permission'));
+            }
+
         },
         //鍒犻櫎鐞嗙墖绗肩幓鐠�
         deleteglass(glassid, state) {
@@ -1379,7 +1425,7 @@
                     this.$message.success(this.$t('Operation successful'));
                 }
             });
-        }, 
+        },
         //缃《
         getTopMove(row, index) {
             let Sequence = [];
@@ -1548,32 +1594,34 @@
         },
         //鍒ゆ柇鐜荤拑鏄惁瓒呭嚭鑼冨洿
         Sizerange(Glass, position) {
-            if ((Glass.glassheight < 380 || Glass.glasswidth < 390 || Glass.glassheight > 1810 || Glass.glasswidth > 2760) || (Glass.glassheight < 390 || Glass.glasswidth < 380 || Glass.glassheight > 2760 || Glass.glasswidth > 1810)) {
-                this.$alert(this.$t('The glass size is not within the range'), this.$t('confirm'), {
-                    confirmButtonText: this.$t('Yes'),
-                    type: 'info',
-                    callback: (action) => {
-                        this.$message({
-                            type: 'info',
-                            message: `action: ${ action }`
-                        }).then(
-                            this.DeleteBarcodeGlass()
-                        );
+            if (this.ManuallyInfeedGlass == true) {
+                if ((Glass.glassheight < 380 || Glass.glasswidth < 390 || Glass.glassheight > 1810 || Glass.glasswidth > 2760) || (Glass.glassheight < 390 || Glass.glasswidth < 380 || Glass.glassheight > 2760 || Glass.glasswidth > 1810)) {
+                    this.$alert(this.$t('The glass size is not within the range'), this.$t('confirm'), {
+                        confirmButtonText: this.$t('Yes'),
+                        type: 'info',
+                        callback: (action) => {
+                            this.$message({
+                                type: 'info',
+                                message: `action: ${action}`
+                            }).then(
+                                this.DeleteBarcodeGlass()
+                            );
+                        }
+                    });
+                    if (position == 1 || position == 3) {
+                        this.disabled1 = true;
+                    } else {
+                        this.disabled = true;
                     }
-                });
-                if (position == 1 || position == 3) {
-                    this.disabled1 = true;
                 } else {
-                    this.disabled = true;
-                }
-            } else {
-                if (position == 1 || position == 3) {
-                    this.disabled1 = false;
-                } else {
-                    this.disabled = false;
-                }
-                if (position == 3&&this.isConfirmState==true) {
-                    this.InsertQueueGlass(1);
+                    if (position == 1 || position == 3) {
+                        this.disabled1 = false;
+                    } else {
+                        this.disabled = false;
+                    }
+                    if (position == 3 && this.isConfirmState == true) {
+                        this.InsertQueueGlass(1);
+                    }
                 }
             }
         },

--
Gitblit v1.8.0