diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 2e4ce999..f425c469 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -87,6 +87,7 @@ const user = { // 获取用户信息 GetInfo({ commit, state }) { return new Promise((resolve, reject) => { + console.log('GetInfo') getInfo().then(res => { // 没有 data 数据,赋予个默认值 if (!res) { @@ -96,7 +97,7 @@ const user = { user: { id: '', avatar: '', - userName: '', + username: '', nickname: '' } } @@ -113,7 +114,7 @@ const user = { commit('SET_ROLES', ['ROLE_DEFAULT']) } commit('SET_ID', user.id) - commit('SET_NAME', user.userName) + // commit('SET_NAME', user.username) //无效调用,接口未提供username值 commit('SET_NICKNAME', user.nickname) commit('SET_AVATAR', avatar) resolve(res) diff --git a/src/views/specialEquipment/check/CheckOrderListTable.vue b/src/views/specialEquipment/check/CheckOrderListTable.vue index 042771ef..cea20347 100644 --- a/src/views/specialEquipment/check/CheckOrderListTable.vue +++ b/src/views/specialEquipment/check/CheckOrderListTable.vue @@ -51,10 +51,7 @@ {{ scope.row.planCheckTime | timeFilter }} - + @@ -129,7 +126,7 @@ import moment from 'moment'; export default { name: 'CheckOrderListTable', components: {}, - props: ['tableData', 'page', 'limit'], + props: ['tableData', 'page', 'limit', 'permissionGuard'], filters: { timeFilter: (val) => val ? moment(val).format('yyyy-MM-DD HH:mm:ss') : '---', @@ -170,12 +167,7 @@ export default { }, methods: { checkSelectable(row, index) { - return true; - // return ( - // row.relatePlan == 2 || - // (row.relatePlan == 1 && - // (!row.confirmDueTime || +row.confirmDueTime >= new Date().getTime())) - // ); + return this.permissionGuard(row); }, handleSelectionChange(val) { this.selectedOrder = val; diff --git a/src/views/specialEquipment/check/Content-add.vue b/src/views/specialEquipment/check/Content-add.vue index 9aa70588..fc231bf0 100644 --- a/src/views/specialEquipment/check/Content-add.vue +++ b/src/views/specialEquipment/check/Content-add.vue @@ -175,8 +175,8 @@ export default { special: true, status: 1, // status: confirmed ? 2 : 1, - groupClass: this.dataForm.groupClass.join(','), - checkPerson: this.$store.getters.userId, + groupClass: this.dataForm.groupClass?.join(','), + checkPerson: this.$store.getters.nickname, }, }); if (res.code == 0) { diff --git a/src/views/specialEquipment/check/Content-edit.vue b/src/views/specialEquipment/check/Content-edit.vue index d58e23fd..e12bbb5e 100644 --- a/src/views/specialEquipment/check/Content-edit.vue +++ b/src/views/specialEquipment/check/Content-edit.vue @@ -240,7 +240,15 @@ export default { return { visible: false, btnLoading: false, - form: {}, + form: { + id: null, + name: null, + departmentId: null, + groupClass: null, + checkPerson: null, + planCheckTime: null, + remark: null, + }, formLoading: false, departmentList: [], inspectorOptions: [], @@ -421,6 +429,17 @@ export default { break; } }, + resetForm() { + this.form = { + id: null, + name: null, + departmentId: null, + groupClass: null, + checkPerson: null, + planCheckTime: null, + remark: null, + }; + }, async handleConfirm() { this.btnLoading = true; this.$nextTick(async () => { @@ -443,7 +462,6 @@ export default { this.$emit('refreshDataList'); this.handleCancel(); } catch (err) { - console.log('..................................err', err); this.btnLoading = false; } }); @@ -462,20 +480,22 @@ export default { }, async getInfo(row) { - console.log('row', row); + this.resetForm(); const res = await this.$axios( '/base/equipment-check-order/get?id=' + row.id ); if (res.code == 0) { - this.form = res.data; - this.form.groupClass = - res.data.groupClass && - res.data.groupClass.trim() != '' && - res.data.groupClass.split(','); - this.form.checkPerson = - res.data.checkPerson && - res.data.checkPerson.trim() != '' && - res.data.checkPerson.split(','); + Object.keys(this.form).forEach((key) => { + if (key == 'groupClass' || key == 'checkPerson') { + this.form[key] = + (res.data[key] && + res.data[key].trim() != '' && + res.data[key].split(',')) || + []; + } else { + this.form[key] = res.data[key]; + } + }); this.formLoading = false; } this.formLoading = false; @@ -520,8 +540,8 @@ export default { if (userlist.code == 0) { inspectorList = inspectorList.concat( (userlist.data?.list || []).map((item) => ({ - label: item.username, - value: item.id, + label: item.nickname, + value: item.nickname, })) ); } @@ -547,22 +567,6 @@ export default { this.formLoading = false; }, - // 保存表单 - handleSave() { - this.$refs.form.validate(async (valid) => { - if (valid) { - await this.$axios({ - url: '/urlupdate', // this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'], - method: 'post', // isEdit ? 'put' : 'post', - data: this.form, - }); - this.$modal.msgSuccess(`${isEdit ? '更新' : '创建'}成功`); - this.visible = false; - this.$emit('refreshDataList'); - } - }); - }, - handleCancel() { this.visible = false; }, diff --git a/src/views/specialEquipment/check/Content.vue b/src/views/specialEquipment/check/Content.vue index 8bfae10e..6e97e95d 100644 --- a/src/views/specialEquipment/check/Content.vue +++ b/src/views/specialEquipment/check/Content.vue @@ -18,6 +18,7 @@ :table-data="list" :page="queryParams.pageNo" :limit="queryParams.pageSize" + :permissionGuard="checkConfirmPermission" @edit="handleEdit" @detail="handleDetail" @delete="handleDelete" @@ -177,6 +178,7 @@ export default { pageSize: 10, name: null, status: 1, + special: true, }, // 表单参数 form: {}, @@ -296,6 +298,12 @@ export default { }); }, + /** 按钮、选择权限 */ + checkConfirmPermission(row) { + const isAdmin = false; // 后续再修改 + return !row.confirmDueTime || row.confirmDueTime >= new Date().getTime() || isAdmin; + }, + /** 编辑 */ handleEdit(row, detail) { this.editOpen = true; @@ -313,7 +321,7 @@ export default { return this.$axios({ url: '/base/equipment-check-order/confirm?confirmPerson=' + - this.$store.getters.userId, + this.$store.getters.nickname, // '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''), method: 'put', data: [id], diff --git a/src/views/specialEquipment/check/Record-detail.vue b/src/views/specialEquipment/check/Record-detail.vue index 833cc738..58adc97b 100644 --- a/src/views/specialEquipment/check/Record-detail.vue +++ b/src/views/specialEquipment/check/Record-detail.vue @@ -324,8 +324,8 @@ export default { method: 'put', data: { ...this.form, - groupClass: this.form.groupClass.join(','), - checkPerson: this.form.checkPerson.join(','), + groupClass: this.form.groupClass?.join(','), + checkPerson: this.form.checkPerson?.join(','), }, }); if (code == 0) { @@ -401,8 +401,8 @@ export default { if (userlist.code == 0) { inspectorList = inspectorList.concat( (userlist.data?.list || []).map((item) => ({ - label: item.username, - value: item.id, + label: item.nickname, + value: item.nickname, })) ); } diff --git a/src/views/specialEquipment/maintain/Repair--add.vue b/src/views/specialEquipment/maintain/Repair--add.vue index 6bbc6ff1..05165a96 100644 --- a/src/views/specialEquipment/maintain/Repair--add.vue +++ b/src/views/specialEquipment/maintain/Repair--add.vue @@ -658,7 +658,7 @@ export default { }); list = list.concat( (userList.data?.list || []).map((item) => ({ - label: item.username, + label: item.nickname, value: item.id, })) );