Commit 7e2917fa authored by renjintao's avatar renjintao

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

parents 1366a5c3 fe1902fd
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
import GanttElastic from "gantt-elastic"; import GanttElastic from "gantt-elastic";
import GanttHeader from "./components/gantt-header"; import GanttHeader from "./components/gantt-header";
import dayjs from "dayjs"; import dayjs from "dayjs";
import Api from "./api";
// just helper to get current dates // just helper to get current dates
function getDate(hours) { function getDate(hours) {
const currentDate = new Date(); const currentDate = new Date();
...@@ -273,17 +273,18 @@ let options = { ...@@ -273,17 +273,18 @@ let options = {
value: "label", value: "label",
width: 200, width: 200,
expander: true, expander: true,
html: true, html: true
events: { // events: {
click({ data, column }) { // click({ data, column }) {
alert("description clicked!\n" + data.label); // alert("description clicked!\n" + data.label);
} // }
} // }
}, },
{ {
id: 3, id: 3,
label: "责任人", label: "设备编号",
value: "user", value: "user",
width: 130, width: 130,
html: true html: true
}, },
...@@ -295,12 +296,25 @@ let options = { ...@@ -295,12 +296,25 @@ let options = {
}, },
{ {
id: 5, id: 5,
label: "类型", label: "结束时间",
value: "type", value: task => dayjs(task.endTime).format("YYYY-MM-DD"),
width: 68 width: 78
}, },
{ {
id: 6, id: 6,
label: "投入数量",
value: "put_into_qty",
width: 68
},
{
id: 7,
label: "派工数量",
value: "dispatch_qty",
width: 68
},
{
id: 8,
label: "%", label: "%",
value: "progress", value: "progress",
width: 35, width: 35,
...@@ -349,15 +363,60 @@ export default { ...@@ -349,15 +363,60 @@ export default {
GanttElastic, GanttElastic,
GanttHeader GanttHeader
}, },
props: {
id: String
},
data() { data() {
return { return {
tasks, tasks:[],
options, options,
dynamicStyle: {}, dynamicStyle: {},
lastId: 16 lastId: 16
}; };
}, },
mounted() {
this.gantData();
},
methods: { methods: {
gantData() {
if (this.id) {
Api.paged({ scheduleId: this.id })
.then(r => {
if (r.result) {
Api.getdetail({
part_task_pk: r.result[0].id,
scheduleId: this.id
}).then(r => {
if (r.result) {
var list = [];
for (var i = 0; i < r.result.length; i++) {
let temp = {
id: r.result[i].op_task_pk,
label: r.result[i].task_name,
user: r.result[i].equip_id,
// start: r.result[i].plan_start,
// endTime: r.result[i].plan_finish,
endTime: "2020-7-30",
start: getDate(1),
duration: (15*i) * 24 * 60 * 60 * 1000,
percent: 85,
put_into_qty: r.result[i].put_into_qty,
dispatch_qty: r.result[i].dispatch_qty
};
list.push(temp);
}
this.tasksUpdate(list);
}
});
}
})
.catch(error => {
this.$Message.error("请求失败");
});
}
},
addTask() { addTask() {
this.tasks.push({ this.tasks.push({
id: this.lastId++, id: this.lastId++,
...@@ -372,9 +431,11 @@ export default { ...@@ -372,9 +431,11 @@ export default {
}); });
}, },
tasksUpdate(tasks) { tasksUpdate(tasks) {
// console.log(tasks);
this.tasks = tasks; this.tasks = tasks;
}, },
optionsUpdate(options) { optionsUpdate(options) {
// console.log(options);
this.options = options; this.options = options;
}, },
styleUpdate(style) { styleUpdate(style) {
......
...@@ -50,22 +50,23 @@ ...@@ -50,22 +50,23 @@
<Button type="default" @click="cancel">取消</Button> <Button type="default" @click="cancel">取消</Button>
</div> </div>
<Modal v-model="modal1Gant" fullscreen title="甘特图" footer-hide> <Modal v-model="modal1Gant" fullscreen title="甘特图" footer-hide>
<Gantt /> <!-- <Gantt :id="id" /> -->
<gantt :is="gantt" :id="id" />
</Modal> </Modal>
</div> </div>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
import Gantt from "./gantt"; // import Gantt from "./gantt";
export default { export default {
components: { // components: {
Gantt // Gantt
}, // },
data() { data() {
return { return {
curId: null, curId: null,
detail: null, detail: null,
isactive: 0, isactive: null,
list: [], list: [],
name: "name1", name: "name1",
id: null, id: null,
...@@ -75,7 +76,8 @@ export default { ...@@ -75,7 +76,8 @@ export default {
showFooter: false, showFooter: false,
total: 0, total: 0,
blacks: false, blacks: false,
gant: false gant: false,
gantt:null,
}; };
}, },
async fetch({ store, params }) { async fetch({ store, params }) {
...@@ -152,10 +154,11 @@ export default { ...@@ -152,10 +154,11 @@ export default {
//甘特图 //甘特图
gantChart() { gantChart() {
this.modal1Gant = true; this.modal1Gant = true;
this.gantt = () => import("./gantt");
}, },
changeCheck(item) { changeCheck(item) {
this.isactive = null; this.isactive = null;
this.blacks = true; (this.id = null), (this.blacks = true);
if (item.checked == true) { if (item.checked == true) {
this.contrastList.push(item.schedule_Id); this.contrastList.push(item.schedule_Id);
} else if (item.checked == false) { } else if (item.checked == false) {
......
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