|
|
@@ -1,43 +1,74 @@
|
|
|
<!-- 用户编辑弹窗 -->
|
|
|
<template>
|
|
|
- <ele-modal :title="title" :visible.sync="visible" :before-close="handleClose" :close-on-click-modal="false"
|
|
|
- :close-on-press-escape="false" append-to-body width="50%" :maxable="true">
|
|
|
+ <ele-modal
|
|
|
+ :title="title"
|
|
|
+ :visible.sync="visible"
|
|
|
+ :before-close="handleClose"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :close-on-press-escape="false"
|
|
|
+ append-to-body
|
|
|
+ width="50%"
|
|
|
+ :maxable="true"
|
|
|
+ >
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
<el-row>
|
|
|
- <el-col :span="12">
|
|
|
+ <el-col :span="12" style="padding: 0">
|
|
|
<el-form-item label="标准类型:" prop="type">
|
|
|
- <DictSelection dictName="质检标准类型" v-model="form.type" :disabled="type == 'detail'"></DictSelection>
|
|
|
+ <DictSelection
|
|
|
+ dictName="质检标准类型"
|
|
|
+ v-model="form.type"
|
|
|
+ :disabled="type == 'detail'"
|
|
|
+ ></DictSelection>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
- <el-col :span="12">
|
|
|
+ <el-col :span="12" style="padding: 0">
|
|
|
<el-form-item label="标准名称:" prop="name">
|
|
|
- <el-input clearable v-model="form.name" placeholder="请输入" :disabled="type == 'detail'" />
|
|
|
+ <el-input
|
|
|
+ clearable
|
|
|
+ v-model="form.name"
|
|
|
+ placeholder="请输入"
|
|
|
+ :disabled="type == 'detail'"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
+ <el-col :span="12" style="padding: 0">
|
|
|
<el-form-item label="标准代码:" prop="standardCode">
|
|
|
- <el-input v-model="form.standardCode" :disabled="type == 'detail'"></el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="form.standardCode"
|
|
|
+ :disabled="type == 'detail'"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
- <el-col :span="12">
|
|
|
+ <el-col :span="12" style="padding: 0">
|
|
|
<el-form-item label="版本号:" prop="version">
|
|
|
- <el-input v-model="form.version" :disabled="type == 'detail'"></el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="form.version"
|
|
|
+ :disabled="type == 'detail'"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
+ <el-col :span="12" style="padding: 0">
|
|
|
<el-form-item label="状态:" prop="status">
|
|
|
- <el-select v-model="form.status" placeholder="请选择" style="width: 100%" :disabled="type == 'detail'">
|
|
|
+ <el-select
|
|
|
+ v-model="form.status"
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width: 100%"
|
|
|
+ :disabled="type == 'detail'"
|
|
|
+ >
|
|
|
<el-option label="停用" :value="0" />
|
|
|
<el-option label="启用" :value="1" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
- <el-col :span="8">
|
|
|
+ <el-col :span="8" style="padding: 0">
|
|
|
<el-form-item prop="imgUrl" label="附件">
|
|
|
- <fileUpload v-model="form.imgUrl" :type="type == 'detail' ? 'view' : 'add'" />
|
|
|
+ <fileUpload
|
|
|
+ v-model="form.imgUrl"
|
|
|
+ :type="type == 'detail' ? 'view' : 'add'"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
@@ -50,31 +81,68 @@
|
|
|
>选择工艺参数标准</el-button
|
|
|
> -->
|
|
|
<el-tabs v-model="activeName" type="card" v-if="false">
|
|
|
- <el-tab-pane :label="item.name" :name="item.name" v-for="item in activeList" :key="item.name">
|
|
|
- <el-table v-show="activeName == '质检项'" 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">
|
|
|
+ <el-tab-pane
|
|
|
+ :label="item.name"
|
|
|
+ :name="item.name"
|
|
|
+ v-for="item in activeList"
|
|
|
+ :key="item.name"
|
|
|
+ >
|
|
|
+ <el-table
|
|
|
+ v-show="activeName == '质检项'"
|
|
|
+ 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 :disabled="type == 'detail'" v-model="scope.row.finalValue"
|
|
|
- placeholder="请输入" />
|
|
|
+ <el-input
|
|
|
+ clearable
|
|
|
+ :disabled="type == 'detail'"
|
|
|
+ v-model="scope.row.finalValue"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="参数下限" align="center" v-if="form.parameterType == 3">
|
|
|
+ <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 :disabled="type == 'detail'" clearable v-model="scope.row.initialValue"
|
|
|
- placeholder="请输入" />
|
|
|
+ <el-input
|
|
|
+ :disabled="type == 'detail'"
|
|
|
+ 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">
|
|
|
+ <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 :disabled="type == 'detail'" v-model="scope.row.defaultValue"
|
|
|
- placeholder="请输入" />
|
|
|
+ <el-input
|
|
|
+ clearable
|
|
|
+ :disabled="type == 'detail'"
|
|
|
+ v-model="scope.row.defaultValue"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -83,47 +151,89 @@
|
|
|
<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="请输入"
|
|
|
- :disabled="type == 'detail'">
|
|
|
- <DictSelection style="width: 100px" slot="prepend" clearable :disabled="type == 'detail'"
|
|
|
- dictName="数学字符" v-model="scope.row.symbol"></DictSelection>
|
|
|
+ <el-input
|
|
|
+ clearable
|
|
|
+ v-model="scope.row.toleranceValue"
|
|
|
+ placeholder="请输入"
|
|
|
+ :disabled="type == 'detail'"
|
|
|
+ >
|
|
|
+ <DictSelection
|
|
|
+ style="width: 100px"
|
|
|
+ slot="prepend"
|
|
|
+ clearable
|
|
|
+ :disabled="type == 'detail'"
|
|
|
+ dictName="数学字符"
|
|
|
+ v-model="scope.row.symbol"
|
|
|
+ ></DictSelection>
|
|
|
</el-input>
|
|
|
<!-- </el-form-item> -->
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" align="center" width="80" v-if="type != 'detail'">
|
|
|
+ <el-table-column
|
|
|
+ label="操作"
|
|
|
+ align="center"
|
|
|
+ width="80"
|
|
|
+ v-if="type != 'detail'"
|
|
|
+ >
|
|
|
<template slot-scope="scope">
|
|
|
- <el-link type="danger" :underline="false"
|
|
|
- @click="handleDeleteItem(scope.$index, 'parameterStandards')">
|
|
|
+ <el-link
|
|
|
+ type="danger"
|
|
|
+ :underline="false"
|
|
|
+ @click="
|
|
|
+ handleDeleteItem(scope.$index, 'parameterStandards')
|
|
|
+ "
|
|
|
+ >
|
|
|
删除
|
|
|
</el-link>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- <el-table v-show="activeName == '质检点'" style="margin-top: 15px" :data="form.linePoints" border
|
|
|
- height="40vh">
|
|
|
+ <el-table
|
|
|
+ v-show="activeName == '质检点'"
|
|
|
+ style="margin-top: 15px"
|
|
|
+ :data="form.linePoints"
|
|
|
+ border
|
|
|
+ height="40vh"
|
|
|
+ >
|
|
|
<el-table-column label="编码" align="center" prop="pointCode">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-link type="primary" :underline="false" @click="openEdit('detail', scope.row)">
|
|
|
+ <el-link
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ @click="openEdit('detail', scope.row)"
|
|
|
+ >
|
|
|
{{ scope.row.pointCode }}
|
|
|
</el-link>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="名称" align="center" prop="pointName"></el-table-column>
|
|
|
- <el-table-column label="区域" align="center" prop="areaName"></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="名称"
|
|
|
+ align="center"
|
|
|
+ prop="pointName"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="区域"
|
|
|
+ align="center"
|
|
|
+ prop="areaName"
|
|
|
+ ></el-table-column>
|
|
|
|
|
|
<el-table-column label="操作" align="center" width="80">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-link type="danger" :underline="false" v-if="type != 'detail'"
|
|
|
- @click="handleDeleteItem(scope.$index, 'linePoints')">
|
|
|
+ <el-link
|
|
|
+ type="danger"
|
|
|
+ :underline="false"
|
|
|
+ v-if="type != 'detail'"
|
|
|
+ @click="handleDeleteItem(scope.$index, 'linePoints')"
|
|
|
+ >
|
|
|
删除
|
|
|
</el-link>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- </el-tab-pane></el-tabs>
|
|
|
+ </el-tab-pane></el-tabs
|
|
|
+ >
|
|
|
|
|
|
<div class="add-product" @click="add" v-if="false">
|
|
|
<i class="el-icon-circle-plus-outline"></i>
|
|
|
@@ -136,210 +246,227 @@
|
|
|
|
|
|
<template v-slot:footer>
|
|
|
<el-button @click="handleClose">取消</el-button>
|
|
|
- <el-button type="primary" :loading="loading" @click="save" v-if="type != 'detail'">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ :loading="loading"
|
|
|
+ @click="save"
|
|
|
+ v-if="type != 'detail'"
|
|
|
+ >
|
|
|
保存
|
|
|
</el-button>
|
|
|
</template>
|
|
|
<!-- <standardDialog ref="standardDialogRef" @choose="choose" />
|
|
|
<EquipmentDialog ref="equipmentDialogRef" @choose="choose" />
|
|
|
-
|
|
|
+
|
|
|
<edit ref="edit" ></edit> -->
|
|
|
</ele-modal>
|
|
|
-
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { save, update, getById } from '@/api/inspectionStandard';
|
|
|
-import fileUpload from '@/components/addDoc/index.vue';
|
|
|
-import standardDialog from './standardDialog';
|
|
|
-// import EquipmentDialog from './EquipmentDialog';
|
|
|
+ import { save, update, getById } from '@/api/inspectionStandard';
|
|
|
+ import fileUpload from '@/components/addDoc/index.vue';
|
|
|
+ import standardDialog from './standardDialog';
|
|
|
+ // import EquipmentDialog from './EquipmentDialog';
|
|
|
|
|
|
-// import edit from '@/views/inspectionPoint/components/edit';
|
|
|
+ // import edit from '@/views/inspectionPoint/components/edit';
|
|
|
|
|
|
-export default {
|
|
|
- components: {
|
|
|
- fileUpload,
|
|
|
- standardDialog,
|
|
|
- // EquipmentDialog,
|
|
|
- // edit
|
|
|
- },
|
|
|
+ export default {
|
|
|
+ components: {
|
|
|
+ fileUpload,
|
|
|
+ standardDialog
|
|
|
+ // EquipmentDialog,
|
|
|
+ // edit
|
|
|
+ },
|
|
|
|
|
|
- data() {
|
|
|
- const defaultForm = function () {
|
|
|
+ data() {
|
|
|
+ const defaultForm = function () {
|
|
|
+ return {
|
|
|
+ id: '',
|
|
|
+ name: '',
|
|
|
+ status: '',
|
|
|
+ type: '',
|
|
|
+ version: '1.0',
|
|
|
+ standardCode: '',
|
|
|
+ inspectionId: '',
|
|
|
+ singleWeightDivision: '',
|
|
|
+ tolerance: '',
|
|
|
+ parameterStandards: [],
|
|
|
+ linePoints: [],
|
|
|
+ parameterType: '',
|
|
|
+ imgUrl: []
|
|
|
+ };
|
|
|
+ };
|
|
|
return {
|
|
|
- id: '',
|
|
|
- name: '',
|
|
|
- status: '',
|
|
|
- type: '',
|
|
|
- version: '1.0',
|
|
|
- standardCode: '',
|
|
|
- inspectionId: '',
|
|
|
- singleWeightDivision: '',
|
|
|
- tolerance: '',
|
|
|
- parameterStandards: [],
|
|
|
- linePoints: [],
|
|
|
- parameterType: '',
|
|
|
- imgUrl: []
|
|
|
+ defaultForm,
|
|
|
+ // 表单数据
|
|
|
+ form: { ...defaultForm() },
|
|
|
+ activeName: '质检项',
|
|
|
+ activeList: [{ name: '质检项' }, { name: '质检点' }],
|
|
|
+ // 表单验证规则
|
|
|
+ rules: {
|
|
|
+ name: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
+ version: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
+ type: {
|
|
|
+ required: true,
|
|
|
+ message: '请选择',
|
|
|
+ trigger: 'change'
|
|
|
+ },
|
|
|
|
|
|
- };
|
|
|
- };
|
|
|
- return {
|
|
|
- defaultForm,
|
|
|
- // 表单数据
|
|
|
- form: { ...defaultForm() },
|
|
|
- activeName: '质检项',
|
|
|
- activeList: [{ name: '质检项' }, { name: '质检点' }],
|
|
|
- // 表单验证规则
|
|
|
- rules: {
|
|
|
- name: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
- version: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
- type: {
|
|
|
- required: true,
|
|
|
- message: '请选择',
|
|
|
- trigger: 'change'
|
|
|
+ status: {
|
|
|
+ required: true,
|
|
|
+ message: '请选择',
|
|
|
+ trigger: 'change'
|
|
|
+ }
|
|
|
},
|
|
|
+ visible: false,
|
|
|
+ type: null,
|
|
|
+ title: null,
|
|
|
+ loading: false
|
|
|
+ };
|
|
|
+ },
|
|
|
|
|
|
- status: {
|
|
|
- required: true,
|
|
|
- message: '请选择',
|
|
|
- trigger: 'change'
|
|
|
+ created() {},
|
|
|
+ methods: {
|
|
|
+ open(type, row) {
|
|
|
+ this.title = type == 'add' ? '新增' : 'edit' ? '编辑' : '详情';
|
|
|
+ this.type = type;
|
|
|
+ if (this.type != 'add') {
|
|
|
+ row.linePoints = row.linePoints || [];
|
|
|
+ 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;
|
|
|
},
|
|
|
- visible: false,
|
|
|
- type: null,
|
|
|
- title: null,
|
|
|
- loading: false
|
|
|
- };
|
|
|
- },
|
|
|
-
|
|
|
- created() { },
|
|
|
- methods: {
|
|
|
- open(type, row) {
|
|
|
- this.title = type == 'add' ? '新增' : 'edit' ? '编辑' : '详情';
|
|
|
- this.type = type;
|
|
|
- if (this.type != 'add') {
|
|
|
- row.linePoints = row.linePoints || []
|
|
|
- if (!row.parameterStandards) {
|
|
|
- row.parameterStandards = [];
|
|
|
- } else {
|
|
|
- row.singleWeightDivision =
|
|
|
- row.parameterStandards[0]?.singleWeightDivision;
|
|
|
- row.tolerance = row.parameterStandards[0]?.tolerance;
|
|
|
- row.parameterType = row.parameterStandards[0]?.parameterType;
|
|
|
+ openEdit(type, row) {
|
|
|
+ this.$refs.edit.open(type, row);
|
|
|
+ },
|
|
|
+ choose(data) {
|
|
|
+ if (this.activeName == '质检点') {
|
|
|
+ this.form.linePoints = data;
|
|
|
+ return;
|
|
|
}
|
|
|
- this.form = JSON.parse(JSON.stringify(row));
|
|
|
- }
|
|
|
- this.visible = true;
|
|
|
- },
|
|
|
- openEdit(type, row) {
|
|
|
- this.$refs.edit.open(type, row);
|
|
|
- },
|
|
|
- choose(data) {
|
|
|
- if (this.activeName == '质检点') {
|
|
|
- this.form.linePoints = data;
|
|
|
- return;
|
|
|
- }
|
|
|
- let obj = {
|
|
|
- finalValue: data.parameter?.maxValue,
|
|
|
- initialValue: data.parameter?.minValue,
|
|
|
- toleranceValue: data.project?.inspectionStandard,
|
|
|
- symbol: data.project?.symbol,
|
|
|
- singleWeightDivision:
|
|
|
- data.parameter?.name + ' ' + data.parameter?.unitName,
|
|
|
- tolerance: data.project?.inspectionName + ' ' + data.project?.unit,
|
|
|
- parameterType: data.parameter?.textType,
|
|
|
- defaultValue: data.parameter?.defaultValue
|
|
|
- };
|
|
|
- this.$set(this.form, 'singleWeightDivision', obj.singleWeightDivision);
|
|
|
- this.$set(this.form, 'tolerance', obj.tolerance);
|
|
|
- this.form.parameterType = obj.parameterType;
|
|
|
- this.form.parameterStandards.push(obj);
|
|
|
- },
|
|
|
- add() {
|
|
|
- if (this.activeName == '质检点') {
|
|
|
- this.$refs.equipmentDialogRef.open(this.form.linePoints.map(item => item.id));
|
|
|
- return;
|
|
|
- }
|
|
|
- if (!this.form.parameterStandards.length) {
|
|
|
- this.$refs.standardDialogRef.open();
|
|
|
- return;
|
|
|
- }
|
|
|
- let obj = {
|
|
|
- finalValue: '',
|
|
|
- initialValue: '',
|
|
|
- toleranceValue: '',
|
|
|
- singleWeightDivision: '',
|
|
|
- tolerance: ''
|
|
|
- };
|
|
|
- this.form.parameterStandards.push(obj);
|
|
|
- },
|
|
|
- handleDeleteItem(index, list) {
|
|
|
- this.form[list].splice(index, 1);
|
|
|
- },
|
|
|
- /* 保存编辑 */
|
|
|
- save() {
|
|
|
- this.$refs.form.validate((valid) => {
|
|
|
- if (!valid) {
|
|
|
- return false;
|
|
|
+ let obj = {
|
|
|
+ finalValue: data.parameter?.maxValue,
|
|
|
+ initialValue: data.parameter?.minValue,
|
|
|
+ toleranceValue: data.project?.inspectionStandard,
|
|
|
+ symbol: data.project?.symbol,
|
|
|
+ singleWeightDivision:
|
|
|
+ data.parameter?.name + ' ' + data.parameter?.unitName,
|
|
|
+ tolerance: data.project?.inspectionName + ' ' + data.project?.unit,
|
|
|
+ parameterType: data.parameter?.textType,
|
|
|
+ defaultValue: data.parameter?.defaultValue
|
|
|
+ };
|
|
|
+ this.$set(this.form, 'singleWeightDivision', obj.singleWeightDivision);
|
|
|
+ this.$set(this.form, 'tolerance', obj.tolerance);
|
|
|
+ this.form.parameterType = obj.parameterType;
|
|
|
+ this.form.parameterStandards.push(obj);
|
|
|
+ },
|
|
|
+ add() {
|
|
|
+ if (this.activeName == '质检点') {
|
|
|
+ this.$refs.equipmentDialogRef.open(
|
|
|
+ this.form.linePoints.map((item) => item.id)
|
|
|
+ );
|
|
|
+ return;
|
|
|
}
|
|
|
- this.loading = true;
|
|
|
- if (this.type == 'add') {
|
|
|
- delete this.form.id;
|
|
|
+ if (!this.form.parameterStandards.length) {
|
|
|
+ this.$refs.standardDialogRef.open();
|
|
|
+ return;
|
|
|
}
|
|
|
- // this.form.inspectionId = this.$refs.inspectionProjectRef.getValue();
|
|
|
+ let obj = {
|
|
|
+ finalValue: '',
|
|
|
+ initialValue: '',
|
|
|
+ toleranceValue: '',
|
|
|
+ singleWeightDivision: '',
|
|
|
+ tolerance: ''
|
|
|
+ };
|
|
|
+ this.form.parameterStandards.push(obj);
|
|
|
+ },
|
|
|
+ handleDeleteItem(index, list) {
|
|
|
+ this.form[list].splice(index, 1);
|
|
|
+ },
|
|
|
+ /* 保存编辑 */
|
|
|
+ save() {
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
+ if (!valid) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ this.loading = true;
|
|
|
+ if (this.type == 'add') {
|
|
|
+ delete this.form.id;
|
|
|
+ }
|
|
|
+ // this.form.inspectionId = this.$refs.inspectionProjectRef.getValue();
|
|
|
|
|
|
- let URL = this.type == 'add' ? save : update;
|
|
|
- URL(this.form)
|
|
|
- .then((msg) => {
|
|
|
- this.loading = false;
|
|
|
- this.$message.success(msg);
|
|
|
- this.handleClose();
|
|
|
- this.$emit('done');
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
- restForm() {
|
|
|
- this.form = { ...this.defaultForm() };
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.form.clearValidate();
|
|
|
- });
|
|
|
- },
|
|
|
- handleClose() {
|
|
|
- this.restForm();
|
|
|
- this.visible = false;
|
|
|
+ let URL = this.type == 'add' ? save : update;
|
|
|
+ URL(this.form)
|
|
|
+ .then((msg) => {
|
|
|
+ this.loading = false;
|
|
|
+ this.$message.success(msg);
|
|
|
+ this.handleClose();
|
|
|
+ this.$emit('done');
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ restForm() {
|
|
|
+ this.form = { ...this.defaultForm() };
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.form.clearValidate();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleClose() {
|
|
|
+ this.restForm();
|
|
|
+ this.visible = false;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-};
|
|
|
+ };
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.location-warp {
|
|
|
- display: flex;
|
|
|
+ .location-warp {
|
|
|
+ display: flex;
|
|
|
|
|
|
- .detail {
|
|
|
- margin-left: 10px;
|
|
|
+ .detail {
|
|
|
+ margin-left: 10px;
|
|
|
+ }
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
-: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-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;
|
|
|
-}
|
|
|
+ :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;
|
|
|
-}
|
|
|
+ .add-product {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: flex-end;
|
|
|
+ font-size: 30px;
|
|
|
+ color: #1890ff;
|
|
|
+ margin: 10px 0;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
</style>
|