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 () => {
const response = await this.$axios(opt.url, {
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) {
//
const list =

View File

@ -27,7 +27,7 @@
<div class="drawer-body flex">
<div class="drawer-body__content">
<section>
<SmallTitle>保养信息</SmallTitle>
<!-- <SmallTitle>保养信息</SmallTitle> -->
<div class="form-part" style="margin-bottom: 32px">
<el-skeleton v-if="!showForm" animated />
<el-form
@ -56,14 +56,6 @@
<section>
<SmallTitle>保养详情</SmallTitle>
<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
v-loading="detailLoading"
:table-props="detailTableProps"
@ -210,7 +202,8 @@ export default {
detailTableProps: [
{ prop: 'equipmentName', label: '设备名称' },
{ prop: 'program', label: '保养项目' },
{ prop: 'remark', label: '备注' },
{ prop: 'maintenanceDes', label: '保养描述' },
// { prop: 'remark', label: '' },
],
detailTableQuery: {
pageNo: 1,
@ -308,16 +301,24 @@ export default {
this.detailLoading = true;
if (!this.form.id)
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: {
pageNo: this.detailTableQuery.pageNo,
pageSize: this.detailTableQuery.pageSize,
planId: this.form.id,
},
});
}
);
this.detailList = res.data?.list || [];
this.detailTotal = res.data?.total || 0;
this.detailLoading = false;
} catch (err) {
this.detailLoading = false;
}
},
//
handleDetailTableAction() {},

View File

@ -157,6 +157,7 @@ export default {
label: '保养计划名称',
width: 110,
showOverflowtooltip: true,
filter: (val) => (val != null ? val : '---'),
},
{
prop: 'departmentName',
@ -514,30 +515,7 @@ export default {
},
created() {
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();
// if (this.$route.query.addRecord) {
// this.handleAdd();
// }
},
methods: {
handleEmitFun({ action, value }) {
@ -546,7 +524,7 @@ export default {
this.recordDetailVisible = true;
this.$nextTick(() => {
this.$refs.recordDetailDrawer.show({
id: value.id,
id: value.maintainPlanId,
planMaintainWorker: value.planMaintainWorker,
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() {
// 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', {
pageNo: 1,
pageSize: 100,
@ -588,7 +552,6 @@ export default {
}).then(({ data }) => {
this.$set(
this.searchBarFormConfig[0],
// this.searchBarFormConfig[2],
'selectOptions',
(data?.list || []).map((item) => ({
name: item.name,
@ -602,20 +565,7 @@ export default {
this.loading = true;
//
this.recv({ ...this.queryParams, special: true }).then((response) => {
this.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.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
@ -670,19 +620,6 @@ export default {
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) {
//

View File

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

View File

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

View File

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