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

update src/views/maintain/detail.vue

wudebin 5 месяцев назад
Родитель
Сommit
0e37076794
1 измененных файлов с 38 добавлено и 14 удалено
  1. 38 14
      Strides-Admin/src/views/maintain/detail.vue

+ 38 - 14
Strides-Admin/src/views/maintain/detail.vue

@@ -37,11 +37,18 @@
           <el-form-item
             label="Carpark Code:"
             prop="carparkCode">
-            <el-input
+            <el-select
               class="add-text"
-              v-model="form.carparkCode"
+              filterable
               placeholder="Carpark Code"
-              maxlength="10"/>
+              v-model="form.carparkCode"
+              @change="getStationOptions(true)">
+              <el-option
+                v-for="(item, index) in options.carpark"
+                :key="index"
+                :label="item"
+                :value="item"/>
+            </el-select>
           </el-form-item>
           <el-form-item
             label="Chargers:"
@@ -50,14 +57,14 @@
               clearable
               class="add-text"
               v-model="form.chargeBoxIds"
-              placeholder="Filter by Station ID"
+              placeholder="Please select the Carpark code first"
               multiple
               filterable>
               <el-option
                 v-for="(item, index) in options.station"
                 :key="index"
-                :label="item.chargeBoxId"
-                :value="item.chargeBoxId"/>
+                :label="item"
+                :value="item"/>
             </el-select>
           </el-form-item>
           <el-form-item
@@ -206,6 +213,11 @@ export default {
           trigger: "change",
           message: "Please select maintenance type"
         },
+        carparkCode: {
+          required: true,
+          trigger: "change",
+          message: "Please select carpark code"
+        },
         startTime: [{
           message: "Please select start date time",
           trigger: "change",
@@ -224,6 +236,7 @@ export default {
       },
       options: {
         type: [],
+        carpark: [],
         station: []
       },
       evidences: [],
@@ -233,7 +246,7 @@ export default {
   components: {AuditView},
   created() {
     this.getTypeOptions();
-    this.getStationOptions();
+    this.getCarParkOptions();
     if (this.$route.params.id) {
       this.isEdit = true;
       this.getMaintainInfo()
@@ -249,14 +262,22 @@ export default {
         
       })
     },
-    getStationOptions() {
-      this.loading.option = true;
-      charge.getStationPages({
-        pageNo: 1,
-        pageSize: 500,
-        pageVo: {
-          criteria: ""
+    getCarParkOptions() {
+      api.getCarParkOptions().then(res => {
+        if (res.data && res.data.length > 0) {
+          this.options.carpark = res.data;
         }
+      }).catch(err => {
+        
+      })
+    },
+    getStationOptions(change) {
+      if (change) {
+        this.form.chargeBoxIds = [];
+      }
+      this.loading.option = true;
+      api.getChargerOptions({
+        carparkCode: this.form.carparkCode
       }).then(res => {
         if (res.data) {
           this.options.station = res.data;
@@ -286,6 +307,9 @@ export default {
               url: this.$imageSrc(this.form.evidenceUrl)
             });
           }
+          if  (this.form.carparkCode) {
+            this.getStationOptions()
+          }
         }
       }).catch(err => {
         this.$message({