应用类型车辆配置开发
This commit is contained in:
parent
b5e8560472
commit
54fce285f0
@ -3,7 +3,8 @@ var CONFIG = {
|
||||
login_background: '/assets/login_background.jpg',
|
||||
logo_big: '/assets/logo_big.png',
|
||||
logo_small: '/assets/logo_small.png',
|
||||
url: (window.location.hostname === 'localhost') ? 'http://vd.dipp.ink/' : '/'
|
||||
url: (window.location.hostname === 'localhost') ? 'http://vd.dipp.ink/' : '/',
|
||||
ascsUrl: (window.location.hostname === 'localhost') ? 'http://172.16.14.91:8080/' : '/'
|
||||
};
|
||||
|
||||
window.CONFIG = CONFIG;
|
||||
|
@ -82,3 +82,24 @@ export function importExcel(file) {
|
||||
|
||||
return service.post('api/virtual/properties/import', params, config);
|
||||
}
|
||||
|
||||
/**
|
||||
* [getCarAndplatformList 展示所有的平台车辆]
|
||||
* @param {[type]} data [description]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
|
||||
export function getCarTypeToPlatformList(data) {
|
||||
return fetch.get('setting/list', { params: data })
|
||||
}
|
||||
|
||||
/**
|
||||
* [import 展示所有的平台车辆]
|
||||
* @param {[type]} data [description]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
|
||||
export function saveCarTypeToPlatform(data) {
|
||||
return fetch.post('setting/update', data)
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ import iView from "iview";
|
||||
import iviewArea from "iview-area";
|
||||
import Cookies from "js-cookie";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import { service, serviceForm } from "service/service";
|
||||
import { service, serviceForm,fetch} from "service/service";
|
||||
import App from "./App";
|
||||
import router from "./router";
|
||||
import store from "./store";
|
||||
@ -52,3 +52,4 @@ window.md5 = md5;
|
||||
window.jquery = window.$ = jquery;
|
||||
window.service = service;
|
||||
window.serviceForm = serviceForm;
|
||||
window.fetch = fetch;
|
||||
|
@ -25,6 +25,14 @@ export const serviceForm = axios.create({
|
||||
baseURL: domain
|
||||
});
|
||||
|
||||
export const fetch = axios.create({
|
||||
timeout: 1800000,
|
||||
headers: {
|
||||
'Content-Type': 'application/json; charset=utf-8'
|
||||
},
|
||||
baseURL: window.CONFIG.ascsUrl
|
||||
})
|
||||
|
||||
// http request 拦截器
|
||||
let request = function (config) {
|
||||
const token = getToken();
|
||||
@ -40,6 +48,15 @@ let request = function(config) {
|
||||
return config;
|
||||
};
|
||||
|
||||
//fetch 的 http request 拦截器
|
||||
let fetchRequest = function (config) {
|
||||
// 配置取消请求
|
||||
if (window._source) {
|
||||
config.cancelToken = window._source.token;
|
||||
}
|
||||
return config;
|
||||
};
|
||||
|
||||
let request_err = function (err) {
|
||||
Message.error('请求超时');
|
||||
return Promise.reject(err);
|
||||
@ -93,6 +110,9 @@ service.interceptors.response.use(response, response_err);
|
||||
serviceForm.interceptors.request.use(request, request_err);
|
||||
serviceForm.interceptors.response.use(response, response_err);
|
||||
|
||||
fetch.interceptors.request.use(fetchRequest, request_err);
|
||||
fetch.interceptors.response.use(response, response_err);
|
||||
|
||||
axios.interceptors.response.use(response, response_err);
|
||||
|
||||
window.axios = axios;
|
||||
|
33
frontend/src/views/virtual/properties/configure.vue
Normal file
33
frontend/src/views/virtual/properties/configure.vue
Normal file
@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<Drawer :mask-closable="false" @on-visible-change="visibleChange" title="应用类型车辆配置" v-model="my_show" width="900">
|
||||
<div class="page-edit-wrap uinn-lr20">
|
||||
<Row>
|
||||
<Col span="3" style="line-height:32px">平台类型:</Col>
|
||||
<Col span="21">
|
||||
<Select v-model="param.name" style="width:400px" @on-change="getCarTypes">
|
||||
<Option v-for="(item,key) in configure" :value="key" :key="key">{{key}}</Option>
|
||||
</Select>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row style="margin-top:20px" v-if="param.name">
|
||||
<Col span="3" style="line-height:32px">车辆类型:</Col>
|
||||
<Col span="21">
|
||||
<Tabs v-model="carTypeName">
|
||||
<TabPane v-for="(item,key) in carTypeList" :key="key" :name="key" :label="key">
|
||||
<CheckboxGroup v-model="param.value[key]">
|
||||
<Checkbox :label="name" v-for="(name,index) in item" :key="index"></Checkbox>
|
||||
</CheckboxGroup>
|
||||
</TabPane>
|
||||
</Tabs>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
|
||||
<div class="ta-c">
|
||||
<Button @click="clear" class="w-80 umar-r5" ghost type="primary">取消</Button>
|
||||
<Button :loading="loading" @click="ok" class="w-80" type="primary">确认</Button>
|
||||
</div>
|
||||
</Drawer>
|
||||
</template>
|
||||
|
||||
<script src="./js/configure.js"></script>
|
@ -19,21 +19,15 @@
|
||||
</div>
|
||||
|
||||
<div class="handle-item">
|
||||
<Button
|
||||
@click="ok"
|
||||
icon="md-checkmark"
|
||||
type="primary"
|
||||
v-if="hasPermission('update') && editModel"
|
||||
>保存修改</Button>
|
||||
<Button @click="ok" icon="md-checkmark" type="primary" v-if="hasPermission('update') && editModel">保存修改</Button>
|
||||
</div>
|
||||
|
||||
<div class="handle-item">
|
||||
<Button
|
||||
@click="settingsShow = true"
|
||||
icon="md-add"
|
||||
type="primary"
|
||||
v-if="hasPermission('create')"
|
||||
>配置管理</Button>
|
||||
<Button @click="settingsShow = true" icon="md-add" type="primary" v-if="hasPermission('create')">配置管理</Button>
|
||||
</div>
|
||||
|
||||
<div class="handle-item">
|
||||
<Button @click="configureShow = true" type="primary">应用类型车辆配置</Button>
|
||||
</div>
|
||||
|
||||
<div class="handle-item">
|
||||
@ -50,21 +44,13 @@
|
||||
<ul class="handle-wraper">
|
||||
<li class="handle-item w-250">
|
||||
<Select placeholder="企业名称" v-model.trim="params.company_id" clearable filterable>
|
||||
<Option
|
||||
:key="index"
|
||||
:value="item.id"
|
||||
v-for="(item, index) in companies"
|
||||
>{{ item.name }}</Option>
|
||||
<Option :key="index" :value="item.id" v-for="(item, index) in companies">{{ item.name }}</Option>
|
||||
</Select>
|
||||
</li>
|
||||
|
||||
<li class="handle-item w-250">
|
||||
<Select placeholder="套餐名称" v-model.trim="params.package_id" clearable filterable>
|
||||
<Option
|
||||
:key="index"
|
||||
:value="item.id"
|
||||
v-for="(item, index) in packages"
|
||||
>{{ item.name }}</Option>
|
||||
<Option :key="index" :value="item.id" v-for="(item, index) in packages">{{ item.name }}</Option>
|
||||
</Select>
|
||||
</li>
|
||||
|
||||
@ -102,37 +88,16 @@
|
||||
</div>
|
||||
|
||||
<div class="page-turn-wrap" v-if="showData">
|
||||
<Page
|
||||
:current="Number(page.page)"
|
||||
:page-size="Number(page.limit)"
|
||||
:page-size-opts="[10, 20, 50, 100]"
|
||||
:total="Number(page.total)"
|
||||
@on-change="changePage"
|
||||
@on-page-size-change="changeLimit"
|
||||
show-elevator
|
||||
show-total
|
||||
show-sizer
|
||||
></Page>
|
||||
<Page :current="Number(page.page)" :page-size="Number(page.limit)" :page-size-opts="[10, 20, 50, 100]" :total="Number(page.total)" @on-change="changePage" @on-page-size-change="changeLimit" show-elevator show-total show-sizer></Page>
|
||||
</div>
|
||||
|
||||
<ui-edit
|
||||
:data="editObj.data"
|
||||
:isUpdate="editObj.isUpdate"
|
||||
:show.sync="editObj.show"
|
||||
:provinces="settingsData.province ? settingsData.province : []"
|
||||
@province-success="handleProvinceSuccess"
|
||||
></ui-edit>
|
||||
<ui-edit :data="editObj.data" :isUpdate="editObj.isUpdate" :show.sync="editObj.show" :provinces="settingsData.province ? settingsData.province : []" @province-success="handleProvinceSuccess"></ui-edit>
|
||||
|
||||
<ui-agent
|
||||
:data="agentObj.data"
|
||||
:isUpdate="agentObj.isUpdate"
|
||||
:show.sync="agentObj.show"
|
||||
:agents="agentsProp ? agentsProp : []"
|
||||
:platforms="settingsData.platform ? settingsData.platform : []"
|
||||
@agent-success="handleAgentSuccess"
|
||||
></ui-agent>
|
||||
<ui-agent :data="agentObj.data" :isUpdate="agentObj.isUpdate" :show.sync="agentObj.show" :agents="agentsProp ? agentsProp : []" :platforms="settingsData.platform ? settingsData.platform : []" @agent-success="handleAgentSuccess"></ui-agent>
|
||||
|
||||
<ui-settings :data="settingsData" :show.sync="settingsShow" @store-success="updateSettings"></ui-settings>
|
||||
|
||||
<ui-configure :show.sync="configureShow"></ui-configure>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
92
frontend/src/views/virtual/properties/js/configure.js
Normal file
92
frontend/src/views/virtual/properties/js/configure.js
Normal file
@ -0,0 +1,92 @@
|
||||
import * as API from "api/virtual/properties";
|
||||
export default {
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
my_show: false,
|
||||
loading: false,
|
||||
configure: [],//配置总数据
|
||||
carTypeList: {},//车辆类型
|
||||
carTypeName: '',
|
||||
param: {
|
||||
name: '',//选中平台
|
||||
value: {},//选中的车辆类型
|
||||
},
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
show(bool) {
|
||||
this.my_show = bool;
|
||||
if (bool) {
|
||||
this.getCarTypeToPlatformList()
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
getCarTypeToPlatformList() {
|
||||
API.getCarTypeToPlatformList()
|
||||
.then(res => {
|
||||
if (res.code == 0) {
|
||||
this.configure = res.data;
|
||||
}
|
||||
})
|
||||
},
|
||||
getCarTypes(val) {
|
||||
if (!val) return;
|
||||
const configure = this.configure[val] || {};
|
||||
this.carTypeList = configure.carList;
|
||||
this.param.value = {};
|
||||
if (configure['已选']) {
|
||||
this.param.value = configure['已选']
|
||||
} else {
|
||||
for (let k in configure.carList) {
|
||||
this.$set(this.param.value, k, [])
|
||||
}
|
||||
}
|
||||
this.carTypeName = Object.keys(configure.carList)[0];
|
||||
},
|
||||
ok() {
|
||||
let data = new Object;
|
||||
data.name = this.param.name;
|
||||
data.value = JSON.stringify(this.param.value);
|
||||
this.loading = true;
|
||||
API.saveCarTypeToPlatform(data)
|
||||
.then(res => {
|
||||
this.loading = false;
|
||||
if (res.code == 0) {
|
||||
this.$Message.success('修改成功');
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false;
|
||||
})
|
||||
},
|
||||
clear() {
|
||||
this.my_show = false;
|
||||
this.configure = [];
|
||||
this.carTypeList = {};
|
||||
this.carTypeName = '';
|
||||
this.param = {
|
||||
name: '',
|
||||
value: {}
|
||||
};
|
||||
},
|
||||
visibleChange(bool) {
|
||||
if (!bool) {
|
||||
this.$emit('update:show', false);
|
||||
}
|
||||
this.configure = [];
|
||||
this.carTypeList = {};
|
||||
this.carTypeName = '';
|
||||
this.param = {
|
||||
name: '',
|
||||
value: {}
|
||||
};
|
||||
},
|
||||
}
|
||||
};
|
@ -5,7 +5,8 @@ export default {
|
||||
components: {
|
||||
UiEdit: resolve => require(['views/virtual/properties/edit'], resolve),
|
||||
UiAgent: resolve => require(['views/virtual/properties/agent'], resolve),
|
||||
UiSettings: resolve => require(['views/virtual/properties/settings'], resolve)
|
||||
UiSettings: resolve => require(['views/virtual/properties/settings'], resolve),
|
||||
UiConfigure: resolve => require(['views/virtual/properties/configure'],resolve)
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -17,6 +18,7 @@ export default {
|
||||
},
|
||||
only: ['company_id', 'package_id', 'product', 'vehicle_type', 'company', 'platform', 'customer', 'province', 'agent'],
|
||||
updates: new Map(),
|
||||
configureShow: false,
|
||||
settingsShow: false,
|
||||
settingsData: {},
|
||||
agentsData: {},
|
||||
@ -88,54 +90,54 @@ export default {
|
||||
return this.editRender('company', h, context);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '平台/API',
|
||||
key: 'platform',
|
||||
minWidth: 120,
|
||||
render: (h, context) => {
|
||||
return this.editRender('platform', h, context);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '客户类型',
|
||||
key: 'customer',
|
||||
minWidth: 120,
|
||||
render: (h, context) => {
|
||||
return this.editRender('customer', h, context);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '产品类型',
|
||||
key: 'product',
|
||||
minWidth: 130,
|
||||
render: (h, context) => {
|
||||
return this.editRender('product', h, context);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '套餐类型',
|
||||
key: 'package_type',
|
||||
width: 100,
|
||||
render: (h, context) => {
|
||||
return h('span', this.productPackageTypes[context.row.product]);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '车辆类型',
|
||||
key: 'vehicle_type',
|
||||
minWidth: 120,
|
||||
render: (h, context) => {
|
||||
return this.editRender('vehicle_type', h, context);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '车型分类',
|
||||
key: 'vehicle_group',
|
||||
minWidth: 120,
|
||||
render: (h, context) => {
|
||||
return h('span', this.vehicleTypeVehicleGroups[context.row.vehicle_type]);
|
||||
}
|
||||
},
|
||||
// {
|
||||
// title: '平台/API',
|
||||
// key: 'platform',
|
||||
// minWidth: 120,
|
||||
// render: (h, context) => {
|
||||
// return this.editRender('platform', h, context);
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// title: '客户类型',
|
||||
// key: 'customer',
|
||||
// minWidth: 120,
|
||||
// render: (h, context) => {
|
||||
// return this.editRender('customer', h, context);
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// title: '产品类型',
|
||||
// key: 'product',
|
||||
// minWidth: 130,
|
||||
// render: (h, context) => {
|
||||
// return this.editRender('product', h, context);
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// title: '套餐类型',
|
||||
// key: 'package_type',
|
||||
// width: 100,
|
||||
// render: (h, context) => {
|
||||
// return h('span', this.productPackageTypes[context.row.product]);
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// title: '车辆类型',
|
||||
// key: 'vehicle_type',
|
||||
// minWidth: 120,
|
||||
// render: (h, context) => {
|
||||
// return this.editRender('vehicle_type', h, context);
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// title: '车型分类',
|
||||
// key: 'vehicle_group',
|
||||
// minWidth: 120,
|
||||
// render: (h, context) => {
|
||||
// return h('span', this.vehicleTypeVehicleGroups[context.row.vehicle_type]);
|
||||
// }
|
||||
// },
|
||||
{
|
||||
title: '销售省份',
|
||||
key: 'action',
|
||||
@ -206,6 +208,40 @@ export default {
|
||||
}, [button]));
|
||||
}
|
||||
|
||||
if (html.length) {
|
||||
return h('div', html);
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '平台配置',
|
||||
key: 'action',
|
||||
width: 150,
|
||||
render: (h, {
|
||||
row,
|
||||
column,
|
||||
index
|
||||
}) => {
|
||||
let html = [];
|
||||
|
||||
if (this.haveJurisdiction('update')) {
|
||||
let button = h('Button', {
|
||||
props: {
|
||||
type: 'success',
|
||||
size: 'small'
|
||||
},
|
||||
class: ['btn'],
|
||||
on: {
|
||||
click: (event) => {
|
||||
this.agentObj = { show: true, data: row, isUpdate: this.editModel };
|
||||
this.agentsProp = this.agentsData[row.company_id] ? this.agentsData[row.company_id] : [];
|
||||
}
|
||||
}
|
||||
}, '配置');
|
||||
|
||||
html.push(button);
|
||||
}
|
||||
|
||||
if (html.length) {
|
||||
return h('div', html);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user