质量管理
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2023-12-08 13:46:17
|
||||
* @LastEditTime: 2023-12-08 16:09:13
|
||||
* @LastEditTime: 2023-12-15 16:12:08
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
@@ -13,26 +13,28 @@
|
||||
<div class="content">
|
||||
<!-- <div class="visual-part"> -->
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
|
||||
label-width="100px" label-position="top">
|
||||
label-width="auto">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="供应商" prop="supplierId">
|
||||
<el-select v-model="dataForm.supplierId" filterable :disabled="isdetail" style="width: 100%"
|
||||
placeholder="请选择供应商">
|
||||
<el-form-item label="供应商" prop="supplierId"
|
||||
:rules="[{ required: true, message: '供应商不能为空', trigger: 'change' }]">
|
||||
<el-select v-model="dataForm.supplierId" filterable :disabled="isdetail" placeholder="请选择供应商">
|
||||
<el-option v-for="dict in supplierList" :key=" dict.id" :label="dict.name" :value="dict.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="原料" prop="materialId">
|
||||
<el-select v-model="dataForm.materialId" filterable :disabled="isdetail" style="width: 100%"
|
||||
@change="getData" placeholder="请选择原料">
|
||||
<el-form-item label="原料" prop="materialId"
|
||||
:rules="[{ required: true, message: '原料不能为空', trigger: 'change' }]">
|
||||
<el-select v-model="dataForm.materialId" filterable :disabled="isdetail" @change="getData"
|
||||
placeholder="请选择原料">
|
||||
<el-option v-for="dict in materialList" :key=" dict.id" :label="dict.name" :value="dict.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="样品编码" prop="sampleCode">
|
||||
<el-form-item label="样品编码" prop="sampleCode"
|
||||
:rules="[{ required: true, message: '样品编号不能为空', trigger: 'blur' }]">
|
||||
<el-input v-model="dataForm.sampleCode" clearable :disabled="isdetail" placeholder="请输入样品编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -40,28 +42,79 @@
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="取样人" prop="samplerId">
|
||||
<el-select v-model="dataForm.samplerId" filterable :disabled="isdetail" style="width: 100%"
|
||||
placeholder="请选择取样人">
|
||||
<el-select v-model="dataForm.samplerId" filterable :disabled="isdetail" placeholder="请选择取样人">
|
||||
<el-option v-for="dict in workerList" :key=" dict.id" :label="dict.name" :value="dict.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="检测人" prop="checkerId">
|
||||
<el-select v-model="dataForm.checkerId" filterable :disabled="isdetail" style="width: 100%"
|
||||
placeholder="请选择检测人">
|
||||
<el-form-item label="检测人" prop="checkerId"
|
||||
:rules="[{ required: true, message: '检测人不能为空', trigger: 'change' }]">
|
||||
<el-select v-model="dataForm.checkerId" filterable :disabled="isdetail" placeholder="请选择检测人">
|
||||
<el-option v-for="dict in workerList" :key=" dict.id" :label="dict.name" :value="dict.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="检测时间" prop="checkTime">
|
||||
<el-form-item label="检测时间" prop="checkTime"
|
||||
:rules="[{ required: true, message: '检测时间不能为空', trigger: 'change' }]">
|
||||
<el-date-picker v-model="dataForm.checkTime" type="datetime" placeholder="选择检测时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-divider content-position="center">检测结果</el-divider>
|
||||
<el-row :gutter="24">
|
||||
<el-form-item label="外观合格" prop="appearance">
|
||||
<el-radio :disabled="isdetail" v-model="dataForm.appearance" :label="true">合格</el-radio>
|
||||
<el-radio :disabled="isdetail" v-model="dataForm.appearance" :label="false">不合格</el-radio>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row :gutter="24" v-for="(item,index) in ingredientList" :key="item.id">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="成分">
|
||||
{{ item.name }}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :prop="'checkValueList.' + index + '.checkValue'" label="成分含量"
|
||||
:rules="[{ required: true, message: '成分含量不能为空', trigger: 'blur' }]">
|
||||
<el-input :disabled="isdetail" style="width: 90%;margin-right: 10px;" :max="item.maxValue"
|
||||
:min='item.minValue' v-model="dataForm.checkValueList[index].checkValue"
|
||||
@change="judgeValue(arguments[0],item.minValue,item.maxValue,index)"></el-input>
|
||||
<span v-if="dataForm.checkValueList[index].showIcon">
|
||||
<!-- <i class="el-icon-success"></i> -->
|
||||
<svg-icon v-if="dataForm.checkValueList[index].isStandard" icon-class="standards" />
|
||||
<svg-icon v-else icon-class="noStandards" />
|
||||
</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="判断结果" prop="checkResult">
|
||||
<el-select :disabled="isdetail" v-model="dataForm.checkResult" placeholder="请选择">
|
||||
<el-option v-for="item in checkResultList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="原料等级" prop="materialGrade">
|
||||
<el-select :disabled="isdetail" v-model="dataForm.materialGrade" placeholder="请选择" style="width: 100%;">
|
||||
<el-option v-for="item in gradeList" :key="item.value" :label="item.label" :value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input :disabled="isdetail" v-model="dataForm.remark" placeholder="请填写备注" style="width: 100%;">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- </div> -->
|
||||
<div class="attr-list" v-if="idAttrShow">
|
||||
<!-- <small-title style="margin: 16px 0; padding-left: 8px" :no-padding="true">
|
||||
@@ -101,9 +154,15 @@ import {
|
||||
getHotMaterialAllList,
|
||||
getSupplierList,
|
||||
getWorkerList,
|
||||
getMaterialCheckList
|
||||
getMaterialCheckList,
|
||||
createQualityHotMaterialDet,
|
||||
updateQualityHotMaterialDet,
|
||||
getQualityHotMaterialDetList
|
||||
} from '@/api/base/qualityHotMaterial';
|
||||
import SmallTitle from './SmallTitle';
|
||||
import { DICT_TYPE, getDictDatas } from "@/utils/dict";
|
||||
import { create } from 'domain';
|
||||
|
||||
// import { parseTime } from '../../core/mixins/code-filter';
|
||||
// import attrAdd from './attr-add';
|
||||
// import {DICT_TYPE, getDictDatas} from "@/utils/dict";
|
||||
@@ -130,7 +189,17 @@ export default {
|
||||
createURL: createQualityHotMaterial,
|
||||
updateURL: updateQualityHotMaterial,
|
||||
infoURL: getQualityHotMaterial,
|
||||
},
|
||||
},
|
||||
gradeList:[],
|
||||
checkResultList: [{
|
||||
id: true,
|
||||
name:'合格',
|
||||
},
|
||||
{
|
||||
id: false,
|
||||
name: '不合格',
|
||||
}
|
||||
],
|
||||
listQuery: {
|
||||
pageSize: 10,
|
||||
pageNo: 1,
|
||||
@@ -139,7 +208,9 @@ export default {
|
||||
materialList: [],
|
||||
workerList: [],
|
||||
supplierList:[],
|
||||
equipmentList:[],
|
||||
equipmentList: [],
|
||||
ingredientFlag:false,
|
||||
ingredientList:[],
|
||||
dataForm: {
|
||||
id: undefined,
|
||||
materialId:null,
|
||||
@@ -151,6 +222,10 @@ export default {
|
||||
appearance: null,
|
||||
checkResult: null,
|
||||
materialGrade: null,
|
||||
checkValueList: [],
|
||||
checkResult: '',
|
||||
materialGrade: undefined,
|
||||
remark:null,
|
||||
},
|
||||
productAttrList: [],
|
||||
visible: false,
|
||||
@@ -168,6 +243,15 @@ export default {
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
judgeValue(val, minValue, maxValue, index) {
|
||||
if (val >= minValue && val <= maxValue) {
|
||||
this.dataForm.checkValueList[index].showIcon = true
|
||||
this.dataForm.checkValueList[index].isStandard = true
|
||||
} else {
|
||||
this.dataForm.checkValueList[index].showIcon = true
|
||||
this.dataForm.checkValueList[index].isStandard = false
|
||||
}
|
||||
},
|
||||
dataFormSubmit() {
|
||||
this.$refs["dataForm"].validate((valid) => {
|
||||
if (!valid) {
|
||||
@@ -175,28 +259,111 @@ export default {
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.dataForm.id) {
|
||||
this.urlOptions.updateURL(this.dataForm).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.visible = false;
|
||||
this.$emit("refreshDataList");
|
||||
let obj = {
|
||||
id: this.dataForm.id,
|
||||
materialId: this.dataForm.materialId,
|
||||
supplierId: this.dataForm.supplierId,
|
||||
sampleCode: this.dataForm.sampleCode,
|
||||
samplerId: this.dataForm.samplerId,
|
||||
checkerId: this.dataForm.checkerId,
|
||||
checkTime: this.dataForm.checkTime,
|
||||
appearance: this.dataForm.appearance,
|
||||
checkResult: this.dataForm.checkResult,
|
||||
materialGrade: this.dataForm.materialGrade,
|
||||
// checkValueList: [],
|
||||
checkResult: this.dataForm.checkResult,
|
||||
materialGrade: this.dataForm.materialGrade,
|
||||
remark: this.dataForm.remark
|
||||
}
|
||||
this.urlOptions.updateURL(obj).then(response => {
|
||||
let array = []
|
||||
this.dataForm.checkValueList.forEach(ele => {
|
||||
array.push(this.updateDet({
|
||||
mainId: this.dataForm.id,
|
||||
id:ele.id,
|
||||
checkDetId: ele.checkDetId,
|
||||
checkValue: ele.checkValue
|
||||
}))
|
||||
})
|
||||
Promise.all(array).then(res => {
|
||||
console.log(res)
|
||||
this.visible = false;
|
||||
this.$emit("refreshDataList");
|
||||
}).catch(error => {
|
||||
// 如果任何一个请求失败,将会进入这个 catch 块
|
||||
console.log(error)
|
||||
})
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
this.urlOptions.createURL(this.dataForm).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.idAttrShow = true;
|
||||
this.dataForm.id = res.data
|
||||
this.$emit("refreshDataList");
|
||||
let obj = {
|
||||
// id: this.dataForm.id,
|
||||
materialId: this.dataForm.materialId,
|
||||
supplierId: this.dataForm.supplierId,
|
||||
sampleCode: this.dataForm.sampleCode,
|
||||
samplerId: this.dataForm.samplerId,
|
||||
checkerId: this.dataForm.checkerId,
|
||||
checkTime: this.dataForm.checkTime,
|
||||
appearance: this.dataForm.appearance,
|
||||
checkResult: this.dataForm.checkResult,
|
||||
materialGrade: this.dataForm.materialGrade,
|
||||
// checkValueList: [],
|
||||
checkResult: this.dataForm.checkResult,
|
||||
materialGrade: this.dataForm.materialGrade,
|
||||
remark:this.dataForm.remark
|
||||
}
|
||||
this.urlOptions.createURL(obj).then(response => {
|
||||
// this.idAttrShow = true;
|
||||
let array = []
|
||||
this.dataForm.checkValueList.forEach(ele => {
|
||||
array.push(this.createDet({
|
||||
mainId: response.data,
|
||||
checkDetId: ele.checkDetId,
|
||||
checkValue: ele.checkValue
|
||||
}))
|
||||
})
|
||||
Promise.all(array).then(res => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.visible = false;
|
||||
this.$emit("refreshDataList");
|
||||
}).catch(error => {
|
||||
// 如果任何一个请求失败,将会进入这个 catch 块
|
||||
console.log(error)
|
||||
})
|
||||
|
||||
// this.dataForm.id = res.data
|
||||
});
|
||||
});
|
||||
},
|
||||
createDet(obj) {
|
||||
return createQualityHotMaterialDet(obj).then((response) => {
|
||||
return response.data
|
||||
})
|
||||
},
|
||||
updateDet(obj) {
|
||||
return updateQualityHotMaterialDet(obj).then((response) => {
|
||||
return response.data
|
||||
})
|
||||
},
|
||||
getData(val) {
|
||||
console.log(val);
|
||||
getMaterialCheckList({
|
||||
materialId:val
|
||||
}).then((res) => {
|
||||
console.log(res);
|
||||
this.ingredientList = res.data
|
||||
this.ingredientFlag = true
|
||||
this.dataForm.checkValueList = res.data.map((ele) => {
|
||||
return {
|
||||
mainId: null,
|
||||
checkDetId: ele.id,
|
||||
checkValue: null,
|
||||
isStandard: true,
|
||||
showIcon:false,
|
||||
}
|
||||
})
|
||||
// this.$set()
|
||||
console.log(this.dataForm);
|
||||
})
|
||||
},
|
||||
// clickTopBtn(val) {
|
||||
@@ -208,7 +375,7 @@ export default {
|
||||
this.productAttrList.splice(0);
|
||||
this.listQuery.total = 0;
|
||||
},
|
||||
getDict() {
|
||||
async getDict() {
|
||||
getHotMaterialAllList().then((res) => {
|
||||
this.materialList = res.data
|
||||
})
|
||||
@@ -218,49 +385,52 @@ export default {
|
||||
getSupplierList().then(res => {
|
||||
this.supplierList = res.data
|
||||
})
|
||||
const res = await getDictDatas(this.DICT_TYPE.EQU_ALARM_LEVEL)
|
||||
console.log('111', res)
|
||||
this.gradeList = res
|
||||
},
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'delete') {
|
||||
this.$confirm(
|
||||
`确定对${
|
||||
raw.data.materialName
|
||||
? '[物料名称为' + raw.data.materialName + ']'
|
||||
: '[序号为' + raw.data.materialName + ']'
|
||||
}进行删除操作?`,
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
deleteProcessEquMaterialBomDet(raw.data.id).then(({ data }) => {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList();
|
||||
},
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
} else {
|
||||
this.addNew(raw.data.id);
|
||||
}
|
||||
},
|
||||
getList() {
|
||||
// 获取产品属性列表
|
||||
processEquMaterialBomDetPage({
|
||||
...this.listQuery,
|
||||
bomId: this.dataForm.id,
|
||||
}).then((response) => {
|
||||
this.productAttrList = response.data.list;
|
||||
this.listQuery.total = response.data.total;
|
||||
});
|
||||
},
|
||||
// handleClick(raw) {
|
||||
// if (raw.type === 'delete') {
|
||||
// this.$confirm(
|
||||
// `确定对${
|
||||
// raw.data.materialName
|
||||
// ? '[物料名称为' + raw.data.materialName + ']'
|
||||
// : '[序号为' + raw.data.materialName + ']'
|
||||
// }进行删除操作?`,
|
||||
// '提示',
|
||||
// {
|
||||
// confirmButtonText: '确定',
|
||||
// cancelButtonText: '取消',
|
||||
// type: 'warning',
|
||||
// }
|
||||
// )
|
||||
// .then(() => {
|
||||
// deleteProcessEquMaterialBomDet(raw.data.id).then(({ data }) => {
|
||||
// this.$message({
|
||||
// message: '操作成功',
|
||||
// type: 'success',
|
||||
// duration: 1500,
|
||||
// onClose: () => {
|
||||
// this.getList();
|
||||
// },
|
||||
// });
|
||||
// });
|
||||
// })
|
||||
// .catch(() => {});
|
||||
// } else {
|
||||
// this.addNew(raw.data.id);
|
||||
// }
|
||||
// },
|
||||
// getList() {
|
||||
// // 获取产品属性列表
|
||||
// processEquMaterialBomDetPage({
|
||||
// ...this.listQuery,
|
||||
// bomId: this.dataForm.id,
|
||||
// }).then((response) => {
|
||||
// this.productAttrList = response.data.list;
|
||||
// this.listQuery.total = response.data.total;
|
||||
// });
|
||||
// },
|
||||
init(id, isdetail) {
|
||||
this.initData()
|
||||
this.getDict()
|
||||
@@ -277,19 +447,51 @@ export default {
|
||||
this.$refs['dataForm'].resetFields();
|
||||
|
||||
if (this.dataForm.id) {
|
||||
// 获取产品详情
|
||||
this.urlOptions.infoURL({
|
||||
bomId: id,
|
||||
pageNo: 1,
|
||||
pageSize:10
|
||||
}).then(response => {
|
||||
// 获取产品详情
|
||||
let valueList = []
|
||||
this.urlOptions.infoURL(id).then(response => {
|
||||
this.dataForm = response.data
|
||||
this.dataForm.unit = String(this.dataForm.unit)
|
||||
this.dataForm.materialType = String(this.dataForm.materialType)
|
||||
this.dataForm.productType = String(this.dataForm.productType)
|
||||
});
|
||||
getMaterialCheckList({
|
||||
materialId: response.data.materialId
|
||||
}).then((res) => {
|
||||
console.log(res.data);
|
||||
this.ingredientList = res.data
|
||||
valueList = this.ingredientList.map((ele) => {
|
||||
// console.log(ele)
|
||||
return {
|
||||
maxValue: ele.maxValue,
|
||||
minValue: ele.minValue
|
||||
}
|
||||
})
|
||||
getQualityHotMaterialDetList({
|
||||
mainId: response.data.id
|
||||
}).then((result) => {
|
||||
this.dataForm.checkValueList = result.data.map((ele) => {
|
||||
return {
|
||||
mainId: ele.mainId,
|
||||
id: ele.id,
|
||||
checkDetId: ele.id,
|
||||
checkValue: ele.checkValue,
|
||||
isStandard: true,
|
||||
showIcon: false,
|
||||
}
|
||||
})
|
||||
valueList.forEach((ele,index) => {
|
||||
console.log(ele);
|
||||
if (this.dataForm.checkValueList[index].checkValue >= ele.minValue && this.dataForm.checkValueList[index].checkValue <= ele.maxValue) {
|
||||
this.dataForm.checkValueList[index].showIcon = true
|
||||
this.dataForm.checkValueList[index].isStandard = true
|
||||
} else {
|
||||
this.dataForm.checkValueList[index].showIcon = true
|
||||
this.dataForm.checkValueList[index].isStandard = false
|
||||
}
|
||||
// })
|
||||
})
|
||||
})
|
||||
});
|
||||
})
|
||||
// 获取产品属性列表
|
||||
this.getList();
|
||||
// this.getList();
|
||||
} else {
|
||||
if (this.urlOptions.isGetCode) {
|
||||
this.getCode()
|
||||
@@ -322,10 +524,6 @@ export default {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.drawer >>> .el-form-item__label {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.drawer >>> .el-drawer__header {
|
||||
margin: 0;
|
||||
padding: 32px 32px 24px;
|
||||
|
||||
@@ -77,13 +77,19 @@ export default {
|
||||
},
|
||||
tableProps,
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi(`base:quality-inspection-det:update`)
|
||||
this.$auth.hasPermi(`base:quality-hot-material:update`)
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '编辑',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`base:quality-inspection-det:delete`)
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`base:quality-hot-material:detail`)
|
||||
? {
|
||||
type: 'detail',
|
||||
btnName: '详情',
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi(`base:quality-hot-material:delete`)
|
||||
? {
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
@@ -132,7 +138,16 @@ export default {
|
||||
mounted () {
|
||||
this.getDict();
|
||||
},
|
||||
methods: {
|
||||
methods: {
|
||||
otherMethods(val) {
|
||||
if (val.type === 'detail') {
|
||||
this.addOrUpdateVisible = true;
|
||||
this.addOrEditTitle = "详情";
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(val.data.id, true);
|
||||
});
|
||||
}
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true;
|
||||
|
||||
Reference in New Issue
Block a user