Commit b543d5d8 authored by renjintao's avatar renjintao

智能排产

parent 0219e91a
<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="false">
: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="false"
>
<template slot="searchBack"></template> <template slot="searchBack"></template>
<template slot="searchForm"> <template slot="searchForm">
<Search /> <Search />
</template> </template>
<template slot="buttons"> <template slot="buttons">
<DatePicker <Select v-model="rulesAi" multiple style="width:280px;" class="tl">
type="date" <Option v-for="item in rulesAiList" :value="item.value" :key="item.value">{{ item.label }}</Option>
placeholder="设置基准日期" </Select>
style="width: 150px;" <DatePicker type="date" placeholder="设置基准日期" style="width: 150px;" v-model="entity.setTime" @on-change="getTime"></DatePicker>
v-model="entity.setTime"
@on-change="getTime"
></DatePicker>
<Button type="primary" @click="openApsModal">智能排产</Button> <Button type="primary" @click="openApsModal">智能排产</Button>
</template> </template>
<template slot="batch"> <template slot="batch">
...@@ -52,8 +37,9 @@ ...@@ -52,8 +37,9 @@
</Col> </Col>
</Row> </Row>
</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();
...@@ -76,7 +62,10 @@ export default { ...@@ -76,7 +62,10 @@ export default {
return { return {
action: Api.index, action: Api.index,
easySearch: { easySearch: {
keys: { op: "notes", value: null }, keys: {
op: "notes",
value: null
},
}, },
result: { result: {
res: true, res: true,
...@@ -84,7 +73,8 @@ export default { ...@@ -84,7 +73,8 @@ export default {
}, },
resultModal: false, resultModal: false,
entity: { entity: {
setTime:this.getFormatDate(nowDate) setTime: this.getFormatDate(nowDate),
rules: '',
}, },
editModal: false, editModal: false,
detailModal: false, detailModal: false,
...@@ -96,8 +86,7 @@ export default { ...@@ -96,8 +86,7 @@ export default {
rowIndex1: null, rowIndex1: null,
list: [], list: [],
curId: 0, curId: 0,
columns: [ columns: [{
{
key: "move", key: "move",
title: " ", title: " ",
hide: false, hide: false,
...@@ -260,7 +249,9 @@ export default { ...@@ -260,7 +249,9 @@ export default {
align: "center", align: "center",
// fixed:"right", // fixed:"right",
render: (h, params) => { render: (h, params) => {
return h("div", { class: "action" }, [ return h("div", {
class: "action"
}, [
h("op", { h("op", {
attrs: { attrs: {
icon: "md-refresh", icon: "md-refresh",
...@@ -269,7 +260,9 @@ export default { ...@@ -269,7 +260,9 @@ export default {
oprate: "edit", oprate: "edit",
msg: "确认要恢复工序吗?", msg: "确认要恢复工序吗?",
}, },
on: { click: () => this.refresh(params.row.part_task_pk) }, on: {
click: () => this.refresh(params.row.part_task_pk)
},
}), }),
h("op", { h("op", {
attrs: { attrs: {
...@@ -279,7 +272,9 @@ export default { ...@@ -279,7 +272,9 @@ export default {
oprate: "delete", oprate: "delete",
msg: "确认要移出排产吗?", msg: "确认要移出排产吗?",
}, },
on: { click: () => this.remove(params.row.part_task_pk) }, on: {
click: () => this.remove(params.row.part_task_pk)
},
}), }),
]); ]);
}, },
...@@ -296,12 +291,29 @@ export default { ...@@ -296,12 +291,29 @@ export default {
//设置参数结束 //设置参数结束
circleModal: false, //进度条 circleModal: false, //进度条
tempStatu: 0, //新建模型时传过来的id值 tempStatu: 0, //新建模型时传过来的id值
rulesAi: ['1', '2', '3', '4'],
rulesAiList: [{
value: '1',
label: '转序'
}, {
value: '2',
label: '多台'
}, {
value: '3',
label: '加班'
}, {
value: '4',
label: '公休'
}]
}; };
}, },
mounted() { mounted() {
this.loadList(); this.loadList();
}, },
async fetch({ store, params }) { async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
methods: { methods: {
...@@ -438,7 +450,9 @@ export default { ...@@ -438,7 +450,9 @@ export default {
apsOk() { apsOk() {
this.circleModal = true; this.circleModal = true;
//智能排产前订单优先级功能 //智能排产前订单优先级功能
let parmsOrderpriority = { alls: [] }; let parmsOrderpriority = {
alls: []
};
let arryIds = []; let arryIds = [];
this.list.forEach((e, index) => { this.list.forEach((e, index) => {
let objIds = {}; let objIds = {};
...@@ -490,6 +504,7 @@ export default { ...@@ -490,6 +504,7 @@ export default {
//排产计算 //排产计算
let paramsTime = { let paramsTime = {
setTime: this.entity.setTime, setTime: this.entity.setTime,
rules: JSON.stringify(this.rulesAi).replace('[', '').replace(']', '').replace(/\"/g, '')
}; };
Api.apsprepareandcalc(paramsTime) Api.apsprepareandcalc(paramsTime)
.then((res2) => { .then((res2) => {
...@@ -547,29 +562,36 @@ export default { ...@@ -547,29 +562,36 @@ export default {
}, },
}; };
</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% { 50% {
transform: rotate(180deg); transform: rotate(180deg);
} }
to { to {
transform: rotate(360deg); 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;
...@@ -579,6 +601,7 @@ export default { ...@@ -579,6 +601,7 @@ export default {
top: 0; top: 0;
} }
} }
.tempModal { .tempModal {
.ivu-modal-body { .ivu-modal-body {
padding: 16px; padding: 16px;
...@@ -587,6 +610,7 @@ export default { ...@@ -587,6 +610,7 @@ export default {
padding-top: 2px; padding-top: 2px;
padding-bottom: 0px; padding-bottom: 0px;
} }
.ivu-modal-footer { .ivu-modal-footer {
border-top: none; border-top: none;
padding: 12px 18px 12px 18px; padding: 12px 18px 12px 18px;
......
<template>
<div class="h100">
<Tabs type="card" width="100">
<TabPane label="excel数据">
<TablePaste hide-table :input-props="inputProps" @on-success="handleSuccess" @on-error="handleError" />
</TabPane>
<TabPane label="预览">
<Table border="true" :columns="columnsImport" :data="excelData" :height="tableHeight" ref="tableExcel" class="tableCommon"></Table>
</TabPane>
</Tabs>
</div>
</template>
<script>
import Api from "./api";
export default {
name: "detailExcel",
data() {
return {
entity: {},
downUrl: fileUrlDown,
fileUrlPath: "",
excelRows: 100,
tableHeight: '',
inputProps: {
rows: 10,
placeholder: "请从Excel复制一段表格数据,粘贴在这里",
},
};
},
props: {
eid: Number,
},
created() {
this.excelRows = parseInt((window.innerHeight - 231) / 21) + 1;
this.inputProps.rows = this.excelRows
this.tableHeight = window.innerHeight - 200
},
mounted() {
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.excelRows = parseInt((window.screenHeight - 231) / 21) + 1;
this.inputProps.rows = this.excelRows
this.tableHeight = window.innerHeight - 200
})();
};
},
methods: {
load(v) {
Api.get({
id: v,
}).then((r) => {
this.entity = r.result;
this.$emit("on-load");
});
},
handleClose() {
this.$emit("on-close");
},
downFile(path) {
//alert(path)
let truePath = path;
if (truePath.length > 2) {
if (
truePath.substring(0, 7).toLowerCase() == "http://" ||
truePath.substring(0, 8).toLowerCase() == "https://"
) {
window.open(truePath, "_blank");
} else {
this.fileUrlPath = this.downUrl + path;
window.open(this.fileUrlPath, "_blank");
}
}
},
l(key) {
key = "import_center" + "." + key;
return this.$t(key);
},
},
watch: {
eid(v) {
if (v > 0) {
this.load(v);
}
},
},
};
</script>
...@@ -29,28 +29,37 @@ ...@@ -29,28 +29,37 @@
<div class="btns"> <div class="btns">
<Form inline> <Form inline>
<FormItem> <FormItem>
原文件:<a @click="downFile">{{entity.file}}</a> <a @click="downFile">
<Icon type="md-download" />{{entity.file}}
</a>
</FormItem> </FormItem>
<FormItem> <FormItem>
<a class="ml10 mr10" @click="resetTable">刷新</a> <a class="ml10 mr10" @click="resetTable">
<Icon type="md-eye" />预览
</a>
</FormItem> </FormItem>
<FormItem v-if="show"> <FormItem v-if="show">
<Button @click="openPaste" :type="btnType" :ghost="ghostStatus">{{btnTxt}}</Button> <Button @click="openPaste" :type="btnType" :ghost="ghostStatus">{{btnTxt}}</Button>
</FormItem> </FormItem>
<FormItem> <FormItem>
<RadioGroup value="large" type="button"> <RadioGroup value="0" type="button" @on-change="changeExcel">
<Radio label="large">数据列表</Radio> <Radio label="0">
<Radio label="default">粘贴Excel</Radio> <Icon type="md-list" />列表
</Radio>
<Radio label="1">
<Icon type="md-clipboard" />Excel
</Radio>
</RadioGroup> </RadioGroup>
</FormItem> </FormItem>
</Form> </Form>
</div> </div>
</div> </div>
<div class="table-main" ref="main"> <div class="table-main" ref="main">
<Table border="true" :columns="columnsImport" :data="excelData" :height="tdHeightExcel" ref="table" class="tableCommon"></Table> <Table border="true" :columns="columnsImport" :data="excelData" :height="tdHeightExcel" ref="table" class="tableCommon" v-if="tableImport"></Table>
<component :is="detailExcel" />
</div> </div>
<FooterToolbar v-if="sheetNames.length>1"> <FooterToolbar v-if="sheetNames.length>1&&tableImport">
<Form inline> <Form inline>
<FormItem> <FormItem>
<Tabs :animated="false" :value="0" @on-click="sheetClick"> <Tabs :animated="false" :value="0" @on-click="sheetClick">
...@@ -82,6 +91,8 @@ export default { ...@@ -82,6 +91,8 @@ export default {
downUrl: fileUrlDown, downUrl: fileUrlDown,
fileUrlPath: "", fileUrlPath: "",
disabled: false, disabled: false,
detailExcel: null,
tableImport: true,
columns0: [{ columns0: [{
key: "userName", key: "userName",
title: this.l("userName"), title: this.l("userName"),
...@@ -715,6 +726,16 @@ export default { ...@@ -715,6 +726,16 @@ export default {
} }
}); });
}, },
changeExcel(val) {
if (val == 1) {
this.tableImport = false
this.detailExcel = () => import("./detailExcel");
} else {
this.detailExcel = null;
this.tableImport = true
}
},
l(key) { l(key) {
key = "user" + "." + key; key = "user" + "." + key;
return this.$t(key); return this.$t(key);
......
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