Compare commits

..

No commits in common. "dd6f07a9b00be95b90ac57f857382df1f2055010" and "2fe3aebe890b2d3be9ad62a48865fc4cd4144a05" have entirely different histories.

4 changed files with 104 additions and 258 deletions

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2024-02-28 14:45:58 * @LastEditTime: 2024-02-27 09:41:00
* @Description: * @Description:
--> -->
<template> <template>
@ -27,14 +27,13 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="巡检单名称" prop="name"> <el-form-item label="巡检单名称" prop="name">
<el-input v-model="dataForm.name" :disabled="isdetail" placeholder="请输入巡检单名称" /> <el-input v-model="dataForm.name" placeholder="请输入巡检单名称" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="部门" prop="departmentId"> <el-form-item label="部门" prop="departmentId">
<el-select <el-select
v-model="dataForm.departmentId" v-model="dataForm.departmentId"
:disabled="isdetail"
:placeholder="`请选择部门`"> :placeholder="`请选择部门`">
<el-option <el-option
v-for="opt in departmentOptions" v-for="opt in departmentOptions"
@ -51,7 +50,7 @@
filterable filterable
clearable clearable
multiple multiple
:disabled="isdetail" :disabled="isedit"
style="width: 100%" style="width: 100%"
placeholder="请选择班次"> placeholder="请选择班次">
<el-option <el-option
@ -71,7 +70,7 @@
:placeholder="`请选择巡检人`" :placeholder="`请选择巡检人`"
multiple multiple
clearable clearable
:disabled="isdetail" :disabled="isedit"
filterable> filterable>
<el-option <el-option
v-for="opt in inspectorOptions" v-for="opt in inspectorOptions"
@ -86,7 +85,7 @@
<el-date-picker <el-date-picker
v-model="dataForm.planCheckTime" v-model="dataForm.planCheckTime"
type="datetime" type="datetime"
:disabled="isdetail" :disabled="isedit"
placeholder="请选择巡检时间" placeholder="请选择巡检时间"
value-format="timestamp"></el-date-picker> value-format="timestamp"></el-date-picker>
</el-form-item> </el-form-item>
@ -143,8 +142,7 @@
<div v-if="!isdetail" class="drawer-body__footer"> <div v-if="!isdetail" class="drawer-body__footer">
<el-button @click="goback()">取消</el-button> <el-button @click="goback()">取消</el-button>
<!-- <el-button :disabled="isdetail" @click="init(dataForm.id)">重置</el-button> --> <!-- <el-button :disabled="isdetail" @click="init(dataForm.id)">重置</el-button> -->
<el-button v-if="isshowConfirm" type="primary" @click="confirmIns()">保存</el-button> <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
<el-button v-else type="primary" @click="dataFormSubmit()">保存</el-button>
</div> </div>
<attr-add <attr-add
@ -207,7 +205,6 @@ export default {
tableProps, tableProps,
topBtnConfig, topBtnConfig,
addOrUpdateVisible: false, addOrUpdateVisible: false,
isshowConfirm: false,
urlOptions: { urlOptions: {
isGetCode: false, isGetCode: false,
createURL: createCheckOrder, createURL: createCheckOrder,
@ -401,34 +398,6 @@ export default {
this.$refs.addOrUpdate.init(id); this.$refs.addOrUpdate.init(id);
}); });
}, },
getConfirmed() {
return this.$confirm('是否直接确认巡检记录', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
},
async confirmIns() {
await this.getConfirmed().then(confirm => {
this.$axios({
url:
'/base/equipment-check-order/confirm?confirmPerson=' +
this.$store.getters.userId,
method: 'put',
data: [this.dataForm.id],
}).then(res =>{
if (res.code == 0) {
this.visible = false;
this.$emit("refreshDataList");
this.$message.success('已确认');
}
}).catch(() => {
this.visible = false;
this.$emit("refreshDataList");
this.$message.success('取消确认');
})
})
},
// //
dataFormSubmit() { dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => { this.$refs["dataForm"].validate((valid) => {
@ -460,7 +429,6 @@ export default {
}).then(response => { }).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.idAttrShow = true this.idAttrShow = true
this.isshowConfirm = true
this.dataForm.id = response.data this.dataForm.id = response.data
// this.visible = false; // this.visible = false;
this.$emit("refreshDataList"); this.$emit("refreshDataList");

View File

@ -172,27 +172,24 @@ export default {
async searchBarClicked(btn) { async searchBarClicked(btn) {
switch (btn.btnName) { switch (btn.btnName) {
case 'batchConfirm': case 'batchConfirm':
const ids = this.$refs['waiting-list-table'].selectedPlan.map(
(item) => item.id
)
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; return;
} }
this.$modal const res = await this.$axios({
.confirm('是否确认所有选中保养单"?') url: '/base/equipment-check-order/confirm?confirmPerson=' + this.$store.getters.userId + '&ids=' + ids,
.then(() => {
return this.$axios({
url: '/base/equipment-check-order/confirm?confirmPerson=' + this.$store.getters.userId,
method: 'put', method: 'put',
data: this.$refs['waiting-list-table'].selectedPlan.map( // data: this.$refs['waiting-list-table'].selectedPlan.map(
(item) => item.id // (item) => item.id
), // ),
}); });
}) if (res.code == 0) {
.then((res) => { this.$message.success('确认成功');
this.getList(); this.getList();
res.code == 0 && this.$modal.msgSuccess('确认成功'); }
res.code != 0 && this.$modal.msgError('确认失败');
})
.catch(() => {});
break; break;
} }
}, },
@ -331,7 +328,7 @@ export default {
// }, // },
getConfirmed() { getConfirmed() {
return this.$confirm('是否直接确认巡检记录', '提示', { return this.$confirm('是否直接确认保养记录', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
@ -391,16 +388,17 @@ export default {
}, },
/** 确认 */ /** 确认 */
async handleConfirm(row) { async handleConfirm(row) {
console.log('111', this.$store.getters.userId)
this.$modal this.$modal
.confirm('是否确认巡检单"' + row.name + '"?') .confirm('是否确认巡检单"' + row.name + '"?')
.then(() => { .then(() => {
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.userId + '&ids=' + [row.id],
// '/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: [row.id], // data: [row.id],
}); });
}) })
.then((res) => { .then((res) => {

View File

@ -14,7 +14,7 @@
custom-class="mes-drawer" custom-class="mes-drawer"
size="60%" size="60%"
@closed="$emit('destroy')"> @closed="$emit('destroy')">
<SmallTitle slot="title">{{ showTable ? '编辑' : '新增' }}</SmallTitle> <SmallTitle slot="title">编辑</SmallTitle>
<div class="drawer-body flex"> <div class="drawer-body flex">
<div class="drawer-body__content"> <div class="drawer-body__content">
@ -184,7 +184,6 @@
</el-form> </el-form>
</div> </div>
<div v-if="showTable">
<SmallTitle>保养内容</SmallTitle> <SmallTitle>保养内容</SmallTitle>
<div style="margin-top: 12px; position: relative"> <div style="margin-top: 12px; position: relative">
@ -224,13 +223,10 @@
@pagination="getAttrList" /> @pagination="getAttrList" />
</div> </div>
</div> </div>
</div>
<div class="drawer-body__footer"> <div class="drawer-body__footer">
<el-button style="" @click="handleCancel">取消</el-button> <el-button style="" @click="handleCancel">取消</el-button>
<!-- 新增可确认 --> <el-button type="primary" @click="handleConfirm">保存</el-button>
<el-button v-if="isAdd" type="primary" @click="addConfirm">保存</el-button>
<el-button v-else type="primary" @click="handleConfirm">保存</el-button>
<!-- sections的第二项必须是 属性列表 --> <!-- sections的第二项必须是 属性列表 -->
<!-- <el-button <!-- <el-button
v-if="sections[1].allowAdd" v-if="sections[1].allowAdd"
@ -296,8 +292,6 @@ export default {
return { return {
visible: false, visible: false,
btnLoading: false, btnLoading: false,
showTable: false,
isAdd: false,
form: {}, form: {},
formLoading: false, formLoading: false,
lineList: [], lineList: [],
@ -393,7 +387,7 @@ export default {
attrListLoading: false, attrListLoading: false,
// syncFileListFlag: null, // syncFileListFlag: null,
tableBtn: [], tableBtn: [],
row: {}, row: null,
}; };
}, },
computed: { computed: {
@ -444,107 +438,24 @@ export default {
break; break;
} }
}, },
async addConfirm() {
console.log('11', this.showTable)
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
this.$nextTick(() => {
this.getConfirmed().then(confirm => {
console.log('111', confirm)
this.$axios({
url:
'/base/equipment-maintain-log/confirm?confirmPerson=' +
this.$store.getters.userId,
method: 'put',
data: [this.form.id],
}).then(res =>{
if (res.code == 0) {
this.visible = false;
this.$emit("refreshDataList");
this.$message.success('已确认');
}
})
}).catch(() => {
this.visible = false;
this.$emit("refreshDataList");
this.$message.success('取消确认');
})
})
});
},
getConfirmed() {
return this.$confirm('是否直接确认保养记录', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
},
async handleConfirm() { async handleConfirm() {
this.btnLoading = true; this.btnLoading = true;
// this.$nextTick(async () => { this.$nextTick(async () => {
// const { code, data } = await this.$axios({ const { code, data } = await this.$axios({
// url: '/base/equipment-maintain-log/update',
// method: 'put',
// data: {
// ...this.form,
// maintainWorker: this.form.maintainWorker.join(',')
// },
// });
// if (code == 0) {
// this.$modal.msgSuccess('');
// }
// this.btnLoading = false;
// this.$emit('refreshDataList');
// this.handleCancel();
// });
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
this.$axios({
url: '/base/equipment-maintain-log/update', url: '/base/equipment-maintain-log/update',
method: 'put', method: 'put',
data: { data: {
...this.form, ...this.form,
maintainWorker: this.form.maintainWorker.join(','), maintainWorker: this.form.maintainWorker.join(',')
special: false, },
relatePlan: 2 });
if (code == 0) {
this.$modal.msgSuccess('更新成功');
} }
}).then((response) => {
this.$modal.msgSuccess('修改成功');
this.btnLoading = false; this.btnLoading = false;
this.$emit('refreshDataList'); this.$emit('refreshDataList');
this.handleCancel(); this.handleCancel();
}); });
return;
}
//
this.$axios({
url: '/base/equipment-maintain-log/create',
method: 'post',
data: {
...this.form,
maintainWorker: this.form.maintainWorker.join(','),
special: false,
relatePlan: 2,
confirmed: false,
}
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.btnLoading = false;
this.form.id = response.data
this.row.id = response.data
this.showTable = true
this.isAdd = true
this.$emit('refreshDataList');
// this.handleCancel();
});
});
}, },
handleEmitFun(val) { handleEmitFun(val) {
@ -553,22 +464,15 @@ export default {
init(row) { init(row) {
this.visible = true; this.visible = true;
if (row) {
this.row = row; this.row = row;
this.showTable = row ? true : false; this.getInfo(row);
this.$nextTick(() => { this.getAttrList(row);
if (row.id) {
this.getInfo(row.id);
this.getAttrList(row.id);
}
})
}
}, },
async getInfo(id) { async getInfo(row) {
this.formLoading = true; this.formLoading = true;
const res = await this.$axios( const res = await this.$axios(
'/base/equipment-maintain-log/get?id=' + id '/base/equipment-maintain-log/get?id=' + row.id
); );
if (res.code == 0) { if (res.code == 0) {
this.form = res.data; this.form = res.data;
@ -578,15 +482,15 @@ export default {
this.formLoading = false; this.formLoading = false;
}, },
async getAttrList(id, condition = {}) { async getAttrList(row, condition = {}) {
if (!id) id = this.row.id; if (!row) row = this.row;
this.attrListLoading = true; this.attrListLoading = true;
const res = await this.$axios({ const res = await this.$axios({
url: '/base/equipment-maintain-log-det/page', url: '/base/equipment-maintain-log-det/page',
method: 'get', method: 'get',
params: { params: {
...this.attrQuery.params, ...this.attrQuery.params,
logId: id, logId: row.id,
...condition, ...condition,
}, },
}); });

View File

@ -258,27 +258,17 @@ export default {
this.$message.warning('请选择待确认的设备保养记录'); this.$message.warning('请选择待确认的设备保养记录');
return; return;
} }
this.$modal const res = await this.$axios({
.confirm('是否确认所有选中保养单"?')
.then(() => {
return this.$axios({
url: '/base/equipment-maintain-log/confirm', url: '/base/equipment-maintain-log/confirm',
method: 'put', method: 'put',
data: this.$refs['waiting-list-table'].selectedPlan.map( data: this.$refs['waiting-list-table'].selectedPlan.map(
(item) => item.id (item) => item.id
), ),
}); });
// if (res.code == 0) { if (res.code == 0) {
// this.$message.success(''); this.$message.success('确认成功');
// this.getList();
// }
})
.then((res) => {
this.getList(); this.getList();
res.code == 0 && this.$modal.msgSuccess('确认成功'); }
res.code != 0 && this.$modal.msgError('确认失败');
})
.catch(() => {});
break; break;
} }
}, },
@ -422,13 +412,9 @@ export default {
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
// this.reset(); this.reset();
// this.open = true; this.open = true;
// this.title = ''; this.title = '添加待确认保养记录';
this.openUnplannedDrawer = true;
this.$nextTick(() => {
this.$refs.unplanned.init();
});
}, },
getConfirmed() { getConfirmed() {
@ -492,25 +478,15 @@ export default {
}, },
/** 确认 */ /** 确认 */
async handleConfirm(row) { async handleConfirm(row) {
this.$modal const res = await this.$axios({
.confirm('是否确认保养单"' + row.maintainOrderNumber + '"?')
.then(() => {
return this.$axios({
url: '/base/equipment-maintain-log/confirm', url: '/base/equipment-maintain-log/confirm',
method: 'put', method: 'put',
data: [row.id], data: [row.id],
}); });
// if (res.code == 0) { if (res.code == 0) {
// this.$message.success(''); this.$message.success('确认成功');
// this.getList();
// }
})
.then((res) => {
this.getList(); this.getList();
res.code == 0 && this.$modal.msgSuccess('确认成功'); }
res.code != 0 && this.$modal.msgError('确认失败');
})
.catch(() => {});
}, },
/** 编辑 */ /** 编辑 */
async handleEdit(row) { async handleEdit(row) {