yemianqunaxiananniutinajia

This commit is contained in:
shijing 2022-03-02 09:53:54 +08:00
parent 7a1a1111ff
commit 7bfc78bc07
6 changed files with 817 additions and 765 deletions

View File

@ -2,7 +2,7 @@
<div class="app-container"> <div class="app-container">
<el-card> <el-card>
<div> <div>
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"> <el-button v-if="checkPermission(['material_create'])" type="primary" icon="el-icon-plus" @click="handleCreate">
新增物料 新增物料
</el-button> </el-button>
<el-input <el-input
@ -85,7 +85,7 @@
>检查表 >检查表
</el-link> </el-link>
<el-link <el-link
v-if="checkPermission(['material_update'])" subproduction_delete
type="primary" type="primary"
@click="handleEdit(scope)" @click="handleEdit(scope)"
>编辑 >编辑

View File

@ -2,7 +2,7 @@
<div class="app-container"> <div class="app-container">
<el-card> <el-card>
<div style="margin-top: 2px"> <div style="margin-top: 2px">
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"> <el-button v-if="checkPermission(['process_create'])" type="primary" icon="el-icon-plus" @click="handleCreate">
新增工序 新增工序
</el-button> </el-button>
</div> </div>
@ -46,6 +46,7 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
v-if="checkPermission(['process_update'])"
type="primary" type="primary"
@click="handleAdd(scope)" @click="handleAdd(scope)"
> >

View File

@ -42,25 +42,28 @@
<el-col :span="15"> <el-col :span="15">
<el-card class="box-card"> <el-card class="box-card">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span style="font-size: 16px; <span style="font-size: 16px;
font-weight: 700; font-weight: 700;
">工艺流程</span> ">工艺流程</span>
</div> </div>
<el-steps :active="values" spac="400px" align-center="" style="padding-top: 20px;height:80px"> <el-steps :active="values" spac="400px" align-center="" style="padding-top: 20px;height:80px">
<el-step :title="item.name" v-for="(item,index) in processoptions " :key="index" <el-step
@click.native=stepclick(item.id)> v-for="(item,index) in processoptions "
:key="index"
:title="item.name"
@click.native=stepclick(item.id)
>
</el-step> </el-step>
</el-steps> </el-steps>
</el-card> </el-card>
<el-card class="box-card"> <el-card class="box-card">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span style="font-size: 16px; <span style="font-size: 16px;
font-weight: 700; font-weight: 700;
">流程分解</span> ">流程分解</span>
</div> </div>
<el-button type="primary" icon="el-icon-plus" @click="handlesubproducationCreate" <el-button v-if="checkPermission(['subproduction_create'])" type="primary" icon="el-icon-plus" @click="handlesubproducationCreate">
>新增 新增
</el-button> </el-button>
<el-table <el-table
height="190px" height="190px"
@ -87,33 +90,29 @@
<el-table-column label="排序"> <el-table-column label="排序">
<template slot-scope="scope">{{ scope.row.sort }}</template> <template slot-scope="scope">{{ scope.row.sort }}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
align="center" align="center"
label="操作" label="操作"
width="220px" width="220px"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
v-if="checkPermission(['material_update'])" v-if="checkPermission(['subproduction_update'])"
type="primary" type="primary"
@click="handlesubproducationEdit(scope)" @click="handlesubproducationEdit(scope)"
>编辑
</el-link
> >
编辑
</el-link>
<el-link <el-link
v-if="checkPermission(['material_delete'])" v-if="checkPermission(['subproduction_delete'])"
type="danger" type="danger"
@click="handlesubproducationDelete(scope)" @click="handlesubproducationDelete(scope)"
>删除
</el-link
> >
删除
</el-link>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-dialog <el-dialog
:visible.sync="dialogVisiblesp" :visible.sync="dialogVisiblesp"
:title="dialogTypesp === 'edit' ? '编辑流程分解' : '新增流程分解'" :title="dialogTypesp === 'edit' ? '编辑流程分解' : '新增流程分解'"
@ -124,7 +123,6 @@
label-width="80px" label-width="80px"
label-position="right" label-position="right"
> >
<el-form-item label="名称" prop="name"> <el-form-item label="名称" prop="name">
<el-input v-model="subproducation.name"/> <el-input v-model="subproducation.name"/>
</el-form-item> </el-form-item>
@ -137,7 +135,6 @@
:value="item.value"> :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="是否质检" prop="need_combtest"> <el-form-item label="是否质检" prop="need_combtest">
<el-switch v-model="subproducation.need_combtest"></el-switch> <el-switch v-model="subproducation.need_combtest"></el-switch>
@ -149,8 +146,6 @@
:max="2147483647" :max="2147483647"
></el-input-number> ></el-input-number>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="text-align: right"> <div style="text-align: right">
<el-button type="danger" @click="dialogVisiblesp = false">取消</el-button> <el-button type="danger" @click="dialogVisiblesp = false">取消</el-button>
@ -160,8 +155,13 @@
</el-card> </el-card>
<el-tabs type="border-card" style="height:310px"> <el-tabs type="border-card" style="height:310px">
<el-tab-pane label="输入物料"> <el-tab-pane label="输入物料">
<el-button type="primary" icon="el-icon-plus" @click="handleinputCreate" <el-button
>新增 v-if="checkPermission(['subproduction_update'])"
type="primary"
icon="el-icon-plus"
@click="handleinputCreate"
>
新增
</el-button> </el-button>
<el-table <el-table
:data="inputtableData" :data="inputtableData"
@ -190,16 +190,18 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
v-if="checkPermission(['material_update'])" v-if="checkPermission(['subproduction_update'])"
type="primary" type="primary"
@click="handleinputEdit(scope)" @click="handleinputEdit(scope)"
>编辑 >
编辑
</el-link> </el-link>
<el-link <el-link
v-if="checkPermission(['material_delete'])" v-if="checkPermission(['subproduction_update'])"
type="danger" type="danger"
@click="handleinputDelete(scope)" @click="handleinputDelete(scope)"
>删除 >
删除
</el-link> </el-link>
</template> </template>
</el-table-column> </el-table-column>
@ -244,8 +246,13 @@
</el-dialog> </el-dialog>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="输出物料"> <el-tab-pane label="输出物料">
<el-button type="primary" icon="el-icon-plus" @click="handleoutputCreate" <el-button
>新增 v-if="checkPermission(['subproduction_update'])"
type="primary"
icon="el-icon-plus"
@click="handleoutputCreate"
>
新增
</el-button> </el-button>
<el-table <el-table
:data="outputtableData" :data="outputtableData"
@ -268,7 +275,7 @@
</el-table-column> </el-table-column>
<el-table-column label="是否主产出"> <el-table-column label="是否主产出">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.is_main==true"> </el-tag> <el-tag v-if="scope.row.is_main==true"></el-tag>
<el-tag v-else></el-tag> <el-tag v-else></el-tag>
</template> </template>
</el-table-column> </el-table-column>
@ -279,16 +286,18 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
v-if="checkPermission(['material_update'])" v-if="checkPermission(['subproduction_update'])"
type="primary" type="primary"
@click="handleoutputEdit(scope)" @click="handleoutputEdit(scope)"
>编辑 >
编辑
</el-link> </el-link>
<el-link <el-link
v-if="checkPermission(['material_delete'])" v-if="checkPermission(['subproduction_update'])"
type="danger" type="danger"
@click="handleoutputDelete(scope)" @click="handleoutputDelete(scope)"
>删除 >
删除
</el-link> </el-link>
</template> </template>
</el-table-column> </el-table-column>
@ -336,8 +345,13 @@
</el-dialog> </el-dialog>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="工具工装"> <el-tab-pane label="工具工装">
<el-button type="primary" icon="el-icon-plus" @click="handleotherCreate" <el-button
>新增 v-if="checkPermission(['subproduction_update'])"
type="primary"
icon="el-icon-plus"
@click="handleotherCreate"
>
新增
</el-button> </el-button>
<el-table <el-table
:data="othertableData" :data="othertableData"
@ -362,16 +376,18 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
v-if="checkPermission(['material_update'])" v-if="checkPermission(['subproduction_update'])"
type="primary" type="primary"
@click="handleotherEdit(scope)" @click="handleotherEdit(scope)"
>编辑 >
编辑
</el-link> </el-link>
<el-link <el-link
v-if="checkPermission(['material_delete'])" v-if="checkPermission(['subproduction_update'])"
type="danger" type="danger"
@click="handleotherDelete(scope)" @click="handleotherDelete(scope)"
>删除 >
删除
</el-link> </el-link>
</template> </template>
</el-table-column> </el-table-column>
@ -418,8 +434,13 @@
</el-dialog> </el-dialog>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="子工序列表"> <el-tab-pane label="子工序列表">
<el-button type="primary" icon="el-icon-plus" @click="handleusedstepCreate" <el-button
>新增 v-if="checkPermission(['subproduction_update'])"
type="primary"
icon="el-icon-plus"
@click="handleusedstepCreate"
>
新增
</el-button> </el-button>
<el-table <el-table
:data="usedsteptableData" :data="usedsteptableData"
@ -433,7 +454,6 @@
</el-table-column> </el-table-column>
<el-table-column label="工序内检验"> <el-table-column label="工序内检验">
<template slot-scope="scope"> <template slot-scope="scope">
<!--{{ scope.row.need_test }}-->
<span v-if=" scope.row.need_test">检验</span> <span v-if=" scope.row.need_test">检验</span>
<span v-else>不检验</span> <span v-else>不检验</span>
</template> </template>
@ -447,20 +467,24 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
v-if="checkPermission(['subproduction_update'])"
type="primary" type="primary"
@click="handleEdit(scope)" @click="handleEdit(scope)"
>编辑 >
编辑
</el-link> </el-link>
<el-link <el-link
type="primary" type="primary"
@click="handlesearch(scope)" @click="handlesearch(scope)"
>查看 >
查看
</el-link> </el-link>
<el-link <el-link
v-if="checkPermission(['material_delete'])" v-if="checkPermission(['subproduction_update'])"
type="danger" type="danger"
@click="handleusedstepDelete(scope)" @click="handleusedstepDelete(scope)"
>删除 >
删除
</el-link> </el-link>
</template> </template>
</el-table-column> </el-table-column>
@ -503,8 +527,13 @@
</el-dialog> </el-dialog>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="技术文件"> <el-tab-pane label="技术文件">
<el-button type="primary" icon="el-icon-plus" @click="handletechdocCreate" <el-button
>新增 v-if="checkPermission(['subproduction_update'])"
type="primary"
icon="el-icon-plus"
@click="handletechdocCreate"
>
新增
</el-button> </el-button>
<el-table <el-table
:data="techdoctableData" :data="techdoctableData"
@ -535,16 +564,18 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
v-if="checkPermission(['process_update'])" v-if="checkPermission(['subproduction_update'])"
type="primary" type="primary"
@click="handletechdocEdit(scope)" @click="handletechdocEdit(scope)"
>编辑 >
编辑
</el-link> </el-link>
<el-link <el-link
v-if="checkPermission(['process_delete'])" v-if="checkPermission(['subproduction_update'])"
type="danger" type="danger"
@click="handletechdocDelete(scope)" @click="handletechdocDelete(scope)"
>删除 >
删除
</el-link> </el-link>
</template> </template>
</el-table-column> </el-table-column>
@ -628,7 +659,7 @@
deleteOthermaterial, deleteOthermaterial,
updateOthermaterial updateOthermaterial
} from "@/api/mtm"; } from "@/api/mtm";
import { getEquipmentAll } from "@/api/equipment"; import {getEquipmentAll} from "@/api/equipment";
import {quillEditor} from 'vue-quill-editor' import {quillEditor} from 'vue-quill-editor'
import 'quill/dist/quill.core.css' import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css' import 'quill/dist/quill.snow.css'
@ -641,8 +672,8 @@
const defaultinputmaterial = {}; const defaultinputmaterial = {};
const defaultoutputmaterial = {}; const defaultoutputmaterial = {};
const defaultother = {}; const defaultother = {};
const defaultusedstep = {need_test:false}; const defaultusedstep = {need_test: false};
const defaulttechdoc = {enabled: false,name:""}; const defaulttechdoc = {enabled: false, name: ""};
const defaultsubproducation = { const defaultsubproducation = {
need_combtest: false, need_combtest: false,
}; };
@ -831,11 +862,11 @@
}) })
.then(async () => { .then(async () => {
await deletesubproducation(scope.row.id); await deletesubproducation(scope.row.id);
this.getsubproducationList() this.getsubproducationList();
this.$message.success("成功"); this.$message.success("成功");
}) })
.catch((err) => { .catch((err) => {
console.error(err); this.$message.error(err);
}); });
}, },
@ -847,7 +878,7 @@
this.subproducation.product = this.product; this.subproducation.product = this.product;
updatesubproducation(this.subproducation.id, this.subproducation).then((res) => { updatesubproducation(this.subproducation.id, this.subproducation).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getsubproducationList() this.getsubproducationList();
this.dialogVisiblesp = false; this.dialogVisiblesp = false;
this.$message.success("成功"); this.$message.success("成功");
} }
@ -856,7 +887,7 @@
this.subproducation.product = this.product; this.subproducation.product = this.product;
createsubproducation(this.subproducation).then((res) => { createsubproducation(this.subproducation).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getsubproducationList() this.getsubproducationList();
this.dialogVisiblesp = false; this.dialogVisiblesp = false;
this.$message.success("成功"); this.$message.success("成功");
} }
@ -906,11 +937,11 @@
}) })
.then(async () => { .then(async () => {
await deleteInputmaterial(scope.row.id); await deleteInputmaterial(scope.row.id);
this.getInputmaterialLists() this.getInputmaterialLists();
this.$message.success("成功"); this.$message.success("成功");
}) })
.catch((err) => { .catch((err) => {
console.error(err); this.$message.error(err);
}); });
}, },
@ -922,7 +953,7 @@
this.inputmaterial.subproduction = this.subproduction; this.inputmaterial.subproduction = this.subproduction;
updateInputmaterial(this.inputmaterial.id, this.inputmaterial).then((res) => { updateInputmaterial(this.inputmaterial.id, this.inputmaterial).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getInputmaterialLists() this.getInputmaterialLists();
this.dialogVisible = false; this.dialogVisible = false;
this.$message.success("成功"); this.$message.success("成功");
} }
@ -931,7 +962,7 @@
this.inputmaterial.subproduction = this.subproduction; this.inputmaterial.subproduction = this.subproduction;
createInputmaterial(this.inputmaterial).then((res) => { createInputmaterial(this.inputmaterial).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getInputmaterialLists() this.getInputmaterialLists();
this.dialogVisible = false; this.dialogVisible = false;
this.$message.success("成功"); this.$message.success("成功");
} }
@ -980,11 +1011,11 @@
}) })
.then(async () => { .then(async () => {
await deleteOutputmaterial(scope.row.id); await deleteOutputmaterial(scope.row.id);
this.getOutputmaterialLists() this.getOutputmaterialLists();
this.$message.success("成功"); this.$message.success("成功");
}) })
.catch((err) => { .catch((err) => {
console.error(err); this.$message.error(err);
}); });
}, },
async outputconfirm(form) { async outputconfirm(form) {
@ -995,7 +1026,7 @@
this.outputmaterial.subproduction = this.subproduction; this.outputmaterial.subproduction = this.subproduction;
updateOutputmaterial(this.outputmaterial.id, this.outputmaterial).then((res) => { updateOutputmaterial(this.outputmaterial.id, this.outputmaterial).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getOutputmaterialLists() this.getOutputmaterialLists();
this.dialogVisible1 = false; this.dialogVisible1 = false;
this.$message.success("成功"); this.$message.success("成功");
} }
@ -1004,7 +1035,7 @@
this.outputmaterial.subproduction = this.subproduction; this.outputmaterial.subproduction = this.subproduction;
createOutputmaterial(this.outputmaterial).then((res) => { createOutputmaterial(this.outputmaterial).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getOutputmaterialLists() this.getOutputmaterialLists();
this.dialogVisible1 = false; this.dialogVisible1 = false;
this.$message.success("成功"); this.$message.success("成功");
} }
@ -1056,7 +1087,7 @@
this.$message.success("成功"); this.$message.success("成功");
}) })
.catch((err) => { .catch((err) => {
console.error(err); this.$message.error(err);
}); });
}, },
@ -1068,7 +1099,7 @@
this.othermaterial.subproduction = this.subproduction; this.othermaterial.subproduction = this.subproduction;
updateOthermaterial(this.othermaterial.id, this.othermaterial).then((res) => { updateOthermaterial(this.othermaterial.id, this.othermaterial).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getOthermaterialLists() this.getOthermaterialLists();
this.dialogVisibleother = false; this.dialogVisibleother = false;
this.$message.success("成功"); this.$message.success("成功");
} }
@ -1077,7 +1108,7 @@
this.othermaterial.subproduction = this.subproduction; this.othermaterial.subproduction = this.subproduction;
createOthermaterial(this.othermaterial).then((res) => { createOthermaterial(this.othermaterial).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getOthermaterialLists() this.getOthermaterialLists();
this.dialogVisibleother = false; this.dialogVisibleother = false;
this.$message.success("成功"); this.$message.success("成功");
} }
@ -1125,9 +1156,9 @@
}); });
}, },
//编辑子工序 //编辑子工序
handleEdit(scope){ handleEdit(scope) {
this.subProcessId = scope.row.id; this.subProcessId = scope.row.id;
this.usedstep = Object.assign({}, scope.row); this.usedstep = Object.assign({}, scope.row);
this.dialogTypes = "edit"; this.dialogTypes = "edit";
this.dialogVisibleusedstep = true; this.dialogVisibleusedstep = true;
}, },
@ -1141,11 +1172,11 @@
}) })
.then(async () => { .then(async () => {
await deleteUsedstep(scope.row.id); await deleteUsedstep(scope.row.id);
this.getUsedstepLists() this.getUsedstepLists();
this.$message.success("成功"); this.$message.success("成功");
}) })
.catch((err) => { .catch((err) => {
console.error(err); this.$message.error(err);
}); });
}, },
@ -1153,11 +1184,11 @@
async usedstepconfirm(form) { async usedstepconfirm(form) {
let that = this; let that = this;
this.usedstep.subproduction = this.subproduction; this.usedstep.subproduction = this.subproduction;
if(that.dialogTypes === 'edit'){ if (that.dialogTypes === 'edit') {
let obj = new Object(); let obj = new Object();
obj.remark =this.usedstep.remark; obj.remark = this.usedstep.remark;
obj.need_test =this.usedstep.need_test; obj.need_test = this.usedstep.need_test;
updateUsedstep(that.subProcessId,obj).then((res) => { updateUsedstep(that.subProcessId, obj).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getUsedstepLists(); this.getUsedstepLists();
this.getMaterial(); this.getMaterial();
@ -1165,7 +1196,7 @@
this.$message.success("成功"); this.$message.success("成功");
} }
}); });
}else{ } else {
createUsedstep(this.usedstep).then((res) => { createUsedstep(this.usedstep).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getUsedstepLists(); this.getUsedstepLists();
@ -1208,11 +1239,11 @@
handleUpSuccess(res, file, filelist) { handleUpSuccess(res, file, filelist) {
this.techdoc.file = res.data.id; this.techdoc.file = res.data.id;
console.log(res.data); // console.log(res.data);
this.techdoc.name = res.data.name; this.techdoc.name = res.data.name;
}, },
handleRemove(file, filelist) { handleRemove() {
this.techdoc.file = null; this.techdoc.file = null;
}, },
@ -1245,7 +1276,7 @@
this.$message.success("成功"); this.$message.success("成功");
}) })
.catch((err) => { .catch((err) => {
console.error(err); this.$message.error(err);
}); });
}, },

View File

@ -3,31 +3,30 @@
<el-card class="box-card"> <el-card class="box-card">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>生产任务列表</span> <span>生产任务列表</span>
<el-input
<el-input v-model="listQuery.search"
v-model="listQuery.search" placeholder="任务编号/订单编号/合同编号/产品名称"
placeholder="任务编号/订单编号/合同编号/产品名称" style="width: 300px"
style="width: 300px" class="filter-item"
class="filter-item" @keyup.enter.native="handleFilter"
@keyup.enter.native="handleFilter" />
/>
<el-button <el-button
class="filter-item" class="filter-item"
type="primary" type="primary"
icon="el-icon-search" icon="el-icon-search"
@click="handleFilter" @click="handleFilter"
>搜索</el-button
> >
搜索
</el-button>
<el-button <el-button
class="filter-item" class="filter-item"
type="primary" type="primary"
icon="el-icon-refresh-left" icon="el-icon-refresh-left"
@click="resetFilter" @click="resetFilter"
>重置</el-button
> >
重置
</el-button>
</div> </div>
<el-table <el-table
:data="productionplanList.results" :data="productionplanList.results"
border border
@ -37,61 +36,54 @@
height="300" height="300"
@row-click="tableRowClick" @row-click="tableRowClick"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50"/>
<el-table-column label="任务编号" prop="number" width="110">
<el-table-column label="任务编号" width="110">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="订单编号" width="110"> <el-table-column label="订单编号" width="110">
<template slot-scope="scope">{{ scope.row.order_.number }}</template> <template slot-scope="scope">{{ scope.row.order_.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="合同编号" width="110"> <el-table-column label="合同编号" width="110">
<template slot-scope="scope" v-if="scope.row.order_">{{ <template slot-scope="scope" v-if="scope.row.order_">
scope.row.order_.contract_.number {{scope.row.order_.contract_.number}}
}}</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="产品名称" width="250">
<el-table-column label="产品名称" width="250" >
<template slot-scope="scope">{{ scope.row.product_.name }}</template> <template slot-scope="scope">{{ scope.row.product_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="产品型号" width="110"> <el-table-column label="产品型号" width="110">
<template slot-scope="scope">{{ <template slot-scope="scope">
scope.row.product_.specification {{scope.row.product_.specification}}
}}</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="产品单位" width="110"> <el-table-column label="产品单位" width="110">
<template slot-scope="scope">{{ scope.row.product_.unit }}</template> <template slot-scope="scope">{{ scope.row.product_.unit }}</template>
</el-table-column> </el-table-column>
<el-table-column label="生产数量" width="110"> <el-table-column label="生产数量" prop="count" width="110">
<template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column> </el-table-column>
<el-table-column label="状态" width="110"> <el-table-column label="状态" width="110">
<template slot-scope="scope">{{ state_[scope.row.state] }}</template> <template slot-scope="scope">{{ state_[scope.row.state] }}</template>
</el-table-column> </el-table-column>
<el-table-column label="计划开工时间" width="110"> <el-table-column label="计划开工时间" prop="start_date" width="110">
<template slot-scope="scope">{{ scope.row.start_date }}</template>
</el-table-column> </el-table-column>
<el-table-column label="计划完工时间" width="110"> <el-table-column label="计划完工时间" prop="end_date" width="110">
<template slot-scope="scope">{{ scope.row.end_date }}</template>
</el-table-column> </el-table-column>
<el-table-column label="交付截止时间" width="110"> <el-table-column label="交付截止时间" width="110">
<template slot-scope="scope">{{ <template slot-scope="scope">
scope.row.order_.delivery_date {{scope.row.order_.delivery_date}}
}}</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
align="center" align="center"
label="操作" label="操作"
fixed="right" fixed="right"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
v-if="scope.row.is_planed&&checkPermission(['testitem_detail'])"
type="primary" type="primary"
v-if="scope.row.is_planed"
@click="handleselectplan(scope)" @click="handleselectplan(scope)"
>详情 >
详情
</el-link> </el-link>
</template> </template>
</el-table-column> </el-table-column>
@ -107,79 +99,157 @@
<el-card class="box-card"> <el-card class="box-card">
<div style="height: 40px;line-height: 40px;background: #F5F7FA;padding-left: 20px;">甘特图</div> <div style="height: 40px;line-height: 40px;background: #F5F7FA;padding-left: 20px;">甘特图</div>
<gantt <gantt
style="position: relative"
v-if="proList.length>0" v-if="proList.length>0"
:proList="proList" :proList="proList"
style="position: relative"
></gantt> ></gantt>
</el-card> </el-card>
</div> </div>
</template> </template>
<script> <script>
import {getPlanGantt} from "@/api/srm"; import {getPlanGantt} from "@/api/srm";
import gantt from "@/components/Gantt/index"; import gantt from "@/components/Gantt/index";
import { getProductionplanList} from "@/api/pm"; import {getProductionplanList} from "@/api/pm";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
export default { export default {
components: { Pagination, gantt }, components: {Pagination, gantt},
data() { data() {
return { return {
productionplanList: { productionplanList: {
count: 0, count: 0,
}, },
listQuery: { listQuery: {
page: 1, page: 1,
page_size: 20, page_size: 20,
}, },
state_:{ state_: {
10: "制定中", 10: "制定中",
20: "已下达", 20: "已下达",
30: "已接受", 30: "已接受",
40: "生产中", 40: "生产中",
50: "已完成", 50: "已完成",
60: "军检完成", 60: "军检完成",
70: "暂停", 70: "暂停",
80: "终止"}, 80: "终止"
listLoading: true, },
proList: [], listLoading: true,
proList: [],
}; };
}, },
computed: {}, computed: {},
watch: {}, watch: {},
created() { created() {
this.getplanList();
},
methods: {
checkPermission,
//搜索生产计划
handleFilter() {
this.listQuery.page = 1;
this.getplanList(); this.getplanList();
}, },
resetFilter() { methods: {
this.listQuery = { checkPermission,
page: 1, //搜索生产计划
page_size: 20, handleFilter() {
} this.listQuery.page = 1;
this.getplanList(); this.getplanList();
}, },
//生产计划列表 resetFilter() {
tableRowClick(row){ this.listQuery = {
let that = this; page: 1,
getPlanGantt({}).then(res=>{ page_size: 20,
if(res.code===200){ }
let arr =[],list=[]; this.getplanList();
let li = res.data.results; },
li.forEach((item)=>{ //生产计划列表
if(item.id===row.id){ tableRowClick(row) {
list.push(item) let that = this;
} getPlanGantt({}).then(res => {
}); if (res.code === 200) {
debugger; let arr = [], list = [];
console.log(list); let li = res.data.results;
list.forEach(item => { li.forEach((item) => {
if (!item.children || item.children.length < 1) { if (item.id === row.id) {
list.push(item)
}
});
// debugger;
// console.log(list);
list.forEach(item => {
if (!item.children || item.children.length < 1) {
let startTime = new Date(item.start_date).getTime();
let endTime = new Date(item.end_date).getTime();
let obj = new Object();
obj.name = item.number;
obj.id = item.id;
obj.top = 20;
obj.startTime = startTime;
obj.endTime = endTime;
obj.planTime = [startTime, endTime];
obj.per = item.count;
obj.type = 1;
obj.productName = item.product_.name;
obj.productNum = item.product_.specification;
obj.isShow = true;
arr.push(obj);
} else if (item.children && item.children.length >= 1) {
let startTime = new Date(item.start_date).getTime();
let endTime = new Date(item.end_date).getTime();
let temp = [];
let parentId = item.id;
let children = item.children;
children.forEach(child => {
let start = new Date(child.start_date).getTime();
let end = new Date(child.end_date).getTime();
let objChild = new Object();
objChild.name = child.number;
objChild.id = child.id;
objChild.top = 50;
objChild.parentId = parentId;
objChild.startTime = start;
objChild.endTime = end;
objChild.planTime = [start, end];
objChild.per = child.count;
objChild.per1 = child.count_real;
objChild.type = 1;
objChild.productName = child.product_.name;
objChild.productNum = child.product_.specification;
objChild.isShow = true;
temp.push(objChild);
});
let obj = new Object();
obj.name = item.number;
obj.id = item.id;
obj.top = 20;
obj.startTime = startTime;
obj.endTime = endTime;
obj.planTime = [startTime, endTime];
obj.per = item.count;
obj.per1 = item.count_real;
obj.type = 3;
obj.productName = item.product_.name;
obj.productNum = item.product_.specification;
obj.children = temp;
obj.isShow = true;
arr.push(obj);
}
that.proList = arr;
// debugger;
// console.log(arr)
});
} else {
that.$message.error(res.msg);
}
})
},
//列表
getplanList() {
let that = this;
this.listLoading = true;
getProductionplanList(this.listQuery).then((response) => {
if (response.data) {
this.productionplanList = response.data;
let list = response.data.results;
let arr = [];
list.forEach((item) => {
// if (!item.children || item.children.length < 1) {
let startTime = new Date(item.start_date).getTime(); let startTime = new Date(item.start_date).getTime();
let endTime = new Date(item.end_date).getTime(); let endTime = new Date(item.end_date).getTime();
let obj = new Object(); let obj = new Object();
@ -195,105 +265,28 @@ export default {
obj.productNum = item.product_.specification; obj.productNum = item.product_.specification;
obj.isShow = true; obj.isShow = true;
arr.push(obj); arr.push(obj);
} else if (item.children && item.children.length >= 1) { // }
let startTime = new Date(item.start_date).getTime(); that.proList = arr;
let endTime = new Date(item.end_date).getTime(); });
let temp =[]; }
let parentId = item.id; this.listLoading = false;
let children = item.children; });
children.forEach(child => { },
let start = new Date(child.start_date).getTime(); //详情
let end = new Date(child.end_date).getTime(); handleselectplan(scope) {
let objChild = new Object(); this.$router.push({name: "plandetails", params: {id: scope.row.id}});
objChild.name = child.number; },
objChild.id = child.id;
objChild.top=50;
objChild.parentId=parentId;
objChild.startTime = start;
objChild.endTime = end;
objChild.planTime = [start,end];
objChild.per = child.count;
objChild.per1 = child.count_real;
objChild.type = 1;
objChild.productName = child.product_.name;
objChild.productNum = child.product_.specification;
objChild.isShow= true;
temp.push(objChild);
});
let obj=new Object();
obj.name=item.number;
obj.id=item.id;
obj.top=20;
obj.startTime=startTime;
obj.endTime=endTime;
obj.planTime = [startTime,endTime];
obj.per=item.count;
obj.per1=item.count_real;
obj.type=3;
obj.productName = item.product_.name;
obj.productNum = item.product_.specification;
obj.children = temp;
obj.isShow= true;
arr.push(obj);
}
that.proList = arr;
debugger;
console.log(arr)
});
}else{
that.$message.error(res.msg);
}
})
}, },
//列表 };
getplanList() {
let that = this;
this.listLoading = true;
getProductionplanList(this.listQuery).then((response) => {
if (response.data) {
this.productionplanList = response.data;
let list = response.data.results;
let arr = [];
list.forEach((item) => {
// if (!item.children || item.children.length < 1) {
let startTime = new Date(item.start_date).getTime();
let endTime = new Date(item.end_date).getTime();
let obj = new Object();
obj.name = item.number;
obj.id = item.id;
obj.top = 20;
obj.startTime = startTime;
obj.endTime = endTime;
obj.planTime = [startTime, endTime];
obj.per = item.count;
obj.type = 1;
obj.productName = item.product_.name;
obj.productNum = item.product_.specification;
obj.isShow = true;
arr.push(obj);
// }
that.proList = arr;
});
}
this.listLoading = false;
});
},
//详情
handleselectplan(scope){
this.$router.push({ name: "plandetails", params: { id: scope.row.id } });
},
},
};
</script> </script>
//样式文件 //样式文件
<style> <style>
.el-table .warning-row { .el-table .warning-row {
background: oldlace; background: oldlace;
} }
.el-table .success-row { .el-table .success-row {
background: #f0f9eb; background: #f0f9eb;
} }
</style> </style>

View File

@ -16,14 +16,16 @@
type="primary" type="primary"
icon="el-icon-search" icon="el-icon-search"
@click="handleFilter" @click="handleFilter"
>搜索 >
搜索
</el-button> </el-button>
<el-button <el-button
class="filter-item" class="filter-item"
type="primary" type="primary"
icon="el-icon-refresh-left" icon="el-icon-refresh-left"
@click="resetFilter" @click="resetFilter"
>重置 >
重置
</el-button> </el-button>
<el-table <el-table
:data="productionplanList.results" :data="productionplanList.results"
@ -33,55 +35,49 @@
style="width: 100%" style="width: 100%"
height="300" height="300"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50"/>
<el-table-column label="任务编号" width="110"> <el-table-column label="任务编号" prop="number" width="110">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="订单编号" width="110"> <el-table-column label="订单编号" width="110">
<template slot-scope="scope">{{ scope.row.order_.number }}</template> <template slot-scope="scope">{{ scope.row.order_.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="合同编号" width="110"> <el-table-column label="合同编号" width="110">
<template slot-scope="scope" v-if="scope.row.contract">{{ <template slot-scope="scope" v-if="scope.row.contract">
scope.row.order_.contract_.number {{scope.row.order_.contract_.number }}
}}</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="产品名称" width="150" show-overflow-tooltip> <el-table-column label="产品名称" width="150" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.product_.name }}</template> <template slot-scope="scope">{{ scope.row.product_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="产品型号" width="110"> <el-table-column label="产品型号" width="110">
<template slot-scope="scope">{{ <template slot-scope="scope">
scope.row.product_.specification {{scope.row.product_.specification}}
}}</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="产品单位" width="110"> <el-table-column label="产品单位" width="110">
<template slot-scope="scope">{{ scope.row.product_.unit }}</template> <template slot-scope="scope">{{ scope.row.product_.unit }}</template>
</el-table-column> </el-table-column>
<el-table-column label="生产数量" width="110"> <el-table-column label="生产数量" prop="count" width="110">
<template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column> </el-table-column>
<el-table-column label="状态" width="110"> <el-table-column label="状态" width="110">
<template slot-scope="scope">{{ state_[scope.row.state] }}</template> <template slot-scope="scope">{{ state_[scope.row.state] }}</template>
</el-table-column> </el-table-column>
<el-table-column label="计划开工时间" width="110"> <el-table-column label="计划开工时间" prop="start_date" width="110">
<template slot-scope="scope">{{ scope.row.start_date }}</template>
</el-table-column> </el-table-column>
<el-table-column label="计划完工时间" width="110"> <el-table-column label="计划完工时间" prop="end_date" width="110">
<template slot-scope="scope">{{ scope.row.end_date }}</template>
</el-table-column> </el-table-column>
<el-table-column label="交货日期" width="110"> <el-table-column label="交货日期" width="110">
<template slot-scope="scope">{{ <template slot-scope="scope">
scope.row.order_.delivery_date {{scope.row.order_.delivery_date}}
}}</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="是否生成子计划" width="120"> <el-table-column label="是否生成子计划" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.is_planed == false"></el-tag> <el-tag v-if="scope.row.is_planed == false"></el-tag>
<el-tag v-if="scope.row.is_planed == true"></el-tag> <el-tag v-if="scope.row.is_planed == true"></el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" width="160"> <el-table-column label="创建时间" prop="create_time" width="160">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
align="center" align="center"
@ -90,31 +86,40 @@
width="150px" width="150px"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link type="warning" <el-link
v-if="scope.row.state != 70" v-if="checkPermission(['plan_toggle'])&&scope.row.state !== 70"
@click="handlestatesuspended(scope)" type="warning"
>暂停 @click="handlestatesuspended(scope)"
>
暂停
</el-link> </el-link>
<el-link <el-link
v-if="checkPermission(['plan_toggle'])&&scope.row.state === 70"
type="primary" type="primary"
v-if="scope.row.state == 70"
@click="handlestate(scope)" @click="handlestate(scope)"
>启用 >
启用
</el-link> </el-link>
<el-link <el-link
type="danger" v-if="checkPermission(['plan_stop'])&&scope.row.state === 70"
v-if="scope.row.state == 70" type="danger"
@click="handlestatestop(scope)" @click="handlestatestop(scope)"
>终止 >
终止
</el-link> </el-link>
<el-link <el-link
v-if="checkPermission(['plan_subcreate'])&&scope.row.is_planed"
type="primary" type="primary"
v-if="scope.row.is_planed"
@click="handleselectplan(scope)" @click="handleselectplan(scope)"
>查看子计划 >
查看子计划
</el-link> </el-link>
<el-link type="primary" v-else @click="handleWork(scope)" <el-link
>生成子计划 v-if="checkPermission(['plan_subcreate'])&&!scope.row.is_planed"
type="primary"
@click="handleWork(scope)"
>
生成子计划
</el-link> </el-link>
</template> </template>
</el-table-column> </el-table-column>
@ -161,7 +166,8 @@
<el-table-column label="产品型号" width="110"> <el-table-column label="产品型号" width="110">
<template slot-scope="scope">{{ <template slot-scope="scope">{{
scope.row.product_.specification scope.row.product_.specification
}}</template> }}
</template>
</el-table-column> </el-table-column>
<el-table-column label="产品数量"> <el-table-column label="产品数量">
<template slot-scope="scope">{{ scope.row.count }}</template> <template slot-scope="scope">{{ scope.row.count }}</template>
@ -182,10 +188,12 @@
width="80px" width="80px"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link type="primary" <el-link
v-if="checkPermission(['warehouse_update'])" v-if="checkPermission(['plan_create'])"
@click="handleclick(scope)" type="primary"
>排产 @click="handleclick(scope)"
>
排产
</el-link> </el-link>
</template> </template>
</el-table-column> </el-table-column>
@ -229,10 +237,18 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="text-align: right"> <div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false" <el-button
>取消</el-button type="danger"
@click="dialogVisible = false"
> >
<el-button type="primary" @click="confirm('Form')">确认</el-button> 取消
</el-button>
<el-button
type="primary"
@click="confirm('Form')"
>
确认
</el-button>
</div> </div>
</el-dialog> </el-dialog>
</el-tab-pane> </el-tab-pane>
@ -243,264 +259,264 @@
</div> </div>
</template> </template>
<script> <script>
import gantt from "@/components/Gantt/index"; import gantt from "@/components/Gantt/index";
import { getordertoplan } from "@/api/sam"; import {getordertoplan} from "@/api/sam";
import { import {
createProductionplan, createProductionplan,
getProductionplanList, getProductionplanList,
createsubplan, createsubplan,
plantoggle, plantoggle,
planstop planstop
} from "@/api/pm"; } from "@/api/pm";
import { getMaterialList } from "@/api/mtm"; import {getMaterialList} from "@/api/mtm";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import { genTree } from "@/utils"; import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaulteorderplan = {}; const defaulteorderplan = {};
export default { export default {
components: { Pagination, gantt }, components: {Pagination, gantt},
data() { data() {
return { return {
orderplan: defaulteorderplan, orderplan: defaulteorderplan,
orderList: { orderList: {
count: 0, count: 0,
}, },
state_: { state_: {
10: "制定中", 10: "制定中",
20: "已下达", 20: "已下达",
30: "已接受", 30: "已接受",
40: "生产中", 40: "生产中",
50: "已完成", 50: "已完成",
60: "军检完成", 60: "军检完成",
70: "暂停", 70: "暂停",
80: "终止", 80: "终止",
}, },
listQuery: { listQuery: {
page: 1, page: 1,
page_size: 20, page_size: 20,
}, },
productionplanList: { productionplanList: {
count: 0, count: 0,
}, },
listQuery1: { listQuery1: {
page: 1, page: 1,
page_size: 20, page_size: 20,
}, },
value1: "", value1: "",
listLoading: true, listLoading: true,
dialogVisiblestate: false, dialogVisiblestate: false,
ganttShow: false, ganttShow: false,
dialogVisible: false, dialogVisible: false,
dialogType: "new", dialogType: "new",
activeName: "订单排产", activeName: "订单排产",
rule1: { rule1: {
number: [{ required: true, message: "请输入", trigger: "blur" }], number: [{required: true, message: "请输入", trigger: "blur"}],
}, },
proList: [], proList: [],
};
},
computed: {},
watch: {},
created() {
this.getorderList();
this.getplanList();
},
methods: {
checkPermission,
//订单列表
getorderList() {
this.listLoading = true;
getordertoplan(this.listQuery).then((response) => {
if (response.data) {
this.orderList = response.data;
}
this.listLoading = false;
});
},
//生产计划列表
//列表
getplanList() {
let that = this;
this.listLoading = true;
getProductionplanList(this.listQuery1).then((response) => {
if (response.data) {
this.productionplanList = response.data;
let list = response.data.results;
let arr = [];
list.forEach((item) => {
if (!item.children || item.children.length < 1) {
let startTime = new Date(item.start_date).getTime();
let endTime = new Date(item.end_date).getTime();
let obj = new Object();
obj.name = item.number;
obj.id = item.id;
obj.top = 20;
obj.startTime = startTime;
obj.endTime = endTime;
obj.planTime = [startTime, endTime];
obj.per = item.count;
obj.type = 1;
obj.productName = item.product_.name;
obj.productNum = item.product_.specification;
obj.isShow = true;
arr.push(obj);
}
that.proList = arr;
});
}
this.listLoading = false;
});
},
//修改任务状态设置暂停
handlestatesuspended(scope) {
this.$confirm("确认暂停任务?", "提醒", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await plantoggle(scope.row.id).then((res) => {
if (res.code >= 200) {
this.$message.success("任务暂停成功!");
this.getplanList();
}
});
})
.catch((err) => {
console.error(err);
});
},
//修改任务状态设置启动
handlestate(scope) {
this.$confirm("确认启动任务?", "提醒", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await plantoggle(scope.row.id).then((res) => {
if (res.code >= 200) {
this.$message.success("任务启动成功!");
this.getplanList();
}
});
})
.catch((err) => {
console.error(err);
});
},
//修改任务状态设置终止
handlestatestop(scope) {
this.$confirm("确认终止任务?", "提醒", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await planstop(scope.row.id).then((res) => {
if (res.code >= 200) {
this.$message.success("任务终止成功!");
this.getplanList();
}
});
})
.catch((err) => {
console.error(err);
});
},
//搜索生产计划
handleFilter() {
this.listQuery1.page = 1;
this.getplanList();
},
resetFilter() {
this.listQuery1 = {
page: 1,
page_size: 20,
}; };
},
computed: {},
watch: {},
created() {
this.getorderList();
this.getplanList(); this.getplanList();
}, },
handleclick(scope) { methods: {
this.orderID = scope.row.id; checkPermission,
this.countsx = scope.row.count;
this.planed_count = scope.row.planed_count;
this.delivery_date = scope.row.delivery_date;
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].resetFields();
this.value1 = "";
});
},
async confirm(form) {
this.orderplan.start_date = this.value1[0];
if (this.delivery_date >= this.value1[1]) { //订单列表
this.orderplan.end_date = this.value1[1]; getorderList() {
} else { this.listLoading = true;
this.$message.error("计划完成时间超过订单交付日期,请从新选择日期!"); getordertoplan(this.listQuery).then((response) => {
} if (response.data) {
this.orderList = response.data;
this.orderplan.order = this.orderID;
if (this.orderplan.count <= this.countsx - this.planed_count) {
createProductionplan(this.orderplan).then((res) => {
if (res.code >= 200) {
this.getorderList();
this.getplanList();
this.dialogVisible = false;
this.$message.success("成功");
} }
this.listLoading = false;
}); });
} else { },
this.$message.error("排产数超过所需数,请合理排产!"); //生产计划列表
} //列表
}, getplanList() {
handleWork(scope) { let that = this;
this.$confirm("确认生成子计划?", "提醒", { this.listLoading = true;
confirmButtonText: "确认", getProductionplanList(this.listQuery1).then((response) => {
cancelButtonText: "取消", if (response.data) {
type: "error", this.productionplanList = response.data;
}) let list = response.data.results;
.then(async () => { let arr = [];
await createsubplan(scope.row.id).then((res) => { list.forEach((item) => {
if (!item.children || item.children.length < 1) {
let startTime = new Date(item.start_date).getTime();
let endTime = new Date(item.end_date).getTime();
let obj = new Object();
obj.name = item.number;
obj.id = item.id;
obj.top = 20;
obj.startTime = startTime;
obj.endTime = endTime;
obj.planTime = [startTime, endTime];
obj.per = item.count;
obj.type = 1;
obj.productName = item.product_.name;
obj.productNum = item.product_.specification;
obj.isShow = true;
arr.push(obj);
}
that.proList = arr;
});
}
this.listLoading = false;
});
},
//修改任务状态设置暂停
handlestatesuspended(scope) {
this.$confirm("确认暂停任务?", "提醒", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await plantoggle(scope.row.id).then((res) => {
if (res.code >= 200) {
this.$message.success("任务暂停成功!");
this.getplanList();
}
});
})
.catch((err) => {
console.error(err);
});
},
//修改任务状态设置启动
handlestate(scope) {
this.$confirm("确认启动任务?", "提醒", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await plantoggle(scope.row.id).then((res) => {
if (res.code >= 200) {
this.$message.success("任务启动成功!");
this.getplanList();
}
});
})
.catch((err) => {
console.error(err);
});
},
//修改任务状态设置终止
handlestatestop(scope) {
this.$confirm("确认终止任务?", "提醒", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await planstop(scope.row.id).then((res) => {
if (res.code >= 200) {
this.$message.success("任务终止成功!");
this.getplanList();
}
});
})
.catch((err) => {
console.error(err);
});
},
//搜索生产计划
handleFilter() {
this.listQuery1.page = 1;
this.getplanList();
},
resetFilter() {
this.listQuery1 = {
page: 1,
page_size: 20,
};
this.getplanList();
},
handleclick(scope) {
this.orderID = scope.row.id;
this.countsx = scope.row.count;
this.planed_count = scope.row.planed_count;
this.delivery_date = scope.row.delivery_date;
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].resetFields();
this.value1 = "";
});
},
async confirm(form) {
this.orderplan.start_date = this.value1[0];
if (this.delivery_date >= this.value1[1]) {
this.orderplan.end_date = this.value1[1];
} else {
this.$message.error("计划完成时间超过订单交付日期,请从新选择日期!");
}
this.orderplan.order = this.orderID;
if (this.orderplan.count <= this.countsx - this.planed_count) {
createProductionplan(this.orderplan).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.$message.success("生成子计划成功!"); this.getorderList();
this.$router.push({ name: "work", params: { id: scope.row.id } });
this.getplanList(); this.getplanList();
this.dialogVisible = false;
this.$message.success("成功");
} }
}); });
} else {
this.$message.error("排产数超过所需数,请合理排产!");
}
},
handleWork(scope) {
this.$confirm("确认生成子计划?", "提醒", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
}) })
.catch((err) => { .then(async () => {
console.error(err); await createsubplan(scope.row.id).then((res) => {
}); if (res.code >= 200) {
this.$message.success("生成子计划成功!");
this.$router.push({name: "work", params: {id: scope.row.id}});
this.getplanList();
}
});
})
.catch((err) => {
console.error(err);
});
},
activeNameClick(tab, event) {
debugger;
console.log(tab, event);
if (tab.label === "甘特图") {
this.ganttShow = true;
} else {
this.ganttShow = false;
}
},
//查看子计划
handleselectplan(scope) {
this.$router.push({name: "work", params: {id: scope.row.id}});
},
}, },
activeNameClick(tab, event) { };
debugger;
console.log(tab, event);
if (tab.label === "甘特图") {
this.ganttShow = true;
} else {
this.ganttShow = false;
}
},
//查看子计划
handleselectplan(scope) {
this.$router.push({ name: "work", params: { id: scope.row.id } });
},
},
};
</script> </script>
<style> <style>
.el-table .warning-row { .el-table .warning-row {
background: oldlace; background: oldlace;
} }
.el-table .success-row { .el-table .success-row {
background: #f0f9eb; background: #f0f9eb;
} }
</style> </style>

View File

@ -6,10 +6,16 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>合同订单列表</span> <span>合同订单列表</span>
</div> </div>
<el-button type="primary" @click="handlecount">计算物料</el-button> <el-button
v-if="checkPermission(['resource_cal'])"
type="primary"
@click="handlecount"
>
计算物料
</el-button>
<el-table <el-table
:data="orderList.results"
ref="multipleTable" ref="multipleTable"
:data="orderList.results"
border border
fit fit
stripe stripe
@ -17,7 +23,7 @@
height="100" height="100"
v-el-height-adaptive-table="{ bottomOffset: 25 }" v-el-height-adaptive-table="{ bottomOffset: 25 }"
> >
<el-table-column type="selection" width="55"> </el-table-column> <el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="订单编号" width="110"> <el-table-column label="订单编号" width="110">
<template slot-scope="scope">{{ scope.row.number }}</template> <template slot-scope="scope">{{ scope.row.number }}</template>
@ -26,7 +32,8 @@
<el-table-column label="所需产品" show-overflow-tooltip width="150"> <el-table-column label="所需产品" show-overflow-tooltip width="150">
<template slot-scope="scope">{{ <template slot-scope="scope">{{
scope.row.product_.name scope.row.product_.name
}}</template> }}
</template>
</el-table-column> </el-table-column>
<el-table-column label="产品数量"> <el-table-column label="产品数量">
@ -35,38 +42,45 @@
<el-table-column label="已派数量"> <el-table-column label="已派数量">
<template slot-scope="scope">{{ <template slot-scope="scope">{{
scope.row.planed_count scope.row.planed_count
}}</template> }}
</template>
</el-table-column> </el-table-column>
<el-table-column label="产品型号"> <el-table-column label="产品型号">
<template slot-scope="scope">{{ <template slot-scope="scope">{{
scope.row.product_.specification scope.row.product_.specification
}}</template> }}
</template>
</el-table-column> </el-table-column>
<el-table-column label="客户名称" show-overflow-tooltip width="150"> <el-table-column label="客户名称" show-overflow-tooltip width="150">
<template slot-scope="scope">{{ <template slot-scope="scope">{{
scope.row.customer_.name scope.row.customer_.name
}}</template> }}
</template>
</el-table-column> </el-table-column>
<el-table-column label="合同编号" show-overflow-tooltip width="150"> <el-table-column label="合同编号" show-overflow-tooltip width="150">
<template slot-scope="scope" v-if=" scope.row.contract_">{{ <template slot-scope="scope" v-if=" scope.row.contract_">{{
scope.row.contract_.number scope.row.contract_.number
}}</template> }}
</template>
</el-table-column> </el-table-column>
<el-table-column label="合同名称" show-overflow-tooltip width="150"> <el-table-column label="合同名称" show-overflow-tooltip width="150">
<template slot-scope="scope" v-if=" scope.row.contract_">{{ <template slot-scope="scope" v-if=" scope.row.contract_">{{
scope.row.contract_.name scope.row.contract_.name
}}</template> }}
</template>
</el-table-column> </el-table-column>
<el-table-column label="交货日期" width="110"> <el-table-column label="交货日期" width="110">
<template slot-scope="scope">{{ <template slot-scope="scope">{{
scope.row.delivery_date scope.row.delivery_date
}}</template> }}
</template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" width="110"> <el-table-column label="创建时间" width="110">
<template slot-scope="scope">{{ <template slot-scope="scope">{{
scope.row.create_time scope.row.create_time
}}</template> }}
</template>
</el-table-column> </el-table-column>
<el-table-column label="计划生产数" width="150px" fixed="right"> <el-table-column label="计划生产数" width="150px" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
@ -99,12 +113,13 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>物料配置</span> <span>物料配置</span>
<el-button <el-button
v-if="butshow&&checkPermission(['resource_cal'])"
type="primary"
style="float: right; " style="float: right; "
@click="handlebcpcount" @click="handlebcpcount"
type="primary"
v-if="butshow"
>半成品折合</el-button
> >
半成品折合
</el-button>
</div> </div>
<el-table <el-table
:data="materialpzTable" :data="materialpzTable"
@ -115,16 +130,16 @@
height="330" height="330"
ref="multipleTables" ref="multipleTables"
> >
<el-table-column type="selection" width="55"> </el-table-column> <el-table-column type="selection" width="55"></el-table-column>
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50"/>
<el-table-column label="物料名称"> <el-table-column label="物料名称">
<template slot-scope="scope">{{ scope.row.name }}</template> <template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="物料类型"> <el-table-column label="物料类型">
<template slot-scope="scope"> <template slot-scope="scope">
{{ options_[scope.row.type] }}</template {{ options_[scope.row.type] }}
> </template>
</el-table-column> </el-table-column>
<el-table-column label="物料编号"> <el-table-column label="物料编号">
<template slot-scope="scope">{{ scope.row.number }}</template> <template slot-scope="scope">{{ scope.row.number }}</template>
@ -142,30 +157,26 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div v-else>{{ scope.row.count }}</div></template <div v-else>{{ scope.row.count }}</div>
> </template>
</el-table-column> </el-table-column>
<el-table-column label="剩余量"> <el-table-column label="剩余量">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag <el-tag
v-if=" v-if="scope.row.count_safe != null &&scope.row.count_safe >scope.row.inv_count - scope.row.count"
scope.row.count_safe != null &&
scope.row.count_safe >
scope.row.inv_count - scope.row.count
"
type="danger" type="danger"
> >
{{ scope.row.inv_count - scope.row.count }}</el-tag {{ scope.row.inv_count - scope.row.count }}
> </el-tag>
<el-tag v-else> <el-tag v-else>
{{ scope.row.inv_count - scope.row.count }}</el-tag {{ scope.row.inv_count - scope.row.count }}
> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="安全库存"> <el-table-column label="安全库存">
<template slot-scope="scope">{{ <template slot-scope="scope">
scope.row.count_safe {{scope.row.count_safe }}
}}</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-card> </el-card>
@ -185,41 +196,41 @@
style="width: 100%" style="width: 100%"
height="280" height="280"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50"/>
<el-table-column label="设备名称"> <el-table-column label="设备名称">
<template slot-scope="scope">{{ scope.row.name }}</template> <template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="设备状态"> <el-table-column label="设备状态">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="scope.row.type===2"> <div v-if="scope.row.type===2">
<el-tag v-if="scope.row.state===40" type="danger"> <el-tag v-if="scope.row.state===40" type="danger">
禁用 禁用
</el-tag> </el-tag>
<el-tag v-else type="success"> <el-tag v-else type="success">
合格 合格
</el-tag> </el-tag>
</div> </div>
<div v-else> <div v-else>
<el-tag v-if="scope.row.state===10" type="success"> <el-tag v-if="scope.row.state===10" type="success">
{{ state_[scope.row.state] }} {{ state_[scope.row.state] }}
</el-tag> </el-tag>
<el-tag v-else-if="scope.row.state===20"> <el-tag v-else-if="scope.row.state===20">
{{ state_[scope.row.state] }} {{ state_[scope.row.state] }}
</el-tag> </el-tag>
<el-tag v-else-if="scope.row.state===30" type="warning"> <el-tag v-else-if="scope.row.state===30" type="warning">
{{ state_[scope.row.state] }} {{ state_[scope.row.state] }}
</el-tag> </el-tag>
<el-tag v-else type="danger"> <el-tag v-else type="danger">
{{ state_[scope.row.state] }} {{ state_[scope.row.state] }}
</el-tag> </el-tag>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="设备编号"> <el-table-column label="设备编号">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.number }}</template {{ scope.row.number }}
> </template>
</el-table-column> </el-table-column>
<el-table-column label="设备型号"> <el-table-column label="设备型号">
<template slot-scope="scope"> {{ scope.row.model }}</template> <template slot-scope="scope"> {{ scope.row.model }}</template>
@ -239,152 +250,152 @@
</el-row> </el-row>
</div> </div>
</template> </template>
<script> <script>
import { getordertoplan } from "@/api/sam"; import {getordertoplan} from "@/api/sam";
import { import {
createProductionplan, createProductionplan,
createConvert, createConvert,
createresource, createresource,
createequip, createequip,
} from "@/api/pm"; } from "@/api/pm";
import { getMaterialList } from "@/api/mtm"; import {getMaterialList} from "@/api/mtm";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import { genTree } from "@/utils"; import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaulteorderplan = {}; const defaulteorderplan = {};
export default { export default {
components: { Pagination }, components: {Pagination},
data() { data() {
return { return {
orderplan: defaulteorderplan, orderplan: defaulteorderplan,
orderList: { orderList: {
count: 0, count: 0,
}, },
options_: { options_: {
1: "成品", 1: "成品",
2: "半成品", 2: "半成品",
3: "主要原料", 3: "主要原料",
4: "辅助原料", 4: "辅助原料",
5: "加工工具", 5: "加工工具",
6: "辅助工具", 6: "辅助工具",
}, },
state_: { state_: {
10: "完好", 10: "完好",
20: "限用", 20: "限用",
30: "在修", 30: "在修",
40: "禁用", 40: "禁用",
}, },
listQuery: { listQuery: {
page: 1, page: 1,
page_size: 20, page_size: 20,
}, },
materialpzTable: [], materialpzTable: [],
mutipID: [], mutipID: [],
bcpID: [], bcpID: [],
equipmentTable: [], equipmentTable: [],
listLoading: true, listLoading: true,
dialogVisible: false, dialogVisible: false,
dialogType: "new", dialogType: "new",
zhbcp: [], zhbcp: [],
rule1: { rule1: {
number: [{ required: true, message: "请输入", trigger: "blur" }], number: [{required: true, message: "请输入", trigger: "blur"}],
}, },
butshow:true, butshow: true,
}; };
},
computed: {},
watch: {},
created() {
this.getorderList();
},
methods: {
checkPermission,
//订单列表
getorderList() {
this.listLoading = true;
getordertoplan(this.listQuery).then((response) => {
if (response.data) {
this.orderList = response.data;
}
this.listLoading = false;
});
}, },
computed: {},
//物料计算 watch: {},
handlecount() { created() {
let _this = this; this.getorderList();
this.butshow=true;
_this.mutipID = [];
this.$refs.multipleTable.selection.forEach((item) => {
_this.mutipID.push({
id: item.product_.id,
count: item.pgcount,
});
});
createresource(this.mutipID).then((res) => {
if (res.code >= 200) {
this.materialpzTable = res.data;
this.$message.success("物料计算成功");
}
});
createequip(this.mutipID).then((res) => {
if (res.code >= 200) {
this.equipmentTable = res.data;
this.$message.success("成功");
}
});
}, },
methods: {
//半成品折合物料 checkPermission,
handlebcpcount() { //订单列表
let _this = this; getorderList() {
_this.bcpID = []; this.listLoading = true;
this.$refs.multipleTables.selection.forEach((item) => { getordertoplan(this.listQuery).then((response) => {
_this.bcpID.push({ if (response.data) {
id: item.id, this.orderList = response.data;
count: item.bcpcount, }
this.listLoading = false;
}); });
}); },
createConvert(this.bcpID).then((res) => { //物料计算
if (res.code >= 200) { handlecount() {
this.materialpzTable.forEach((items) => { let _this = this;
res.data.forEach((item) => { this.butshow = true;
if (item.id == items.id) { _this.mutipID = [];
items.count = items.count - item.count; this.$refs.multipleTable.selection.forEach((item) => {
} _this.mutipID.push({
}); id: item.product_.id,
count: item.pgcount,
}); });
});
console.log(this.materialpzTable); createresource(this.mutipID).then((res) => {
this.butshow=false; if (res.code >= 200) {
} this.materialpzTable = res.data;
}); this.$message.success("物料计算成功");
}, }
});
createequip(this.mutipID).then((res) => {
if (res.code >= 200) {
this.equipmentTable = res.data;
this.$message.success("成功");
}
});
},
handleclick(scope) { //半成品折合物料
this.orderID = scope.row.id; handlebcpcount() {
let _this = this;
_this.bcpID = [];
this.$refs.multipleTables.selection.forEach((item) => {
_this.bcpID.push({
id: item.id,
count: item.bcpcount,
});
});
this.dialogVisible = true; createConvert(this.bcpID).then((res) => {
this.$nextTick(() => { if (res.code >= 200) {
this.$refs["Form"].clearValidate(); this.materialpzTable.forEach((items) => {
}); res.data.forEach((item) => {
if (item.id == items.id) {
items.count = items.count - item.count;
}
});
});
console.log(this.materialpzTable);
this.butshow = false;
}
});
},
handleclick(scope) {
this.orderID = scope.row.id;
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
async confirm(form) {
this.orderplan.start_date = this.value1[0];
this.orderplan.end_date = this.value1[1];
this.orderplan.order = this.orderID;
createProductionplan(this.orderplan).then((res) => {
if (res.code >= 200) {
this.getorderList();
this.getplanList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
},
}, },
async confirm(form) { };
this.orderplan.start_date = this.value1[0]; </script>
this.orderplan.end_date = this.value1[1];
this.orderplan.order = this.orderID;
createProductionplan(this.orderplan).then((res) => {
if (res.code >= 200) {
this.getorderList();
this.getplanList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
},
},
};
</script>