Commit 81b5493b authored by renjintao's avatar renjintao

计划管理-->配套派发 cancel

parent 9dc1f424
<template> <template>
<div class="h100"> <div class="h100">
<DataGrid <DataGrid :columns="columns" ref="grid" :action="action" @on-selection-change="selectInfo" :batch="false">
:columns="columns" <template slot="easySearch">
ref="grid" <Form ref="formInline" :model="easySearch" inline>
:action="action" <FormItem prop="keys">
@on-selection-change="selectInfo" <Input search enter-button placeholder="请输入关键字订单编号/项目名称" v-model="easySearch.keys.value" v-width="300" @on-search="search" />
:batch="false" </FormItem>
> </Form>
<template slot="easySearch"> </template>
<Form ref="formInline" :model="easySearch" inline> <template slot="searchBack">
<FormItem prop="keys"> <Badge :count="this.$store.state.countAps" overflow-count="99" style="margin-right: 15px" type="info" v-if="showAps">
<Input <a href="javascript:;" @click="goAps">APS排产&nbsp;&nbsp;&nbsp;</a>
search </Badge>
enter-button <Badge :count="this.$store.state.countAi" overflow-count="99" style="margin-right: 15px" type="info" v-if="showAi">
placeholder="请输入关键字订单编号/项目名称" <a href="javascript:;" @click="goAi">智能排产&nbsp;&nbsp;&nbsp;</a>
v-model="easySearch.keys.value" </Badge>
v-width="300" <Badge :count="this.$store.state.countAll" overflow-count="99" style="margin-right: 15px" type="info" v-if="showAll">
@on-search="search" <a @click="goCemplate">整机排产&nbsp;&nbsp;&nbsp;</a>
/> </Badge>
</FormItem> <Badge :count="this.$store.state.countRun" overflow-count="99" type="info" v-if="showRun">
</Form> <a @click="goStream">流水排产&nbsp;&nbsp;&nbsp;</a>
</template> </Badge>
<template slot="searchBack"> </template>
<Badge <template slot="searchForm">
:count="this.$store.state.countAps" <Search />
overflow-count="99" </template>
style="margin-right: 15px" <template slot="buttons"></template>
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> </DataGrid>
<FooterToolbar extra v-if="footerBar" class="ftball"> <FooterToolbar extra v-if="footerBar" class="ftball">
<Row> <Row>
<Checkbox @on-change="handleSelectAll(single)" v-model="single" <Checkbox @on-change="handleSelectAll(single)" v-model="single">全选</Checkbox>
>全选</Checkbox <span class="footerSpan">已选 {{ selectCount }} 项</span>
> &nbsp;&nbsp;&nbsp;&nbsp;
<span class="footerSpan">已选 {{ selectCount }} 项</span> <Button type="primary" @click="modalDispatch">工艺派发</Button>&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; <Button type="primary" @click="modalSchedule">移入排产</Button>&nbsp;&nbsp;&nbsp;&nbsp;
<Button type="primary" @click="modalDispatch">工艺派发</Button <Button @click="canselFooter">取消</Button>
>&nbsp;&nbsp;&nbsp;&nbsp; </Row>
<Button type="primary" @click="modalSchedule">移入排产</Button
>&nbsp;&nbsp;&nbsp;&nbsp;
<Button @click="canselFooter">取消</Button>
</Row>
</FooterToolbar> </FooterToolbar>
<Modal v-model="addModal" title="新增" footer-hide> <Modal v-model="addModal" title="新增" footer-hide>
<Add @on-close="cancel" @on-ok="addOk" /> <Add @on-close="cancel" @on-ok="addOk" />
</Modal> </Modal>
<Modal v-model="editModal" title="编辑" footer-hide> <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>
<Modal v-model="detailModal" title="详情"> <Modal v-model="detailModal" title="详情">
<Detail :eid="curId" /> <Detail :eid="curId" />
</Modal> </Modal>
<Modal <Modal v-model="deletelModal" title="删除" @on-ok="removeOk" @on-cancel="cancel">
v-model="deletelModal" <p>确定删除?</p>
title="删除"
@on-ok="removeOk"
@on-cancel="cancel"
>
<p>确定删除?</p>
</Modal> </Modal>
<Modal v-model="dispatchModal" title="工艺派发" footer-hide width="800"> <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>
<Modal v-model="scheduleModal" title="移入排产" width="800"> <Modal v-model="scheduleModal" title="移入排产" width="800">
<p>&nbsp;</p> <p>&nbsp;</p>
<h4>请选择排产模型:</h4> <h4>请选择排产模型:</h4>
<!-- <!--
<Dictionary <Dictionary
code="aps.plan.scheduleType" code="aps.plan.scheduleType"
v-model="scheduleType" v-model="scheduleType"
...@@ -110,59 +65,39 @@ ...@@ -110,59 +65,39 @@
@on-change="onchangeScheduleType" @on-change="onchangeScheduleType"
></Dictionary> ></Dictionary>
--> -->
<RadioGroup <RadioGroup v-model="scheduleType" class="radioList" @on-change="onchangeScheduleType">
v-model="scheduleType" <Radio :label="1" border :disabled="this.$store.state.countAi > 0">
class="radioList" <span>Aps排产</span>
@on-change="onchangeScheduleType" </Radio>
> <Radio :label="4" border :disabled="this.$store.state.countAps > 0">
<Radio :label="1" border :disabled="this.$store.state.countAi > 0"> <span>智能排产</span>
<span>Aps排产</span> </Radio>
</Radio> <Radio :label="2" border>
<Radio :label="4" border :disabled="this.$store.state.countAps > 0"> <span>整机排产</span>
<span>智能排产</span> </Radio>
</Radio> <Radio :label="3" border>
<Radio :label="2" border> <span>流水排产</span>
<span>整机排产</span> </Radio>
</Radio> </RadioGroup>
<Radio :label="3" border> <p class="pl30 pt10" v-show="scheduleType != null">
<span>流水排产</span> 确定将订单
</Radio> <span class="fwBold">{{ resultsOrderList }}</span> 移入
</RadioGroup> <span class="red fwBold">{{ scheduleTypeName }}</span>
<p class="pl30 pt10" v-show="scheduleType != null"> </p>
确定将订单 <p>&nbsp;</p>
<span class="fwBold">{{ resultsOrderList }}</span> 移入 <p>&nbsp;</p>
<span class="red fwBold">{{ scheduleTypeName }}</span <div slot="footer">
> <Button @click="cancel">取消</Button>
</p> <Button type="primary" @click="scheduleOk">确定</Button>
<p>&nbsp;</p> </div>
<p>&nbsp;</p>
<div slot="footer">
<Button @click="cancel">取消</Button>
<Button type="primary" @click="scheduleOk">确定</Button>
</div>
</Modal> </Modal>
<Modal <Modal v-model="orderSupportModal" title="配套下发" footer-hide width="1300">
v-model="orderSupportModal" <orderSupport ref="orderSupport"></orderSupport>
title="配套下发"
footer-hide
width="1300"
>
<orderSupport ref="orderSupport"></orderSupport>
</Modal> </Modal>
<Modal v-model="modalAccessory" :title="title" fullscreen footer-hide> <Modal v-model="modalAccessory" :title="title" fullscreen footer-hide>
<component <component :is="details" :eid="orderId" :mesCode="mesCode" :productName="productName" :drawnNumber="drawnNumber" :productingPreparationPeople="productingPreparationPeople" :count="count" @on-close="cancel" @on-ok="addOk" />
:is="details"
:eid="orderId"
:mesCode="mesCode"
:productName="productName"
:drawnNumber="drawnNumber"
:productingPreparationPeople="productingPreparationPeople"
:count="count"
@on-close="cancel"
@on-ok="addOk"
/>
</Modal> </Modal>
</div> </div>
</template> </template>
<script> <script>
...@@ -174,750 +109,747 @@ import Search from "./search"; ...@@ -174,750 +109,747 @@ import Search from "./search";
import Dispatch from "./dispatch"; import Dispatch from "./dispatch";
import orderSupport from "../../produce/orderSupport"; import orderSupport from "../../produce/orderSupport";
export default { export default {
name: "list", name: "list",
components: { components: {
Add, Add,
Edit, Edit,
Detail, Detail,
Search, Search,
Dispatch, Dispatch,
orderSupport, orderSupport,
}, },
data() { data() {
return { return {
action: Api.index, action: Api.index,
productingPreparationPeople: 0, productingPreparationPeople: 0,
easySearch: { easySearch: {
keys: { keys: {
op: "mesCode,projectNumber", op: "mesCode,projectNumber",
value: null, 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: 50,
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: "quantity",
title: this.l("quantity"),
align: "right",
high: true,
},
{
key: "productCode",
title: this.l("productCode"),
align: "left",
easy: true,
high: true,
hide: true,
},
{
key: "isPreschedule",
title: this.l("isPreschedule"),
align: "center",
width: 100,
high: true,
code: "aps.plan.ispreschedule",
},
{
key: "taskRequire",
title: this.l("taskRequire"),
align: "left",
easy: true,
high: true,
hide: true,
},
{
key: "productingPreparationPeople",
title: this.l("productingPreparationPeople"),
align: "left",
high: true,
hide: true,
type: "workShopName",
},
{
key: "productingPreparationFinishDate",
title: this.l("productingPreparationFinishDate"),
align: "left",
high: true,
hide: true,
},
{
key: "quotationPeople",
title: this.l("quotationPeople"),
align: "left",
high: true,
hide: true,
type: "user",
},
{
key: "quotationFinishDate",
title: this.l("quotationFinishDate"),
align: "left",
high: true,
hide: true,
},
{
key: "demandStartDate",
title: this.l("demandStartDate"),
align: "left",
high: true,
hide: true,
type: "date",
},
{
key: "demandFinishDate",
title: this.l("demandFinishDate"),
align: "left",
high: true,
hide: true,
type: "date",
},
// {
// 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.isPreschedule == 0 ?
"工艺派发" :
params.row.mainRoutingSetStatus == 1 &&
params.row.isPreschedule == 0 ?
"移入排产" :
""
),
// 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,
isPrescheduleStatu: 0,
};
},
mounted() {
this.loadInitCount();
},
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
handleSelectAll(status) {
//选择列表数据
this.$refs.grid.selectAll(status);
}, },
}, selectInfo(value) {
addModal: false, if (value.length > 0) {
editModal: false, this.footerBar = true;
detailModal: false, } else {
deletelModal: false, this.footerBar = false;
dispatchModal: false, }
scheduleModal: false, this.selectList = [];
orderSupportModal: false, this.selectList = value;
curId: 0,
statuList: this.selectCount = this.selectList.length;
this.$store.getters.dictionaryByKey("aps.plan.supportingStatus") || [], let statueArry = [];
name: "", let tempmesCodeList = [];
items: null, this.resultsStatusArr = [];
title: "", this.isPrescheduleStatu = 0;
details: null, value.forEach((data) => {
uId: "", var that = this;
hid: 0, statueArry.push(data.id);
orderId: 0, this.resultsStatusArr.push(data.mainRoutingSetStatus);
mesCode: "", if (data.isPreschedule == 2) {
productName: "", this.isPrescheduleStatu = 2;
drawnNumber: "", }
count: 0, tempmesCodeList.push(data.mesCode);
modalAccessory: false, });
columns: [
{ let mainRS = this.uniq(this.resultsStatusArr); //数组去重
key: "selection", if (mainRS.length == 1) {
title: "多选", this.results = [];
type: "selection", this.results = statueArry;
width: 50, this.getListId(statueArry);
align: "center", 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
title: this.l("mesCode"), getListId(value) {
key: "mesCode", this.listBatchIds1 = value;
width: 240, if (this.listBatchIds1.length > 0) {
align: "left", this.footerBar = true;
} else {
this.footerBar = false;
}
}, },
{ canselFooter() {
key: "productName", this.footerBar = false;
title: this.l("productName"), this.handleSelectAll(false);
align: "left",
easy: true,
width: 160,
high: true,
tooltip: true,
}, },
{ modalDispatch() {
key: "status", //打开工艺派发
title: this.l("status"), this.listBatchIds = this.listBatchIds1; //用于列表操作时和多选时的listBatchId的冲突
align: "center", if (this.dispatchStatus == 1) {
high: true, this.dispatchModal = true;
code: "plan.order.status", } else {
this.$Message.error("所选订单里存在已派发订单!");
}
}, },
{ modalSchedule() {
key: "mainRoutingSetStatus", //移入排产
title: this.l("mainRoutingSetStatus"), this.scheduleType = null;
align: "center", this.scheduleTypeName = "";
high: true, this.listBatchIds = this.listBatchIds1;
code: "aps.plan.mainRoutingStatus", if (this.scheduleStatus == 1 && this.isPrescheduleStatu != 2) {
this.scheduleModal = true;
} else {
this.$Message.error("所选订单里存在未派发订单!");
}
}, },
{ goMethod(value) {
key: "isSupportingFinish", //行内点击后面按钮
title: this.l("isSupportingFinish"), this.canselFooter();
align: "center", this.resultsOrderList = value.mesCode;
render: (h, params) => { this.listBatchIds = [value.id];
return h( this.scheduleType = null;
"op", this.scheduleTypeName = "";
{ if (value.mainRoutingSetStatus == 0) {
attrs: { //this.dispatchStatus = 1
oprate: "detail", //this.scheduleStatus = 0
}, this.dispatchModal = true;
style: { } else if (value.mainRoutingSetStatus == 1) {
color: this.setName(params.row.isSupportingFinish).color, //this.dispatchStatus = 0
}, //this.scheduleStatus = 1
on: { this.scheduleModal = true;
click: () => this.openAccessory(params.row), }
},
},
this.setName(params.row.isSupportingFinish).name
);
},
}, },
{ supportDis(value) {
key: "projectNumber", (this.orderSupportModal = true),
title: this.l("projectNumber"), this.$refs.orderSupport.loaddata(value.id);
align: "left",
easy: true,
high: true,
}, },
{ scheduleOk() {
key: "batchNumber", if (this.scheduleType == null) {
title: this.l("batchNumber"), this.$Message.error("请选择排产模型");
align: "left", } else {
easy: true, let params = {
high: true, 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();
}
}, },
{ //跳转到aps排产池(有判断)
key: "urgencyLevel", goAps() {
title: this.l("urgencyLevel"), Api.moveintoaps().then((res) => {
align: "left", if (res.success) {
easy: true, if (res.result.res) {
high: true, this.$router.push({
code: "plan.order.urgencyLevel", name: "aps-aps",
// params: { customerId: id }
});
} else {
this.$Message.error(res.result.msg);
}
}
});
}, },
//跳转到智能排产池(有判断)
{ goAi() {
key: "taskType", Api.moveintoai().then((res) => {
title: this.l("taskType"), if (res.success) {
align: "left", if (res.result.res) {
easy: true, //test
high: true, this.$router.push({
hide: true, name: "aps-ai",
code: "plan.order.taskType", // params: { customerId: id }
});
} else {
this.$Message.error(res.result.msg);
}
}
});
}, },
goCemplate() {
{ this.$router.push({
key: "drawnNumber", name: "aps-complete",
title: this.l("drawnNumber"), });
align: "left",
easy: true,
high: true,
}, },
{ goStream() {
key: "quantity", this.$router.push({
title: this.l("quantity"), name: "aps-stream",
align: "right", });
high: true,
}, },
{ add() {
key: "productCode", this.addModal = true;
title: this.l("productCode"),
align: "left",
easy: true,
high: true,
hide: true,
}, },
{ addOk() {
key: "isPreschedule", this.$refs.grid.load();
title: this.l("isPreschedule"), this.addModal = false;
align: "center", this.detailModal = false;
width: 100, this.editModal = false;
high: true, this.curId = 0;
code: "aps.plan.ispreschedule", //aps
this.dispatchModal = false;
this.scheduleModal = false;
this.listBatchIds = [];
this.listBatchIds1 = [];
this.canselFooter();
this.modalAccessory = false;
}, },
{ search() {
key: "taskRequire", this.$refs.grid.reload(this.easySearch);
title: this.l("taskRequire"),
align: "left",
easy: true,
high: true,
hide: true,
}, },
{ detail(id) {
key: "productingPreparationPeople", this.detailModal = true;
title: this.l("productingPreparationPeople"), this.curId = id;
align: "left",
high: true,
hide: true,
type: "workShopName",
}, },
{ edit(id) {
key: "productingPreparationFinishDate", this.editModal = true;
title: this.l("productingPreparationFinishDate"), this.curId = id;
align: "left",
high: true,
hide: true,
}, },
{ remove(id) {
key: "quotationPeople", this.deletelModal = true;
title: this.l("quotationPeople"), this.curId = id;
align: "left",
high: true,
hide: true,
type: "user",
}, },
{ removeOk() {
key: "quotationFinishDate", Api.delete({
title: this.l("quotationFinishDate"), id: this.curId,
align: "left", }).then((r) => {
high: true, if (r.success) {
hide: true, this.$refs.grid.load();
this.deletelModal = false;
this.$Message.success("删除成功");
}
});
}, },
{ removeCancel() {
key: "demandStartDate", this.deletelModal = false;
title: this.l("demandStartDate"),
align: "left",
high: true,
hide: true,
type: "date",
}, },
{ cancel() {
key: "demandFinishDate", this.curId = 0;
title: this.l("demandFinishDate"), this.addModal = false;
align: "left", this.detailModal = false;
high: true, this.editModal = false;
hide: true, this.deletedlModal = false;
type: "date", //aps
this.dispatchModal = false;
this.scheduleModal = false;
this.modalAccessory = false;
// this.listBatchIds = []
// this.listBatchIds1 = []
// this.canselFooter()
}, },
// { l(key) {
// key: "spareQty", let vkey = "mes_order" + "." + key;
// title: this.l("spareQty"), return this.$t(vkey) || key;
// 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.isPreschedule == 0
? "工艺派发"
: params.row.mainRoutingSetStatus == 1 &&
params.row.isPreschedule == 0
? "移入排产"
: ""
),
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) {
selectCount: 0, //数组去重
selectList: [], array.sort();
footerBar: false, var temp = [];
results: [], temp = [array[0]];
listBatchIds: [], for (var i = 1; i < array.length; i++) {
listBatchIds1: [], //临时存储选择的ids if (array[i] !== temp[temp.length - 1]) {
single: false, temp.push(array[i]);
resultsStatusArr: [], }
resultsStatus: 0,
dispatchStatus: 0, //派发标识
scheduleStatus: 0, //排产标识
resultsOrderList: "",
scheduleType: null,
scheduleTypeName: "",
showAps: false,
showAi: false,
showAll: false,
showRun: false,
isPrescheduleStatu: 0,
};
},
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 = [];
this.isPrescheduleStatu = 0;
value.forEach((data) => {
var that = this;
statueArry.push(data.id);
this.resultsStatusArr.push(data.mainRoutingSetStatus);
if (data.isPreschedule == 2) {
this.isPrescheduleStatu = 2;
}
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.isPrescheduleStatu != 2) {
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("移入排产失败");
}
} }
}) return temp;
.catch((err) => { },
this.$Message.error("移入排产失败"); //移入排产前选择排产模型
}); onchangeScheduleType(val) {
this.canselFooter(); switch (Number(val)) {
this.cancel(); case 4:
} this.scheduleTypeName = "智能排产";
}, break;
//跳转到aps排产池(有判断) case 2:
goAps() { this.scheduleTypeName = "整机排产";
Api.moveintoaps().then((res) => { break;
if (res.success) { case 3:
if (res.result.res) { this.scheduleTypeName = "流水排产";
this.$router.push({ break;
name: "aps-aps", default:
// params: { customerId: id } this.scheduleTypeName = "APS排产";
});
} 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) {
this.$store.commit("setCountAps", 0); case 4: //智能排产池排产订单数量
this.$store.commit("setCountAi", 0); this.$store.commit("setCountAi", this.$store.state.countAi + count);
this.$store.commit("setCountAll", 0); break;
this.$store.commit("setCountRun", 0); case 2: //整机排产池排产订单数量
Api.getpoolordercount() this.$store.commit("setCountAll", this.$store.state.countAll + count);
.then((res) => { break;
if (res.success && res.result && res.result.length > 0) { case 3: //流水排产池排产订单数量
res.result.forEach((data) => { this.$store.commit("setCountRun", this.$store.state.countRun + count);
this.changeCountOut(data.poolType, data.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;
}
});
}
}); });
}
})
.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;
this.productingPreparationPeople = row.productingPreparationPeople;
if (row.mainRoutingSetStatus == 1 && row.isSupportingFinish == 0) { this.$store.commit("setCountAps", 0);
this.$Message.error("请去工艺设置生成料单!"); this.$store.commit("setCountAi", 0);
// this.title = "申请配套"; this.$store.commit("setCountAll", 0);
// this.details = () => import("./addAccessory"); this.$store.commit("setCountRun", 0);
} else { Api.getpoolordercount()
this.title = "配套清单"; .then((res) => {
this.details = () => import("./editAccessory"); if (res.success && res.result && res.result.length > 0) {
this.modalAccessory = true; res.result.forEach((data) => {
} this.changeCountOut(data.poolType, data.count);
} });
}, }
ok() { })
this.modalAccessory = false; .catch((err) => {
this.curId = 0; 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;
this.productingPreparationPeople = row.productingPreparationPeople;
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> </script>
<style lang="less"> <style lang="less">
.footerSpan { .footerSpan {
width: 120px; width: 120px;
} }
.demo-badge-alone { .demo-badge-alone {
background: #5cb85c !important; background: #5cb85c !important;
} }
.radioList { .radioList {
margin: 10px 30px; margin: 10px 30px;
} }
.radioList label { .radioList label {
margin-top: 5px; margin-top: 5px;
} }
</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