vbea пре 3 година
родитељ
комит
9fc73d2752

+ 1 - 1
Strides-Admin/src/views/notification/add.vue

@@ -18,7 +18,7 @@
                 class="add-text"
                 v-model="formInfo.title"
                 placeholder="Add text"
-                maxlength="30"
+                maxlength="80"
                 :readonly="!isEdit"/>
             </el-form-item>
           </el-col>

+ 2 - 2
Strides-Admin/src/views/site/AddSite.vue

@@ -679,7 +679,7 @@ import Balancing from './components/Balancing'
 import Reservation from './components/Reservation'
 import waves from '@/directive/waves' // waves directive
 import site from '../../http/api/site'
-import { fetchFleetCompanyOptions } from '@/http/api/driver'
+import driver from '@/http/api/driver'
 
 export default {
   name: 'AddSite',
@@ -1040,7 +1040,7 @@ export default {
       });
     },
     getCompanyOptions() {
-      fetchFleetCompanyOptions().then((response) => {
+      driver.fetchFleetCompanyOptions().then((response) => {
         const { data, success } = response
         if (success) {
           this.companyOptions = data

+ 2 - 2
Strides-Admin/src/views/site/UpdateSite.vue

@@ -668,7 +668,7 @@ import { mapState } from 'vuex'
 import Balancing from './components/Balancing'
 import Reservation from './components/Reservation'
 import { getRoleName } from '@/utils/auth'
-import { fetchFleetCompanyOptions } from '@/http/api/driver'
+import driver from '@/http/api/driver'
 
 export default {
   components: { Balancing, Reservation },
@@ -1183,7 +1183,7 @@ export default {
       })
     },
     getCompanyOptions() {
-      fetchFleetCompanyOptions().then((response) => {
+      driver.fetchFleetCompanyOptions().then((response) => {
         const { data, success } = response
         if (success) {
           this.companyOptions = data

+ 8 - 5
Strides-Admin/src/views/site/components/ChargeRate.vue

@@ -73,7 +73,7 @@
 
 <script>
 import site from '@/http/api/site'
-import { fetchFleetCompanyOptions } from '@/http/api/driver'
+import driver from '@/http/api/driver'
 export default {
   name: "ChargeRate",
   props: {
@@ -164,7 +164,8 @@ export default {
         if (res.data) {
           this.rateTypeOptions = res.data
           if (res.data.length > 0) {
-            this.chargeRates[0].rateType = res.data[0].value
+            if (!this.chargeRates[0].rateType)
+              this.chargeRates[0].rateType = res.data[0].value
             this.tempChargeRate.rateType = res.data[0].value
             this.onChange()
           }
@@ -176,7 +177,8 @@ export default {
         if (res.data) {
           this.chargeTypeOptions = res.data
           if (res.data.length > 0) {
-            this.chargeRates[0].chargeTypePk = res.data[0].chargeTypePk
+            if (!this.chargeRates[0].chargeTypePk)
+              this.chargeRates[0].chargeTypePk = res.data[0].chargeTypePk
             this.tempChargeRate.chargeTypePk = res.data[0].chargeTypePk
             this.onChange()
           }
@@ -184,11 +186,12 @@ export default {
       });
     },
     getCompanyOptions() {
-      fetchFleetCompanyOptions().then(res => {
+      driver.fetchFleetCompanyOptions().then(res => {
         if (res.data) {
           this.companyOptions = res.data
           if (res.data.length > 0) {
-            this.chargeRates[0].fleetCompanyId = res.data[0].fleetCompanyId
+            if (!this.chargeRates[0].fleetCompanyId)
+              this.chargeRates[0].fleetCompanyId = res.data[0].fleetCompanyId
             this.tempChargeRate.fleetCompanyId = res.data[0].fleetCompanyId
             this.onChange()
           }

+ 1 - 1
Strides-Admin/src/views/site/components/Summary.vue

@@ -2,7 +2,7 @@
   <div class="summary-layout">
     <div v-if="info.connectorStatus">
       <div class="summary-view">
-        <div class="summary-text">Total Number Of Stations</div>
+        <div class="summary-text">Total Number Of Connectors</div>
         <div class="summary-text">{{info.connectors || "0"}}</div>
       </div>
       <div class="summary-sub-view">

+ 9 - 3
Strides-Admin/src/views/site/components/WhiteListFleet.vue

@@ -32,7 +32,8 @@
 </template>
 
 <script>
-import { fetchFleetCompanyOptions } from '@/http/api/driver'
+import site from '@/http/api/site'
+import driver from '@/http/api/driver'
 export default {
   name: 'WhiteListFleet',
   props: {
@@ -63,14 +64,18 @@ export default {
     }
   },
   mounted() {
-    this.getCompanyOptions()
+    this.fleetWhitelist = this.value;
+    this.getCompanyOptions();
+    if (this.fleetWhitelist.length === 0) {
+      this.handleClickAddWhiteFleetButton()
+    }
   },
   methods: {
     onChange() {
       this.$emit('change', this.fleetWhitelist);
     },
     getCompanyOptions() {
-      fetchFleetCompanyOptions().then(res => {
+      driver.fetchFleetCompanyOptions().then(res => {
         if (res.data) {
           this.companyOptions = res.data
         }
@@ -80,6 +85,7 @@ export default {
       this.fleetWhitelist.push({
         fleetCompanyId: ''
       })
+      this.onChange();
     },
     handleClickSubWhiteFleetButton(fleet, index) {
       if (fleet.siteFleetId) {

+ 12 - 2
Strides-Admin/src/views/site/components/WhiteListUser.vue

@@ -10,7 +10,8 @@
         :rules="rules.mobileNumber">
         <el-input
           v-model="item.mobileNumber"
-          class="rate-text" />
+          class="rate-text"
+          @blur="onChange"/>
         <!-- <div class="el-form-item__error">Please type mobile number</div> -->
       </el-form-item>
       <el-form-item
@@ -19,7 +20,8 @@
         :rules="rules.licenceNumber">
         <el-input
           v-model="item.licenceNumber"
-          class="rate-text" />
+          class="rate-text"
+          @blur="onChange"/>
         <!-- <div class="el-form-item__error">Please type licence number</div> -->
       </el-form-item>
       <img
@@ -36,6 +38,7 @@
 </template>
 
 <script>
+import site from '@/http/api/site'
 export default {
   name: 'WhiteListUser',
   props: {
@@ -84,6 +87,12 @@ export default {
       }
     }
   },
+  mounted() {
+    this.whitelistUser = this.value;
+    if (this.whitelistUser.length === 0) {
+      this.handleClickAddWhiteUserButton();
+    }
+  },
   methods: {
     onChange() {
       this.$emit('change', this.whitelistUser);
@@ -93,6 +102,7 @@ export default {
         mobileNumber: '',
         licenceNumber: '',
       })
+      this.onChange();
     },
     handleClickSubWhiteUserButton(user, index) {
       if (user.whitelistPk) {

+ 23 - 10
Strides-Admin/src/views/site/detail.vue

@@ -315,7 +315,6 @@ import SiteTypeWithTime from './components/SiteTypeWithTime'
 import waves from '@/directive/waves' // waves directive
 import site from '../../http/api/site'
 import { getRoleName } from '@/utils/auth'
-import { fetchFleetCompanyOptions } from '@/http/api/driver'
 export default {
   directives: { waves },
   components: {
@@ -515,12 +514,22 @@ export default {
         if (res.data) {
           this.siteForm = res.data;
           this.applySiteInfo();
+        } else {
+          this.pageLoading = false;
         }
-      }).finally(() => {
+      }).catch(() => {
+        this.$message({
+          message: err,
+          type: 'error',
+          duration: 3000,
+        })
         this.pageLoading = false;
       })
     },
     applySiteInfo() {
+      setTimeout(() => {
+        this.pageLoading = false;
+      }, 500);
       if (this.siteForm.chargeRates) {
         const rate = [], srate = []
         this.siteForm.chargeRates.forEach(item => {
@@ -666,7 +675,7 @@ export default {
           if (this.enableWhitelistFleet) {
             let _list = []
             this.siteForm.fleetWhitelist.forEach(item => {
-              if (item.mobileNumber && item.licenceNumber) {
+              if (item.fleetCompanyId) {
                 _list.push(item);
               }
             })
@@ -684,11 +693,15 @@ export default {
             this.siteForm.fleetWhitelist = []
           }
           this.pageLoading = true;
-          console.log("form", this.siteForm);
+          const params = {
+            ...this.siteForm,
+            chargeRates: rates
+          }
+          console.log("form", params);
           if (this.isEdit) {
-            this.updateSite();
+            this.updateSite(params);
           } else {
-            this.addSite()
+            this.addSite(params)
           }
           //this.editSiteWithForm();
         } else {
@@ -720,8 +733,8 @@ export default {
       }
       return false;
     },
-    addSite() {
-      site.addSite(this.siteForm).then(res => {
+    addSite(params) {
+      site.addSite(params).then(res => {
         this.$message({
           message: "Add site success",
           type: 'success',
@@ -738,8 +751,8 @@ export default {
         this.pageLoading = false;
       })
     },
-    updateSite() {
-      site.updateSite(this.siteForm).then(res => {
+    updateSite(params) {
+      site.updateSite(params).then(res => {
         this.$message({
           message: "Update site success",
           type: 'success',