feat: 优化handover_form

This commit is contained in:
caoqianming 2025-09-24 14:14:48 +08:00
parent d445981929
commit 53ce3694be
3 changed files with 254 additions and 294 deletions

View File

@ -75,7 +75,7 @@ export default {
emits: ["success", "closed"],
components: { ticketd },
props: {
modelId: { type: String, default: null },
t_id: { type: String, default: null },
},
data() {
return {
@ -107,8 +107,8 @@ export default {
mounted() {
this.project_code = this.$TOOL.data.get("BASE_INFO").base.base_code;
this.tableData = [];
if (this.modelId) {
this.getRoutePackDetail(this.modelId);
if (this.t_id) {
this.getRoutePackDetail(this.t_id);
}
},
methods: {

View File

@ -251,8 +251,14 @@
</scTable>
</el-main>
</el-container>
<el-drawer
v-model="dialog.save"
:title="titleMap[mode]"
:size="'90%'"
destroy-on-close
:close-on-click-modal="false"
>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
:type="type"
:process = "processId"
@ -261,8 +267,8 @@
:mgroupId="mgroupId"
@success="handleSaveSuccess"
@closed="dialog.save = false"
>
</save-dialog>
></save-dialog>
</el-drawer>
<el-dialog title="退料操作" v-model="backDialogVisible" style="width: 70%;">
<el-row v-for="item in handoverbList" :key="item.id" style="padding: 10px 10px 0 20px;">
<el-col style="display: flex;border-bottom: 1px dashed #eee;">
@ -379,6 +385,12 @@ export default {
},
route_code: "",
// setNameVisible: false,
titleMap: {
add: "新增交接记录",
edit: "编辑交接记录",
show: "查看交接记录",
},
mode: "add"
};
},
mounted() {
@ -410,6 +422,7 @@ export default {
//
table_add(type) {
this.dialog.save = true;
this.mode = "add";
this.type = type;
this.$nextTick(() => {
this.$refs.saveDialog.open("add",'',10);
@ -419,6 +432,7 @@ export default {
let that = this;
that.type = 10;
that.codeText = codeText;
that.mode = "add";
that.dialog.save = true;
that.$nextTick(() => {
that.$refs.saveDialog.open("add",codeText,10);
@ -429,6 +443,7 @@ export default {
this.type = 20;
that.codeText2 = codeText2;
this.dialog.save = true;
that.mode = "add";
this.$nextTick(() => {
this.$refs.saveDialog.open("add",codeText2,10);
});
@ -437,6 +452,7 @@ export default {
table_edit(row) {
this.type=row.type;
this.dialog.save = true;
this.mode = "edit";
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
@ -444,6 +460,7 @@ export default {
table_show(row){
this.type=row.type;
this.dialog.save = true;
this.mode = "show";
this.$nextTick(() => {
this.$refs.saveDialog.open("show").setData(row);
});
@ -561,7 +578,7 @@ export default {
//
//
handleSaveSuccess(data, mode) {
this.dialog.save = true;
this.dialog.save = false;
this.$refs.table.refresh();
},
},

View File

@ -1,12 +1,6 @@
<template>
<el-dialog
:title="titleMap[mode]"
v-model="visible"
width="1000px"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-container>
<el-main class="nopadding">
<el-form
ref="dialogForm"
:model="form"
@ -193,25 +187,32 @@
</el-form>
<el-footer v-show="mode!=='show'">
<template v-if="(route_code=='tuihuo'&&type==10&&mtype==10)||form.ticket!=null">
<el-button
v-for="item in transitions"
:key="item.id"
type="primary"
:loading="isSaveing"
:disabled="isSaveing"
@click="submitTicketCreate(item.id)"
style="margin-right: 4px"
>{{ item.name }}</el-button>
<ticketd_b_start :workflow_key="'backfire'" :title="'退火交接审批单'" :t_id="form.id" :ticketId="form.ticket"
@success="()=>{$emit('success')} " :submit_b_func="submit_b_func" ref="ticketd_b_start"></ticketd_b_start>
</template>
<el-button v-else type="primary" v-loading="isSaveing" @click="submit">确定</el-button>
<el-button @click="visible = false">取消</el-button>
<el-button @click="$emit('closed')">取消</el-button>
</el-footer>
</el-dialog>
</el-main>
<el-aside width="20%" v-if="form.ticket">
<ticketd :ticketId="form.ticket" @success="$emit('success')"></ticketd>
</el-aside>
</el-container>
</template>
<script>
import ticketd_b_start from "@/views/wf/ticketd_b_start.vue";
import ticketd from '@/views/wf/ticketd.vue'
export default {
emits: ["success", "closed"],
components: {
ticketd_b_start, ticketd
},
props: {
t_id: {
type: String,
default: null
},
type: {
type: Number,
default: 10,
@ -245,12 +246,7 @@ export default {
selectItems:[],
yseorno: ["是", "否"],
loading: false,
mode: "add",
titleMap: {
add: "新增交接记录",
edit: "编辑交接记录",
show: "查看交接记录",
},
mode: "show",
lists:[],//
handle_user: [],
form: {
@ -331,7 +327,6 @@ export default {
mgroupOptions: [],
materialOptions: [],
addShow: false,
visible: false,
scanVisible:false,
isSaveing: false,
setFiltersVisible: false,
@ -380,25 +375,25 @@ export default {
}else{
that.getMgroupOptions();
}
if(that.route_code=='tuihuo'){
that.getInit();
}
that.getTid();
},
methods: {
//
getInit() {
let that = this;
if(this.form.ticket!==null){
this.$API.wf.ticket.ticketTransitions.req(this.form.ticket).then((res) => {
that.transitions = res;
})
getTid (){
var that = this;
if (that.t_id) {
that.$API.wpm.handover.item.req(that.t_id).then(res=>{
that.setData(res);
if(res.ticket_.state_.type == 1 && res.create_by == that.$TOOL.data.get("USER_INFO").id ) {
that.mode = "edit";
}else{
that.$API.wf.workflow.initkey.req(" backfire").then((res) => {
that.initForm = res;
that.transitions = res.transitions;
});
that.mode = "show";
}
that.$nextTick(()=>{
that.$refs.ticketd_b_start.init();
})
})
}
},
//
getMgroupOptions() {
@ -517,7 +512,6 @@ export default {
if(mtype==30){//
this.change_batch = true;
}
this.visible = true;
return this;
},
//handoverb
@ -560,61 +554,13 @@ export default {
fileUPSuccess(res) {
this.test_file = res.path;
},
//退,
submitTicketCreate(id) {
async submit_b_func() {
let that = this;
that.isSaveing = true;
that.form.oinfo_json = {};
that.form.oinfo_json.test_file = that.test_file;
if(that.mode == "add") {
that.$API.wpm.handover.create.req(that.form).then((res) => {
let ticket = {};
ticket.title = '退火交接审批单';
ticket.workflow = that.initForm.workflow;
ticket.ticket_data = {t_id: res.id};
ticket.transition = id;
that.$API.wf.ticket.create.req(ticket).then((res) => {
that.isSaveing = false;
that.visible = false;
that.$emit("success");
that.$message.success("提交成功");
}).catch((e) => {
that.isSaveing = false;
});
}).catch((e) => {
that.isSaveing = false;
});
let res = await that.$API.wpm.handover.create.req(that.form);
that.form.id = res.id;
} else if (that.mode == "edit") {
that.$API.wpm.handover.update.req(that.form.id, that.form).then((res) => {
if (that.form.ticket == null) {
let ticket = {};
ticket.title = '退火交接审批单';
ticket.workflow = that.initForm.workflow;
ticket.ticket_data = {t_id: res.id};
ticket.transition = id;
that.$API.wf.ticket.create.req(ticket).then((res) => {
that.isSaveing = false;
that.visible = false;
that.$emit("success");
that.$message.success("提交成功");
}).catch((e) => {
that.isSaveing = false;
});
} else {
let data = {transition: id, ticket_data: {}}
that.$API.wf.ticket.ticketHandle.req(that.form.ticket, data).then(res=>{
that.isSaveing = false;
that.visible = false;
that.$emit("success");
that.$message.success("提交成功");
}).catch((e) => {
that.isSaveing = false;
})
}
}).catch((err) => {
that.isSaveing = false;
return err;
});
await that.$API.wpm.handover.update.req(that.form.id, that.form);
}
},
//
@ -634,7 +580,6 @@ export default {
that.$API.wpm.handover.createsubmit.req(that.form).then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
}).catch((err) => {
that.isSaveing = false;
@ -645,7 +590,6 @@ export default {
that.$API.wpm.handover.create.req(that.form).then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
}).catch((err) => {
that.isSaveing = false;
@ -655,7 +599,6 @@ export default {
that.$API.wpm.handover.update.req(that.form.id, that.form).then((res) => {
that.isSaveing = false;
that.$emit("success", that.form, that.mode);
that.visible = false;
that.$message.success("操作成功");
}).catch((err) => {
that.isSaveing = false;