This commit is contained in:
lb 2024-02-29 15:54:49 +08:00
parent a41db38229
commit 838c8d66ad
7 changed files with 56 additions and 51 deletions

View File

@ -87,6 +87,7 @@ const user = {
// 获取用户信息 // 获取用户信息
GetInfo({ commit, state }) { GetInfo({ commit, state }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
console.log('GetInfo')
getInfo().then(res => { getInfo().then(res => {
// 没有 data 数据,赋予个默认值 // 没有 data 数据,赋予个默认值
if (!res) { if (!res) {
@ -96,7 +97,7 @@ const user = {
user: { user: {
id: '', id: '',
avatar: '', avatar: '',
userName: '', username: '',
nickname: '' nickname: ''
} }
} }
@ -113,7 +114,7 @@ const user = {
commit('SET_ROLES', ['ROLE_DEFAULT']) commit('SET_ROLES', ['ROLE_DEFAULT'])
} }
commit('SET_ID', user.id) commit('SET_ID', user.id)
commit('SET_NAME', user.userName) // commit('SET_NAME', user.username) //无效调用接口未提供username值
commit('SET_NICKNAME', user.nickname) commit('SET_NICKNAME', user.nickname)
commit('SET_AVATAR', avatar) commit('SET_AVATAR', avatar)
resolve(res) resolve(res)

View File

@ -51,10 +51,7 @@
{{ scope.row.planCheckTime | timeFilter }} {{ scope.row.planCheckTime | timeFilter }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column v-if="selectedBox[3]" label="班次" prop="groupClass">
v-if="selectedBox[3]"
label="班次"
prop="groupClass">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.groupClass || '---' }} {{ scope.row.groupClass || '---' }}
</template> </template>
@ -129,7 +126,7 @@ import moment from 'moment';
export default { export default {
name: 'CheckOrderListTable', name: 'CheckOrderListTable',
components: {}, components: {},
props: ['tableData', 'page', 'limit'], props: ['tableData', 'page', 'limit', 'permissionGuard'],
filters: { filters: {
timeFilter: (val) => timeFilter: (val) =>
val ? moment(val).format('yyyy-MM-DD HH:mm:ss') : '---', val ? moment(val).format('yyyy-MM-DD HH:mm:ss') : '---',
@ -170,12 +167,7 @@ export default {
}, },
methods: { methods: {
checkSelectable(row, index) { checkSelectable(row, index) {
return true; return this.permissionGuard(row);
// return (
// row.relatePlan == 2 ||
// (row.relatePlan == 1 &&
// (!row.confirmDueTime || +row.confirmDueTime >= new Date().getTime()))
// );
}, },
handleSelectionChange(val) { handleSelectionChange(val) {
this.selectedOrder = val; this.selectedOrder = val;

View File

@ -175,8 +175,8 @@ export default {
special: true, special: true,
status: 1, status: 1,
// status: confirmed ? 2 : 1, // status: confirmed ? 2 : 1,
groupClass: this.dataForm.groupClass.join(','), groupClass: this.dataForm.groupClass?.join(','),
checkPerson: this.$store.getters.userId, checkPerson: this.$store.getters.nickname,
}, },
}); });
if (res.code == 0) { if (res.code == 0) {

View File

@ -240,7 +240,15 @@ export default {
return { return {
visible: false, visible: false,
btnLoading: false, btnLoading: false,
form: {}, form: {
id: null,
name: null,
departmentId: null,
groupClass: null,
checkPerson: null,
planCheckTime: null,
remark: null,
},
formLoading: false, formLoading: false,
departmentList: [], departmentList: [],
inspectorOptions: [], inspectorOptions: [],
@ -421,6 +429,17 @@ export default {
break; break;
} }
}, },
resetForm() {
this.form = {
id: null,
name: null,
departmentId: null,
groupClass: null,
checkPerson: null,
planCheckTime: null,
remark: null,
};
},
async handleConfirm() { async handleConfirm() {
this.btnLoading = true; this.btnLoading = true;
this.$nextTick(async () => { this.$nextTick(async () => {
@ -443,7 +462,6 @@ export default {
this.$emit('refreshDataList'); this.$emit('refreshDataList');
this.handleCancel(); this.handleCancel();
} catch (err) { } catch (err) {
console.log('..................................err', err);
this.btnLoading = false; this.btnLoading = false;
} }
}); });
@ -462,20 +480,22 @@ export default {
}, },
async getInfo(row) { async getInfo(row) {
console.log('row', row); this.resetForm();
const res = await this.$axios( const res = await this.$axios(
'/base/equipment-check-order/get?id=' + row.id '/base/equipment-check-order/get?id=' + row.id
); );
if (res.code == 0) { if (res.code == 0) {
this.form = res.data; Object.keys(this.form).forEach((key) => {
this.form.groupClass = if (key == 'groupClass' || key == 'checkPerson') {
res.data.groupClass && this.form[key] =
res.data.groupClass.trim() != '' && (res.data[key] &&
res.data.groupClass.split(','); res.data[key].trim() != '' &&
this.form.checkPerson = res.data[key].split(',')) ||
res.data.checkPerson && [];
res.data.checkPerson.trim() != '' && } else {
res.data.checkPerson.split(','); this.form[key] = res.data[key];
}
});
this.formLoading = false; this.formLoading = false;
} }
this.formLoading = false; this.formLoading = false;
@ -520,8 +540,8 @@ export default {
if (userlist.code == 0) { if (userlist.code == 0) {
inspectorList = inspectorList.concat( inspectorList = inspectorList.concat(
(userlist.data?.list || []).map((item) => ({ (userlist.data?.list || []).map((item) => ({
label: item.username, label: item.nickname,
value: item.id, value: item.nickname,
})) }))
); );
} }
@ -547,22 +567,6 @@ export default {
this.formLoading = false; 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() { handleCancel() {
this.visible = false; this.visible = false;
}, },

View File

@ -18,6 +18,7 @@
:table-data="list" :table-data="list"
:page="queryParams.pageNo" :page="queryParams.pageNo"
:limit="queryParams.pageSize" :limit="queryParams.pageSize"
:permissionGuard="checkConfirmPermission"
@edit="handleEdit" @edit="handleEdit"
@detail="handleDetail" @detail="handleDetail"
@delete="handleDelete" @delete="handleDelete"
@ -177,6 +178,7 @@ export default {
pageSize: 10, pageSize: 10,
name: null, name: null,
status: 1, status: 1,
special: true,
}, },
// //
form: {}, form: {},
@ -296,6 +298,12 @@ export default {
}); });
}, },
/** 按钮、选择权限 */
checkConfirmPermission(row) {
const isAdmin = false; //
return !row.confirmDueTime || row.confirmDueTime >= new Date().getTime() || isAdmin;
},
/** 编辑 */ /** 编辑 */
handleEdit(row, detail) { handleEdit(row, detail) {
this.editOpen = true; this.editOpen = true;
@ -313,7 +321,7 @@ export default {
return this.$axios({ return this.$axios({
url: url:
'/base/equipment-check-order/confirm?confirmPerson=' + '/base/equipment-check-order/confirm?confirmPerson=' +
this.$store.getters.userId, this.$store.getters.nickname,
// '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''), // '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''),
method: 'put', method: 'put',
data: [id], data: [id],

View File

@ -324,8 +324,8 @@ export default {
method: 'put', method: 'put',
data: { data: {
...this.form, ...this.form,
groupClass: this.form.groupClass.join(','), groupClass: this.form.groupClass?.join(','),
checkPerson: this.form.checkPerson.join(','), checkPerson: this.form.checkPerson?.join(','),
}, },
}); });
if (code == 0) { if (code == 0) {
@ -401,8 +401,8 @@ export default {
if (userlist.code == 0) { if (userlist.code == 0) {
inspectorList = inspectorList.concat( inspectorList = inspectorList.concat(
(userlist.data?.list || []).map((item) => ({ (userlist.data?.list || []).map((item) => ({
label: item.username, label: item.nickname,
value: item.id, value: item.nickname,
})) }))
); );
} }

View File

@ -658,7 +658,7 @@ export default {
}); });
list = list.concat( list = list.concat(
(userList.data?.list || []).map((item) => ({ (userList.data?.list || []).map((item) => ({
label: item.username, label: item.nickname,
value: item.id, value: item.id,
})) }))
); );