Просмотр исходного кода

零部件DVP模板添加试验解除限制

xuhaowei 2 месяцев назад
Родитель
Сommit
9a2315c3ed
1 измененных файлов с 220 добавлено и 6 удалено
  1. 220 6
      src/views/componentsDVP/dvpPlan/editModal/templateEdit.vue

+ 220 - 6
src/views/componentsDVP/dvpPlan/editModal/templateEdit.vue

@@ -14,12 +14,50 @@
             <a-input v-model.trim="formData.partName" :maxLength='128' :placeholder="$t('global-btn.please-enter') + $t('workbench.compoment-name')" allowClear/>
           </a-form-item>
         </a-col>
+        <!-- CPAC编码 -->
+        <a-col :lg='8' :md='24' :sm='24' :xl='8' :xs='24'>
+          <a-form-item :label="$t('verity.dvp.cpac.number')">
+            <a-select
+              allowClear
+              showSearch
+              v-model="formData.cpacCode"
+              :placeholder="$t('global-btn.please-select') + $t('verity.dvp.cpac.number')"
+              :options="cpacList"
+              :filterOption="handleCpacCodeFilterOption"
+              @change="cpacChange"
+              @search="getCpacInitData">
+              <a-icon slot="suffixIcon" type="search" />
+            </a-select>
+          </a-form-item>
+        </a-col>
+        <!-- FND代码 -->
+        <a-col :lg='8' :md='24' :sm='24' :xl='8' :xs='24'>
+          <a-form-item :label="$t('verity.dvp.fnd.code')">
+            <a-select
+              allowClear
+              showSearch
+              v-model='formData.fndCode'
+              :placeholder="$t('global-btn.please-select') + $t('verity.dvp.fnd.code')"
+              :options="fndCodeList"
+              :filterOption="handleFndCodeFilterOption"
+              @search="getFndCodeList"
+              @change="fndChange">
+              <a-icon slot="suffixIcon" type="search" />
+            </a-select>
+          </a-form-item>
+        </a-col>
         <!--试验项目-->
         <a-col :lg='8' :md='24' :sm='24' :xl='8' :xs='24'>
           <a-form-item :label="$t('plan.dvp.test-project')">
             <a-input v-model.trim="formData.testProject" :maxLength='500' :placeholder="$t('global-btn.please-enter') + $t('plan.dvp.test-project')" allowClear/>
           </a-form-item>
         </a-col>
+        <!-- 试验类型 -->
+        <a-col :lg='8' :md='24' :sm='24' :xl='8' :xs='24'>
+          <a-form-item :label="$t('plan.dvp.test-type')">
+            <a-select v-model.trim="formData.testType" :options="testTypeList" :filter-option="handleFilterDataList" :placeholder="$t('global-btn.please-select') + $t('plan.dvp.test-type')" allowClear></a-select>
+          </a-form-item>
+        </a-col>
         <!--创建者-->
         <a-col :lg='8' :md='24' :sm='24' :xl='8' :xs='24'>
           <a-form-item :label="$t('plan.dvp.creator')">
@@ -60,11 +98,11 @@
         <span>{{ (pagination.current - 1) * pagination.pageSize + index + 1 }}</span>
       </template>
       <!-- 试验来源 -->
-      <template slot='testSource' slot-scope='text, record, index'>
+      <template slot='testSource' slot-scope='text, record'>
         <span>{{ testSourceMap[record.testSource] || '-' }}</span>
       </template>
       <!-- 试验类型 -->
-      <template slot='testType' slot-scope='text, record, index'>
+      <template slot='testType' slot-scope='text, record'>
         <span>{{ testTypeMap[record.testType] || '-' }}</span>
       </template>
     </a-table>
@@ -138,7 +176,10 @@ export default {
     return {
       changeReason: undefined, // 变更原因
       /** 查询数据 */
-      formData: {},
+      formData: {
+        cpacId: undefined,
+        fndId: undefined
+      },
       /** 表格高度 */
       tableHeight: window.innerHeight - 352 + 'px',
       tableHeightValue: window.innerHeight - 352,
@@ -284,8 +325,36 @@ export default {
         '1': this.$t('dvp.appearance'),
         '2': this.$t('dvp.size'),
         '3': this.$t('dvp.material-regulations'),
-        '4': this.$t('dvp.performance-and-functionality')
+        '4': this.$t('dvp.performance-and-functionality'),
+        '5': this.$t('dvp.vehicle-installation-verification')
       },
+      /** 试验类型字典  未确定具体字段-暂时写死*/
+      testTypeList: [
+        {
+          value: '1',
+          label: this.$t('dvp.appearance')
+        },
+        {
+          value: '2',
+          label: this.$t('dvp.size')
+        },
+        {
+          value: '3',
+          label: this.$t('dvp.material-regulations')
+        },
+        {
+          value: '4',
+          label: this.$t('dvp.performance-and-functionality')
+        },
+        {
+          value: '5',
+          label: this.$t('dvp.vehicle-installation-verification')
+        }
+      ],
+      /** cpac */
+      cpacList: [],
+      /** fnd */
+      fndCodeList: [],
       /** 表格选中行的key 默认是index */
       selectedRowKeys: [],
       /** 表格选中行数据 */
@@ -297,10 +366,44 @@ export default {
       this.tableHeight = window.innerHeight - 352 + 'px';
       this.tableHeightValue = window.innerHeight - 352;
     };
-    this.initData();
+    this.getDefaultData();
+    this.getCpacInitData();
+    this.getFndCodeList();
   },
   methods: {
-
+    // 获取默认值 调用初始化方法
+    getDefaultData() {
+      this.formData.partNo = this.$route.query.partNo;
+      this.formData.partName = this.$route.query.partName;
+      let cpacCode = this.$route.query.cpacCode;
+      let fndCode = this.$route.query.fndCode;
+      this.$api.getCpacInfoList({
+        cpacCoding: cpacCode,
+        cpacCn: cpacCode
+      }).then(res => {
+        if (res.flag) {
+          let cpacData = res.data || [];
+          this.formData.cpacCode = cpacData[0].cpacCoding + ' ' + cpacData[0].cpacCn
+          this.formData.cpacId = cpacData[0].cpacId
+        }
+      }).finally(() => {
+        this.$api.getFndInfoList({
+          fndCode: fndCode ? fndCode.toString() : '',
+          fndCn: fndCode ? fndCode.toString() : '',
+          cpacId: this.formData.cpacId
+        }).then(res => {
+          if (res.flag) {
+            let fndData = res.data || [];
+            if (fndData.length > 0) {
+              this.formData.fndCode = fndData[0].fndCode + ' ' + fndData[0].fndCn;
+              this.formData.fndId = fndData[0].id;
+            }
+          }
+        }).finally(() => {
+          this.initData();
+        });
+      });
+    },
     /**
      * 初始化表格方法
      */
@@ -311,6 +414,9 @@ export default {
         partCode: this.formData.partNo,
         partName: this.formData.partName,
         testProject: this.formData.testProject,
+        testType: this.formData.testType,
+        cpacId: this.formData.cpacId,
+        fndId: this.formData.fndId,
         templateTestIds: this.selectedRowKeys,
         pagination: {
           pageSize: this.pagination.pageSize,
@@ -322,10 +428,116 @@ export default {
           this.tableData = res.data.data || [];
         } else {
           this.tableData = [];
+          this.$notification.error({message: res.message});
+        }
+      });
+    },
+    /**
+     * 下拉选模糊查询
+     * @param input
+     * @param option
+     * @returns {boolean}
+     */
+     handleFilterDataList(input,option) {
+      return option.componentOptions.children[0].text.toLowerCase().includes(input.toLowerCase());
+    },
+    /**
+     * 初始化CPAC下拉列表
+     */
+     getCpacInitData(cpacCoding) {
+      let _that = this;
+      _that.$api.getCpacInfoList({
+        cpacCoding: cpacCoding,
+        cpacCn: cpacCoding
+      }).then(res => {
+        if (res.flag) {
+          let cpacData = res.data || [];
+          _that.cpacList = [];
+          if (cpacData.length > 0) {
+            cpacData.forEach(item => {
+              let temp = {
+                key: item.cpacId,
+                value: item.cpacId + '-' + item.cpacCoding + '-' + item.cpacCn,
+                label: item.cpacCoding + ' ' + item.cpacCn
+              };
+              _that.cpacList.push(temp);
+            });
+          }
+        } else {
+          _that.$notification.error({message: res.message});
         }
       });
     },
+    /**
+     * 获取FND代码下拉选数据
+     */
+     getFndCodeList(fndCode, cpacId) {
+      let _that = this;
+      _that.$api.getFndInfoList({
+        fndCode: fndCode ? fndCode.toString() : '',
+        fndCn: fndCode ? fndCode.toString() : '',
+        cpacId: cpacId
+      }).then(res => {
+        if (res.flag) {
+          let fndData = res.data || [];
+          _that.fndCodeList = [];
+          if (fndData.length > 0) {
+            fndData.forEach(item => {
+              let temp = {
+                key: item.id,
+                value: item.id + item.fndCode + ' ' + item.fndCn,
+                label: item.fndCode + ' ' + item.fndCn
+              };
+              _that.fndCodeList.push(temp);
+            });
+          }
+        } else {
+          _that.$notification.error({message: res.message});
+        }
+      });
+    },
+    /**
+     * cpac编码过滤配置
+     * @param input
+     * @param option
+     * @returns {boolean}
+     */
+     handleCpacCodeFilterOption(input, option) {
+      return (option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0);
+    },
+    /**
+     * fnd编码过滤配置
+     * @param input
+     * @param option
+     * @returns {boolean}
+     */
+     handleFndCodeFilterOption(input, option) {
+      return (option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0);
+    },
+    /**
+     * CPAC选择事件
+     * @param value
+     * @param options
+     * @constructor
+     */
+     cpacChange(value, options) {
+      this.formData.fndCode = undefined;
+      this.formData.fndId = undefined;
+      this.formData.cpacId = options ? options.data.key : undefined;
+      this.$forceUpdate();
+      this.getFndCodeList(null, this.formData.cpacId);
+    },
 
+    /**
+     * FND选择事件
+     * @param value
+     * @param options
+     * @constructor
+     */
+    fndChange(value, options) {
+      this.formData.fndId = options ? options.data.key : undefined;
+      this.$forceUpdate();
+    },
     /**
      * 非空校验 判断是否为空
      * @returns {boolean}
@@ -392,6 +604,8 @@ export default {
       this.pagination.current = 1;
       this.pagination.pageSize = 10;
       this.initData();
+      this.getCpacInitData();
+      this.getFndCodeList();
     },
 
     /**