Commit 77b1cf7c authored by 仇晓婷's avatar 仇晓婷

Merge branch 'product' of http://git.mes123.com/zhouyx/mes-ui into product

parents 440e1f1f 1b066382
......@@ -85,9 +85,7 @@ export default {
// const openNames = getSiderSubmenu(path, menuSider);
// this.$store.commit("admin/menu/setOpenNames", openNames);
} else {
this.$Message.error("加载产品树失败!");
}
}
});
},
toMenu(list) {
......
<template>
<div style="padding: 0;" class="excute">
<DataGrid
style="margin-top:2px; margin-bottom: -5px;"
:columns="columns"
ref="grid"
:easy="false"
:high="false"
:set="false"
:border="false"
:data="data1"
:height="gridHeight"
:page="false"
:size="size"
></DataGrid>
<Modal v-model="editModal" title="编辑" footer-hide width="800">
<Edit :row="rowData" @on-close="cancel" @on-option-ok="addOk" />
<div style="padding: 0;" class="excute">
<DataGrid style="margin-top:2px; margin-bottom: -5px;" :columns="columns" ref="grid" :easy="false" :high="false" :set="false" :border="false" :data="data1" :height="gridHeight" :page="false" :size="size"></DataGrid>
<Modal v-model="editModal" title="编辑" footer-hide width="1000">
<Edit :row="rowData" @on-close="cancel" @on-option-ok="addOk" />
</Modal>
<Modal v-model="insertlModal" :title="insertTItle" @on-ok="insertOk" @on-cancel="cancel">
<p>确定进行 {{ insertTItle }} 操作?</p>
<p>确定进行 {{ insertTItle }} 操作?</p>
</Modal>
<Modal v-model="setParsModal" title="工序参数设置" footer-hide width="1000">
<Add
@on-parameter-ok="addOk"
@on-close="cancel"
:opTaskPk="setParams.opTaskPk"
:partTaskPk="setParams.partTaskPk"
:taskSeq="setParams.taskSeq"
:count="setParams.count"
:row="rowData"
/>
<Add @on-parameter-ok="addOk" @on-close="cancel" :opTaskPk="setParams.opTaskPk" :partTaskPk="setParams.partTaskPk" :taskSeq="setParams.taskSeq" :count="setParams.count" :row="rowData" />
</Modal>
</div>
</div>
</template>
<script>
import Api from "../api";
import Edit from "./edit";
import Add from "../options";
export default {
name: "list",
components: {
Edit,
Add
},
props: {
rowId: { type: Number }
},
data() {
return {
action: Api.index,
easySearch: {
keys: {
op: "task_seq",
value: null
}
},
setParsModal: false,
editModal: false,
detailModal: false,
insertlModal: false,
rowIndex: null,
curId: 0,
gridHeight: 150,
size: "small",
columns: [
{ title: " ", width: 130 },
{
key: "insert_flag",
title: this.l("insert_flag"),
align: "center",
high: true,
width: 60,
render: (h, params) => {
return h(
"Tooltip",
{
props: {
content:
params.row.insert_flag == 1 ? "取消插单" : "进行插单",
placement: "top"
},
class: "ico"
},
[
h("Icon", {
attrs: {
type:
params.row.insert_flag == 1
? "ios-flag"
: "ios-flag-outline",
size: 20,
color: params.row.insert_flag == 1 ? "#2680EB" : "#aaa"
},
on: {
click: () =>
this.changeFlag(params.row.op_task_pk, params.index)
}
})
]
);
}
},
{
key: "task_seq",
title: this.l("task_seq"),
align: "left",
easy: true,
high: true
},
{
key: "op_task_pk",
title: this.l("op_task_pk"),
align: "left",
high: true,
hide: true
},
{
key: "task_name",
title: this.l("task_name"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "taskseq_des",
title: this.l("task_name"),
align: "left",
easy: true,
high: true
},
{
key: "part_task_pk",
title: this.l("part_task_pk"),
align: "left",
high: true,
hide: true
},
{
key: "put_into_qty",
title: this.l("put_into_qty"),
align: "left",
high: true,
hide: true
},
{
key: "plan_start",
title: this.l("plan_start"),
align: "center",
high: true,
width: 140,
hide: true
},
{
key: "plan_finish",
title: this.l("plan_finish"),
align: "center",
high: true,
width: 140,
hide: true
},
{
key: "first_equip",
title: this.l("first_equip"),
align: "left",
easy: true,
high: true
},
{
key: "setup_time",
title: this.l("setup_time"),
align: "right",
high: true,
type: "outputTime"
},
{
key: "run_time",
title: this.l("run_time"),
align: "right",
high: true,
type: "outputTime"
},
{
key: "outside_time",
title: this.l("outside_time"),
align: "right",
high: true,
type: "outputTime"
},
{
key: "transport_time",
title: this.l("transport_time"),
align: "right",
high: true,
hide: true,
type: "outputTime"
},
{
key: "check_time",
title: this.l("check_time"),
align: "right",
high: true,
hide: true,
type: "outputTime"
},
{
key: "efficiency_value",
title: this.l("efficiency_value"),
align: "right",
high: true
},
{
key: "machine_rule",
title: this.l("machine_rule"),
align: "center",
easy: true,
high: true,
width: 140
},
{
key: "singleout",
title: this.l("singleout"),
align: "left",
high: true,
hide: true
},
{
key: "equip_type",
title: this.l("equip_type"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "first_equip",
title: this.l("first_equip"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "cal_id",
title: this.l("cal_id"),
align: "left",
easy: true,
high: true
},
{
key: "plan_method",
title: this.l("plan_method"),
align: "left",
easy: true,
high: true
},
{
key: "over_time",
title: this.l("over_time"),
align: "left",
easy: true,
high: true
},
{
key: "isdiscrete",
title: this.l("isdiscrete"),
align: "center",
easy: true,
high: true
},
{
key: "discrete_value",
title: this.l("discrete_value"),
align: "right",
high: true
},
{
key: "multi_machine",
title: this.l("multi_machine"),
align: "center",
easy: true,
high: true
},
{
key: "notes",
title: this.l("notes"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "workshopcode",
title: this.l("workshopcode"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "routing_detail_id",
title: this.l("routing_detail_id"),
align: "left",
high: true,
hide: true
},
{
key: "routing_header_id",
title: this.l("routing_header_id"),
align: "left",
high: true,
hide: true
},
{
key: "comb_param",
title: this.l("comb_param"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "rule_qty",
title: this.l("rule_qty"),
align: "left",
high: true,
hide: true
},
{
title: "操作",
key: "action",
width: 140,
align: "center",
render: (h, params) => {
return h("div", { class: "action" }, [
h("op", {
attrs: {
icon: "md-options",
type: "icon",
oprate: "detail",
title: "工序参数设置"
},
on: { click: () => this.openParms(params.row) }
}),
h("op", {
attrs: {
icon: "md-create",
type: "icon",
title: "編輯工序",
oprate: "edit"
},
on: { click: () => this.edit(params.row) }
}),
h("op", {
attrs: {
icon: "ios-trash",
type: "icon",
title: "删除工序",
oprate: "delete",
msg: "确认要刪除工序吗?"
},
on: { click: () => this.remove(params.row, params.index) }
})
]);
}
}
],
data1: [],
insertTItle: "插单",
selectRoutingDetail: {}, //需那种工序
//设置参数开始
setParams: {
opTaskPk: 0, //工单ID
partTaskPk: 0, //生产计划ID
taskSeq: "", //工序编号
count: 0 //生产计划数量
},
//设置参数结束
rowData: {} //编辑时传入行数据
};
},
mounted() {
this.loadData(this.rowId);
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
//根据点击副组件传过来id进行加载数据
loadData(expendId) {
let params = {
id: expendId
};
Api.getbyorderid(params).then(res => {
if (res.success) {
this.gridHeight = 50;
this.gridHeight = (res.result.length + 1) * 47;
this.data1 = res.result;
name: "list",
components: {
Edit,
Add
},
props: {
rowId: {
type: Number
}
});
},
data() {
return {
action: Api.index,
easySearch: {
keys: {
op: "task_seq",
value: null
}
},
setParsModal: false,
editModal: false,
detailModal: false,
insertlModal: false,
rowIndex: null,
curId: 0,
gridHeight: 150,
size: "small",
columns: [{
title: " ",
width: 130
},
{
key: "insert_flag",
title: this.l("insert_flag"),
align: "center",
high: true,
width: 60,
render: (h, params) => {
return h(
"Tooltip", {
props: {
content: params.row.insert_flag == 1 ? "取消插单" : "进行插单",
placement: "top"
},
class: "ico"
},
[
h("Icon", {
attrs: {
type: params.row.insert_flag == 1 ?
"ios-flag" : "ios-flag-outline",
size: 20,
color: params.row.insert_flag == 1 ? "#2680EB" : "#aaa"
},
on: {
click: () =>
this.changeFlag(params.row.op_task_pk, params.index)
}
})
]
);
}
},
{
key: "task_seq",
title: this.l("task_seq"),
align: "left",
easy: true,
high: true
},
{
key: "op_task_pk",
title: this.l("op_task_pk"),
align: "left",
high: true,
hide: true
},
{
key: "task_name",
title: this.l("task_name"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "taskseq_des",
title: this.l("task_name"),
align: "left",
easy: true,
high: true
},
{
key: "part_task_pk",
title: this.l("part_task_pk"),
align: "left",
high: true,
hide: true
},
{
key: "put_into_qty",
title: this.l("put_into_qty"),
align: "left",
high: true,
hide: true
},
{
key: "plan_start",
title: this.l("plan_start"),
align: "center",
high: true,
width: 140,
hide: true
},
{
key: "plan_finish",
title: this.l("plan_finish"),
align: "center",
high: true,
width: 140,
hide: true
},
{
key: "first_equip",
title: this.l("first_equip"),
align: "left",
easy: true,
high: true
},
{
key: "setup_time",
title: this.l("setup_time"),
align: "right",
high: true,
type: "outputTime"
},
{
key: "run_time",
title: this.l("run_time"),
align: "right",
high: true,
type: "outputTime"
},
{
key: "outside_time",
title: this.l("outside_time"),
align: "right",
high: true,
type: "outputTime"
},
{
key: "transport_time",
title: this.l("transport_time"),
align: "right",
high: true,
hide: true,
type: "outputTime"
},
{
key: "check_time",
title: this.l("check_time"),
align: "right",
high: true,
hide: true,
type: "outputTime"
},
{
key: "efficiency_value",
title: this.l("efficiency_value"),
align: "right",
high: true
},
{
key: "machine_rule",
title: this.l("machine_rule"),
align: "center",
easy: true,
high: true,
width: 140
},
{
key: "singleout",
title: this.l("singleout"),
align: "left",
high: true,
hide: true
},
{
key: "equip_type",
title: this.l("equip_type"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "first_equip",
title: this.l("first_equip"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "cal_id",
title: this.l("cal_id"),
align: "left",
easy: true,
high: true
},
{
key: "plan_method",
title: this.l("plan_method"),
align: "left",
easy: true,
high: true
},
{
key: "over_time",
title: this.l("over_time"),
align: "left",
easy: true,
high: true
},
{
key: "isdiscrete",
title: this.l("isdiscrete"),
align: "center",
easy: true,
high: true
},
{
key: "discrete_value",
title: this.l("discrete_value"),
align: "right",
high: true
},
{
key: "multi_machine",
title: this.l("multi_machine"),
align: "center",
easy: true,
high: true
},
{
key: "notes",
title: this.l("notes"),
align: "left",
easy: true,
high: true,
hide: true
},
//插单事件start----
changeFlag(id, index) {
this.rowIndex = index;
if (this.data1[this.rowIndex].insert_flag == 1) {
this.insertTItle = "取消插单";
} else {
this.insertTItle = "插单";
}
this.insertlModal = true;
},
insertOk() {
//this.loadData(this.row)
if (this.data1[this.rowIndex].insert_flag == 1) {
//根据插单数据状态进行插单或取消插单操作
let params1 = {
partTaskPks: [],
opTaskPks: [this.data1[this.rowIndex].op_task_pk]
{
key: "workshopcode",
title: this.l("workshopcode"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "routing_detail_id",
title: this.l("routing_detail_id"),
align: "left",
high: true,
hide: true
},
{
key: "routing_header_id",
title: this.l("routing_header_id"),
align: "left",
high: true,
hide: true
},
{
key: "comb_param",
title: this.l("comb_param"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "rule_qty",
title: this.l("rule_qty"),
align: "left",
high: true,
hide: true
},
{
title: "操作",
key: "action",
width: 140,
align: "center",
render: (h, params) => {
return h("div", {
class: "action"
}, [
h("op", {
attrs: {
icon: "md-options",
type: "icon",
oprate: "detail",
title: "工序参数设置"
},
on: {
click: () => this.openParms(params.row)
}
}),
h("op", {
attrs: {
icon: "md-create",
type: "icon",
title: "編輯工序",
oprate: "edit"
},
on: {
click: () => this.edit(params.row)
}
}),
h("op", {
attrs: {
icon: "ios-trash",
type: "icon",
title: "删除工序",
oprate: "delete",
msg: "确认要刪除工序吗?"
},
on: {
click: () => this.remove(params.row, params.index)
}
})
]);
}
}
],
data1: [],
insertTItle: "插单",
selectRoutingDetail: {}, //需那种工序
//设置参数开始
setParams: {
opTaskPk: 0, //工单ID
partTaskPk: 0, //生产计划ID
taskSeq: "", //工序编号
count: 0 //生产计划数量
},
//设置参数结束
rowData: {} //编辑时传入行数据
};
Api.cancelinsertorder(params1)
.then(res => {
if (res.success) {
this.$Message.success("取消插单成功!");
this.data1[this.rowIndex].insert_flag = 0;
},
mounted() {
this.loadData(this.rowId);
},
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
//根据点击副组件传过来id进行加载数据
loadData(expendId) {
let params = {
id: expendId
};
Api.getbyorderid(params).then(res => {
if (res.success) {
this.gridHeight = 50;
this.gridHeight = (res.result.length + 1) * 47;
this.data1 = res.result;
}
});
},
//插单事件start----
changeFlag(id, index) {
this.rowIndex = index;
if (this.data1[this.rowIndex].insert_flag == 1) {
this.insertTItle = "取消插单";
} else {
this.$Message.error("取消插单失败!");
this.insertTItle = "插单";
}
})
.catch(err => {
this.$Message.error("数据异常!");
});
} else {
let params = {
partTaskPks: [],
opTaskPks: [this.data1[this.rowIndex].op_task_pk]
};
Api.saveinsertorder(params)
.then(res => {
if (res.success) {
this.$Message.success("插单成功!");
this.data1[this.rowIndex].insert_flag = 1;
this.insertlModal = true;
},
insertOk() {
//this.loadData(this.row)
if (this.data1[this.rowIndex].insert_flag == 1) {
//根据插单数据状态进行插单或取消插单操作
let params1 = {
partTaskPks: [],
opTaskPks: [this.data1[this.rowIndex].op_task_pk]
};
Api.cancelinsertorder(params1)
.then(res => {
if (res.success) {
this.$Message.success("取消插单成功!");
this.data1[this.rowIndex].insert_flag = 0;
} else {
this.$Message.error("取消插单失败!");
}
})
.catch(err => {
this.$Message.error("数据异常!");
});
} else {
this.$Message.error("插单失败!");
let params = {
partTaskPks: [],
opTaskPks: [this.data1[this.rowIndex].op_task_pk]
};
Api.saveinsertorder(params)
.then(res => {
if (res.success) {
this.$Message.success("插单成功!");
this.data1[this.rowIndex].insert_flag = 1;
} else {
this.$Message.error("插单失败!");
}
})
.catch(err => {
this.$Message.error("数据异常!");
});
}
})
.catch(err => {
this.$Message.error("数据异常!");
});
}
this.setParsModal = false;
this.detailModal = false;
this.editModal = false;
this.insertlModal = false;
},
//插单事件end----
this.setParsModal = false;
this.detailModal = false;
this.editModal = false;
this.insertlModal = false;
},
//插单事件end----
//单个工序进行参设置start----
openParms(row) {
this.setParams = {
opTaskPk: row.op_task_pk,
partTaskPk: row.part_task_pk,
taskSeq: row.task_seq,
count: row.put_into_qty
};
this.rowData = row;
this.setParsModal = true;
},
//单个工序进行参数设置end----
//单个工序进行参设置start----
openParms(row) {
this.setParams = {
opTaskPk: row.op_task_pk,
partTaskPk: row.part_task_pk,
taskSeq: row.task_seq,
count: row.put_into_qty
};
this.rowData = row;
this.setParsModal = true;
},
//单个工序进行参数设置end----
//编辑工序start----
edit(row) {
this.editModal = true;
this.rowData = row;
},
//编辑工序end----
//编辑工序start----
edit(row) {
this.editModal = true;
this.rowData = row;
},
//编辑工序end----
//删除工序事件start-----
remove(row, index) {
//this.curId = Number(id);
this.rowIndex = index;
this.selectRoutingDetail = row;
let params = {
partPk: this.selectRoutingDetail.part_task_pk,
detailIdstr: this.selectRoutingDetail.routing_detail_id
};
Api.removeoptasksimluate(params).then(r => {
if (r.success) {
this.$Message.success("删除成功");
this.data1.splice(this.rowIndex, 1);
//删除工序事件start-----
remove(row, index) {
//this.curId = Number(id);
this.rowIndex = index;
this.selectRoutingDetail = row;
let params = {
partPk: this.selectRoutingDetail.part_task_pk,
detailIdstr: this.selectRoutingDetail.routing_detail_id
};
Api.removeoptasksimluate(params).then(r => {
if (r.success) {
this.$Message.success("删除成功");
this.data1.splice(this.rowIndex, 1);
}
});
},
addOk() {
this.data1 = [];
this.loadData(this.rowId);
this.setParsModal = false;
this.editModal = false;
},
//删除工序时间end-----
cancel() {
this.curId = 0;
this.setParsModal = false;
this.detailModal = false;
this.editModal = false;
this.deletedlModal = false;
this.insertlModal = false;
},
l(key) {
let vkey = "mes_op_task_plan_simulate" + "." + key;
return this.$t(vkey) || key;
}
});
},
addOk() {
this.data1 = [];
this.loadData(this.rowId);
this.setParsModal = false;
this.editModal = false;
},
//删除工序时间end-----
cancel() {
this.curId = 0;
this.setParsModal = false;
this.detailModal = false;
this.editModal = false;
this.deletedlModal = false;
this.insertlModal = false;
},
l(key) {
let vkey = "mes_op_task_plan_simulate" + "." + key;
return this.$t(vkey) || key;
}
}
};
</script>
<style lang="less">
.excute table tr th span,
.excute table tr td {
font-size: 10px;
font-size: 10px;
}
</style>
<template>
<div class="h100">
<DataGrid
:columns="columns"
ref="grid"
:action="action"
@on-selection-change="selectInfo"
:batch="false"
>
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input
search
enter-button
placeholder="请输入关键字订单编号/项目名称"
v-model="easySearch.keys.value"
v-width="300"
@on-search="search"
/>
</FormItem>
</Form>
</template>
<template slot="searchBack">
<Badge
:count="this.$store.state.countAps"
overflow-count="99"
style="margin-right:15px;"
type="info"
v-if="showAps"
>
<a href="javascript:;" @click="goAps">APS排产&nbsp;&nbsp;&nbsp;</a>
</Badge>
<Badge
:count="this.$store.state.countAi"
overflow-count="99"
style="margin-right:15px;"
type="info"
v-if="showAi"
>
<a href="javascript:;" @click="goAi">智能排产&nbsp;&nbsp;&nbsp;</a>
</Badge>
<Badge
:count="this.$store.state.countAll"
overflow-count="99"
style="margin-right:15px;"
type="info"
v-if="showAll"
>
<a @click="goCemplate">整机排产&nbsp;&nbsp;&nbsp;</a>
</Badge>
<Badge :count="this.$store.state.countRun" overflow-count="99" type="info" v-if="showRun">
<a @click="goStream">流水排产&nbsp;&nbsp;&nbsp;</a>
</Badge>
</template>
<template slot="searchForm">
<Search />
</template>
<template slot="buttons"></template>
<div class="h100">
<DataGrid :columns="columns" ref="grid" :action="action" @on-selection-change="selectInfo" :batch="false">
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input search enter-button placeholder="请输入关键字订单编号/项目名称" v-model="easySearch.keys.value" v-width="300" @on-search="search" />
</FormItem>
</Form>
</template>
<template slot="searchBack">
<Badge :count="this.$store.state.countAps" overflow-count="99" style="margin-right:15px;" type="info" v-if="showAps">
<a href="javascript:;" @click="goAps">APS排产&nbsp;&nbsp;&nbsp;</a>
</Badge>
<Badge :count="this.$store.state.countAi" overflow-count="99" style="margin-right:15px;" type="info" v-if="showAi">
<a href="javascript:;" @click="goAi">智能排产&nbsp;&nbsp;&nbsp;</a>
</Badge>
<Badge :count="this.$store.state.countAll" overflow-count="99" style="margin-right:15px;" type="info" v-if="showAll">
<a @click="goCemplate">整机排产&nbsp;&nbsp;&nbsp;</a>
</Badge>
<Badge :count="this.$store.state.countRun" overflow-count="99" type="info" v-if="showRun">
<a @click="goStream">流水排产&nbsp;&nbsp;&nbsp;</a>
</Badge>
</template>
<template slot="searchForm">
<Search />
</template>
<template slot="buttons"></template>
</DataGrid>
<FooterToolbar extra v-if="footerBar" class="ftball">
<Row>
<Checkbox @on-change="handleSelectAll(single)" v-model="single">全选</Checkbox>
<span class="footerSpan">已选 {{selectCount}} 项</span>
&nbsp;&nbsp;&nbsp;&nbsp;
<Button type="primary" @click="modalDispatch">工艺派发</Button>&nbsp;&nbsp;&nbsp;&nbsp;
<Button type="primary" @click="modalSchedule">移入排产</Button>&nbsp;&nbsp;&nbsp;&nbsp;
<Button @click="canselFooter">取消</Button>
</Row>
<Row>
<Checkbox @on-change="handleSelectAll(single)" v-model="single">全选</Checkbox>
<span class="footerSpan">已选 {{selectCount}} 项</span>
&nbsp;&nbsp;&nbsp;&nbsp;
<Button type="primary" @click="modalDispatch">工艺派发</Button>&nbsp;&nbsp;&nbsp;&nbsp;
<Button type="primary" @click="modalSchedule">移入排产</Button>&nbsp;&nbsp;&nbsp;&nbsp;
<Button @click="canselFooter">取消</Button>
</Row>
</FooterToolbar>
<Modal v-model="addModal" title="新增" footer-hide>
<Add @on-close="cancel" @on-ok="addOk" />
<Add @on-close="cancel" @on-ok="addOk" />
</Modal>
<Modal v-model="editModal" title="编辑" footer-hide>
<Edit :eid="curId" @on-close="cancel" @on-ok="addOk" />
<Edit :eid="curId" @on-close="cancel" @on-ok="addOk" />
</Modal>
<Modal v-model="detailModal" title="详情">
<Detail :eid="curId" />
<Detail :eid="curId" />
</Modal>
<Modal v-model="deletelModal" title="删除" @on-ok="removeOk" @on-cancel="cancel">
<p>确定删除?</p>
<p>确定删除?</p>
</Modal>
<Modal v-model="dispatchModal" title="工艺派发" footer-hide width="800">
<Dispatch @on-close="cancel" :ids="listBatchIds" @on-ok="addOk" />
<Dispatch @on-close="cancel" :ids="listBatchIds" @on-ok="addOk" />
</Modal>
<Modal v-model="scheduleModal" title="移入排产" width="800">
<p>&nbsp;</p>
<h4>请选择排产模型:</h4>
<!--
<p>&nbsp;</p>
<h4>请选择排产模型:</h4>
<!--
<Dictionary
code="aps.plan.scheduleType"
v-model="scheduleType"
......@@ -96,49 +65,41 @@
@on-change="onchangeScheduleType"
></Dictionary>
-->
<RadioGroup v-model="scheduleType" class="radioList" @on-change="onchangeScheduleType">
<Radio :label="1" border :disabled="this.$store.state.countAi>0">
<span>Aps排产</span>
</Radio>
<Radio :label="4" border :disabled="this.$store.state.countAps>0">
<span>智能排产</span>
</Radio>
<Radio :label="2" border>
<span>整机排产</span>
</Radio>
<Radio :label="3" border>
<span>流水排产</span>
</Radio>
</RadioGroup>
<p class="pl30 pt10" v-show="scheduleType!=null">
确定将订单
<span class="fwBold">{{resultsOrderList}}</span> 移入
<span class="red fwBold">{{scheduleTypeName}}</span>
</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div slot="footer">
<Button @click="cancel">取消</Button>
<Button type="primary" @click="scheduleOk">确定</Button>
</div>
<RadioGroup v-model="scheduleType" class="radioList" @on-change="onchangeScheduleType">
<Radio :label="1" border :disabled="this.$store.state.countAi>0">
<span>Aps排产</span>
</Radio>
<Radio :label="4" border :disabled="this.$store.state.countAps>0">
<span>智能排产</span>
</Radio>
<Radio :label="2" border>
<span>整机排产</span>
</Radio>
<Radio :label="3" border>
<span>流水排产</span>
</Radio>
</RadioGroup>
<p class="pl30 pt10" v-show="scheduleType!=null">
确定将订单
<span class="fwBold">{{resultsOrderList}}</span> 移入
<span class="red fwBold">{{scheduleTypeName}}</span>
</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div slot="footer">
<Button @click="cancel">取消</Button>
<Button type="primary" @click="scheduleOk">确定</Button>
</div>
</Modal>
<Modal v-model="orderSupportModal" title="配套下发" footer-hide width="1300">
<orderSupport ref="orderSupport"></orderSupport>
<orderSupport ref="orderSupport"></orderSupport>
</Modal>
<Modal v-model="modalAccessory" :title="title" fullscreen footer-hide>
<component
:is="details"
:eid="orderId"
:mesCode="mesCode"
:productName="productName"
:drawnNumber="drawnNumber"
:count="count"
@on-close="cancel"
@on-ok="addOk"
/>
<component :is="details" :eid="orderId" :mesCode="mesCode" :productName="productName" :drawnNumber="drawnNumber" :count="count" @on-close="cancel" @on-ok="addOk" />
</Modal>
</div>
</div>
</template>
<script>
import Api from "./api";
import Add from "./add";
......@@ -148,704 +109,706 @@ import Search from "./search";
import Dispatch from "./dispatch";
import orderSupport from "../../produce/orderSupport";
export default {
name: "list",
components: {
Add,
Edit,
Detail,
Search,
Dispatch,
orderSupport,
},
data() {
return {
action: Api.index,
easySearch: {
keys: {
op: "mesCode,projectNumber",
value: null,
name: "list",
components: {
Add,
Edit,
Detail,
Search,
Dispatch,
orderSupport,
},
data() {
return {
action: Api.index,
easySearch: {
keys: {
op: "mesCode,projectNumber",
value: null,
},
},
addModal: false,
editModal: false,
detailModal: false,
deletelModal: false,
dispatchModal: false,
scheduleModal: false,
orderSupportModal: false,
curId: 0,
statuList: this.$store.getters.dictionaryByKey("aps.plan.supportingStatus") || [],
name: "",
items: null,
title: "",
details: null,
uId: "",
hid: 0,
orderId: 0,
mesCode: "",
productName: "",
drawnNumber: "",
count: 0,
modalAccessory: false,
columns: [{
key: "selection",
title: "#",
type: "selection",
width: 70,
align: "center",
},
{
title: this.l("mesCode"),
key: "mesCode",
width: 240,
align: "left",
},
{
key: "productName",
title: this.l("productName"),
align: "left",
easy: true,
width: 160,
high: true,
tooltip: true,
},
{
key: "status",
title: this.l("status"),
align: "center",
high: true,
code: "plan.order.status",
},
{
key: "mainRoutingSetStatus",
title: this.l("mainRoutingSetStatus"),
align: "center",
high: true,
code: "aps.plan.mainRoutingStatus",
},
{
key: "isSupportingFinish",
title: this.l("isSupportingFinish"),
align: "center",
render: (h, params) => {
return h(
"op", {
attrs: {
oprate: "detail",
},
style: {
color: this.setName(params.row.isSupportingFinish).color,
},
on: {
click: () => this.openAccessory(params.row),
},
},
this.setName(params.row.isSupportingFinish).name
);
},
},
{
key: "projectNumber",
title: this.l("projectNumber"),
align: "left",
easy: true,
high: true,
},
{
key: "batchNumber",
title: this.l("batchNumber"),
align: "left",
easy: true,
high: true,
},
{
key: "urgencyLevel",
title: this.l("urgencyLevel"),
align: "left",
easy: true,
high: true,
code: "plan.order.urgencyLevel",
},
{
key: "taskType",
title: this.l("taskType"),
align: "left",
easy: true,
high: true,
hide: true,
code: "plan.order.taskType",
},
{
key: "drawnNumber",
title: this.l("drawnNumber"),
align: "left",
easy: true,
high: true,
},
{
key: "stage",
title: this.l("stage"),
align: "left",
easy: true,
high: true,
code: "plan.order.stage",
},
{
key: "materialName",
title: this.l("materialName"),
align: "left",
easy: true,
high: true,
},
{
key: "quantity",
title: this.l("quantity"),
align: "right",
high: true,
},
{
key: "routingMethod",
title: this.l("routingMethod"),
align: "left",
easy: true,
high: true,
code: "plan.order.routingMethod",
},
{
key: "materialWeight",
title: this.l("materialWeight"),
align: "left",
high: true,
hide: true,
},
{
key: "productCode",
title: this.l("productCode"),
align: "left",
easy: true,
high: true,
hide: true,
},
{
key: "isPreschedule",
title: this.l("isPreschedule"),
align: "left",
high: true,
code: "mes_xingchi_plan.mes_order.is_preschedule",
hide: true,
},
{
key: "spareQty",
title: this.l("spareQty"),
align: "left",
high: true,
hide: true,
},
{
key: "demandStart",
title: this.l("demandStart"),
align: "left",
high: true,
hide: true,
},
{
key: "demandFinish",
title: this.l("demandFinish"),
align: "left",
high: true,
hide: true,
},
{
key: "partNamePro",
title: this.l("partNamePro"),
align: "left",
easy: true,
high: true,
hide: true,
},
{
title: "操作",
key: "action",
width: 140,
align: "center",
render: (h, params) => {
return h("div", {
class: "action"
}, [
h(
"op", {
attrs: {
oprate: "detail",
title: params.row.mainRoutingSetStatus == 0 ?
"工艺派发" : "移入排产",
},
style: {
color: params.row.mainRoutingSetStatus == 0 ? "red" : "",
},
on: {
click: () =>
params.row.mainRoutingSetStatus == 0 ||
params.row.mainRoutingSetStatus == 1 ?
this.goMethod(params.row) : null,
},
},
params.row.mainRoutingSetStatus == 0 ?
"工艺派发" :
params.row.mainRoutingSetStatus == 1 ?
"移入排产" :
""
),
h(
"op", {
attrs: {
oprate: "detail",
title: params.row.isSupportingFinish == 2 ||
params.row.isSupportingFinish == 3 ?
"配套派发" : "",
},
style: {
color: params.row.mainRoutingSetStatus == 0 ? "red" : "",
},
on: {
click: () =>
params.row.isSupportingFinish == 2 ||
params.row.isSupportingFinish == 3 ?
this.supportDis(params.row) : null,
},
},
params.row.isSupportingFinish == 2 ||
params.row.isSupportingFinish == 3 ?
"配套派发" :
""
),
]);
},
},
],
selectCount: 0,
selectList: [],
footerBar: false,
results: [],
listBatchIds: [],
listBatchIds1: [], //临时存储选择的ids
single: false,
resultsStatusArr: [],
resultsStatus: 0,
dispatchStatus: 0, //派发标识
scheduleStatus: 0, //排产标识
resultsOrderList: "",
scheduleType: null,
scheduleTypeName: "",
showAps: false,
showAi: false,
showAll: false,
showRun: false,
};
},
mounted() {
this.loadInitCount();
},
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
handleSelectAll(status) {
//选择列表数据
this.$refs.grid.selectAll(status);
},
},
addModal: false,
editModal: false,
detailModal: false,
deletelModal: false,
dispatchModal: false,
scheduleModal: false,
orderSupportModal: false,
curId: 0,
statuList:
this.$store.getters.dictionaryByKey("aps.plan.supportingStatus") || [],
name: "",
items: null,
title: "",
details: null,
uId: "",
hid: 0,
orderId: 0,
mesCode: "",
productName: "",
drawnNumber: "",
count: 0,
modalAccessory: false,
columns: [
{
key: "selection",
title: "#",
type: "selection",
width: 70,
align: "center",
selectInfo(value) {
if (value.length > 0) {
this.footerBar = true;
} else {
this.footerBar = false;
}
this.selectList = [];
this.selectList = value;
this.selectCount = this.selectList.length;
let statueArry = [];
let tempmesCodeList = [];
this.resultsStatusArr = [];
value.forEach((data) => {
var that = this;
statueArry.push(data.id);
this.resultsStatusArr.push(data.mainRoutingSetStatus);
tempmesCodeList.push(data.mesCode);
});
let mainRS = this.uniq(this.resultsStatusArr); //数组去重
if (mainRS.length == 1) {
this.results = [];
this.results = statueArry;
this.getListId(statueArry);
this.resultsOrderList = JSON.stringify(tempmesCodeList) //提示mesCode
.replace("[", "")
.replace("]", "")
.replace(/\"/g, "");
if (mainRS[0] == 0) {
//未派发
this.dispatchStatus = 1;
this.scheduleStatus = 0;
} else if (mainRS[0] == 1) {
//已派发
this.dispatchStatus = 0;
this.scheduleStatus = 1;
} else {
//派发中
this.dispatchStatus = 0;
this.scheduleStatus = 0;
}
} else {
this.dispatchStatus = 0;
this.scheduleStatus = 0;
}
},
{
title: this.l("mesCode"),
key: "mesCode",
width: 240,
align: "left",
//得到需要批量操作的ids
getListId(value) {
this.listBatchIds1 = value;
if (this.listBatchIds1.length > 0) {
this.footerBar = true;
} else {
this.footerBar = false;
}
},
{
key: "productName",
title: this.l("productName"),
align: "left",
easy: true,
width: 160,
high: true,
tooltip: true,
canselFooter() {
this.footerBar = false;
this.handleSelectAll(false);
},
{
key: "status",
title: this.l("status"),
align: "center",
high: true,
code: "plan.order.status",
modalDispatch() {
//打开工艺派发
this.listBatchIds = this.listBatchIds1; //用于列表操作时和多选时的listBatchId的冲突
if (this.dispatchStatus == 1) {
this.dispatchModal = true;
} else {
this.$Message.error("所选订单里存在已派发订单!");
}
},
{
key: "mainRoutingSetStatus",
title: this.l("mainRoutingSetStatus"),
align: "center",
high: true,
code: "aps.plan.mainRoutingStatus",
modalSchedule() {
//移入排产
this.scheduleType = null;
this.scheduleTypeName = "";
this.listBatchIds = this.listBatchIds1;
if (this.scheduleStatus == 1) {
this.scheduleModal = true;
} else {
this.$Message.error("所选订单里存在未派发订单!");
}
},
{
key: "isSupportingFinish",
title: this.l("isSupportingFinish"),
align: "center",
render: (h, params) => {
return h(
"op",
{
attrs: {
oprate: "detail",
},
style: {
color: this.setName(params.row.isSupportingFinish).color,
},
on: {
click: () => this.openAccessory(params.row),
},
},
this.setName(params.row.isSupportingFinish).name
);
},
goMethod(value) {
//行内点击后面按钮
this.canselFooter();
this.resultsOrderList = value.mesCode;
this.listBatchIds = [value.id];
this.scheduleType = null;
this.scheduleTypeName = "";
if (value.mainRoutingSetStatus == 0) {
//this.dispatchStatus = 1
//this.scheduleStatus = 0
this.dispatchModal = true;
} else if (value.mainRoutingSetStatus == 1) {
//this.dispatchStatus = 0
//this.scheduleStatus = 1
this.scheduleModal = true;
}
},
{
key: "projectNumber",
title: this.l("projectNumber"),
align: "left",
easy: true,
high: true,
supportDis(value) {
(this.orderSupportModal = true),
this.$refs.orderSupport.loaddata(value.id);
},
{
key: "batchNumber",
title: this.l("batchNumber"),
align: "left",
easy: true,
high: true,
scheduleOk() {
if (this.scheduleType == null) {
this.$Message.error("请选择排产模型");
} else {
let params = {
ids: this.listBatchIds,
poolType: this.scheduleType,
};
Api.moveinbatch(params)
.then((r) => {
if (r.success && r.result == true) {
this.$Message.success("移入排产成功");
this.$refs.grid.reload(this.easySearch);
this.changeCountOut(this.scheduleType, this.listBatchIds.length);
} else {
if (!r.result.res) {
this.$Message.error(r.result.msg);
} else {
this.$Message.error("移入排产失败");
}
}
})
.catch((err) => {
this.$Message.error("移入排产失败");
});
this.canselFooter();
this.cancel();
}
},
{
key: "urgencyLevel",
title: this.l("urgencyLevel"),
align: "left",
easy: true,
high: true,
code: "plan.order.urgencyLevel",
//跳转到aps排产池(有判断)
goAps() {
Api.moveintoaps().then((res) => {
if (res.success) {
if (res.result.res) {
this.$router.push({
name: "aps-aps",
// params: { customerId: id }
});
} else {
this.$Message.error(res.result.msg);
}
}
});
},
{
key: "taskType",
title: this.l("taskType"),
align: "left",
easy: true,
high: true,
hide: true,
code: "plan.order.taskType",
//跳转到智能排产池(有判断)
goAi() {
Api.moveintoai().then((res) => {
if (res.success) {
if (res.result.res) {
//test
this.$router.push({
name: "aps-ai",
// params: { customerId: id }
});
} else {
this.$Message.error(res.result.msg);
}
}
});
},
{
key: "drawnNumber",
title: this.l("drawnNumber"),
align: "left",
easy: true,
high: true,
goCemplate() {
this.$router.push({
name: "aps-complete",
});
},
{
key: "stage",
title: this.l("stage"),
align: "left",
easy: true,
high: true,
code: "plan.order.stage",
goStream() {
this.$router.push({
name: "aps-stream",
});
},
{
key: "materialName",
title: this.l("materialName"),
align: "left",
easy: true,
high: true,
add() {
this.addModal = true;
},
{
key: "quantity",
title: this.l("quantity"),
align: "right",
high: true,
addOk() {
this.$refs.grid.load();
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.curId = 0;
//aps
this.dispatchModal = false;
this.scheduleModal = false;
this.listBatchIds = [];
this.listBatchIds1 = [];
this.canselFooter();
this.modalAccessory = false;
},
{
key: "routingMethod",
title: this.l("routingMethod"),
align: "left",
easy: true,
high: true,
code: "plan.order.routingMethod",
search() {
this.$refs.grid.reload(this.easySearch);
},
{
key: "materialWeight",
title: this.l("materialWeight"),
align: "left",
high: true,
hide: true,
detail(id) {
this.detailModal = true;
this.curId = id;
},
{
key: "productCode",
title: this.l("productCode"),
align: "left",
easy: true,
high: true,
hide: true,
edit(id) {
this.editModal = true;
this.curId = id;
},
{
key: "isPreschedule",
title: this.l("isPreschedule"),
align: "left",
high: true,
code: "mes_xingchi_plan.mes_order.is_preschedule",
hide: true,
remove(id) {
this.deletelModal = true;
this.curId = id;
},
{
key: "spareQty",
title: this.l("spareQty"),
align: "left",
high: true,
hide: true,
removeOk() {
Api.delete({
id: this.curId
}).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.deletelModal = false;
this.$Message.success("删除成功");
}
});
},
{
key: "demandStart",
title: this.l("demandStart"),
align: "left",
high: true,
hide: true,
removeCancel() {
this.deletelModal = false;
},
{
key: "demandFinish",
title: this.l("demandFinish"),
align: "left",
high: true,
hide: true,
cancel() {
this.curId = 0;
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.deletedlModal = false;
//aps
this.dispatchModal = false;
this.scheduleModal = false;
this.modalAccessory = false;
// this.listBatchIds = []
// this.listBatchIds1 = []
// this.canselFooter()
},
{
key: "partNamePro",
title: this.l("partNamePro"),
align: "left",
easy: true,
high: true,
hide: true,
l(key) {
let vkey = "mes_order" + "." + key;
return this.$t(vkey) || key;
},
{
title: "操作",
key: "action",
width: 140,
align: "center",
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{
attrs: {
oprate: "detail",
title:
params.row.mainRoutingSetStatus == 0
? "工艺派发"
: "移入排产",
},
style: {
color: params.row.mainRoutingSetStatus == 0 ? "red" : "",
},
on: {
click: () =>
params.row.mainRoutingSetStatus == 0 ||
params.row.mainRoutingSetStatus == 1
? this.goMethod(params.row)
: null,
},
},
params.row.mainRoutingSetStatus == 0
? "工艺派发"
: params.row.mainRoutingSetStatus == 1
? "移入排产"
: ""
),
h(
"op",
{
attrs: {
oprate: "detail",
title:
params.row.isSupportingFinish == 2 ||
params.row.isSupportingFinish == 3
? "配套派发"
: "",
},
style: {
color: params.row.mainRoutingSetStatus == 0 ? "red" : "",
},
on: {
click: () =>
params.row.isSupportingFinish == 2 ||
params.row.isSupportingFinish == 3
? this.supportDis(params.row)
: null,
},
},
params.row.isSupportingFinish == 2 ||
params.row.isSupportingFinish == 3
? "配套派发"
: ""
),
]);
},
uniq(array) {
//数组去重
array.sort();
var temp = [];
temp = [array[0]];
for (var i = 1; i < array.length; i++) {
if (array[i] !== temp[temp.length - 1]) {
temp.push(array[i]);
}
}
return temp;
},
],
selectCount: 0,
selectList: [],
footerBar: false,
results: [],
listBatchIds: [],
listBatchIds1: [], //临时存储选择的ids
single: false,
resultsStatusArr: [],
resultsStatus: 0,
dispatchStatus: 0, //派发标识
scheduleStatus: 0, //排产标识
resultsOrderList: "",
scheduleType: null,
scheduleTypeName: "",
showAps: false,
showAi: false,
showAll: false,
showRun: false,
};
},
mounted() {
this.loadInitCount();
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
handleSelectAll(status) {
//选择列表数据
this.$refs.grid.selectAll(status);
},
selectInfo(value) {
if (value.length > 0) {
this.footerBar = true;
} else {
this.footerBar = false;
}
this.selectList = [];
this.selectList = value;
this.selectCount = this.selectList.length;
let statueArry = [];
let tempmesCodeList = [];
this.resultsStatusArr = [];
value.forEach((data) => {
var that = this;
statueArry.push(data.id);
this.resultsStatusArr.push(data.mainRoutingSetStatus);
tempmesCodeList.push(data.mesCode);
});
let mainRS = this.uniq(this.resultsStatusArr); //数组去重
if (mainRS.length == 1) {
this.results = [];
this.results = statueArry;
this.getListId(statueArry);
this.resultsOrderList = JSON.stringify(tempmesCodeList) //提示mesCode
.replace("[", "")
.replace("]", "")
.replace(/\"/g, "");
if (mainRS[0] == 0) {
//未派发
this.dispatchStatus = 1;
this.scheduleStatus = 0;
} else if (mainRS[0] == 1) {
//已派发
this.dispatchStatus = 0;
this.scheduleStatus = 1;
} else {
//派发中
this.dispatchStatus = 0;
this.scheduleStatus = 0;
}
} else {
this.dispatchStatus = 0;
this.scheduleStatus = 0;
}
},
//得到需要批量操作的ids
getListId(value) {
this.listBatchIds1 = value;
if (this.listBatchIds1.length > 0) {
this.footerBar = true;
} else {
this.footerBar = false;
}
},
canselFooter() {
this.footerBar = false;
this.handleSelectAll(false);
},
modalDispatch() {
//打开工艺派发
this.listBatchIds = this.listBatchIds1; //用于列表操作时和多选时的listBatchId的冲突
if (this.dispatchStatus == 1) {
this.dispatchModal = true;
} else {
this.$Message.error("所选订单里存在已派发订单!");
}
},
modalSchedule() {
//移入排产
this.scheduleType = null;
this.scheduleTypeName = "";
this.listBatchIds = this.listBatchIds1;
if (this.scheduleStatus == 1) {
this.scheduleModal = true;
} else {
this.$Message.error("所选订单里存在未派发订单!");
}
},
goMethod(value) {
//行内点击后面按钮
this.canselFooter();
this.resultsOrderList = value.mesCode;
this.listBatchIds = [value.id];
this.scheduleType = null;
this.scheduleTypeName = "";
if (value.mainRoutingSetStatus == 0) {
//this.dispatchStatus = 1
//this.scheduleStatus = 0
this.dispatchModal = true;
} else if (value.mainRoutingSetStatus == 1) {
//this.dispatchStatus = 0
//this.scheduleStatus = 1
this.scheduleModal = true;
}
},
supportDis(value) {
(this.orderSupportModal = true),
this.$refs.orderSupport.loaddata(value.id);
},
scheduleOk() {
if (this.scheduleType == null) {
this.$Message.error("请选择排产模型");
} else {
let params = {
ids: this.listBatchIds,
poolType: this.scheduleType,
};
Api.moveinbatch(params)
.then((r) => {
if (r.success && r.result == true) {
this.$Message.success("移入排产成功");
this.$refs.grid.reload(this.easySearch);
this.changeCountOut(this.scheduleType, this.listBatchIds.length);
} else {
if (!r.result.res) {
this.$Message.error(r.result.msg);
} else {
this.$Message.error("移入排产失败");
}
//移入排产前选择排产模型
onchangeScheduleType(val) {
switch (Number(val)) {
case 4:
this.scheduleTypeName = "智能排产";
break;
case 2:
this.scheduleTypeName = "整机排产";
break;
case 3:
this.scheduleTypeName = "流水排产";
break;
default:
this.scheduleTypeName = "APS排产";
}
})
.catch((err) => {
this.$Message.error("移入排产失败");
});
this.canselFooter();
this.cancel();
}
},
//跳转到aps排产池(有判断)
goAps() {
Api.moveintoaps().then((res) => {
if (res.success) {
if (res.result.res) {
this.$router.push({
name: "aps-aps",
// params: { customerId: id }
});
} else {
this.$Message.error(res.result.msg);
}
}
});
},
//跳转到智能排产池(有判断)
goAi() {
Api.moveintoai().then((res) => {
if (res.success) {
if (res.result.res) {
//test
this.$router.push({
name: "aps-ai",
// params: { customerId: id }
});
} else {
this.$Message.error(res.result.msg);
}
}
});
},
goCemplate() {
this.$router.push({
name: "aps-complete",
});
},
goStream() {
this.$router.push({
name: "aps-stream",
});
},
add() {
this.addModal = true;
},
addOk() {
this.$refs.grid.load();
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.curId = 0;
//aps
this.dispatchModal = false;
this.scheduleModal = false;
this.listBatchIds = [];
this.listBatchIds1 = [];
this.canselFooter();
this.modalAccessory = false;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
detail(id) {
this.detailModal = true;
this.curId = id;
},
edit(id) {
this.editModal = true;
this.curId = id;
},
remove(id) {
this.deletelModal = true;
this.curId = id;
},
removeOk() {
Api.delete({ id: this.curId }).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.deletelModal = false;
this.$Message.success("删除成功");
}
});
},
removeCancel() {
this.deletelModal = false;
},
cancel() {
this.curId = 0;
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.deletedlModal = false;
//aps
this.dispatchModal = false;
this.scheduleModal = false;
this.modalAccessory = false;
// this.listBatchIds = []
// this.listBatchIds1 = []
// this.canselFooter()
},
l(key) {
let vkey = "mes_order" + "." + key;
return this.$t(vkey) || key;
},
uniq(array) {
//数组去重
array.sort();
var temp = [];
temp = [array[0]];
for (var i = 1; i < array.length; i++) {
if (array[i] !== temp[temp.length - 1]) {
temp.push(array[i]);
}
}
return temp;
},
//移入排产前选择排产模型
onchangeScheduleType(val) {
switch (Number(val)) {
case 4:
this.scheduleTypeName = "智能排产";
break;
case 2:
this.scheduleTypeName = "整机排产";
break;
case 3:
this.scheduleTypeName = "流水排产";
break;
default:
this.scheduleTypeName = "APS排产";
}
},
//移入排产成功后给标题增加数量
changeCountOut(type, count) {
switch (type) {
case 4: //智能排产池排产订单数量
this.$store.commit("setCountAi", this.$store.state.countAi + count);
break;
case 2: //整机排产池排产订单数量
this.$store.commit("setCountAll", this.$store.state.countAll + count);
break;
case 3: //流水排产池排产订单数量
this.$store.commit("setCountRun", this.$store.state.countRun + count);
break;
default:
//APS排产池排产订单数量
this.$store.commit("setCountAps", this.$store.state.countAps + count);
}
},
//进入页面加载排产count-----
loadInitCount() {
let currentUserId = this.$store.state.userInfo.userId;
let para = { id: currentUserId };
Api.listbyuser(para).then((datas) => {
if (datas.success && datas.result && datas.result.length > 0) {
datas.result.forEach((dateScheduleId) => {
switch (dateScheduleId.apsScheduleId) {
case 1:
this.showAps = true;
break;
case 2:
this.showAll = true;
break;
case 3:
this.showRun = true;
break;
default:
this.showAi = true;
},
//移入排产成功后给标题增加数量
changeCountOut(type, count) {
switch (type) {
case 4: //智能排产池排产订单数量
this.$store.commit("setCountAi", this.$store.state.countAi + count);
break;
case 2: //整机排产池排产订单数量
this.$store.commit("setCountAll", this.$store.state.countAll + count);
break;
case 3: //流水排产池排产订单数量
this.$store.commit("setCountRun", this.$store.state.countRun + count);
break;
default:
//APS排产池排产订单数量
this.$store.commit("setCountAps", this.$store.state.countAps + count);
}
});
}
});
this.$store.commit("setCountAps", 0);
this.$store.commit("setCountAi", 0);
this.$store.commit("setCountAll", 0);
this.$store.commit("setCountRun", 0);
Api.getpoolordercount()
.then((res) => {
if (res.success && res.result.length > 1) {
res.result.forEach((data) => {
this.changeCountOut(data.poolType, data.count);
},
//进入页面加载排产count-----
loadInitCount() {
let currentUserId = this.$store.state.userInfo.userId;
let para = {
id: currentUserId
};
Api.listbyuser(para).then((datas) => {
if (datas.success && datas.result && datas.result.length > 0) {
datas.result.forEach((dateScheduleId) => {
switch (dateScheduleId.apsScheduleId) {
case 1:
this.showAps = true;
break;
case 2:
this.showAll = true;
break;
case 3:
this.showRun = true;
break;
default:
this.showAi = true;
}
});
}
});
}
})
.catch((err) => {
this.$Message.error("获取排产模型数量失败");
});
},
//配套申请
setName(v) {
let outPar = {
name: "",
color: "",
};
if ((v + "").indexOf(",") == -1) {
var item;
this.statuList.map((u) => {
if (u.code == v) {
item = u;
}
});
if (item) {
//this.items = item;
outPar = {
name: item.name,
color: item.color,
};
}
}
return outPar;
},
openAccessory(row) {
if (row.mainRoutingSetStatus != 1) {
this.$Message.error("请设置订单工艺!");
return;
} else {
this.orderId = row.id;
this.mesCode = row.mesCode;
this.productName = row.productName;
this.drawnNumber = row.drawnNumber;
this.count = row.quantity;
if (row.mainRoutingSetStatus == 1 && row.isSupportingFinish == 0) {
this.$Message.error("请去工艺设置生成料单!");
// this.title = "申请配套";
// this.details = () => import("./addAccessory");
} else {
this.title = "配套清单";
this.details = () => import("./editAccessory");
this.modalAccessory = true;
}
}
},
ok() {
this.modalAccessory = false;
this.curId = 0;
this.$store.commit("setCountAps", 0);
this.$store.commit("setCountAi", 0);
this.$store.commit("setCountAll", 0);
this.$store.commit("setCountRun", 0);
Api.getpoolordercount()
.then((res) => {
if (res.success && res.result && res.result.length > 0) {
res.result.forEach((data) => {
this.changeCountOut(data.poolType, data.count);
});
}
})
.catch((err) => {
this.$Message.error("获取排产池排产数量失败");
});
},
//配套申请
setName(v) {
let outPar = {
name: "",
color: "",
};
if ((v + "").indexOf(",") == -1) {
var item;
this.statuList.map((u) => {
if (u.code == v) {
item = u;
}
});
if (item) {
//this.items = item;
outPar = {
name: item.name,
color: item.color,
};
}
}
return outPar;
},
openAccessory(row) {
if (row.mainRoutingSetStatus != 1) {
this.$Message.error("请设置订单工艺!");
return;
} else {
this.orderId = row.id;
this.mesCode = row.mesCode;
this.productName = row.productName;
this.drawnNumber = row.drawnNumber;
this.count = row.quantity;
if (row.mainRoutingSetStatus == 1 && row.isSupportingFinish == 0) {
this.$Message.error("请去工艺设置生成料单!");
// this.title = "申请配套";
// this.details = () => import("./addAccessory");
} else {
this.title = "配套清单";
this.details = () => import("./editAccessory");
this.modalAccessory = true;
}
}
},
ok() {
this.modalAccessory = false;
this.curId = 0;
},
},
},
};
</script>
<style lang="less">
.footerSpan {
width: 120px;
width: 120px;
}
.demo-badge-alone {
background: #5cb85c !important;
background: #5cb85c !important;
}
.radioList {
margin: 10px 30px;
margin: 10px 30px;
}
.radioList label {
margin-top: 5px;
margin-top: 5px;
}
</style>
\ No newline at end of file
</style>
......@@ -297,11 +297,11 @@ export default {
type: "date"
},
{
key: "creatorUserId",
key: "creator",
title: this.$t("creatorUserId"),
align: "left",
high: true,
type: "user"
// type: "user"
},
{
key: "creationTime",
......@@ -310,22 +310,22 @@ export default {
high: true,
width: 180
},
{
key: "lastModifierUserId",
title: this.$t("lastModifierUserId"),
hide: true,
align: "left",
high: true,
type: "user"
},
{
key: "lastModificationTime",
title: this.$t("lastModificationTime"),
hide: true,
align: "center",
high: true,
width: 180
},
// {
// key: "lastModifierUserId",
// title: this.$t("lastModifierUserId"),
// hide: true,
// align: "left",
// high: true,
// type: "user"
// },
// {
// key: "lastModificationTime",
// title: this.$t("lastModificationTime"),
// hide: true,
// align: "center",
// high: true,
// width: 180
// },
{
title: "操作",
key: "action",
......
......@@ -366,10 +366,10 @@ export default {
overflow: hidden;
border: #cacbd0 dashed 1px;
img {
// width: 90px;
// height: 90px;
}
//img {
// width: 90px;
// height: 90px;
//}
}
.row {
......
<template>
<div id="flow">
<div id="flow">
<div id="myDiagramDiv" class="flex fd">
<div v-height="100" class="flex">
<div id="palette" class="fg"></div>
<div v-width="200" class="tr lh50">
<Button type="primary" class="mr10" @click="save" v-noClick>保存</Button>
<div v-height="100" class="flex">
<div id="palette" class="fg"></div>
<div v-width="200" class="tr lh50">
<Button type="primary" class="mr10" @click="save" v-noClick>保存</Button>
</div>
</div>
</div>
<div id="draw" class="fg"></div>
<div id="draw" class="fg"></div>
</div>
<Modal v-model="detailModal" title="节点属性设置" :width="800" footer-hide>
<component :is="detail" :eid="curId" :data="node" @on-ok="ok" />
<component :is="detail" :eid="curId" :data="node" @on-ok="ok" @on-close="close" />
</Modal>
</div>
</div>
</template>
<script>
......@@ -20,500 +20,539 @@ import Api from "@/plugins/request";
import go from "gojs";
let $ = go.GraphObject.make;
export default {
name: "",
data() {
return {
detailModal: false,
detail: null,
name: "",
data() {
return {
detailModal: false,
detail: null,
curId: -1,
node: null,
myDiagram: null
};
},
props: {
eid: String,
default: null
},
curId: -1,
node: null,
myDiagram: null
};
},
props: {
eid: String,
default: null
},
mounted() {
this.init();
this.load();
},
methods: {
init() {
// let theme = "black";
let theme = "#2d8cf0";
// fill: "#D1DEDC",
// stroke: "#DC3C00",
let select = $(
go.Adornment,
go.Panel.Auto,
// [2]
$(go.Shape, {
fill: null,
stroke: "black",
strokeWidth: 2,
strokeDashArray: [8, 2, 8, 2],
margin: 0
// padding:4
}),
mounted() {
this.init();
this.load();
},
methods: {
init() {
// let theme = "black";
let theme = "#2d8cf0";
// fill: "#D1DEDC",
// stroke: "#DC3C00",
let select = $(
go.Adornment,
go.Panel.Auto,
// [2]
$(go.Shape, {
fill: null,
stroke: "black",
strokeWidth: 2,
strokeDashArray: [8, 2, 8, 2],
margin: 0
// padding:4
}),
// [3]
// { width: 500, height: 200 }
$(go.Placeholder)
);
this.myDiagram = $(
go.Diagram,
"draw", // must name or refer to the DIV HTML element
{
LinkDrawn: showLinkLabel, // this DiagramEvent listener is defined below
LinkRelinked: showLinkLabel,
"undoManager.isEnabled": true, // enable undo & redo,
nodeSelectionAdornmentTemplate: select
}
);
// [3]
// { width: 500, height: 200 }
$(go.Placeholder)
);
this.myDiagram = $(
go.Diagram,
"draw", // must name or refer to the DIV HTML element
{
LinkDrawn: showLinkLabel, // this DiagramEvent listener is defined below
LinkRelinked: showLinkLabel,
"undoManager.isEnabled": true, // enable undo & redo,
nodeSelectionAdornmentTemplate: select
}
);
function nodeStyle() {
return [
// The Node.location comes from the "loc" property of the node data,
// converted by the Point.parse static method.
// If the Node.location is changed, it updates the "loc" property of the node data,
// converting back using the Point.stringify static method.
new go.Binding("location", "loc", go.Point.parse).makeTwoWay(
go.Point.stringify
),
{
// the Node.location is at the center of each node
locationSpot: go.Spot.Center
}
];
}
function nodeStyle() {
return [
// The Node.location comes from the "loc" property of the node data,
// converted by the Point.parse static method.
// If the Node.location is changed, it updates the "loc" property of the node data,
// converting back using the Point.stringify static method.
new go.Binding("location", "loc", go.Point.parse).makeTwoWay(
go.Point.stringify
),
{
// the Node.location is at the center of each node
locationSpot: go.Spot.Center
}
];
}
// Define a function for creating a "port" that is normally transparent.
// The "name" is used as the GraphObject.portId,
// the "align" is used to determine where to position the port relative to the body of the node,
// the "spot" is used to control how links connect with the port and whether the port
// stretches along the side of the node,
// and the boolean "output" and "input" arguments control whether the user can draw links from or to the port.
function makePort(name, align, spot, output, input) {
var horizontal =
align.equals(go.Spot.Top) || align.equals(go.Spot.Bottom);
// the port is basically just a transparent rectangle that stretches along the side of the node,
// and becomes colored when the mouse passes over it
return $(go.Shape, {
fill: "transparent", // changed to a color in the mouseEnter event handler
strokeWidth: 0, // no stroke
width: horizontal ? NaN : 8, // if not stretching horizontally, just 8 wide
height: !horizontal ? NaN : 8, // if not stretching vertically, just 8 tall
alignment: align, // align the port on the main Shape
stretch: horizontal
? go.GraphObject.Horizontal
: go.GraphObject.Vertical,
portId: name, // declare this object to be a "port"
fromSpot: spot, // declare where links may connect at this port
fromLinkable: output, // declare whether the user may draw links from here
toSpot: spot, // declare where links may connect at this port
toLinkable: input, // declare whether the user may draw links to here
cursor: "pointer", // show a different cursor to indicate potential link point
mouseEnter: function(e, port) {
// the PORT argument will be this Shape
if (!e.diagram.isReadOnly) port.fill = "rgba(15,0,25,0.5)";
},
mouseLeave: function(e, port) {
port.fill = "transparent";
// port.fill = "white";
}
});
}
// Define a function for creating a "port" that is normally transparent.
// The "name" is used as the GraphObject.portId,
// the "align" is used to determine where to position the port relative to the body of the node,
// the "spot" is used to control how links connect with the port and whether the port
// stretches along the side of the node,
// and the boolean "output" and "input" arguments control whether the user can draw links from or to the port.
function makePort(name, align, spot, output, input) {
var horizontal =
align.equals(go.Spot.Top) || align.equals(go.Spot.Bottom);
// the port is basically just a transparent rectangle that stretches along the side of the node,
// and becomes colored when the mouse passes over it
return $(go.Shape, {
fill: "transparent", // changed to a color in the mouseEnter event handler
strokeWidth: 0, // no stroke
width: horizontal ? NaN : 8, // if not stretching horizontally, just 8 wide
height: !horizontal ? NaN : 8, // if not stretching vertically, just 8 tall
alignment: align, // align the port on the main Shape
stretch: horizontal ?
go.GraphObject.Horizontal : go.GraphObject.Vertical,
portId: name, // declare this object to be a "port"
fromSpot: spot, // declare where links may connect at this port
fromLinkable: output, // declare whether the user may draw links from here
toSpot: spot, // declare where links may connect at this port
toLinkable: input, // declare whether the user may draw links to here
cursor: "pointer", // show a different cursor to indicate potential link point
mouseEnter: function (e, port) {
// the PORT argument will be this Shape
if (!e.diagram.isReadOnly) port.fill = "rgba(15,0,25,0.5)";
},
mouseLeave: function (e, port) {
port.fill = "transparent";
// port.fill = "white";
}
});
}
function textStyle(c) {
let color = c || "#f8f8f8";
return {
font: "14px Microsoft YaHei",
stroke: color
};
}
function textStyle(c) {
let color = c || "#f8f8f8";
return {
font: "14px Microsoft YaHei",
stroke: color
};
}
/*添加模版*/
this.myDiagram.nodeTemplateMap.add(
"", // the default category
$(
go.Node,
"Table",
nodeStyle(),
// the main object is a Panel that surrounds a TextBlock with a rectangular Shape
$(
go.Panel,
"Auto",
{
// resizable: true,
doubleClick: (e, obj) => {
this.show(obj.part.data);
}
},
$(
go.Shape,
"Rectangle",
{
fill: "white",
stroke: theme,
strokeWidth: 2,
minSize: new go.Size(80, 50)
},
new go.Binding("figure", "figure"),
new go.Binding("data")
),
$(
go.TextBlock,
textStyle(theme),
{
margin: 8,
maxSize: new go.Size(300, NaN),
wrap: go.TextBlock.WrapFit,
editable: false
},
new go.Binding("text").makeTwoWay()
)
),
// four named ports, one on each side:
makePort("T", go.Spot.Top, go.Spot.TopSide, false, true),
makePort("L", go.Spot.Left, go.Spot.LeftSide, true, true),
makePort("R", go.Spot.Right, go.Spot.RightSide, true, true),
makePort("B", go.Spot.Bottom, go.Spot.BottomSide, true, false)
)
);
/*添加模版*/
this.myDiagram.nodeTemplateMap.add(
"", // the default category
$(
go.Node,
"Table",
nodeStyle(),
// the main object is a Panel that surrounds a TextBlock with a rectangular Shape
$(
go.Panel,
"Auto", {
// resizable: true,
doubleClick: (e, obj) => {
this.show(obj.part.data);
}
},
$(
go.Shape,
"Rectangle", {
fill: "white",
stroke: theme,
strokeWidth: 2,
minSize: new go.Size(80, 50)
},
new go.Binding("figure", "figure"),
new go.Binding("data")
),
$(
go.TextBlock,
textStyle(theme), {
margin: 8,
maxSize: new go.Size(300, NaN),
wrap: go.TextBlock.WrapFit,
editable: false
},
new go.Binding("text").makeTwoWay()
)
),
// four named ports, one on each side:
makePort("T", go.Spot.Top, go.Spot.TopSide, false, true),
makePort("L", go.Spot.Left, go.Spot.LeftSide, true, true),
makePort("R", go.Spot.Right, go.Spot.RightSide, true, true),
makePort("B", go.Spot.Bottom, go.Spot.BottomSide, true, false)
)
);
this.myDiagram.nodeTemplateMap.add(
"Conditional",
$(
go.Node,
"Table",
nodeStyle(),
// the main object is a Panel that surrounds a TextBlock with a rectangular Shape
$(
go.Panel,
"Auto",
$(
go.Shape,
"Diamond",
{ fill: "#fff", stroke: theme, strokeWidth: 2 },
new go.Binding("figure", "figure")
),
$(
go.TextBlock,
textStyle(theme),
{
margin: 8,
maxSize: new go.Size(60, NaN),
wrap: go.TextBlock.WrapFit,
editable: false
},
new go.Binding("text").makeTwoWay()
)
),
// four named ports, one on each side:
makePort("T", go.Spot.Top, go.Spot.Top, false, true),
makePort("L", go.Spot.Left, go.Spot.Left, true, true),
makePort("R", go.Spot.Right, go.Spot.Right, true, true),
makePort("B", go.Spot.Bottom, go.Spot.Bottom, true, false)
)
);
this.myDiagram.nodeTemplateMap.add(
"Conditional",
$(
go.Node,
"Table",
nodeStyle(),
// the main object is a Panel that surrounds a TextBlock with a rectangular Shape
$(
go.Panel,
"Auto",
$(
go.Shape,
"Diamond", {
fill: "#fff",
stroke: theme,
strokeWidth: 2
},
new go.Binding("figure", "figure")
),
$(
go.TextBlock,
textStyle(theme), {
margin: 8,
maxSize: new go.Size(60, NaN),
wrap: go.TextBlock.WrapFit,
editable: false
},
new go.Binding("text").makeTwoWay()
)
),
// four named ports, one on each side:
makePort("T", go.Spot.Top, go.Spot.Top, false, true),
makePort("L", go.Spot.Left, go.Spot.Left, true, true),
makePort("R", go.Spot.Right, go.Spot.Right, true, true),
makePort("B", go.Spot.Bottom, go.Spot.Bottom, true, false)
)
);
this.myDiagram.nodeTemplateMap.add(
"Start",
$(
go.Node,
"Table",
nodeStyle(),
$(
go.Panel,
"Spot",
$(go.Shape, "Circle", {
desiredSize: new go.Size(60, 60),
fill: theme,
stroke: "#09d3ac",
strokeWidth: 0
}),
$(go.TextBlock, "开始", textStyle())
),
// three named ports, one on each side except the top, all output only:
makePort("L", go.Spot.Left, go.Spot.Left, true, false),
makePort("R", go.Spot.Right, go.Spot.Right, true, false),
makePort("B", go.Spot.Bottom, go.Spot.Bottom, true, false)
)
);
this.myDiagram.nodeTemplateMap.add(
"Start",
$(
go.Node,
"Table",
nodeStyle(),
$(
go.Panel,
"Spot",
$(go.Shape, "Circle", {
desiredSize: new go.Size(60, 60),
fill: theme,
stroke: "#09d3ac",
strokeWidth: 0
}),
$(go.TextBlock, "开始", textStyle())
),
// three named ports, one on each side except the top, all output only:
makePort("L", go.Spot.Left, go.Spot.Left, true, false),
makePort("R", go.Spot.Right, go.Spot.Right, true, false),
makePort("B", go.Spot.Bottom, go.Spot.Bottom, true, false)
)
);
this.myDiagram.nodeTemplateMap.add(
"End",
$(
go.Node,
"Table",
nodeStyle(),
$(
go.Panel,
"Spot",
$(go.Shape, "Circle", {
desiredSize: new go.Size(60, 60),
fill: "#D1DEDC",
stroke: "#DC3C00",
strokeWidth: 0
}),
$(go.TextBlock, "结束", textStyle("#909B9A"))
),
// three named ports, one on each side except the bottom, all input only:
makePort("T", go.Spot.Top, go.Spot.Top, false, true),
makePort("L", go.Spot.Left, go.Spot.Left, false, true),
makePort("R", go.Spot.Right, go.Spot.Right, false, true)
)
);
go.Shape.defineFigureGenerator("File", function(shape, w, h) {
var geo = new go.Geometry();
var fig = new go.PathFigure(0, 0, true); // starting point
geo.add(fig);
fig.add(new go.PathSegment(go.PathSegment.Line, 0.75 * w, 0));
fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.25 * h));
fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
var fig2 = new go.PathFigure(0.75 * w, 0, false);
geo.add(fig2);
// The Fold
fig2.add(new go.PathSegment(go.PathSegment.Line, 0.75 * w, 0.25 * h));
fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0.25 * h));
geo.spot1 = new go.Spot(0, 0.25);
geo.spot2 = go.Spot.BottomRight;
return geo;
});
this.myDiagram.nodeTemplateMap.add(
"Comment",
$(
go.Node,
"Auto",
nodeStyle(),
$(go.Shape, "File", {
fill: "#fff",
stroke: theme,
strokeWidth: 2
}),
$(
go.TextBlock,
textStyle(theme),
{
margin: 8,
maxSize: new go.Size(200, NaN),
wrap: go.TextBlock.WrapFit,
textAlign: "center",
editable: false
},
new go.Binding("text").makeTwoWay()
)
// no ports, because no links are allowed to connect with a comment
)
);
this.myDiagram.nodeTemplateMap.add(
"End",
$(
go.Node,
"Table",
nodeStyle(),
$(
go.Panel,
"Spot",
$(go.Shape, "Circle", {
desiredSize: new go.Size(60, 60),
fill: "#D1DEDC",
stroke: "#DC3C00",
strokeWidth: 0
}),
$(go.TextBlock, "结束", textStyle("#909B9A"))
),
// three named ports, one on each side except the bottom, all input only:
makePort("T", go.Spot.Top, go.Spot.Top, false, true),
makePort("L", go.Spot.Left, go.Spot.Left, false, true),
makePort("R", go.Spot.Right, go.Spot.Right, false, true)
)
);
go.Shape.defineFigureGenerator("File", function (shape, w, h) {
var geo = new go.Geometry();
var fig = new go.PathFigure(0, 0, true); // starting point
geo.add(fig);
fig.add(new go.PathSegment(go.PathSegment.Line, 0.75 * w, 0));
fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.25 * h));
fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
var fig2 = new go.PathFigure(0.75 * w, 0, false);
geo.add(fig2);
// The Fold
fig2.add(new go.PathSegment(go.PathSegment.Line, 0.75 * w, 0.25 * h));
fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0.25 * h));
geo.spot1 = new go.Spot(0, 0.25);
geo.spot2 = go.Spot.BottomRight;
return geo;
});
this.myDiagram.nodeTemplateMap.add(
"Comment",
$(
go.Node,
"Auto",
nodeStyle(),
$(go.Shape, "File", {
fill: "#fff",
stroke: theme,
strokeWidth: 2
}),
$(
go.TextBlock,
textStyle(theme), {
margin: 8,
maxSize: new go.Size(200, NaN),
wrap: go.TextBlock.WrapFit,
textAlign: "center",
editable: false
},
new go.Binding("text").makeTwoWay()
)
// no ports, because no links are allowed to connect with a comment
)
);
// replace the default Link template in the linkTemplateMap
this.myDiagram.linkTemplate = $(
go.Link, // the whole link panel
{
routing: go.Link.AvoidsNodes,
curve: go.Link.JumpOver,
corner: 5,
toShortLength: 4,
relinkableFrom: true,
relinkableTo: true,
reshapable: true,
resegmentable: true,
// replace the default Link template in the linkTemplateMap
this.myDiagram.linkTemplate = $(
go.Link, // the whole link panel
{
routing: go.Link.AvoidsNodes,
curve: go.Link.JumpOver,
corner: 5,
toShortLength: 4,
relinkableFrom: true,
relinkableTo: true,
reshapable: true,
resegmentable: true,
// mouse-overs subtly highlight links:
mouseEnter: function(e, link) {
link.findObject("HIGHLIGHT").stroke = "rgba(30,144,255,0.2)";
},
mouseLeave: function(e, link) {
link.findObject("HIGHLIGHT").stroke = "transparent";
},
selectionAdorned: false
},
new go.Binding("points").makeTwoWay(),
$(
go.Shape, // the highlight shape, normally transparent
{
isPanelMain: true,
strokeWidth: 8,
stroke: "transparent",
fill: theme,
name: "HIGHLIGHT"
}
),
$(
go.Shape, // the link path shape
{ isPanelMain: true, stroke: theme, strokeWidth: 2 },
new go.Binding("stroke", "isSelected", function(sel) {
return sel ? "dodgerblue" : theme;
}).ofObject()
),
$(
go.Shape, // the "from" end arrowhead
{ fromArrow: "Circle", fill: "#fff", strokeWidth: 2, stroke: theme }
),
$(
go.Shape, // the arrowhead
{ toArrow: "standard", strokeWidth: 2, fill: theme, stroke: theme }
),
$(
go.Panel,
"Auto", // the link label, normally not visible
{
visible: false,
name: "LABEL",
segmentIndex: 2,
segmentFraction: 0.5
},
new go.Binding("visible", "visible").makeTwoWay(),
$(
go.Shape,
"RoundedRectangle", // the label shape
{ fill: "#F8F8F8", strokeWidth: 0 }
),
$(
go.TextBlock,
"Yes", // the label
{
textAlign: "center",
font: "10pt helvetica, arial, sans-serif",
stroke: "#333333",
editable: false
},
new go.Binding("text").makeTwoWay()
)
)
);
function showLinkLabel(e) {
var label = e.subject.findObject("LABEL");
if (label !== null)
label.visible = e.subject.fromNode.data.category === "Conditional";
}
this.myDiagram.toolManager.linkingTool.temporaryLink.routing =
go.Link.Orthogonal;
this.myDiagram.toolManager.relinkingTool.temporaryLink.routing =
go.Link.Orthogonal;
this.myPalette = $(
go.Palette,
"palette", // must name or refer to the DIV HTML element
{
// Instead of the default animation, use a custom fade-down
"animationManager.initialAnimationStyle": go.AnimationManager.None,
InitialAnimationStarting: animateFadeDown, // Instead, animate with this function
// mouse-overs subtly highlight links:
mouseEnter: function (e, link) {
link.findObject("HIGHLIGHT").stroke = "rgba(30,144,255,0.2)";
},
mouseLeave: function (e, link) {
link.findObject("HIGHLIGHT").stroke = "transparent";
},
selectionAdorned: false
},
new go.Binding("points").makeTwoWay(),
$(
go.Shape, // the highlight shape, normally transparent
{
isPanelMain: true,
strokeWidth: 8,
stroke: "transparent",
fill: theme,
name: "HIGHLIGHT"
}
),
$(
go.Shape, // the link path shape
{
isPanelMain: true,
stroke: theme,
strokeWidth: 2
},
new go.Binding("stroke", "isSelected", function (sel) {
return sel ? "dodgerblue" : theme;
}).ofObject()
),
$(
go.Shape, // the "from" end arrowhead
{
fromArrow: "Circle",
fill: "#fff",
strokeWidth: 2,
stroke: theme
}
),
$(
go.Shape, // the arrowhead
{
toArrow: "standard",
strokeWidth: 2,
fill: theme,
stroke: theme
}
),
$(
go.Panel,
"Auto", // the link label, normally not visible
{
visible: false,
name: "LABEL",
segmentIndex: 2,
segmentFraction: 0.5
},
new go.Binding("visible", "visible").makeTwoWay(),
$(
go.Shape,
"RoundedRectangle", // the label shape
{
fill: "#F8F8F8",
strokeWidth: 0
}
),
$(
go.TextBlock,
"Yes", // the label
{
textAlign: "center",
font: "10pt helvetica, arial, sans-serif",
stroke: "#333333",
editable: false
},
new go.Binding("text").makeTwoWay()
)
)
);
nodeTemplateMap: this.myDiagram.nodeTemplateMap, // share the templates used by myDiagram
nodeSelectionAdornmentTemplate: select,
model: new go.GraphLinksModel([
// specify the contents of the Palette
{ category: "Start", text: "开始" },
{ text: "节点" },
{ category: "Conditional", text: "条件" },
{ category: "End", text: "结束" },
{ category: "Comment", text: "备注" }
])
}
);
function showLinkLabel(e) {
var label = e.subject.findObject("LABEL");
if (label !== null)
label.visible = e.subject.fromNode.data.category === "Conditional";
}
this.myDiagram.toolManager.linkingTool.temporaryLink.routing =
go.Link.Orthogonal;
this.myDiagram.toolManager.relinkingTool.temporaryLink.routing =
go.Link.Orthogonal;
this.myPalette = $(
go.Palette,
"palette", // must name or refer to the DIV HTML element
{
// Instead of the default animation, use a custom fade-down
"animationManager.initialAnimationStyle": go.AnimationManager.None,
InitialAnimationStarting: animateFadeDown, // Instead, animate with this function
this.myDiagram.addModelChangedListener(evt => {
if (!evt.isTransactionFinished) return;
var txn = evt.object; // a Transaction
if (txn === null) return;
// iterate over all of the actual ChangedEvents of the Transaction
txn.changes.each(function(e) {
// ignore any kind of change other than adding/removing a node
if (e.modelChange !== "nodeDataArray") return;
// record node insertions and removals
if (e.change === go.ChangedEvent.Insert) {
console.log(
evt.propertyName + " added node with key: " + e.newValue.key
);
} else if (e.change === go.ChangedEvent.Remove) {
console.log(
evt.propertyName + " removed node with key: " + e.oldValue.key
nodeTemplateMap: this.myDiagram.nodeTemplateMap, // share the templates used by myDiagram
nodeSelectionAdornmentTemplate: select,
model: new go.GraphLinksModel([
// specify the contents of the Palette
{
category: "Start",
text: "开始"
},
{
text: "节点"
},
{
category: "Conditional",
text: "条件"
},
{
category: "End",
text: "结束"
},
{
category: "Comment",
text: "备注"
}
])
}
);
}
});
});
function animateFadeDown(e) {
var diagram = e.diagram;
var animation = new go.Animation();
animation.isViewportUnconstrained = true; // So Diagram positioning rules let the animation start off-screen
animation.easing = go.Animation.EaseOutExpo;
animation.duration = 900;
// Fade "down", in other words, fade in from above
animation.add(
diagram,
"position",
diagram.position.copy().offset(0, 200),
diagram.position
);
animation.add(diagram, "opacity", 0, 1);
animation.start();
}
// this.load();
},
load() {
Api.get(`${workflowUrl}/schema/get`, { id: this.eid }).then(r => {
console.warn(r);
// this.myDiagram.model=go.Model.fromJson(r.content);
var data = r.result.content || `{}`;
// this.init(data)
// this.init(data)
this.myDiagram.model = go.Model.fromJson(data);
});
},
save() {
let content = this.myDiagram.model.toJson();
Api.post(`${workflowUrl}/schema/design`, {
id: this.eid,
name: "",
content
}).then(r => {
if (r.success) {
this.$Message.success("保存成功!");
this.load();
this.myDiagram.addModelChangedListener(evt => {
if (!evt.isTransactionFinished) return;
var txn = evt.object; // a Transaction
if (txn === null) return;
// iterate over all of the actual ChangedEvents of the Transaction
txn.changes.each(function (e) {
// ignore any kind of change other than adding/removing a node
if (e.modelChange !== "nodeDataArray") return;
// record node insertions and removals
if (e.change === go.ChangedEvent.Insert) {
console.log(
evt.propertyName + " added node with key: " + e.newValue.key
);
} else if (e.change === go.ChangedEvent.Remove) {
console.log(
evt.propertyName + " removed node with key: " + e.oldValue.key
);
}
});
});
function animateFadeDown(e) {
var diagram = e.diagram;
var animation = new go.Animation();
animation.isViewportUnconstrained = true; // So Diagram positioning rules let the animation start off-screen
animation.easing = go.Animation.EaseOutExpo;
animation.duration = 900;
// Fade "down", in other words, fade in from above
animation.add(
diagram,
"position",
diagram.position.copy().offset(0, 200),
diagram.position
);
animation.add(diagram, "opacity", 0, 1);
animation.start();
}
// this.load();
},
load() {
Api.get(`${workflowUrl}/schema/get`, {
id: this.eid
}).then(r => {
console.warn(r);
// this.myDiagram.model=go.Model.fromJson(r.content);
var data = r.result.content || `{}`;
// this.init(data)
// this.init(data)
this.myDiagram.model = go.Model.fromJson(data);
});
},
save() {
let content = this.myDiagram.model.toJson();
Api.post(`${workflowUrl}/schema/design`, {
id: this.eid,
name: "",
content
}).then(r => {
if (r.success) {
this.$Message.success("保存成功!");
this.load();
}
});
},
show(data) {
if (data.id) {
this.detailModal = true;
this.node = data;
this.curId = data.id;
this.detail = () => import("./edit");
} else {
this.$Message.warning("请先保存流程设计!");
}
},
ok(node) {
if (node.name != this.node.text) {
this.node.text = node.name;
var nodeData = this.myDiagram.model.findNodeDataForKey(this.node.key);
nodeData.text = node.name;
this.myDiagram.model.updateTargetBindings(nodeData);
}
this.detailModal = false;
this.detail = null;
this.curId = -1;
},
close() {
this.detailModal = false;
this.detail = null;
this.curId = -1;
}
});
},
show(data) {
if (data.id) {
this.detailModal = true;
this.node = data;
this.curId = data.id;
this.detail = () => import("./edit");
} else {
this.$Message.warning("请先保存流程设计!");
}
},
ok(node) {
if (node.name != this.node.text) {
this.node.text = node.name;
var nodeData = this.myDiagram.model.findNodeDataForKey(this.node.key);
nodeData.text = node.name;
this.myDiagram.model.updateTargetBindings(nodeData);
}
this.detailModal = false;
this.detail = null;
this.curId = -1;
}
}
};
</script>
<style lang="less">
#flow {
// background:#a7a7a7;
margin: -16px;
padding: 0 10px;
canvas:focus {
outline: 0;
}
#myDiagramDiv {
height: calc(100vh - 51px);
display: flex;
}
// background:#a7a7a7;
margin: -16px;
padding: 0 10px;
canvas:focus {
outline: 0;
}
#myDiagramDiv {
height: calc(100vh - 51px);
display: flex;
}
}
</style>
\ No newline at end of file
</style>
<template>
<div class="Design">
<div class="Design">
<Timeline>
<TimelineItem v-for="(node,i) in nodes" :key="node.id">
<Badge :count="i+1" type="primary" slot="dot"></Badge>
<div class="node" @click="edit(node.id,i)">
<div class="title">
<a>
{{node.name}}
&nbsp;(
<state code="workflow.form.audit.type" :value="node.operation" />)
<Icon type="md-build" />
<Icon v-if="node.isFixed" type="ios-lock" color="orange" title="人员固定"/>
</a>
</div>
<div v-if="node.userIds&&node.userIds.length>0">
审批人:
<User v-for="(item,j) in node.userIds" :value="item" class="ml10" :key="j" />
</div>
<div v-if="node.roleList&&node.roleList.length>0">
审批角色:
<span
v-for="(role,k) in node.roleList"
class="mr10"
>{{role.name}}({{role.userIdList.length}})</span>
</div>
</div>
</TimelineItem>
<TimelineItem v-for="(node,i) in nodes" :key="node.id">
<Badge :count="i+1" type="primary" slot="dot"></Badge>
<div class="node" @click="edit(node.id,i)">
<div class="title">
<a>
{{node.name}}
&nbsp;(
<state code="workflow.form.audit.type" :value="node.operation" />)
<Icon type="md-build" />
<Icon v-if="node.isFixed" type="ios-lock" color="orange" title="人员固定" />
</a>
</div>
<div v-if="node.userIds&&node.userIds.length>0">
审批人:
<User v-for="(item,j) in node.userIds" :value="item" class="ml10" :key="j" />
</div>
<div v-if="node.roleList&&node.roleList.length>0">
审批角色:
<span v-for="(role,k) in node.roleList" class="mr10">{{role.name}}({{role.userIdList.length}})</span>
</div>
</div>
</TimelineItem>
</Timeline>
<Modal v-model="editModal" title="编辑" footer-hide width="800">
<Edit :eid="curId" @on-close="cancel" @on-ok="addOk" />
<Edit :eid="curId" @on-close="cancel" @on-ok="addOk" />
</Modal>
<Modal v-model="startModal" title="开始节点编辑" footer-hide width="800">
<StartEdit :eid="startId" @on-close="cancel" @on-ok="addOk" />
<StartEdit :eid="startId" @on-close="cancel" @on-ok="addOk" />
</Modal>
</div>
</div>
</template>
<script>
import Api from './api'
import Edit from './node'
import StartEdit from './node/start'
export default {
name: 'Design',
data() {
return {
editModal: false,
entity: {},
nodes: [],
curId: 0,
startId: 0,
startModal: false
}
},
components: {
Edit,
StartEdit
},
props: {
eid: String
},
async fetch({ store, params }) {
await store.dispatch('loadDictionary') // 加载数据字典
},
mounted(){
this.load(this.eid)
},
methods: {
load(v) {
alert(v)
Api.detail({ id: v }).then((r) => {
this.nodes = r.result.nodes
// this.$emit('on-load')
})
name: 'Design',
data() {
return {
editModal: false,
entity: {},
nodes: [],
curId: 0,
startId: 0,
startModal: false
}
},
edit(id, i) {
if (i== 0) {
this.startModal=true
this.startId=id;
} else {
this.editModal = true
this.curId = id
}
components: {
Edit,
StartEdit
},
handleClose() {
this.$emit('on-close')
props: {
eid: String
},
cancel() {
this.editModal = false
this.startModal = false
async fetch({
store,
params
}) {
await store.dispatch('loadDictionary') // 加载数据字典
},
addOk() {
this.curId = 0
this.editModal = false
this.startId = 0
this.startModal = false
this.load(this.eid)
mounted() {
this.load(this.eid)
},
l(key) {
key = 'instance' + '.' + key
return this.$t(key)
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v)
}
methods: {
load(v) {
//alert(v)
Api.detail({
id: v
}).then((r) => {
this.nodes = r.result.nodes
// this.$emit('on-load')
})
},
edit(id, i) {
if (i == 0) {
this.startModal = true
this.startId = id;
} else {
this.editModal = true
this.curId = id
}
},
handleClose() {
this.$emit('on-close')
},
cancel() {
this.editModal = false
this.startModal = false
},
addOk() {
this.curId = 0
this.editModal = false
this.startId = 0
this.startModal = false
this.load(this.eid)
},
l(key) {
key = 'instance' + '.' + key
return this.$t(key)
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v)
}
}
}
}
}
</script>
<style lang="less">
.Design {
background: white;
padding: 20px 50px;
.node {
.title {
font-size: 14px;
font-weight: bold;
.auditedTime {
font-size: 12px;
color: #ddd;
}
background: white;
padding: 20px 50px;
.node {
.title {
font-size: 14px;
font-weight: bold;
.auditedTime {
font-size: 12px;
color: #ddd;
}
}
}
}
}
</style>
\ No newline at end of file
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment