fix:gantt去掉累加,随上表数据变化变化
This commit is contained in:
parent
89d70548b9
commit
70df6c3837
|
@ -4,10 +4,20 @@
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-header>
|
<el-header>
|
||||||
<div class="'left-panel'">
|
<div class="'left-panel'">
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="utaskCreate"
|
<el-button
|
||||||
v-auth="'utask.create'">新增任务</el-button>
|
type="primary"
|
||||||
<el-button type="primary" @click="utaskDepuse" v-loading="isLoading"
|
icon="el-icon-plus"
|
||||||
v-auth="'utask.assgin'">任务分解并下达</el-button>
|
@click="utaskCreate"
|
||||||
|
v-auth="'utask.create'"
|
||||||
|
>新增任务</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="utaskDepuse"
|
||||||
|
v-loading="isLoading"
|
||||||
|
v-auth="'utask.assgin'"
|
||||||
|
>任务分解并下达</el-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="'right-panel'">
|
<div class="'right-panel'">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
|
@ -19,16 +29,38 @@
|
||||||
value-format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD"
|
||||||
style="vertical-align: middle; margin-right: 6px"
|
style="vertical-align: middle; margin-right: 6px"
|
||||||
/>
|
/>
|
||||||
<el-button type="primary" @click="utaskSearch" v-loading="isLoading">搜索</el-button>
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="utaskSearch"
|
||||||
|
v-loading="isLoading"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main class="nopadding">
|
<el-main class="nopadding">
|
||||||
<scTable ref="tables" :apiObj="apiUtask" row-key="id" stripe :params="paramsUtask" @row-click="rowclick"
|
<scTable
|
||||||
@selection-change="handleSelectionChange" @dataChange="updateCount">
|
ref="tables"
|
||||||
|
:apiObj="apiUtask"
|
||||||
|
row-key="id"
|
||||||
|
stripe
|
||||||
|
:params="paramsUtask"
|
||||||
|
@row-click="rowclick"
|
||||||
|
@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
|
||||||
<el-table-column label="产品名称" prop="material_" show-overflow-tooltip>
|
label="任务编号"
|
||||||
|
prop="number"
|
||||||
|
width="120"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="产品名称"
|
||||||
|
prop="material_"
|
||||||
|
show-overflow-tooltip
|
||||||
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ scope.row.material_.name }}
|
{{ scope.row.material_.name }}
|
||||||
</template>
|
</template>
|
||||||
|
@ -45,10 +77,16 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="任务状态" prop="state">
|
<el-table-column label="任务状态" prop="state">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag v-if="scope.row.state == 40" type="success">
|
<el-tag
|
||||||
|
v-if="scope.row.state == 40"
|
||||||
|
type="success"
|
||||||
|
>
|
||||||
{{ state_[scope.row.state] }}
|
{{ state_[scope.row.state] }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag v-else-if="scope.row.state == 34" type="danger">
|
<el-tag
|
||||||
|
v-else-if="scope.row.state == 34"
|
||||||
|
type="danger"
|
||||||
|
>
|
||||||
{{ state_[scope.row.state] }}
|
{{ state_[scope.row.state] }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag v-else>
|
<el-tag v-else>
|
||||||
|
@ -58,44 +96,98 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="任务类型" prop="type">
|
<el-table-column label="任务类型" prop="type">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-link v-if="scope.row.type == 'mass'" type="primary">量产</el-link>
|
<el-link
|
||||||
|
v-if="scope.row.type == 'mass'"
|
||||||
|
type="primary"
|
||||||
|
>量产</el-link
|
||||||
|
>
|
||||||
<el-link v-else type="success">中试</el-link>
|
<el-link v-else type="success">中试</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="任务量" prop="count"> </el-table-column>
|
<el-table-column label="任务量" prop="count">
|
||||||
<el-table-column label="计划量" prop="count"> </el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="计划量" prop="count">
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="日均产量" prop="count_day">
|
<el-table-column label="日均产量" prop="count_day">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="计划开工时间" prop="start_date" width="120">
|
<el-table-column
|
||||||
|
label="计划开工时间"
|
||||||
|
prop="start_date"
|
||||||
|
width="120"
|
||||||
|
>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="计划完工时间" prop="end_date" width="120">
|
<el-table-column
|
||||||
|
label="计划完工时间"
|
||||||
|
prop="end_date"
|
||||||
|
width="120"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="合格数" prop="count_ok">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合格数" prop="count_ok"> </el-table-column>
|
|
||||||
<el-table-column label="完成率" prop="count">
|
<el-table-column label="完成率" prop="count">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span v-if="scope.row.count != 0&&scope.row.count_ok!= 0">{{ Math.round((scope.row.count_ok / scope.row.count) * 100) }}%</span>
|
<span
|
||||||
|
v-if="
|
||||||
|
scope.row.count != 0 &&
|
||||||
|
scope.row.count_ok != 0
|
||||||
|
"
|
||||||
|
>{{
|
||||||
|
Math.round(
|
||||||
|
(scope.row.count_ok /
|
||||||
|
scope.row.count) *
|
||||||
|
100
|
||||||
|
)
|
||||||
|
}}%</span
|
||||||
|
>
|
||||||
<span v-else>0</span>
|
<span v-else>0</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" fixed="right" width="150">
|
<el-table-column label="操作" fixed="right" width="150">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" @click.stop="table_show(scope.row)">
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click.stop="table_show(scope.row)"
|
||||||
|
>
|
||||||
查看
|
查看
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button link type="primary" @click.stop="table_edit(scope.row)"
|
<el-button
|
||||||
v-if="scope.row.state == 10" v-auth="'utask.update'">
|
link
|
||||||
|
type="primary"
|
||||||
|
@click.stop="table_edit(scope.row)"
|
||||||
|
v-if="scope.row.state == 10"
|
||||||
|
v-auth="'utask.update'"
|
||||||
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-popconfirm title="确定删除吗?" @confirm.stop="table_del(scope.row)"
|
<el-popconfirm
|
||||||
v-if="scope.row.state == 10 || scope.row.state == 14" v-auth="'utask.delete'">
|
title="确定删除吗?"
|
||||||
|
@confirm.stop="table_del(scope.row)"
|
||||||
|
v-if="
|
||||||
|
scope.row.state == 10 ||
|
||||||
|
scope.row.state == 14
|
||||||
|
"
|
||||||
|
v-auth="'utask.delete'"
|
||||||
|
>
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button link type="danger">删除</el-button>
|
<el-button link type="danger"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
<el-popconfirm title="确定终止该任务吗?" @confirm.stop="table_stop(scope.row)"
|
<el-popconfirm
|
||||||
v-if="scope.row.state==30" v-auth="'utask.stop'">
|
title="确定终止该任务吗?"
|
||||||
|
@confirm.stop="table_stop(scope.row)"
|
||||||
|
v-if="scope.row.state == 30"
|
||||||
|
v-auth="'utask.stop'"
|
||||||
|
>
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button link type="danger" v-if="scope.row.state==30">终止</el-button>
|
<el-button
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
v-if="scope.row.state == 30"
|
||||||
|
>终止</el-button
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
</template>
|
</template>
|
||||||
|
@ -105,29 +197,44 @@
|
||||||
</el-container>
|
</el-container>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main class="nopadding">
|
<el-main class="nopadding">
|
||||||
<GanttComponent class="left-container" v-if="ganntVisit" :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>
|
||||||
<showDrawer ref="showDrawer" v-if="visibleDrawer" :utaskId="utaskId" @closed="visibleDrawer = false">
|
<showDrawer
|
||||||
|
ref="showDrawer"
|
||||||
|
v-if="visibleDrawer"
|
||||||
|
:utaskId="utaskId"
|
||||||
|
@closed="visibleDrawer = false"
|
||||||
|
>
|
||||||
</showDrawer>
|
</showDrawer>
|
||||||
<save-dialog v-if="dialog.save" ref="saveDialog" :activeDept="currentDept.id" @success="handleSaveSuccess"
|
<save-dialog
|
||||||
@closed="dialog.save = false"></save-dialog>
|
v-if="dialog.save"
|
||||||
|
ref="saveDialog"
|
||||||
|
:activeDept="currentDept.id"
|
||||||
|
@success="handleSaveSuccess"
|
||||||
|
@closed="dialog.save = false"
|
||||||
|
></save-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import saveDialog from "./utask_form.vue";
|
import saveDialog from "./utask_form.vue";
|
||||||
import showDrawer from "./mtask_drawer.vue"
|
import showDrawer from "./mtask_drawer.vue";
|
||||||
import GanttComponent from '@/components/GanttComponent.vue';
|
import GanttComponent from "@/components/GanttComponent.vue";
|
||||||
export default {
|
export default {
|
||||||
name: 'utask_dept10',
|
name: "utask_dept10",
|
||||||
components: {
|
components: {
|
||||||
saveDialog,
|
saveDialog,
|
||||||
showDrawer,
|
showDrawer,
|
||||||
GanttComponent
|
GanttComponent,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
utaskId: '',
|
utaskId: "",
|
||||||
visibleDrawer: false,
|
visibleDrawer: false,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
selectedIds: [],
|
selectedIds: [],
|
||||||
|
@ -135,9 +242,9 @@ export default {
|
||||||
save: false,
|
save: false,
|
||||||
},
|
},
|
||||||
tasks: {
|
tasks: {
|
||||||
data: []
|
data: [],
|
||||||
},
|
},
|
||||||
dateValue:'',
|
dateValue: "",
|
||||||
apiUtask: null,
|
apiUtask: null,
|
||||||
apiObj: null,
|
apiObj: null,
|
||||||
ganntVisit: true,
|
ganntVisit: true,
|
||||||
|
@ -151,48 +258,53 @@ export default {
|
||||||
14: "已分解",
|
14: "已分解",
|
||||||
20: "已下达",
|
20: "已下达",
|
||||||
30: "生产中",
|
30: "生产中",
|
||||||
34:'终止',
|
34: "终止",
|
||||||
40: "已提交",
|
40: "已提交",
|
||||||
},
|
},
|
||||||
start_date:''
|
start_date: "",
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initDept()
|
this.initDept();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initDept() {
|
initDept() {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.$API.system.dept.list.req({ page: 0, name: '10车间' }).then(res => {
|
that.$API.system.dept.list
|
||||||
|
.req({ page: 0, name: "10车间" })
|
||||||
|
.then((res) => {
|
||||||
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.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) {
|
updateCount(res, tableData) {
|
||||||
let that = this;
|
let that = this;
|
||||||
this.count = res.count;
|
this.count = res.count;
|
||||||
let data = [];
|
let data = [];
|
||||||
console.log('tableData', tableData)
|
that.ganntVisit = false;
|
||||||
|
that.tasks.data = [];
|
||||||
|
console.log("tableData", tableData);
|
||||||
if (tableData.length > 0) {
|
if (tableData.length > 0) {
|
||||||
tableData.forEach(item=>{
|
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 = {};
|
||||||
objItem.id = item.id;
|
objItem.id = item.id;
|
||||||
objItem.type = 'utask';
|
objItem.type = "utask";
|
||||||
objItem.number = item.number;
|
objItem.number = item.number;
|
||||||
objItem.count = item.count;
|
objItem.count = item.count;
|
||||||
objItem.text = item.number;
|
objItem.text = item.number;
|
||||||
objItem.material_name = item.material_.name;
|
objItem.material_name = item.material_.name;
|
||||||
objItem.material_specification = item.material_.specification;
|
objItem.material_specification =
|
||||||
|
item.material_.specification;
|
||||||
objItem.material_model = item.material_.model;
|
objItem.material_model = item.material_.model;
|
||||||
objItem.progress = item.count_real / item.count;;
|
objItem.progress = item.count_real / item.count;
|
||||||
objItem.count_ok = item.count_ok;
|
objItem.count_ok = item.count_ok;
|
||||||
objItem.count_real = item.count_real;
|
objItem.count_real = item.count_real;
|
||||||
objItem.count_notok = item.count_notok;
|
objItem.count_notok = item.count_notok;
|
||||||
|
@ -204,38 +316,40 @@ export default {
|
||||||
let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
||||||
let firstDate = new Date(start_date);
|
let firstDate = new Date(start_date);
|
||||||
let secondDate = new Date(end_date);
|
let secondDate = new Date(end_date);
|
||||||
let timeDiff = Math.abs(secondDate.getTime()-firstDate.getTime());
|
let timeDiff = Math.abs(
|
||||||
|
secondDate.getTime() - firstDate.getTime()
|
||||||
|
);
|
||||||
let daysDiff = Math.ceil(timeDiff / oneDay);
|
let daysDiff = Math.ceil(timeDiff / oneDay);
|
||||||
objItem.duration = daysDiff + 1;
|
objItem.duration = daysDiff + 1;
|
||||||
data.push(objItem)
|
data.push(objItem);
|
||||||
that.start_date = start_date;
|
that.start_date = start_date;
|
||||||
console.log('objItemduration',objItem.duration)
|
});
|
||||||
})
|
|
||||||
}
|
}
|
||||||
that.ganntVisit = true;
|
|
||||||
that.tasks.data = data;
|
that.tasks.data = data;
|
||||||
|
that.ganntVisit = true;
|
||||||
gantt.parse(that.tasks);
|
gantt.parse(that.tasks);
|
||||||
// 刷新数据
|
// 刷新数据
|
||||||
gantt.refreshData();
|
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) => {
|
||||||
let list = res.results;
|
let list = res.results;
|
||||||
let data = [];
|
let data = [];
|
||||||
list.forEach(item=>{
|
list.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 = {};
|
||||||
objItem.id = item.id;
|
objItem.id = item.id;
|
||||||
objItem.type = 'utask';
|
objItem.type = "utask";
|
||||||
objItem.number = item.number;
|
objItem.number = item.number;
|
||||||
objItem.count = item.count;
|
objItem.count = item.count;
|
||||||
objItem.text = item.number;
|
objItem.text = item.number;
|
||||||
objItem.material_name = item.material_.name;
|
objItem.material_name = item.material_.name;
|
||||||
objItem.material_specification = item.material_.specification;
|
objItem.material_specification =
|
||||||
|
item.material_.specification;
|
||||||
objItem.material_model = item.material_.model;
|
objItem.material_model = item.material_.model;
|
||||||
objItem.progress = item.count_real / item.count;;
|
objItem.progress = item.count_real / item.count;
|
||||||
objItem.count_ok = item.count_ok;
|
objItem.count_ok = item.count_ok;
|
||||||
objItem.count_real = item.count_real;
|
objItem.count_real = item.count_real;
|
||||||
objItem.count_notok = item.count_notok;
|
objItem.count_notok = item.count_notok;
|
||||||
|
@ -247,19 +361,21 @@ export default {
|
||||||
let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
||||||
let firstDate = new Date(start_date);
|
let firstDate = new Date(start_date);
|
||||||
let secondDate = new Date(end_date);
|
let secondDate = new Date(end_date);
|
||||||
let timeDiff = Math.abs(secondDate.getTime()-firstDate.getTime());
|
let timeDiff = Math.abs(
|
||||||
|
secondDate.getTime() - firstDate.getTime()
|
||||||
|
);
|
||||||
let daysDiff = Math.ceil(timeDiff / oneDay);
|
let daysDiff = Math.ceil(timeDiff / oneDay);
|
||||||
objItem.duration = daysDiff + 1;
|
objItem.duration = daysDiff + 1;
|
||||||
data.push(objItem)
|
data.push(objItem);
|
||||||
that.start_date = start_date;
|
that.start_date = start_date;
|
||||||
console.log('objItemduration',objItem.duration)
|
console.log("objItemduration", objItem.duration);
|
||||||
})
|
});
|
||||||
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;
|
||||||
|
@ -318,7 +434,9 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
table_stop(row) {
|
table_stop(row) {
|
||||||
this.$API.pm.utask.stop.req(row.id).then((res) => {
|
this.$API.pm.utask.stop
|
||||||
|
.req(row.id)
|
||||||
|
.then((res) => {
|
||||||
this.$message.success("操作成功");
|
this.$message.success("操作成功");
|
||||||
this.$refs.table.refresh();
|
this.$refs.table.refresh();
|
||||||
return res;
|
return res;
|
||||||
|
@ -391,13 +509,13 @@ export default {
|
||||||
this.paramsUtask.start_date__gte = start_date;
|
this.paramsUtask.start_date__gte = start_date;
|
||||||
this.paramsUtask.end_date__lte = end_date;
|
this.paramsUtask.end_date__lte = end_date;
|
||||||
} else {
|
} else {
|
||||||
this.paramsUtask.start_date__gte = '';
|
this.paramsUtask.start_date__gte = "";
|
||||||
this.paramsUtask.end_date__lte = '';
|
this.paramsUtask.end_date__lte = "";
|
||||||
}
|
}
|
||||||
this.$refs.tables.refresh();
|
this.$refs.tables.refresh();
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.countBlock {
|
.countBlock {
|
||||||
|
|
|
@ -4,12 +4,27 @@
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-header>
|
<el-header>
|
||||||
<div class="'left-panel'">
|
<div class="'left-panel'">
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="utaskCreate"
|
<el-button
|
||||||
v-auth="'utask.create'">新增任务</el-button>
|
type="primary"
|
||||||
<el-button type="primary" @click="utaskDepuse" v-loading="isLoading"
|
icon="el-icon-plus"
|
||||||
v-auth="'utask.schedule'">任务分解</el-button>
|
@click="utaskCreate"
|
||||||
<el-button type="primary" @click="utaskAssgin" v-loading="isLoading"
|
v-auth="'utask.create'"
|
||||||
v-auth="'utask.assgin'">任务下达</el-button>
|
>新增任务</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="utaskDepuse"
|
||||||
|
v-loading="isLoading"
|
||||||
|
v-auth="'utask.schedule'"
|
||||||
|
>任务分解</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="utaskAssgin"
|
||||||
|
v-loading="isLoading"
|
||||||
|
v-auth="'utask.assgin'"
|
||||||
|
>任务下达</el-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="'right-panel'">
|
<div class="'right-panel'">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
|
@ -21,16 +36,38 @@
|
||||||
value-format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD"
|
||||||
style="vertical-align: middle; margin-right: 6px"
|
style="vertical-align: middle; margin-right: 6px"
|
||||||
/>
|
/>
|
||||||
<el-button type="primary" @click="utaskSearch" v-loading="isLoading">搜索</el-button>
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="utaskSearch"
|
||||||
|
v-loading="isLoading"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main class="nopadding">
|
<el-main class="nopadding">
|
||||||
<scTable ref="tables" :apiObj="apiUtask" row-key="id" stripe :params="paramsUtask" @row-click="rowclick"
|
<scTable
|
||||||
@selection-change="handleSelectionChange" @dataChange="updateCount">
|
ref="tables"
|
||||||
|
:apiObj="apiUtask"
|
||||||
|
row-key="id"
|
||||||
|
stripe
|
||||||
|
:params="paramsUtask"
|
||||||
|
@row-click="rowclick"
|
||||||
|
@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
|
||||||
<el-table-column label="产品名称" prop="material_" show-overflow-tooltip>
|
label="任务编号"
|
||||||
|
prop="number"
|
||||||
|
width="120"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="产品名称"
|
||||||
|
prop="material_"
|
||||||
|
show-overflow-tooltip
|
||||||
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ scope.row.material_.name }}
|
{{ scope.row.material_.name }}
|
||||||
</template>
|
</template>
|
||||||
|
@ -47,10 +84,16 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="任务状态" prop="state">
|
<el-table-column label="任务状态" prop="state">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag v-if="scope.row.state == 40" type="success">
|
<el-tag
|
||||||
|
v-if="scope.row.state == 40"
|
||||||
|
type="success"
|
||||||
|
>
|
||||||
{{ state_[scope.row.state] }}
|
{{ state_[scope.row.state] }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag v-else-if="scope.row.state == 34" type="danger">
|
<el-tag
|
||||||
|
v-else-if="scope.row.state == 34"
|
||||||
|
type="danger"
|
||||||
|
>
|
||||||
{{ state_[scope.row.state] }}
|
{{ state_[scope.row.state] }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag v-else>
|
<el-tag v-else>
|
||||||
|
@ -60,44 +103,95 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="任务类型" prop="type">
|
<el-table-column label="任务类型" prop="type">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-link v-if="scope.row.type == 'mass'" type="primary">量产</el-link>
|
<el-link
|
||||||
|
v-if="scope.row.type == 'mass'"
|
||||||
|
type="primary"
|
||||||
|
>量产</el-link
|
||||||
|
>
|
||||||
<el-link v-else type="success">中试</el-link>
|
<el-link v-else type="success">中试</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="任务量" prop="count"> </el-table-column>
|
<el-table-column label="任务量" prop="count">
|
||||||
<el-table-column label="计划量" prop="count"> </el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="计划量" prop="count">
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="日均产量" prop="count_day">
|
<el-table-column label="日均产量" prop="count_day">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="计划开工时间" prop="start_date" width="120">
|
<el-table-column
|
||||||
|
label="计划开工时间"
|
||||||
|
prop="start_date"
|
||||||
|
width="120"
|
||||||
|
>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="计划完工时间" prop="end_date" width="120">
|
<el-table-column
|
||||||
|
label="计划完工时间"
|
||||||
|
prop="end_date"
|
||||||
|
width="120"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="合格数" prop="count_ok">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合格数" prop="count_ok"> </el-table-column>
|
|
||||||
<el-table-column label="完成率" prop="count">
|
<el-table-column label="完成率" prop="count">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span v-if="scope.row.count != 0&&scope.row.count_ok!= 0">{{ Math.round((scope.row.count_ok / scope.row.count) * 100) }}%</span>
|
<span
|
||||||
|
v-if="
|
||||||
|
scope.row.count != 0 &&
|
||||||
|
scope.row.count_ok != 0
|
||||||
|
"
|
||||||
|
>{{
|
||||||
|
Math.round(
|
||||||
|
(scope.row.count_ok /
|
||||||
|
scope.row.count) *
|
||||||
|
100
|
||||||
|
)
|
||||||
|
}}%</span
|
||||||
|
>
|
||||||
<span v-else>0</span>
|
<span v-else>0</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" fixed="right" width="150">
|
<el-table-column label="操作" fixed="right" width="150">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" @click.stop="table_show(scope.row)">
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click.stop="table_show(scope.row)"
|
||||||
|
>
|
||||||
查看
|
查看
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button link type="primary" @click.stop="table_edit(scope.row)"
|
<el-button
|
||||||
v-if="scope.row.state==10" v-auth="'utask.update'">
|
link
|
||||||
|
type="primary"
|
||||||
|
@click.stop="table_edit(scope.row)"
|
||||||
|
v-if="scope.row.state == 10"
|
||||||
|
v-auth="'utask.update'"
|
||||||
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-popconfirm title="确定删除吗?" @confirm.stop="table_del(scope.row)"
|
<el-popconfirm
|
||||||
v-if="scope.row.state==10||scope.row.state==14" v-auth="'utask.delete'">
|
title="确定删除吗?"
|
||||||
|
@confirm.stop="table_del(scope.row)"
|
||||||
|
v-if="
|
||||||
|
scope.row.state == 10 ||
|
||||||
|
scope.row.state == 14
|
||||||
|
"
|
||||||
|
v-auth="'utask.delete'"
|
||||||
|
>
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button link type="danger">删除</el-button>
|
<el-button link type="danger"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
<el-popconfirm title="确定终止该任务吗?" @confirm.stop="table_stop(scope.row)"
|
<el-popconfirm
|
||||||
v-if="scope.row.state==30" v-auth="'utask.stop'">
|
title="确定终止该任务吗?"
|
||||||
|
@confirm.stop="table_stop(scope.row)"
|
||||||
|
v-if="scope.row.state == 30"
|
||||||
|
v-auth="'utask.stop'"
|
||||||
|
>
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button link type="danger">终止</el-button>
|
<el-button link type="danger"
|
||||||
|
>终止</el-button
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
</template>
|
</template>
|
||||||
|
@ -114,31 +208,46 @@
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main class="nopadding">
|
<el-main class="nopadding">
|
||||||
<GanttComponent class="left-container" v-if="ganntVisit" :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>
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
<save-dialog v-if="dialog.save" ref="saveDialog" :activeDept="currentDept.id" @success="handleSaveSuccess"
|
<save-dialog
|
||||||
@closed="dialog.save = false"></save-dialog>
|
v-if="dialog.save"
|
||||||
<showDrawer ref="showDrawer" v-if="visibleDrawer" :utaskId="utaskId" @closed="visibleDrawer = false">
|
ref="saveDialog"
|
||||||
|
:activeDept="currentDept.id"
|
||||||
|
@success="handleSaveSuccess"
|
||||||
|
@closed="dialog.save = false"
|
||||||
|
></save-dialog>
|
||||||
|
<showDrawer
|
||||||
|
ref="showDrawer"
|
||||||
|
v-if="visibleDrawer"
|
||||||
|
:utaskId="utaskId"
|
||||||
|
@closed="visibleDrawer = false"
|
||||||
|
>
|
||||||
</showDrawer>
|
</showDrawer>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import GanttComponent from '@/components/GanttComponent.vue';
|
import GanttComponent from "@/components/GanttComponent.vue";
|
||||||
import saveDialog from "./utask_form_2.vue";
|
import saveDialog from "./utask_form_2.vue";
|
||||||
import showDrawer from "./mtask_drawer.vue"
|
import showDrawer from "./mtask_drawer.vue";
|
||||||
export default {
|
export default {
|
||||||
name: 'utask_dept6',
|
name: "utask_dept6",
|
||||||
components: {
|
components: {
|
||||||
saveDialog,
|
saveDialog,
|
||||||
showDrawer,
|
showDrawer,
|
||||||
GanttComponent
|
GanttComponent,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
utaskId: '',
|
utaskId: "",
|
||||||
visibleDrawer: false,
|
visibleDrawer: false,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
selectedIds: [],
|
selectedIds: [],
|
||||||
|
@ -146,11 +255,11 @@ export default {
|
||||||
save: false,
|
save: false,
|
||||||
},
|
},
|
||||||
query: {
|
query: {
|
||||||
start_date:'',
|
start_date: "",
|
||||||
end_date:'',
|
end_date: "",
|
||||||
},
|
},
|
||||||
ganntVisit: true,
|
ganntVisit: true,
|
||||||
dateValue:'',
|
dateValue: "",
|
||||||
apiUtask: null,
|
apiUtask: null,
|
||||||
currentDept: { id: 0 },
|
currentDept: { id: 0 },
|
||||||
paramsUtask: {},
|
paramsUtask: {},
|
||||||
|
@ -160,52 +269,57 @@ export default {
|
||||||
14: "已分解",
|
14: "已分解",
|
||||||
20: "已下达",
|
20: "已下达",
|
||||||
30: "生产中",
|
30: "生产中",
|
||||||
34:'终止',
|
34: "终止",
|
||||||
40: "已提交",
|
40: "已提交",
|
||||||
},
|
},
|
||||||
tasks: {
|
tasks: {
|
||||||
data: []
|
data: [],
|
||||||
},
|
},
|
||||||
end_date: '',
|
end_date: "",
|
||||||
start_date: '',
|
start_date: "",
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initDept()
|
this.initDept();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initDept() {
|
initDept() {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.$API.system.dept.list.req({ page: 0, name: '6车间' }).then(res => {
|
that.$API.system.dept.list
|
||||||
|
.req({ page: 0, name: "6车间" })
|
||||||
|
.then((res) => {
|
||||||
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.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) {
|
updateCount(res, tableData) {
|
||||||
let that = this;
|
let that = this;
|
||||||
this.count = res.count;
|
this.count = res.count;
|
||||||
let data = [];
|
let data = [];
|
||||||
console.log('tableData', tableData)
|
that.ganntVisit = false;
|
||||||
|
that.tasks.data = [];
|
||||||
|
console.log("tableData", tableData);
|
||||||
if (tableData.length > 0) {
|
if (tableData.length > 0) {
|
||||||
tableData.forEach(item=>{
|
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 = {};
|
||||||
objItem.id = item.id;
|
objItem.id = item.id;
|
||||||
objItem.type = 'utask';
|
objItem.type = "utask";
|
||||||
objItem.number = item.number;
|
objItem.number = item.number;
|
||||||
objItem.count = item.count;
|
objItem.count = item.count;
|
||||||
objItem.text = item.number;
|
objItem.text = item.number;
|
||||||
objItem.material_name = item.material_.name;
|
objItem.material_name = item.material_.name;
|
||||||
objItem.material_specification = item.material_.specification;
|
objItem.material_specification =
|
||||||
|
item.material_.specification;
|
||||||
objItem.material_model = item.material_.model;
|
objItem.material_model = item.material_.model;
|
||||||
objItem.progress = item.count_real / item.count;;
|
objItem.progress = item.count_real / item.count;
|
||||||
objItem.count_ok = item.count_ok;
|
objItem.count_ok = item.count_ok;
|
||||||
objItem.count_real = item.count_real;
|
objItem.count_real = item.count_real;
|
||||||
objItem.count_notok = item.count_notok;
|
objItem.count_notok = item.count_notok;
|
||||||
|
@ -217,38 +331,40 @@ export default {
|
||||||
let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
||||||
let firstDate = new Date(start_date);
|
let firstDate = new Date(start_date);
|
||||||
let secondDate = new Date(end_date);
|
let secondDate = new Date(end_date);
|
||||||
let timeDiff = Math.abs(secondDate.getTime()-firstDate.getTime());
|
let timeDiff = Math.abs(
|
||||||
|
secondDate.getTime() - firstDate.getTime()
|
||||||
|
);
|
||||||
let daysDiff = Math.ceil(timeDiff / oneDay);
|
let daysDiff = Math.ceil(timeDiff / oneDay);
|
||||||
objItem.duration = daysDiff + 1;
|
objItem.duration = daysDiff + 1;
|
||||||
data.push(objItem)
|
data.push(objItem);
|
||||||
that.start_date = start_date;
|
that.start_date = start_date;
|
||||||
console.log('objItemduration',objItem.duration)
|
});
|
||||||
})
|
|
||||||
}
|
}
|
||||||
that.ganntVisit = true;
|
|
||||||
that.tasks.data = data;
|
that.tasks.data = data;
|
||||||
|
that.ganntVisit = true;
|
||||||
gantt.parse(that.tasks);
|
gantt.parse(that.tasks);
|
||||||
// 刷新数据
|
// 刷新数据
|
||||||
gantt.refreshData();
|
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) => {
|
||||||
let list = res.results;
|
let list = res.results;
|
||||||
let data = [];
|
let data = [];
|
||||||
list.forEach(item=>{
|
list.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 = {};
|
||||||
objItem.id = item.id;
|
objItem.id = item.id;
|
||||||
objItem.type = 'utask';
|
objItem.type = "utask";
|
||||||
objItem.number = item.number;
|
objItem.number = item.number;
|
||||||
objItem.count = item.count;
|
objItem.count = item.count;
|
||||||
objItem.text = item.number;
|
objItem.text = item.number;
|
||||||
objItem.material_name = item.material_.name;
|
objItem.material_name = item.material_.name;
|
||||||
objItem.material_specification = item.material_.specification;
|
objItem.material_specification =
|
||||||
|
item.material_.specification;
|
||||||
objItem.material_model = item.material_.model;
|
objItem.material_model = item.material_.model;
|
||||||
objItem.progress = item.count_real / item.count;;
|
objItem.progress = item.count_real / item.count;
|
||||||
objItem.count_ok = item.count_ok;
|
objItem.count_ok = item.count_ok;
|
||||||
objItem.count_real = item.count_real;
|
objItem.count_real = item.count_real;
|
||||||
objItem.count_notok = item.count_notok;
|
objItem.count_notok = item.count_notok;
|
||||||
|
@ -260,19 +376,21 @@ export default {
|
||||||
let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
||||||
let firstDate = new Date(start_date);
|
let firstDate = new Date(start_date);
|
||||||
let secondDate = new Date(end_date);
|
let secondDate = new Date(end_date);
|
||||||
let timeDiff = Math.abs(secondDate.getTime()-firstDate.getTime());
|
let timeDiff = Math.abs(
|
||||||
|
secondDate.getTime() - firstDate.getTime()
|
||||||
|
);
|
||||||
let daysDiff = Math.ceil(timeDiff / oneDay);
|
let daysDiff = Math.ceil(timeDiff / oneDay);
|
||||||
objItem.duration = daysDiff + 1;
|
objItem.duration = daysDiff + 1;
|
||||||
data.push(objItem)
|
data.push(objItem);
|
||||||
that.start_date = start_date;
|
that.start_date = start_date;
|
||||||
console.log('objItemduration',objItem.duration)
|
console.log("objItemduration", objItem.duration);
|
||||||
})
|
});
|
||||||
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,7 +461,9 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
table_stop(row) {
|
table_stop(row) {
|
||||||
this.$API.pm.utask.stop.req(row.id).then((res) => {
|
this.$API.pm.utask.stop
|
||||||
|
.req(row.id)
|
||||||
|
.then((res) => {
|
||||||
this.$message.success("操作成功");
|
this.$message.success("操作成功");
|
||||||
this.$refs.table.refresh();
|
this.$refs.table.refresh();
|
||||||
return res;
|
return res;
|
||||||
|
@ -386,14 +506,14 @@ export default {
|
||||||
let end_date = row.end_date;
|
let end_date = row.end_date;
|
||||||
let objItem = {};
|
let objItem = {};
|
||||||
objItem.id = row.id;
|
objItem.id = row.id;
|
||||||
objItem.type = 'utask';
|
objItem.type = "utask";
|
||||||
objItem.number = row.number;
|
objItem.number = row.number;
|
||||||
objItem.count = row.count;
|
objItem.count = row.count;
|
||||||
objItem.text = row.number;
|
objItem.text = row.number;
|
||||||
objItem.material_name = row.material_.name;
|
objItem.material_name = row.material_.name;
|
||||||
objItem.material_specification = row.material_.specification;
|
objItem.material_specification = row.material_.specification;
|
||||||
objItem.material_model = row.material_.model;
|
objItem.material_model = row.material_.model;
|
||||||
objItem.progress = row.count_real / row.count;;
|
objItem.progress = row.count_real / row.count;
|
||||||
objItem.count_ok = row.count_ok;
|
objItem.count_ok = row.count_ok;
|
||||||
objItem.count_real = row.count_real;
|
objItem.count_real = row.count_real;
|
||||||
objItem.count_notok = row.count_notok;
|
objItem.count_notok = row.count_notok;
|
||||||
|
@ -407,11 +527,11 @@ export default {
|
||||||
let timeDiff = Math.abs(secondDate.getTime() - firstDate.getTime());
|
let timeDiff = Math.abs(secondDate.getTime() - firstDate.getTime());
|
||||||
let daysDiff = Math.ceil(timeDiff / oneDay);
|
let daysDiff = Math.ceil(timeDiff / oneDay);
|
||||||
objItem.duration = daysDiff + 1;
|
objItem.duration = daysDiff + 1;
|
||||||
data.push(objItem)
|
data.push(objItem);
|
||||||
that.start_date = start_date
|
that.start_date = start_date;
|
||||||
that.end_date = end_date;
|
that.end_date = end_date;
|
||||||
that.tasks.data = data;
|
that.tasks.data = data;
|
||||||
console.log('objItemduration',objItem.duration)
|
console.log("objItemduration", objItem.duration);
|
||||||
gantt.parse(that.tasks);
|
gantt.parse(that.tasks);
|
||||||
// 刷新数据
|
// 刷新数据
|
||||||
gantt.refreshData();
|
gantt.refreshData();
|
||||||
|
@ -457,13 +577,13 @@ export default {
|
||||||
this.paramsUtask.start_date__gte = start_date;
|
this.paramsUtask.start_date__gte = start_date;
|
||||||
this.paramsUtask.end_date__lte = end_date;
|
this.paramsUtask.end_date__lte = end_date;
|
||||||
} else {
|
} else {
|
||||||
this.paramsUtask.start_date__gte = '';
|
this.paramsUtask.start_date__gte = "";
|
||||||
this.paramsUtask.end_date__lte = '';
|
this.paramsUtask.end_date__lte = "";
|
||||||
}
|
}
|
||||||
this.$refs.tables.refresh();
|
this.$refs.tables.refresh();
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.countBlock {
|
.countBlock {
|
||||||
|
|
|
@ -4,10 +4,20 @@
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-header>
|
<el-header>
|
||||||
<div class="'left-panel'">
|
<div class="'left-panel'">
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="utaskCreate"
|
<el-button
|
||||||
v-auth="'utask.create'">新增任务</el-button>
|
type="primary"
|
||||||
<el-button type="primary" @click="utaskDepuse" v-loading="isLoading"
|
icon="el-icon-plus"
|
||||||
v-auth="'utask.assgin'">任务分解并下达</el-button>
|
@click="utaskCreate"
|
||||||
|
v-auth="'utask.create'"
|
||||||
|
>新增任务</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="utaskDepuse"
|
||||||
|
v-loading="isLoading"
|
||||||
|
v-auth="'utask.assgin'"
|
||||||
|
>任务分解并下达</el-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="'right-panel'">
|
<div class="'right-panel'">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
|
@ -19,16 +29,39 @@
|
||||||
value-format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD"
|
||||||
style="vertical-align: middle; margin-right: 6px"
|
style="vertical-align: middle; margin-right: 6px"
|
||||||
/>
|
/>
|
||||||
<el-button type="primary" @click="utaskSearch" v-loading="isLoading">搜索</el-button>
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="utaskSearch"
|
||||||
|
v-loading="isLoading"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main class="nopadding">
|
<el-main class="nopadding">
|
||||||
<scTable ref="tables" :apiObj="apiUtask" row-key="id" stripe :params="paramsUtask" :query="queryUtask" @row-click="rowclick"
|
<scTable
|
||||||
@selection-change="handleSelectionChange" @dataChange="updateCount">
|
ref="tables"
|
||||||
|
:apiObj="apiUtask"
|
||||||
|
row-key="id"
|
||||||
|
stripe
|
||||||
|
:params="paramsUtask"
|
||||||
|
:query="queryUtask"
|
||||||
|
@row-click="rowclick"
|
||||||
|
@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
|
||||||
<el-table-column label="产品名称" prop="material_" show-overflow-tooltip>
|
label="任务编号"
|
||||||
|
prop="number"
|
||||||
|
width="120"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="产品名称"
|
||||||
|
prop="material_"
|
||||||
|
show-overflow-tooltip
|
||||||
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ scope.row.material_.name }}
|
{{ scope.row.material_.name }}
|
||||||
</template>
|
</template>
|
||||||
|
@ -45,10 +78,16 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="任务状态" prop="state">
|
<el-table-column label="任务状态" prop="state">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag v-if="scope.row.state == 40" type="success">
|
<el-tag
|
||||||
|
v-if="scope.row.state == 40"
|
||||||
|
type="success"
|
||||||
|
>
|
||||||
{{ state_[scope.row.state] }}
|
{{ state_[scope.row.state] }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag v-else-if="scope.row.state == 34" type="danger">
|
<el-tag
|
||||||
|
v-else-if="scope.row.state == 34"
|
||||||
|
type="danger"
|
||||||
|
>
|
||||||
{{ state_[scope.row.state] }}
|
{{ state_[scope.row.state] }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag v-else>
|
<el-tag v-else>
|
||||||
|
@ -58,44 +97,95 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="任务类型" prop="type">
|
<el-table-column label="任务类型" prop="type">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-link v-if="scope.row.type == 'mass'" type="primary">量产</el-link>
|
<el-link
|
||||||
|
v-if="scope.row.type == 'mass'"
|
||||||
|
type="primary"
|
||||||
|
>量产</el-link
|
||||||
|
>
|
||||||
<el-link v-else type="success">中试</el-link>
|
<el-link v-else type="success">中试</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="任务量" prop="count"> </el-table-column>
|
<el-table-column label="任务量" prop="count">
|
||||||
<el-table-column label="计划量" prop="count"> </el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="计划量" prop="count">
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="日均产量" prop="count_day">
|
<el-table-column label="日均产量" prop="count_day">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="计划开工时间" prop="start_date" width="120">
|
<el-table-column
|
||||||
|
label="计划开工时间"
|
||||||
|
prop="start_date"
|
||||||
|
width="120"
|
||||||
|
>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="计划完工时间" prop="end_date" width="120">
|
<el-table-column
|
||||||
|
label="计划完工时间"
|
||||||
|
prop="end_date"
|
||||||
|
width="120"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="合格数" prop="count_ok">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合格数" prop="count_ok"> </el-table-column>
|
|
||||||
<el-table-column label="完成率">
|
<el-table-column label="完成率">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span v-if="scope.row.count != 0&&scope.row.count_ok != 0">{{ Math.round(scope.row.count_ok / scope.row.count*100) }}%</span>
|
<span
|
||||||
|
v-if="
|
||||||
|
scope.row.count != 0 &&
|
||||||
|
scope.row.count_ok != 0
|
||||||
|
"
|
||||||
|
>{{
|
||||||
|
Math.round(
|
||||||
|
(scope.row.count_ok /
|
||||||
|
scope.row.count) *
|
||||||
|
100
|
||||||
|
)
|
||||||
|
}}%</span
|
||||||
|
>
|
||||||
<span v-else>0</span>
|
<span v-else>0</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" fixed="right" width="150">
|
<el-table-column label="操作" fixed="right" width="150">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" @click.stop="table_show(scope.row)">
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click.stop="table_show(scope.row)"
|
||||||
|
>
|
||||||
查看
|
查看
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button link type="primary" @click.stop="table_edit(scope.row)"
|
<el-button
|
||||||
v-if="scope.row.state == 10" v-auth="'utask.update'">
|
link
|
||||||
|
type="primary"
|
||||||
|
@click.stop="table_edit(scope.row)"
|
||||||
|
v-if="scope.row.state == 10"
|
||||||
|
v-auth="'utask.update'"
|
||||||
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-popconfirm title="确定删除吗?" @confirm.stop="table_del(scope.row)"
|
<el-popconfirm
|
||||||
v-if="scope.row.state == 10 || scope.row.state == 14" v-auth="'utask.delete'">
|
title="确定删除吗?"
|
||||||
|
@confirm.stop="table_del(scope.row)"
|
||||||
|
v-if="
|
||||||
|
scope.row.state == 10 ||
|
||||||
|
scope.row.state == 14
|
||||||
|
"
|
||||||
|
v-auth="'utask.delete'"
|
||||||
|
>
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button link type="danger">删除</el-button>
|
<el-button link type="danger"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
<el-popconfirm title="确定终止该任务吗?" @confirm.stop="table_stop(scope.row)"
|
<el-popconfirm
|
||||||
v-if="scope.row.state==30" v-auth="'utask.stop'">
|
title="确定终止该任务吗?"
|
||||||
|
@confirm.stop="table_stop(scope.row)"
|
||||||
|
v-if="scope.row.state == 30"
|
||||||
|
v-auth="'utask.stop'"
|
||||||
|
>
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button link type="danger">终止</el-button>
|
<el-button link type="danger"
|
||||||
|
>终止</el-button
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
</template>
|
</template>
|
||||||
|
@ -140,29 +230,44 @@
|
||||||
</scTable>
|
</scTable>
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container> -->
|
</el-container> -->
|
||||||
<GanttComponent class="left-container" :tasks="tasks" v-if="ganntVisit" :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>
|
||||||
<showDrawer ref="showDrawer" v-if="visibleDrawer" :utaskId="utaskId" @closed="visibleDrawer = false">
|
<showDrawer
|
||||||
|
ref="showDrawer"
|
||||||
|
v-if="visibleDrawer"
|
||||||
|
:utaskId="utaskId"
|
||||||
|
@closed="visibleDrawer = false"
|
||||||
|
>
|
||||||
</showDrawer>
|
</showDrawer>
|
||||||
<save-dialog v-if="dialog.save" ref="saveDialog" :activeDept="currentDept.id" @success="handleSaveSuccess"
|
<save-dialog
|
||||||
@closed="dialog.save = false"></save-dialog>
|
v-if="dialog.save"
|
||||||
|
ref="saveDialog"
|
||||||
|
:activeDept="currentDept.id"
|
||||||
|
@success="handleSaveSuccess"
|
||||||
|
@closed="dialog.save = false"
|
||||||
|
></save-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import saveDialog from "./utask_form.vue";
|
import saveDialog from "./utask_form.vue";
|
||||||
import showDrawer from "./mtask_drawer.vue";
|
import showDrawer from "./mtask_drawer.vue";
|
||||||
import GanttComponent from '@/components/GanttComponent.vue';
|
import GanttComponent from "@/components/GanttComponent.vue";
|
||||||
export default {
|
export default {
|
||||||
name: 'utask_dept7',
|
name: "utask_dept7",
|
||||||
components: {
|
components: {
|
||||||
saveDialog,
|
saveDialog,
|
||||||
showDrawer,
|
showDrawer,
|
||||||
GanttComponent
|
GanttComponent,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
utaskId: '',
|
utaskId: "",
|
||||||
visibleDrawer: false,
|
visibleDrawer: false,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
selectedIds: [],
|
selectedIds: [],
|
||||||
|
@ -170,7 +275,7 @@ export default {
|
||||||
save: false,
|
save: false,
|
||||||
},
|
},
|
||||||
tasks: {
|
tasks: {
|
||||||
data: []
|
data: [],
|
||||||
},
|
},
|
||||||
ganntVisit: true,
|
ganntVisit: true,
|
||||||
dateValue: [],
|
dateValue: [],
|
||||||
|
@ -186,12 +291,12 @@ export default {
|
||||||
14: "已分解",
|
14: "已分解",
|
||||||
20: "已下达",
|
20: "已下达",
|
||||||
30: "生产中",
|
30: "生产中",
|
||||||
34:'终止',
|
34: "终止",
|
||||||
40: "已提交",
|
40: "已提交",
|
||||||
},
|
},
|
||||||
start_date: '',
|
start_date: "",
|
||||||
newDate:''
|
newDate: "",
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initDept();
|
this.initDept();
|
||||||
|
@ -199,7 +304,9 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
initDept() {
|
initDept() {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.$API.system.dept.list.req({ page: 0, name: '7车间' }).then(res => {
|
that.$API.system.dept.list
|
||||||
|
.req({ page: 0, name: "7车间" })
|
||||||
|
.then((res) => {
|
||||||
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;
|
||||||
|
@ -209,27 +316,30 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
that.$message.error("未找到车间");
|
that.$message.error("未找到车间");
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
updateCount(res, tableData) {
|
updateCount(res, tableData) {
|
||||||
let that = this;
|
let that = this;
|
||||||
this.count = res.count;
|
this.count = res.count;
|
||||||
let data = [];
|
let data = [];
|
||||||
console.log('tableData', tableData)
|
that.ganntVisit = false;
|
||||||
|
that.tasks.data = [];
|
||||||
|
console.log("tableData", tableData);
|
||||||
if (tableData.length > 0) {
|
if (tableData.length > 0) {
|
||||||
tableData.forEach(item=>{
|
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 = {};
|
||||||
objItem.id = item.id;
|
objItem.id = item.id;
|
||||||
objItem.type = 'utask';
|
objItem.type = "utask";
|
||||||
objItem.number = item.number;
|
objItem.number = item.number;
|
||||||
objItem.count = item.count;
|
objItem.count = item.count;
|
||||||
objItem.text = item.number;
|
objItem.text = item.number;
|
||||||
objItem.material_name = item.material_.name;
|
objItem.material_name = item.material_.name;
|
||||||
objItem.material_specification = item.material_.specification;
|
objItem.material_specification =
|
||||||
|
item.material_.specification;
|
||||||
objItem.material_model = item.material_.model;
|
objItem.material_model = item.material_.model;
|
||||||
objItem.progress = item.count_real / item.count;;
|
objItem.progress = item.count_real / item.count;
|
||||||
objItem.count_ok = item.count_ok;
|
objItem.count_ok = item.count_ok;
|
||||||
objItem.count_real = item.count_real;
|
objItem.count_real = item.count_real;
|
||||||
objItem.count_notok = item.count_notok;
|
objItem.count_notok = item.count_notok;
|
||||||
|
@ -241,16 +351,17 @@ export default {
|
||||||
let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
||||||
let firstDate = new Date(start_date);
|
let firstDate = new Date(start_date);
|
||||||
let secondDate = new Date(end_date);
|
let secondDate = new Date(end_date);
|
||||||
let timeDiff = Math.abs(secondDate.getTime()-firstDate.getTime());
|
let timeDiff = Math.abs(
|
||||||
|
secondDate.getTime() - firstDate.getTime()
|
||||||
|
);
|
||||||
let daysDiff = Math.ceil(timeDiff / oneDay);
|
let daysDiff = Math.ceil(timeDiff / oneDay);
|
||||||
objItem.duration = daysDiff + 1;
|
objItem.duration = daysDiff + 1;
|
||||||
data.push(objItem)
|
data.push(objItem);
|
||||||
that.start_date = start_date;
|
that.start_date = start_date;
|
||||||
console.log('objItemduration',objItem.duration)
|
});
|
||||||
})
|
|
||||||
}
|
}
|
||||||
that.ganntVisit = true;
|
|
||||||
that.tasks.data = data;
|
that.tasks.data = data;
|
||||||
|
that.ganntVisit = true;
|
||||||
gantt.parse(that.tasks);
|
gantt.parse(that.tasks);
|
||||||
// 刷新数据
|
// 刷新数据
|
||||||
gantt.refreshData();
|
gantt.refreshData();
|
||||||
|
@ -312,7 +423,9 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
table_stop(row) {
|
table_stop(row) {
|
||||||
this.$API.pm.utask.stop.req(row.id).then((res) => {
|
this.$API.pm.utask.stop
|
||||||
|
.req(row.id)
|
||||||
|
.then((res) => {
|
||||||
this.$message.success("操作成功");
|
this.$message.success("操作成功");
|
||||||
this.$refs.table.refresh();
|
this.$refs.table.refresh();
|
||||||
return res;
|
return res;
|
||||||
|
@ -352,7 +465,7 @@ export default {
|
||||||
this.$refs.table.refresh();
|
this.$refs.table.refresh();
|
||||||
},
|
},
|
||||||
utaskSearch() {
|
utaskSearch() {
|
||||||
console.log('this.dateValue',this.dateValue);
|
console.log("this.dateValue", this.dateValue);
|
||||||
this.ganntVisit = false;
|
this.ganntVisit = false;
|
||||||
if (this.dateValue && this.dateValue.length > 0) {
|
if (this.dateValue && this.dateValue.length > 0) {
|
||||||
let start_date = this.dateValue[0];
|
let start_date = this.dateValue[0];
|
||||||
|
@ -360,13 +473,13 @@ export default {
|
||||||
this.paramsUtask.start_date__gte = start_date;
|
this.paramsUtask.start_date__gte = start_date;
|
||||||
this.paramsUtask.end_date__lte = end_date;
|
this.paramsUtask.end_date__lte = end_date;
|
||||||
} else {
|
} else {
|
||||||
this.paramsUtask.start_date__gte = '';
|
this.paramsUtask.start_date__gte = "";
|
||||||
this.paramsUtask.end_date__lte = '';
|
this.paramsUtask.end_date__lte = "";
|
||||||
}
|
}
|
||||||
this.$refs.tables.refresh();
|
this.$refs.tables.refresh();
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.countBlock {
|
.countBlock {
|
||||||
|
|
Loading…
Reference in New Issue