gannt修改#138
This commit is contained in:
parent
7e90d78de3
commit
365439d05b
|
|
@ -2379,16 +2379,16 @@ const routes = [
|
||||||
},
|
},
|
||||||
"component": "statistics/inm_check.vue"
|
"component": "statistics/inm_check.vue"
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
"name": "good_check",
|
// "name": "good_check",
|
||||||
"path": "/statistic/good_check",
|
// "path": "/statistic/good_check",
|
||||||
"meta": {
|
// "meta": {
|
||||||
"title": "成品检验统计",
|
// "title": "成品检验统计",
|
||||||
"icon": "el-icon-DataAnalysis",
|
// "icon": "el-icon-DataAnalysis",
|
||||||
"perms": ["statistic_qm"]
|
// "perms": ["statistic_qm"]
|
||||||
},
|
// },
|
||||||
"component": "statistics/good_check.vue"
|
// "component": "statistics/good_check.vue"
|
||||||
},
|
// },
|
||||||
// {
|
// {
|
||||||
// "name": "behavior_check",
|
// "name": "behavior_check",
|
||||||
// "path": "/statistic/behavior_check",
|
// "path": "/statistic/behavior_check",
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main class="nopadding">
|
<el-main class="nopadding">
|
||||||
<scTable ref="table" :apiObj="apiUtask" row-key="id" stripe :params="paramsUtask" @row-click="rowclick"
|
<scTable ref="tables" :apiObj="apiUtask" row-key="id" stripe :params="paramsUtask" @row-click="rowclick"
|
||||||
@selection-change="handleSelectionChange">
|
@selection-change="handleSelectionChange" @dataChange="updateCount">
|
||||||
<el-table-column type="selection" width="40" />
|
<el-table-column type="selection" width="40" />
|
||||||
<el-table-column type="index" width="40" />
|
<el-table-column type="index" width="40" />
|
||||||
<el-table-column label="任务编号" prop="number" width="120"> </el-table-column>
|
<el-table-column label="任务编号" prop="number" width="120"> </el-table-column>
|
||||||
|
|
@ -105,43 +105,7 @@
|
||||||
</el-container>
|
</el-container>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main class="nopadding">
|
<el-main class="nopadding">
|
||||||
<!-- <el-container>
|
<GanttComponent class="left-container" v-if="ganntVisit" :tasks="tasks" :start_date="start_date">
|
||||||
<el-header>
|
|
||||||
<div class="left-panel">
|
|
||||||
<span style="font-size: 14px">生产进度</span>
|
|
||||||
</div>
|
|
||||||
</el-header>
|
|
||||||
<el-main class="nopadding">
|
|
||||||
<scTable ref="table2" :data="utaskList" row-key="id" stripe hideDo hidePagination :params="query">
|
|
||||||
<el-table-column type="index" width="50" />
|
|
||||||
<el-table-column label="任务编号" prop="number" width="100" fixed="left">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="产品名称" prop="material" width="100" show-overflow-tooltip fixed="left">
|
|
||||||
<template #default="scope">
|
|
||||||
{{ scope.row.material_.name }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="规格" prop="specification" width="100" fixed="left">
|
|
||||||
<template #default="scope">
|
|
||||||
{{ scope.row.material_.specification }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="型号" prop="model" width="100" fixed="left">
|
|
||||||
<template #default="scope">
|
|
||||||
{{ scope.row.material_.model }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column v-for="item in mtaskList" :label="item.start_date" :key="item.id" width="100">
|
|
||||||
<div :class="bindClass(item)">
|
|
||||||
<div>{{ item.count_b }}</div>
|
|
||||||
<div>{{ item.count_y }}</div>
|
|
||||||
<div>{{ item.count_ok }}</div>
|
|
||||||
</div>
|
|
||||||
</el-table-column>
|
|
||||||
</scTable>
|
|
||||||
</el-main>
|
|
||||||
</el-container> -->
|
|
||||||
<GanttComponent class="left-container" :tasks="tasks" :start_date="start_date">
|
|
||||||
</GanttComponent>
|
</GanttComponent>
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
|
|
@ -176,6 +140,7 @@ export default {
|
||||||
dateValue:'',
|
dateValue:'',
|
||||||
apiUtask: null,
|
apiUtask: null,
|
||||||
apiObj: null,
|
apiObj: null,
|
||||||
|
ganntVisit:true,
|
||||||
visibleRecord: false,
|
visibleRecord: false,
|
||||||
currentDept: { id: 0 },
|
currentDept: { id: 0 },
|
||||||
paramsUtask: {},
|
paramsUtask: {},
|
||||||
|
|
@ -209,6 +174,50 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
updateCount(res, tableData) {
|
||||||
|
let that = this;
|
||||||
|
this.count = res.count;
|
||||||
|
let data = [];
|
||||||
|
console.log('tableData', tableData)
|
||||||
|
if (tableData.length > 0) {
|
||||||
|
tableData.forEach(item=>{
|
||||||
|
let start_date = item.start_date;
|
||||||
|
let end_date = item.end_date;
|
||||||
|
let objItem = {};
|
||||||
|
objItem.id = item.id;
|
||||||
|
objItem.type = 'utask';
|
||||||
|
objItem.number = item.number;
|
||||||
|
objItem.count = item.count;
|
||||||
|
objItem.text = item.number;
|
||||||
|
objItem.material_name = item.material_.name;
|
||||||
|
objItem.material_specification = item.material_.specification;
|
||||||
|
objItem.material_model = item.material_.model;
|
||||||
|
objItem.progress = item.count_real / item.count;;
|
||||||
|
objItem.count_ok = item.count_ok;
|
||||||
|
objItem.count_real = item.count_real;
|
||||||
|
objItem.count_notok = item.count_notok;
|
||||||
|
objItem.state = item.state;
|
||||||
|
objItem.start_date = start_date;
|
||||||
|
objItem.utaskType = item.type;
|
||||||
|
objItem.mgroup_name = item.mgroup_name;
|
||||||
|
objItem.open = true;
|
||||||
|
let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
||||||
|
let firstDate = new Date(start_date);
|
||||||
|
let secondDate = new Date(end_date);
|
||||||
|
let timeDiff = Math.abs(secondDate.getTime()-firstDate.getTime());
|
||||||
|
let daysDiff = Math.ceil(timeDiff / oneDay);
|
||||||
|
objItem.duration = daysDiff+1;
|
||||||
|
data.push(objItem)
|
||||||
|
that.start_date = start_date;
|
||||||
|
console.log('objItemduration',objItem.duration)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
that.ganntVisit = true;
|
||||||
|
that.tasks.data = data;
|
||||||
|
gantt.parse(that.tasks);
|
||||||
|
// 刷新数据
|
||||||
|
gantt.refreshData();
|
||||||
|
},
|
||||||
getGantt(){
|
getGantt(){
|
||||||
let that = this;
|
let that = this;
|
||||||
that.$API.pm.utask.list.req(that.paramsUtask).then(res=>{
|
that.$API.pm.utask.list.req(that.paramsUtask).then(res=>{
|
||||||
|
|
@ -375,14 +384,17 @@ export default {
|
||||||
this.$refs.table.refresh();
|
this.$refs.table.refresh();
|
||||||
},
|
},
|
||||||
utaskSearch(){
|
utaskSearch(){
|
||||||
|
this.ganntVisit = false;
|
||||||
|
if (this.dateValue && this.dateValue.length > 0) {
|
||||||
let start_date = this.dateValue[0];
|
let start_date = this.dateValue[0];
|
||||||
let end_date = this.dateValue[1];
|
let end_date = this.dateValue[1];
|
||||||
let obj = {};
|
this.paramsUtask.start_date__gte = start_date;
|
||||||
obj.start_date__gte = start_date;
|
this.paramsUtask.end_date__lte = end_date;
|
||||||
obj.end_date__lte = end_date;
|
} else {
|
||||||
obj.belong_dept__name = '10车间';
|
this.paramsUtask.start_date__gte = '';
|
||||||
this.paramsUtask = obj;
|
this.paramsUtask.end_date__lte = '';
|
||||||
this.getGantt();
|
}
|
||||||
|
this.$refs.tables.refresh();
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,8 @@
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main class="nopadding">
|
<el-main class="nopadding">
|
||||||
<scTable ref="table" :apiObj="apiUtask" row-key="id" stripe :params="paramsUtask" @row-click="rowclick"
|
<scTable ref="tables" :apiObj="apiUtask" row-key="id" stripe :params="paramsUtask" @row-click="rowclick"
|
||||||
@selection-change="handleSelectionChange">
|
@selection-change="handleSelectionChange" @dataChange="updateCount">
|
||||||
<el-table-column type="selection" width="40" />
|
<el-table-column type="selection" width="40" />
|
||||||
<el-table-column type="index" width="40" />
|
<el-table-column type="index" width="40" />
|
||||||
<el-table-column label="任务编号" prop="number" width="120"> </el-table-column>
|
<el-table-column label="任务编号" prop="number" width="120"> </el-table-column>
|
||||||
|
|
@ -114,7 +114,7 @@
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main class="nopadding">
|
<el-main class="nopadding">
|
||||||
<GanttComponent class="left-container" :tasks="tasks" :start_date="start_date">
|
<GanttComponent class="left-container" v-if="ganntVisit" :tasks="tasks" :start_date="start_date">
|
||||||
</GanttComponent>
|
</GanttComponent>
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
|
|
@ -149,6 +149,7 @@ export default {
|
||||||
start_date:'',
|
start_date:'',
|
||||||
end_date:'',
|
end_date:'',
|
||||||
},
|
},
|
||||||
|
ganntVisit:true,
|
||||||
dateValue:'',
|
dateValue:'',
|
||||||
apiUtask: null,
|
apiUtask: null,
|
||||||
currentDept: { id: 0 },
|
currentDept: { id: 0 },
|
||||||
|
|
@ -180,12 +181,56 @@ export default {
|
||||||
that.currentDept = res[0]
|
that.currentDept = res[0]
|
||||||
that.paramsUtask.belong_dept = that.currentDept.id
|
that.paramsUtask.belong_dept = that.currentDept.id
|
||||||
that.apiUtask = that.$API.pm.utask.list
|
that.apiUtask = that.$API.pm.utask.list
|
||||||
that.getGantt();
|
// that.getGantt();
|
||||||
} else {
|
} else {
|
||||||
that.$message.error("未找到车间");
|
that.$message.error("未找到车间");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
updateCount(res, tableData) {
|
||||||
|
let that = this;
|
||||||
|
this.count = res.count;
|
||||||
|
let data = [];
|
||||||
|
console.log('tableData', tableData)
|
||||||
|
if (tableData.length > 0) {
|
||||||
|
tableData.forEach(item=>{
|
||||||
|
let start_date = item.start_date;
|
||||||
|
let end_date = item.end_date;
|
||||||
|
let objItem = {};
|
||||||
|
objItem.id = item.id;
|
||||||
|
objItem.type = 'utask';
|
||||||
|
objItem.number = item.number;
|
||||||
|
objItem.count = item.count;
|
||||||
|
objItem.text = item.number;
|
||||||
|
objItem.material_name = item.material_.name;
|
||||||
|
objItem.material_specification = item.material_.specification;
|
||||||
|
objItem.material_model = item.material_.model;
|
||||||
|
objItem.progress = item.count_real / item.count;;
|
||||||
|
objItem.count_ok = item.count_ok;
|
||||||
|
objItem.count_real = item.count_real;
|
||||||
|
objItem.count_notok = item.count_notok;
|
||||||
|
objItem.state = item.state;
|
||||||
|
objItem.start_date = start_date;
|
||||||
|
objItem.utaskType = item.type;
|
||||||
|
objItem.mgroup_name = item.mgroup_name;
|
||||||
|
objItem.open = true;
|
||||||
|
let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
||||||
|
let firstDate = new Date(start_date);
|
||||||
|
let secondDate = new Date(end_date);
|
||||||
|
let timeDiff = Math.abs(secondDate.getTime()-firstDate.getTime());
|
||||||
|
let daysDiff = Math.ceil(timeDiff / oneDay);
|
||||||
|
objItem.duration = daysDiff+1;
|
||||||
|
data.push(objItem)
|
||||||
|
that.start_date = start_date;
|
||||||
|
console.log('objItemduration',objItem.duration)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
that.ganntVisit = true;
|
||||||
|
that.tasks.data = data;
|
||||||
|
gantt.parse(that.tasks);
|
||||||
|
// 刷新数据
|
||||||
|
gantt.refreshData();
|
||||||
|
},
|
||||||
getGantt(){
|
getGantt(){
|
||||||
let that = this;
|
let that = this;
|
||||||
that.$API.pm.utask.list.req(that.paramsUtask).then(res=>{
|
that.$API.pm.utask.list.req(that.paramsUtask).then(res=>{
|
||||||
|
|
@ -405,14 +450,17 @@ export default {
|
||||||
this.$refs.table.refresh();
|
this.$refs.table.refresh();
|
||||||
},
|
},
|
||||||
utaskSearch(){
|
utaskSearch(){
|
||||||
|
this.ganntVisit = false;
|
||||||
|
if (this.dateValue && this.dateValue.length > 0) {
|
||||||
let start_date = this.dateValue[0];
|
let start_date = this.dateValue[0];
|
||||||
let end_date = this.dateValue[1];
|
let end_date = this.dateValue[1];
|
||||||
let obj = {};
|
this.paramsUtask.start_date__gte = start_date;
|
||||||
obj.start_date__gte = start_date;
|
this.paramsUtask.end_date__lte = end_date;
|
||||||
obj.end_date__lte = end_date;
|
} else {
|
||||||
obj.belong_dept__name = '6车间';
|
this.paramsUtask.start_date__gte = '';
|
||||||
this.paramsUtask = obj;
|
this.paramsUtask.end_date__lte = '';
|
||||||
this.getGantt();
|
}
|
||||||
|
this.$refs.tables.refresh();
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main class="nopadding">
|
<el-main class="nopadding">
|
||||||
<scTable ref="table" :apiObj="apiUtask" row-key="id" stripe :params="paramsUtask" @row-click="rowclick"
|
<scTable ref="tables" :apiObj="apiUtask" row-key="id" stripe :params="paramsUtask" :query="queryUtask" @row-click="rowclick"
|
||||||
@selection-change="handleSelectionChange">
|
@selection-change="handleSelectionChange" @dataChange="updateCount">
|
||||||
<el-table-column type="selection" width="40" />
|
<el-table-column type="selection" width="40" />
|
||||||
<el-table-column type="index" width="40" />
|
<el-table-column type="index" width="40" />
|
||||||
<el-table-column label="任务编号" prop="number" width="120"> </el-table-column>
|
<el-table-column label="任务编号" prop="number" width="120"> </el-table-column>
|
||||||
|
|
@ -140,7 +140,7 @@
|
||||||
</scTable>
|
</scTable>
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container> -->
|
</el-container> -->
|
||||||
<GanttComponent class="left-container" :tasks="tasks" :start_date="start_date">
|
<GanttComponent class="left-container" :tasks="tasks" v-if="ganntVisit" :start_date="start_date">
|
||||||
</GanttComponent>
|
</GanttComponent>
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
|
|
@ -172,13 +172,14 @@ export default {
|
||||||
tasks: {
|
tasks: {
|
||||||
data: []
|
data: []
|
||||||
},
|
},
|
||||||
dateValue:'',
|
ganntVisit:true,
|
||||||
|
dateValue:[],
|
||||||
apiUtask: null,
|
apiUtask: null,
|
||||||
apiObj: null,
|
apiObj: null,
|
||||||
visibleRecord: false,
|
visibleRecord: false,
|
||||||
currentDept: { id: 0 },
|
currentDept: { id: 0 },
|
||||||
paramsUtask: {},
|
paramsUtask: {},
|
||||||
paramsObj: {},
|
queryUtask: {},
|
||||||
utaskList: [],
|
utaskList: [],
|
||||||
state_: {
|
state_: {
|
||||||
10: "创建中",
|
10: "创建中",
|
||||||
|
|
@ -188,11 +189,12 @@ export default {
|
||||||
34:'终止',
|
34:'终止',
|
||||||
40: "已提交",
|
40: "已提交",
|
||||||
},
|
},
|
||||||
start_date:''
|
start_date: '',
|
||||||
|
newDate:''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initDept()
|
this.initDept();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initDept() {
|
initDept() {
|
||||||
|
|
@ -201,19 +203,21 @@ export default {
|
||||||
if (res.length == 1) {
|
if (res.length == 1) {
|
||||||
that.currentDept = res[0];
|
that.currentDept = res[0];
|
||||||
that.paramsUtask.belong_dept = that.currentDept.id;
|
that.paramsUtask.belong_dept = that.currentDept.id;
|
||||||
|
// that.paramsObj.belong_dept = that.currentDept.id;
|
||||||
that.apiUtask = that.$API.pm.utask.list;
|
that.apiUtask = that.$API.pm.utask.list;
|
||||||
that.getGantt();
|
// that.getGantt();
|
||||||
} else {
|
} else {
|
||||||
that.$message.error("未找到车间");
|
that.$message.error("未找到车间");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getGantt(){
|
updateCount(res, tableData) {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.$API.pm.utask.list.req(that.paramsUtask).then(res=>{
|
this.count = res.count;
|
||||||
let list = res.results;
|
|
||||||
let data = [];
|
let data = [];
|
||||||
list.forEach(item=>{
|
console.log('tableData', tableData)
|
||||||
|
if (tableData.length > 0) {
|
||||||
|
tableData.forEach(item=>{
|
||||||
let start_date = item.start_date;
|
let start_date = item.start_date;
|
||||||
let end_date = item.end_date;
|
let end_date = item.end_date;
|
||||||
let objItem = {};
|
let objItem = {};
|
||||||
|
|
@ -244,12 +248,12 @@ export default {
|
||||||
that.start_date = start_date;
|
that.start_date = start_date;
|
||||||
console.log('objItemduration',objItem.duration)
|
console.log('objItemduration',objItem.duration)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
that.ganntVisit = true;
|
||||||
that.tasks.data = data;
|
that.tasks.data = data;
|
||||||
|
|
||||||
gantt.parse(that.tasks);
|
gantt.parse(that.tasks);
|
||||||
// 刷新数据
|
// 刷新数据
|
||||||
gantt.refreshData();
|
gantt.refreshData();
|
||||||
})
|
|
||||||
},
|
},
|
||||||
utaskDepuse() {
|
utaskDepuse() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
|
@ -343,37 +347,23 @@ export default {
|
||||||
this.$refs.showDrawer.open();
|
this.$refs.showDrawer.open();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// rowclick(val) {
|
|
||||||
// let utask = val.id;
|
|
||||||
// this.$API.pm.mtask.list.req({ utask: utask, page: 0 }).then((res) => {
|
|
||||||
// let columList = [];
|
|
||||||
// res.forEach((item) => {
|
|
||||||
// let obj = {};
|
|
||||||
// obj.id = item.id
|
|
||||||
// obj.state = item.state;
|
|
||||||
// obj.count_ok = item.count_ok
|
|
||||||
// obj.count = item.count;
|
|
||||||
// obj.start_date = item.start_date;
|
|
||||||
// obj.rate = ((item.count_ok / item.count) * 100).toFixed(0) + '%';
|
|
||||||
// columList.push(obj);
|
|
||||||
// });
|
|
||||||
// this.mtaskList = columList
|
|
||||||
// this.utaskList = [val]
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
handleSaveSuccess(data, mode) {
|
handleSaveSuccess(data, mode) {
|
||||||
this.$refs.table.refresh();
|
this.$refs.table.refresh();
|
||||||
},
|
},
|
||||||
utaskSearch() {
|
utaskSearch() {
|
||||||
|
console.log('this.dateValue',this.dateValue);
|
||||||
|
this.ganntVisit = false;
|
||||||
|
if (this.dateValue && this.dateValue.length > 0) {
|
||||||
let start_date = this.dateValue[0];
|
let start_date = this.dateValue[0];
|
||||||
let end_date = this.dateValue[1];
|
let end_date = this.dateValue[1];
|
||||||
let obj = {};
|
this.paramsUtask.start_date__gte = start_date;
|
||||||
obj.start_date__gte = start_date;
|
this.paramsUtask.end_date__lte = end_date;
|
||||||
obj.end_date__lte = end_date;
|
} else {
|
||||||
obj.belong_dept__name = '7车间';
|
this.paramsUtask.start_date__gte = '';
|
||||||
obj.page = 0;
|
this.paramsUtask.end_date__lte = '';
|
||||||
this.paramsUtask = obj;
|
}
|
||||||
this.getGantt();
|
this.$refs.tables.refresh();
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue