Sfoglia il codice sorgente

提交质检方案功能页面

PC-202503171525\Administrator 1 anno fa
parent
commit
c8b96ac0f9

+ 59 - 0
src/api/inspectionTemplate/index.js

@@ -0,0 +1,59 @@
+import request from '@/utils/request';
+
+export async function pageByBom (data) {
+  let par = new URLSearchParams(data);
+  const res = await request.get(`/qms/qualitylevel/pageByBom?` + par, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+
+// 新增
+export async function save(data) {
+  const res = await request.post(`/qms/qualitytemplate/save`, data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 编辑
+export async function update(data) {
+  const res = await request.put(`/qms/qualitytemplate/update`, data);
+  if (res.data.code == 0) {
+    return res.data.message;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 获取详情
+export async function getById(id) {
+  const res = await request.get(`/qms/qualitytemplate/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+
+// 删除
+export async function removeItem(data) {
+  const res = await request.delete('/qms/qualitytemplate/delete', {
+    data
+  });
+  if (res.data.code == 0) {
+    return res.data.message;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 列表
+
+export async function getList(data) {
+  let par = new URLSearchParams(data);
+  const res = await request.get(`/qms/qualitytemplate/page?` + par, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 0 - 10
src/api/qualityInspectionPlan/index.js

@@ -1,10 +0,0 @@
-import request from '@/utils/request';
-
-export async function pageByBom (data) {
-  let par = new URLSearchParams(data);
-  const res = await request.get(`/qms/qualitylevel/pageByBom?` + par, {});
-  if (res.data.code == 0) {
-    return res.data.data;
-  }
-  return Promise.reject(new Error(res.data.message));
-}

+ 24 - 23
src/views/inspectionClassify/components/user-list.vue

@@ -39,8 +39,6 @@
             ? '时间'
             ? '时间'
             : row.itemVO.textType == 6
             : row.itemVO.textType == 6
             ? '范围'
             ? '范围'
-            : row.itemVO.textType == 7
-            ? '文本'
             : ''
             : ''
         }}
         }}
       </template>
       </template>
@@ -49,10 +47,6 @@
         {{ getDictValue('质检标准类型', row.itemVO.qualityStandardType) }}
         {{ getDictValue('质检标准类型', row.itemVO.qualityStandardType) }}
       </template>
       </template>
 
 
-      <template v-slot:defaultValue="{ row }">
-        <span v-if="row.itemVO.defaultValue">{{ row.itemVO.symbol }}</span>
-        {{ row.itemVO.defaultValue }}
-      </template>
       <template v-slot:toolList="{ row }">
       <template v-slot:toolList="{ row }">
         <div
         <div
           style="display: inline-block"
           style="display: inline-block"
@@ -113,6 +107,13 @@
         columns: [
         columns: [
           {
           {
             prop: 'itemVO.categoryLevelClassName',
             prop: 'itemVO.categoryLevelClassName',
+            label: '质检分类层级',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150
+          },
+          {
+            prop: 'itemVO.categoryLevelName',
             label: '质检类型',
             label: '质检类型',
             align: 'center',
             align: 'center',
             minWidth: 110
             minWidth: 110
@@ -140,13 +141,7 @@
             slot: 'textType',
             slot: 'textType',
             minWidth: 110
             minWidth: 110
           },
           },
-          {
-            prop: 'itemVO.defaultValue',
-            label: '默认值',
-            align: 'center',
-            showOverflowTooltip: true,
-            slot: 'defaultValue'
-          },
+
           {
           {
             prop: 'itemVO.maxValue',
             prop: 'itemVO.maxValue',
             label: '参数上限',
             label: '参数上限',
@@ -159,16 +154,22 @@
             align: 'center',
             align: 'center',
             showOverflowTooltip: true
             showOverflowTooltip: true
           },
           },
-          // {
-          //   label: '工艺要求',
-          //   prop: 'itemVO.inspectionStandard',
-          //   formatter: (row, column, cellValue) => {
-          //     return (
-          //       row.itemVO.symbol + ' ' + cellValue + ' ' + row.itemVO.unit
-          //     );
-          //   },
-          //   minWidth: 150
-          // },
+          {
+            prop: 'itemVO.defaultValue',
+            label: '默认值',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '工艺要求',
+            prop: 'itemVO.inspectionStandard',
+            formatter: (row, column, cellValue) => {
+              return (
+                row.itemVO.symbol + ' ' + cellValue + ' ' + row.itemVO.unit
+              );
+            },
+            minWidth: 150
+          },
           {
           {
             label: '标准类型',
             label: '标准类型',
             prop: 'itemVO.type',
             prop: 'itemVO.type',

+ 17 - 5
src/views/inspectionPlan/components/edit.vue

@@ -162,9 +162,21 @@
           <el-form-item label="附件:" prop="accessory">
           <el-form-item label="附件:" prop="accessory">
             <fileUpload
             <fileUpload
               v-model="form.accessory"
               v-model="form.accessory"
-             
+
+            />
+
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row>
+        <el-col :span="24">
+          <el-form-item label="备注:" prop="remark">
+            <el-input
+              type="textarea"
+              v-model="form.remark"
+              placeholder="请输入"
+              :disabled="type == 'detail' || type == 'issued'"
             />
             />
-            
           </el-form-item>
           </el-form-item>
         </el-col>
         </el-col>
       </el-row>
       </el-row>
@@ -317,7 +329,7 @@
           productList: [],
           productList: [],
           qualityMode: '',
           qualityMode: '',
 
 
-        
+
         };
         };
       };
       };
       return {
       return {
@@ -416,7 +428,7 @@
             return;
             return;
           }
           }
 
 
-    
+
 
 
            let isBol  = this.form.productList.every((e, i) => e.productNumber && e.produceRoutingId)
            let isBol  = this.form.productList.every((e, i) => e.productNumber && e.produceRoutingId)
            if(!isBol) {
            if(!isBol) {
@@ -424,7 +436,7 @@
             return;
             return;
           }
           }
 
 
-     
+
 
 
 
 
           this.loading = true;
           this.loading = true;

+ 71 - 0
src/views/inspectionTemplate/components/search.vue

@@ -0,0 +1,71 @@
+<!-- 搜索表单 --> 6
+<template>
+  <el-form label-width="100px" class="ele-form-search" @keyup.enter.native="search" @submit.native.prevent>
+    <el-row :gutter="15">
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 10 } : { span: 6}">
+        <el-form-item label="质检方案名称:">
+          <el-input clearable v-model="where.qualitySchemeTemplateName" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 10 } : { span: 6}">
+        <el-form-item label="质检方案编码:">
+          <el-input clearable v-model="where.qualitySchemeTemplateCode" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 10 } : { span: 6}">
+        <el-form-item label="状态:" >
+          <el-select v-model="where.status" class="m-2" placeholder="请选择" size="large" style="width: 100%">
+            <el-option label="停用" :value="0" />
+            <el-option label="启用" :value="1" />
+          </el-select>
+        </el-form-item>
+      </el-col>
+      <el-col style="display: flex;justify-content: flex-end" v-bind="styleResponsive ? { lg: 18, md: 18 } : { span: 18}">
+        <div class="ele-form-actions">
+          <el-button type="primary" icon="el-icon-search" class="ele-btn-icon" @click="search">
+            查询
+          </el-button>
+          <el-button @click="reset">重置</el-button>
+        </div>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<script>
+export default {
+  data() {
+    // 默认表单数据
+    const defaultWhere = {
+      name: '',
+      standardCode: '',
+      status: ''
+    };
+    return {
+      defaultWhere,
+      // 表单数据
+      where: { ...defaultWhere },
+
+    };
+  },
+  computed: {
+    // 是否开启响应式布局
+    styleResponsive() {
+      return this.$store.state.theme.styleResponsive;
+    }
+  },
+  methods: {
+    /* 搜索 */
+    search() {
+      this.$emit('search', this.where);
+    },
+    /*  重置 */
+    reset() {
+
+      this.where = { ...this.defaultWhere };
+      this.search();
+    }
+  }
+};
+</script>

+ 176 - 0
src/views/inspectionTemplate/index.vue

@@ -0,0 +1,176 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never">
+      <search ref="search" @search="search"></search>
+      <ele-pro-table
+        ref="table"
+        :columns="columns"
+        :datasource="datasource"
+        height="calc(100vh - 605px)"
+        tool-class="ele-toolbar-form"
+        cache-key="inspectionClassify"
+        row-key="qualityLevelId"
+        :selection.sync="selection"
+        @selection-change="selectionChangeHandle"
+      >
+        <template v-slot:toolbar>
+          <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon"
+                     @click="addOrUpdateHandle()">
+            新增
+          </el-button>
+          <el-button size="small" type="danger" icon="el-icon-delete" class="ele-btn-icon"
+                     @click="deleteHandle()" :disabled="selection.length <= 0">
+            批量删除
+          </el-button>
+        </template>
+        <template v-slot:status="{ row }">
+          {{ row.status ? '启用' : "停用" }}
+        </template>
+
+        <!-- 操作列 -->
+        <template v-slot:action="{ row }">
+          <el-link type="primary" :underline="false" icon="el-icon-edit" @click="addOrUpdateHandle(row.id)">
+            修改
+          </el-link>
+          <el-popconfirm class="ele-action" title="确定要删除此方案吗?" @confirm="deleteHandle(row.id)">
+            <template v-slot:reference>
+              <el-link type="danger" :underline="false" icon="el-icon-delete">
+                删除
+              </el-link>
+            </template>
+          </el-popconfirm>
+        </template>
+      </ele-pro-table>
+    </el-card>
+    <!-- 弹窗, 新增 / 修改 -->
+    <add-or-update
+      v-if="addOrUpdateVisible"
+      ref="addOrUpdate"
+      @refreshDataList="getDataList"
+    ></add-or-update>
+  </div>
+</template>
+
+<script>
+  import AddOrUpdate from './qualitytemplate-add-or-update';
+  import search from './components/search.vue';
+  import {getList, removeItem} from "@/api/inspectionTemplate";
+  export default {
+    data() {
+      return {
+        dataForm: {
+          key: ''
+        },
+        selection: [],
+        addOrUpdateVisible: false,
+        columns: [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            reserveSelection: true
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'qualitySchemeTemplateCode',
+            label: '质检方案编码',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+          {
+            prop: 'qualitySchemeTemplateName',
+            label: '质检方案名称',
+            align: 'center',
+            minWidth: 150
+          },
+          {
+            label: '状态',
+            prop: 'status',
+            slot: 'status',
+            align: 'center'
+          },
+          {
+            prop: 'templateRemark',
+            label: '备注',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 150,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            fixed: 'right'
+          }
+        ],
+      };
+    },
+    components: {
+      AddOrUpdate,
+      search
+    },
+    methods: {
+      // 获取数据列表
+      datasource({ page, where, limit }) {
+        return getList({
+          ...where,
+          pageNum: page,
+          size: limit,
+        });
+      },
+      // 多选
+      selectionChangeHandle(val) {
+        this.selection = val;
+      },
+      // 新增 / 修改
+      addOrUpdateHandle(id) {
+        this.addOrUpdateVisible = true;
+        this.$refs.addOrUpdate.init(id);
+      },
+      // 删除
+      deleteHandle(id) {
+        var ids = id
+          ? [id]
+          : this.selection.map((item) => {
+              return item.id;
+            });
+        this.$confirm(
+          `确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`,
+          '提示',
+          {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+          }
+        ).then(() => {
+          removeItem(ids).then(({ message }) => {
+            this.$message.success(message);
+            this.getDataList();
+          }).catch((e) => {});
+        });
+      },
+      getDataList(){
+        this.$refs.search.search();
+      },
+      search(where) {
+        this.$refs.table.reload({
+          where: where,
+          page: 1
+        });
+      },
+    }
+  };
+</script>

+ 0 - 0
src/views/qualityInspectionPlan/inspectionClassify/components/user-search.vue → src/views/inspectionTemplate/inspectionClassify/components/user-search.vue


+ 31 - 20
src/views/qualityInspectionPlan/inspectionClassify/index.vue → src/views/inspectionTemplate/inspectionClassify/index.vue

@@ -64,15 +64,20 @@
                 {{ getDictValue('质检标准类型', row.qualityStandardType) }}
                 {{ getDictValue('质检标准类型', row.qualityStandardType) }}
               </template>
               </template>
 
 
-              <template v-slot:defaultValue="{ row }">
-                <div>
-                  <span v-if="row.textType == 3">
-                    [ {{ row.minValue }}-{{ row.maxValue }}]
-                  </span>
-                  <span v-else>{{ row.defaultValue }}</span>
+<!--              <template v-slot:defaultValue="{ row }">-->
+<!--                <div>-->
+<!--                  <span v-if="row.textType == 3">-->
+<!--                    [ {{ row.minValue }}-{{ row.maxValue }}]-->
+<!--                  </span>-->
+<!--                  <span v-else>{{ row.defaultValue }}</span>-->
+
+<!--                  <span> {{ row.unit }}</span>-->
+<!--                </div>-->
+<!--              </template>-->
 
 
-                  <span> {{ row.unit }}</span>
-                </div>
+              <template v-slot:defaultValue="{ row }">
+                <span v-if="row.defaultValue">{{ row.symbol }}</span>
+                {{ row.defaultValue }}
               </template>
               </template>
 
 
               <template v-slot:toolList="{ row }">
               <template v-slot:toolList="{ row }">
@@ -102,7 +107,7 @@
 <script>
 <script>
   import AssetTree from '@/components/AssetTree';
   import AssetTree from '@/components/AssetTree';
   import userSearch from './components/user-search.vue';
   import userSearch from './components/user-search.vue';
-  import { pageByBom } from '@/api/qualityInspectionPlan/index.js';
+  import { pageByBom } from '@/api/inspectionTemplate/index.js';
   import dictMixins from '@/mixins/dictMixins';
   import dictMixins from '@/mixins/dictMixins';
 
 
   export default {
   export default {
@@ -131,11 +136,17 @@
           },
           },
 
 
           {
           {
-            prop: 'categoryLevelName',
+            prop: 'categoryLevelClassName',
             label: '质检类型',
             label: '质检类型',
             align: 'center',
             align: 'center',
-            minWidth: 110
+            minWidth: 150
           },
           },
+          // {
+          //   prop: 'categoryLevelName',
+          //   label: '质检类型',
+          //   align: 'center',
+          //   minWidth: 110
+          // },
 
 
           {
           {
             prop: 'inspectionCode',
             prop: 'inspectionCode',
@@ -164,19 +175,19 @@
           {
           {
             prop: 'defaultValue',
             prop: 'defaultValue',
             slot: 'defaultValue',
             slot: 'defaultValue',
-            label: '工艺参数',
+            label: '默认值',
             align: 'center',
             align: 'center',
             minWidth: 150
             minWidth: 150
           },
           },
 
 
-          {
-            label: '工艺要求',
-            prop: 'inspectionStandard',
-            formatter: (row, column, cellValue) => {
-              return row.symbol + ' ' + cellValue + ' ' + row.unit;
-            },
-            minWidth: 150
-          },
+          // {
+          //   label: '工艺要求',
+          //   prop: 'inspectionStandard',
+          //   formatter: (row, column, cellValue) => {
+          //     return row.symbol + ' ' + cellValue + ' ' + row.unit;
+          //   },
+          //   minWidth: 150
+          // },
           {
           {
             label: '标准类型',
             label: '标准类型',
             prop: 'type',
             prop: 'type',

+ 88 - 108
src/views/qualityInspectionPlan/qualitytemplate-add-or-update.vue → src/views/inspectionTemplate/qualitytemplate-add-or-update.vue

@@ -3,6 +3,7 @@
     :title="!dataForm.id ? '新增' : '修改'"
     :title="!dataForm.id ? '新增' : '修改'"
     :close-on-click-modal="false"
     :close-on-click-modal="false"
     :visible.sync="visible"
     :visible.sync="visible"
+    width="60%"
   >
   >
     <el-form
     <el-form
       :model="dataForm"
       :model="dataForm"
@@ -24,7 +25,7 @@
           <el-form-item label="编码" prop="qualitySchemeTemplateCode">
           <el-form-item label="编码" prop="qualitySchemeTemplateCode">
             <el-input
             <el-input
               v-model="dataForm.qualitySchemeTemplateCode"
               v-model="dataForm.qualitySchemeTemplateCode"
-              placeholder="质检方案编码"
+              placeholder="质检方案编码" disabled
             ></el-input>
             ></el-input>
           </el-form-item>
           </el-form-item>
         </el-col>
         </el-col>
@@ -41,6 +42,16 @@
             </el-select> </el-form-item
             </el-select> </el-form-item
         ></el-col>
         ></el-col>
       </el-row>
       </el-row>
+      <el-row>
+        <el-col :span="24">
+          <el-form-item label="备注" prop="qualitySchemeTemplateRemark">
+            <el-input type="textarea"
+              v-model="dataForm.qualitySchemeTemplateRemark"
+              placeholder="请输入"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
       <el-row>
       <el-row>
         <ele-pro-table
         <ele-pro-table
           ref="table"
           ref="table"
@@ -108,7 +119,7 @@
               </div>
               </div>
 
 
               <div v-else style="width: 75%">
               <div v-else style="width: 75%">
-                <el-input v-model="row.defaultValue" placeholder="请输入">
+                <el-input v-model="row.defaultValue" placeholder="请输入" disabled>
                 </el-input>
                 </el-input>
               </div>
               </div>
 
 
@@ -136,14 +147,16 @@
     </el-form>
     </el-form>
     <span slot="footer" class="dialog-footer">
     <span slot="footer" class="dialog-footer">
       <el-button @click="visible = false">取消</el-button>
       <el-button @click="visible = false">取消</el-button>
-      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
+      <el-button type="primary" @click="dataFormSubmit()" >保存</el-button>
     </span>
     </span>
     <termPop ref="termRef" @selectChange="selectChange"></termPop>
     <termPop ref="termRef" @selectChange="selectChange"></termPop>
   </el-dialog>
   </el-dialog>
 </template>
 </template>
 
 
 <script>
 <script>
-  import termPop from '@/views/qualityInspectionPlan/inspectionClassify/index.vue';
+  import termPop from '@/views/inspectionTemplate/inspectionClassify/index.vue';
+  import { save, update, getById } from '@/api/inspectionTemplate';
+  import {getCode} from "@/api/login";
   export default {
   export default {
     components: { termPop },
     components: { termPop },
     data() {
     data() {
@@ -153,16 +166,9 @@
           id: 0,
           id: 0,
           qualitySchemeTemplateName: '',
           qualitySchemeTemplateName: '',
           qualitySchemeTemplateCode: '',
           qualitySchemeTemplateCode: '',
-          inspectionItemId: '',
-          status: '',
-          deleted: '',
-          createTime: '',
-          createUserId: '',
-          updateTime: '',
-          updateUserId: '',
-          tenantId: '',
-          deptId: '',
-          factoriesId: ''
+          inspectionItemVOList: [],
+          status: 1,
+          qualitySchemeTemplateRemark: ''
         },
         },
         columns: [
         columns: [
           {
           {
@@ -182,15 +188,21 @@
             fixed: 'left'
             fixed: 'left'
           },
           },
           {
           {
-            prop: 'categoryLevelName',
+            prop: 'categoryLevelClassName',
             label: '质检类型',
             label: '质检类型',
             align: 'center',
             align: 'center',
-            minWidth: 110
+            minWidth: 150
           },
           },
+          // {
+          //   prop: 'categoryLevelName',
+          //   label: '质检类型',
+          //   align: 'center',
+          //   minWidth: 110
+          // },
 
 
           {
           {
             prop: 'inspectionName',
             prop: 'inspectionName',
-            label: '质检名称',
+            label: '质检名称',
             showOverflowTooltip: true,
             showOverflowTooltip: true,
             align: 'center',
             align: 'center',
             minWidth: 110
             minWidth: 110
@@ -215,42 +227,18 @@
           }
           }
         ],
         ],
         dataRule: {
         dataRule: {
-          // qualitySchemeTemplateName: [
-          //   { required: true, message: '质检方案名称不能为空', trigger: 'blur' }
-          // ],
+          qualitySchemeTemplateName: [
+            { required: true, message: '质检方案名称不能为空', trigger: 'blur' }
+          ],
           // qualitySchemeTemplateCode: [
           // qualitySchemeTemplateCode: [
           //   { required: true, message: '质检方案编码不能为空', trigger: 'blur' }
           //   { required: true, message: '质检方案编码不能为空', trigger: 'blur' }
           // ],
           // ],
           // inspectionItemId: [
           // inspectionItemId: [
           //   { required: true, message: '质检项id不能为空', trigger: 'blur' }
           //   { required: true, message: '质检项id不能为空', trigger: 'blur' }
           // ],
           // ],
-          // status: [
-          //   { required: true, message: '状态 0 失效 1 有效不能为空', trigger: 'blur' }
-          // ],
-          // deleted: [
-          //   { required: true, message: '是否删除:0 正常,1 删除不能为空', trigger: 'blur' }
-          // ],
-          // createTime: [
-          //   { required: true, message: '创建时间不能为空', trigger: 'blur' }
-          // ],
-          // createUserId: [
-          //   { required: true, message: '创建人ID不能为空', trigger: 'blur' }
-          // ],
-          // updateTime: [
-          //   { required: true, message: '最后更新时间不能为空', trigger: 'blur' }
-          // ],
-          // updateUserId: [
-          //   { required: true, message: '最后更新人ID不能为空', trigger: 'blur' }
-          // ],
-          // tenantId: [
-          //   { required: true, message: '租户ID不能为空', trigger: 'blur' }
-          // ],
-          // deptId: [
-          //   { required: true, message: '组织id不能为空', trigger: 'blur' }
-          // ],
-          // factoriesId: [
-          //   { required: true, message: '工厂id不能为空', trigger: 'blur' }
-          // ]
+          status: [
+            { required: true, message: '状态 0 失效 1 有效不能为空', trigger: 'blur' }
+          ],
         },
         },
         list: []
         list: []
       };
       };
@@ -277,34 +265,42 @@
       init(id) {
       init(id) {
         this.dataForm.id = id || 0;
         this.dataForm.id = id || 0;
         this.visible = true;
         this.visible = true;
-        this.$nextTick(() => {
+        this.$nextTick(async () => {
           this.$refs['dataForm'].resetFields();
           this.$refs['dataForm'].resetFields();
           if (this.dataForm.id) {
           if (this.dataForm.id) {
-            this.$http({
-              url: this.$http.adornUrl(
-                `/qms/qualitytemplate/info/${this.dataForm.id}`
-              ),
-              method: 'get',
-              params: this.$http.adornParams()
-            }).then(({ data }) => {
-              if (data && data.code === 0) {
-                this.dataForm.qualitySchemeTemplateName =
-                  data.qualityTemplate.qualitySchemeTemplateName;
-                this.dataForm.qualitySchemeTemplateCode =
-                  data.qualityTemplate.qualitySchemeTemplateCode;
-                this.dataForm.inspectionItemId =
-                  data.qualityTemplate.inspectionItemId;
-                this.dataForm.status = data.qualityTemplate.status;
-                this.dataForm.deleted = data.qualityTemplate.deleted;
-                this.dataForm.createTime = data.qualityTemplate.createTime;
-                this.dataForm.createUserId = data.qualityTemplate.createUserId;
-                this.dataForm.updateTime = data.qualityTemplate.updateTime;
-                this.dataForm.updateUserId = data.qualityTemplate.updateUserId;
-                this.dataForm.tenantId = data.qualityTemplate.tenantId;
-                this.dataForm.deptId = data.qualityTemplate.deptId;
-                this.dataForm.factoriesId = data.qualityTemplate.factoriesId;
-              }
+            getById(this.dataForm.id).then(({ data }) => {
+              this.dataForm = data;
+              this.list = data.inspectionItemVOList;
             });
             });
+            // this.$http({
+            //   url: this.$http.adornUrl(
+            //     `/qms/qualitytemplate/info/${this.dataForm.id}`
+            //   ),
+            //   method: 'get',
+            //   params: this.$http.adornParams()
+            // }).then(({data}) => {
+            //   if (data && data.code === 0) {
+            //     this.dataForm.qualitySchemeTemplateName =
+            //       data.qualityTemplate.qualitySchemeTemplateName;
+            //     this.dataForm.qualitySchemeTemplateCode =
+            //       data.qualityTemplate.qualitySchemeTemplateCode;
+            //     this.dataForm.inspectionItemId =
+            //       data.qualityTemplate.inspectionItemId;
+            //     this.dataForm.status = data.qualityTemplate.status;
+            //     this.dataForm.deleted = data.qualityTemplate.deleted;
+            //     this.dataForm.createTime = data.qualityTemplate.createTime;
+            //     this.dataForm.createUserId = data.qualityTemplate.createUserId;
+            //     this.dataForm.updateTime = data.qualityTemplate.updateTime;
+            //     this.dataForm.updateUserId = data.qualityTemplate.updateUserId;
+            //     this.dataForm.tenantId = data.qualityTemplate.tenantId;
+            //     this.dataForm.deptId = data.qualityTemplate.deptId;
+            //     this.dataForm.factoriesId = data.qualityTemplate.factoriesId;
+            //   }
+            // });
+          } else {
+            const code = await getCode('template_code');
+            this.dataForm.qualitySchemeTemplateCode = code;
+            this.list = [];
           }
           }
         });
         });
       },
       },
@@ -312,43 +308,27 @@
       dataFormSubmit() {
       dataFormSubmit() {
         this.$refs['dataForm'].validate((valid) => {
         this.$refs['dataForm'].validate((valid) => {
           if (valid) {
           if (valid) {
-            this.$http({
-              url: this.$http.adornUrl(
-                `/qms/qualitytemplate/${!this.dataForm.id ? 'save' : 'update'}`
-              ),
-              method: 'post',
-              data: this.$http.adornData({
-                id: this.dataForm.id || undefined,
-                qualitySchemeTemplateName:
-                  this.dataForm.qualitySchemeTemplateName,
-                qualitySchemeTemplateCode:
-                  this.dataForm.qualitySchemeTemplateCode,
-                inspectionItemId: this.dataForm.inspectionItemId,
-                status: this.dataForm.status,
-                deleted: this.dataForm.deleted,
-                createTime: this.dataForm.createTime,
-                createUserId: this.dataForm.createUserId,
-                updateTime: this.dataForm.updateTime,
-                updateUserId: this.dataForm.updateUserId,
-                tenantId: this.dataForm.tenantId,
-                deptId: this.dataForm.deptId,
-                factoriesId: this.dataForm.factoriesId
+            if (!this.dataForm.id) {
+              delete this.dataForm.id;
+            }
+            const saveOrUpdate = this.dataForm.id ? update : save;
+            console.log('this.list',this.list);
+            debugger
+            this.dataForm.inspectionItemVOList = this.list;
+            console.log('this.dataForm',this.dataForm);
+            saveOrUpdate(this.dataForm)
+              .then((msg) => {
+                this.loading = false;
+                this.dataForm = {};
+                const info = this.dataForm.id ? '修改成功' : '新增成功';
+                this.$message.success(info);
+                this.visible = false;
+                // this.updateVisible(false);
+                this.$emit('refreshDataList');
               })
               })
-            }).then(({ data }) => {
-              if (data && data.code === 0) {
-                this.$message({
-                  message: '操作成功',
-                  type: 'success',
-                  duration: 1500,
-                  onClose: () => {
-                    this.visible = false;
-                    this.$emit('refreshDataList');
-                  }
-                });
-              } else {
-                this.$message.error(data.msg);
-              }
-            });
+              .catch((e) => {
+                this.loading = false;
+              });
           }
           }
         });
         });
       }
       }

+ 0 - 229
src/views/qualityInspectionPlan/index.vue

@@ -1,229 +0,0 @@
-<template>
-  <div class="ele-body">
-    <el-card shadow="never">
-        <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
-            <el-form-item label="参数名">
-                <el-input
-                    v-model="dataForm.key"
-                    placeholder="请输入"
-                    clearable>
-                </el-input>
-            </el-form-item>
-            <el-form-item>
-                <el-button @click="getDataList()">查询</el-button>
-                <el-button type="primary" @click="addOrUpdateHandle()">新增</el-button>
-                <el-button
-                    type="danger"
-                    @click="deleteHandle()"
-                    :disabled="dataListSelections.length <= 0"
-                >批量删除
-            </el-button>
-            </el-form-item>
-        </el-form>
-        <el-table
-      :data="dataList"
-      border
-      v-loading="dataListLoading"
-      @selection-change="selectionChangeHandle"
-      style="width: 100%"
-    >
-      <el-table-column
-        type="selection"
-        header-align="center"
-        align="center"
-        width="50"
-      >
-      </el-table-column>
-      <el-table-column
-        prop="qualitySchemeTemplateName"
-        header-align="center"
-        align="center"
-        label="名称"
-      >
-      </el-table-column>
-      <el-table-column
-        prop="qualitySchemeTemplateCode"
-        header-align="center"
-        align="center"
-        label="编码"
-      >
-      </el-table-column>
-      
-      <el-table-column
-        prop="status"
-        header-align="center"
-        align="center"
-        label="状态"
-        :formatter="statusFormat"
-      >
-      </el-table-column>
-      <el-table-column
-        prop="createTime"
-        header-align="center"
-        align="center"
-        label="创建时间"
-      >
-      </el-table-column>
-      <el-table-column
-        prop="createUserName"
-        header-align="center"
-        align="center"
-        label="创建人"
-      >
-      </el-table-column>
-      
-      </el-table-column>
-      <el-table-column
-        fixed="right"
-        header-align="center"
-        align="center"
-        width="150"
-        label="操作"
-      >
-        <template slot-scope="scope">
-          <el-button
-            type="text"
-            size="small"
-            @click="addOrUpdateHandle(scope.row.id)"
-            >修改</el-button
-          >
-          <el-button
-            type="text"
-            size="small"
-            @click="deleteHandle(scope.row.id)"
-            >删除</el-button
-          >
-        </template>
-      </el-table-column>
-    </el-table>
-    <el-pagination
-      @size-change="sizeChangeHandle"
-      @current-change="currentChangeHandle"
-      :current-page="pageIndex"
-      :page-sizes="[10, 20, 50, 100]"
-      :page-size="pageSize"
-      :total="totalPage"
-      layout="total, sizes, prev, pager, next, jumper"
-    >
-    </el-pagination>
-    </el-card>
-    <!-- 弹窗, 新增 / 修改 -->
-    <add-or-update
-      v-if="addOrUpdateVisible"
-      ref="addOrUpdate"
-      @refreshDataList="getDataList"
-    ></add-or-update>
-  </div>
-</template>
-
-<script>
-  import AddOrUpdate from './qualitytemplate-add-or-update';
-  export default {
-    data() {
-      return {
-        dataForm: {
-          key: ''
-        },
-        dataList: [],
-        pageIndex: 1,
-        pageSize: 10,
-        totalPage: 0,
-        dataListLoading: false,
-        dataListSelections: [],
-        addOrUpdateVisible: false
-      };
-    },
-    components: {
-      AddOrUpdate
-    },
-    activated() {
-      this.getDataList();
-    },
-    methods: {
-      // 获取数据列表
-      getDataList() {
-        this.dataListLoading = true;
-        this.$http({
-          url: this.$http.adornUrl('/qms/qualitytemplate/list'),
-          method: 'get',
-          params: this.$http.adornParams({
-            page: this.pageIndex,
-            limit: this.pageSize,
-            key: this.dataForm.key
-          })
-        }).then(({ data }) => {
-          if (data && data.code === 0) {
-            this.dataList = data.page.list;
-            this.totalPage = data.page.totalCount;
-          } else {
-            this.dataList = [];
-            this.totalPage = 0;
-          }
-          this.dataListLoading = false;
-        });
-      },
-      // 每页数
-      sizeChangeHandle(val) {
-        this.pageSize = val;
-        this.pageIndex = 1;
-        this.getDataList();
-      },
-      // 当前页
-      currentChangeHandle(val) {
-        this.pageIndex = val;
-        this.getDataList();
-      },
-      // 多选
-      selectionChangeHandle(val) {
-        this.dataListSelections = val;
-      },
-      // 新增 / 修改
-      addOrUpdateHandle(id) {
-        this.addOrUpdateVisible = true;
-        this.$nextTick(() => {
-          this.$refs.addOrUpdate.init(id);
-        });
-      },
-      // 删除
-      deleteHandle(id) {
-        var ids = id
-          ? [id]
-          : this.dataListSelections.map((item) => {
-              return item.id;
-            });
-        this.$confirm(
-          `确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`,
-          '提示',
-          {
-            confirmButtonText: '确定',
-            cancelButtonText: '取消',
-            type: 'warning'
-          }
-        ).then(() => {
-          this.$http({
-            url: this.$http.adornUrl('/qms/qualitytemplate/delete'),
-            method: 'post',
-            data: this.$http.adornData(ids, false)
-          }).then(({ data }) => {
-            if (data && data.code === 0) {
-              this.$message({
-                message: '操作成功',
-                type: 'success',
-                duration: 1500,
-                onClose: () => {
-                  this.getDataList();
-                }
-              });
-            } else {
-              this.$message.error(data.msg);
-            }
-          });
-        });
-      },
-    
-      statusFormat(row, column) {
-        return row.status === 1 ? "有效" : "失效";
-      }
-    }
-  };
-</script>