待确认

This commit is contained in:
helloDy
2024-02-28 15:03:21 +08:00
parent c71d99a21e
commit 1a622dc4d3
4 changed files with 252 additions and 99 deletions

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-02-28 09:15:02
* @LastEditTime: 2024-02-28 14:45:58
* @Description:
-->
<template>
@@ -143,7 +143,8 @@
<div v-if="!isdetail" class="drawer-body__footer">
<el-button @click="goback()">取消</el-button>
<!-- <el-button :disabled="isdetail" @click="init(dataForm.id)">重置</el-button> -->
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
<el-button v-if="isshowConfirm" type="primary" @click="confirmIns()">保存</el-button>
<el-button v-else type="primary" @click="dataFormSubmit()">保存</el-button>
</div>
<attr-add
@@ -206,6 +207,7 @@ export default {
tableProps,
topBtnConfig,
addOrUpdateVisible: false,
isshowConfirm: false,
urlOptions: {
isGetCode: false,
createURL: createCheckOrder,
@@ -399,6 +401,34 @@ export default {
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() {
this.$refs["dataForm"].validate((valid) => {
@@ -430,6 +460,7 @@ export default {
}).then(response => {
this.$modal.msgSuccess("新增成功");
this.idAttrShow = true
this.isshowConfirm = true
this.dataForm.id = response.data
// this.visible = false;
this.$emit("refreshDataList");

View File

@@ -172,24 +172,27 @@ export default {
async searchBarClicked(btn) {
switch (btn.btnName) {
case 'batchConfirm':
const ids = this.$refs['waiting-list-table'].selectedPlan.map(
(item) => item.id
)
if (this.$refs['waiting-list-table'].selectedPlan.length == 0) {
this.$message.warning('请选择待确认的设备巡检单');
return;
}
const res = await this.$axios({
url: '/base/equipment-check-order/confirm?confirmPerson=' + this.$store.getters.userId + '&ids=' + ids,
method: 'put',
// data: this.$refs['waiting-list-table'].selectedPlan.map(
// (item) => item.id
// ),
});
if (res.code == 0) {
this.$message.success('确认成功');
this.getList();
}
this.$modal
.confirm('是否确认所有选中保养单"?')
.then(() => {
return this.$axios({
url: '/base/equipment-check-order/confirm?confirmPerson=' + this.$store.getters.userId,
method: 'put',
data: this.$refs['waiting-list-table'].selectedPlan.map(
(item) => item.id
),
});
})
.then((res) => {
this.getList();
res.code == 0 && this.$modal.msgSuccess('确认成功');
res.code != 0 && this.$modal.msgError('确认失败');
})
.catch(() => {});
break;
}
},
@@ -388,17 +391,16 @@ export default {
},
/** 确认 */
async handleConfirm(row) {
console.log('111', this.$store.getters.userId)
this.$modal
.confirm('是否确认巡检单"' + row.name + '"?')
.then(() => {
return this.$axios({
url:
'/base/equipment-check-order/confirm?confirmPerson=' +
this.$store.getters.userId + '&ids=' + [row.id],
this.$store.getters.userId,
// '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''),
method: 'put',
// data: [row.id],
data: [row.id],
});
})
.then((res) => {