线体管理修改

yangwl
shaoyong 6 months ago
parent 42b692e7b2
commit 16c86f1a37

@ -43,10 +43,18 @@ export function delMesLine(id) {
}); });
} }
//线体获取 //线体获取
export function getLineBodyList(query) { export function selectLineBody(query) {
return request({ return request({
url: '/mes/mesLine/selectLineBody', url: '/mes/mesLine/selectLineBody',
method: 'get', method: 'get',
params: query params: query
}); });
} }
export function getProductListBom(query) {
return request({
url: '/mes/mesLine/getProductListBom',
method: 'get',
params: query
});
}

@ -63,7 +63,7 @@
plain plain
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAddLineBody" @click="handleAdd"
v-hasPermi="['mes:mesLine:add']" v-hasPermi="['mes:mesLine:add']"
>新增 >新增
</el-button> </el-button>
@ -120,6 +120,7 @@
<el-table-column label="线体名称" align="center" prop="lineName" /> <el-table-column label="线体名称" align="center" prop="lineName" />
<el-table-column label="标准用人" align="center" prop="useMan" /> <el-table-column label="标准用人" align="center" prop="useMan" />
<el-table-column label="标准效率" align="center" prop="efficiency" /> <el-table-column label="标准效率" align="center" prop="efficiency" />
<el-table-column label="产品列表" align="center" prop="productList" :formatter="formatProductNames" :show-overflow-tooltip="true"/>
<el-table-column label="检验工具" align="center" prop="attr1" /> <el-table-column label="检验工具" align="center" prop="attr1" />
<el-table-column <el-table-column
label="操作" label="操作"
@ -155,9 +156,24 @@
@pagination="getList" @pagination="getList"
/> />
<!-- 添加修改线体管理对话框 --> <!-- 添加/修改线体管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="90px"> <el-form ref="form" :model="form" :rules="rules" label-width="90px">
<el-row :gutter="10">
<el-col :span="8">
<el-form-item label="线体选择" prop="lineCode">
<el-select v-model="form.lineCode" placeholder="请选择检验类型" @change="selectChange(form.lineCode)" clearable style="width: 100%;">
<el-option
v-for="item in lineBodys"
:key="item.lineCode"
:label="item.lineName"
:value="item.lineCode"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="标准用人" prop="useMan"> <el-form-item label="标准用人" prop="useMan">
@ -190,6 +206,38 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleSelectProduct"
v-hasPermi="['mes:mesLine:add']"
>选择产品
</el-button>
</el-col>
</el-row>
<el-table v-loading="proloading" :data="form.productList" @selection-change="productSelectionChange" ref="myTable" >
<!-- 序号 -->
<el-table-column type="index" width="90" align="center" label="序号" />
<el-table-column label="产品编码" align="center" prop="productCode" />
<el-table-column label="产品名称" align="center" prop="productName" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="deleteProduct(scope.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
@ -197,8 +245,10 @@
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<SelectMesLine ref="selectMesLine" @onSelected="onSelectLineBody"> <ItemSelectMaterial
</SelectMesLine> ref="itemSelectMaterial"
@onSelected="onSelectMaterial"
></ItemSelectMaterial>
</div> </div>
</template> </template>
@ -209,18 +259,21 @@ import {
delMesLine, delMesLine,
addMesLine, addMesLine,
updateMesLine, updateMesLine,
selectLineBody
} from "@/api/mes/mesLine"; } from "@/api/mes/mesLine";
import SelectMesLine from "./selectMesLine"; import ItemSelectMaterial from "@/views/mes/mesLine/selectMaterial";
export default { export default {
name: "MesLine", name: "MesLine",
components: {SelectMesLine,}, components: {ItemSelectMaterial,},
data() { data() {
return { return {
// //
loading: true, loading: true,
proloading: false,
// //
ids: [], ids: [],
codes: [],
// //
single: true, single: true,
// //
@ -229,6 +282,7 @@ export default {
showSearch: true, showSearch: true,
// //
total: 0, total: 0,
lineBodys: [],
// 线 // 线
mesLineList: [], mesLineList: [],
// //
@ -269,6 +323,7 @@ export default {
}, },
created() { created() {
this.getList(); this.getList();
this.getLineBody();
}, },
methods: { methods: {
/** 查询线体管理列表 */ /** 查询线体管理列表 */
@ -280,6 +335,14 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
getLineBody() {
selectLineBody(this.queryParams).then((response) => {
this.lineBodys = response.rows;
});
},
selectChange(lineCode) {
this.form.lineName = this.lineBodys.find(item => item.lineCode === lineCode).lineName;
},
// //
cancel() { cancel() {
this.open = false; this.open = false;
@ -291,6 +354,7 @@ export default {
id: null, id: null,
lineCode: null, lineCode: null,
lineName: null, lineName: null,
productList: [],
useMan: null, useMan: null,
efficiency: null, efficiency: null,
attr1: null, attr1: null,
@ -332,6 +396,10 @@ export default {
this.single = selection.length !== 1; this.single = selection.length !== 1;
this.multiple = !selection.length; this.multiple = !selection.length;
}, },
//
productSelectionChange(selection) {
this.codes = selection.map((item) => item.productCode);
},
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
@ -360,13 +428,16 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate((valid) => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (this.form.id != null) { this.form.processList = [];
this.form.processItems?.forEach(item => { this.form.qualityList = [];
this.form.processList.push(item.value); this.form.processItems?.forEach((item,index) => {
this.form.qualityList.push(item.quality); this.form.processList[index] = item.value;
this.form.qualityList[index] = item.quality;
}); });
if (this.form.id != null) {
updateMesLine(this.form).then((response) => { updateMesLine(this.form).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
@ -374,6 +445,11 @@ export default {
}); });
} else { } else {
addMesLine(this.form).then((response) => { addMesLine(this.form).then((response) => {
if(response.code == 200) {
this.$modal.msgSuccess("添加成功");
}else {
this.$modal.msgError(response.msg);
}
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
@ -405,21 +481,39 @@ export default {
`mesLine_${new Date().getTime()}.xlsx` `mesLine_${new Date().getTime()}.xlsx`
); );
}, },
handleAddLineBody() { //
this.$refs.selectMesLine.showFlag = true; onSelectMaterial(obj) {
obj.map(item => {
if(item.productCode) {
if(this.form.productList.some(e => e.productCode === item.productCode)) {
this.$modal.msgError("该物料已存在");
return;
}
this.form.productList.push(item);
}
})
console.log(this.form.productList);
},
deleteProduct(row) {
const productCode = row.productCode;
this.$modal
.confirm('是否确认删除线体编号为"' + productCode + '"的数据项?')
.then(() => {
this.form.productList = this.form.productList.filter(item => item.productCode !== productCode);
})
.then(() => {
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
handleSelectProduct() {
this.$refs.itemSelectMaterial.showFlag = true;
}, },
onSelectLineBody(obj) { onSelectLineBody(obj) {
console.log(obj); console.log(obj);
this.form.lineCode = obj.code; this.form.lineCode = obj.code;
this.form.lineName = obj.name; this.form.lineName = obj.name;
addMesLine(this.form).then((response) => {
if(response.code == 200) {
this.$modal.msgSuccess("添加成功");
}else {
this.$modal.msgError(response.msg);
}
this.getList();
});
}, },
// //
addProcessItem() { addProcessItem() {
@ -438,6 +532,17 @@ export default {
} }
this.form.processItems = this.processItems; this.form.processItems = this.processItems;
}, },
formatProductNames(row, column, cellValue) {
// cellValue productList
if (Array.isArray(cellValue)) {
// 使 map productName join
return cellValue.map(item => item.productName).join(', ');
} else {
//
return '';
}
},
}, },
}; };
</script> </script>

@ -0,0 +1,148 @@
<template>
<el-dialog title="BOM物料选择"
v-if="showFlag"
:visible.sync="showFlag"
:modal= false
width="1000px"
>
<el-row :gutter="20">
<!--BOM数据-->
<el-col :span="24" :xs="24">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="105px" align="center">
<el-form-item label="物料编码" prop="itemCode">
<el-input
v-model="queryParams.productCode"
placeholder="请输入物料编码"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料名称" prop="itemName">
<el-input
v-model="queryParams.productName"
placeholder="请输入物料名称"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="itemList" @selection-change="handleBomSelectionChange" ref="myTable" >
<el-table-column width="50" align="center" type="selection">
</el-table-column>
<!-- 序号 -->
<el-table-column type="index" width="90" align="center" label="序号"></el-table-column>
<el-table-column label="BOM物料组件编码" align="left" key="productCode" prop="productCode" v-if="columns[2].visible" :show-overflow-tooltip="true" />
<el-table-column label="BOM物料组件名称" align="left" key="productName" prop="productName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-col>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitBomForm"> </el-button>
<el-button @click="showFlag=false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import {getProductListBom } from "@/api/mes/mesLine";
export default {
name: "itemSelectMaterial",
data() {
return {
showFlag:false,
//
selectedRows: {},
//
single: true,
//
multiple: false,
//
showSearch: true,
selectedList: [],
//
total: 0,
// BOM
itemList: [],
productList:[],
//
bomCode: undefined,
defaultProps: {
id: "id",
label: "label"
},
//
queryParams: {
pageNum: 1,
pageSize: 10,
productCode: '',
productName: ''
},
//
columns: [
{ key: 0, label: `BOM物料编码`, visible: true },
{ key: 1, label: `产品名称`, visible: true },
{ key: 2, label: `BOM物料组件编码`, visible: true },
{ key: 3, label: `BOM物料组件名称`, visible: true }
]
};
},
created() {
this.getList();
},
methods: {
handleEquipmentSelectionChange (val) {
this.itemList = val
},
/** 查询BOM列表*/
getList() {
this.loading = true;
getProductListBom(this.queryParams).then(response => {
this.itemList = response.rows;
this.total = response.total;
this.loading = false;
}
);
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleBomSelectionChange(selection) {
this.productList = selection;
},
submitBomForm() {
this.$emit('onSelected', this.productList);
this.showFlag = false;
}
}
};
</script>

@ -58,7 +58,7 @@
</template> </template>
<script> <script>
import {getLineBodyList } from "@/api/mes/mesLine"; import {selectLineBody } from "@/api/mes/mesLine";
export default { export default {
name: "selectMesLine", name: "selectMesLine",
data() { data() {
@ -101,7 +101,7 @@ export default {
/** 查询BOM列表*/ /** 查询BOM列表*/
getList() { getList() {
this.loading = true; this.loading = true;
getLineBodyList(this.queryParams).then(response => { selectLineBody(this.queryParams).then(response => {
this.itemList = response.rows; this.itemList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;

Loading…
Cancel
Save