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