From 3fbd08917515f8b9bd8f34421bbce022cefd9d5d Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期三, 25 十月 2023 16:15:53 +0800
Subject: [PATCH] 密码策略-按钮权限

---
 Source/UBCS-WEB/src/views/system/PasswordManagement/passwords.vue |  378 +++++++++++++++++++++++++++--------------------------
 1 files changed, 191 insertions(+), 187 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/system/PasswordManagement/passwords.vue b/Source/UBCS-WEB/src/views/system/PasswordManagement/passwords.vue
index 4326828..f28a489 100644
--- a/Source/UBCS-WEB/src/views/system/PasswordManagement/passwords.vue
+++ b/Source/UBCS-WEB/src/views/system/PasswordManagement/passwords.vue
@@ -6,6 +6,7 @@
           type="text"
           size="small"
           icon="el-icon-edit"
+          v-if="permission.password.password_edit"
           @click="handleEdit(row, index)"
         >
           缂栬緫
@@ -14,6 +15,7 @@
           type="text"
           size="small"
           icon="el-icon-delete"
+          v-if="permission.password.password_delete"
           @click="handleDel(row, index)"
         >
           鍒犻櫎
@@ -36,6 +38,7 @@
   getremove,
   combination
 } from "@/api/system/passwords";
+import {mapGetters} from "vuex";
 export default {
   name: "passwords.vue",
   data() {
@@ -125,181 +128,7 @@
         total: 100
       },
       data: [],
-      option: {
-        headerAlign: 'center',
-        align: 'center',
-        columnBtn:false,
-        border: true,
-        index: true,
-        rowKey:'id',
-        editBtn:false,
-        height:700,
-        delBtn:false,
-        column: [
-          {
-            label: '绛栫暐鍚嶇О',
-            prop: 'strategyName',
-            align: 'left',
-            span:24,
-            labelWidth: "11%",
-            rules: [{
-              required: true,
-              message: "璇疯緭鍏ョ瓥鐣ュ悕绉�",
-              trigger: "blur"
-            }]
-          },
-          {
-            label: '瀵嗙爜鏈�灏忛暱搴�',
-            prop: 'minPwdLen',
-            span:12,
-            labelWidth:"22%",
-            rules: [{
-              required: true,
-              validator:validatePass,
-              trigger: 'blur'
-            }]
-          },
-          {
-            label: '瀵嗙爜鏈�澶ч暱搴�',
-            prop: 'maxPwdLen',
-            span:12,
-            labelWidth:"25%",
-            rules: [{
-              required: true,
-              validator:validatePass1,
-              trigger: 'change'
-            }]
-          },
-          {
-            label: '缁勫悎鏂规硶',
-            prop: 'combinationNames',
-            labelWidth: 91,
-            display:false,
 
-          },
-          {
-            label: '缁勫悎鏂规硶',
-            prop: 'combinationIds',
-            type: "checkbox",
-            span:12,
-            labelWidth:"22%",
-            id:5,
-            hide:true,
-            change: this.handleCheckboxChange,
-            rules: [{
-              required: true,
-              message: "璇烽�夋嫨缁勫悎鏂规硶",
-              trigger: "blur"
-            }],
-            dicUrl: '/api/ubcs-system/combination/select',
-            dicMethod: 'get',
-            props: {
-              value: "ID",
-              label: "NAME",
-            },
-          },
-          {
-            label: '蹇呭~绉嶇被',
-            prop: 'requiredType',
-            type: 'select',
-            span:12,
-            labelWidth:"25%",
-            change:this.handleSelectChange,
-            rules: [{
-              required: true,
-              message: "璇烽�夋嫨蹇呭~绉嶇被",
-              trigger: "blur"
-            }],
-            dicData:[{
-              label:'1绉�',
-              value:1,
-              disabled:false
-              },
-              {
-                label:'2绉�',
-                value:2,
-                disabled:false
-              },
-              {
-                label:'3绉�',
-                value:3,
-                disabled:false
-              },
-              {
-                label:'4绉�',
-                value:4,
-                disabled:false
-              }
-            ]
-
-          },
-          {
-            label: '杩囨湡鏃堕棿(澶�)',
-            prop:'expirationTime',
-            span:12,
-            labelWidth:"22%",
-            rules: [{
-              required: true,
-              validator:validatePass2,
-              trigger: 'blur'
-            }]
-          },
-          {
-            label: '鎻愰啋鏃堕棿(澶�)',
-            prop:'reminderTime',
-            span:12,
-            labelWidth:"25%",
-            rules: [{
-              required: true,
-              validator:validatePass3,
-              trigger: 'blur'
-            }]
-          },
-          {
-            label: '閿佸畾娆℃暟(娆�)',
-            prop:'lockingNum',
-            span:12,
-            labelWidth:"22%",
-            rules: [{
-              required: true,
-              validator:validatePass4,
-              trigger: 'blur'
-            }]
-          },
-          {
-            label: '閿佸畾鏃堕棿(鍒嗛挓)',
-            prop:'lockingTime',
-            span:12,
-            labelWidth:"25%",
-            rules: [{
-              required: true,
-              validator:validatePass5,
-              trigger: 'blur'
-            }]
-          },
-          {
-            label: '鎻忚堪',
-            prop:'desc',
-            type: 'textarea',
-            span:12,
-            labelWidth:"22%",
-            rows: 5,
-          },
-          {
-            label: '鏄惁涓洪粯璁ょ瓥鐣�',
-            prop: 'isDefault',
-            type: 'switch',
-            labelWidth: 132,
-            dicData:[{
-              label:'鍚�',
-              value:0
-            },{
-              label:'鏄�',
-              value:1
-            }]
-          }
-        ],
-      },
       //娣诲姞瀛樻斁澶氶�夌殑鍙橀噺,鐢ㄤ簬涓嬫媺鑿滃崟鐨勭鐢ㄦ晥鏋滃拰蹇呭~绉嶇被鏄惁澶т簬缁勫悎鏂瑰紡鐒跺悗鎻愮ず鐢ㄦ埛閲嶆柊閫夋嫨
       checkboxlength:"",
       //杩欎釜鏄笅鎷夎彍鍗曠殑鏁版嵁鍙橀噺
@@ -316,26 +145,204 @@
     }
 
   },
+  computed:{
+    ...mapGetters(["permission"]),
+    option(){
+      return{
+          headerAlign: 'center',
+          align: 'center',
+          columnBtn:false,
+          border: true,
+          index: true,
+          rowKey:'id',
+          addBtn:this.permission.password.password_add,
+          editBtn:false,
+          height:700,
+          delBtn:false,
+          column: [
+            {
+              label: '绛栫暐鍚嶇О',
+              prop: 'strategyName',
+              align: 'left',
+              span:24,
+              labelWidth: "11%",
+              rules: [{
+                required: true,
+                message: "璇疯緭鍏ョ瓥鐣ュ悕绉�",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: '瀵嗙爜鏈�灏忛暱搴�',
+              prop: 'minPwdLen',
+              span:12,
+              labelWidth:"22%",
+              rules: [{
+                required: true,
+                validator:this.validatePass,
+                trigger: 'blur'
+              }]
+            },
+            {
+              label: '瀵嗙爜鏈�澶ч暱搴�',
+              prop: 'maxPwdLen',
+              span:12,
+              labelWidth:"25%",
+              rules: [{
+                required: true,
+                validator:this.validatePass1,
+                trigger: 'change'
+              }]
+            },
+            {
+              label: '缁勫悎鏂规硶',
+              prop: 'combinationNames',
+              labelWidth: 91,
+              display:false,
+
+            },
+            {
+              label: '缁勫悎鏂规硶',
+              prop: 'combinationIds',
+              type: "checkbox",
+              span:12,
+              labelWidth:"22%",
+              id:5,
+              hide:true,
+              change: this.handleCheckboxChange,
+              rules: [{
+                required: true,
+                message: "璇烽�夋嫨缁勫悎鏂规硶",
+                trigger: "blur"
+              }],
+              dicUrl: '/api/ubcs-system/combination/select',
+              dicMethod: 'get',
+              props: {
+                value: "ID",
+                label: "NAME",
+              },
+            },
+            {
+              label: '蹇呭~绉嶇被',
+              prop: 'requiredType',
+              type: 'select',
+              span:12,
+              labelWidth:"25%",
+              change:this.handleSelectChange,
+              rules: [{
+                required: true,
+                message: "璇烽�夋嫨蹇呭~绉嶇被",
+                trigger: "blur"
+              }],
+              dicData:[{
+                label:'1绉�',
+                value:1,
+                disabled:false
+              },
+                {
+                  label:'2绉�',
+                  value:2,
+                  disabled:false
+                },
+                {
+                  label:'3绉�',
+                  value:3,
+                  disabled:false
+                },
+                {
+                  label:'4绉�',
+                  value:4,
+                  disabled:false
+                }
+              ]
+
+            },
+            {
+              label: '杩囨湡鏃堕棿(澶�)',
+              prop:'expirationTime',
+              span:12,
+              labelWidth:"22%",
+              rules: [{
+                required: true,
+                validator:this.validatePass2,
+                trigger: 'blur'
+              }]
+            },
+            {
+              label: '鎻愰啋鏃堕棿(澶�)',
+              prop:'reminderTime',
+              span:12,
+              labelWidth:"25%",
+              rules: [{
+                required: true,
+                validator:this.validatePass3,
+                trigger: 'blur'
+              }]
+            },
+            {
+              label: '閿佸畾娆℃暟(娆�)',
+              prop:'lockingNum',
+              span:12,
+              labelWidth:"22%",
+              rules: [{
+                required: true,
+                validator:this.validatePass4,
+                trigger: 'blur'
+              }]
+            },
+            {
+              label: '閿佸畾鏃堕棿(鍒嗛挓)',
+              prop:'lockingTime',
+              span:12,
+              labelWidth:"25%",
+              rules: [{
+                required: true,
+                validator:this.validatePass5,
+                trigger: 'blur'
+              }]
+            },
+            {
+              label: '鎻忚堪',
+              prop:'desc',
+              type: 'textarea',
+              span:12,
+              labelWidth:"22%",
+              rows: 5,
+            },
+            {
+              label: '鏄惁涓洪粯璁ょ瓥鐣�',
+              prop: 'isDefault',
+              type: 'switch',
+              labelWidth: 132,
+              dicData:[{
+                label:'鍚�',
+                value:0
+              },{
+                label:'鏄�',
+                value:1
+              }]
+            }
+          ],
+
+      }
+    }
+  },
   created() {
     this.onLoad()
-    combination().then(res=>{
-      // console.log("111",res)
-    })
   },
   methods:{
     handleSelectChange(val){
       this.selectlength=val
-      // if(val.value >= this.checkboxlength.value.length && this.checkboxlength.value.length > 0){
-      //   console.log("澶т簬")
-      // }
     },
     handleCheckboxChange(val) {
-      console.log("val",val);
+      // console.log("val",val);
       const arr = this.option.column[5];
-      this.checkboxlength = val.value;
-      console.log("this.checkboxlength",this.checkboxlength);
+      if(val){
+        this.checkboxlength = val.value;
+        return
+      }
+      // console.log("this.checkboxlength",this.checkboxlength);
       this.checkboxedit = this.checkboxlength.toString().split(",");
-
       if (val.value != undefined && val.value != null) {
         if (this.checkboxlist == val.value) {
         } else {
@@ -408,11 +415,8 @@
     handleEdit(row){
       this.$refs.crud.rowEdit(row,row.$index);
       this.editFlag=true;
-      // const arr=this.option.column[5];
       this.checkboxNumber=row.combinationIds.split(",")
       this.selectNumber=row.requiredType
-      // console.log(this.checkboxNumber, this.selectNumber)
-    //  鎵撳紑缂栬緫棣栧厛鍒ゆ柇锛岀粍鍚堟柟娉曟槸鍚﹀皬浜庡繀濉绫伙紝濡傛灉灏忎簬缁欎簣鎻愰啋淇敼
         if(this.checkboxNumber.length<=this.selectNumber){
           this.$message({
             type:"warning",

--
Gitblit v1.9.3