|
|
@@ -1,18 +1,25 @@
|
|
|
<!-- 用户编辑弹窗 -->
|
|
|
<template>
|
|
|
- <el-dialog class="ele-dialog-form" :title="title" :visible.sync="visible" :before-close="handleClose"
|
|
|
- :close-on-click-modal="false" :close-on-press-escape="false" width="1000px">
|
|
|
+ <el-dialog
|
|
|
+ class="ele-dialog-form"
|
|
|
+ :title="title"
|
|
|
+ :visible.sync="visible"
|
|
|
+ :before-close="handleClose"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :close-on-press-escape="false"
|
|
|
+ width="1000px"
|
|
|
+ >
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
<el-row>
|
|
|
-
|
|
|
-
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="标准类型:" prop="type">
|
|
|
- <DictSelection dictName="质检标准类型" v-model="form.type"></DictSelection>
|
|
|
+ <DictSelection
|
|
|
+ dictName="质检标准类型"
|
|
|
+ v-model="form.type"
|
|
|
+ ></DictSelection>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
-
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="标准名称:" prop="name">
|
|
|
<el-input clearable v-model="form.name" placeholder="请输入" />
|
|
|
@@ -31,65 +38,133 @@
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="状态:" prop="status">
|
|
|
- <el-select v-model="form.status" placeholder="请选择" style="width: 100%">
|
|
|
+ <el-select
|
|
|
+ v-model="form.status"
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
<el-option label="停用" :value="0" />
|
|
|
<el-option label="启用" :value="1" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
-
|
|
|
<el-col :span="8">
|
|
|
<el-form-item prop="imgUrl" label="附件">
|
|
|
- <fileUpload v-model="form.imgUrl" module="main" :showLib="false" :limit="1" />
|
|
|
+ <fileUpload
|
|
|
+ v-model="form.imgUrl"
|
|
|
+ module="main"
|
|
|
+ :showLib="false"
|
|
|
+ :limit="1"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
- <inspectionProjectList v-if="visible" :list="form.inspectionItems" ref="inspectionProjectRef" />
|
|
|
-
|
|
|
+ <el-col :span="24">
|
|
|
+ <!-- <el-button
|
|
|
+ style="margin-left: 100px"
|
|
|
+ type="primary"
|
|
|
+ @click="addParameter"
|
|
|
+ >选择工艺参数标准</el-button
|
|
|
+ > -->
|
|
|
+ <el-table
|
|
|
+ style="margin-top: 15px"
|
|
|
+ :data="form.parameterStandards"
|
|
|
+ border
|
|
|
+ height="40vh"
|
|
|
+ >
|
|
|
+ <el-table-column :label="form.singleWeightDivision" align="center">
|
|
|
+ <el-table-column label="参数上限" align="center" v-if='form.parameterType==3'>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item label-width="0" prop="finalValue">
|
|
|
+ <el-input
|
|
|
+ clearable
|
|
|
+ v-model="scope.row.finalValue"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="参数下限" align="center" v-if='form.parameterType==3'>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item label-width="0" prop="initialValue">
|
|
|
+ <el-input
|
|
|
+ clearable
|
|
|
+ v-model="scope.row.initialValue"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="默认值" align="center" v-if='form.parameterType!=3'>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item label-width="0" prop="defaultValue">
|
|
|
+ <el-input
|
|
|
+ clearable
|
|
|
+ v-model="scope.row.defaultValue"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="form.tolerance" align="center">
|
|
|
+ <el-table-column label="质检标准" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item label-width="0" prop="inspectionStandard">
|
|
|
+ <el-input
|
|
|
+ clearable
|
|
|
+ v-model="scope.row.toleranceValue"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" align="center" width="80">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-link
|
|
|
+ type="danger"
|
|
|
+ :underline="false"
|
|
|
+ @click="handleDeleteItem(scope.$index, scope.row.id)"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-link>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div class="add-product" @click="add">
|
|
|
+ <i class="el-icon-circle-plus-outline"></i>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <!-- <inspectionProjectList v-if="visible" :list="form.inspectionItems" ref="inspectionProjectRef" /> -->
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
<template v-slot:footer>
|
|
|
<el-button @click="handleClose">取消</el-button>
|
|
|
<el-button type="primary" :loading="loading" @click="save">
|
|
|
保存
|
|
|
</el-button>
|
|
|
</template>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ <standardDialog ref="standardDialogRef" @choose="choose" />
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-
|
|
|
import { save, update, getById } from '@/api/inspectionStandard';
|
|
|
import fileUpload from '@/components/upload/fileUpload';
|
|
|
-import inspectionProjectList from '../../../views/inspectionPoint/components/inspectionProjectList';
|
|
|
+import standardDialog from './standardDialog';
|
|
|
+// import EquipmentDialog from '../../../views/inspectionPoint/components/EquipmentDialog';
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
- fileUpload,inspectionProjectList
|
|
|
+ fileUpload,
|
|
|
+ standardDialog
|
|
|
},
|
|
|
|
|
|
-
|
|
|
-
|
|
|
data() {
|
|
|
const defaultForm = function () {
|
|
|
return {
|
|
|
@@ -99,17 +174,20 @@ export default {
|
|
|
type: '',
|
|
|
version: '1.0',
|
|
|
standardCode: '',
|
|
|
- inspectionId:"",
|
|
|
- inspectionItems: []
|
|
|
+ inspectionId: '',
|
|
|
+ singleWeightDivision: '',
|
|
|
+ tolerance: '',
|
|
|
+ parameterStandards: [],
|
|
|
+ parameterType:''
|
|
|
};
|
|
|
};
|
|
|
return {
|
|
|
defaultForm,
|
|
|
// 表单数据
|
|
|
form: { ...defaultForm() },
|
|
|
+
|
|
|
// 表单验证规则
|
|
|
rules: {
|
|
|
-
|
|
|
name: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
version: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
type: {
|
|
|
@@ -122,41 +200,65 @@ export default {
|
|
|
required: true,
|
|
|
message: '请选择',
|
|
|
trigger: 'change'
|
|
|
- },
|
|
|
-
|
|
|
+ }
|
|
|
},
|
|
|
visible: false,
|
|
|
type: null,
|
|
|
title: null,
|
|
|
- loading: false,
|
|
|
-
|
|
|
+ loading: false
|
|
|
};
|
|
|
},
|
|
|
|
|
|
- created() {
|
|
|
-
|
|
|
- },
|
|
|
+ created() {},
|
|
|
methods: {
|
|
|
open(type, row) {
|
|
|
- this.title = type == 'add' ? '新增' : '编辑'
|
|
|
+ this.title = type == 'add' ? '新增' : '编辑';
|
|
|
this.type = type;
|
|
|
if (this.type == 'edit') {
|
|
|
- this.form=row
|
|
|
-
|
|
|
- // this.getDetail(row.id)
|
|
|
+ if (!row.parameterStandards) {
|
|
|
+ row.parameterStandards = [];
|
|
|
+ }else{
|
|
|
+ row.singleWeightDivision=row.parameterStandards[0]?.singleWeightDivision
|
|
|
+ row.tolerance=row.parameterStandards[0]?.tolerance
|
|
|
+ row.parameterType=row.parameterStandards[0]?.parameterType
|
|
|
+ }
|
|
|
+ this.form = JSON.parse(JSON.stringify(row)) ;
|
|
|
}
|
|
|
this.visible = true;
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
|
|
|
- // getDetail(id) {
|
|
|
- // getById(id).then(res => {
|
|
|
- // this.form = res.data
|
|
|
-
|
|
|
- // })
|
|
|
- // },
|
|
|
-
|
|
|
+ choose(data) {
|
|
|
+ let obj = {
|
|
|
+ finalValue: data.parameter?.maxValue,
|
|
|
+ initialValue: data.parameter?.minValue,
|
|
|
+ toleranceValue: data.project?.inspectionStandard,
|
|
|
+ singleWeightDivision: data.parameter?.name +' '+ data.parameter?.unitName,
|
|
|
+ tolerance: data.project?.inspectionName+' '+data.project?.unit,
|
|
|
+ parameterType:data.parameter?.textType,
|
|
|
+ defaultValue:data.parameter?.defaultValue,
|
|
|
+ };
|
|
|
+ this.form.singleWeightDivision =obj.singleWeightDivision
|
|
|
+ this.form.tolerance = obj.tolerance
|
|
|
+ this.form.parameterType = obj.parameterType
|
|
|
+ this.form.parameterStandards.push(obj);
|
|
|
+ },
|
|
|
+ add() {
|
|
|
+ if (!this.form.parameterStandards.length) {
|
|
|
+ this.$refs.standardDialogRef.open();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let obj = {
|
|
|
+ finalValue: '',
|
|
|
+ initialValue: '',
|
|
|
+ toleranceValue: '',
|
|
|
+ singleWeightDivision: '',
|
|
|
+ tolerance: ''
|
|
|
+ };
|
|
|
+ this.form.parameterStandards.push(obj);
|
|
|
+ },
|
|
|
+ handleDeleteItem(index) {
|
|
|
+ this.form.parameterStandards.splice(index, 1);
|
|
|
+ },
|
|
|
/* 保存编辑 */
|
|
|
save() {
|
|
|
this.$refs.form.validate((valid) => {
|
|
|
@@ -167,9 +269,9 @@ export default {
|
|
|
if (this.type == 'add') {
|
|
|
delete this.form.id;
|
|
|
}
|
|
|
- this.form.inspectionId = this.$refs.inspectionProjectRef.getValue();
|
|
|
+ // this.form.inspectionId = this.$refs.inspectionProjectRef.getValue();
|
|
|
|
|
|
- let URL = this.type == 'add' ? save : update
|
|
|
+ let URL = this.type == 'add' ? save : update;
|
|
|
URL(this.form)
|
|
|
.then((msg) => {
|
|
|
this.loading = false;
|
|
|
@@ -184,6 +286,7 @@ export default {
|
|
|
},
|
|
|
restForm() {
|
|
|
this.form = { ...this.defaultForm() };
|
|
|
+ this.list = [];
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.form.clearValidate();
|
|
|
});
|
|
|
@@ -191,16 +294,7 @@ export default {
|
|
|
handleClose() {
|
|
|
this.restForm();
|
|
|
this.visible = false;
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
@@ -214,7 +308,32 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-:deep(.el-dialog:not(.ele-dialog-form) .el-dialog__body .el-form .el-form-item:last-child) {
|
|
|
+:deep(
|
|
|
+ .el-dialog:not(.ele-dialog-form)
|
|
|
+ .el-dialog__body
|
|
|
+ .el-form
|
|
|
+ .el-form-item:last-child
|
|
|
+ ) {
|
|
|
margin-bottom: 22px;
|
|
|
}
|
|
|
+:deep(
|
|
|
+ .el-dialog:not(.ele-dialog-form)
|
|
|
+ .el-dialog__body
|
|
|
+ .el-form
|
|
|
+ .el-table__body
|
|
|
+ .el-table__row
|
|
|
+ .el-form-item:last-child
|
|
|
+ ) {
|
|
|
+ margin-bottom: 0 !important;
|
|
|
+}
|
|
|
+.add-product {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: flex-end;
|
|
|
+ font-size: 30px;
|
|
|
+ color: #1890ff;
|
|
|
+ margin: 10px 0;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
</style>
|