|
|
@@ -5,7 +5,7 @@
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
<el-row>
|
|
|
|
|
|
-
|
|
|
+
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="质检名称:" prop="name">
|
|
|
<el-input clearable v-model="form.name" placeholder="请输入" />
|
|
|
@@ -26,14 +26,14 @@
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="标准类型:" prop="type">
|
|
|
+ <el-form-item label="标准类型:" prop="type">
|
|
|
<DictSelection dictName="质检标准类型" v-model="form.type"></DictSelection>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="标准代码:" prop="standardCode">
|
|
|
- <el-input v-model="form.standardCode"></el-input>
|
|
|
+ <el-form-item label="标准代码:" prop="standardCode">
|
|
|
+ <el-input v-model="form.standardCode"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
@@ -41,19 +41,98 @@
|
|
|
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
+
|
|
|
+ <headerTitle title="质检工具">
|
|
|
+ <el-button type="primary" size="small" @click="handleAdd">新增</el-button>
|
|
|
+ </headerTitle>
|
|
|
+
|
|
|
+ <el-table ref="multipleTable" :data="form.toolList" tooltip-effect="dark" style="width: 100%" stripe
|
|
|
+ :header-cell-style="{ background: '#EEEEEE', border: 'none' }">
|
|
|
+
|
|
|
+
|
|
|
+ <el-table-column label="设备名称" prop="code" min-width="120">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ {{ row.name }}
|
|
|
+ </template></el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="设备编码" prop="code" min-width="120">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ {{ row.code }}
|
|
|
+ </template></el-table-column>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <el-table-column label="操作" fixed="right">
|
|
|
+ <template slot-scope="{ $index, row }">
|
|
|
+ <el-button type="text" @click="removeItem($index, row)">删除设备</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <headerTitle title="质检注意事项">
|
|
|
+ <el-button type="primary" size="small" @click="addPostscript">新增</el-button>
|
|
|
+ </headerTitle>
|
|
|
+
|
|
|
+
|
|
|
+ <el-table ref="multipleTable" :data="form.postscriptList" tooltip-effect="dark" style="width: 100%" stripe
|
|
|
+ :header-cell-style="{ background: '#EEEEEE', border: 'none' }">
|
|
|
+
|
|
|
+
|
|
|
+ <el-table-column label="排序" prop="" width="220">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-input placeholder="请输入" type="number" v-model.number="row.sort
|
|
|
+ " clearable></el-input>
|
|
|
+ </template></el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="注意事项" prop="" min-width="120">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-input placeholder="请输入" type="textarea" :rows="1" v-model="row.content
|
|
|
+ " clearable></el-input>
|
|
|
+ </template></el-table-column>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <el-table-column label="操作" fixed="right">
|
|
|
+ <template slot-scope="{ $index, row }">
|
|
|
+ <el-button type="text" @click="removePostscript($index, row)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
<template v-slot:footer>
|
|
|
<el-button @click="handleClose">取消</el-button>
|
|
|
<el-button type="primary" :loading="loading" @click="save">
|
|
|
保存
|
|
|
</el-button>
|
|
|
</template>
|
|
|
+
|
|
|
+
|
|
|
+ <ProductModal ref="productRefs" @chooseModal="chooseModal" />
|
|
|
+
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
-import { save, update } from '@/api/inspectionStandard';
|
|
|
+import { save, update, getById } from '@/api/inspectionStandard';
|
|
|
+import ProductModal from './ProductModal.vue'
|
|
|
export default {
|
|
|
+ components: {
|
|
|
+ ProductModal
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
|
|
|
data() {
|
|
|
const defaultForm = function () {
|
|
|
@@ -63,7 +142,11 @@ export default {
|
|
|
status: '',
|
|
|
type: '',
|
|
|
version: '',
|
|
|
- standardCode: ''
|
|
|
+ standardCode: '',
|
|
|
+ toolList: [],
|
|
|
+ postscriptList: [],
|
|
|
+ toolRemoveIds: [],
|
|
|
+ postscriptRemoveIds: []
|
|
|
};
|
|
|
};
|
|
|
return {
|
|
|
@@ -103,14 +186,21 @@ export default {
|
|
|
open(type, row) {
|
|
|
this.title = type == 'add' ? '新增' : '编辑'
|
|
|
this.type = type;
|
|
|
- if(this.type =='edit') {
|
|
|
- this.form = row
|
|
|
+ if (this.type == 'edit') {
|
|
|
+
|
|
|
+ this.getDetail(row.id)
|
|
|
}
|
|
|
this.visible = true;
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
+ getDetail(id) {
|
|
|
+ getById(id).then(res => {
|
|
|
+ this.form = res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
/* 保存编辑 */
|
|
|
save() {
|
|
|
this.$refs.form.validate((valid) => {
|
|
|
@@ -145,6 +235,46 @@ export default {
|
|
|
this.visible = false;
|
|
|
},
|
|
|
|
|
|
+ handleAdd() {
|
|
|
+ this.$refs.productRefs.open(this.form.toolList)
|
|
|
+ },
|
|
|
+
|
|
|
+ chooseModal(data) {
|
|
|
+ this.form.toolList = data
|
|
|
+ console.log(data)
|
|
|
+ },
|
|
|
+
|
|
|
+ removeItem(idx, row) {
|
|
|
+ if (this.form.toolList.length == 1) {
|
|
|
+ return this.$message.error('至少保留一个设备!');
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$confirm(`是否删除这个设备?`).then(async () => {
|
|
|
+ this.form.toolList.splice(idx, 1)
|
|
|
+
|
|
|
+
|
|
|
+ this.form.toolRemoveIds.push(row.id)
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ addPostscript() {
|
|
|
+ this.form.postscriptList.push({ sort: null, content: '' })
|
|
|
+ },
|
|
|
+ removePostscript(idx, row) {
|
|
|
+ if (this.form.postscriptList.length == 1) {
|
|
|
+ return this.$message.error('至少保留一个事项!');
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$confirm(`是否删除这个事项?`).then(async () => {
|
|
|
+ this.form.postscriptList.splice(idx, 1)
|
|
|
+
|
|
|
+
|
|
|
+ this.form.postscriptRemoveIds.push(row.id)
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
|
|
|
}
|
|
|
};
|