From 15b5b761a15805719294e7660f4cb84b35f84af8 Mon Sep 17 00:00:00 2001 From: liukangdong <898885815@qq.com> Date: 星期五, 23 八月 2024 11:24:13 +0800 Subject: [PATCH] ll --- admin/src/components/business/OperaMemberRoleWindow.vue | 97 ++++++++++++++++++++++++------------------------ 1 files changed, 48 insertions(+), 49 deletions(-) diff --git a/admin/src/components/business/OperaMemberRoleWindow.vue b/admin/src/components/business/OperaMemberRoleWindow.vue index 5ed9027..930d160 100644 --- a/admin/src/components/business/OperaMemberRoleWindow.vue +++ b/admin/src/components/business/OperaMemberRoleWindow.vue @@ -50,42 +50,42 @@ <script> import BaseOpera from '@/components/base/BaseOpera' import GlobalWindow from '@/components/common/GlobalWindow' -import {getDeviceRoleList} from '@/api/business/device' +import { getDeviceRoleList } from '@/api/business/device' export default { name: 'OperaDeviceRoleWindow', extends: BaseOpera, components: { GlobalWindow }, data () { var validateTime = (rule, value, callback) => { - if(this.form.timeType == null ){ + if (this.form.timeType == null) { callback(new Error('璇峰~鍐欐纭殑闂ㄧ鏈夋晥鏈熸椂闂�')) return } - if(this.form.timeType === 1 && (this.form.startTime ==null || this.form.endTime == null)){ - callback(new Error('璇峰~鍐欐纭殑闂ㄧ鏈夋晥鏈熸椂闂�')) - return + if (this.form.timeType === 1 && (this.form.startTime == null || this.form.endTime == null)) { + callback(new Error('璇峰~鍐欐纭殑闂ㄧ鏈夋晥鏈熸椂闂�')) + return } callback() - }; + } return { // 琛ㄥ崟鏁版嵁 - time:null, - companyType:1, + time: null, + companyType: 1, form: { ids: [], names: [], timeType: 0, roleIds: [], status: 1, - startTime:null, - endTime:null, + startTime: null, + endTime: null, radio: 0 }, - roles:[], + roles: [], rules: { // 楠岃瘉瑙勫垯 timeType: [ - { required: true, validator: validateTime,message: '璇烽�変腑闂ㄧ鏈夋晥鏈�' } + { required: true, validator: validateTime, message: '璇烽�変腑闂ㄧ鏈夋晥鏈�' } ], startTime: [ { validator: validateTime, trigger: 'blur' } @@ -103,15 +103,15 @@ }) }, methods: { - filterMethod(query, item) { - if (!query) return item; - return item.label.indexOf(query) > -1 ; + filterMethod (query, item) { + if (!query) return item + return item.label.indexOf(query) > -1 }, seleTime (e) { - if(e && e.length >= 2){ + if (e && e.length >= 2) { this.form.startTime = e[0] this.form.endTime = e[1] - }else{ + } else { this.form.startTime = null this.form.endTime = null } @@ -123,41 +123,40 @@ } if (this.form.roleIds == null || this.form.roleIds.length == 0) { this.$dialog.actionConfirm('鏉冮檺涓虹┖锛屾彁浜ゅ悗鍗虫竻闄ゆ墍閫変汉鍛樺凡鍒嗛厤鏉冮檺锛佽璋ㄦ厧鎿嶄綔', '鎮ㄧ‘璁よ繘琛岃鎿嶄綔鍚楋紵') - .then(() => { - this.confirmDo(); - }) - .catch(() => {}) - + .then(() => { + this.confirmDo() + }) + .catch(() => {}) } else { - this.confirmDo(); + this.confirmDo() } }) }, - confirmDo(){ - // 璋冪敤鏂板缓鎺ュ彛 - this.isWorking = true - this.api.batchRoleAuth({ - ids: this.form.ids, - timeType: this.form.timeType, - startTime: this.form.startTime, - endTime: this.form.endTime, - roleIds: this.form.roleIds + confirmDo () { + // 璋冪敤鏂板缓鎺ュ彛 + this.isWorking = true + this.api.batchRoleAuth({ + ids: this.form.ids, + timeType: this.form.timeType, + startTime: this.form.startTime, + endTime: this.form.endTime, + roleIds: this.form.roleIds + }) + .then(() => { + this.visible = false + this.$tip.apiSuccess('鎺堟潈鎴愬姛锛屽彲鍓嶅線銆愪汉鍛樻巿鏉冭褰曘�戞煡鐪嬩笅鍙戣繘搴�') + this.$emit('success') }) - .then(() => { - this.visible = false - this.$tip.apiSuccess('鎺堟潈鎴愬姛锛屽彲鍓嶅線銆愪汉鍛樻巿鏉冭褰曘�戞煡鐪嬩笅鍙戣繘搴�') - this.$emit('success') - }) - .catch(e => { - this.$tip.apiFailed(e) - }) - .finally(() => { - this.isWorking = false - }) - }, + .catch(e => { + // this.$tip.apiFailed(e) + }) + .finally(() => { + this.isWorking = false + }) + }, // 鑾峰彇璁惧 - getLists (){ - getDeviceRoleList({type:2}) + getLists () { + getDeviceRoleList({ type: 2 }) .then(res => { this.roles = res.map(item => { return { @@ -168,7 +167,7 @@ }) }) }, - open (title, ids,names,companyType) { + open (title, ids, names, companyType) { this.roles = [] this.getLists() this.title = title @@ -178,8 +177,8 @@ this.$nextTick(() => { this.$refs.form.resetFields() this.form[this.configData['field.id']] = null - this.form.ids = ids; - this.form.names =names; + this.form.ids = ids + this.form.names = names console.log(names) }) -- Gitblit v1.9.3