fix: mtask页面的bug修改

This commit is contained in:
caoqianming 2023-11-28 00:40:28 +08:00
parent 93a85eb192
commit c62188eaa7
7 changed files with 2336 additions and 1186 deletions

View File

@ -792,7 +792,7 @@ const routes = [
"name": "worktaskFlog", "name": "worktaskFlog",
"path": "/wpm/worktaskFlog", "path": "/wpm/worktaskFlog",
"meta": { "meta": {
"title": "生产部记录", "title": "生产部记录",
"icon": "el-icon-cellphone", "icon": "el-icon-cellphone",
"perms": ["wpm"], "perms": ["wpm"],
"hidden":true "hidden":true

View File

@ -1,10 +1,18 @@
<template> <template>
<el-container style="flex-direction: column"> <el-container style="flex-direction: column">
<el-main id="topContainer" class="nopadding" style="position: relative;margin-bottom: 10px;"> <el-main
id="topContainer"
class="nopadding"
style="position: relative; margin-bottom: 10px"
>
<div class="right-panel btnsContainer"> <div class="right-panel btnsContainer">
<el-button type="primary" icon="el-icon-plus" @click="add">新增任务</el-button> <el-button type="primary" icon="el-icon-plus" @click="add"
>新增任务</el-button
>
<!-- <el-button type="primary" @click="utaskDepuse" v-loading="isloading">任务分解</el-button> --> <!-- <el-button type="primary" @click="utaskDepuse" v-loading="isloading">任务分解</el-button> -->
<el-button type="primary" @click="utaskDepuse" v-loading="isloading">任务下达</el-button> <el-button type="primary" @click="utaskDepuse" v-loading="isloading"
>任务下达</el-button
>
</div> </div>
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick"> <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<!-- <el-tab-pane label="混料工序" name="8车间"> <!-- <el-tab-pane label="混料工序" name="8车间">
@ -71,13 +79,24 @@
</scTable> </scTable>
</el-tab-pane> --> </el-tab-pane> -->
<el-tab-pane label="成型7车间" name="7车间"> <el-tab-pane label="成型7车间" name="7车间">
<scTable ref="table7" :apiObj="apiUtask" row-key="id" stripe :height="topHeight" :params="paramsUtask7" <scTable
@row-click="rowclick" @selection-change="handleSelectionChange"> ref="table7"
:apiObj="apiUtask"
row-key="id"
stripe
:height="topHeight"
:params="paramsUtask7"
@row-click="rowclick"
@selection-change="handleSelectionChange"
>
<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"> <el-table-column label="任务编号" prop="number" width="120"> </el-table-column>
</el-table-column> <el-table-column
<el-table-column label="产品名称" prop="material_" show-overflow-tooltip> label="产品名称"
prop="material_"
show-overflow-tooltip
>
<template #default="scope"> <template #default="scope">
{{ scope.row.material_.name }} {{ scope.row.material_.name }}
</template> </template>
@ -102,34 +121,46 @@
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="任务量" prop="number"> <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">
</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"> <el-table-column label="计划开工时间" prop="start_date" width="120">
</el-table-column> </el-table-column>
<el-table-column label="计划完工时间" prop="end_date"> <el-table-column label="计划完工时间" prop="end_date" width="120">
</el-table-column>
<el-table-column label="完成产量" prop="count">
</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">
<span v-if="scope.row.count !=0">{{ (scope.row.count_ok/scope.row.count)*100 }}</span>
</template>
</el-table-column> </el-table-column>
<el-table-column label="要求描述" prop="count"> <!-- <el-table-column label="要求描述"> </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-link type="primary" @click="table_show(scope.row)"> <el-link type="primary" @click="table_show(scope.row)">
查看 查看
</el-link> </el-link>
<el-divider direction="vertical" v-if="scope.row.state == 10"></el-divider> <el-divider
<el-link type="primary" @click="table_edit(scope.row)" v-if="scope.row.state == 10"> direction="vertical"
v-if="scope.row.state == 10"
></el-divider>
<el-link
type="primary"
@click="table_edit(scope.row)"
v-if="scope.row.state == 10"
>
编辑 编辑
</el-link> </el-link>
<el-divider direction="vertical" v-if="scope.row.state == 10 || scope.row.state == 14"></el-divider> <el-divider
<el-link type="danger" @click="table_del(scope.row)" direction="vertical"
v-if="scope.row.state == 10 || scope.row.state == 14"> v-if="scope.row.state == 10 || scope.row.state == 14"
></el-divider>
<el-link
type="danger"
@click="table_del(scope.row)"
v-if="scope.row.state == 10 || scope.row.state == 14"
>
删除 删除
</el-link> </el-link>
</template> </template>
@ -137,18 +168,37 @@
</scTable> </scTable>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="成型10车间" name="10车间"> <el-tab-pane label="成型10车间" name="10车间">
<scTable ref="table10" :apiObj="apiUtask" row-key="id" stripe :height="topHeight" :params="paramsUtask10" <scTable
@row-click="rowclick" @selection-change="handleSelectionChange"> ref="table10"
:apiObj="apiUtask"
row-key="id"
stripe
:height="topHeight"
:params="paramsUtask10"
@row-click="rowclick"
@selection-change="handleSelectionChange"
>
<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"> <el-table-column label="任务编号" prop="number" width="120"> </el-table-column>
</el-table-column> <el-table-column
<el-table-column label="产品名称" prop="material" show-overflow-tooltip> label="产品名称"
prop="material"
show-overflow-tooltip
>
<template #default="scope"> <template #default="scope">
{{ scope.row.material_.name }} {{ scope.row.material_.name }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="型号" prop="number"> <el-table-column label="规格" prop="material_">
<template #default="scope">
{{ scope.row.material_.specification }}
</template>
</el-table-column>
<el-table-column label="型号" prop="material_">
<template #default="scope">
{{ scope.row.material_.model }}
</template>
</el-table-column> </el-table-column>
<el-table-column label="任务状态" prop="state"> <el-table-column label="任务状态" prop="state">
<template #default="scope"> <template #default="scope">
@ -160,37 +210,55 @@
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="任务量" prop="number"> <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>
<el-table-column label="计划量" prop="count"> <el-table-column label="计划完工时间" prop="end_date" width="120">
</el-table-column>
<el-table-column label="日均产量" prop="count">
</el-table-column>
<el-table-column label="计划开工时间" prop="start_date">
</el-table-column>
<el-table-column label="计划完工时间" prop="end_date">
</el-table-column>
<el-table-column label="完成产量" prop="count">
</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">
<span v-if="scope.row.count !=0">{{ (scope.row.count_ok/scope.row.count)*100 }}</span>
</template>
</el-table-column> </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="操作" fixed="right" width="150"> <el-table-column label="操作" fixed="right" width="150">
<template #default="scope"> <template #default="scope">
<el-link type="primary" @click="table_show(scope.row)"> <el-link type="primary" @click="table_show(scope.row)">
查看 查看
</el-link> </el-link>
<el-divider direction="vertical" v-if="scope.row.state == 10"></el-divider> <el-divider
<el-link type="primary" @click="table_edit(scope.row)" v-if="scope.row.state == 10"> direction="vertical"
v-if="scope.row.state == 10"
></el-divider>
<el-link
type="primary"
@click="table_edit(scope.row)"
v-if="scope.row.state == 10"
>
编辑 编辑
</el-link> </el-link>
<el-divider direction="vertical" v-if="scope.row.state == 30 || scope.row.state == 20"></el-divider> <el-divider
<el-link type="danger" @click="table_end(scope.row)" direction="vertical"
v-if="scope.row.state == 30 || scope.row.state == 20">终止</el-link> v-if="scope.row.state == 30 || scope.row.state == 20"
<el-divider direction="vertical" v-if="scope.row.state == 10 || scope.row.state == 14"></el-divider> ></el-divider>
<el-link type="danger" @click="table_del(scope.row)" <el-link
v-if="scope.row.state == 10 || scope.row.state == 14"> type="danger"
@click="table_end(scope.row)"
v-if="scope.row.state == 30 || scope.row.state == 20"
>终止</el-link
>
<el-divider
direction="vertical"
v-if="scope.row.state == 10 || scope.row.state == 14"
></el-divider>
<el-link
type="danger"
@click="table_del(scope.row)"
v-if="scope.row.state == 10 || scope.row.state == 14"
>
删除 删除
</el-link> </el-link>
</template> </template>
@ -199,27 +267,59 @@
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</el-main> </el-main>
<el-main class="nopadding" style="position: relative;"> <el-main class="nopadding" style="position: relative">
<el-header style="justify-content: space-between;"> <el-header style="justify-content: space-between">
<div class="left-panel"> <div class="left-panel">
<span style="font-size:14px ;">生产进度</span> <span style="font-size: 14px">生产进度</span>
</div> </div>
<div class="right-panel"> <div class="right-panel">
<el-date-picker v-model="query.date" type="daterange" range-separator="" start-placeholder="开始时间" <el-date-picker
end-placeholder="结束时间" value-format="YYYY-MM-DD" /> v-model="query.date"
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button> type="daterange"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
value-format="YYYY-MM-DD"
/>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"
>查询</el-button
>
</div> </div>
</el-header> </el-header>
<scTable ref="table2" :data="dataList" row-key="id" stripe :height="bottomHeight" :hideDo="hideDo" :params="query"> <scTable
ref="table2"
:data="dataList"
row-key="id"
stripe
:height="bottomHeight"
:hideDo="hideDo"
:params="query"
>
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="任务编号" prop="number" width="100" fixed="left"> <el-table-column
label="任务编号"
prop="number"
width="100"
fixed="left"
>
</el-table-column> </el-table-column>
<el-table-column label="产品名称" prop="material" width="100" show-overflow-tooltip fixed="left"> <el-table-column
label="产品名称"
prop="material"
width="100"
show-overflow-tooltip
fixed="left"
>
<template #default="scope"> <template #default="scope">
{{ scope.row.material_.name }} {{ scope.row.material_.name }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="规格" prop="specification" width="100" fixed="left"> <el-table-column
label="规格"
prop="specification"
width="100"
fixed="left"
>
<template #default="scope"> <template #default="scope">
{{ scope.row.material_.specification }} {{ scope.row.material_.specification }}
</template> </template>
@ -229,15 +329,35 @@
{{ scope.row.material_.model }} {{ scope.row.material_.model }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="计划量" prop="count" width="100" fixed="left"> <!-- <el-table-column label="计划量" prop="count" width="100" fixed="left">
</el-table-column> </el-table-column>
<el-table-column label="日均产量" prop="count_day" width="100" fixed="left"> <el-table-column
label="日均产量"
prop="count_day"
width="100"
fixed="left"
>
</el-table-column> </el-table-column>
<el-table-column label="计划开工时间" prop="start_date" width="100" fixed="left"> <el-table-column
label="计划开工时间"
prop="start_date"
width="100"
fixed="left"
>
</el-table-column> </el-table-column>
<el-table-column label="计划完工时间" prop="end_date" width="100" fixed="left"> <el-table-column
</el-table-column> label="计划完工时间"
<el-table-column v-for="item in columList" :label="item.data" :key="item" width="100"> prop="end_date"
width="100"
fixed="left"
>
</el-table-column> -->
<el-table-column
v-for="item in columList"
:label="item.data"
:key="item"
width="100"
>
<div :class="bindClass(item)"> <div :class="bindClass(item)">
<div v-if="activeName == '10车间'">{{ item.count1 }}</div> <div v-if="activeName == '10车间'">{{ item.count1 }}</div>
<div>{{ item.count2 }}</div> <div>{{ item.count2 }}</div>
@ -247,23 +367,49 @@
</scTable> </scTable>
</el-main> </el-main>
</el-container> </el-container>
<save-dialog v-if="dialog.save" ref="saveDialog" :activeName="activeName" @success="handleSaveSuccess" <save-dialog
@closed="dialog.save = false"></save-dialog> v-if="dialog.save"
<el-drawer title="任务详情" v-model="visibleRecord" :size="800" destroy-on-close @closed="visibleRecord = false"> ref="saveDialog"
<div class="right-panel tabsHeader"> :activeName="activeName"
<el-date-picker v-model="paramsObj.start_date" type="date" value-format="YYYY-MM-DD" /> @success="handleSaveSuccess"
<el-button type="primary" icon="el-icon-search" @click="handleDetailQuery">查询</el-button> @closed="dialog.save = false"
</div> ></save-dialog>
<el-drawer
title="任务详情"
v-model="visibleRecord"
:size="800"
destroy-on-close
@closed="visibleRecord = false"
>
<el-container v-loading="isloading"> <el-container v-loading="isloading">
<el-main style="padding: 0 20px 20px 20px"> <el-header>
<scTable ref="drawer_table" :apiObj="apiObj" row-key="id" stripe :params="paramsObj"> <div class="left-panel">
<el-date-picker
placeholder="工作日期"
v-model="paramsObj.start_date"
type="date"
value-format="YYYY-MM-DD"
@change="handleMtaskQuery"
/>
</div>
</el-header>
<el-main>
<scTable
ref="drawer_table"
:apiObj="apiObj"
row-key="id"
stripe
:params="paramsObj"
>
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="工段" prop="mgroup_name" show-overflow-tooltip> <el-table-column
</el-table-column> label="工段"
<el-table-column label="任务编号" prop="number"> prop="mgroup_name"
</el-table-column> show-overflow-tooltip
<el-table-column label="数量" prop="count"> >
</el-table-column> </el-table-column>
<el-table-column label="任务编号" prop="number"> </el-table-column>
<el-table-column label="数量" prop="count"> </el-table-column>
<el-table-column label="工作日期" prop="start_date"> <el-table-column label="工作日期" prop="start_date">
</el-table-column> </el-table-column>
<el-table-column label="状态" prop="state" show-overflow-tooltip> <el-table-column label="状态" prop="state" show-overflow-tooltip>
@ -294,22 +440,22 @@ export default {
save: false, save: false,
}, },
apiUtask: this.$API.pm.utask.list, apiUtask: this.$API.pm.utask.list,
paramsUtask7: { belong_dept__name: '7车间' }, paramsUtask7: { belong_dept__name: "7车间" },
paramsUtask8: { belong_dept__name: '8车间' }, paramsUtask8: { belong_dept__name: "8车间" },
paramsUtask10: { belong_dept__name: '10车间' }, paramsUtask10: { belong_dept__name: "10车间" },
apiObj: null, apiObj: null,
paramsObj: { utask: '' }, paramsObj: { utask: "" },
query: { query: {
page: 1, page: 1,
page_size: 20, page_size: 20,
date: '' date: "",
}, },
utaskId: '', utaskId: "",
isloading: false, isloading: false,
visibleRecord: false, visibleRecord: false,
tableHeight: null, tableHeight: null,
hideDo: true, hideDo: true,
activeName: '7车间', activeName: "7车间",
dataList: [ dataList: [
// {number:'rwbh2023',name:'',xh:'',count:100,count1:100,start_date:'2023-10-15',end_date:'2023-10-15', count01:100, count02:200, count03:300 }, // {number:'rwbh2023',name:'',xh:'',count:100,count1:100,start_date:'2023-10-15',end_date:'2023-10-15', count01:100, count02:200, count03:300 },
// {number:'rwbh2023',name:'',xh:'',count:100,count1:100,start_date:'2023-10-15',end_date:'2023-10-15', count01:100, count02:250, count03:300 }, // {number:'rwbh2023',name:'',xh:'',count:100,count1:100,start_date:'2023-10-15',end_date:'2023-10-15', count01:100, count02:250, count03:300 },
@ -319,11 +465,11 @@ export default {
selection: [], selection: [],
selectedIds: [], selectedIds: [],
state_: { state_: {
10: '创建中', 10: "创建中",
14: '已分解', 14: "已分解",
20: '已下达', 20: "已下达",
30: '生产中', 30: "生产中",
40: '已提交' 40: "已提交",
}, },
topHeight: null, topHeight: null,
bottomHeight: null, bottomHeight: null,
@ -336,24 +482,29 @@ export default {
let day = date.getDate(); let day = date.getDate();
let timeNow = date.getTime(); let timeNow = date.getTime();
let timer = 1000 * 60 * 60 * 24 * 2; let timer = 1000 * 60 * 60 * 24 * 2;
let data2 = new Date(timeNow - timer);//2 let data2 = new Date(timeNow - timer); //2
let year2 = data2.getFullYear(); let year2 = data2.getFullYear();
let month2 = data2.getMonth() + 1; let month2 = data2.getMonth() + 1;
let day2 = data2.getDate(); let day2 = data2.getDate();
let startDate = year2 + '-' + month2 + '-' + day2; let startDate = year2 + "-" + month2 + "-" + day2;
let endDate = year + '-' + month + '-' + day; let endDate = year + "-" + month + "-" + day;
this.query.date = [startDate, endDate]; this.query.date = [startDate, endDate];
let heights = document.getElementById('topContainer').clientHeight; let heights = document.getElementById("topContainer").clientHeight;
this.topHeight = (heights - 45) + 'px'; this.topHeight = heights - 45 + "px";
this.bottomHeight = (heights - 65) + 'px'; this.bottomHeight = heights - 65 + "px";
}, },
methods: { methods: {
// Class // Class
bindClass(item) { bindClass(item) {
let count = item.count; let count = item.count;
let classInfo = { countBlock: true, redColor: false, greenColor: false, orangeColor: false }; let classInfo = {
countBlock: true,
redColor: false,
greenColor: false,
orangeColor: false,
};
let countok = 0; let countok = 0;
if (this.activeName == '10车间') { if (this.activeName == "10车间") {
countok = item.count3; countok = item.count3;
} else { } else {
countok = item.count2; countok = item.count2;
@ -368,7 +519,7 @@ export default {
} }
} }
return classInfo return classInfo;
}, },
// //
add() { add() {
@ -388,29 +539,39 @@ export default {
async table_del(row) { async table_del(row) {
this.$confirm(`确定删除吗?`, "提示", { this.$confirm(`确定删除吗?`, "提示", {
type: "warning", type: "warning",
}).then(() => { })
this.$API.pm.utask.delete.req(row.id).then((res) => { .then(() => {
this.$API.pm.utask.delete
.req(row.id)
.then((res) => {
this.$message.success("删除成功"); this.$message.success("删除成功");
this.$refs.table7.refresh(); this.$refs.table7.refresh();
return res; return res;
}).catch((err) => { })
.catch((err) => {
return err; return err;
}); });
}).catch(() => { }); })
.catch(() => {});
}, },
// //
table_end(row) { table_end(row) {
this.$confirm(`确定终止该任务吗?`, "提示", { this.$confirm(`确定终止该任务吗?`, "提示", {
type: "warning", type: "warning",
}).then(() => { })
this.$API.pm.utask.stop.req(row.id).then((res) => { .then(() => {
this.$API.pm.utask.stop
.req(row.id)
.then((res) => {
this.$message.success("操作成功"); this.$message.success("操作成功");
this.$refs.table10.refresh(); this.$refs.table10.refresh();
return res; return res;
}).catch((err) => { })
.catch((err) => {
return err; return err;
}); });
}).catch(() => { }); })
.catch(() => {});
}, },
// //
handleSaveSuccess(data, mode) { handleSaveSuccess(data, mode) {
@ -428,14 +589,14 @@ export default {
let arr = []; let arr = [];
let startTimer = new Date(start).getTime(); let startTimer = new Date(start).getTime();
let endTimer = new Date(end).getTime(); let endTimer = new Date(end).getTime();
let oneTime = 1000 * 60 * 60 * 24;//1 let oneTime = 1000 * 60 * 60 * 24; //1
let tempTime = startTimer; let tempTime = startTimer;
while (tempTime <= endTimer) { while (tempTime <= endTimer) {
let dates = new Date(tempTime); let dates = new Date(tempTime);
let year = dates.getFullYear(); let year = dates.getFullYear();
let month = dates.getMonth() + 1; let month = dates.getMonth() + 1;
let day = dates.getDate(); let day = dates.getDate();
let item = year + '-' + month + '-' + day; let item = year + "-" + month + "-" + day;
arr.push(item); arr.push(item);
tempTime = tempTime + oneTime; tempTime = tempTime + oneTime;
} }
@ -446,8 +607,8 @@ export default {
}, },
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.selectedIds = []; this.selectedIds = [];
selection.forEach(item => { selection.forEach((item) => {
this.selectedIds.push(item.id) this.selectedIds.push(item.id);
}); });
}, },
// //
@ -456,48 +617,60 @@ export default {
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.req({ ids: ids }).then(res => { that.$API.pm.utask.scheduemtasks
that.$API.pm.utask.assgin.req({ ids: ids }).then(res => { .req({ ids: ids })
that.$message.success('下达任务成功'); .then((res) => {
that.$API.pm.utask.assgin
.req({ ids: ids })
.then((res) => {
that.$message.success("下达任务成功");
that.isloading = false; that.isloading = false;
that.$refs.table7.refresh(); that.$refs.table7.refresh();
// that.$refs.table8.refresh(); // that.$refs.table8.refresh();
that.$refs.table10.refresh(); that.$refs.table10.refresh();
}).catch(() => {
that.isloading = false;
}) })
.catch(() => {
}).catch(() => {
that.isloading = false; that.isloading = false;
});
}) })
.catch(() => {
that.isloading = false;
});
} else { } else {
this.$message.error('未选择任何任务') this.$message.error("未选择任何任务");
} }
}, },
utaskAssgin() { utaskAssgin() {
let that = this; let that = this;
if (that.selectedIds.length > 0) { if (that.selectedIds.length > 0) {
that.isloading = true; that.isloading = true;
that.$API.pm.utask.assgin.req({ ids: that.selectedIds }).then(res => { that.$API.pm.utask.assgin
that.$message.success('下达任务成功'); .req({ ids: that.selectedIds })
.then((res) => {
that.$message.success("下达任务成功");
that.isloading = false; that.isloading = false;
that.$refs.table7.refresh(); that.$refs.table7.refresh();
// that.$refs.table8.refresh(); // that.$refs.table8.refresh();
that.$refs.table10.refresh(); that.$refs.table10.refresh();
}).catch(() => {
that.isloading = false;
}) })
.catch(() => {
that.isloading = false;
});
} else { } else {
this.$message.error('未选择任何任务') this.$message.error("未选择任何任务");
} }
}, },
// //
table_show(row) { table_show(row) {
this.utaskId = row.id; this.utaskId = row.id;
this.paramsObj = {}
this.paramsObj.utask = row.id; this.paramsObj.utask = row.id;
this.apiObj = this.$API.pm.mtask.list; this.apiObj = this.$API.pm.mtask.list;
this.visibleRecord = true; this.visibleRecord = true;
}, },
handleMtaskQuery() {
this.$refs.drawer_table.queryData(this.paramsObj)
} ,
handleClick() { handleClick() {
this.columList = []; this.columList = [];
this.dataList = []; this.dataList = [];
@ -506,45 +679,46 @@ export default {
let that = this; let that = this;
that.columList = []; that.columList = [];
let utask = val.id; let utask = val.id;
that.dataList = [val] that.dataList = [val];
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.state = item.state obj.state = item.state;
obj.count1 = 0; obj.count2 = 0; obj.count3 = 0; obj.count1 = 0;
obj.count2 = 0;
obj.count3 = 0;
obj.count = item.count; obj.count = item.count;
obj.data = item.start_date; obj.data = item.start_date;
if (that.activeName == '7车间') { if (that.activeName == "7车间") {
let rate = (item.count_ok / item.count) * 100; let rate = (item.count_ok / item.count) * 100;
obj.count2 = item.count_ok;//7count_ok obj.count2 = item.count_ok; //7count_ok
obj.count3 = rate + '%';//7 obj.count3 = rate + "%"; //7
} else if (that.activeName == '10车间') { } else if (that.activeName == "10车间") {
let mlogs = item.mlogs; let mlogs = item.mlogs;
if (mlogs.length > 0) { if (mlogs.length > 0) {
for (let i = 0; i < mlogs.length; i++) { for (let i = 0; i < mlogs.length; i++) {
if (mlogs[i].shift_name == '白班') { if (mlogs[i].shift_name == "白班") {
obj.count1 = mlogs[i].count_ok;//10 obj.count1 = mlogs[i].count_ok; //10
} else { } else {
obj.count2 = mlogs[i].count_ok;//10 obj.count2 = mlogs[i].count_ok; //10
} }
obj.count3 = obj.count1 + obj.count2;//10 obj.count3 = obj.count1 + obj.count2; //10
} }
} }
} }
columList.push(obj); columList.push(obj);
});
}) this.columList = columList;
this.columList = columList console.log(columList);
console.log(columList) });
})
}, },
}, },
}; };
</script> </script>
<style scoped> <style scoped>
.right-panel>*+* { .right-panel > * + * {
margin-left: 10px; margin-left: 10px;
} }
@ -567,7 +741,7 @@ export default {
} }
.el-main.nopadding { .el-main.nopadding {
padding: 0 20px 0 20px padding: 0 20px 0 20px;
} }
.btnsContainer { .btnsContainer {
@ -575,6 +749,6 @@ export default {
position: absolute; position: absolute;
right: 20px; right: 20px;
margin-top: 4px; margin-top: 4px;
z-index: 100 z-index: 100;
} }
</style> </style>

View File

@ -110,12 +110,13 @@
</el-footer> </el-footer>
</el-dialog> </el-dialog>
<el-drawer title="任务详情" v-model="visibleRecord" :size="800" destroy-on-close @closed="visibleRecord = false"> <el-drawer title="任务详情" v-model="visibleRecord" :size="800" destroy-on-close @closed="visibleRecord = false">
<div class="right-panel tabsHeader">
<el-date-picker v-model="paramsObj.start_date" type="date" value-format="YYYY-MM-DD" />
<el-button type="primary" icon="el-icon-search" @click="handleDetailQuery">查询</el-button>
</div>
<el-container v-loading="loading"> <el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px"> <el-header>
<div class="left-panel">
<el-date-picker placeholder="工作日期" v-model="paramsObj.start_date" type="date" value-format="YYYY-MM-DD" @change="handleMtaskQuery"/>
</div>
</el-header>
<el-main>
<scTable ref="drawer_table" :apiObj="apiObj" row-key="id" stripe :params="paramsObj"> <scTable ref="drawer_table" :apiObj="apiObj" row-key="id" stripe :params="paramsObj">
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="任务编号" prop="number"> <el-table-column label="任务编号" prop="number">
@ -372,9 +373,9 @@ export default {
this.apiObj = this.$API.pm.mtask.list; this.apiObj = this.$API.pm.mtask.list;
this.visibleRecord = true; this.visibleRecord = true;
}, },
handleDetailQuery() { handleMtaskQuery() {
this.$refs.drawer_table.refresh(); this.$refs.drawer_table.queryData(this.paramsObj)
}, } ,
// //
async table_del(row) { async table_del(row) {
let that = this; let that = this;

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick"> <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<el-tab-pane label="粗加工6车间" name="first"> <el-tab-pane label="粗加工6车间" name="first">
<scTable ref="table" :apiObj="apiObj" row-key="id" stripe :height="topHeight" :params="query" hidePagination <scTable ref="table" :apiObj="apiObj" row-key="id" stripe :height="topHeight" :params="query" hidePagination
@row-click="rowClick"> @row-click="rowClick" hideDo>
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="任务编号" prop="number"> <el-table-column label="任务编号" prop="number">
</el-table-column> </el-table-column>
@ -17,13 +17,19 @@
<span v-if="scope.row.material_out_">{{ scope.row.material_out_.name }}</span> <span v-if="scope.row.material_out_">{{ scope.row.material_out_.name }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="产品型号" prop="number"> <el-table-column label="规格" prop="material">
<template #default="scope">
<span v-if="scope.row.material_out_">{{ scope.row.material_out_.specification }}</span>
</template>
</el-table-column> </el-table-column>
<el-table-column label="产品规格" prop="number"> <el-table-column label="型号" prop="material">
<template #default="scope">
<span v-if="scope.row.material_out_">{{ scope.row.material_out_.model }}</span>
</template>
</el-table-column> </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 label="生产日期" prop="start_date">
</el-table-column> </el-table-column>
<el-table-column label="状态" prop="state"> <el-table-column label="状态" prop="state">
<template #default="scope"> <template #default="scope">
@ -51,19 +57,19 @@
<div> <div>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="13" style="border-right: 1px solid #eeeeee;"> <el-col :span="13" style="border-right: 1px solid #eeeeee;">
<div class="tableTitle">工序进度</div> <div class="tableTitle">工序进度</div>
<scTable ref="tableprocess" row-key="id" stripe :hideDo="hideDo" :data="processList" :height="bottomHeight"> <scTable ref="tableprocess" row-key="id" stripe :hideDo="hideDo" :data="processList" :height="bottomHeight">
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="日期" prop="start_date"> <el-table-column label="任务编号" prop="number" width="150">
</el-table-column>
<el-table-column label="日期" prop="start_date" width="120">
</el-table-column> </el-table-column>
<el-table-column label="工序" prop="mgroup_name"> <el-table-column label="工序" prop="mgroup_name">
</el-table-column> </el-table-column>
<el-table-column label="产品名称" prop="number"> <!-- <el-table-column label="型号规格" prop="specification">
</el-table-column>
<el-table-column label="型号规格" prop="specification">
</el-table-column> </el-table-column>
<el-table-column label="规格" prop="number"> <el-table-column label="规格" prop="number">
</el-table-column> </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_ok"> <el-table-column label="合格数量" prop="count_ok">
@ -91,7 +97,7 @@
<el-table-column label="型号" prop="material"> <el-table-column label="型号" prop="material">
<template #default="scope">{{ scope.row.material_.model }}</template> <template #default="scope">{{ scope.row.material_.model }}</template>
</el-table-column> </el-table-column>
<el-table-column label="批次" prop="batch"> <el-table-column label="批次" prop="batch" show-overflow-tooltip>
</el-table-column> </el-table-column>
<el-table-column label="数量" prop="count" width="80"> <el-table-column label="数量" prop="count" width="80">
</el-table-column> </el-table-column>

View File

@ -1,34 +1,29 @@
<template> <template>
<el-container> <el-card header="任务信息">
<el-card style="height:fit-content;padding-bottom:10px;">
<el-form label-width="100px"> <el-form label-width="100px">
<el-row> <el-row>
<el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24"> <el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
<el-form-item class="infoForm" label="产品名称:">{{ orderObj.number }}</el-form-item> <el-form-item class="infoForm" label="任务编号:">{{ mtaskObj.number }}</el-form-item>
</el-col> </el-col>
<el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24"> <el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
<el-form-item class="infoForm" label="型号:">{{ orderObj.number }}</el-form-item> <el-form-item class="infoForm" label="产品名称:"><span v-if="mtaskObj.material_out_">{{ mtaskObj.material_out_.name }}</span></el-form-item>
</el-col> </el-col>
<el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24"> <el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
<el-form-item class="infoForm" label="规格">{{ orderObj.number }}</el-form-item> <el-form-item class="infoForm" label="规格型号:"><span v-if="mtaskObj.material_out_">{{ mtaskObj.material_out_.specification }} {{ mtaskObj.material_out_.model }}</span></el-form-item>
</el-col> </el-col>
<el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24"> <el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
<el-form-item class="infoForm" label="计划数量">{{ orderObj.count }}</el-form-item> <el-form-item class="infoForm" label="计划数量:">{{ mtaskObj.count }}</el-form-item>
</el-col> </el-col>
<el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24"> <el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
<el-form-item class="infoForm" label="计划日期">{{ orderObj.start_date }}</el-form-item> <el-form-item class="infoForm" label="计划日期:">{{ mtaskObj.start_date }}</el-form-item>
</el-col> </el-col>
<el-button v-if="orderObj.state!==40" type="primary" @click="submit">提交</el-button> <el-button v-if="mtaskObj.state!==40" type="primary" @click="submit">提交任务</el-button>
</el-row> </el-row>
</el-form> </el-form>
</el-card> </el-card>
<el-header> <div style="padding: 4px; background-color: white">
<div class="left-panel"> <el-button type="primary" icon="el-icon-plus" @click="addRow" :disabled="mtaskObj.state==40">新增记录</el-button>
<el-button type="primary" icon="el-icon-plus" @click="addRow" :disabled="orderObj.state==40">新增记录</el-button>
</div> </div>
<div class="right-panel"></div>
</el-header>
<el-main class="nopadding">
<sc-form-table ref="table" v-model="relatedList" hideAdd drag-sort placeholder="暂无数据"> <sc-form-table ref="table" v-model="relatedList" hideAdd drag-sort placeholder="暂无数据">
<el-table-column prop="type" label="工序" min-width="100"> <el-table-column prop="type" label="工序" min-width="100">
<template #default="scope"> <template #default="scope">
@ -96,13 +91,11 @@
</template> </template>
</el-table-column> </el-table-column>
</sc-form-table> </sc-form-table>
</el-main>
</el-container>
<save-dialog <save-dialog
v-if="dialog.save" v-if="dialog.save"
ref="saveDialog" ref="saveDialog"
:mtask="orderObj.id" :mtask="mtaskObj.id"
:date="orderObj.start_date" :date="mtaskObj.start_date"
@success="handleSaveSuccess" @success="handleSaveSuccess"
@closed="dialog.save = false" @closed="dialog.save = false"
></save-dialog> ></save-dialog>
@ -120,7 +113,7 @@
save: false, save: false,
}, },
task:'', task:'',
orderObj:{}, mtaskObj:{},
apiObj: null, apiObj: null,
query: { query: {
page:0, page:0,
@ -148,7 +141,7 @@
getTask(){ getTask(){
let that = this; let that = this;
that.$API.pm.mtask.item.req(that.mtask).then((res) => { that.$API.pm.mtask.item.req(that.mtask).then((res) => {
that.orderObj = res; that.mtaskObj = res;
that.getFormList(); that.getFormList();
}) })
}, },
@ -185,7 +178,7 @@
}, },
getFormList(){ getFormList(){
let that = this; let that = this;
that.$API.pm.mtask.related.req(that.orderObj.id).then(res=>{ that.$API.pm.mtask.related.req(that.mtaskObj.id).then(res=>{
that.related = res; that.related = res;
let ids = []; let ids = [];
res.forEach(item=>{ res.forEach(item=>{
@ -238,7 +231,7 @@
}else{ }else{
debugger; debugger;
let obj = row; let obj = row;
obj.handle_date = this.orderObj.start_date; obj.handle_date = this.mtaskObj.start_date;
obj.count_real = obj.count_use; obj.count_real = obj.count_use;
this.$API.wpm.mlog.create.req(obj).then(res=>{ this.$API.wpm.mlog.create.req(obj).then(res=>{
this.relatedList[index].isedit = false; this.relatedList[index].isedit = false;
@ -251,7 +244,7 @@
let obj = {}; let obj = {};
let ids = data.join(',') let ids = data.join(',')
obj.mtask__in = ids; obj.mtask__in = ids;
obj.handle_date = this.orderObj.start_date; obj.handle_date = this.mtaskObj.start_date;
obj.mtask__mgroup__belong_dept__name = '6车间'; obj.mtask__mgroup__belong_dept__name = '6车间';
this.$API.wpm.mlog.list.req(obj).then(res=>{ this.$API.wpm.mlog.list.req(obj).then(res=>{
let data = res.results; let data = res.results;
@ -288,7 +281,7 @@
submit(){ submit(){
let that = this; let that = this;
that.$confirm(`确定删除吗?`, "提示", {type: "warning"}).then(() => { that.$confirm(`确定删除吗?`, "提示", {type: "warning"}).then(() => {
that.$API.pm.mtask.submitSameDay.req(that.orderObj.id).then(re=>{ that.$API.pm.mtask.submitSameDay.req(that.mtaskObj.id).then(re=>{
that.$message.success("提交成功"); that.$message.success("提交成功");
}).catch((err) => { }).catch((err) => {
return err; return err;

File diff suppressed because it is too large Load Diff