@@ -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) | |||
@@ -51,10 +51,7 @@ | |||
{{ scope.row.planCheckTime | timeFilter }} | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
v-if="selectedBox[3]" | |||
label="班次" | |||
prop="groupClass"> | |||
<el-table-column v-if="selectedBox[3]" label="班次" prop="groupClass"> | |||
<template slot-scope="scope"> | |||
{{ scope.row.groupClass || '---' }} | |||
</template> | |||
@@ -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; | |||
@@ -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) { | |||
@@ -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; | |||
}, | |||
@@ -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], | |||
@@ -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, | |||
})) | |||
); | |||
} | |||
@@ -658,7 +658,7 @@ export default { | |||
}); | |||
list = list.concat( | |||
(userList.data?.list || []).map((item) => ({ | |||
label: item.username, | |||
label: item.nickname, | |||
value: item.id, | |||
})) | |||
); | |||