Commit 695863e3 authored by renjintao's avatar renjintao

on-selection-change

parent d97107be
<template> <template>
<div> <div>
<DataGrid <DataGrid :columns="columns" ref="grid" :draggable="true" :data="list" :high="false" @on-drag-drop="onDragDrop" :page="false" @on-selection-change="onSelect" :batch="true" :border="true" :easy="true">
:columns="columns" <template slot="easySearch">
ref="grid" <div>
:draggable="true" <Select placeholder="选择排序优先级" v-model="tempValue" style="width: 150px;" @on-change="tempValueChange" clearable>
:data="list" <Option v-for="(item,index) in listTemp" :key="index" :value="item.id" :label="item.name"></Option>
:high="false" </Select>
@on-drag-drop="onDragDrop" <a style="font-weight: bold;" @click="openaddModalTemp">
:page="false" <Icon type="md-color-palette" size="14" />&nbsp;自定义排序模板
@on-change="onSelect" </a>
:batch="true" <a style="font-weight: bold;" @click="openDuration">
:border="true" <Icon type="md-create" size="14" />&nbsp;修改外协工期
:easy="true" </a>
> <Select placeholder="选择历史方案" style="width: 150px;"></Select>
<template slot="easySearch"> </div>
<div> </template>
<Select <template slot="searchBack"></template>
placeholder="选择排序优先级" <template slot="searchForm">
v-model="tempValue" <Search />
style="width: 150px;" </template>
@on-change="tempValueChange" <template slot="buttons">
clearable <DatePicker type="date" placeholder="设置基准日期" style="width: 150px;" v-model="entity.setTime" @on-change="getTime"></DatePicker>
> <a style="font-weight: bold;" @click="openAddModel(1)">
<Option <Icon type="ios-options" size="14" />&nbsp;工序参数调整
v-for="(item,index) in listTemp" </a>
:key="index" <Button type="primary" @click="goResults" style="background:#515A6E;border:solid 1px #515A6E">历史方案</Button>
:value="item.id" <Button type="primary" @click="openApsModal">APS排产</Button>
:label="item.name" </template>
></Option> <template slot="batch">
</Select> <Button type="primary" class="mr10 ml10" @click="removeOk">移出排产</Button>
<a style="font-weight: bold;" @click="openaddModalTemp"> </template>
<Icon type="md-color-palette" size="14" />&nbsp;自定义排序模板
</a>
<a style="font-weight: bold;" @click="openDuration">
<Icon type="md-create" size="14" />&nbsp;修改外协工期
</a>
<Select placeholder="选择历史方案" style="width: 150px;"></Select>
</div>
</template>
<template slot="searchBack"></template>
<template slot="searchForm">
<Search />
</template>
<template slot="buttons">
<DatePicker
type="date"
placeholder="设置基准日期"
style="width: 150px;"
v-model="entity.setTime"
@on-change="getTime"
></DatePicker>
<a style="font-weight: bold;" @click="openAddModel(1)">
<Icon type="ios-options" size="14" />&nbsp;工序参数调整
</a>
<Button
type="primary"
@click="goResults"
style="background:#515A6E;border:solid 1px #515A6E"
>历史方案</Button>
<Button type="primary" @click="openApsModal">APS排产</Button>
</template>
<template slot="batch">
<Button type="primary" class="mr10 ml10" @click="removeOk">移出排产</Button>
</template>
</DataGrid> </DataGrid>
<Modal v-model="addModalTemp" title="自定义排序模板" footer-hide width="1000" class="tempModal"> <Modal v-model="addModalTemp" title="自定义排序模板" footer-hide width="1000" class="tempModal">
<Temp :data="listTemp" ref="tempRef"></Temp> <Temp :data="listTemp" ref="tempRef"></Temp>
</Modal> </Modal>
<Modal v-model="modalDuration" title="外协任务" footer-hide width="1000"> <Modal v-model="modalDuration" title="外协任务" footer-hide width="1000">
<Duration ref="durationRef"></Duration> <Duration ref="durationRef"></Duration>
</Modal> </Modal>
<Modal v-model="addModal" title="工序参数设置" footer-hide width="1000"> <Modal v-model="addModal" title="工序参数设置" footer-hide width="1000">
<Add <Add @on-close="cancel" @on-parameter-ok="addOk" :opTaskPk="setParams.opTaskPk" :partTaskPk="setParams.partTaskPk" :taskSeq="setParams.taskSeq" :count="setParams.count" />
@on-close="cancel"
@on-parameter-ok="addOk"
:opTaskPk="setParams.opTaskPk"
:partTaskPk="setParams.partTaskPk"
:taskSeq="setParams.taskSeq"
:count="setParams.count"
/>
</Modal> </Modal>
<Modal v-model="apsModal" title="确定APS排产" @on-ok="apsOk" @on-cancel="cancel"> <Modal v-model="apsModal" title="确定APS排产" @on-ok="apsOk" @on-cancel="cancel">
<p>确定进行APS排产?</p> <p>确定进行APS排产?</p>
</Modal> </Modal>
<!-- <Modal v-model="resultModal" title="数据检查" width="1500" @on-ok="checkOk" @on-cancel="cancel"> <!-- <Modal v-model="resultModal" title="数据检查" width="1500" @on-ok="checkOk" @on-cancel="cancel">
<CheckResult :data="result"></CheckResult> <CheckResult :data="result"></CheckResult>
</Modal> --> </Modal> -->
<Modal v-model="resultModal" title="数据检查" width="1500" @on-ok="cancel" @on-cancel="cancel"> <Modal v-model="resultModal" title="数据检查" width="1500" @on-ok="cancel" @on-cancel="cancel">
<CheckResult :data="result"></CheckResult> <CheckResult :data="result"></CheckResult>
</Modal> </Modal>
<Modal v-model="apsCheckModal" title="确定APS排产" @on-ok="apsCheckOk" @on-cancel="cancel"> <Modal v-model="apsCheckModal" title="确定APS排产" @on-ok="apsCheckOk" @on-cancel="cancel">
<p>已有排产方案,是否移出排产池?</p> <p>已有排产方案,是否移出排产池?</p>
</Modal> </Modal>
<Modal v-model="circleModal" title footer-hide :mask-closable="false"> <Modal v-model="circleModal" title footer-hide :mask-closable="false">
<div slot="close"></div> <div slot="close"></div>
<Row> <Row>
<Col class="demo-spin-col" span="24"> <Col class="demo-spin-col" span="24">
<Spin fix> <Spin fix>
<Icon type="ios-loading" size="36" class="demo-spin-icon-load"></Icon> <Icon type="ios-loading" size="36" class="demo-spin-icon-load"></Icon>
<div>APS排产进行中......</div> <div>APS排产进行中......</div>
</Spin> </Spin>
</Col> </Col>
</Row> </Row>
</Modal> </Modal>
<Modal v-model="insertlModal1" :title="insertTItle1" @on-ok="insertOk1" @on-cancel="cancel"> <Modal v-model="insertlModal1" :title="insertTItle1" @on-ok="insertOk1" @on-cancel="cancel">
<p>确定进行 {{ insertTItle1 }} 操作?</p> <p>确定进行 {{ insertTItle1 }} 操作?</p>
</Modal> </Modal>
</div> </div>
</template> </template>
<script> <script>
var myDate = new Date(); var myDate = new Date();
var nowDate = myDate.getFullYear() + "-" + (myDate.getMonth() + 1) + "-" + myDate.getDate(); var nowDate = myDate.getFullYear() + "-" + (myDate.getMonth() + 1) + "-" + myDate.getDate();
...@@ -118,708 +79,729 @@ import Duration from "./duration"; ...@@ -118,708 +79,729 @@ import Duration from "./duration";
import Expand from "./components/excute"; import Expand from "./components/excute";
import CheckResult from "./components/check"; import CheckResult from "./components/check";
export default { export default {
name: "list", name: "list",
components: { components: {
Add, Add,
Expand, Expand,
Temp, Temp,
Duration, Duration,
CheckResult CheckResult
}, },
data() { data() {
return { return {
action: Api.index, action: Api.index,
easySearch: { easySearch: {
keys: { op: "notes", value: null } keys: {
}, op: "notes",
result: { value: null
res: true, }
datas: '{}' },
}, result: {
resultModal: false, res: true,
entity: { datas: '{}'
setTime:this.getFormatDate(nowDate) },
}, resultModal: false,
addModal: false, entity: {
editModal: false, setTime: this.getFormatDate(nowDate)
detailModal: false, },
deletelModal: false, addModal: false,
apsModal: false, editModal: false,
addModalTemp: false, detailModal: false,
modalDuration: false, deletelModal: false,
insertlModal1: false, apsModal: false,
apsCheckModal: false, addModalTemp: false,
tempParams: null, modalDuration: false,
insertTItle1: "插单", insertlModal1: false,
rowIndex1: null, apsCheckModal: false,
list: [], tempParams: null,
curId: 0, insertTItle1: "插单",
columns: [ rowIndex1: null,
{ list: [],
key: "move", curId: 0,
title: " ", columns: [{
hide: false, key: "move",
align: "center", title: " ",
width: 30, hide: false,
render: (h, params) => { align: "center",
return h("Icon", { width: 30,
attrs: { render: (h, params) => {
type: "md-more", return h("Icon", {
size: 18 attrs: {
}, type: "md-more",
class: "drag" size: 18
},
class: "drag"
});
}
},
{
type: "expand",
width: 50,
render: (h, params) => {
return h(Expand, {
props: {
rowId: params.row.part_task_pk
}
});
}
},
{
key: "selection",
type: "selection",
width: 50,
align: "center"
},
{
key: "id",
title: this.l("id"),
hide: true,
align: "left",
sortable: true,
width: 50
},
{
key: "insert_flag",
title: this.l("insert_flag"),
align: "center",
width: 70,
high: true,
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-water" :
"ios-water-outline",
size: 20,
color: params.row.insert_flag == 1 ? "#2680EB" : "#aaa"
},
on: {
click: () =>
this.changeFlag1(params.row.part_task_pk, params.index)
}
})
]
);
}
},
{
key: "mesCode",
title: this.l("mes_code"),
align: "left",
high: true,
width: 240
},
{
key: "product_name",
title: this.l("product_name"),
align: "left",
high: true
},
{
key: "drawingnum",
title: this.l("drawingnum"),
align: "left",
high: true
},
{
key: "project_no",
title: this.l("project_no"),
align: "left",
high: true
},
{
key: "batchnum",
title: this.l("batchnum"),
align: "left",
high: true
},
{
key: "urgency_level",
title: this.l("urgency_level"),
align: "left",
high: true,
code: "plan.order.urgencyLevel",
width: 100
},
{
key: "priority",
title: this.l("priority"),
align: "left",
high: true,
hide: true,
render: (h, params) => {
return h("span", {}, params.index + 1);
}
},
{
key: "plan_qty",
title: this.l("plan_qty"),
align: "right",
width: 100,
high: true
},
{
key: "spare_qty",
title: this.l("spare_qty"),
align: "right",
width: 100,
high: true,
hide: true
},
{
key: "plan_start",
title: this.l("plan_start"),
align: "center",
high: true,
hide: true,
resizable: true,
width: 150
},
{
key: "plan_finish",
title: this.l("plan_finish"),
align: "center",
high: true,
hide: true,
sortable: true,
resizable: true,
width: 150
},
{
key: "notes",
title: this.l("notes"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "demand_start",
title: this.l("demand_start"),
align: "center",
resizable: true,
width: 150,
type: "date"
},
{
key: "demand_finish",
title: this.l("demand_finish"),
align: "center",
high: true,
resizable: true,
width: 150,
type: "date"
},
{
key: "badjustflag",
title: this.l("badjustflag"),
align: "left",
high: true,
hide: true
},
{
title: "操作",
key: "action",
width: 140,
align: "center",
// fixed:"right",
render: (h, params) => {
return h("div", {
class: "action"
}, [
h("op", {
attrs: {
icon: "md-options",
type: "icon",
title: "工序参数设置",
oprate: "edit"
},
on: {
click: () => this.openAddModel(2, params.row)
}
}),
h("op", {
attrs: {
icon: "md-refresh",
type: "icon",
title: "恢复工序",
oprate: "edit",
msg: "确认要恢复工序吗?"
},
on: {
click: () => this.refresh(params.row.part_task_pk)
}
}),
h("op", {
attrs: {
icon: "ios-trash",
type: "icon",
title: "移出排产池",
oprate: "delete",
msg: "确认要移出排产吗?"
},
on: {
click: () => this.remove(params.row.part_task_pk)
}
})
]);
}
}
],
arrPartPkId: [],
//设置参数开始
setParams: {
opTaskPk: 0, //工单ID
partTaskPk: 0, //生产计划ID
taskSeq: "", //工序编号
count: 0 //生产计划数量
},
//设置参数结束
circleModal: false, //进度条
listTemp: [], //自定义模板排序下拉框列表
tempValue: null,
tempStatu: 0 //新建模型时传过来的id值
};
},
mounted() {
this.loadList();
this.loadTemp();
},
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
//排产池加载数据列表
loadList() {
Api.getall().then(res => {
if (res.success) {
this.list = res.result;
}
}); });
}
}, },
{ loadTemp() {
type: "expand", Api.getdropsortlist().then(resDrop => {
width: 50, //加载排序模板列表
render: (h, params) => { if (resDrop.success) {
return h(Expand, { this.listTemp = resDrop.result;
props: { }
rowId: params.row.part_task_pk
}
}); });
}
},
{
key: "selection",
type: "selection",
width: 50,
align: "center"
}, },
{
key: "id", addOk() {
title: this.l("id"), this.list = [];
hide: true, this.loadList();
align: "left", this.addModal = false;
sortable: true, this.detailModal = false;
width: 50 this.editModal = false;
}, this.curId = 0;
{
key: "insert_flag",
title: this.l("insert_flag"),
align: "center",
width: 70,
high: true,
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-water"
: "ios-water-outline",
size: 20,
color: params.row.insert_flag == 1 ? "#2680EB" : "#aaa"
},
on: {
click: () =>
this.changeFlag1(params.row.part_task_pk, params.index)
}
})
]
);
}
}, },
{ detail(id) {
key: "mesCode", this.detailModal = true;
title: this.l("mes_code"), this.curId = id;
align: "left",
high: true,
width: 240
}, },
{ edit(id) {
key: "product_name", this.editModal = true;
title: this.l("product_name"), this.curId = id;
align: "left",
high: true
}, },
{ refresh(partPkId) {
key: "drawingnum", //恢复工序
title: this.l("drawingnum"), let params = {
align: "left", id: partPkId
high: true };
Api.recoveryoptasksimluate(params).then(r => {
if (r.success) {
this.$Message.success("恢复成功");
this.list = [];
this.loadList();
}
});
}, },
{ remove(partPkId) {
key: "project_no", //移出排产池
title: this.l("project_no"), this.tempParams = null;
align: "left", let paramsArry = [];
high: true if (partPkId.constructor == Array) {
paramsArry = partPkId;
} else {
paramsArry.push(partPkId);
}
let params = {
partPks: paramsArry
};
Api.beforeshiftoutapspool(params)
.then(res => {
if (res.success) {
if (res.result) {
this.checkapspool(params);
} else {
this.tempParams = null;
this.tempParams = params;
this.apsCheckModal = true;
}
} else {
this.$Message.error("校验失败");
}
})
.catch(err => {
this.$Message.error("连接错误1");
});
}, },
{ apsCheckOk() {
key: "batchnum", this.checkapspool(this.tempParams);
title: this.l("batchnum"),
align: "left",
high: true
}, },
{ checkapspool(params) {
key: "urgency_level", Api.shiftoutapspool(params)
title: this.l("urgency_level"), .then(r => {
align: "left", if (r.success) {
high: true, this.$Message.success("移出排产池操作成功");
code: "plan.order.urgencyLevel", this.loadList();
width: 100 //移出排产后将aps对应的store数量去掉
this.$store.commit(
"setCountAps",
this.$store.state.countAps - params.partPks.length
);
} else {
this.$Message.error("移出排产池操作失败");
}
})
.catch(err => {
this.$Message.error("连接失败2");
});
}, },
{ onSelect(a, b) {
key: "priority", //批量选择
title: this.l("priority"), let selectRows = a;
align: "left", this.arrPartPkId = [];
high: true, selectRows.forEach(e => {
hide: true, this.arrPartPkId.push(e.part_task_pk);
render: (h, params) => { });
return h("span", {}, params.index + 1);
}
}, },
{ removeOk() {
key: "plan_qty", //批量选择移出排产池
title: this.l("plan_qty"), this.remove(this.arrPartPkId);
align: "right",
width: 100,
high: true
}, },
{ removeCancel() {
key: "spare_qty", this.deletelModal = false;
title: this.l("spare_qty"),
align: "right",
width: 100,
high: true,
hide: true
}, },
{ cancel() {
key: "plan_start", this.curId = 0;
title: this.l("plan_start"), this.addModal = false;
align: "center", this.detailModal = false;
high: true, this.editModal = false;
hide: true, this.deletedlModal = false;
resizable: true, this.apsModal = false;
width: 150 this.apsCheckModal = false;
this.resultModal = false;
}, },
{ onDragDrop(a, b) {
key: "plan_finish", //拖拽排序
title: this.l("plan_finish"), //this.list.splice(b, 1, ...this.list.splice(a, 1, this.list[b]));
align: "center", let tempArray = this.list[a];
high: true, this.list.splice(a, 1);
hide: true, this.list.splice(b, 0, tempArray);
sortable: true,
resizable: true,
width: 150
}, },
{ openParms(id) {
key: "notes", this.addModal = true;
title: this.l("notes"),
align: "left",
easy: true,
high: true,
hide: true
}, },
{ getUserDepart() {
key: "demand_start", // alert("5656565");
title: this.l("demand_start"), // Api.getUserDepart().then(res=>{
align: "center", // console.log("11111",res)
resizable: true, // return res
width: 150, // })
type: "date"
}, },
{
key: "demand_finish", l(key) {
title: this.l("demand_finish"), let vkey = "mes_part_task_plan_simulate" + "." + key;
align: "center", return this.$t(vkey) || key;
high: true,
resizable: true,
width: 150,
type: "date"
}, },
{ getTime(value) {
key: "badjustflag", this.entity.getTime = value;
title: this.l("badjustflag"),
align: "left",
high: true,
hide: true
}, },
{ openApsModal() {
title: "操作", if (this.entity.setTime != "") {
key: "action", this.apsModal = true;
width: 140,
align: "center",
// fixed:"right",
render: (h, params) => {
return h("div", { class: "action" }, [
h("op", {
attrs: {
icon: "md-options",
type: "icon",
title: "工序参数设置",
oprate: "edit"
},
on: { click: () => this.openAddModel(2, params.row) }
}),
h("op", {
attrs: {
icon: "md-refresh",
type: "icon",
title: "恢复工序",
oprate: "edit",
msg: "确认要恢复工序吗?"
},
on: { click: () => this.refresh(params.row.part_task_pk) }
}),
h("op", {
attrs: {
icon: "ios-trash",
type: "icon",
title: "移出排产池",
oprate: "delete",
msg: "确认要移出排产吗?"
},
on: { click: () => this.remove(params.row.part_task_pk) }
})
]);
}
}
],
arrPartPkId: [],
//设置参数开始
setParams: {
opTaskPk: 0, //工单ID
partTaskPk: 0, //生产计划ID
taskSeq: "", //工序编号
count: 0 //生产计划数量
},
//设置参数结束
circleModal: false, //进度条
listTemp: [], //自定义模板排序下拉框列表
tempValue: null,
tempStatu: 0 //新建模型时传过来的id值
};
},
mounted() {
this.loadList();
this.loadTemp();
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
//排产池加载数据列表
loadList() {
Api.getall().then(res => {
if (res.success) {
this.list = res.result;
}
});
},
loadTemp() {
Api.getdropsortlist().then(resDrop => {
//加载排序模板列表
if (resDrop.success) {
this.listTemp = resDrop.result;
}
});
},
addOk() {
this.list = [];
this.loadList();
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.curId = 0;
},
detail(id) {
this.detailModal = true;
this.curId = id;
},
edit(id) {
this.editModal = true;
this.curId = id;
},
refresh(partPkId) {
//恢复工序
let params = {
id: partPkId
};
Api.recoveryoptasksimluate(params).then(r => {
if (r.success) {
this.$Message.success("恢复成功");
this.list = [];
this.loadList();
}
});
},
remove(partPkId) {
//移出排产池
this.tempParams = null;
let paramsArry = [];
if (partPkId.constructor == Array) {
paramsArry = partPkId;
} else {
paramsArry.push(partPkId);
}
let params = {
partPks: paramsArry
};
Api.beforeshiftoutapspool(params)
.then(res => {
if (res.success) {
if (res.result) {
this.checkapspool(params);
} else { } else {
this.tempParams = null; this.$Message.error("请设置基准日期");
this.tempParams = params;
this.apsCheckModal = true;
} }
} else { },
this.$Message.error("校验失败"); //查看历史方案
} goResults() {
}) this.$router.push({
.catch(err => { path: "/aps/results"
this.$Message.error("连接错误1"); // params: { customerId: id }
}); });
}, },
apsCheckOk() { //确定aps排产
this.checkapspool(this.tempParams); apsOk() {
}, this.circleModal = true;
checkapspool(params) { //APS排产前订单优先级功能
Api.shiftoutapspool(params) let parmsOrderpriority = {
.then(r => { alls: []
if (r.success) { };
this.$Message.success("移出排产池操作成功"); let arryIds = [];
this.loadList(); this.list.forEach((e, index) => {
//移出排产后将aps对应的store数量去掉 let objIds = {};
this.$store.commit( objIds.orderId = e.part_task_pk;
"setCountAps", objIds.priority = index + 1;
this.$store.state.countAps - params.partPks.length arryIds.push(objIds);
); });
} else { parmsOrderpriority.alls = arryIds;
this.$Message.error("移出排产池操作失败"); Api.orderpriority(parmsOrderpriority)
} .then(res => {
}) if (res.success) {
.catch(err => { if (res.result) {
this.$Message.error("连接失败2"); //this.$Message.success("排序成功");
}); //apsp排产前检查
}, Api.apsdatachecked()
onSelect(a, b) { .then(res1 => {
//批量选择 if (res1.success) {
let selectRows = a; // this.result=res1.result;
this.arrPartPkId = []; // this.resultModal=true;
selectRows.forEach(e => { this.checkOk();
this.arrPartPkId.push(e.part_task_pk); } else {
}); // this.circleModal = false;
}, // this.$Message.error("操作失败:数据校验");
removeOk() { this.result = res1.result;
//批量选择移出排产池 this.resultModal = true;
this.remove(this.arrPartPkId); }
}, })
removeCancel() { .catch(
this.deletelModal = false; function (err) {
}, this.circleModal = false;
cancel() { this.$Message.error("操作失败");
this.curId = 0; }.bind(this)
this.addModal = false; );
this.detailModal = false; } else {
this.editModal = false; this.circleModal = false;
this.deletedlModal = false; this.$Message.error("排序失败,请重新APS排产操作");
this.apsModal = false; }
this.apsCheckModal = false; } else {
this.resultModal = false; this.circleModal = false;
}, this.$Message.error("操作失败:排序");
onDragDrop(a, b) { }
//拖拽排序
//this.list.splice(b, 1, ...this.list.splice(a, 1, this.list[b]));
let tempArray = this.list[a];
this.list.splice(a, 1);
this.list.splice(b, 0, tempArray);
},
openParms(id) {
this.addModal = true;
},
getUserDepart() {
// alert("5656565");
// Api.getUserDepart().then(res=>{
// console.log("11111",res)
// return res
// })
},
l(key) {
let vkey = "mes_part_task_plan_simulate" + "." + key;
return this.$t(vkey) || key;
},
getTime(value) {
this.entity.getTime = value;
},
openApsModal() {
if (this.entity.setTime != "") {
this.apsModal = true;
} else {
this.$Message.error("请设置基准日期");
}
},
//查看历史方案
goResults() {
this.$router.push({
path: "/aps/results"
// params: { customerId: id }
});
},
//确定aps排产
apsOk() {
this.circleModal = true;
//APS排产前订单优先级功能
let parmsOrderpriority = { alls: [] };
let arryIds = [];
this.list.forEach((e, index) => {
let objIds = {};
objIds.orderId = e.part_task_pk;
objIds.priority = index + 1;
arryIds.push(objIds);
});
parmsOrderpriority.alls = arryIds;
Api.orderpriority(parmsOrderpriority)
.then(res => {
if (res.success) {
if (res.result) {
//this.$Message.success("排序成功");
//apsp排产前检查
Api.apsdatachecked()
.then(res1 => {
if (res1.success) {
// this.result=res1.result;
// this.resultModal=true;
this.checkOk();
} else {
// this.circleModal = false;
// this.$Message.error("操作失败:数据校验");
this.result=res1.result;
this.resultModal=true;
}
}) })
.catch( .catch(
function(err) { function (err) {
this.circleModal = false; this.circleModal = false;
this.$Message.error("操作失败"); this.$Message.error("操作失败");
}.bind(this) }.bind(this)
); );
},
checkOk() {
//排产计算
let paramsTime = {
setTime: this.entity.setTime
};
Api.apsprepareandcalc(paramsTime)
.then(res2 => {
if (res2.success) {
if (res2.result.res) {
this.$Message.success("排产计算成功");
this.circleModal = false;
this.$router.push({
path: "/aps/results"
// params: { customerId: id }
});
} else {
this.circleModal = false;
this.$Message.error(res2.result.msg);
}
} else {
this.circleModal = false;
this.$Message.error("操作失败:排产计算");
}
})
.catch(
function (err) {
this.circleModal = false;
this.$Message.error("操作失败");
}.bind(this)
);
},
//打开设置参数
openAddModel(type, row) {
if (type == 2) {
this.setParams = {
opTaskPk: 0,
partTaskPk: row.part_task_pk,
taskSeq: "",
count: row.plan_qty
};
} else { } else {
this.circleModal = false; this.setParams = {
this.$Message.error("排序失败,请重新APS排产操作"); opTaskPk: 0,
} partTaskPk: 0,
} else { taskSeq: "",
this.circleModal = false; count: 0
this.$Message.error("操作失败:排序"); };
}
})
.catch(
function(err) {
this.circleModal = false;
this.$Message.error("操作失败");
}.bind(this)
);
},
checkOk() {
//排产计算
let paramsTime = {
setTime: this.entity.setTime
};
Api.apsprepareandcalc(paramsTime)
.then(res2 => {
if (res2.success) {
if (res2.result.res) {
this.$Message.success("排产计算成功");
this.circleModal = false;
this.$router.push({
path: "/aps/results"
// params: { customerId: id }
});
} else {
this.circleModal = false;
this.$Message.error(res2.result.msg);
} }
} else { this.addModal = true;
this.circleModal = false; },
this.$Message.error("操作失败:排产计算"); //自定义排序模板相关start------
} //打开自定义排序模板窗口
}) openaddModalTemp() {
.catch( this.addModalTemp = true;
function(err) { },
this.circleModal = false; //选择排序模板
this.$Message.error("操作失败"); tempValueChange(val) {
}.bind(this) let params = {
); id: val
}, };
//打开设置参数 Api.usesorttemplate(params)
openAddModel(type, row) { .then(r => {
if (type == 2) { if (r.success) {
this.setParams = { this.$Message.success("设置成功");
opTaskPk: 0, this.list = [];
partTaskPk: row.part_task_pk, this.loadList();
taskSeq: "", } else {
count: row.plan_qty this.$Message.error("设置失败");
}; }
} else { })
this.setParams = { .catch(e => {
opTaskPk: 0, this.$Message.error("访问失败");
partTaskPk: 0, });
taskSeq: "", },
count: 0 //自定义排序模板相关end------
}; //外协工期修改start------
} //打开外协工期任务modal
this.addModal = true; openDuration() {
}, this.modalDuration = true;
//自定义排序模板相关start------ },
//打开自定义排序模板窗口 //外协工期修改end
openaddModalTemp() { //插单start
this.addModalTemp = true; //插单事件start----
}, changeFlag1(id, index) {
//选择排序模板 this.rowIndex1 = index;
tempValueChange(val) { if (this.list[this.rowIndex1].insert_flag == 1) {
let params = { this.insertTItle1 = "取消插单";
id: val
};
Api.usesorttemplate(params)
.then(r => {
if (r.success) {
this.$Message.success("设置成功");
this.list = [];
this.loadList();
} else {
this.$Message.error("设置失败");
}
})
.catch(e => {
this.$Message.error("访问失败");
});
},
//自定义排序模板相关end------
//外协工期修改start------
//打开外协工期任务modal
openDuration() {
this.modalDuration = true;
},
//外协工期修改end
//插单start
//插单事件start----
changeFlag1(id, index) {
this.rowIndex1 = index;
if (this.list[this.rowIndex1].insert_flag == 1) {
this.insertTItle1 = "取消插单";
} else {
this.insertTItle1 = "插单";
}
this.insertlModal1 = true;
},
insertOk1() {
if (this.list[this.rowIndex1].insert_flag == 1) {
//根据插单数据状态进行插单或取消插单操作
let params1 = {
partTaskPks: [this.list[this.rowIndex1].part_task_pk],
opTaskPks: []
};
Api.cancelinsertorder(params1)
.then(res => {
if (res.success) {
this.$Message.success("取消插单成功!");
this.list[this.rowIndex1].insert_flag = 0;
} else { } else {
this.$Message.error("取消插单失败!"); this.insertTItle1 = "插单";
} }
}) this.insertlModal1 = true;
.catch(err => { },
this.$Message.error("数据异常!"); insertOk1() {
}); if (this.list[this.rowIndex1].insert_flag == 1) {
} else { //根据插单数据状态进行插单或取消插单操作
let params = { let params1 = {
partTaskPks: [this.list[this.rowIndex1].part_task_pk], partTaskPks: [this.list[this.rowIndex1].part_task_pk],
opTaskPks: [] opTaskPks: []
}; };
Api.saveinsertorder(params) Api.cancelinsertorder(params1)
.then(res => { .then(res => {
if (res.success) { if (res.success) {
this.$Message.success("插单成功!"); this.$Message.success("取消插单成功!");
this.list[this.rowIndex1].insert_flag = 1; this.list[this.rowIndex1].insert_flag = 0;
} else {
this.$Message.error("取消插单失败!");
}
})
.catch(err => {
this.$Message.error("数据异常!");
});
} else { } else {
this.$Message.error("插单失败!"); let params = {
partTaskPks: [this.list[this.rowIndex1].part_task_pk],
opTaskPks: []
};
Api.saveinsertorder(params)
.then(res => {
if (res.success) {
this.$Message.success("插单成功!");
this.list[this.rowIndex1].insert_flag = 1;
} else {
this.$Message.error("插单失败!");
}
})
.catch(err => {
this.$Message.error("数据异常!");
});
} }
}) this.insertlModal1 = false;
.catch(err => { },
this.$Message.error("数据异常!"); //插单end
}); getFormatDate(dates) {
} const d = new Date(dates);
this.insertlModal1 = false; const resDate =
}, d.getFullYear() +
//插单end "-" +
getFormatDate(dates) { this.p(d.getMonth() + 1) +
const d = new Date(dates); "-" +
const resDate = this.p(d.getDate()) +
d.getFullYear() + " 00:00:01";
"-" + return resDate;
this.p(d.getMonth() + 1) + },
"-" + p(s) {
this.p(d.getDate()) + return s < 10 ? "0" + s : s;
" 00:00:01"; }
return resDate;
},
p(s) {
return s < 10 ? "0" + s : s;
} }
}
}; };
</script> </script>
<style lang="less"> <style lang="less">
.drag { .drag {
cursor: move; cursor: move;
} }
.demo-spin-icon-load { .demo-spin-icon-load {
animation: ani-demo-spin 1s linear infinite; animation: ani-demo-spin 1s linear infinite;
} }
@keyframes ani-demo-spin { @keyframes ani-demo-spin {
from { from {
transform: rotate(0deg); transform: rotate(0deg);
} }
50% {
transform: rotate(180deg); 50% {
} transform: rotate(180deg);
to { }
transform: rotate(360deg);
} to {
transform: rotate(360deg);
}
} }
.demo-spin-col { .demo-spin-col {
height: 100px; height: 100px;
position: relative; position: relative;
border: 0px solid #eee; border: 0px solid #eee;
} }
.vertical-center-modal { .vertical-center-modal {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
.ivu-modal { .ivu-modal {
top: 0; top: 0;
} }
} }
.tempModal { .tempModal {
.ivu-modal-body { .ivu-modal-body {
padding: 16px; padding: 16px;
font-size: 14px; font-size: 14px;
line-height: 1.5; line-height: 1.5;
padding-top: 2px; padding-top: 2px;
padding-bottom: 0px; padding-bottom: 0px;
} }
.ivu-modal-footer {
border-top: none; .ivu-modal-footer {
padding: 12px 18px 12px 18px; border-top: none;
text-align: right; padding: 12px 18px 12px 18px;
} text-align: right;
}
} }
</style> </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