| | |
| | | <template #userTypeName="{ row }"> |
| | | <el-tag>{{ row.userTypeName }}</el-tag> |
| | | </template> |
| | | |
| | | </avue-crud> |
| | | <el-dialog title="用户角色配置" append-to-body v-model="roleBox" width="345px"> |
| | | <el-tree :data="roleGrantList" show-checkbox check-strictly default-expand-all node-key="id" ref="treeRole" |
| | |
| | | } |
| | | }; |
| | | return { |
| | | form: {}, |
| | | form: { |
| | | flightStartTime: null, // 飞行事件开始时间 |
| | | flightEndTime: null, // 飞行事件结束时间 |
| | | }, |
| | | search: {}, |
| | | roleBox: false, |
| | | excelBox: false, |
| | |
| | | viewDisplay: false, |
| | | rules: [{ required: true, validator: validatePass2, trigger: 'blur' }], |
| | | }, |
| | | { |
| | | label: '到期时间', |
| | | prop: 'expireTime', |
| | | type: 'datetime', |
| | | format: 'YYYY-MM-DD HH:mm:ss', |
| | | valueFormat: 'YYYY-MM-DD HH:mm:ss', |
| | | }, |
| | | |
| | | ], |
| | | }, |
| | | { |
| | |
| | | }, |
| | | ], |
| | | }, |
| | | // { |
| | | // label: '所属岗位', |
| | | // prop: 'postId', |
| | | // type: 'tree', |
| | | // multiple: true, |
| | | // dicData: [], |
| | | // props: { |
| | | // label: 'postName', |
| | | // value: 'id', |
| | | // }, |
| | | // rules: [ |
| | | // { |
| | | // required: true, |
| | | // message: '请选择所属岗位', |
| | | // trigger: 'click', |
| | | // }, |
| | | // ], |
| | | // }, |
| | | |
| | | ], |
| | | }, |
| | | { |
| | | label: '登录限制', |
| | | prop: '', |
| | | icon: 'el-icon-s-custom', |
| | | column: [ |
| | | { |
| | | label: '到期时间', |
| | | prop: 'expireTime', |
| | | type: 'datetime', |
| | | format: 'YYYY-MM-DD HH:mm:ss', |
| | | valueFormat: 'YYYY-MM-DD HH:mm:ss', |
| | | }, |
| | | { |
| | | label: '次数限制', |
| | | prop: 'maxLoginNum', |
| | | type: 'input', |
| | | }, |
| | | |
| | | { |
| | | label: '飞行开始时间', |
| | | prop: 'flightStartTime', |
| | | type: 'time', |
| | | format: 'HH:mm', |
| | | valueFormat: 'HH:mm', |
| | | rules: [ |
| | | { |
| | | required: false, |
| | | message: '请输入飞行开始时间', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: '飞行结束时间', |
| | | prop: 'flightEndTime', |
| | | type: 'time', |
| | | format: 'HH:mm', |
| | | valueFormat: 'HH:mm', |
| | | rules: [ |
| | | { |
| | | required: false, |
| | | message: '请输入飞行结束时间', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | }, |
| | | |
| | | |
| | | |
| | | ], |
| | | }, |
| | | ], |
| | |
| | | }); |
| | | }, |
| | | rowSave(row, done, loading) { |
| | | // 格式化时间数据 |
| | | |
| | | if (row.flightStartTime && row.flightEndTime) { |
| | | // 验证 flightEndTime 是否小于 flightStartTime |
| | | const [startHours, startMinutes] = row.flightStartTime.split(':').map(Number); |
| | | const [endHours, endMinutes] = row.flightEndTime.split(':').map(Number); |
| | | |
| | | const startTotalMinutes = startHours * 60 + startMinutes; |
| | | const endTotalMinutes = endHours * 60 + endMinutes; |
| | | |
| | | if (endTotalMinutes < startTotalMinutes) { |
| | | this.$message.error('飞行结束时间不能小于飞行开始时间'); |
| | | loading(); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | row.deptId = func.join(row.deptId); |
| | | row.roleId = func.join(row.roleId); |
| | | row.postId = func.join(row.postId); |
| | |
| | | ); |
| | | }, |
| | | rowUpdate(row, index, done, loading) { |
| | | // 格式化时间数据 |
| | | // if (row.flightStartTime) { |
| | | // row.flightStartTime = this.formatTime(row.flightStartTime); |
| | | // } |
| | | // if (row.flightEndTime) { |
| | | // row.flightEndTime = this.formatTime(row.flightEndTime); |
| | | // } |
| | | if (row.flightStartTime && row.flightEndTime) { |
| | | // 验证 flightEndTime 是否小于 flightStartTime |
| | | const [startHours, startMinutes] = row.flightStartTime.split(':').map(Number); |
| | | const [endHours, endMinutes] = row.flightEndTime.split(':').map(Number); |
| | | |
| | | const startTotalMinutes = startHours * 60 + startMinutes; |
| | | const endTotalMinutes = endHours * 60 + endMinutes; |
| | | |
| | | if (endTotalMinutes < startTotalMinutes) { |
| | | this.$message.error('飞行结束时间不能小于飞行开始时间'); |
| | | loading(); |
| | | return ; |
| | | } |
| | | } |
| | | |
| | | row.deptId = func.join(row.deptId); |
| | | row.roleId = func.join(row.roleId); |
| | | row.postId = func.join(row.postId); |
| | |
| | | if (this.form.hasOwnProperty('postId')) { |
| | | this.form.postId = func.split(this.form.postId); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | this.initFlag = true; |
| | |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | | formatTime(time) { |
| | | // 格式化时间为 HH:mm |
| | | const date = new Date(time); |
| | | const hours = String(date.getHours()).padStart(2, '0'); |
| | | const minutes = String(date.getMinutes()).padStart(2, '0'); |
| | | return `${hours}:${minutes}`; |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |