feat: 优化routepack 添加wf组件

This commit is contained in:
caoqianming 2025-09-23 13:24:15 +08:00
parent a293bfe1ae
commit 83edbad12d
3 changed files with 96 additions and 131 deletions

View File

@ -1,59 +1,36 @@
<template>
<el-drawer
title="查看"
v-model="visible"
:size="'90%'"
destroy-on-close
@closed="$emit('closed')"
:close-on-click-modal="false"
>
<el-container v-loading="loading">
<el-header style="height: 80px;display: block;padding:0">
<el-card shadow="hover">
<el-descriptions :column="3" title="基本信息">
<el-descriptions-item label="工艺名称:">{{
form.name
}}</el-descriptions-item>
<el-descriptions-item label="物料名称:">{{
form.material_name
}}</el-descriptions-item>
</el-descriptions>
</el-card>
</el-header>
<el-main id="degInnerMain">
<el-container>
<el-side style="width: 50%;overflow: scroll;">
<div style="font-weight: 600;color: #303133;font-size: 16px;padding: 10px 0;position: fixed;">工艺路线流程图</div>
<el-tabs
v-if="tabsTitle.length>1"
v-model="activeName"
:tab-position="'left'"
style="flex-direction: row;"
@tab-click="tabshandleClick"
>
<el-tab-pane :label="item" v-for="item in tabsTitle" :key="item"></el-tab-pane>
</el-tabs>
<scDegra
style="margin-top: 50px;"
v-if="limitedWatch"
ref="degraDialogs"
:nodes="nodes"
:edges="edges"
:rankdir="'DL'"
@closeDialog="limitedWatch = false"
>
</scDegra>
</el-side>
<el-main>
<scTable
ref="tables"
:data="tableData"
row-key="id"
hidePagination
hideDo
stripe
border
>
<el-container v-loading="loading">
<el-main class="nopadding" style="padding-right: 1px;">
<el-container>
<el-header style="height: 80px;display: block;padding:0">
<el-card shadow="hover">
<el-descriptions :column="3" title="基本信息">
<el-descriptions-item label="工艺名称:">{{
form.name
}}</el-descriptions-item>
<el-descriptions-item label="物料名称:">{{
form.material_name
}}</el-descriptions-item>
</el-descriptions>
</el-card>
</el-header>
<el-main>
<el-container>
<el-aside style="width: 50%;overflow: scroll;">
<div
style="font-weight: 600;color: #303133;font-size: 16px;padding: 10px 0;position: fixed;">
工艺路线流程图</div>
<el-tabs v-if="tabsTitle.length > 1" v-model="activeName" :tab-position="'left'"
style="flex-direction: row;" @tab-click="tabshandleClick">
<el-tab-pane :label="item" v-for="item in tabsTitle" :key="item"></el-tab-pane>
</el-tabs>
<scDegra style="margin-top: 50px;" v-if="limitedWatch" ref="degraDialogs" :nodes="nodes"
:edges="edges" :rankdir="'DL'" @closeDialog="limitedWatch = false">
</scDegra>
</el-aside>
<el-main class="padding: 1px">
<scTable ref="tables" :data="tableData" row-key="id" hidePagination hideDo stripe border>
<el-table-column label="排序" prop="sort" width="50">
</el-table-column>
<el-table-column label="工序" prop="process_name">
@ -73,25 +50,36 @@
</el-table-column>
<el-table-column label="工时" prop="hour_work">
</el-table-column>
<el-table-column label="批次校验" v-if="project_code!=='bxerp'">
<el-table-column label="批次校验" v-if="project_code !== 'bxerp'">
<template #default="scope">
<el-tag v-if="scope.row.batch_bind" type="success"></el-tag>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
</el-main>
</el-container>
</el-drawer>
</el-main>
</el-container>
</el-main>
</el-container>
</el-main>
<el-aside width="20%" v-if="form.ticket">
<ticketd :ticketId="form.ticket"></ticketd>
</el-aside>
</el-container>
</template>
<script>
import ticketd from '@/views/wf/ticketd.vue'
export default {
emits: ["success", "closed"],
components: { ticketd },
props: {
modelId: { type: String, default: null },
},
data() {
return {
loading: false,
visible: false,
isSaveing: false,
state_: {
10: "创建中",
@ -99,24 +87,29 @@ export default {
40: "进行中",
50: "已完成",
},
tracking_:{
10:"批次",
20:"单个",
tracking_: {
10: "批次",
20: "单个",
},
form: {},
nodes:[],
edges:[],
tabsTitle:['总图'],
tabsData:{},
form: {
ticket: null
},
nodes: [],
edges: [],
tabsTitle: ['总图'],
tabsData: {},
tableData: [],
project_code: "",
activeName:"总图",
limitedWatch:false,
activeName: "总图",
limitedWatch: false,
};
},
mounted() {
this.project_code = this.$TOOL.data.get("BASE_INFO").base.base_code;
this.tableData = [];
if (this.modelId) {
this.getRoutePackDetail(this.modelId);
}
},
methods: {
//
@ -132,13 +125,17 @@ export default {
that.getDEGdatas(data.id);
this.getTabsList(data.id);
},
getDEGdatas(id){
async getRoutePackDetail(id) {
let res = await this.$API.mtm.routepack.item.req(id);
this.setData(res);
},
getDEGdatas(id) {
let that = this;
that.$API.mtm.routepack.dag.req(id).then((res) => {
that.nodes = res.nodes;
that.nodes = res.nodes;
that.edges = res.edges;
that.tabsData['总图'] = res;
if(!that.limitedWatch){
if (!that.limitedWatch) {
that.limitedWatch = true;
that.$nextTick(() => {
that.$refs.degraDialogs.open();
@ -146,17 +143,17 @@ export default {
}
})
},
getTabsList(id){
getTabsList(id) {
let that = this;
that.$API.mtm.routepack.dags.req(id).then((res) => {
let arr = [];
for(let key in res){
for (let key in res) {
arr.push(key);
}
if(arr.length>1){
for(let key in res){
if (arr.length > 1) {
for (let key in res) {
that.tabsTitle.push(res[key].name);
that.tabsData[res[key].name]=res[key];
that.tabsData[res[key].name] = res[key];
}
}
console.log(that.tabsData);
@ -170,11 +167,11 @@ export default {
this.tableData = res;
});
},
tabshandleClick(val){
tabshandleClick(val) {
let that = this;
let label = val.props.label;
that.$nextTick(() => {
that.nodes = that.tabsData[label].nodes;
that.nodes = that.tabsData[label].nodes;
that.edges = that.tabsData[label].edges;
})
},

View File

@ -185,11 +185,17 @@
@closed="saveClose"
>
</save-dialog>
<show-dialog
v-if="dialog.show"
ref="showDialog"
<el-drawer
v-model="dialog.show"
title="查看"
:size="'90%'"
destroy-on-close
@closed="dialog.show = false"
></show-dialog>
:close-on-click-modal="false"
>
<show-dialog ref="showDialog"></show-dialog>
</el-drawer>
</template>
<script>
import saveDialog from "./routepack_form.vue";

View File

@ -93,7 +93,7 @@
<!--工序!-->
<el-main class="nopadding" v-if="active === 1">
<el-container>
<el-side style="width: 50%;overflow: scroll;">
<el-aside style="width: 50%;overflow: scroll;">
<div style="font-weight: 600;color: #303133;font-size: 16px;padding: 10px 0;position: fixed;width: 30px;">工艺路线流程图</div>
<scDegra
style="margin-top: 50px;"
@ -104,7 +104,7 @@
:rankdir="'DL'"
>
</scDegra>
</el-side>
</el-aside>
<el-main style="width: 50%;overflow: scroll;">
<el-container>
<el-header>
@ -177,15 +177,8 @@
</el-main>
<el-footer v-if="active === 1" style="text-align: center">
<el-button @click="handleLastStep" style="margin-right: 4px">上一步</el-button>
<el-button
v-for="item in initForm.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="'routepack'" :title="form.name" :t_id="form.id"
@success="$emit('closed')"></ticketd_b_start>
<el-button @click="$emit('closed')" type="warning">退出</el-button>
</el-footer>
</el-container>
@ -200,9 +193,10 @@
</template>
<script>
import saveDialog from "./route_form.vue";
import ticketd_b_start from "@/views/wf/ticketd_b_start.vue";
export default {
name: "routepack_form",
components: { saveDialog },
components: { saveDialog, ticketd_b_start },
data() {
return {
active: 0,
@ -250,7 +244,7 @@ export default {
mounted() {
this.isSaveing = false;
this.project_code = this.$TOOL.data.get("BASE_INFO").base.base_code;
this.getInit();
// this.getInit();
// this.getMaterials();
},
methods: {
@ -379,38 +373,6 @@ export default {
return err;
});
},
//
getInit() {
let that = this;
that.$API.wf.workflow.initkey.req("routepack").then((res) => {
that.initForm = res;
});
},
//,
submitTicketCreate(id) {
let that = this;
let ticket = {};
that.isSaveing = true;
ticket.title = that.form.name;
ticket.workflow = that.initForm.workflow;
ticket.ticket_data = {
t_id: that.routepack,
};
ticket.transition = id;
that.$API.wf.ticket.create
.req(ticket)
.then((res) => {
that.tLoading = false;
that.$message.success("提交成功");
that.$emit("close");
that.visible = false;
})
.catch((e) => {
that.tLoading = false;
});
},
//
handleSaveSuccess() {
console.log("handleSaveSuccess");