From dc2d2f1e26a84d5600051c0ed086027a28b71162 Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期四, 26 十月 2023 11:31:07 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/UBCS-WEB/src/views/system/PasswordManagement/passwords.vue | 566 ++++++++++++++++++++++++-------------------------------- 1 files changed, 241 insertions(+), 325 deletions(-) diff --git a/Source/UBCS-WEB/src/views/system/PasswordManagement/passwords.vue b/Source/UBCS-WEB/src/views/system/PasswordManagement/passwords.vue index 8724503..9b24dc2 100644 --- a/Source/UBCS-WEB/src/views/system/PasswordManagement/passwords.vue +++ b/Source/UBCS-WEB/src/views/system/PasswordManagement/passwords.vue @@ -1,11 +1,12 @@ <template> - <basic-container> + <basic-container > <avue-crud v-model="form" :option="option" :data="data" ref="crud" @on-load="onLoad" @row-save="rowSave" @row-update="rowUpdate" @row-del="rowDel" :page.sync="page"> <template slot="menu" slot-scope="{ row, index }"> <el-button type="text" size="small" icon="el-icon-edit" + v-if="permissionList.editBtn" @click="handleEdit(row, index)" > 缂栬緫 @@ -14,6 +15,7 @@ type="text" size="small" icon="el-icon-delete" + v-if="permissionList.delBtn" @click="handleDel(row, index)" > 鍒犻櫎 @@ -33,8 +35,10 @@ // getOnesearch, getadd, getupdata, - getremove + getremove, + combination } from "@/api/system/passwords"; +import {mapGetters} from "vuex"; export default { name: "passwords.vue", data() { @@ -124,192 +128,7 @@ total: 100 }, data: [], - option: { - headerAlign: 'center', - align: 'center', - border: true, - index: true, - rowKey:'id', - editBtn:false, - 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, - }, - { - //鍐欎袱涓粍鍚堟柟娉曟槸鍥犱负id鍜宯ame涓嶈兘鍚屾椂缁戝畾杩欎釜prop鏉ユ覆鏌擄紝涓�涓〃鏍煎仛闅愯棌鏉ユ暟鎹搷浣滐紙琛ㄥ崟闅愯棌锛夛紝鍙︿竴涓〃鏍煎仛鏄剧ず鍙樉绀哄湪椤甸潰锛堣〃鍗曢殣钘忥級銆� - label: '缁勫悎鏂规硶', - prop: 'combinationIds', - type: "checkbox", - span:12, - labelWidth:"22%", - id:5, - hide:true, - change:this.handleCheckboxChange, - rules: [{ - required: true, - message: "璇烽�夋嫨缁勫悎鏂规硶", - trigger: "blur" - }], - dicData: [ - { - label: "鏁板瓧", - value: '1638024706425188354' - }, - { - label: "绗﹀彿", - value: '1638097837516926977' - }, - { - label: "灏忓啓瀛楁瘝", - value: '1638097772983365634' - }, - { - label: "澶у啓瀛楁瘝", - value: '1638097733707902977' - }, - ], - }, - { - label: '蹇呭~绉嶇被', - prop: 'requiredType', - type: 'select', - span:12, - labelWidth:"25%", - change:this.handleSelectChange, - rules: [{ - required: true, - message: "璇烽�夋嫨蹇呭~绉嶇被", - trigger: "blur" - }], - dicData:[{ - label:'1绉�', - value:0, - disabled:false - }, - { - label:'2绉�', - value:1, - disabled:false - }, - { - label:'3绉�', - value:2, - disabled:false - }, - { - label:'4绉�', - value:3, - 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:"", //杩欎釜鏄笅鎷夎彍鍗曠殑鏁版嵁鍙橀噺 @@ -323,146 +142,247 @@ checkboxedit:"", // 鐢ㄤ簬鍒ゆ柇鏄惁鏄紪杈� editFlag:false - // 鑷充簬涓轰粈涔堟病鍦ㄧ敤鎴烽�夋嫨蹇呭~绉嶇被澶т簬缁勫悎鏂瑰紡鐨勬椂鍊欙紝缁欎笅鎷夎彍鍗曢�変腑鐨勬暟鎹竻绌轰簡锛岃繖鏍锋瘮缁欎簣寮圭獥鎻愰啋鏇村悎鐞� - // 鍘熷洜鏄壘浜嗗ソ涔呮病鎵惧埌avue妗嗘灦杩欎釜閫変腑鐨勫睘鎬ф樉绀哄湪椤甸潰鎬庝箞淇敼锛岀洿鎺ヤ慨鏀逛笅鎷夎彍鍗曟暟鎹殑value娌℃晥鏋滐紝鎵句笉鍒版槸浠�涔堟帶鍒惰繖椤甸潰鏄剧ず鐨勯�変腑鏁版嵁 - // 鎴戝皾璇曞湪dicdata澶栭潰瀹氫箟value淇敼涓嬫媺鑿滃崟鏄剧ず鐨勯粯璁ゅ�间篃涓嶈锛岀劧鍚庡啀灏濊瘯璋冪敤avue鐨刢lose娓呴櫎鏂规硶锛屼絾鏄篃鏄彧鑳藉疄鐜板湪涓嬫媺鑿滃崟鍚庨潰鏄剧ず涓�涓猉鍙� - // 褰撶敤鎴锋墜鍔ㄧ偣鍑绘竻闄わ紝鎵嶅彲浠ユ妸鏁版嵁娓呴櫎锛屾�昏�岃█涔嬫壘浜嗗ソ涔咃紝娌℃壘鍒拌繖涓竻闄ゆ柟娉曪紝avue鐨勮鏄庢枃妗d篃娌℃槑纭爣鏄庤繖涓姛鑳界殑鍐呯疆鎿嶄綔鏂规硶 - // 鎴戞兂鍒扮殑搴旇鍙互鐨勬柟娉曟槸锛岃垗寮僶ption閲岄潰鐨勭粍鍚堟柟寮忥紝鑷繁鎵嬪姩鍦ㄩ〉闈㈡坊鍔犳彃妲藉畾涔夌粍鍚堟柟寮忥紝鑷充簬鏄娇鐢╝vue杩樻槸element-ui鏉ュ啓锛岃繕瑕佺湅鍏蜂綋鐨勬楠� - // 鍥犱负涓�鏀瑰姩锛屾垜鐜板湪鍐欑殑閫昏緫姣斿涓嬫媺鑿滃崟绂佺敤鍜岀瓥鐣ラ獙璇佺瓑绛夎閲嶆柊姊崇悊锛屾垜杩欒竟鎬ョ潃璧跺璞″缓妯$殑杩涘害锛屾墍浠ュ厛鐢ㄨ繖绉嶆柟寮忔潵澶勭悊锛屽鏋滄垜鍥炲ご鏈夋椂闂存垜鍐嶆潵缁х画鏀癸紝灏辨病鏈夎繖鏉℃敞閲婁簡銆� } + }, + computed:{ + ...mapGetters(["permission"]), + permissionList() { + return { + addBtn: this.vaildData(this.permission.password.password_add, false), + //viewBtn: this.vaildData(this.permission.password.user_view, false), + delBtn: this.vaildData(this.permission.password.password_delete, false), + editBtn: this.vaildData(this.permission.password.password_edit, false), + }; + }, + platformPermissionList() { + return { + addBtn: this.vaildData(this.permission.password.password_add, false), + //viewBtn: this.vaildData(this.permission.password.user_view, false), + delBtn: this.vaildData(this.permission.password.password_delete, false), + editBtn: this.vaildData(this.permission.password.password_edit, false), + }; + }, + option(){ + return{ + headerAlign: 'center', + align: 'center', + columnBtn:false, + border: true, + index: true, + rowKey:'id', + addBtn:this.permissionList.addBtn, + 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() }, - mount() { - }, methods:{ handleSelectChange(val){ this.selectlength=val - // if(val.value >= this.checkboxlength.value.length && this.checkboxlength.value.length > 0){ - // console.log("澶т簬") - // } }, - handleCheckboxChange(val){ - const arr=this.option.column[5]; - this.checkboxlength=val.value; - //娣诲姞鐨勬椂鍊檆heckboxlength鏄竴涓暟缁勶紝鍒颁簡缂栬緫浠栧氨鏄竴涓瓧绗︿覆锛屽鏋滄垜鎴戠洿鎺ヨ浆鎹负鏁扮粍锛屽洜涓烘湰鏉ュ氨鏄暟缁勬墍浠ョ偣鍑绘坊鍔犵殑鏃跺�欎細鎶ラ敊 - //濡傛灉鎴戝彉鎴愬瓧绗︿覆鍚庡啀杞暟缁�,娣诲姞涓嶄細鎶ラ敊浜�,浣嗘槸缂栬緫鐨勬椂鍊欏氨鍙堜細鎶ラ敊浜�,鏈潵灏辨槸瀛楃涓插張璧颁簡涓�閬峵ostring - this.checkboxedit=this.checkboxlength.toString().split(",") - if(val.value != undefined && val.value != null){ - if(this.checkboxlist == val.value){ - // 鍒ゆ柇鐩哥瓑鍒欎笉鎿嶄綔锛屼笉绛夊垯閲嶆柊鎵ц銆傚姞杩欏眰鍒ゆ柇鏄洜涓篶hange浜嬩欢瑙﹀彂涓ゆ锛屼細鍑虹幇涓や釜娑堟伅鎻愮ず妗� - // 瀹氫箟checkboxlist鍙橀噺,瀛樺偍鐨勬敼鍙樼殑鍊�,濡傛灉鍊兼敼鍙樺拰鍙橀噺鐩哥瓑鍒欎笉闇�瑕佷换浣曟搷浣� - }else { - this.checkboxlist=val.value - if( this.selectlength.value >= val.value.length && val.value.length > 0 ){ - this.$message({ - message: '蹇呭~绉嶇被涓嶈兘澶т簬缁勫悎鏂规硶锛岃閲嶆柊閫夋嫨锛�', - type: 'warning', - showClose: true, - }); - }else if(this.selectlength.value >= this.checkboxedit.length && this.checkboxedit.length > 0 ){ - this.$message({ - message: '蹇呭~绉嶇被涓嶈兘澶т簬缁勫悎鏂规硶锛岃閲嶆柊閫夋嫨锛�', - type: 'warning', - showClose: true, - }); + handleCheckboxChange(val) { + // console.log("val",val); + const arr = this.option.column[5]; + 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 { + this.checkboxlist = val.value; + if ( + this.selectlength.value >= val.value.length && + val.value.length > 0 + ) { + this.showMessage("蹇呭~绉嶇被涓嶈兘澶т簬缁勫悎鏂规硶锛岃閲嶆柊閫夋嫨锛�"); + } else if ( + this.selectlength.value >= this.checkboxedit.length && + this.checkboxedit.length > 0 + ) { + this.showMessage("蹇呭~绉嶇被涓嶈兘澶т簬缁勫悎鏂规硶锛岃閲嶆柊閫夋嫨锛�"); } } - // if(this.checkboxeditlist == val.value){ - // // tong - // }else { - // this.checkboxeditlist=val.value - // if(this.selectlength.value >= this.checkboxedit.length && this.checkboxedit.length > 0){ - // this.$message({ - // message: '蹇呭~绉嶇被涓嶈兘澶т簬缁勫悎鏂规硶锛岃閲嶆柊閫夋嫨锛�', - // type: 'warning', - // showClose: true, - // }); - // } - // } - // if(this.selectlength.value >= this.checkboxedit.length && this.checkboxedit.length > 0){ - // this.$message({ - // message: '蹇呭~绉嶇被涓嶈兘澶т簬缁勫悎鏂规硶锛岃閲嶆柊閫夋嫨锛�', - // type: 'warning', - // showClose: true, - // }); - // } } - // 杩欓噷涓�鐩存姤length鐨勯敊璇� - // arr.forEach((item,index)=>{ - // console.log(item,index) - // if(val.value != undefined && val.value != null && val.value.length==0){ - // item.disabled=false - // } - // if(val.value != undefined && val.value != null && val.value.length>=1){ - // - // } - // }) - // if(val.value != undefined && val.value != null && val.value.length >= 0){ - // arr.dicData[val.value.length-1].disabled=true - // } - // }else if(val.value != undefined && val.value != null && val.value.length ==0){ - // arr.dicData.disabled=false - // } - if(val.value != undefined && val.value != null && val.value.length == 1){ - arr.dicData[0].disabled=false - arr.dicData[1].disabled=true - arr.dicData[2].disabled=true - arr.dicData[3].disabled=true - }else if(val.value != undefined && val.value != null && val.value.length ==2){ - arr.dicData[0].disabled=false - arr.dicData[1].disabled=false - arr.dicData[2].disabled=true - arr.dicData[3].disabled=true - }else if(val.value != undefined && val.value != null && val.value.length ==3){ - arr.dicData[0].disabled=false - arr.dicData[1].disabled=false - arr.dicData[2].disabled=false - arr.dicData[3].disabled=true - }else if(val.value != undefined && val.value != null && val.value.length==4){ - arr.dicData[0].disabled=false - arr.dicData[1].disabled=false - arr.dicData[2].disabled=false - arr.dicData[3].disabled=false - }else if(val.value != undefined && val.value != null && val.value.length==0 ){ - arr.dicData[0].disabled=true - arr.dicData[1].disabled=true - arr.dicData[2].disabled=true - arr.dicData[3].disabled=true - }else if(this.checkboxNumber.length!=0){ - arr.dicData[0].disabled=false - arr.dicData[1].disabled=false - arr.dicData[2].disabled=false - arr.dicData[3].disabled=false + const disabledCount = Math.min(this.checkboxedit.length, 4); + for (let i = 0; i < arr.dicData.length; i++) { + arr.dicData[i].disabled = i >= disabledCount; } - if(this.editFlag == true){ - if(this.checkboxedit.length == 1){ - arr.dicData[0].disabled=false - arr.dicData[1].disabled=true - arr.dicData[2].disabled=true - arr.dicData[3].disabled=true - }else if(this.checkboxedit.length == 2){ - arr.dicData[0].disabled=false - arr.dicData[1].disabled=false - arr.dicData[2].disabled=true - arr.dicData[3].disabled=true - }else if(this.checkboxedit.length ==3){ - arr.dicData[0].disabled=false - arr.dicData[1].disabled=false - arr.dicData[2].disabled=false - arr.dicData[3].disabled=true - }else if(this.checkboxedit ==4){ - arr.dicData[0].disabled=false - arr.dicData[1].disabled=false - arr.dicData[2].disabled=false - arr.dicData[3].disabled=false - }else if(this.checkboxedit.length ==0){ - arr.dicData[0].disabled=true - arr.dicData[1].disabled=true - arr.dicData[2].disabled=true - arr.dicData[3].disabled=true + if (this.editFlag == true) { + const disabledCount = Math.min(this.checkboxedit.length, 4); + for (let i = 0; i < arr.dicData.length; i++) { + arr.dicData[i].disabled = i >= disabledCount; } } }, @@ -482,7 +402,7 @@ }); this.onLoad(); }).catch(res=>{ - console.log(res) + // console.log(res) }) }, rowSave(row,done){ @@ -497,13 +417,12 @@ }); done(row) this.onLoad() - console.log(res) }).catch((res)=>{ - console.log(res) + this.$message.warning(res) }) }, rowEdit(row){ - console.log("鎵撳紑缂栬緫edit",row) + // console.log("鎵撳紑缂栬緫edit",row) }, handleDel(row){ this.$refs.crud.rowDel(row,row.$index); @@ -511,11 +430,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", @@ -532,7 +448,7 @@ }); done() }).catch(res=>{ - console.log(res) + // console.log(res) }) }, onLoad(page, params = {}) { @@ -543,9 +459,9 @@ // this.data = data.records; // this.loading = false; // this.selectionClear(); - console.log(res) - this.page.total=res.data.data.totalElements - this.data=res.data.data.content + // console.log(res) + this.page.total=res.data.data.total + this.data=res.data.data.records }); } } @@ -553,5 +469,5 @@ } </script> -<style lang="scss"> +<style lang="scss" scoped> </style> -- Gitblit v1.9.3