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">
<el-card>
<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-input
@ -85,7 +85,7 @@
>检查表
</el-link>
<el-link
v-if="checkPermission(['material_update'])"
subproduction_delete
type="primary"
@click="handleEdit(scope)"
>编辑

View File

@ -2,7 +2,7 @@
<div class="app-container">
<el-card>
<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>
</div>
@ -46,6 +46,7 @@
>
<template slot-scope="scope">
<el-link
v-if="checkPermission(['process_update'])"
type="primary"
@click="handleAdd(scope)"
>

View File

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

View File

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

View File

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

View File

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