fix:成品、车间物料和工艺路线添加deg图
This commit is contained in:
parent
2dd09fcfa5
commit
eed8a1eb05
|
|
@ -73,6 +73,9 @@
|
|||
<el-table-column width="90">
|
||||
<template #default="scope">
|
||||
<el-button @click="printMaterial(scope.row)" type="text">物料标签</el-button>
|
||||
<el-link :underline="false" type="primary"
|
||||
@click="handleWatch(scope.row)"
|
||||
>流程图</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</scTable>
|
||||
|
|
@ -139,14 +142,23 @@
|
|||
:mtype="wmtype"
|
||||
:apiObj="apiObjPrint"
|
||||
></print-dialog>
|
||||
<degraDialog
|
||||
v-if="limitedWatch"
|
||||
ref="degraDialogs"
|
||||
:code="showBatch"
|
||||
@closeDialog="limitedWatch = false"
|
||||
>
|
||||
</degraDialog>
|
||||
</el-container>
|
||||
</template>
|
||||
<script>
|
||||
import degraDialog from "./../template/degraD3.vue";
|
||||
import printDialog from "./../template/printmaterial.vue";
|
||||
export default {
|
||||
name: "halfgood",
|
||||
components: {
|
||||
printDialog
|
||||
printDialog,
|
||||
degraDialog
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -161,9 +173,11 @@ export default {
|
|||
queryWm: {},
|
||||
wmtype:0,
|
||||
print_m:false,
|
||||
limitedWatch:false,
|
||||
materialsVisible:false,
|
||||
apiObjPrint:this.$API.cm.labelmat.fromMb,
|
||||
wmId:'',
|
||||
showBatch: "",
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
|
@ -190,6 +204,14 @@ export default {
|
|||
resetQuery() {
|
||||
this.query = {};
|
||||
},
|
||||
handleWatch(row) {
|
||||
let that = this;
|
||||
that.showBatch = row.batch;
|
||||
that.limitedWatch = true;
|
||||
that.$nextTick(() => {
|
||||
that.$refs.degraDialogs.open('batch');
|
||||
});
|
||||
},
|
||||
//打印物料标签
|
||||
printMaterial(row){
|
||||
let that = this;
|
||||
|
|
|
|||
|
|
@ -118,6 +118,9 @@
|
|||
>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
<el-link :underline="false" type="primary"
|
||||
@click="handleWatch(scope.row)"
|
||||
>流程图</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</scTable>
|
||||
|
|
@ -163,16 +166,24 @@
|
|||
ref="showDialog"
|
||||
@closed="dialog.show = false"
|
||||
></show-dialog>
|
||||
<degraDialog
|
||||
v-if="limitedWatch"
|
||||
ref="degraDialogs"
|
||||
:code="showrotepack"
|
||||
@closeDialog="limitedWatch = false"
|
||||
>
|
||||
</degraDialog>
|
||||
</template>
|
||||
<script>
|
||||
import saveDialog from "./routepack_form.vue";
|
||||
import showDialog from "./route_show.vue";
|
||||
|
||||
import degraDialog from "./../template/degraD3.vue";
|
||||
export default {
|
||||
name: "route",
|
||||
components: {
|
||||
saveDialog,
|
||||
showDialog,
|
||||
degraDialog
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -217,10 +228,12 @@ export default {
|
|||
20: "审批中",
|
||||
30: "已确认",
|
||||
},
|
||||
showrotepack: "",
|
||||
filterType: "all",
|
||||
toggleState:10,
|
||||
visible:false,
|
||||
isSaveing:false,
|
||||
limitedWatch:false,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
|
@ -272,6 +285,14 @@ export default {
|
|||
return err;
|
||||
});
|
||||
},
|
||||
handleWatch(row) {
|
||||
let that = this;
|
||||
that.showrotepack = row.id;
|
||||
that.limitedWatch = true;
|
||||
that.$nextTick(() => {
|
||||
that.$refs.degraDialogs.open('routepack');
|
||||
});
|
||||
},
|
||||
table_state(row){
|
||||
this.toggleState = row.state;
|
||||
this.toggleId = row.id;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,237 @@
|
|||
<template>
|
||||
<el-drawer
|
||||
v-model="visible"
|
||||
:title="workflowName"
|
||||
:size="'90%'"
|
||||
>
|
||||
<svg id="mySvg" v-if="visible"></svg>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import dagreD3 from "dagre-d3";
|
||||
import * as d3 from "d3";
|
||||
|
||||
export default {
|
||||
name: "degraD3",
|
||||
props: {
|
||||
code: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
mySvgHeight: null,
|
||||
visible:false,
|
||||
isSaving: false,
|
||||
params:{}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
open(type=""){
|
||||
this.visible = true;
|
||||
if(type=='batch'){
|
||||
this.params.batch = this.code;
|
||||
}else if(type=='routepack'){
|
||||
this.params.routepack = this.code;
|
||||
}
|
||||
this.handleWatch();
|
||||
},
|
||||
handleWatch() {
|
||||
let that = this;
|
||||
that.limitedWatch = true;
|
||||
that.$nextTick(() => {
|
||||
var g = new dagreD3.graphlib.Graph().setGraph({
|
||||
rankdir: "LR",
|
||||
nodesep: 40,
|
||||
edgesep: 25, //两条线之间的距离
|
||||
ranksep: 20, //节点之间的距离
|
||||
marginx: 80,
|
||||
marginy: 10,
|
||||
});
|
||||
//获取state得到节点
|
||||
that.$API.wpm.batchlog.dag.req(that.params).then((res) => {
|
||||
let nodes = res.nodes;
|
||||
// 添加节点
|
||||
nodes.forEach((item) => {
|
||||
if(item.id&& item.label){
|
||||
g.setNode(item.id, {
|
||||
// 节点标签
|
||||
label: item.label,
|
||||
// 节点形状
|
||||
shape: item.shape,
|
||||
toolText: item.label,
|
||||
//节点样式
|
||||
style: "fill:#fff;stroke:#000",
|
||||
labelStyle: "fill:#000;",
|
||||
rx: 5, //矩形节点圆角度
|
||||
ry: 5,
|
||||
});
|
||||
}
|
||||
});
|
||||
//流转得到线 链接关系
|
||||
let transitionList = res.edges;
|
||||
transitionList.forEach((transition0) => {
|
||||
g.setEdge(
|
||||
transition0.source,
|
||||
transition0.target,
|
||||
{
|
||||
// 边标签
|
||||
label: transition0.label,
|
||||
// 边样式
|
||||
style: "fill:#ffffff;stroke:#c0c1c3;stroke-width:1.5px", // 根据后台数据来改变连线的颜色
|
||||
}
|
||||
);
|
||||
// let condition_expression = transition0.condition_expression;
|
||||
// if (condition_expression.length > 0) {
|
||||
// let newNodeId = transition0.id
|
||||
// g.setNode(newNodeId, {
|
||||
// label: "条件流转",
|
||||
// style: "stroke: #000;fill: #afa",
|
||||
// shape: "diamond",
|
||||
// });
|
||||
// g.setEdge(
|
||||
// transition0.source_state,
|
||||
// newNodeId,
|
||||
// {
|
||||
// // 边标签
|
||||
// label: transition0.name,
|
||||
// style: "fill:#ffffff;stroke:#c0c1c3;stroke-width:1.5px",
|
||||
// }
|
||||
// );
|
||||
// condition_expression.forEach((condition_expression0) => {
|
||||
// g.setEdge(
|
||||
// newNodeId,
|
||||
// condition_expression0.target_state,
|
||||
// {
|
||||
// label: condition_expression0.label,
|
||||
// style:
|
||||
// "fill:#ffffff;stroke:#c0c1c3;stroke-width:1.5px",
|
||||
// }
|
||||
// );
|
||||
// });
|
||||
// }else {
|
||||
// g.setEdge(
|
||||
// transition0.source,
|
||||
// transition0.target,
|
||||
// {
|
||||
// // 边标签
|
||||
// label: transition0.label,
|
||||
// // 边样式
|
||||
// style: "fill:#ffffff;stroke:#c0c1c3;stroke-width:1.5px", // 根据后台数据来改变连线的颜色
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
});
|
||||
// g.nodes().length - 1;
|
||||
// 创建渲染器
|
||||
let render = new dagreD3.render();
|
||||
// 选择 svg 并添加一个g元素作为绘图容器.
|
||||
let svg = d3.select("#mySvg");
|
||||
let inner = svg.append("g");
|
||||
// 在绘图容器上运行渲染器生成流程图.
|
||||
render(inner, g);
|
||||
let mySvgHeight =document.getElementsByClassName("nodes")[0].getBoundingClientRect().height + 50;
|
||||
let mySvgWdith =document.getElementsByClassName("output")[0].getBoundingClientRect().innerwidth ;
|
||||
console.log('mySvgWdith',mySvgWdith);
|
||||
document.getElementById('mySvg').setAttribute("height", mySvgHeight);
|
||||
document.getElementById('mySvg').setAttribute("width", mySvgWdith);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
closeMark() {
|
||||
this.limitedWatch = false;
|
||||
},
|
||||
scaleUp() {
|
||||
var svg = document.getElementById("mySvg");
|
||||
svg.style.transform = "scale(0.5)";
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.treeMain {
|
||||
height: 280px;
|
||||
overflow: auto;
|
||||
border: 1px solid #dcdfe6;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 10px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.2);
|
||||
background-color: #fefefe;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
border-radius: 5px;
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.svgMark {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
overflow: auto;
|
||||
margin: 0;
|
||||
z-index: 2000;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.svgWrapper {
|
||||
background: #fff;
|
||||
width: 800px;
|
||||
margin: 5vh auto;
|
||||
height: 90vh;
|
||||
text-align: center;
|
||||
border-radius: 2px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.svgItem {
|
||||
padding: 20px 40px 0;
|
||||
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB,
|
||||
Microsoft YaHei, Arial, sans-serif;
|
||||
font-size: 18px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
svg {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.node rect {
|
||||
stroke: #606266;
|
||||
fill: #fff;
|
||||
}
|
||||
|
||||
.edgePath path {
|
||||
stroke: #606266;
|
||||
fill: #333;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
g.conditions > rect {
|
||||
fill: #00ffd0;
|
||||
stroke: #000;
|
||||
}
|
||||
|
||||
.el-icon-close {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
@ -131,6 +131,9 @@
|
|||
type="primary"
|
||||
style="margin-left: 10px;"
|
||||
>检验</el-link>
|
||||
<el-link :underline="false" type="primary"
|
||||
@click="handleWatch(scope.row)"
|
||||
>流程图</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</scTable>
|
||||
|
|
@ -231,9 +234,17 @@
|
|||
<el-button type="primary" @click="savePrinter">保存</el-button>
|
||||
</el-footer>
|
||||
</el-dialog>
|
||||
<degraDialog
|
||||
v-if="limitedWatch"
|
||||
ref="degraDialogs"
|
||||
:code="showBatch"
|
||||
@closeDialog="limitedWatch = false"
|
||||
>
|
||||
</degraDialog>
|
||||
</el-container>
|
||||
</template>
|
||||
<script>
|
||||
import degraDialog from "./../template/degraD3.vue";
|
||||
import { wmState } from "@/utils/enum.js";
|
||||
import materials from "./../mtm/materials.vue";
|
||||
import checkDialog from "./check_form.vue";
|
||||
|
|
@ -253,6 +264,7 @@ export default {
|
|||
checkDialog,
|
||||
showDrawer,
|
||||
scrapDialog,
|
||||
degraDialog
|
||||
},
|
||||
name: "wmaterial",
|
||||
data() {
|
||||
|
|
@ -293,10 +305,12 @@ export default {
|
|||
page:0,
|
||||
wm: ""
|
||||
},
|
||||
showBatch: "",
|
||||
wmMaterial:'',
|
||||
cate_type:'',
|
||||
process:'',
|
||||
materialType: "wm",
|
||||
limitedWatch:false,
|
||||
materialsVisible:false,
|
||||
visibleDrawer: false,
|
||||
wprVisibleDrawer:false,
|
||||
|
|
@ -340,6 +354,14 @@ export default {
|
|||
that.$refs.table.refresh();
|
||||
});
|
||||
},
|
||||
handleWatch(row) {
|
||||
let that = this;
|
||||
that.showBatch = row.batch;
|
||||
that.limitedWatch = true;
|
||||
that.$nextTick(() => {
|
||||
that.$refs.degraDialogs.open('batch');
|
||||
});
|
||||
},
|
||||
add() {
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue