完成工厂建模
This commit is contained in:
parent
fc3954970f
commit
299f1a419e
53
src/api/mes/equipmentInfo.js
Normal file
53
src/api/mes/equipmentInfo.js
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询设备信息列表
|
||||||
|
export function listEquipmentInfo(query) {
|
||||||
|
return request({
|
||||||
|
url: '/baseInfo/equipmentInfo/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询设备信息详细
|
||||||
|
export function getEquipmentInfo(id) {
|
||||||
|
return request({
|
||||||
|
url: '/baseInfo/equipmentInfo/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增设备信息
|
||||||
|
export function addEquipmentInfo(data) {
|
||||||
|
return request({
|
||||||
|
url: '/baseInfo/equipmentInfo',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改设备信息
|
||||||
|
export function updateEquipmentInfo(data) {
|
||||||
|
return request({
|
||||||
|
url: '/baseInfo/equipmentInfo',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除设备信息
|
||||||
|
export function delEquipmentInfo(id) {
|
||||||
|
return request({
|
||||||
|
url: '/baseInfo/equipmentInfo/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出设备信息
|
||||||
|
export function exportEquipmentInfo(query) {
|
||||||
|
return request({
|
||||||
|
url: '/baseInfo/equipmentInfo/export',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -76,7 +76,7 @@
|
|||||||
<el-table-column label="编号" align="center" prop="id" />
|
<el-table-column label="编号" align="center" prop="id" />
|
||||||
<el-table-column label="产品名称" align="center" prop="materialName" />
|
<el-table-column label="产品名称" align="center" prop="materialName" />
|
||||||
<el-table-column label="生产线名称" align="center" prop="productLineName" />
|
<el-table-column label="生产线名称" align="center" prop="productLineName" />
|
||||||
<el-table-column label="描述" align="center" prop="remark" />
|
<!-- <el-table-column label="描述" align="center" prop="remark" /> -->
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
@ -106,7 +106,7 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 添加或修改工厂建模对话框 -->
|
<!-- 添加或修改工厂建模对话框 -->
|
||||||
<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" :inline="true" :rules="rules" label-width="100px">
|
<el-form ref="form" :model="form" :inline="true" :rules="rules" label-width="100px">
|
||||||
<el-form-item label="生产线名称" prop="productLineName">
|
<el-form-item label="生产线名称" prop="productLineName">
|
||||||
<el-input v-model="form.productLineName" placeholder="请输入生产线名称" />
|
<el-input v-model="form.productLineName" placeholder="请输入生产线名称" />
|
||||||
@ -128,6 +128,45 @@
|
|||||||
<!-- <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> -->
|
<!-- <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> -->
|
||||||
<Editor :height=127 v-model="form.remark" />
|
<Editor :height=127 v-model="form.remark" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-divider content-position="center">设备信息信息</el-divider>
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddMesEquipment">添加</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteMesEquipment">删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-table :data="form.mesEquipmentList" :row-class-name="rowMesEquipmentIndex" @selection-change="handleMesEquipmentSelectionChange" ref="mesEquipmentList">
|
||||||
|
<el-table-column type="selection" width="50" align="center" />
|
||||||
|
<el-table-column label="序号" align="center" prop="index" width="50"/>
|
||||||
|
<el-table-column label="设备" prop="name" width="150">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-select v-model="value[scope.$index]" placeholder="请选择" @change="seleqcted(value[scope.$index], scope.$index)">
|
||||||
|
<el-option
|
||||||
|
v-for="item in mesEquipmentLists"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
style="color: black; font-weight: 300;">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="编码" prop="code" width="100">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="型号" prop="model" width="100">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="生产日期" prop="productDate" width="150">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ scope.row.productDate }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="生产批号" prop="batchNo" width="150">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="制造商" prop="manufacturer" width="150">
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
</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>
|
||||||
@ -141,6 +180,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listModel, getModel, delModel, addModel, updateModel, exportModel } from "@/api/mes/model";
|
import { listModel, getModel, delModel, addModel, updateModel, exportModel } from "@/api/mes/model";
|
||||||
|
import { listEquipmentInfo } from "@/api/mes/equipmentInfo";
|
||||||
import Editor from "@/components/Editor/index"
|
import Editor from "@/components/Editor/index"
|
||||||
import factoryModel from "@/components/Material/MaterialSelect";
|
import factoryModel from "@/components/Material/MaterialSelect";
|
||||||
|
|
||||||
@ -152,11 +192,14 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
value: [],
|
||||||
factoryModel_open: false,
|
factoryModel_open: false,
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
// 选中数组
|
// 选中数组
|
||||||
ids: [],
|
ids: [],
|
||||||
|
// 子表选中数据
|
||||||
|
checkedMesEquipment: [],
|
||||||
// 非单个禁用
|
// 非单个禁用
|
||||||
single: true,
|
single: true,
|
||||||
// 非多个禁用
|
// 非多个禁用
|
||||||
@ -167,6 +210,10 @@ export default {
|
|||||||
total: 0,
|
total: 0,
|
||||||
// 工厂建模表格数据
|
// 工厂建模表格数据
|
||||||
modelList: [],
|
modelList: [],
|
||||||
|
// 设备信息表格数据
|
||||||
|
mesEquipmentList: [],
|
||||||
|
// 设备信息列表
|
||||||
|
mesEquipmentLists: [],
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
title: "",
|
title: "",
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
@ -175,30 +222,53 @@ export default {
|
|||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
materialId: null,
|
||||||
materialName: null,
|
materialName: null,
|
||||||
productLineName: null,
|
productLineName: null,
|
||||||
|
remark: null
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
|
productLineName: [
|
||||||
|
{ required: true, message: "请输入生产线名称", trigger: "blur" }
|
||||||
|
],
|
||||||
|
materialName: [
|
||||||
|
{ required: true, message: "请选择产品", trigger: "blur" }
|
||||||
|
],
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
'mesEquipmentList': {
|
||||||
|
handler(newVal, oldVal) {
|
||||||
|
this.form.mesEquipmentList = newVal;
|
||||||
|
},
|
||||||
|
immediate: true,
|
||||||
|
deep: true,
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
seleqcted(row, index) {
|
||||||
|
this.mesEquipmentLists.forEach(element => {
|
||||||
|
if (element.id == row) {
|
||||||
|
console.log(index, element);
|
||||||
|
|
||||||
|
this.form.mesEquipmentList[index] = element;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
handleMaterialSelected(list){
|
handleMaterialSelected(list){
|
||||||
this.form.materialId = list[0].id;
|
this.form.materialId = list[0].id;
|
||||||
this.form.materialName = list[0].name;
|
this.form.materialName = list[0].name;
|
||||||
this.form.productModel = list[0].model;
|
this.form.productModel = list[0].model;
|
||||||
this.form.productSpecification = list[0].specification;
|
this.form.productSpecification = list[0].specification;
|
||||||
|
// this.form.mesFactoryModelDetailList = list[0].mesFactoryModelDetailList;
|
||||||
this.factoryModel_open=false;
|
this.factoryModel_open=false;
|
||||||
console.log("handleMaterialSelected", list[0],this.form);
|
|
||||||
console.log(this.modelList);
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
/** 查询工厂建模列表 */
|
/** 查询工厂建模列表 */
|
||||||
getList() {
|
getList() {
|
||||||
@ -208,6 +278,9 @@ export default {
|
|||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
|
listEquipmentInfo().then(response => {
|
||||||
|
this.mesEquipmentLists = response.rows;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
@ -218,12 +291,16 @@ export default {
|
|||||||
reset() {
|
reset() {
|
||||||
this.form = {
|
this.form = {
|
||||||
id: null,
|
id: null,
|
||||||
|
materialId: null,
|
||||||
materialName: null,
|
materialName: null,
|
||||||
productLineName: null,
|
productLineName: null,
|
||||||
remark: null,
|
remark: null,
|
||||||
|
mesEquipmentList: [],
|
||||||
productSpecification: null,
|
productSpecification: null,
|
||||||
productModel: null
|
productModel: null
|
||||||
};
|
};
|
||||||
|
this.value = []
|
||||||
|
this.mesEquipmentList = [];
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
@ -254,9 +331,17 @@ export default {
|
|||||||
const id = row.id || this.ids
|
const id = row.id || this.ids
|
||||||
getModel(id).then(response => {
|
getModel(id).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
this.form.materialName = this.form.mesFactoryModelDetailList.name;
|
this.mesEquipmentList = this.form.mesFactoryModelDetailList
|
||||||
this.form.productModel = this.form.mesFactoryModelDetailList.model;
|
this.form.mesEquipmentList = this.form.mesFactoryModelDetailList;
|
||||||
this.form.productSpecification = this.form.mesFactoryModelDetailList.specification;
|
this.form.materialName = this.form.mesFactoryModelDetail.name;
|
||||||
|
this.form.productModel = this.form.mesFactoryModelDetail.model;
|
||||||
|
this.form.productSpecification = this.form.mesFactoryModelDetail.specification;
|
||||||
|
console.log(this.form);
|
||||||
|
|
||||||
|
this.form.mesFactoryModelDetailList.forEach((item, index) => {
|
||||||
|
this.value[index] = item.equipmentId;
|
||||||
|
this.seleqcted(item.equipmentId, index);
|
||||||
|
});
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改工厂建模";
|
this.title = "修改工厂建模";
|
||||||
});
|
});
|
||||||
@ -265,6 +350,9 @@ export default {
|
|||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
this.form.mesFactoryModelDetailList = this.form.mesEquipmentList;
|
||||||
|
delete this.form.mesEquipmentList; // 删除多余字段
|
||||||
|
delete this.form.mesFactoryModelDetail; // 删除多余字段
|
||||||
if (this.form.id != null) {
|
if (this.form.id != null) {
|
||||||
updateModel(this.form).then(response => {
|
updateModel(this.form).then(response => {
|
||||||
this.msgSuccess("修改成功");
|
this.msgSuccess("修改成功");
|
||||||
@ -294,6 +382,37 @@ export default {
|
|||||||
this.getList();
|
this.getList();
|
||||||
this.msgSuccess("删除成功");
|
this.msgSuccess("删除成功");
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
/** 设备信息序号 */
|
||||||
|
rowMesEquipmentIndex({ row, rowIndex }) {
|
||||||
|
row.index = rowIndex + 1;
|
||||||
|
},
|
||||||
|
/** 设备信息添加按钮操作 */
|
||||||
|
handleAddMesEquipment() {
|
||||||
|
let obj = {};
|
||||||
|
obj.code = "";
|
||||||
|
obj.model = "";
|
||||||
|
obj.name = "";
|
||||||
|
obj.productDate = "";
|
||||||
|
obj.batchNo = "";
|
||||||
|
obj.manufacturer = "";
|
||||||
|
this.mesEquipmentList.push(obj);
|
||||||
|
},
|
||||||
|
/** 设备信息删除按钮操作 */
|
||||||
|
handleDeleteMesEquipment() {
|
||||||
|
if (this.checkedMesEquipment.length == 0) {
|
||||||
|
this.$alert("请先选择要删除的设备信息数据", "提示", { confirmButtonText: "确定", });
|
||||||
|
} else {
|
||||||
|
this.mesEquipmentList = this.mesEquipmentList.filter((item, index) => {
|
||||||
|
let isDelete = this.checkedMesEquipment.includes(item);
|
||||||
|
if (isDelete) this.value.splice(index, 1);
|
||||||
|
return !isDelete;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** 单选框选中数据 */
|
||||||
|
handleMesEquipmentSelectionChange(selection) {
|
||||||
|
this.checkedMesEquipment = selection;
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user