projects/mesxc-lb #205

Merged
gtz217 merged 38 commits from projects/mesxc-lb into projects/mesxc-test 2024-02-26 02:14:07 +08:00
6 changed files with 171 additions and 205 deletions
Showing only changes of commit 8ca1ef5624 - Show all commits

View File

@ -360,8 +360,9 @@ export default {
promiseList.push(async () => { promiseList.push(async () => {
const response = await this.$axios(opt.url, { const response = await this.$axios(opt.url, {
method: opt.method ?? 'get', method: opt.method ?? 'get',
// data: opt.method == 'post' ? opt.queryParams : null
}); });
console.log('[dialogForm:handleOptions:response]', response); // console.log('[dialogForm:handleOptions:response]', response);
if (opt.select) { if (opt.select) {
// //
const list = const list =

View File

@ -27,7 +27,7 @@
<div class="drawer-body flex"> <div class="drawer-body flex">
<div class="drawer-body__content"> <div class="drawer-body__content">
<section> <section>
<SmallTitle>保养信息</SmallTitle> <!-- <SmallTitle>保养信息</SmallTitle> -->
<div class="form-part" style="margin-bottom: 32px"> <div class="form-part" style="margin-bottom: 32px">
<el-skeleton v-if="!showForm" animated /> <el-skeleton v-if="!showForm" animated />
<el-form <el-form
@ -56,14 +56,6 @@
<section> <section>
<SmallTitle>保养详情</SmallTitle> <SmallTitle>保养详情</SmallTitle>
<div style="margin-top: 12px; position: relative"> <div style="margin-top: 12px; position: relative">
<!-- <div
v-if="!mode.includes('detail')"
style="position: absolute; top: -40px; right: 0">
<el-button @click="handleAddDetail" type="text">
<i class="el-icon-plus"></i>
添加详情
</el-button>
</div> -->
<base-table <base-table
v-loading="detailLoading" v-loading="detailLoading"
:table-props="detailTableProps" :table-props="detailTableProps"
@ -210,7 +202,8 @@ export default {
detailTableProps: [ detailTableProps: [
{ prop: 'equipmentName', label: '设备名称' }, { prop: 'equipmentName', label: '设备名称' },
{ prop: 'program', label: '保养项目' }, { prop: 'program', label: '保养项目' },
{ prop: 'remark', label: '备注' }, { prop: 'maintenanceDes', label: '保养描述' },
// { prop: 'remark', label: '' },
], ],
detailTableQuery: { detailTableQuery: {
pageNo: 1, pageNo: 1,
@ -308,16 +301,24 @@ export default {
this.detailLoading = true; this.detailLoading = true;
if (!this.form.id) if (!this.form.id)
return this.$message.info('没有找到保养计划相关信息...'); return this.$message.info('没有找到保养计划相关信息...');
const res = await this.$axios('/base/equipment-maintain-plan-det/page', {
try {
const res = await this.$axios(
'/base/equipment-maintain-plan-det/page',
{
params: { params: {
pageNo: this.detailTableQuery.pageNo, pageNo: this.detailTableQuery.pageNo,
pageSize: this.detailTableQuery.pageSize, pageSize: this.detailTableQuery.pageSize,
planId: this.form.id, planId: this.form.id,
}, },
}); }
);
this.detailList = res.data?.list || []; this.detailList = res.data?.list || [];
this.detailTotal = res.data?.total || 0; this.detailTotal = res.data?.total || 0;
this.detailLoading = false; this.detailLoading = false;
} catch (err) {
this.detailLoading = false;
}
}, },
// //
handleDetailTableAction() {}, handleDetailTableAction() {},

View File

@ -157,6 +157,7 @@ export default {
label: '保养计划名称', label: '保养计划名称',
width: 110, width: 110,
showOverflowtooltip: true, showOverflowtooltip: true,
filter: (val) => (val != null ? val : '---'),
}, },
{ {
prop: 'departmentName', prop: 'departmentName',
@ -514,30 +515,7 @@ export default {
}, },
created() { created() {
this.initSearchBar(); this.initSearchBar();
// if (this.$route.query) {
// this.queryParams.specialType =
// this.$route.query?.specialType ?? undefined;
// this.queryParams.equipmentId =
// this.$route.query?.equipmentId ?? undefined;
// this.queryParams.maintainPlanId =
// this.$route.query?.maintainPlanId ?? undefined;
// this.queryParams.relatePlan = this.$route.query?.relatePlan ?? undefined;
// this.queryParams.startTime = this.$route.query?.createTime ?? undefined;
// this.searchBarFormConfig[0].defaultSelect =
// this.$route.query.specialType ?? undefined;
// this.searchBarFormConfig[1].defaultSelect =
// this.$route.query.equipmentId ?? undefined;
// this.searchBarFormConfig[2].defaultSelect =
// this.$route.query.maintainPlanId ?? undefined;
// this.searchBarFormConfig[3].defaultSelect =
// this.$route.query?.createTime ?? undefined;
// this.searchBarFormConfig[4].defaultSelect =
// Number(this.$route.query.relatePlan) ?? undefined;
// }
this.getList(); this.getList();
// if (this.$route.query.addRecord) {
// this.handleAdd();
// }
}, },
methods: { methods: {
handleEmitFun({ action, value }) { handleEmitFun({ action, value }) {
@ -546,7 +524,7 @@ export default {
this.recordDetailVisible = true; this.recordDetailVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.recordDetailDrawer.show({ this.$refs.recordDetailDrawer.show({
id: value.id, id: value.maintainPlanId,
planMaintainWorker: value.planMaintainWorker, planMaintainWorker: value.planMaintainWorker,
maintainWorker: value.maintainWorker, maintainWorker: value.maintainWorker,
}); });
@ -566,21 +544,7 @@ export default {
); );
} }
}, },
// setSearchBarEquipmentList(eqList) {
// this.$set(
// this.searchBarFormConfig[1],
// 'selectOptions',
// eqList.map((item) => ({
// name: item.name,
// id: item.id,
// }))
// );
// },
initSearchBar() { initSearchBar() {
// this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
// this.allSpecialEquipments = data.filter((item) => item.special);
// this.setSearchBarEquipmentList(data.filter((item) => item.special));
// });
this.http('/base/equipment-maintain-plan/page', 'get', { this.http('/base/equipment-maintain-plan/page', 'get', {
pageNo: 1, pageNo: 1,
pageSize: 100, pageSize: 100,
@ -588,7 +552,6 @@ export default {
}).then(({ data }) => { }).then(({ data }) => {
this.$set( this.$set(
this.searchBarFormConfig[0], this.searchBarFormConfig[0],
// this.searchBarFormConfig[2],
'selectOptions', 'selectOptions',
(data?.list || []).map((item) => ({ (data?.list || []).map((item) => ({
name: item.name, name: item.name,
@ -602,20 +565,7 @@ export default {
this.loading = true; this.loading = true;
// //
this.recv({ ...this.queryParams, special: true }).then((response) => { this.recv({ ...this.queryParams, special: true }).then((response) => {
this.list = [ this.list = response.data.list;
{
id: 213,
maintainOrderNumber: 123,
planName: 'hhh',
departmentName: 'asdf',
lineName: 456,
planStartTime: '2024-01-01',
planEndTime: '2024-01-01',
startTime: '2024-01-01',
endTime: '2024-01-01',
relatePlan: 1,
},
]; // response.data.list;
this.total = response.data.total; this.total = response.data.total;
this.loading = false; this.loading = false;
}); });
@ -670,19 +620,6 @@ export default {
this.form.relatePlan = tempRow.nextMaintainTime ? 1 : 2; this.form.relatePlan = tempRow.nextMaintainTime ? 1 : 2;
this.form.startTime = tempRow.nextMaintainTime; this.form.startTime = tempRow.nextMaintainTime;
this.form.maintainPlanId = tempRow.id; this.form.maintainPlanId = tempRow.id;
// await (() => {
// return new Promise((acpt, rejt) => {
// this.form.relatePlan =
// this.$route.query.relatePlan ||
// (tempRow.nextMaintainTime ? 1 : 2);
// this.form.startTime = tempRow.nextMaintainTime;
// acpt();
// });
// })();
// this.$nextTick(() => {
// this.form.maintainPlanId = tempRow.id;
// this.form.equipmentId = tempRow.equipmentId;
// });
} }
if (this.$route.query.isAdd) { if (this.$route.query.isAdd) {
// //

View File

@ -488,17 +488,25 @@ export default {
// } // }
}, },
methods: { methods: {
searchBarClicked(btn) { /** 批量确认 */
console.log('searchBarClicked', btn); async searchBarClicked(btn) {
switch (btn.btnName) { switch (btn.btnName) {
case 'batchConfirm': case 'batchConfirm':
if (this.$refs['waiting-list-table'].selectedPlan.length == 0) { if (this.$refs['waiting-list-table'].selectedPlan.length == 0) {
this.$message.warning('请选择待确认的设备保养记录'); this.$message.warning('请选择待确认的设备保养记录');
return;
}
const res = await this.$axios({
url: '/base/equipment-maintain-log/confirm',
method: 'put',
data: this.$refs['waiting-list-table'].selectedPlan.map(
(item) => item.id
),
});
if (res.code == 0) {
this.$message.success('确认成功');
this.getList();
} }
console.log(
'selectedPlan',
this.$refs['waiting-list-table'].selectedPlan
);
break; break;
} }
}, },
@ -599,11 +607,7 @@ export default {
relatePlan: 2, relatePlan: 2,
confirmed: false, confirmed: false,
}).then((response) => { }).then((response) => {
this.list = response.data.list.map((item) => ({ this.list = response.data.list;
...item,
planName: '---',
_selection: 0b10,
}));
this.total = response.data.total; this.total = response.data.total;
this.loading = false; this.loading = false;
}); });
@ -627,7 +631,7 @@ export default {
endTime: null, endTime: null,
planStartTime: null, planStartTime: null,
planEndTime: null, planEndTime: null,
confirmed: null, confirmed: false,
remark: null, remark: null,
special: false, special: false,
}; };
@ -646,36 +650,18 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
// if (this.$route.query.addRecord) {
// //
// const tempRow = this.$route.query.row;
// this.form.equipmentId = tempRow.equipmentId;
// this.form.relatePlan = tempRow.nextMaintainTime ? 1 : 2;
// this.form.startTime = tempRow.nextMaintainTime;
// this.form.maintainPlanId = tempRow.id;
// // await (() => {
// // return new Promise((acpt, rejt) => {
// // this.form.relatePlan =
// // this.$route.query.relatePlan ||
// // (tempRow.nextMaintainTime ? 1 : 2);
// // this.form.startTime = tempRow.nextMaintainTime;
// // acpt();
// // });
// // })();
// // this.$nextTick(() => {
// // this.form.maintainPlanId = tempRow.id;
// // this.form.equipmentId = tempRow.equipmentId;
// // });
// }
// if (this.$route.query.isAdd) {
// //
// this.form.equipmentId = this.$route.query.equipmentId;
// this.form.maintainPlanId = this.$route.query.maintainPlanId;
// }
this.open = true; this.open = true;
this.title = '添加待确认保养记录'; this.title = '添加待确认保养记录';
}, },
getConfirmed() {
return this.$confirm('是否直接确认保养记录', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
},
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
@ -696,37 +682,48 @@ export default {
}); });
return; return;
} }
// //
this.getConfirmed()
.then((confirmed) => {
this.post({ this.post({
...this.form, ...this.form,
maintainWorker: this.form.maintainWorker.join(','), maintainWorker: this.form.maintainWorker.join(','),
special: true, special: true,
relatePlan: 2, relatePlan: 2,
confirmed: true,
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
})
.catch((err) => {
this.post({
...this.form,
maintainWorker: this.form.maintainWorker.join(','),
special: true,
relatePlan: 2,
confirmed: false,
}).then((response) => { }).then((response) => {
this.$modal.msgSuccess('新增成功'); this.$modal.msgSuccess('新增成功');
//
// const toSparePartsMaintain = () => {
// this.open = false;
// };
// this.$confirm('?', '', {
// confirmButtonText: '',
// cancelButtonText: '',
// })
// .then(toSparePartsMaintain)
// .catch(() => {
// this.open = false;
// this.getList();
// });
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
}); });
});
}, },
/** 确认 */ /** 确认 */
handleConfirm(row) { async handleConfirm(row) {
console.log('confirm', row); const res = await this.$axios({
url: '/base/equipment-maintain-log/confirm',
method: 'put',
data: [row.id],
});
if (res.code == 0) {
this.$message.success('确认成功');
this.getList();
}
}, },
/** 编辑 */ /** 编辑 */
async handleEdit(row) { async handleEdit(row) {
@ -738,10 +735,6 @@ export default {
this.form.maintainWorker = res.data.maintainWorker.split(','); this.form.maintainWorker = res.data.maintainWorker.split(',');
this.openPlannedDrawer = true; this.openPlannedDrawer = true;
} else { } else {
// 2
// const res = await this.info({ id: row.id });
// this.form = res.data;
// this.form.maintainWorker = res.data.maintainWorker.split(',');
this.openUnplannedDrawer = true; this.openUnplannedDrawer = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.unplanned.init(row); this.$refs.unplanned.init(row);
@ -750,21 +743,21 @@ export default {
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
console.log('delete', row);
return;
const id = row.id;
this.$modal this.$modal
.confirm( .confirm(
'是否确认删除设备保养单号为"' + row.maintainOrderNumber + '"的数据项?' '是否确认删除设备保养单号为"' + row.maintainOrderNumber + '"的数据项?'
) )
.then(function () { .then(() => {
// return deleteEqMaintainLog(id); return this.$axios({
url: '/base/equipment-maintain-log/delete?id=' + row.id,
method: 'delete',
});
}) })
.then(() => { .then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess('删除成功'); this.$modal.msgSuccess('删除成功');
}) })
.catch(() => {}); .catch(console.error);
}, },
handleDetail(row) { handleDetail(row) {
console.log('detail', row); console.log('detail', row);

View File

@ -39,18 +39,21 @@
width="128" width="128"
label="设备保养单号" label="设备保养单号"
prop="maintainOrderNumber"></el-table-column> prop="maintainOrderNumber"></el-table-column>
<el-table-column <el-table-column v-if="selectedBox[1]" label="保养计划名称" prop="planName">
v-if="selectedBox[1]" <template slot-scope="scope">
label="保养计划名称" {{ scope.row.planName || '---' }}
prop="planName"></el-table-column> </template>
<el-table-column </el-table-column>
v-if="selectedBox[2]" <el-table-column v-if="selectedBox[2]" label="部门" prop="departmentName">
label="部门" <template slot-scope="scope">
prop="departmentName"></el-table-column> {{ scope.row.departmentName || '---' }}
<el-table-column </template>
v-if="selectedBox[3]" </el-table-column>
label="产线名" <el-table-column v-if="selectedBox[3]" label="产线名" prop="lineName">
prop="lineName"></el-table-column> <template slot-scope="scope">
{{ scope.row.lineName || '---' }}
</template>
</el-table-column>
<el-table-column <el-table-column
v-if="selectedBox[4]" v-if="selectedBox[4]"
width="150" width="150"

View File

@ -191,7 +191,9 @@
:formConfigs="searchBarFormConfig" :formConfigs="searchBarFormConfig"
ref="attr-search-bar" ref="attr-search-bar"
@headBtnClick="handleSearchBarBtnClick" /> @headBtnClick="handleSearchBarBtnClick" />
</div>
<div style="margin-top: 12px; position: relative">
<div style="position: absolute; top: -40px; right: 0"> <div style="position: absolute; top: -40px; right: 0">
<el-button @click="handleAddAttr" type="text"> <el-button @click="handleAddAttr" type="text">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
@ -245,16 +247,18 @@
@close="closeAttrForm" @close="closeAttrForm"
@cancel="closeAttrForm" @cancel="closeAttrForm"
@confirm="submitAttrForm"> @confirm="submitAttrForm">
<!-- <DialogForm <DialogForm
v-if="attrFormVisible" v-if="attrFormVisible"
ref="attrForm" ref="attrForm"
:dataForm="attrForm" v-model="attrForm"
:rows="attrRows" /> --> :rows="attrRows" />
</base-dialog> </base-dialog>
</el-drawer> </el-drawer>
</template> </template>
<script> <script>
import DialogForm from '../../../components/DialogForm/index.vue';
const SmallTitle = { const SmallTitle = {
name: 'SmallTitle', name: 'SmallTitle',
props: ['size'], props: ['size'],
@ -282,13 +286,14 @@ const SmallTitle = {
}; };
export default { export default {
components: { SmallTitle }, components: { SmallTitle, DialogForm },
props: ['dataId'], // dataId id props: ['dataId'], // dataId id
data() { data() {
return { return {
visible: false, visible: false,
btnLoading: false, btnLoading: false,
form: {}, form: {},
formLoading: false,
lineList: [], lineList: [],
maintainerList: [], maintainerList: [],
departmentList: [], departmentList: [],
@ -311,27 +316,49 @@ export default {
attrTitle: '', attrTitle: '',
attrForm: { attrForm: {
id: null, id: null,
equipmentId: null, logId: null,
name: '', program: null,
value: '', maintenanceDes: null,
remark: null,
}, },
attrFormVisible: false, attrFormVisible: false,
attrRows: [ attrRows: [
[ [
{ {
input: true, select: true,
label: '属性名称', label: '设备名称',
prop: 'name', prop: 'equipmentId',
url: '/base/core-equipment/page?pageNo=1&pageSize=100&special=true',
// method: 'post',
// queryParams: {
// pageNo: 1,
// pageSize: 100,
// special: true,
// },
rules: [ rules: [
{ required: true, message: '属性名称不能为空', trigger: 'blur' }, { required: true, message: '设备不能为空', trigger: 'blur' },
], ],
}, },
], ],
[ [
{ {
input: true, input: true,
label: '属性值', label: '保养项目',
prop: 'value', prop: 'program',
},
],
[
{
input: true,
label: '保养描述',
prop: 'maintenanceDes',
},
],
[
{
input: true,
label: '备注',
prop: 'remark',
}, },
], ],
], ],
@ -396,8 +423,8 @@ export default {
console.log('btn', btn); console.log('btn', btn);
switch (btn.btnName) { switch (btn.btnName) {
case 'search': case 'search':
this.attrQuery.params.equipmentName = btn['key']; this.attrQuery.params.equipmentName = btn.equipmentName;
this.handleQuery(); this.getAttrList();
break; break;
} }
}, },
@ -413,18 +440,18 @@ export default {
}, },
async handleConfirm() { async handleConfirm() {
this.btnLoading = true; this.btnLoading = true;
// this.syncFileListFlag = Math.random();
this.$nextTick(async () => { this.$nextTick(async () => {
const { code, data } = await this.$axios({ const { code, data } = await this.$axios({
url: '/update', // this.sections[0].urlUpdate, url: '/base/equipment-maintain-log/update',
method: 'put', method: 'put',
data: this.form, data: {
...this.form,
maintainWorker: this.form.maintainWorker.join(',')
},
}); });
if (code == 0) { if (code == 0) {
this.$modal.msgSuccess('更新成功'); this.$modal.msgSuccess('更新成功');
} }
this.btnLoading = false; this.btnLoading = false;
this.$emit('refreshDataList'); this.$emit('refreshDataList');
this.handleCancel(); this.handleCancel();
@ -518,15 +545,20 @@ export default {
this.visible = false; this.visible = false;
}, },
// resetAttrform() {
handleAddAttr() {
if (!this.dataId) return this.$message.error('请先创建设备信息');
this.attrForm = { this.attrForm = {
id: null, id: null,
equipmentId: this.dataId, logId: this.row.id,
name: '', maintenanceDes: '',
value: '', program: null,
remark: null,
}; };
},
//
handleAddAttr() {
if (!this.row.id) return this.$message.error('请先选中保养记录');
this.resetAttrform();
this.attrTitle = '添加设备属性'; this.attrTitle = '添加设备属性';
this.attrFormVisible = true; this.attrFormVisible = true;
}, },
@ -534,7 +566,7 @@ export default {
// //
async handleEditAttr(attrId) { async handleEditAttr(attrId) {
const res = await this.$axios({ const res = await this.$axios({
url: 'urlpudate', // this.sections[1].urlDetail, url: '/base/equipment-maintain-log-det/get',
method: 'get', method: 'get',
params: { id: attrId }, params: { id: attrId },
}); });
@ -583,10 +615,9 @@ export default {
const isEdit = this.attrForm.id != null; const isEdit = this.attrForm.id != null;
this.attrFormSubmitting = true; this.attrFormSubmitting = true;
const res = await this.$axios({ const res = await this.$axios({
url: 'url edit', url: isEdit
// isEdit ? '/base/equipment-maintain-log-det/update'
// ? this.sections[1].urlUpdate : '/base/equipment-maintain-log-det/create',
// : this.sections[1].urlCreate,
method: isEdit ? 'put' : 'post', method: isEdit ? 'put' : 'post',
data: this.attrForm, data: this.attrForm,
}); });