fix:gantt去掉累加,随上表数据变化变化
This commit is contained in:
parent
89d70548b9
commit
70df6c3837
|
|
@ -1,420 +1,538 @@
|
||||||
<template>
|
<template>
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-header style="height: 50%;padding: 0">
|
<el-header style="height: 50%; padding: 0">
|
||||||
<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"
|
||||||
</div>
|
v-auth="'utask.create'"
|
||||||
<div class="'right-panel'">
|
>新增任务</el-button
|
||||||
<el-date-picker
|
>
|
||||||
v-model="dateValue"
|
<el-button
|
||||||
type="daterange"
|
type="primary"
|
||||||
range-separator="至"
|
@click="utaskDepuse"
|
||||||
start-placeholder="开始时间"
|
v-loading="isLoading"
|
||||||
end-placeholder="结束时间"
|
v-auth="'utask.assgin'"
|
||||||
value-format="YYYY-MM-DD"
|
>任务分解并下达</el-button
|
||||||
style="vertical-align: middle;margin-right:6px"
|
>
|
||||||
/>
|
</div>
|
||||||
<el-button type="primary" @click="utaskSearch" v-loading="isLoading">搜索</el-button>
|
<div class="'right-panel'">
|
||||||
</div>
|
<el-date-picker
|
||||||
</el-header>
|
v-model="dateValue"
|
||||||
<el-main class="nopadding">
|
type="daterange"
|
||||||
<scTable ref="tables" :apiObj="apiUtask" row-key="id" stripe :params="paramsUtask" @row-click="rowclick"
|
range-separator="至"
|
||||||
@selection-change="handleSelectionChange" @dataChange="updateCount">
|
start-placeholder="开始时间"
|
||||||
<el-table-column type="selection" width="40" />
|
end-placeholder="结束时间"
|
||||||
<el-table-column type="index" width="40" />
|
value-format="YYYY-MM-DD"
|
||||||
<el-table-column label="任务编号" prop="number" width="120"> </el-table-column>
|
style="vertical-align: middle; margin-right: 6px"
|
||||||
<el-table-column label="产品名称" prop="material_" show-overflow-tooltip>
|
/>
|
||||||
<template #default="scope">
|
<el-button
|
||||||
{{ scope.row.material_.name }}
|
type="primary"
|
||||||
</template>
|
@click="utaskSearch"
|
||||||
</el-table-column>
|
v-loading="isLoading"
|
||||||
<el-table-column label="规格" prop="material_">
|
>搜索</el-button
|
||||||
<template #default="scope">
|
>
|
||||||
{{ scope.row.material_.specification }}
|
</div>
|
||||||
</template>
|
</el-header>
|
||||||
</el-table-column>
|
<el-main class="nopadding">
|
||||||
<el-table-column label="型号" prop="material_">
|
<scTable
|
||||||
<template #default="scope">
|
ref="tables"
|
||||||
{{ scope.row.material_.model }}
|
:apiObj="apiUtask"
|
||||||
</template>
|
row-key="id"
|
||||||
</el-table-column>
|
stripe
|
||||||
<el-table-column label="任务状态" prop="state">
|
:params="paramsUtask"
|
||||||
<template #default="scope">
|
@row-click="rowclick"
|
||||||
<el-tag v-if="scope.row.state == 40" type="success">
|
@selection-change="handleSelectionChange"
|
||||||
{{ state_[scope.row.state] }}
|
@dataChange="updateCount"
|
||||||
</el-tag>
|
>
|
||||||
<el-tag v-else-if="scope.row.state == 34" type="danger">
|
<el-table-column type="selection" width="40" />
|
||||||
{{ state_[scope.row.state] }}
|
<el-table-column type="index" width="40" />
|
||||||
</el-tag>
|
<el-table-column
|
||||||
<el-tag v-else>
|
label="任务编号"
|
||||||
{{ state_[scope.row.state] }}
|
prop="number"
|
||||||
</el-tag>
|
width="120"
|
||||||
</template>
|
>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="任务类型" prop="type">
|
<el-table-column
|
||||||
<template #default="scope">
|
label="产品名称"
|
||||||
<el-link v-if="scope.row.type == 'mass'" type="primary">量产</el-link>
|
prop="material_"
|
||||||
<el-link v-else type="success">中试</el-link>
|
show-overflow-tooltip
|
||||||
</template>
|
>
|
||||||
</el-table-column>
|
<template #default="scope">
|
||||||
<el-table-column label="任务量" prop="count"> </el-table-column>
|
{{ scope.row.material_.name }}
|
||||||
<el-table-column label="计划量" prop="count"> </el-table-column>
|
</template>
|
||||||
<el-table-column label="日均产量" prop="count_day">
|
</el-table-column>
|
||||||
</el-table-column>
|
<el-table-column label="规格" prop="material_">
|
||||||
<el-table-column label="计划开工时间" prop="start_date" width="120">
|
<template #default="scope">
|
||||||
</el-table-column>
|
{{ scope.row.material_.specification }}
|
||||||
<el-table-column label="计划完工时间" prop="end_date" width="120">
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合格数" prop="count_ok"> </el-table-column>
|
<el-table-column label="型号" prop="material_">
|
||||||
<el-table-column label="完成率" prop="count">
|
<template #default="scope">
|
||||||
<template #default="scope">
|
{{ scope.row.material_.model }}
|
||||||
<span v-if="scope.row.count != 0&&scope.row.count_ok!= 0">{{ Math.round((scope.row.count_ok / scope.row.count) * 100) }}%</span>
|
</template>
|
||||||
<span v-else>0</span>
|
</el-table-column>
|
||||||
</template>
|
<el-table-column label="任务状态" prop="state">
|
||||||
</el-table-column>
|
<template #default="scope">
|
||||||
<el-table-column label="操作" fixed="right" width="150">
|
<el-tag
|
||||||
<template #default="scope">
|
v-if="scope.row.state == 40"
|
||||||
<el-button link type="primary" @click.stop="table_show(scope.row)">
|
type="success"
|
||||||
查看
|
>
|
||||||
</el-button>
|
{{ state_[scope.row.state] }}
|
||||||
<el-button link type="primary" @click.stop="table_edit(scope.row)"
|
</el-tag>
|
||||||
v-if="scope.row.state == 10" v-auth="'utask.update'">
|
<el-tag
|
||||||
编辑
|
v-else-if="scope.row.state == 34"
|
||||||
</el-button>
|
type="danger"
|
||||||
<el-popconfirm title="确定删除吗?" @confirm.stop="table_del(scope.row)"
|
>
|
||||||
v-if="scope.row.state == 10 || scope.row.state == 14" v-auth="'utask.delete'">
|
{{ state_[scope.row.state] }}
|
||||||
<template #reference>
|
</el-tag>
|
||||||
<el-button link type="danger">删除</el-button>
|
<el-tag v-else>
|
||||||
</template>
|
{{ state_[scope.row.state] }}
|
||||||
</el-popconfirm>
|
</el-tag>
|
||||||
<el-popconfirm title="确定终止该任务吗?" @confirm.stop="table_stop(scope.row)"
|
</template>
|
||||||
v-if="scope.row.state==30" v-auth="'utask.stop'">
|
</el-table-column>
|
||||||
<template #reference>
|
<el-table-column label="任务类型" prop="type">
|
||||||
<el-button link type="danger" v-if="scope.row.state==30">终止</el-button>
|
<template #default="scope">
|
||||||
</template>
|
<el-link
|
||||||
</el-popconfirm>
|
v-if="scope.row.type == 'mass'"
|
||||||
</template>
|
type="primary"
|
||||||
</el-table-column>
|
>量产</el-link
|
||||||
</scTable>
|
>
|
||||||
</el-main>
|
<el-link v-else type="success">中试</el-link>
|
||||||
</el-container>
|
</template>
|
||||||
</el-header>
|
</el-table-column>
|
||||||
<el-main class="nopadding">
|
<el-table-column label="任务量" prop="count">
|
||||||
<GanttComponent class="left-container" v-if="ganntVisit" :tasks="tasks" :start_date="start_date">
|
</el-table-column>
|
||||||
</GanttComponent>
|
<el-table-column label="计划量" prop="count">
|
||||||
</el-main>
|
</el-table-column>
|
||||||
</el-container>
|
<el-table-column label="日均产量" prop="count_day">
|
||||||
<showDrawer ref="showDrawer" v-if="visibleDrawer" :utaskId="utaskId" @closed="visibleDrawer = false">
|
</el-table-column>
|
||||||
</showDrawer>
|
<el-table-column
|
||||||
<save-dialog v-if="dialog.save" ref="saveDialog" :activeDept="currentDept.id" @success="handleSaveSuccess"
|
label="计划开工时间"
|
||||||
@closed="dialog.save = false"></save-dialog>
|
prop="start_date"
|
||||||
|
width="120"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<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 label="完成率" prop="count">
|
||||||
|
<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-else>0</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" fixed="right" width="150">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click.stop="table_show(scope.row)"
|
||||||
|
>
|
||||||
|
查看
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click.stop="table_edit(scope.row)"
|
||||||
|
v-if="scope.row.state == 10"
|
||||||
|
v-auth="'utask.update'"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-popconfirm
|
||||||
|
title="确定删除吗?"
|
||||||
|
@confirm.stop="table_del(scope.row)"
|
||||||
|
v-if="
|
||||||
|
scope.row.state == 10 ||
|
||||||
|
scope.row.state == 14
|
||||||
|
"
|
||||||
|
v-auth="'utask.delete'"
|
||||||
|
>
|
||||||
|
<template #reference>
|
||||||
|
<el-button link type="danger"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-popconfirm>
|
||||||
|
<el-popconfirm
|
||||||
|
title="确定终止该任务吗?"
|
||||||
|
@confirm.stop="table_stop(scope.row)"
|
||||||
|
v-if="scope.row.state == 30"
|
||||||
|
v-auth="'utask.stop'"
|
||||||
|
>
|
||||||
|
<template #reference>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
v-if="scope.row.state == 30"
|
||||||
|
>终止</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-popconfirm>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</scTable>
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
</el-header>
|
||||||
|
<el-main class="nopadding">
|
||||||
|
<GanttComponent
|
||||||
|
class="left-container"
|
||||||
|
v-if="ganntVisit"
|
||||||
|
:tasks="tasks"
|
||||||
|
:start_date="start_date"
|
||||||
|
>
|
||||||
|
</GanttComponent>
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
<showDrawer
|
||||||
|
ref="showDrawer"
|
||||||
|
v-if="visibleDrawer"
|
||||||
|
:utaskId="utaskId"
|
||||||
|
@closed="visibleDrawer = false"
|
||||||
|
>
|
||||||
|
</showDrawer>
|
||||||
|
<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: [],
|
||||||
dialog: {
|
dialog: {
|
||||||
save: false,
|
save: false,
|
||||||
},
|
},
|
||||||
tasks: {
|
tasks: {
|
||||||
data: []
|
data: [],
|
||||||
},
|
},
|
||||||
dateValue:'',
|
dateValue: "",
|
||||||
apiUtask: null,
|
apiUtask: null,
|
||||||
apiObj: null,
|
apiObj: null,
|
||||||
ganntVisit:true,
|
ganntVisit: true,
|
||||||
visibleRecord: false,
|
visibleRecord: false,
|
||||||
currentDept: { id: 0 },
|
currentDept: { id: 0 },
|
||||||
paramsUtask: {},
|
paramsUtask: {},
|
||||||
paramsObj: {},
|
paramsObj: {},
|
||||||
utaskList: [],
|
utaskList: [],
|
||||||
state_: {
|
state_: {
|
||||||
10: "创建中",
|
10: "创建中",
|
||||||
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
|
||||||
if (res.length == 1) {
|
.req({ page: 0, name: "10车间" })
|
||||||
that.currentDept = res[0]
|
.then((res) => {
|
||||||
that.paramsUtask.belong_dept = that.currentDept.id
|
if (res.length == 1) {
|
||||||
that.apiUtask = that.$API.pm.utask.list;
|
that.currentDept = res[0];
|
||||||
that.getGantt();
|
that.paramsUtask.belong_dept = that.currentDept.id;
|
||||||
} else {
|
that.apiUtask = that.$API.pm.utask.list;
|
||||||
that.$message.error("未找到车间");
|
that.getGantt();
|
||||||
}
|
} else {
|
||||||
})
|
that.$message.error("未找到车间");
|
||||||
},
|
}
|
||||||
updateCount(res, tableData) {
|
});
|
||||||
let that = this;
|
},
|
||||||
this.count = res.count;
|
updateCount(res, tableData) {
|
||||||
let data = [];
|
let that = this;
|
||||||
console.log('tableData', tableData)
|
this.count = res.count;
|
||||||
if (tableData.length > 0) {
|
let data = [];
|
||||||
tableData.forEach(item=>{
|
that.ganntVisit = false;
|
||||||
let start_date = item.start_date;
|
that.tasks.data = [];
|
||||||
let end_date = item.end_date;
|
console.log("tableData", tableData);
|
||||||
let objItem = {};
|
if (tableData.length > 0) {
|
||||||
objItem.id = item.id;
|
tableData.forEach((item) => {
|
||||||
objItem.type = 'utask';
|
let start_date = item.start_date;
|
||||||
objItem.number = item.number;
|
let end_date = item.end_date;
|
||||||
objItem.count = item.count;
|
let objItem = {};
|
||||||
objItem.text = item.number;
|
objItem.id = item.id;
|
||||||
objItem.material_name = item.material_.name;
|
objItem.type = "utask";
|
||||||
objItem.material_specification = item.material_.specification;
|
objItem.number = item.number;
|
||||||
objItem.material_model = item.material_.model;
|
objItem.count = item.count;
|
||||||
objItem.progress = item.count_real / item.count;;
|
objItem.text = item.number;
|
||||||
objItem.count_ok = item.count_ok;
|
objItem.material_name = item.material_.name;
|
||||||
objItem.count_real = item.count_real;
|
objItem.material_specification =
|
||||||
objItem.count_notok = item.count_notok;
|
item.material_.specification;
|
||||||
objItem.state = item.state;
|
objItem.material_model = item.material_.model;
|
||||||
objItem.start_date = start_date;
|
objItem.progress = item.count_real / item.count;
|
||||||
objItem.utaskType = item.type;
|
objItem.count_ok = item.count_ok;
|
||||||
objItem.mgroup_name = item.mgroup_name;
|
objItem.count_real = item.count_real;
|
||||||
objItem.open = true;
|
objItem.count_notok = item.count_notok;
|
||||||
let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
objItem.state = item.state;
|
||||||
let firstDate = new Date(start_date);
|
objItem.start_date = start_date;
|
||||||
let secondDate = new Date(end_date);
|
objItem.utaskType = item.type;
|
||||||
let timeDiff = Math.abs(secondDate.getTime()-firstDate.getTime());
|
objItem.mgroup_name = item.mgroup_name;
|
||||||
let daysDiff = Math.ceil(timeDiff / oneDay);
|
objItem.open = true;
|
||||||
objItem.duration = daysDiff+1;
|
let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
||||||
data.push(objItem)
|
let firstDate = new Date(start_date);
|
||||||
that.start_date = start_date;
|
let secondDate = new Date(end_date);
|
||||||
console.log('objItemduration',objItem.duration)
|
let timeDiff = Math.abs(
|
||||||
})
|
secondDate.getTime() - firstDate.getTime()
|
||||||
}
|
);
|
||||||
that.ganntVisit = true;
|
let daysDiff = Math.ceil(timeDiff / oneDay);
|
||||||
that.tasks.data = data;
|
objItem.duration = daysDiff + 1;
|
||||||
gantt.parse(that.tasks);
|
data.push(objItem);
|
||||||
// 刷新数据
|
that.start_date = start_date;
|
||||||
gantt.refreshData();
|
});
|
||||||
},
|
}
|
||||||
getGantt(){
|
that.tasks.data = data;
|
||||||
let that = this;
|
that.ganntVisit = true;
|
||||||
that.$API.pm.utask.list.req(that.paramsUtask).then(res=>{
|
gantt.parse(that.tasks);
|
||||||
let list = res.results;
|
// 刷新数据
|
||||||
let data = [];
|
gantt.refreshData();
|
||||||
list.forEach(item=>{
|
},
|
||||||
let start_date = item.start_date;
|
getGantt() {
|
||||||
let end_date = item.end_date;
|
let that = this;
|
||||||
let objItem = {};
|
that.$API.pm.utask.list.req(that.paramsUtask).then((res) => {
|
||||||
objItem.id = item.id;
|
let list = res.results;
|
||||||
objItem.type = 'utask';
|
let data = [];
|
||||||
objItem.number = item.number;
|
list.forEach((item) => {
|
||||||
objItem.count = item.count;
|
let start_date = item.start_date;
|
||||||
objItem.text = item.number;
|
let end_date = item.end_date;
|
||||||
objItem.material_name = item.material_.name;
|
let objItem = {};
|
||||||
objItem.material_specification = item.material_.specification;
|
objItem.id = item.id;
|
||||||
objItem.material_model = item.material_.model;
|
objItem.type = "utask";
|
||||||
objItem.progress = item.count_real / item.count;;
|
objItem.number = item.number;
|
||||||
objItem.count_ok = item.count_ok;
|
objItem.count = item.count;
|
||||||
objItem.count_real = item.count_real;
|
objItem.text = item.number;
|
||||||
objItem.count_notok = item.count_notok;
|
objItem.material_name = item.material_.name;
|
||||||
objItem.state = item.state;
|
objItem.material_specification =
|
||||||
objItem.start_date = start_date;
|
item.material_.specification;
|
||||||
objItem.utaskType = item.type;
|
objItem.material_model = item.material_.model;
|
||||||
objItem.mgroup_name = item.mgroup_name;
|
objItem.progress = item.count_real / item.count;
|
||||||
objItem.open = true;
|
objItem.count_ok = item.count_ok;
|
||||||
let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
objItem.count_real = item.count_real;
|
||||||
let firstDate = new Date(start_date);
|
objItem.count_notok = item.count_notok;
|
||||||
let secondDate = new Date(end_date);
|
objItem.state = item.state;
|
||||||
let timeDiff = Math.abs(secondDate.getTime()-firstDate.getTime());
|
objItem.start_date = start_date;
|
||||||
let daysDiff = Math.ceil(timeDiff / oneDay);
|
objItem.utaskType = item.type;
|
||||||
objItem.duration = daysDiff+1;
|
objItem.mgroup_name = item.mgroup_name;
|
||||||
data.push(objItem)
|
objItem.open = true;
|
||||||
that.start_date = start_date;
|
let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
||||||
console.log('objItemduration',objItem.duration)
|
let firstDate = new Date(start_date);
|
||||||
})
|
let secondDate = new Date(end_date);
|
||||||
that.tasks.data = data;
|
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.tasks.data = data;
|
||||||
|
|
||||||
gantt.parse(that.tasks);
|
gantt.parse(that.tasks);
|
||||||
// 刷新数据
|
// 刷新数据
|
||||||
gantt.refreshData();
|
gantt.refreshData();
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
utaskDepuse() {
|
utaskDepuse() {
|
||||||
let that = this;
|
let that = this;
|
||||||
if (that.selectedIds.length > 0) {
|
if (that.selectedIds.length > 0) {
|
||||||
let ids = that.selectedIds;
|
let ids = that.selectedIds;
|
||||||
that.isLoading = true;
|
that.isLoading = true;
|
||||||
that.$API.pm.utask.scheduemtasks
|
that.$API.pm.utask.scheduemtasks
|
||||||
.req({ ids: ids })
|
.req({ ids: ids })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
that.$API.pm.utask.assgin
|
that.$API.pm.utask.assgin
|
||||||
.req({ ids: ids })
|
.req({ ids: ids })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
that.$message.success("下达任务成功");
|
that.$message.success("下达任务成功");
|
||||||
that.isLoading = false;
|
that.isLoading = false;
|
||||||
that.$refs.table.refresh();
|
that.$refs.table.refresh();
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
that.isLoading = false;
|
that.isLoading = false;
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
that.isLoading = false;
|
that.isLoading = false;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.$message.error("未选择任何任务");
|
this.$message.error("未选择任何任务");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.selectedIds = [];
|
this.selectedIds = [];
|
||||||
selection.forEach((item) => {
|
selection.forEach((item) => {
|
||||||
this.selectedIds.push(item.id);
|
this.selectedIds.push(item.id);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
utaskCreate() {
|
utaskCreate() {
|
||||||
this.dialog.save = true;
|
this.dialog.save = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.saveDialog.open("add");
|
this.$refs.saveDialog.open("add");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
table_edit(row) {
|
table_edit(row) {
|
||||||
this.dialog.save = true;
|
this.dialog.save = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.saveDialog.open("edit").setData(row);
|
this.$refs.saveDialog.open("edit").setData(row);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
table_del(row) {
|
table_del(row) {
|
||||||
this.$API.pm.utask.delete
|
this.$API.pm.utask.delete
|
||||||
.req(row.id)
|
.req(row.id)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.$message.success("删除成功");
|
this.$message.success("删除成功");
|
||||||
this.$refs.table.refresh();
|
this.$refs.table.refresh();
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
return err;
|
return err;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
table_stop(row) {
|
table_stop(row) {
|
||||||
this.$API.pm.utask.stop.req(row.id).then((res) => {
|
this.$API.pm.utask.stop
|
||||||
this.$message.success("操作成功");
|
.req(row.id)
|
||||||
this.$refs.table.refresh();
|
.then((res) => {
|
||||||
return res;
|
this.$message.success("操作成功");
|
||||||
})
|
this.$refs.table.refresh();
|
||||||
.catch((err) => {
|
return res;
|
||||||
return err;
|
})
|
||||||
});
|
.catch((err) => {
|
||||||
},
|
return err;
|
||||||
bindClass(item) {
|
});
|
||||||
let classInfo = {
|
},
|
||||||
countBlock: true,
|
bindClass(item) {
|
||||||
redColor: false,
|
let classInfo = {
|
||||||
greenColor: false,
|
countBlock: true,
|
||||||
orangeColor: false,
|
redColor: false,
|
||||||
};
|
greenColor: false,
|
||||||
if (item.state != 40) {
|
orangeColor: false,
|
||||||
classInfo.orangeColor = true;
|
};
|
||||||
} else {
|
if (item.state != 40) {
|
||||||
if (item.count_ok >= item.count) {
|
classInfo.orangeColor = true;
|
||||||
classInfo.greenColor = true;
|
} else {
|
||||||
} else {
|
if (item.count_ok >= item.count) {
|
||||||
classInfo.redColor = true;
|
classInfo.greenColor = true;
|
||||||
}
|
} else {
|
||||||
}
|
classInfo.redColor = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return classInfo;
|
return classInfo;
|
||||||
},
|
},
|
||||||
table_show(row) {
|
table_show(row) {
|
||||||
this.utaskId = row.id;
|
this.utaskId = row.id;
|
||||||
this.visibleDrawer = true;
|
this.visibleDrawer = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.showDrawer.open();
|
this.$refs.showDrawer.open();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// rowclick(val) {
|
// rowclick(val) {
|
||||||
// let utask = val.id;
|
// let utask = val.id;
|
||||||
// this.$API.pm.mtask.list.req({ utask: utask, page: 0 }).then((res) => {
|
// this.$API.pm.mtask.list.req({ utask: utask, page: 0 }).then((res) => {
|
||||||
// let columList = [];
|
// let columList = [];
|
||||||
// res.forEach((item) => {
|
// res.forEach((item) => {
|
||||||
// let obj = {};
|
// let obj = {};
|
||||||
// obj.id = item.id
|
// obj.id = item.id
|
||||||
// obj.state = item.state;
|
// obj.state = item.state;
|
||||||
// obj.count_b = 0
|
// obj.count_b = 0
|
||||||
// obj.count_y = 0
|
// obj.count_y = 0
|
||||||
// item.mlogs.forEach((item2) => {
|
// item.mlogs.forEach((item2) => {
|
||||||
// if (item2.shift_name.indexOf('白班')) {
|
// if (item2.shift_name.indexOf('白班')) {
|
||||||
// obj.count_b = item2.count_ok
|
// obj.count_b = item2.count_ok
|
||||||
// }
|
// }
|
||||||
// else if (item2.shift_name.indexOf('夜班')) {
|
// else if (item2.shift_name.indexOf('夜班')) {
|
||||||
// obj.count_y = item2.count_ok
|
// obj.count_y = item2.count_ok
|
||||||
// }
|
// }
|
||||||
// })
|
// })
|
||||||
// obj.count_ok = item.count_ok
|
// obj.count_ok = item.count_ok
|
||||||
// obj.count = item.count;
|
// obj.count = item.count;
|
||||||
// obj.start_date = item.start_date;
|
// obj.start_date = item.start_date;
|
||||||
// columList.push(obj);
|
// columList.push(obj);
|
||||||
// });
|
// });
|
||||||
// this.mtaskList = columList
|
// this.mtaskList = columList
|
||||||
// this.utaskList = [val]
|
// this.utaskList = [val]
|
||||||
// });
|
// });
|
||||||
// },
|
// },
|
||||||
handleSaveSuccess(data, mode) {
|
handleSaveSuccess(data, mode) {
|
||||||
this.$refs.table.refresh();
|
this.$refs.table.refresh();
|
||||||
},
|
},
|
||||||
utaskSearch(){
|
utaskSearch() {
|
||||||
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];
|
||||||
let end_date = this.dateValue[1];
|
let end_date = this.dateValue[1];
|
||||||
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 {
|
||||||
width: 80px;
|
width: 80px;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.redColor {
|
.redColor {
|
||||||
background-color: brown;
|
background-color: brown;
|
||||||
}
|
}
|
||||||
|
|
||||||
.greenColor {
|
.greenColor {
|
||||||
background-color: green;
|
background-color: green;
|
||||||
}
|
}
|
||||||
|
|
||||||
.orangeColor {
|
.orangeColor {
|
||||||
background-color: orange;
|
background-color: orange;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,111 +1,201 @@
|
||||||
<template>
|
<template>
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-header style="height: 50%;padding: 0">
|
<el-header style="height: 50%; padding: 0">
|
||||||
<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"
|
||||||
</div>
|
v-auth="'utask.create'"
|
||||||
<div class="'right-panel'">
|
>新增任务</el-button
|
||||||
<el-date-picker
|
>
|
||||||
v-model="dateValue"
|
<el-button
|
||||||
type="daterange"
|
type="primary"
|
||||||
range-separator="至"
|
@click="utaskDepuse"
|
||||||
start-placeholder="开始时间"
|
v-loading="isLoading"
|
||||||
end-placeholder="结束时间"
|
v-auth="'utask.assgin'"
|
||||||
value-format="YYYY-MM-DD"
|
>任务分解并下达</el-button
|
||||||
style="vertical-align: middle;margin-right:6px"
|
>
|
||||||
/>
|
</div>
|
||||||
<el-button type="primary" @click="utaskSearch" v-loading="isLoading">搜索</el-button>
|
<div class="'right-panel'">
|
||||||
</div>
|
<el-date-picker
|
||||||
</el-header>
|
v-model="dateValue"
|
||||||
<el-main class="nopadding">
|
type="daterange"
|
||||||
<scTable ref="tables" :apiObj="apiUtask" row-key="id" stripe :params="paramsUtask" :query="queryUtask" @row-click="rowclick"
|
range-separator="至"
|
||||||
@selection-change="handleSelectionChange" @dataChange="updateCount">
|
start-placeholder="开始时间"
|
||||||
<el-table-column type="selection" width="40" />
|
end-placeholder="结束时间"
|
||||||
<el-table-column type="index" width="40" />
|
value-format="YYYY-MM-DD"
|
||||||
<el-table-column label="任务编号" prop="number" width="120"> </el-table-column>
|
style="vertical-align: middle; margin-right: 6px"
|
||||||
<el-table-column label="产品名称" prop="material_" show-overflow-tooltip>
|
/>
|
||||||
<template #default="scope">
|
<el-button
|
||||||
{{ scope.row.material_.name }}
|
type="primary"
|
||||||
</template>
|
@click="utaskSearch"
|
||||||
</el-table-column>
|
v-loading="isLoading"
|
||||||
<el-table-column label="规格" prop="material_">
|
>搜索</el-button
|
||||||
<template #default="scope">
|
>
|
||||||
{{ scope.row.material_.specification }}
|
</div>
|
||||||
</template>
|
</el-header>
|
||||||
</el-table-column>
|
<el-main class="nopadding">
|
||||||
<el-table-column label="型号" prop="material_">
|
<scTable
|
||||||
<template #default="scope">
|
ref="tables"
|
||||||
{{ scope.row.material_.model }}
|
:apiObj="apiUtask"
|
||||||
</template>
|
row-key="id"
|
||||||
</el-table-column>
|
stripe
|
||||||
<el-table-column label="任务状态" prop="state">
|
:params="paramsUtask"
|
||||||
<template #default="scope">
|
:query="queryUtask"
|
||||||
<el-tag v-if="scope.row.state == 40" type="success">
|
@row-click="rowclick"
|
||||||
{{ state_[scope.row.state] }}
|
@selection-change="handleSelectionChange"
|
||||||
</el-tag>
|
@dataChange="updateCount"
|
||||||
<el-tag v-else-if="scope.row.state == 34" type="danger">
|
>
|
||||||
{{ state_[scope.row.state] }}
|
<el-table-column type="selection" width="40" />
|
||||||
</el-tag>
|
<el-table-column type="index" width="40" />
|
||||||
<el-tag v-else>
|
<el-table-column
|
||||||
{{ state_[scope.row.state] }}
|
label="任务编号"
|
||||||
</el-tag>
|
prop="number"
|
||||||
</template>
|
width="120"
|
||||||
</el-table-column>
|
>
|
||||||
<el-table-column label="任务类型" prop="type">
|
</el-table-column>
|
||||||
<template #default="scope">
|
<el-table-column
|
||||||
<el-link v-if="scope.row.type == 'mass'" type="primary">量产</el-link>
|
label="产品名称"
|
||||||
<el-link v-else type="success">中试</el-link>
|
prop="material_"
|
||||||
</template>
|
show-overflow-tooltip
|
||||||
</el-table-column>
|
>
|
||||||
<el-table-column label="任务量" prop="count"> </el-table-column>
|
<template #default="scope">
|
||||||
<el-table-column label="计划量" prop="count"> </el-table-column>
|
{{ scope.row.material_.name }}
|
||||||
<el-table-column label="日均产量" prop="count_day">
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="计划开工时间" prop="start_date" width="120">
|
<el-table-column label="规格" prop="material_">
|
||||||
</el-table-column>
|
<template #default="scope">
|
||||||
<el-table-column label="计划完工时间" prop="end_date" width="120">
|
{{ scope.row.material_.specification }}
|
||||||
</el-table-column>
|
</template>
|
||||||
<el-table-column label="合格数" prop="count_ok"> </el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="完成率">
|
<el-table-column label="型号" prop="material_">
|
||||||
<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>
|
{{ scope.row.material_.model }}
|
||||||
<span v-else>0</span>
|
</template>
|
||||||
</template>
|
</el-table-column>
|
||||||
</el-table-column>
|
<el-table-column label="任务状态" prop="state">
|
||||||
<el-table-column label="操作" fixed="right" width="150">
|
<template #default="scope">
|
||||||
<template #default="scope">
|
<el-tag
|
||||||
<el-button link type="primary" @click.stop="table_show(scope.row)">
|
v-if="scope.row.state == 40"
|
||||||
查看
|
type="success"
|
||||||
</el-button>
|
>
|
||||||
<el-button link type="primary" @click.stop="table_edit(scope.row)"
|
{{ state_[scope.row.state] }}
|
||||||
v-if="scope.row.state == 10" v-auth="'utask.update'">
|
</el-tag>
|
||||||
编辑
|
<el-tag
|
||||||
</el-button>
|
v-else-if="scope.row.state == 34"
|
||||||
<el-popconfirm title="确定删除吗?" @confirm.stop="table_del(scope.row)"
|
type="danger"
|
||||||
v-if="scope.row.state == 10 || scope.row.state == 14" v-auth="'utask.delete'">
|
>
|
||||||
<template #reference>
|
{{ state_[scope.row.state] }}
|
||||||
<el-button link type="danger">删除</el-button>
|
</el-tag>
|
||||||
</template>
|
<el-tag v-else>
|
||||||
</el-popconfirm>
|
{{ state_[scope.row.state] }}
|
||||||
<el-popconfirm title="确定终止该任务吗?" @confirm.stop="table_stop(scope.row)"
|
</el-tag>
|
||||||
v-if="scope.row.state==30" v-auth="'utask.stop'">
|
</template>
|
||||||
<template #reference>
|
</el-table-column>
|
||||||
<el-button link type="danger">终止</el-button>
|
<el-table-column label="任务类型" prop="type">
|
||||||
</template>
|
<template #default="scope">
|
||||||
</el-popconfirm>
|
<el-link
|
||||||
</template>
|
v-if="scope.row.type == 'mass'"
|
||||||
</el-table-column>
|
type="primary"
|
||||||
</scTable>
|
>量产</el-link
|
||||||
</el-main>
|
>
|
||||||
</el-container>
|
<el-link v-else type="success">中试</el-link>
|
||||||
</el-header>
|
</template>
|
||||||
<el-main class="nopadding">
|
</el-table-column>
|
||||||
<!-- <el-container>
|
<el-table-column label="任务量" prop="count">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="计划量" prop="count">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="日均产量" prop="count_day">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="计划开工时间"
|
||||||
|
prop="start_date"
|
||||||
|
width="120"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<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 label="完成率">
|
||||||
|
<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-else>0</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" fixed="right" width="150">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click.stop="table_show(scope.row)"
|
||||||
|
>
|
||||||
|
查看
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click.stop="table_edit(scope.row)"
|
||||||
|
v-if="scope.row.state == 10"
|
||||||
|
v-auth="'utask.update'"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-popconfirm
|
||||||
|
title="确定删除吗?"
|
||||||
|
@confirm.stop="table_del(scope.row)"
|
||||||
|
v-if="
|
||||||
|
scope.row.state == 10 ||
|
||||||
|
scope.row.state == 14
|
||||||
|
"
|
||||||
|
v-auth="'utask.delete'"
|
||||||
|
>
|
||||||
|
<template #reference>
|
||||||
|
<el-button link type="danger"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-popconfirm>
|
||||||
|
<el-popconfirm
|
||||||
|
title="确定终止该任务吗?"
|
||||||
|
@confirm.stop="table_stop(scope.row)"
|
||||||
|
v-if="scope.row.state == 30"
|
||||||
|
v-auth="'utask.stop'"
|
||||||
|
>
|
||||||
|
<template #reference>
|
||||||
|
<el-button link type="danger"
|
||||||
|
>终止</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-popconfirm>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</scTable>
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
</el-header>
|
||||||
|
<el-main class="nopadding">
|
||||||
|
<!-- <el-container>
|
||||||
<el-header>
|
<el-header>
|
||||||
<div class="left-panel">
|
<div class="left-panel">
|
||||||
<span style="font-size: 14px">生产进度</span>
|
<span style="font-size: 14px">生产进度</span>
|
||||||
|
|
@ -140,250 +230,273 @@
|
||||||
</scTable>
|
</scTable>
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container> -->
|
</el-container> -->
|
||||||
<GanttComponent class="left-container" :tasks="tasks" v-if="ganntVisit" :start_date="start_date">
|
<GanttComponent
|
||||||
</GanttComponent>
|
class="left-container"
|
||||||
</el-main>
|
:tasks="tasks"
|
||||||
</el-container>
|
v-if="ganntVisit"
|
||||||
<showDrawer ref="showDrawer" v-if="visibleDrawer" :utaskId="utaskId" @closed="visibleDrawer = false">
|
:start_date="start_date"
|
||||||
</showDrawer>
|
>
|
||||||
<save-dialog v-if="dialog.save" ref="saveDialog" :activeDept="currentDept.id" @success="handleSaveSuccess"
|
</GanttComponent>
|
||||||
@closed="dialog.save = false"></save-dialog>
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
<showDrawer
|
||||||
|
ref="showDrawer"
|
||||||
|
v-if="visibleDrawer"
|
||||||
|
:utaskId="utaskId"
|
||||||
|
@closed="visibleDrawer = false"
|
||||||
|
>
|
||||||
|
</showDrawer>
|
||||||
|
<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: [],
|
||||||
dialog: {
|
dialog: {
|
||||||
save: false,
|
save: false,
|
||||||
},
|
},
|
||||||
tasks: {
|
tasks: {
|
||||||
data: []
|
data: [],
|
||||||
},
|
},
|
||||||
ganntVisit:true,
|
ganntVisit: true,
|
||||||
dateValue:[],
|
dateValue: [],
|
||||||
apiUtask: null,
|
apiUtask: null,
|
||||||
apiObj: null,
|
apiObj: null,
|
||||||
visibleRecord: false,
|
visibleRecord: false,
|
||||||
currentDept: { id: 0 },
|
currentDept: { id: 0 },
|
||||||
paramsUtask: {},
|
paramsUtask: {},
|
||||||
queryUtask: {},
|
queryUtask: {},
|
||||||
utaskList: [],
|
utaskList: [],
|
||||||
state_: {
|
state_: {
|
||||||
10: "创建中",
|
10: "创建中",
|
||||||
14: "已分解",
|
14: "已分解",
|
||||||
20: "已下达",
|
20: "已下达",
|
||||||
30: "生产中",
|
30: "生产中",
|
||||||
34:'终止',
|
34: "终止",
|
||||||
40: "已提交",
|
40: "已提交",
|
||||||
},
|
},
|
||||||
start_date: '',
|
start_date: "",
|
||||||
newDate:''
|
newDate: "",
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
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: '7车间' }).then(res => {
|
that.$API.system.dept.list
|
||||||
if (res.length == 1) {
|
.req({ page: 0, name: "7车间" })
|
||||||
that.currentDept = res[0];
|
.then((res) => {
|
||||||
that.paramsUtask.belong_dept = that.currentDept.id;
|
if (res.length == 1) {
|
||||||
// that.paramsObj.belong_dept = that.currentDept.id;
|
that.currentDept = res[0];
|
||||||
that.apiUtask = that.$API.pm.utask.list;
|
that.paramsUtask.belong_dept = that.currentDept.id;
|
||||||
// that.getGantt();
|
// that.paramsObj.belong_dept = that.currentDept.id;
|
||||||
} else {
|
that.apiUtask = that.$API.pm.utask.list;
|
||||||
that.$message.error("未找到车间");
|
// that.getGantt();
|
||||||
}
|
} else {
|
||||||
})
|
that.$message.error("未找到车间");
|
||||||
},
|
}
|
||||||
updateCount(res, tableData) {
|
});
|
||||||
let that = this;
|
},
|
||||||
this.count = res.count;
|
updateCount(res, tableData) {
|
||||||
let data = [];
|
let that = this;
|
||||||
console.log('tableData', tableData)
|
this.count = res.count;
|
||||||
if (tableData.length > 0) {
|
let data = [];
|
||||||
tableData.forEach(item=>{
|
that.ganntVisit = false;
|
||||||
let start_date = item.start_date;
|
that.tasks.data = [];
|
||||||
let end_date = item.end_date;
|
console.log("tableData", tableData);
|
||||||
let objItem = {};
|
if (tableData.length > 0) {
|
||||||
objItem.id = item.id;
|
tableData.forEach((item) => {
|
||||||
objItem.type = 'utask';
|
let start_date = item.start_date;
|
||||||
objItem.number = item.number;
|
let end_date = item.end_date;
|
||||||
objItem.count = item.count;
|
let objItem = {};
|
||||||
objItem.text = item.number;
|
objItem.id = item.id;
|
||||||
objItem.material_name = item.material_.name;
|
objItem.type = "utask";
|
||||||
objItem.material_specification = item.material_.specification;
|
objItem.number = item.number;
|
||||||
objItem.material_model = item.material_.model;
|
objItem.count = item.count;
|
||||||
objItem.progress = item.count_real / item.count;;
|
objItem.text = item.number;
|
||||||
objItem.count_ok = item.count_ok;
|
objItem.material_name = item.material_.name;
|
||||||
objItem.count_real = item.count_real;
|
objItem.material_specification =
|
||||||
objItem.count_notok = item.count_notok;
|
item.material_.specification;
|
||||||
objItem.state = item.state;
|
objItem.material_model = item.material_.model;
|
||||||
objItem.start_date = start_date;
|
objItem.progress = item.count_real / item.count;
|
||||||
objItem.utaskType = item.type;
|
objItem.count_ok = item.count_ok;
|
||||||
objItem.mgroup_name = item.mgroup_name;
|
objItem.count_real = item.count_real;
|
||||||
objItem.open = true;
|
objItem.count_notok = item.count_notok;
|
||||||
let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
objItem.state = item.state;
|
||||||
let firstDate = new Date(start_date);
|
objItem.start_date = start_date;
|
||||||
let secondDate = new Date(end_date);
|
objItem.utaskType = item.type;
|
||||||
let timeDiff = Math.abs(secondDate.getTime()-firstDate.getTime());
|
objItem.mgroup_name = item.mgroup_name;
|
||||||
let daysDiff = Math.ceil(timeDiff / oneDay);
|
objItem.open = true;
|
||||||
objItem.duration = daysDiff+1;
|
let oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
||||||
data.push(objItem)
|
let firstDate = new Date(start_date);
|
||||||
that.start_date = start_date;
|
let secondDate = new Date(end_date);
|
||||||
console.log('objItemduration',objItem.duration)
|
let timeDiff = Math.abs(
|
||||||
})
|
secondDate.getTime() - firstDate.getTime()
|
||||||
}
|
);
|
||||||
that.ganntVisit = true;
|
let daysDiff = Math.ceil(timeDiff / oneDay);
|
||||||
that.tasks.data = data;
|
objItem.duration = daysDiff + 1;
|
||||||
gantt.parse(that.tasks);
|
data.push(objItem);
|
||||||
// 刷新数据
|
that.start_date = start_date;
|
||||||
gantt.refreshData();
|
});
|
||||||
},
|
}
|
||||||
utaskDepuse() {
|
that.tasks.data = data;
|
||||||
let that = this;
|
that.ganntVisit = true;
|
||||||
if (that.selectedIds.length > 0) {
|
gantt.parse(that.tasks);
|
||||||
let ids = that.selectedIds;
|
// 刷新数据
|
||||||
that.isLoading = true;
|
gantt.refreshData();
|
||||||
that.$API.pm.utask.scheduemtasks
|
},
|
||||||
.req({ ids: ids })
|
utaskDepuse() {
|
||||||
.then((res) => {
|
let that = this;
|
||||||
that.$API.pm.utask.assgin
|
if (that.selectedIds.length > 0) {
|
||||||
.req({ ids: ids })
|
let ids = that.selectedIds;
|
||||||
.then((res) => {
|
that.isLoading = true;
|
||||||
that.$message.success("下达任务成功");
|
that.$API.pm.utask.scheduemtasks
|
||||||
that.isLoading = false;
|
.req({ ids: ids })
|
||||||
that.$refs.table.refresh();
|
.then((res) => {
|
||||||
})
|
that.$API.pm.utask.assgin
|
||||||
.catch(() => {
|
.req({ ids: ids })
|
||||||
that.isLoading = false;
|
.then((res) => {
|
||||||
});
|
that.$message.success("下达任务成功");
|
||||||
})
|
that.isLoading = false;
|
||||||
.catch(() => {
|
that.$refs.table.refresh();
|
||||||
that.isLoading = false;
|
})
|
||||||
});
|
.catch(() => {
|
||||||
} else {
|
that.isLoading = false;
|
||||||
this.$message.error("未选择任何任务");
|
});
|
||||||
}
|
})
|
||||||
},
|
.catch(() => {
|
||||||
handleSelectionChange(selection) {
|
that.isLoading = false;
|
||||||
this.selectedIds = [];
|
});
|
||||||
selection.forEach((item) => {
|
} else {
|
||||||
this.selectedIds.push(item.id);
|
this.$message.error("未选择任何任务");
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
utaskCreate() {
|
handleSelectionChange(selection) {
|
||||||
this.dialog.save = true;
|
this.selectedIds = [];
|
||||||
this.$nextTick(() => {
|
selection.forEach((item) => {
|
||||||
this.$refs.saveDialog.open("add");
|
this.selectedIds.push(item.id);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
table_edit(row) {
|
utaskCreate() {
|
||||||
this.dialog.save = true;
|
this.dialog.save = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.saveDialog.open("edit").setData(row);
|
this.$refs.saveDialog.open("add");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
table_del(row) {
|
table_edit(row) {
|
||||||
this.$API.pm.utask.delete
|
this.dialog.save = true;
|
||||||
.req(row.id)
|
this.$nextTick(() => {
|
||||||
.then((res) => {
|
this.$refs.saveDialog.open("edit").setData(row);
|
||||||
this.$message.success("删除成功");
|
});
|
||||||
this.$refs.table.refresh();
|
},
|
||||||
return res;
|
table_del(row) {
|
||||||
})
|
this.$API.pm.utask.delete
|
||||||
.catch((err) => {
|
.req(row.id)
|
||||||
return err;
|
.then((res) => {
|
||||||
});
|
this.$message.success("删除成功");
|
||||||
},
|
this.$refs.table.refresh();
|
||||||
table_stop(row) {
|
return res;
|
||||||
this.$API.pm.utask.stop.req(row.id).then((res) => {
|
})
|
||||||
this.$message.success("操作成功");
|
.catch((err) => {
|
||||||
this.$refs.table.refresh();
|
return err;
|
||||||
return res;
|
});
|
||||||
})
|
},
|
||||||
.catch((err) => {
|
table_stop(row) {
|
||||||
return err;
|
this.$API.pm.utask.stop
|
||||||
});
|
.req(row.id)
|
||||||
},
|
.then((res) => {
|
||||||
bindClass(item) {
|
this.$message.success("操作成功");
|
||||||
let classInfo = {
|
this.$refs.table.refresh();
|
||||||
countBlock: true,
|
return res;
|
||||||
redColor: false,
|
})
|
||||||
greenColor: false,
|
.catch((err) => {
|
||||||
orangeColor: false,
|
return err;
|
||||||
};
|
});
|
||||||
if (item.state != 40) {
|
},
|
||||||
classInfo.orangeColor = true;
|
bindClass(item) {
|
||||||
} else {
|
let classInfo = {
|
||||||
if (item.count_ok >= item.count) {
|
countBlock: true,
|
||||||
classInfo.greenColor = true;
|
redColor: false,
|
||||||
} else {
|
greenColor: false,
|
||||||
classInfo.redColor = true;
|
orangeColor: false,
|
||||||
}
|
};
|
||||||
}
|
if (item.state != 40) {
|
||||||
|
classInfo.orangeColor = true;
|
||||||
|
} else {
|
||||||
|
if (item.count_ok >= item.count) {
|
||||||
|
classInfo.greenColor = true;
|
||||||
|
} else {
|
||||||
|
classInfo.redColor = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return classInfo;
|
return classInfo;
|
||||||
},
|
},
|
||||||
table_show(row) {
|
table_show(row) {
|
||||||
this.utaskId = row.id;
|
this.utaskId = row.id;
|
||||||
this.visibleDrawer = true;
|
this.visibleDrawer = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.showDrawer.open();
|
this.$refs.showDrawer.open();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
handleSaveSuccess(data, mode) {
|
handleSaveSuccess(data, mode) {
|
||||||
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];
|
||||||
let end_date = this.dateValue[1];
|
let end_date = this.dateValue[1];
|
||||||
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 {
|
||||||
width: 80px;
|
width: 80px;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.redColor {
|
.redColor {
|
||||||
background-color: brown;
|
background-color: brown;
|
||||||
}
|
}
|
||||||
|
|
||||||
.greenColor {
|
.greenColor {
|
||||||
background-color: green;
|
background-color: green;
|
||||||
}
|
}
|
||||||
|
|
||||||
.orangeColor {
|
.orangeColor {
|
||||||
background-color: orange;
|
background-color: orange;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
Loading…
Reference in New Issue