Browse Source

Merge remote-tracking branch 'origin/qirui-v2' into qirui-v2

# Conflicts:
#	src/locales/lang/en-US/dvpPlan.js
#	src/locales/lang/en-US/globalBtn.js
#	src/locales/lang/zh-CN/dvpPlan.js
#	src/locales/lang/zh-CN/globalBtn.js
#	src/views/fullVehicle/dvpPlan/index.vue
dongfeng 11 months ago
parent
commit
feaf463b55

+ 4 - 0
src/App.vue

@@ -93,6 +93,10 @@ export default {
   created () {
   },
   mounted() {
+    this.$store.dispatch("dvp/set", {
+      key: "dvpId",
+      value: getUrlParam("dvpId")
+    });
   },
   watch: {
 

+ 6 - 1
src/locales/lang/en-US/dvpPlan.js

@@ -1,10 +1,15 @@
 export default {
     /** DVP计划 */
     'plan.dvp.description-of-the-purpose-of-the-test-vehicle': 'Description of the purpose of test vehicle',
+    'plan.dvp.please-enter-description-of-the-purpose-of-the-test-vehicle': 'Please enter description of the purpose of test vehicle',
     'plan.dvp.description-of-the-vehicle-status': 'Description of the vehicle status',
+    'plan.dvp.please-enter-description-of-the-vehicle-status': ' Please enter description of the vehicle status',
     'plan.dvp.test-location': 'Test location',
+    'plan.dvp.please-enter-test-location': 'Please enter test location',
     'plan.dvp.study-director': 'Study director',
+    'plan.dvp.please-enter-study-director': 'Please enter study director',
     'plan.dvp.panel-point': 'Panel point',
+    'plan.dvp.please-enter-panel-point': 'Please enter panel point',
     'plan.dvp.sample-vehicle-plan-delivery-time': 'Sample vehicle plan delivery time',
     'plan.dvp.scheduled-start-time': 'Scheduled start time',
     'plan.dvp.scheduled-end-time': 'Scheduled end time',
@@ -28,4 +33,4 @@ export default {
     'plan.dvp.please_select-scheduled-start-time': 'Please select scheduled start time',
     'plan.dvp.please_select-scheduled-end-time': 'Please select scheduled end time',
     'plan.dvp.please_enter-description-of-the-purpose-of-the-test-vehicle': 'Please enter description of the purpose of the test vehicle',
-}
+}

+ 1 - 2
src/locales/lang/en-US/globalBtn.js

@@ -53,9 +53,8 @@ export default {
     'global-btn.please-enter': 'Please enter',
     'global-btn.please-select': 'Please select',
     /** 表格:共计条数 */
-    'global-constant.table.show-total': 'A total of {0} data',
+    'global-constant.table.show-total': 'A total of {total} data',
     'global-constant.operation': 'operation',
-
     'global-constant.please-enter': 'Please enter',
     'global-constant.please-select': 'Please select',
 }

+ 5 - 0
src/locales/lang/zh-CN/dvpPlan.js

@@ -1,10 +1,15 @@
 export default {
     /** DVP计划 */
     'plan.dvp.description-of-the-purpose-of-the-test-vehicle': '试验车用途描述',
+    'plan.dvp.please-enter-description-of-the-purpose-of-the-test-vehicle': '请输入试验车用途描述',
     'plan.dvp.description-of-the-vehicle-status': '车辆状态描述',
+    'plan.dvp.please-enter-description-of-the-vehicle-status': '请输入车辆状态描述',
     'plan.dvp.test-location': '试验地点',
+    'plan.dvp.please-enter-test-location': '请输入试验地点',
     'plan.dvp.study-director': '试验负责人',
+    'plan.dvp.please-enter-study-director': '请输入试验负责人',
     'plan.dvp.panel-point': '节点',
+    'plan.dvp.please-enter-panel-point': '请输入节点',
     'plan.dvp.sample-vehicle-plan-delivery-time': '样车计划提供时间',
     'plan.dvp.scheduled-start-time': '计划开始时间',
     'plan.dvp.scheduled-end-time': '计划结束时间',

+ 1 - 1
src/locales/lang/zh-CN/globalBtn.js

@@ -53,7 +53,7 @@ export default {
     'global-btn.please-enter': '请输入',
     'global-btn.please-select': '请选择',
     /** 表格:共计条数 */
-    'global-constant.table.show-total': '共 {0} 条数据',
+    'global-constant.table.show-total': '共 {total} 条数据',
     'global-constant.operation': '操作',
     'global-constant.please-enter': '请输入',
     'global-constant.please-select': '请选择',

+ 3 - 1
src/store/getters.js

@@ -11,7 +11,9 @@ const getters = {
 	addRouters: state => state.permission.addRouters,
 	multiTab: state => state.app.multiTab,
 	lang: state => state.app.lang,
-	roleDict: state => state.role.roleDict
+	roleDict: state => state.role.roleDict,
+	/**DVP */
+	dvpId: state => state.dvp.dvpId
 };
 
 export default getters;

+ 30 - 0
src/store/modules/dvp.js

@@ -0,0 +1,30 @@
+
+const state = {
+	state: {
+		dvpId: undefined
+	},
+};
+const mutations = {
+  SET: (state, {key, value}) => {
+    state[key] = value
+  },
+  CLEAR: state => {
+    // 清除缓存
+    state['dvpId'] = undefined
+  },
+};
+const actions = {
+  set({commit}, data) {
+    commit('SET', data)
+  },
+  clear({commit}) {
+      commit('CLEAR')
+  }
+};
+
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions
+};

+ 76 - 44
src/views/fullVehicle/dvpPlan/index.vue

@@ -1,40 +1,54 @@
 <template>
   <div>
-    <a-row class="content-box">
-      <a-card class="layoutCard">
-        <a-form layout='vertical'>
-          <a-row :gutter="24">
-            <a-col :xl='6' :lg='6' :md='12' :sm='24' :xs='24'>
-              <a-form-item :label="$t('plan.dvp.description-of-the-purpose-of-the-test-vehicle')">
-                <a-input>
-
-                </a-input>
-              </a-form-item>
-            </a-col>
-            <a-col :xl='6' :lg='6' :md='12' :sm='24' :xs='24'>
-              <a-form-item :label="$t('plan.dvp.description-of-the-vehicle-status')">
-                <a-input>
-
-                </a-input>
-              </a-form-item>
-            </a-col>
-            <a-col :xl='6' :lg='6' :md='12' :sm='24' :xs='24' v-for="(item,index) in selectDataList">
-              <a-form-item :label="item.name">
-                <a-select allowClear v-model="searchSelectData[item.id]" :options="item.configData" :key="index" >
-
-                </a-select>
-              </a-form-item>
-            </a-col>
-            <span v-show="advanceExpand">
+  <a-row class="content-box">
+    <a-card class="layoutCard">
+      <a-form layout='vertical'>
+        <a-row :gutter="24">
+          <!--试验车用途描述-->
+          <a-col :xl='6' :lg='6' :md='12' :sm='24' :xs='24'>
+            <a-form-item :label="$t('plan.dvp.description-of-the-purpose-of-the-test-vehicle')">
+              <a-input
+                allowClear
+                :maxLength='500'
+                v-model.trim="formData.vehicleUse"
+                :placeholder="$t('plan.dvp.please-enter-description-of-the-purpose-of-the-test-vehicle')"/>
+            </a-form-item>
+          </a-col>
+          <!--车辆状态描述-->
+          <a-col :xl='6' :lg='6' :md='12' :sm='24' :xs='24'>
+            <a-form-item :label="$t('plan.dvp.description-of-the-vehicle-status')">
+              <a-input
+                allowClear
+                :maxLength='500'
+                v-model.trim="formData.vehicleState"
+                :placeholder="$t('plan.dvp.please-enter-description-of-the-vehicle-status')"/>
+            </a-form-item>
+          </a-col>
+          <!--动态下拉选框-->
+          <a-col :xl='6' :lg='6' :md='12' :sm='24' :xs='24' v-for="(item,index) in selectDataList" :key="index" >
+            <a-form-item :label="item.name">
+              <a-select allowClear v-model="searchSelectData[item.id]"  :options="item.configData" :key="index"></a-select>
+            </a-form-item>
+          </a-col>
+          <span v-show="advanceExpand">
+            <!--试验地点-->
             <a-col :xl='6' :lg='6' :md='12' :sm='24' :xs='24'>
             <a-form-item :label="$t('plan.dvp.test-location')">
-             <a-input allowClear :maxLength='50' v-model.trim="formData.testSite"/>
+             <a-input
+               allowClear
+               :maxLength='50'
+               v-model.trim="formData.testSite"
+               :placeholder="$t('plan.dvp.please-enter-test-location')"/>
             </a-form-item>
           </a-col>
             <!--试验负责人-->
           <a-col :xl='6' :lg='6' :md='24' :sm='24' :xs='24'>
             <a-form-item :label="$t('plan.dvp.study-director')">
-               <a-input allowClear :maxLength='50' v-model.trim="formData.testOwner"/>
+               <a-input
+                 allowClear
+                 :maxLength='50'
+                 v-model.trim="formData.testOwner"
+                 :placeholder="$t('plan.dvp.please-enter-study-director')"/>
             </a-form-item>
           </a-col>
             <!--节点-->
@@ -140,7 +154,6 @@
 
 
 import AddDvpTest from "./AddModal/addDvpTest";
-import { getUrlParam } from "@/common/common";
 
 export default {
   components: {AddDvpTest},
@@ -215,6 +228,7 @@ export default {
       tableData: [],
       /** 表格列 */
       tableColumns: [
+        //序号
         {
           title: this.$t('plan.dvp.serial-number'),
           width: 50,
@@ -225,6 +239,7 @@ export default {
           },
           ellipsis: true
         },
+        //性能模块
         {
           title: this.$t('plan.dvp.vehicle-performance-module'),
           dataIndex: 'performanceModule',
@@ -232,6 +247,7 @@ export default {
           // width: 100,
           ellipsis: true
         },
+        //试验车用途描述
         {
           title: this.$t('plan.dvp.description-of-the-purpose-of-the-test-vehicle'),
           dataIndex: 'vehicleUse',
@@ -239,6 +255,7 @@ export default {
           // width: 100,
           ellipsis: true
         },
+        //试验类型
         {
           title: this.$t('plan.dvp.test-type'),
           dataIndex: 'testType',
@@ -246,6 +263,7 @@ export default {
           // width: 100,
           ellipsis: true
         },
+        //车辆状态描述
         {
           title: this.$t('plan.dvp.description-of-the-vehicle-status'),
           dataIndex: 'vehicleState',
@@ -253,6 +271,7 @@ export default {
           // width: 100,
           ellipsis: true
         },
+        //数量
         {
           title: this.$t('plan.dvp.quantity'),
           dataIndex: 'count',
@@ -263,6 +282,7 @@ export default {
       ],
       /** 表格固定部分数据 */
       tableRightColumns: [
+        //试验地点
         {
           title: this.$t('plan.dvp.test-location'),
           dataIndex: 'testSite',
@@ -270,6 +290,7 @@ export default {
           // width: 150,
           ellipsis: true
         },
+        //试验负责人
         {
           title: this.$t('plan.dvp.study-director'),
           dataIndex: 'testOwner',
@@ -277,6 +298,7 @@ export default {
           // width: 150,
           ellipsis: true
         },
+        //节点
         {
           title: this.$t('plan.dvp.panel-point'),
           dataIndex: 'node',
@@ -284,6 +306,7 @@ export default {
           // width: 150,
           ellipsis: true
         },
+        //样车计划提供时间
         {
           title: this.$t('plan.dvp.sample-vehicle-plan-delivery-time'),
           dataIndex: 'prototypePlanTime',
@@ -291,6 +314,7 @@ export default {
           // width: 150,
           ellipsis: true
         },
+        //计划开始时间
         {
           title: this.$t('plan.dvp.scheduled-start-time'),
           dataIndex: 'planStartTime',
@@ -298,6 +322,7 @@ export default {
           // width: 150,
           ellipsis: true
         },
+        //计划结束时间
         {
           title: this.$t('plan.dvp.scheduled-end-time'),
           dataIndex: 'planEndTime',
@@ -305,6 +330,7 @@ export default {
           // width: 150,
           ellipsis: true
         },
+        //操作
         {
           title: this.$t('global-constant.operation'),
           align: 'center',
@@ -339,14 +365,19 @@ export default {
     search() {
       //判断动态下拉选是否有选中数据
       if (this.searchSelectData) {
-         let searchData = [];
-         for (let i = 0; i < Object.keys(this.searchSelectData).length; i++) {
-           let selectedDate = {}
-           //keys 是下拉选框的id,区分是哪个下拉选框; value 是下拉选框选中项的id;
-           selectedDate.configId = parseInt(Object.keys(this.searchSelectData)[i]);
-           selectedDate.id = Object.values(this.searchSelectData)[i];
-           searchData.push(selectedDate);
-         }
+        let searchData = [];
+        for(let [key, value] of Object.entries(this.searchSelectData)){
+          let selectedDate = {};
+          //如果value没有值,就跳过这次循环,不将这个属性传给后端
+          if (value === undefined){
+            continue;
+          } else {
+            //keys 是下拉选框的id,区分是哪个下拉选框; value 是下拉选框选中项的id;
+            selectedDate.configId = parseInt(key);
+            selectedDate.id = value;
+            searchData.push(selectedDate);
+          }
+        }
          //动态下拉选框选中数据,存进查询数据中
          this.formData.dynamicConfig = searchData;
       }
@@ -386,6 +417,7 @@ export default {
      * 重置
      */
     reset() {
+      this.searchSelectData = {};
       this.planTime = undefined;
       this.startTime = undefined;
       this.endTime = undefined;
@@ -468,11 +500,11 @@ export default {
       this.initData();
     },
     /**
-     * 初始化下拉选数据
+     * 初始化动态下拉选框
      */
     initSelectList(){
       let data = {
-        dvpId: getUrlParam("dvpId")
+        dvpId: this.$store.getters.dvpId
       };
       this.$api.initSelectList(data).then(res => {
       if (res.flag){
@@ -504,7 +536,7 @@ export default {
      */
     initData() {
       let _that = this;
-      _that.formData.dvpId = getUrlParam("dvpId");
+      _that.formData.dvpId = _that.$store.getters.dvpId;
       _that.$api.initDvpList(_that.formData).then(res => {
         if (res.flag) {
           //清除之前添加的表头,防止重复添加
@@ -559,6 +591,7 @@ export default {
                 tempData.planEndTime = item.planEndTime; // 计划结束时间
                 _that.tableData.push(tempData);
               })
+              _that.pagination.total = res.data.total;
             }
           }
         }
@@ -577,9 +610,8 @@ export default {
      * @param data
      */
     editDvpTest(record) {
-      console.log("!!!",record);
       let data = {
-        dvpId: getUrlParam("dvpId"),
+        dvpId: this.$store.getters.dvpId,
         testId: record.testId
       }
       this.$api.editDvpTestInit(data).then(res => {
@@ -608,7 +640,7 @@ export default {
 }
 
 </script>
-<style>
+<style lang="less" scoped>
 .content-box {
   padding: 0 12px;
 }
@@ -616,4 +648,4 @@ export default {
 .layoutCard {
  padding: 12px;
 }
-</style>
+</style>