|
@@ -1,280 +0,0 @@
|
|
|
-<!-- 用户编辑弹窗 -->
|
|
|
|
|
-<template>
|
|
|
|
|
- <el-dialog class="ele-dialog-form" title="编辑" v-if="visible" :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="mode">
|
|
|
|
|
- <DictSelection dictName="质检方式" v-model="form.mode"></DictSelection>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-col>
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- </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="牌号" prop="brandNum" min-width="120">
|
|
|
|
|
- <template slot-scope="{ row }">
|
|
|
|
|
- {{ row.brandNum }}
|
|
|
|
|
- </template></el-table-column>
|
|
|
|
|
-
|
|
|
|
|
- <el-table-column label="型号" prop="modelType" min-width="120">
|
|
|
|
|
- <template slot-scope="{ row }">
|
|
|
|
|
- {{ row.modelType }}
|
|
|
|
|
- </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="100">
|
|
|
|
|
- <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" width="100">
|
|
|
|
|
- <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 { update, getById } from '@/api/inspectionClassify';
|
|
|
|
|
-import ProductModal from './ProductModal.vue'
|
|
|
|
|
-export default {
|
|
|
|
|
- components: {
|
|
|
|
|
- ProductModal
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- data() {
|
|
|
|
|
- const defaultForm = function () {
|
|
|
|
|
- return {
|
|
|
|
|
- id: '',
|
|
|
|
|
- name: '',
|
|
|
|
|
- status: 1,
|
|
|
|
|
- type: '',
|
|
|
|
|
- version: '1.0',
|
|
|
|
|
- standardCode: '',
|
|
|
|
|
- toolList: [],
|
|
|
|
|
- postscriptList: [],
|
|
|
|
|
- toolRemoveIds: [],
|
|
|
|
|
- postscriptRemoveIds: []
|
|
|
|
|
- };
|
|
|
|
|
- };
|
|
|
|
|
- return {
|
|
|
|
|
- defaultForm,
|
|
|
|
|
- // 表单数据
|
|
|
|
|
- form: { ...defaultForm() },
|
|
|
|
|
- // 表单验证规则
|
|
|
|
|
- rules: {
|
|
|
|
|
-
|
|
|
|
|
- name: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
|
|
-
|
|
|
|
|
- type: {
|
|
|
|
|
- required: true,
|
|
|
|
|
- message: '请选择',
|
|
|
|
|
- trigger: 'change'
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
- visible: false,
|
|
|
|
|
-
|
|
|
|
|
- title: null,
|
|
|
|
|
- loading: false,
|
|
|
|
|
-
|
|
|
|
|
- };
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- created() {
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
- methods: {
|
|
|
|
|
- open(row) {
|
|
|
|
|
-
|
|
|
|
|
- this.getDetail(row.id)
|
|
|
|
|
- this.visible = true;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- getDetail(id) {
|
|
|
|
|
- getById(id).then(res => {
|
|
|
|
|
- if (!res.data.version) {
|
|
|
|
|
- res.data.version = '1.0'
|
|
|
|
|
- }
|
|
|
|
|
- this.form = res.data
|
|
|
|
|
- this.form['postscriptRemoveIds'] = []
|
|
|
|
|
- this.form['toolRemoveIds'] = []
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- /* 保存编辑 */
|
|
|
|
|
- save() {
|
|
|
|
|
- this.$refs.form.validate((valid) => {
|
|
|
|
|
- if (!valid) {
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- this.loading = true;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- update(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() };
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
- handleClose() {
|
|
|
|
|
- this.restForm();
|
|
|
|
|
- this.visible = false;
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- handleAdd() {
|
|
|
|
|
- this.$refs.productRefs.open(this.form.toolList)
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- chooseModal(data) {
|
|
|
|
|
- this.form.toolList = [...this.form.toolList, ...data]
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- removeItem(idx, row) {
|
|
|
|
|
- if (this.form.toolList.length == 1) {
|
|
|
|
|
- return this.$message.error('至少保留一个设备!');
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- this.$confirm(`是否删除这个设备?`).then(async () => {
|
|
|
|
|
- this.form.toolList.splice(idx, 1)
|
|
|
|
|
-
|
|
|
|
|
- if (row.id) {
|
|
|
|
|
- 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)
|
|
|
|
|
- if (row.id) {
|
|
|
|
|
- this.form.postscriptRemoveIds.push(row.id)
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-};
|
|
|
|
|
-</script>
|
|
|
|
|
-<style lang="scss" scoped>
|
|
|
|
|
-.location-warp {
|
|
|
|
|
- display: flex;
|
|
|
|
|
-
|
|
|
|
|
- .detail {
|
|
|
|
|
- margin-left: 10px;
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-:deep(.el-dialog:not(.ele-dialog-form) .el-dialog__body .el-form .el-form-item:last-child) {
|
|
|
|
|
- margin-bottom: 22px;
|
|
|
|
|
-}
|
|
|
|
|
-</style>
|
|
|