平台配置功能开发

This commit is contained in:
pengyh 2020-04-02 21:16:04 +08:00
parent 54fce285f0
commit f528103219
13 changed files with 1230 additions and 541 deletions

View File

@ -90,7 +90,7 @@ export function importExcel(file) {
*/ */
export function getCarTypeToPlatformList(data) { export function getCarTypeToPlatformList(data) {
return fetch.get('setting/list', { params: data }) return fetch.get('property/list', { params: data })
} }
/** /**
@ -100,6 +100,54 @@ export function getCarTypeToPlatformList(data) {
*/ */
export function saveCarTypeToPlatform(data) { export function saveCarTypeToPlatform(data) {
return fetch.post('setting/update', data) return fetch.post('property/update', data)
} }
/**
* [getPlatformList 展示公司应用]
* @param {[type]} data [description]
* @return {[type]} [description]
*/
export function getApplyList(data) {
return fetch.get('properties/platform', { params: data })
}
/**
* [getPlatformList 展示公司下级机构]
* @param {[type]} data [description]
* @return {[type]} [description]
*/
export function getAgentsList(data) {
return fetch.get('properties/agents', { params: data })
}
/**
* [getPlatformList 展示公司所属套餐]
* @param {[type]} data [description]
* @return {[type]} [description]
*/
export function getPackageList(data) {
return fetch.get('properties/package', { params: data })
}
/**
* [getPlatformSetList 展示平台配置列表]
* @param {[type]} data [description]
* @return {[type]} [description]
*/
export function getPlatformSetList(data) {
return fetch.get('setting/list', { params: data })
}
/**
* [savePlatformSet 保存平台配置]
* @param {[type]} data [description]
* @return {[type]} [description]
*/
export function savePlatformSet(data) {
return fetch.post('setting/save', data)
}

View File

@ -28,7 +28,9 @@ export const serviceForm = axios.create({
export const fetch = axios.create({ export const fetch = axios.create({
timeout: 1800000, timeout: 1800000,
headers: { headers: {
'Content-Type': 'application/json; charset=utf-8' post: {
'Content-Type': 'application/json; charset=utf-8'
}
}, },
baseURL: window.CONFIG.ascsUrl baseURL: window.CONFIG.ascsUrl
}) })

View File

@ -0,0 +1,35 @@
<template>
<div>
<Modal :mask-closable="false" @on-visible-change="visibleChange" v-model="my_show" width="800" footer-hide>
<div slot="header">
<span style="margin-right:20px">{{title}}</span>
<Button type="primary" @click="addSet">添加</Button>
</div>
<div style="height:500px">
<Row style="margin-bottom:10px;font-size:14px;font-weight: bold;">
<Col span="8">
机构名称
</Col>
<Col span="8">占比</Col>
<Col span="8">操作</Col>
</Row>
<Row v-for="(item,index) in agentSetList" style="margin-bottom:10px">
<Col span="8">
<Select v-model="item.agentId" style="width:80%" placeholder="请选择机构" label-in-value @on-change="handleSelect($event,index)">
<Option v-for="agent in agentList" :value="agent.id" :key="agent.id">{{ agent.name}}</Option>
</Select>
</Col>
<Col span="8">
<Input v-model="item.value" type="number" placeholder="请输入占比" clearable style="width:80%" />
</Col>
<Col span="8">
<Button type="primary" style="margin-right:20px" @click="cartypeSet(item)">配置车型</Button>
<Button type="error" @click="delSet(index)">删除</Button>
</Col>
</Row>
</div>
</Modal>
<cartype-set :show.sync="cartype.show" v-bind="cartype"></cartype-set>
</div>
</template>
<script src="./js/agent_set.js"></script>

View File

@ -0,0 +1,35 @@
<template>
<div>
<Modal :mask-closable="false" @on-visible-change="visibleChange" v-model="my_show" width="800" footer-hide>
<div slot="header">
<span style="margin-right:20px">{{title}}</span>
<Button type="primary" @click="addSet">添加</Button>
</div>
<div style="height:500px">
<Row style="margin-bottom:10px;font-size:14px;font-weight: bold;">
<Col span="8">
车型名称
</Col>
<Col span="8">占比</Col>
<Col span="8">操作</Col>
</Row>
<Row v-for="(item,index) in carTypeSetList" style="margin-bottom:10px">
<Col span="8">
<Select v-model="item.carType" style="width:80%" placeholder="请选择车型" @on-change="handleSelect($event,index)">
<Option v-for="(cartype,key) in carTypeList" :value="key" :key="key">{{ key}}</Option>
</Select>
</Col>
<Col span="8">
<Input v-model="item.value" type="number" placeholder="请输入占比" clearable style="width:80%" />
</Col>
<Col span="8">
<Button type="primary" style="margin-right:20px" @click="packageSet(item)">配置产品</Button>
<Button type="error" @click="delSet(index)">删除</Button>
</Col>
</Row>
</div>
</Modal>
<package-set :show.sync="package.show" v-bind="package"></package-set>
</div>
</template>
<script src="./js/cartype_set.js"></script>

View File

@ -1,5 +1,5 @@
<template> <template>
<Drawer :mask-closable="false" @on-visible-change="visibleChange" title="应用类型车辆配置" v-model="my_show" width="900"> <Modal :mask-closable="false" @on-visible-change="visibleChange" title="应用类型车辆配置" v-model="my_show" width="600" @on-ok="ok" @on-cancel="clear">
<div class="page-edit-wrap uinn-lr20"> <div class="page-edit-wrap uinn-lr20">
<Row> <Row>
<Col span="3" style="line-height:32px">平台类型</Col> <Col span="3" style="line-height:32px">平台类型</Col>
@ -22,12 +22,7 @@
</Col> </Col>
</Row> </Row>
</div> </div>
</Modal >
<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> </template>
<script src="./js/configure.js"></script> <script src="./js/configure.js"></script>

View File

@ -98,6 +98,8 @@
<ui-settings :data="settingsData" :show.sync="settingsShow" @store-success="updateSettings"></ui-settings> <ui-settings :data="settingsData" :show.sync="settingsShow" @store-success="updateSettings"></ui-settings>
<ui-configure :show.sync="configureShow"></ui-configure> <ui-configure :show.sync="configureShow"></ui-configure>
<platform-set :show.sync="platform.show" v-bind="platform"></platform-set>
</div> </div>
</template> </template>

View File

@ -0,0 +1,115 @@
import * as API from "api/virtual/properties";
export default {
props: {
show: {
type: Boolean,
default: false
},
title: {//弹窗标题
type: String,
default: ''
},
id: {//企业id
type: [String, Number],
default: ''
},
name:{//企业名称
type:String,
default:''
},
packagetype: {//企业所属套餐类型
type: String,
default: '',
},
applyid:{//平台应用ID用来获取车型
type:[String,Number],
default:''
},
propertyId: {//配置ID
type: [String, Number],
default: ''
},
parentId:{//父级ID
type: [String, Number],
default: ''
}
},
data() {
return {
my_show: false,
loading: false,
agentList: [],//机构列表
agentSetList: [
{
agentId: '',
agentName: '',
value: '',
}
],
cartype:{
show:false,
title: '',
applyid:'',//平台应用id
id: '',//企业id
name:'',//企业名称
packagetype: '',//企业所属套餐类型
}
};
},
components: {
cartypeSet: resolve => require(['views/virtual/properties/cartype_set'], resolve),
},
mounted() {
},
watch: {
show(bool) {
this.my_show = bool;
if (bool) {
this.getAgentsList()
}
},
},
methods: {
getAgentsList() {
let data = new Object;
// data.id=this.id;
data.id = 21;
API.getAgentsList(data)
.then(res => {
if (res.code == 0) {
this.agentList = res.data;
}
})
},
addSet() {
const index = this.agentSetList.length;
const data = {
agentId: '',
agentName: '',
value: '',
}
this.$set(this.agentSetList, index, data)
},
handleSelect(data, index) {
this.agentSetList[index].agentName = data.label;
},
cartypeSet(data) {
this.cartype.show=true;
const title=this.title.split("-")[0];
this.cartype.title=`${title}-${data.agentName}-车型配置`;
this.cartype.id = this.id;
this.cartype.name=this.name;
this.cartype.packagetype = this.packagetype;
this.cartype.applyid=this.applyid;
},
delSet(data) {
this.agentSetList.splice(data, 1)
},
visibleChange(bool) {
if (!bool) {
this.$emit('update:show', false);
}
},
}
};

View File

@ -0,0 +1,122 @@
import * as API from "api/virtual/properties";
export default {
props: {
show: {
type: Boolean,
default: false
},
title: {//弹窗标题
type: String,
default: ''
},
id: {//企业id
type: [String, Number],
default: ''
},
name: {//企业名称
type: String,
default: ''
},
packagetype: {//企业所属套餐类型
type: String,
default: '',
},
applyid: {//平台应用ID用来获取车型
type: [String, Number],
default: ''
}
},
data() {
return {
my_show: false,
loading: false,
carTypeList: {},//车辆类型列表
carTypeSetList: [
{
carType: '',
value: '',
}
],
package:{
show:false,
title: '',
id: '',//企业id
packagetype: '',//校正过的套餐类型
}
};
},
mounted() {
},
components: {
packageSet: resolve => require(['views/virtual/properties/package_set'], resolve),
},
watch: {
show(bool) {
this.my_show = bool;
if (bool) {
this.getCarTypeList();
}
},
},
methods: {
getCarTypeList() {
let data = new Object;
// data.name=this.name;
data.name = '佛山市兴诺科技有限公司'
API.getApplyList(data)
.then(res => {
if (res.code == 0) {
res.data.forEach(item => {
if (item.application.id == this.applyid) {
this.carTypeList = item.carType;
}
})
}
})
},
addSet() {
const index = this.carTypeSetList.length;
const data = {
carType: '',
value: '',
}
this.$set(this.carTypeSetList, index, data)
},
handleSelect(data, index) {
// console.log(this.packagetype)
},
packageSet(data) {
this.hanlePackageType(data.carType)
const titleList=this.title.split('-');
this.package.title=`${titleList[0]}-${titleList[1]}-${data.carType}-产品配置`
// this.package.id=this.id;
this.package.id=21;
this.package.packagetype=this.hanlePackageType(data.carType);
this.package.show=true;
console.log(this.package)
},
hanlePackageType(data){
const type=this.carTypeList[data];
let packagetype='';
if((this.packagetype=='A' || this.packagetype=='C' || this.packagetype=='E')&& type=='商用车'){
packagetype='C类套餐'
}else if((this.packagetype=='A' || this.packagetype=='C' || this.packagetype=='E')&& type=='乘用车'){
packagetype='A类套餐'
}else if((this.packagetype=='A' || this.packagetype=='C' || this.packagetype=='E')&& type=='其他'){
packagetype='E类套餐'
}else if((this.packagetype=='B' || this.packagetype=='D' || this.packagetype=='F')&& type=='商用车'){
packagetype='D类套餐'
}else if((this.packagetype=='B' || this.packagetype=='D' || this.packagetype=='F')&& type=='乘用车'){
packagetype='B类套餐'
}else if((this.packagetype=='B' || this.packagetype=='D' || this.packagetype=='F')&& type=='乘用车'){
packagetype='F类套餐'
}
return packagetype
},
visibleChange(bool) {
if (!bool) {
this.$emit('update:show', false);
}
},
}
};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,68 @@
import * as API from "api/virtual/properties";
export default {
props: {
show: {
type: Boolean,
default: false
},
title: {//弹窗标题
type: String,
default: ''
},
id: {//企业id
type: [String, Number],
default: ''
},
packagetype: {//校正过的套餐类型
type: String,
default: '',
}
},
data() {
return {
my_show: false,
loading: false,
packageList:[],
packageSetList:[
{
productName:'',//产品名称
percent:'',//占比
}
]
};
},
mounted() {
},
watch: {
show(bool) {
this.my_show = bool;
if (bool) {
this.getPackageList();
}
},
},
methods: {
getPackageList() {
let data = new Object;
// data.id= this.id;
data.id = 21;
API.getPackageList(data)
.then(res => {
console.log(res)
if(res.code == 0){
console.log(this.packagetype)
this.packageList=res.data[this.packagetype]
console.log(this.packageList)
}
})
},
addSet() {
},
visibleChange(bool) {
if (!bool) {
this.$emit('update:show', false);
}
},
}
};

View File

@ -0,0 +1,189 @@
import * as API from "api/virtual/properties";
export default {
props: {
show: {
type: Boolean,
default: false
},
id: {//企业id
type: [String, Number],
default: ''
},
name: {//企业名称
type: String,
default: '',
},
packagetype: {//企业所属套餐类型
type: String,
default: '',
},
propertyId: {//配置ID
type: [String, Number],
default: ''
}
},
data() {
return {
my_show: false,
loading: false,
applyList: [],//应用平台列表
applySetList: [],
agent: {
show: false,
title: '',
applyid: '',//平台应用id
id: '',//企业id
name: '',//企业名称
packagetype: '',//企业所属套餐类型
propertyId: '',//配置ID
parentId: '',//父级ID
},
percentList: {},//储存每个占比的数据
applyidList: {},//储存每个平台ID的数据
};
},
components: {
agentSet: resolve => require(['views/virtual/properties/agent_set'], resolve),
},
mounted() {
this.getApplyList();
},
watch: {
show(bool) {
this.my_show = bool;
if (bool) {
this.getApplyList();
this.getPlatformSetList();
}
},
},
methods: {
getApplyList() {
let data = new Object;
data.name = this.name;
API.getApplyList(data)
.then(res => {
if (res.code == 0) {
let applyList = [];
res.data.forEach(item => {
applyList.push(item.application);
})
this.applyList = applyList;
}
})
},
getPlatformSetList() {
let data = new Object;
data.propertyId = this.propertyId;
data.parentId = 0;
API.getPlatformSetList(data)
.then(res => {
if (res.code == 0) {
res.data.forEach(item=>{
this.percentList[item.info.appId]=Number(item.info.percent);
this.applyidList[item.info.appId]=1;
})
this.applySetList = res.data;
}
})
},
handleSelect(data, index) {
if (this.applyidList[data.value]) {
this.$Message.error('平台不能重复');
this.$refs.sel[index].clearSingleSelect();
} else {
this.applyidList[data.value] = 1;
this.percentList[data.value] = 0;
}
this.applyList.forEach(item => {
if (item.id == data.value) {
this.applySetList[index].info.appName = item.name;
this.applySetList[index].info.appType = item.appType;
}
})
},
handleInput(data, appId) {
if (data <= 0) {
this.$Message.error('占比必须大于零');
}
this.percentList[appId] = Number(data);
},
addSet() {
const index = this.applySetList.length;
const data = {
parentId: 0,
propertyId: this.propertyId,
type: 0,
level: "#0",
info: {
appName: '',
appType: '',
appId: '',
percent: '',
}
}
this.$set(this.applySetList, index, data)
},
agentSet(data,index) {
let percentTotal = 0
for (let k in this.percentList) {
if (this.percentList[k] <= 0) {
this.$Message.error('每个平台占比必须大于零');
return false
}
percentTotal += this.percentList[k];
}
if (percentTotal != 100) {
this.$Message.error('占比总和必须等于100');
return
}
const applySetList = JSON.parse(JSON.stringify(this.applySetList))
let params = applySetList.filter(item => {
if (item.info.appId) {
item.info = JSON.stringify(item.info);
return true
} else {
return false
}
})
let obj = new Object;
obj.list = params;
API.savePlatformSet(obj)
.then(res => {
if (res.code == 0) {
this.agent.id = this.id;
this.agent.name = this.name;
this.agent.packagetype = this.packagetype;
this.agent.applyid = data.info.appId;
this.agent.title = `${data.info.appName}-下级机构配置`;
this.agent.propertyId = this.propertyId;
this.agent.parentId = res.data[index].id;
this.agent.show = true;
}
})
},
delSet(data) {
this.applySetList.splice(data, 1)
},
visibleChange(bool) {
if (!bool) {
this.$emit('update:show', false);
}
this.applyList = [];//应用平台列表
this.applySetList = [];
this.agent = {
show: false,
title: '',
applyid: '',//平台应用id
id: '',//企业id
name: '',//企业名称
packagetype: '',//企业所属套餐类型
propertyId: '',//配置ID
parentId: '',//父级ID
};
this.percentList = {};
this.applyidList = {};
},
}
};

View File

@ -0,0 +1,33 @@
<template>
<div>
<Modal :mask-closable="false" @on-visible-change="visibleChange" v-model="my_show" width="800" footer-hide>
<div slot="header">
<span style="margin-right:20px">{{title}}</span>
<Button type="primary" @click="addSet">添加</Button>
</div>
<div style="height:500px">
<Row style="margin-bottom:10px;font-size:14px;font-weight: bold;">
<Col span="12">
产品名称
</Col>
<Col span="10">占比</Col>
<Col span="2">操作</Col>
</Row>
<Row v-for="item in packageSetList" style="margin-bottom:10px">
<Col span="12">
<Select v-model="item.productName" style="width:80%" placeholder="请选择平台">
<Option v-for="a in packageList" :value="a">{{a}}</Option>
</Select>
</Col>
<Col span="10">
<Input v-model="item.percent" type="number" placeholder="请输入占比" clearable style="width:80%" />
</Col>
<Col span="2">
<Button type="error">删除</Button>
</Col>
</Row>
</div>
</Modal>
</div>
</template>
<script src="./js/package_set.js"></script>

View File

@ -0,0 +1,36 @@
<template>
<div>
<Modal :mask-closable="false" @on-visible-change="visibleChange" v-model="my_show" width="800" footer-hide>
<div slot="header">
<span style="margin-right:20px">平台配置</span>
<Button type="primary" @click="addSet">添加</Button>
</div>
<div style="height:500px">
<Row style="margin-bottom:10px;font-size:14px;font-weight: bold;">
<Col span="8">
平台名称
</Col>
<Col span="8">占比</Col>
<Col span="8">操作</Col>
</Row>
<Row v-for="(item,index) in applySetList" style="margin-bottom:10px">
<Col span="8">
<Select ref="sel" v-model="item.info.appId" clearable style="width:80%" placeholder="请选择平台" label-in-value @on-change="handleSelect($event,index)">
<Option v-for="apply in applyList" :value="apply.id" :key="apply.id">{{ apply.appType}}</Option>
</Select>
</Col>
<Col span="8">
<Input v-if="item.info.appId" v-model="item.info.percent" type="number" placeholder="请输入占比" clearable style="width:80%" @on-change="handleInput(item.info.percent,item.info.appId)"/>
<div v-else style="width:80%;height:10px"></div>
</Col>
<Col span="8">
<Button v-if="item.info.appId" type="primary" style="margin-right:20px" @click="agentSet(item,index)">配置下级机构</Button>
<Button type="error" @click="delSet(index)">删除</Button>
</Col>
</Row>
</div>
</Modal>
<agent-set :show.sync="agent.show" v-bind="agent"></agent-set>
</div>
</template>
<script src="./js/platform_set.js"></script>