ysy 1 yıl önce
ebeveyn
işleme
3125e3fd84

+ 190 - 9
src/views/inspectionPoint/components/newEdit.vue

@@ -46,10 +46,78 @@
         </el-col>
       </el-row>
       <el-row>
-        <inspectionProjectList
-          @openAdd="openAdd"
-          :inspectList="inspectList"
-        ></inspectionProjectList>
+        <ele-pro-table
+          ref="table"
+          :columns="columns"
+          :datasource="inspectionItems"
+          :need-page="false"
+          height="calc(100vh - 435px)"
+          full-height="calc(100vh - 156px)"
+          tool-class="ele-toolbar-form"
+          cache-key="newInspectionProjectList"
+          row-key="id"
+        >
+          <!-- 表头工具栏 -->
+          <template v-slot:toolbar>
+            <el-button
+              size="small"
+              type="primary"
+              icon="el-icon-plus"
+              class="ele-btn-icon"
+              @click="openAdd()"
+            >
+              添加质检项
+            </el-button>
+          </template>
+
+          <template v-slot:textType="{ row }">
+            {{
+              row.textType == 1
+                ? '数值'
+                : row.textType == 2
+                ? '选择'
+                : row.textType == 3
+                ? '上下限'
+                : row.textType == 4
+                ? '规格'
+                : row.textType == 5
+                ? '时间'
+                : row.textType == 6
+                ? '范围'
+                : ''
+            }}
+          </template>
+
+          <template v-slot:type="{ row }">
+            {{ getDictValue('质检标准类型', row.type) }}
+          </template>
+
+          <template v-slot:toolList="{ row }">
+            <div
+              style="display: inline-block"
+              v-for="(item, idx) in row.toolList"
+              :key="idx"
+              >{{ item.name }}
+              <span v-if="row.toolList && idx != row.toolList.length - 1"
+                >,
+              </span></div
+            >
+          </template>
+
+          <template v-slot:action="{ row, $index }">
+            <el-popconfirm
+              class="ele-action"
+              title="确定要删除此质检项吗?"
+              @confirm="remove($index)"
+            >
+              <template v-slot:reference>
+                <el-link type="danger" :underline="false" icon="el-icon-delete">
+                  删除
+                </el-link>
+              </template>
+            </el-popconfirm>
+          </template>
+        </ele-pro-table>
       </el-row>
     </el-form>
     <template v-slot:footer>
@@ -77,13 +145,16 @@
   import { save, update } from '@/api/inspectionPoint';
   import fileUpload from '@/components/upload/fileUpload';
   import EquipmentDialog from './newEquipmentDialog';
-  import inspectionProjectList from './newInspectionProjectList';
 
+
+
+  import dictMixins from '@/mixins/dictMixins';
   export default {
+    mixins: [dictMixins],
     components: {
       fileUpload,
       EquipmentDialog,
-      inspectionProjectList
+
     },
 
     props: {
@@ -111,13 +182,117 @@
         loading: false,
 
         showEquipment: false,
-        inspectList: []
+        inspectionItems: [],
+
+        columns: [
+          {
+            prop: 'categoryLevelName',
+            label: '质检类型',
+            align: 'center',
+            minWidth: 110
+          },
+          {
+            prop: 'inspectionCode',
+            label: '参数编码',
+            align: 'center',
+            minWidth: 110
+          },
+
+          {
+            prop: 'inspectionName',
+            label: '参数名称',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+
+          {
+            prop: 'textType',
+            label: '参数类型',
+            showOverflowTooltip: true,
+            align: 'center',
+            slot: 'textType',
+            minWidth: 110
+          },
+
+          {
+            prop: 'maxValue',
+            label: '参数上限',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'minValue',
+            label: '参数下限',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'defaultValue',
+            label: '默认值',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '工艺要求',
+            prop: 'inspectionStandard',
+            formatter: (row, column, cellValue) => {
+              return row.symbol + ' ' + cellValue + ' ' + row.unit;
+            },
+            minWidth: 150
+          },
+          {
+            label: '标准类型',
+            prop: 'type',
+            slot: 'type'
+          },
+
+          {
+            prop: 'qualityStandardName',
+            label: '标准名称',
+            align: 'center',
+            minWidth: 110
+          },
+
+          {
+            label: '状态',
+            prop: 'status',
+            formatter: (row, column, cellValue) => {
+              return cellValue == 1 ? '启用' : cellValue === 0 ? '停用' : '';
+            }
+          },
+
+          {
+            prop: 'toolList',
+            slot: 'toolList',
+            label: '设备名称',
+            align: 'center',
+            minWidth: 150
+          },
+
+          {
+            label: '备注',
+            prop: 'inspectionRemark'
+          },
+          {
+            label: '操作',
+            slot: 'action',
+            fixed: 'right',
+            showOverflowTooltip: true
+          }
+        ]
       };
     },
 
     created() {
       if (this.type == 'edit') {
         this.form = this.editObj;
+        if (this.editObj.inspectionItems.length > 0) {
+ 
+          this.inspectionItems = this.editObj.inspectionItems;
+        } else {
+          this.inspectionItems = []
+        }
       }
     },
     methods: {
@@ -129,7 +304,9 @@
 
           let param = {
             ...this.form,
-            qualityLevelList: this.inspectList.map((item) => item.id)
+            qualityLevelList: this.inspectionItems.map(
+              (item) => item.qualityLevelId
+            )
           };
 
           let URL = this.type == 'add' ? save : update;
@@ -152,12 +329,16 @@
         this.showEquipment = true;
       },
 
+      remove(index) {
+        this.inspectionItems = this.inspectionItems.splice(index, 1);
+      },
+
       closeDialog() {
         this.showEquipment = false;
       },
 
       chooseModal(list) {
-        this.inspectList = list || [];
+        this.inspectionItems = list || [];
       }
     }
   };

+ 0 - 1
src/views/inspectionPoint/components/newEquipmentDialog.vue

@@ -281,7 +281,6 @@
 
         _arr = this.selection.map((m) => {
           return {
-            parentId: m.id,
             ...m.itemVO
           };
         });

+ 0 - 228
src/views/inspectionPoint/components/newInspectionProjectList.vue

@@ -1,228 +0,0 @@
-<template>
-  <div>
-    <ele-pro-table
-      ref="table"
-      :columns="columns"
-      :datasource="datasource"
-      height="calc(100vh - 435px)"
-      full-height="calc(100vh - 156px)"
-      tool-class="ele-toolbar-form"
-      cache-key="newInspectionProjectList"
-      row-key="id"
-    >
-      <!-- 表头工具栏 -->
-      <template v-slot:toolbar>
-        <el-button
-          size="small"
-          type="primary"
-          icon="el-icon-plus"
-          class="ele-btn-icon"
-          @click="openAdd()"
-        >
-          添加质检项
-        </el-button>
-      </template>
-
-      <template v-slot:textType="{ row }">
-        {{
-          row.textType == 1
-            ? '数值'
-            : row.textType == 2
-            ? '选择'
-            : row.textType == 3
-            ? '上下限'
-            : row.textType == 4
-            ? '规格'
-            : row.textType == 5
-            ? '时间'
-            : row.textType == 6
-            ? '范围'
-            : ''
-        }}
-      </template>
-
-      <template v-slot:type="{ row }">
-        {{ getDictValue('质检标准类型', row.type) }}
-      </template>
-
-      <template v-slot:toolList="{ row }">
-        <div
-          style="display: inline-block"
-          v-for="(item, idx) in row.toolList"
-          :key="idx"
-          >{{ item.name }}
-          <span v-if="row.toolList && idx != row.toolList.length - 1"
-            >,
-          </span></div
-        >
-      </template>
-
-      <template v-slot:action="{ row, $index }">
-        <el-popconfirm
-          class="ele-action"
-          title="确定要删除此质检项吗?"
-          @confirm="remove(row)"
-        >
-          <template v-slot:reference>
-            <el-link type="danger" :underline="false" icon="el-icon-delete">
-              删除
-            </el-link>
-          </template>
-        </el-popconfirm>
-      </template>
-    </ele-pro-table>
-  </div>
-</template>
-
-<script>
-  import dictMixins from '@/mixins/dictMixins';
-  export default {
-    mixins: [dictMixins],
-
-    props: {
-      inspectList: {
-        type: Array,
-        default() {
-          return [];
-        }
-      }
-    },
-
-    watch: {
-      inspectList: {
-        handler(list) {
-          this.$nextTick(() => {
-            if (list.length > 0) {
-              this.$refs.table.setData([...list]);
-            } else {
-              this.$refs.table.setData([]);
-            }
-          });
-        },
-        immediate: true,
-        deep: true
-      }
-    },
-
-    data() {
-      return {
-        columns: [
-        {
-            prop: 'categoryLevelName',
-            label: '质检类型',
-            align: 'center',
-            minWidth: 110
-          },
-          {
-            prop: 'inspectionCode',
-            label: '参数编码',
-            align: 'center',
-            minWidth: 110
-          },
-
-
-      
-          {
-            prop: 'inspectionName',
-            label: '参数名称',
-            showOverflowTooltip: true,
-            align: 'center',
-            minWidth: 110
-          },
-
-          {
-            prop: 'textType',
-            label: '参数类型',
-            showOverflowTooltip: true,
-            align: 'center',
-            slot: 'textType',
-            minWidth: 110
-          },
-
-          {
-            prop: 'maxValue',
-            label: '参数上限',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'minValue',
-            label: '参数下限',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'defaultValue',
-            label: '默认值',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            label: '工艺要求',
-            prop: 'inspectionStandard',
-            formatter: (row, column, cellValue) => {
-              return row.symbol + ' ' + cellValue + ' ' + row.unit;
-            },
-            minWidth: 150
-          },
-          {
-            label: '标准类型',
-            prop: 'type',
-            slot: 'type'
-          },
-
-          {
-            prop: 'qualityStandardName',
-            label: '标准名称',
-            align: 'center',
-            minWidth: 110
-          },
-
-          {
-            label: '状态',
-            prop: 'status',
-            formatter: (row, column, cellValue) => {
-              return cellValue == 1 ? '启用' : cellValue === 0 ? '停用' : '';
-            }
-          },
-
-          {
-            prop: 'toolList',
-            slot: 'toolList',
-            label: '设备名称',
-            align: 'center',
-            minWidth: 150
-          },
-
-          {
-            label: '备注',
-            prop: 'inspectionRemark'
-          },
-          {
-            label: '操作',
-            slot: 'action',
-            showOverflowTooltip: true
-          }
-        ]
-      };
-    },
-
-    created() {},
-    methods: {
-      datasource() {
-        return [];
-      },
-
-      remove(index) {
-        let _list = this.$refs.table.getData() || [];
-        _list.splice(index, 1);
-        this.$refs.table.setData([..._list]);
-      },
-      openAdd() {
-        this.$emit('openAdd');
-      }
-    }
-  };
-</script>
-
-<style lang="scss" scoped></style>

+ 4 - 6
src/views/inspectionPoint/index.vue

@@ -128,9 +128,7 @@
         showEdit: false
       };
     },
-    created() {
-      
-    },
+    created() {},
     methods: {
       datasource({ page, where, limit }) {
         return getList({
@@ -152,8 +150,8 @@
       },
       close(val) {
         this.showEdit = false;
-        if(val) {
-        this.reload()
+        if (val) {
+          this.reload();
         }
       },
 
@@ -164,7 +162,7 @@
         removeItem([row.id])
           .then((message) => {
             this.$message.success(message);
-    
+            this.reload()
           })
           .catch((e) => {});
       }