Bläddra i källkod

整车性能dvp若没有项目节点,项目节点不必填

zhangjie 10 månader sedan
förälder
incheckning
7da159587a

+ 1 - 1
src/views/componentsDVP/verify/dvpVerify.vue

@@ -39,7 +39,7 @@
           <a-col :lg="8" :md="12" :sm="24" :xl="6" :xs="24">
             <a-form-item :label="$t('plan.dvp.test-source')">
               <a-select v-model="queryParam.testSource" :placeholder="$t('plan.dvp.please-enter-test-source')" allowClear>
-                <a-select-option v-for="item in testSourceList" :value="item.value">
+                <a-select-option v-for="(item, index) in testSourceList" :value="item.value" :key="index">
                   {{ item.label }}
                 </a-select-option>
               </a-select>

+ 17 - 10
src/views/fullVehicle/dvpPlan/AddModal/addDvpTest.vue

@@ -66,7 +66,7 @@
           </a-col>
           <!--项目节点-->
           <a-col :md="12" :sm="12">
-            <a-form-item :required='true' :label="$t('plan.dvp.project-node')">
+            <a-form-item :required='nodeRequired' :label="$t('plan.dvp.project-node')">
               <a-select allowClear v-model="formData.node" :options="projectNodeList" @change="handleProjectNode" :placeholder="$t('plan.dvp.please_select-project-node')"></a-select>
             </a-form-item>
           </a-col>
@@ -181,7 +181,9 @@ export default {
       searchSelectData: {},
       planStartTime: undefined,
       planEndTime: undefined,
-      formData: {}
+      formData: {},
+      /**项目节点是否必填 */
+      nodeRequired: false
 		};
 	},
 	watch: {
@@ -212,13 +214,18 @@ export default {
       this.$api.getProjectNodeList(data).then(res => {
         if (res.flag){
           let nodeList = res.data.dynamicConfig;
-          nodeList.forEach(item => {
-            let options = {
-              label: item.name,
-              value: item.id
-            }
-            this.projectNodeList.push(options);
-          });
+          if (nodeList && nodeList.length > 0) {
+            nodeList.forEach(item => {
+              let options = {
+                label: item.name,
+                value: item.id
+              }
+              this.projectNodeList.push(options);
+            });
+            this.nodeRequired = true;
+          } else {
+            this.nodeRequired = false;
+          }
         }
       });
     },
@@ -344,7 +351,7 @@ export default {
         message.push(_this.$t('global-constant.please-select') + _this.$t('plan.dvp.study-director'));
       }
       // 项目节点
-      if (!_this.formData.node) {
+      if (_this.nodeRequired && !_this.formData.node) {
         message.push(_this.$t('global-constant.please-select') + _this.$t('plan.dvp.project-node'));
       }
       // 样车试验提供时间