| | |
| | | type="text" |
| | | size="small" |
| | | icon="el-icon-edit" |
| | | v-if="permissionList.editBtn" |
| | | @click="handleEdit(row, index)" |
| | | > |
| | | 编辑 |
| | |
| | | type="text" |
| | | size="small" |
| | | icon="el-icon-delete" |
| | | v-if="permissionList.delBtn" |
| | | @click="handleDel(row, index)" |
| | | > |
| | | 删除 |
| | |
| | | getremove, |
| | | combination |
| | | } from "@/api/system/passwords"; |
| | | import {mapGetters} from "vuex"; |
| | | export default { |
| | | name: "passwords.vue", |
| | | data() { |
| | | // 最小长度正则绑定值 |
| | | let validatePass="" |
| | | //最大长度正则绑定值 |
| | | let validatePass1="" |
| | | //过期时间正则绑定值 |
| | | let validatePass2="" |
| | | //提醒时间正则绑定值 |
| | | let validatePass3="" |
| | | //锁定次数正则绑定值 |
| | | let validatePass4="" |
| | | //锁定时间正则绑定值 |
| | | let validatePass5="" |
| | | //最小长度绑定value |
| | | let values="" |
| | | //最大长度绑定value |
| | | let values1="" |
| | | //最小长度正则方法 |
| | | validatePass = (rule, value,callback) => { |
| | | values=value*1 |
| | | if(value == ""){ |
| | | callback(new Error('请输入密码最小长度')); |
| | | // }else if(values >= values1*1){ |
| | | // callback(new Error('密码最小长度不能大于密码最大长度')); |
| | | }else if(/[^\d]/g.test(value)){ |
| | | callback(new Error('密码最小长度的输入类型只能为数字类型')); |
| | | }else { |
| | | callback(); |
| | | } |
| | | }; |
| | | //最大长度正则方法 |
| | | validatePass1= (rule, value,callback) =>{ |
| | | values1=value*1 |
| | | if(value == ""){ |
| | | callback(new Error('请输入密码最大长度')); |
| | | }else if(values1 <= values){ |
| | | callback(new Error('密码最大长度不能小于密码最大长度')); |
| | | }else if(/[^\d]/g.test(value)){ |
| | | callback(new Error('密码最大长度的输入类型只能为数字类型')); |
| | | }else { |
| | | callback(); |
| | | } |
| | | }; |
| | | validatePass2 = (rule, value,callback) => { |
| | | if(value == ""){ |
| | | callback(new Error('请输入过期时间')); |
| | | }else if(/[^\d]/g.test(value)){ |
| | | callback(new Error('过期时间的输入类型只能为数字类型')); |
| | | }else { |
| | | callback(); |
| | | } |
| | | }; |
| | | validatePass3 = (rule, value,callback) => { |
| | | if(value == ""){ |
| | | callback(new Error('请输入过期时间')); |
| | | }else if(/[^\d]/g.test(value)){ |
| | | callback(new Error('过期时间的输入类型只能为数字类型')); |
| | | }else { |
| | | callback(); |
| | | } |
| | | }; |
| | | validatePass4 = (rule, value,callback) => { |
| | | if(value == ""){ |
| | | callback(new Error('请输入锁定次数')); |
| | | }else if(/[^\d]/g.test(value)){ |
| | | callback(new Error('锁定次数的输入类型只能为数字类型')); |
| | | }else { |
| | | callback(); |
| | | } |
| | | }; |
| | | validatePass5 = (rule, value,callback) => { |
| | | if(value == ""){ |
| | | callback(new Error('请输入锁定时间')); |
| | | }else if(/[^\d]/g.test(value)){ |
| | | callback(new Error('锁定时间的输入类型只能为数字类型')); |
| | | }else { |
| | | callback(); |
| | | } |
| | | }; |
| | | return { |
| | | //最小长度绑定value |
| | | values:"", |
| | | //最大长度绑定value |
| | | values1:"", |
| | | form:{}, |
| | | page: { |
| | | pageSize: 10, |
| | |
| | | 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:"", |
| | | //这个是下拉菜单的数据变量 |
| | |
| | | } |
| | | |
| | | }, |
| | | 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:(rule, value,callback)=>{ |
| | | this.values=value*1 |
| | | if(value == ""){ |
| | | callback(new Error('请输入密码最小长度')); |
| | | }else if(/[^\d]/g.test(value)){ |
| | | callback(new Error('密码最小长度的输入类型只能为数字类型')); |
| | | }else if(this.values >= this.values1 && this.values1 != 0){ |
| | | callback(new Error('密码最小长度不能大于密码最大长度')) |
| | | }else { |
| | | callback(); |
| | | } |
| | | }, |
| | | trigger: 'blur' |
| | | }] |
| | | }, |
| | | { |
| | | label: '密码最大长度', |
| | | prop: 'maxPwdLen', |
| | | span:12, |
| | | labelWidth:"25%", |
| | | rules: [{ |
| | | required: true, |
| | | validator:(rule, value,callback) =>{ |
| | | this.values1=value*1 |
| | | if(value == ""){ |
| | | callback(new Error('请输入密码最大长度')); |
| | | }else if(this.values1 <= this.values){ |
| | | callback(new Error('密码最大长度不能小于密码最大长度')); |
| | | }else if(/[^\d]/g.test(value)){ |
| | | callback(new Error('密码最大长度的输入类型只能为数字类型')); |
| | | }else { |
| | | callback(); |
| | | } |
| | | }, |
| | | 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: (rule, value,callback) => { |
| | | if(value == ""){ |
| | | callback(new Error('请输入过期时间')); |
| | | }else if(/[^\d]/g.test(value)){ |
| | | callback(new Error('过期时间的输入类型只能为数字类型')); |
| | | }else { |
| | | callback(); |
| | | } |
| | | }, |
| | | trigger: 'blur' |
| | | }] |
| | | }, |
| | | { |
| | | label: '提醒时间(天)', |
| | | prop:'reminderTime', |
| | | span:12, |
| | | labelWidth:"25%", |
| | | rules: [{ |
| | | required: true, |
| | | validator:(rule, value,callback) => { |
| | | if(value == ""){ |
| | | callback(new Error('请输入过期时间')); |
| | | }else if(/[^\d]/g.test(value)){ |
| | | callback(new Error('过期时间的输入类型只能为数字类型')); |
| | | }else { |
| | | callback(); |
| | | } |
| | | }, |
| | | trigger: 'blur' |
| | | }] |
| | | }, |
| | | { |
| | | label: '锁定次数(次)', |
| | | prop:'lockingNum', |
| | | span:12, |
| | | labelWidth:"22%", |
| | | rules: [{ |
| | | required: true, |
| | | validator:(rule, value,callback) => { |
| | | if(value == ""){ |
| | | callback(new Error('请输入锁定次数')); |
| | | }else if(/[^\d]/g.test(value)){ |
| | | callback(new Error('锁定次数的输入类型只能为数字类型')); |
| | | }else { |
| | | callback(); |
| | | } |
| | | }, |
| | | trigger: 'blur' |
| | | }] |
| | | }, |
| | | { |
| | | label: '锁定时间(分钟)', |
| | | prop:'lockingTime', |
| | | span:12, |
| | | labelWidth:"25%", |
| | | rules: [{ |
| | | required: true, |
| | | validator:(rule, value,callback) => { |
| | | if(value == ""){ |
| | | callback(new Error('请输入锁定时间')); |
| | | }else if(/[^\d]/g.test(value)){ |
| | | callback(new Error('锁定时间的输入类型只能为数字类型')); |
| | | }else { |
| | | callback(); |
| | | } |
| | | }, |
| | | 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) |
| | | }) |
| | | }, |
| | | 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; |
| | | this.checkboxedit = this.checkboxlength.toString().split(","); |
| | | |
| | | if (val.value != undefined && val.value != null) { |
| | | if (this.checkboxlist == val.value) { |
| | | if (val.value !== undefined && val.value !== null) { |
| | | if (this.checkboxlist === val.value) { |
| | | return; |
| | | } else { |
| | | this.checkboxlist = val.value; |
| | | if ( |
| | | this.selectlength.value >= val.value.length && |
| | | this.selectlength.value > val.value.length && |
| | | val.value.length > 0 |
| | | ) { |
| | | this.showMessage("必填种类不能大于组合方法,请重新选择!"); |
| | | this.showWarningMessage(); |
| | | } else if ( |
| | | this.selectlength.value >= this.checkboxedit.length && |
| | | this.selectlength.value > this.checkboxedit.length && |
| | | this.checkboxedit.length > 0 |
| | | ) { |
| | | this.showMessage("必填种类不能大于组合方法,请重新选择!"); |
| | | this.showWarningMessage(); |
| | | } |
| | | } |
| | | } |
| | | const disabledCount = Math.min(this.checkboxedit.length, 4); |
| | | for (let i = 0; i < arr.dicData.length; i++) { |
| | | arr.dicData[i].disabled = i >= disabledCount; |
| | | |
| | | if (val.value !== undefined && val.value !== null) { |
| | | if (val.value.length === 1) { |
| | | this.setDisabled(arr, [0]); |
| | | } else if (val.value.length === 2) { |
| | | this.setDisabled(arr, [0, 1]); |
| | | } else if (val.value.length === 3) { |
| | | this.setDisabled(arr, [0, 1, 2]); |
| | | } else if (val.value.length === 4) { |
| | | this.setDisabled(arr, [0, 1, 2, 3]); |
| | | } else if (val.value.length === 0) { |
| | | this.setDisabled(arr, [-1]); |
| | | } |
| | | } else if (this.checkboxNumber.length !== 0) { |
| | | this.setDisabled(arr, [0, 1, 2, 3]); |
| | | } |
| | | 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; |
| | | |
| | | if (this.editFlag) { |
| | | if (this.checkboxedit.length === 1) { |
| | | this.setDisabled(arr, [0]); |
| | | } else if (this.checkboxedit.length === 2) { |
| | | this.setDisabled(arr, [0, 1]); |
| | | } else if (this.checkboxedit.length === 3) { |
| | | this.setDisabled(arr, [0, 1, 2]); |
| | | } else if (this.checkboxedit.length === 4) { |
| | | this.setDisabled(arr, [0, 1, 2, 3]); |
| | | } else if (this.checkboxedit.length === 0) { |
| | | this.setDisabled(arr, [-1]); |
| | | } |
| | | } |
| | | }, |
| | | |
| | | setDisabled(arr, indices) { |
| | | arr.dicData.forEach((item, index) => { |
| | | item.disabled = !indices.includes(index); |
| | | }); |
| | | }, |
| | | |
| | | showWarningMessage() { |
| | | this.$message({ |
| | | message: '必填种类不能大于组合方法,请重新选择!', |
| | | type: 'warning', |
| | | showClose: true, |
| | | }); |
| | | }, |
| | | rowDel(row){ |
| | | this.$confirm("确定将选择数据删除?", { |
| | |
| | | }); |
| | | this.onLoad(); |
| | | }).catch(res=>{ |
| | | console.log(res) |
| | | // console.log(res) |
| | | }) |
| | | }, |
| | | rowSave(row,done){ |
| | |
| | | }) |
| | | }, |
| | | rowEdit(row){ |
| | | console.log("打开编辑edit",row) |
| | | // console.log("打开编辑edit",row) |
| | | }, |
| | | handleDel(row){ |
| | | this.$refs.crud.rowDel(row,row.$index); |
| | |
| | | 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){ |
| | | if(this.checkboxNumber.length < this.selectNumber){ |
| | | this.$message({ |
| | | type:"warning", |
| | | message:"必填种类不能大于组合方法,请重新选择!" |
| | |
| | | }); |
| | | done() |
| | | }).catch(res=>{ |
| | | console.log(res) |
| | | // console.log(res) |
| | | }) |
| | | }, |
| | | onLoad(page, params = {}) { |
| | |
| | | // this.data = data.records; |
| | | // this.loading = false; |
| | | // this.selectionClear(); |
| | | console.log(res) |
| | | // console.log(res) |
| | | this.page.total=res.data.data.total |
| | | this.data=res.data.data.records |
| | | }); |