Commit 695863e3 authored by renjintao's avatar renjintao

on-selection-change

parent d97107be
<template>
<div>
<DataGrid
:columns="columns"
ref="grid"
:draggable="true"
:data="list"
:high="false"
@on-drag-drop="onDragDrop"
:page="false"
@on-change="onSelect"
:batch="true"
:border="true"
:easy="true"
>
<template slot="easySearch">
<div>
<Select
placeholder="选择排序优先级"
v-model="tempValue"
style="width: 150px;"
@on-change="tempValueChange"
clearable
>
<Option
v-for="(item,index) in listTemp"
:key="index"
:value="item.id"
:label="item.name"
></Option>
</Select>
<a style="font-weight: bold;" @click="openaddModalTemp">
<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>
<div>
<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">
<template slot="easySearch">
<div>
<Select placeholder="选择排序优先级" v-model="tempValue" style="width: 150px;" @on-change="tempValueChange" clearable>
<Option v-for="(item,index) in listTemp" :key="index" :value="item.id" :label="item.name"></Option>
</Select>
<a style="font-weight: bold;" @click="openaddModalTemp">
<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>
<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 v-model="modalDuration" title="外协任务" footer-hide width="1000">
<Duration ref="durationRef"></Duration>
<Duration ref="durationRef"></Duration>
</Modal>
<Modal v-model="addModal" title="工序参数设置" footer-hide width="1000">
<Add
@on-close="cancel"
@on-parameter-ok="addOk"
:opTaskPk="setParams.opTaskPk"
:partTaskPk="setParams.partTaskPk"
:taskSeq="setParams.taskSeq"
:count="setParams.count"
/>
<Add @on-close="cancel" @on-parameter-ok="addOk" :opTaskPk="setParams.opTaskPk" :partTaskPk="setParams.partTaskPk" :taskSeq="setParams.taskSeq" :count="setParams.count" />
</Modal>
<Modal v-model="apsModal" title="确定APS排产" @on-ok="apsOk" @on-cancel="cancel">
<p>确定进行APS排产?</p>
<p>确定进行APS排产?</p>
</Modal>
<!-- <Modal v-model="resultModal" title="数据检查" width="1500" @on-ok="checkOk" @on-cancel="cancel">
<CheckResult :data="result"></CheckResult>
</Modal> -->
<Modal v-model="resultModal" title="数据检查" width="1500" @on-ok="cancel" @on-cancel="cancel">
<CheckResult :data="result"></CheckResult>
<CheckResult :data="result"></CheckResult>
</Modal>
<Modal v-model="apsCheckModal" title="确定APS排产" @on-ok="apsCheckOk" @on-cancel="cancel">
<p>已有排产方案,是否移出排产池?</p>
<p>已有排产方案,是否移出排产池?</p>
</Modal>
<Modal v-model="circleModal" title footer-hide :mask-closable="false">
<div slot="close"></div>
<Row>
<Col class="demo-spin-col" span="24">
<Spin fix>
<Icon type="ios-loading" size="36" class="demo-spin-icon-load"></Icon>
<div>APS排产进行中......</div>
</Spin>
</Col>
</Row>
<div slot="close"></div>
<Row>
<Col class="demo-spin-col" span="24">
<Spin fix>
<Icon type="ios-loading" size="36" class="demo-spin-icon-load"></Icon>
<div>APS排产进行中......</div>
</Spin>
</Col>
</Row>
</Modal>
<Modal v-model="insertlModal1" :title="insertTItle1" @on-ok="insertOk1" @on-cancel="cancel">
<p>确定进行 {{ insertTItle1 }} 操作?</p>
<p>确定进行 {{ insertTItle1 }} 操作?</p>
</Modal>
</div>
</div>
</template>
<script>
var myDate = new Date();
var nowDate = myDate.getFullYear() + "-" + (myDate.getMonth() + 1) + "-" + myDate.getDate();
......@@ -118,708 +79,729 @@ import Duration from "./duration";
import Expand from "./components/excute";
import CheckResult from "./components/check";
export default {
name: "list",
components: {
Add,
Expand,
Temp,
Duration,
CheckResult
},
data() {
return {
action: Api.index,
easySearch: {
keys: { op: "notes", value: null }
},
result: {
res: true,
datas: '{}'
},
resultModal: false,
entity: {
setTime:this.getFormatDate(nowDate)
},
addModal: false,
editModal: false,
detailModal: false,
deletelModal: false,
apsModal: false,
addModalTemp: false,
modalDuration: false,
insertlModal1: false,
apsCheckModal: false,
tempParams: null,
insertTItle1: "插单",
rowIndex1: null,
list: [],
curId: 0,
columns: [
{
key: "move",
title: " ",
hide: false,
align: "center",
width: 30,
render: (h, params) => {
return h("Icon", {
attrs: {
type: "md-more",
size: 18
},
class: "drag"
name: "list",
components: {
Add,
Expand,
Temp,
Duration,
CheckResult
},
data() {
return {
action: Api.index,
easySearch: {
keys: {
op: "notes",
value: null
}
},
result: {
res: true,
datas: '{}'
},
resultModal: false,
entity: {
setTime: this.getFormatDate(nowDate)
},
addModal: false,
editModal: false,
detailModal: false,
deletelModal: false,
apsModal: false,
addModalTemp: false,
modalDuration: false,
insertlModal1: false,
apsCheckModal: false,
tempParams: null,
insertTItle1: "插单",
rowIndex1: null,
list: [],
curId: 0,
columns: [{
key: "move",
title: " ",
hide: false,
align: "center",
width: 30,
render: (h, params) => {
return h("Icon", {
attrs: {
type: "md-more",
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;
}
});
}
},
{
type: "expand",
width: 50,
render: (h, params) => {
return h(Expand, {
props: {
rowId: params.row.part_task_pk
}
loadTemp() {
Api.getdropsortlist().then(resDrop => {
//加载排序模板列表
if (resDrop.success) {
this.listTemp = resDrop.result;
}
});
}
},
{
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)
}
})
]
);
}
addOk() {
this.list = [];
this.loadList();
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.curId = 0;
},
{
key: "mesCode",
title: this.l("mes_code"),
align: "left",
high: true,
width: 240
detail(id) {
this.detailModal = true;
this.curId = id;
},
{
key: "product_name",
title: this.l("product_name"),
align: "left",
high: true
edit(id) {
this.editModal = true;
this.curId = id;
},
{
key: "drawingnum",
title: this.l("drawingnum"),
align: "left",
high: true
refresh(partPkId) {
//恢复工序
let params = {
id: partPkId
};
Api.recoveryoptasksimluate(params).then(r => {
if (r.success) {
this.$Message.success("恢复成功");
this.list = [];
this.loadList();
}
});
},
{
key: "project_no",
title: this.l("project_no"),
align: "left",
high: true
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 {
this.tempParams = null;
this.tempParams = params;
this.apsCheckModal = true;
}
} else {
this.$Message.error("校验失败");
}
})
.catch(err => {
this.$Message.error("连接错误1");
});
},
{
key: "batchnum",
title: this.l("batchnum"),
align: "left",
high: true
apsCheckOk() {
this.checkapspool(this.tempParams);
},
{
key: "urgency_level",
title: this.l("urgency_level"),
align: "left",
high: true,
code: "plan.order.urgencyLevel",
width: 100
checkapspool(params) {
Api.shiftoutapspool(params)
.then(r => {
if (r.success) {
this.$Message.success("移出排产池操作成功");
this.loadList();
//移出排产后将aps对应的store数量去掉
this.$store.commit(
"setCountAps",
this.$store.state.countAps - params.partPks.length
);
} else {
this.$Message.error("移出排产池操作失败");
}
})
.catch(err => {
this.$Message.error("连接失败2");
});
},
{
key: "priority",
title: this.l("priority"),
align: "left",
high: true,
hide: true,
render: (h, params) => {
return h("span", {}, params.index + 1);
}
onSelect(a, b) {
//批量选择
let selectRows = a;
this.arrPartPkId = [];
selectRows.forEach(e => {
this.arrPartPkId.push(e.part_task_pk);
});
},
{
key: "plan_qty",
title: this.l("plan_qty"),
align: "right",
width: 100,
high: true
removeOk() {
//批量选择移出排产池
this.remove(this.arrPartPkId);
},
{
key: "spare_qty",
title: this.l("spare_qty"),
align: "right",
width: 100,
high: true,
hide: true
removeCancel() {
this.deletelModal = false;
},
{
key: "plan_start",
title: this.l("plan_start"),
align: "center",
high: true,
hide: true,
resizable: true,
width: 150
cancel() {
this.curId = 0;
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.deletedlModal = false;
this.apsModal = false;
this.apsCheckModal = false;
this.resultModal = false;
},
{
key: "plan_finish",
title: this.l("plan_finish"),
align: "center",
high: true,
hide: true,
sortable: true,
resizable: true,
width: 150
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);
},
{
key: "notes",
title: this.l("notes"),
align: "left",
easy: true,
high: true,
hide: true
openParms(id) {
this.addModal = true;
},
{
key: "demand_start",
title: this.l("demand_start"),
align: "center",
resizable: true,
width: 150,
type: "date"
getUserDepart() {
// alert("5656565");
// Api.getUserDepart().then(res=>{
// console.log("11111",res)
// return res
// })
},
{
key: "demand_finish",
title: this.l("demand_finish"),
align: "center",
high: true,
resizable: true,
width: 150,
type: "date"
l(key) {
let vkey = "mes_part_task_plan_simulate" + "." + key;
return this.$t(vkey) || key;
},
{
key: "badjustflag",
title: this.l("badjustflag"),
align: "left",
high: true,
hide: true
getTime(value) {
this.entity.getTime = value;
},
{
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() {
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);
openApsModal() {
if (this.entity.setTime != "") {
this.apsModal = true;
} else {
this.tempParams = null;
this.tempParams = params;
this.apsCheckModal = true;
this.$Message.error("请设置基准日期");
}
} else {
this.$Message.error("校验失败");
}
})
.catch(err => {
this.$Message.error("连接错误1");
});
},
apsCheckOk() {
this.checkapspool(this.tempParams);
},
checkapspool(params) {
Api.shiftoutapspool(params)
.then(r => {
if (r.success) {
this.$Message.success("移出排产池操作成功");
this.loadList();
//移出排产后将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) {
//批量选择
let selectRows = a;
this.arrPartPkId = [];
selectRows.forEach(e => {
this.arrPartPkId.push(e.part_task_pk);
});
},
removeOk() {
//批量选择移出排产池
this.remove(this.arrPartPkId);
},
removeCancel() {
this.deletelModal = false;
},
cancel() {
this.curId = 0;
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.deletedlModal = false;
this.apsModal = false;
this.apsCheckModal = false;
this.resultModal = false;
},
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;
}
},
//查看历史方案
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(
function (err) {
this.circleModal = false;
this.$Message.error("操作失败");
}.bind(this)
);
} else {
this.circleModal = false;
this.$Message.error("排序失败,请重新APS排产操作");
}
} else {
this.circleModal = false;
this.$Message.error("操作失败:排序");
}
})
.catch(
function(err) {
this.circleModal = false;
this.$Message.error("操作失败");
}.bind(this)
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.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 {
this.circleModal = false;
this.$Message.error("排序失败,请重新APS排产操作");
}
} else {
this.circleModal = false;
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);
this.setParams = {
opTaskPk: 0,
partTaskPk: 0,
taskSeq: "",
count: 0
};
}
} 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 {
this.setParams = {
opTaskPk: 0,
partTaskPk: 0,
taskSeq: "",
count: 0
};
}
this.addModal = true;
},
//自定义排序模板相关start------
//打开自定义排序模板窗口
openaddModalTemp() {
this.addModalTemp = true;
},
//选择排序模板
tempValueChange(val) {
let params = {
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;
this.addModal = true;
},
//自定义排序模板相关start------
//打开自定义排序模板窗口
openaddModalTemp() {
this.addModalTemp = true;
},
//选择排序模板
tempValueChange(val) {
let params = {
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.$Message.error("取消插单失败!");
this.insertTItle1 = "插单";
}
})
.catch(err => {
this.$Message.error("数据异常!");
});
} else {
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;
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 {
this.$Message.error("取消插单失败!");
}
})
.catch(err => {
this.$Message.error("数据异常!");
});
} 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("数据异常!");
});
}
})
.catch(err => {
this.$Message.error("数据异常!");
});
}
this.insertlModal1 = false;
},
//插单end
getFormatDate(dates) {
const d = new Date(dates);
const resDate =
d.getFullYear() +
"-" +
this.p(d.getMonth() + 1) +
"-" +
this.p(d.getDate()) +
" 00:00:01";
return resDate;
},
p(s) {
return s < 10 ? "0" + s : s;
this.insertlModal1 = false;
},
//插单end
getFormatDate(dates) {
const d = new Date(dates);
const resDate =
d.getFullYear() +
"-" +
this.p(d.getMonth() + 1) +
"-" +
this.p(d.getDate()) +
" 00:00:01";
return resDate;
},
p(s) {
return s < 10 ? "0" + s : s;
}
}
}
};
</script>
<style lang="less">
.drag {
cursor: move;
cursor: move;
}
.demo-spin-icon-load {
animation: ani-demo-spin 1s linear infinite;
animation: ani-demo-spin 1s linear infinite;
}
@keyframes ani-demo-spin {
from {
transform: rotate(0deg);
}
50% {
transform: rotate(180deg);
}
to {
transform: rotate(360deg);
}
from {
transform: rotate(0deg);
}
50% {
transform: rotate(180deg);
}
to {
transform: rotate(360deg);
}
}
.demo-spin-col {
height: 100px;
position: relative;
border: 0px solid #eee;
height: 100px;
position: relative;
border: 0px solid #eee;
}
.vertical-center-modal {
display: flex;
align-items: center;
justify-content: center;
display: flex;
align-items: center;
justify-content: center;
.ivu-modal {
top: 0;
}
.ivu-modal {
top: 0;
}
}
.tempModal {
.ivu-modal-body {
padding: 16px;
font-size: 14px;
line-height: 1.5;
padding-top: 2px;
padding-bottom: 0px;
}
.ivu-modal-footer {
border-top: none;
padding: 12px 18px 12px 18px;
text-align: right;
}
.ivu-modal-body {
padding: 16px;
font-size: 14px;
line-height: 1.5;
padding-top: 2px;
padding-bottom: 0px;
}
.ivu-modal-footer {
border-top: none;
padding: 12px 18px 12px 18px;
text-align: right;
}
}
</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