diff --git a/src/api/management/goods.js b/src/api/management/goods.js
index 067d0df1a..40fbd4cd7 100644
--- a/src/api/management/goods.js
+++ b/src/api/management/goods.js
@@ -129,3 +129,12 @@ export function postsPermissionGoods(data) {
data: data
});
}
+
+// 创建万能权限商品
+export function postPermissionIdsGoods(data) {
+ return request({
+ url: `/api/goods/permissionIds`,
+ method: 'post',
+ data: data
+ });
+}
diff --git a/src/api/management/order.js b/src/api/management/order.js
index 9879f0c94..322ea6a47 100644
--- a/src/api/management/order.js
+++ b/src/api/management/order.js
@@ -113,13 +113,10 @@ export function createPermission(data) {
});
}
-// 校验是否存在所选择权限对应的权限包
+// 万能权限查询权限包商品
export function postFindPermission(ids) {
return request({
- url: `/api/permission/findPermission`,
- method: 'post',
- data: {
- relPermissions: ids
- }
+ url: `/api/goods/permissionIds?ids=${ids}`,
+ method: 'get'
});
}
diff --git a/src/router/index.js b/src/router/index.js
index 9a8447ed9..99ce006c7 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -875,7 +875,7 @@ export const asyncRouter = [
redirect: '/design/usermap/home',
component: Layout,
meta: {
- roles: [admin, user]
+ roles: [admin]
},
children: [
{
@@ -897,16 +897,11 @@ export const asyncRouter = [
path: 'map/draw/:mapId/:view',
component: NewMapDraft,
hidden: true
- },
- { // 运行图设计
- path: 'runPlan/detail/:mapId',
- component: PlanMonitorDetail,
- hidden: true
}
]
}
]
- },
+ }
];
const createRouter = () => new Router({
diff --git a/src/views/newMap/newDesignUser/demonList.vue b/src/views/newMap/newDesignUser/demonList.vue
index 3705b13d4..aa90bb970 100644
--- a/src/views/newMap/newDesignUser/demonList.vue
+++ b/src/views/newMap/newDesignUser/demonList.vue
@@ -21,14 +21,6 @@
{{ $t('map.newConstruction') }}
-
-
diff --git a/src/views/orderauthor/permission/create/order.vue b/src/views/orderauthor/permission/create/order.vue
index e1ec1eeb0..88cead5a5 100644
--- a/src/views/orderauthor/permission/create/order.vue
+++ b/src/views/orderauthor/permission/create/order.vue
@@ -332,11 +332,13 @@ export default {
// 第一个参数 商品对象、 第二个参数 权限对象
setOrderName(permission, good) {
if (good) {
- this.formModel.goodsName = good.name;
- this.formModel.price = good.price;
- this.formModel.goodsId = good.id;
+ this.formModel = { // 订单数据
+ goodsName: good.name,
+ price: good.price,
+ goodsId: good.id
+ };
this.permissionVo = permission; // 权限对象
- this.goodsVo = good;
+ this.goodsVo = good; // 商品对象
}
},
buildModel() {
@@ -363,11 +365,9 @@ export default {
this.$refs.dataform.validateForm(() => {
this.orderList = [];
this.goodsList.forEach(item => {
- this.formModel.organizationId = this.buildModel();
- // const param = deepAssign({}, this.formModel);
const param = {
- goodItem: item.goodItem,
- permissionType: item.permissionType
+ goodItem: item.goodItem, // 商品对象
+ permissionType: item.permissionType // 权限类型
};
this.orderList.push(param);
});
@@ -380,10 +380,8 @@ export default {
return nor.permissionId;
});
const param = {
- // createVO: {isPackage: false, relPermissions: arr},
- // orderList: this.orderList,
- // canDistribute: this.formModel.canDistribute == '01'
isPackage: false,
+ // 订单数据 formModel
organizationId: this.formModel.organizationId,
packageNum: this.formModel.amount,
amount: this.formModel.amount,
@@ -397,8 +395,7 @@ export default {
bizType: this.formModel.bizType,
payWays: this.formModel.payWays,
forever: this.formModel.forever,
-
- // mapId: this.goodsList[0].mapId,
+ // 基础权限 list
relPermissions: arr,
orderDetailList: this.orderList
};
@@ -431,6 +428,7 @@ export default {
// orderList: [this.formModel],
// canDistribute: this.formModel.canDistribute == '01'
isPackage: true,
+ // 订单数据 formModel
organizationId: this.formModel.organizationId,
packageNum: this.formModel.amount,
startTime: this.formModel.startTime,
@@ -443,16 +441,17 @@ export default {
totalPrice: this.formModel.totalPrice,
contractNo: this.formModel.contractNo,
orderType: this.formModel.orderType,
-
+ // 商品数据 goodsVo
packageName: this.goodsVo.name,
remarks: this.goodsVo.remarks,
price: this.goodsVo.price,
tryUse: this.goodsVo.tryUse,
tryUseTime: this.goodsVo.tryUseTime,
tryUseTimeUnit: this.goodsVo.tryUseTimeUnit,
- relPermissions: this.permissionVo.relPermissions,
+ // 权限包ids 默认名称是 商品名称
+ relPermissions: this.permissionVo.relPermissions
- mapId: this.permissionVo.mapId
+ // mapId: this.permissionVo.mapId
// prdCode: this.permissionVo.prdCode
};
createPermission(param).then(res => {
diff --git a/src/views/orderauthor/permission/create/permission.vue b/src/views/orderauthor/permission/create/permission.vue
index 4edf55d81..406ac4330 100644
--- a/src/views/orderauthor/permission/create/permission.vue
+++ b/src/views/orderauthor/permission/create/permission.vue
@@ -128,6 +128,9 @@ export default {
{value: '02', label: this.$t('orderAuthor.universalPackage')}
],
isGoods: false,
+ idPackage: false,
+ permissionPackageId: '',
+ permissionGoddsId: '',
mapList: [],
goodsList: [], // 商品列表
createGoodList: [], // 待创建商品列表
@@ -158,18 +161,7 @@ export default {
const arr = list.map(item => {
return item.id;
});
- postFindPermission(arr).then(res => {
- this.isGoods = false;
- if (res.data && res.data.id) {
- this.isGoods = true;
- this.addModel.name = res.data.name;
- this.addModel.price = res.data.prdPrice || 0.01;
- this.addModel.remarks = res.data.remarks;
- this.addModel.tryUse = res.data.tryUse;
- this.addModel.tryUseTime = res.data.tryUseTime;
- this.addModel.tryUseTimeUnit = res.data.tryUseTimeUnit;
- }
- });
+ this.postFindPermission(arr);
}
}
},
@@ -192,22 +184,43 @@ export default {
data.payPrice = 0.01;
}
},
+ postFindPermission(arr) { // 判断万能权限ids 是否拥有商品
+ postFindPermission(arr).then(res => {
+ this.isGoods = false;
+ this.permissionPackageId = '';
+ this.permissionGoddsId = '';
+ if (res.data && res.data.id) {
+ this.isGoods = true;
+ this.idPackage = true;
+ this.permissionPackageId = res.data.id;
+ this.permissionGoddsId = res.data.goodsId;
+ this.addModel.name = res.data.name;
+ this.addModel.price = res.data.prdPrice || 0.01;
+ this.addModel.remarks = res.data.remarks;
+ this.addModel.tryUse = res.data.tryUse;
+ this.addModel.tryUseTime = res.data.tryUseTime;
+ this.addModel.tryUseTimeUnit = res.data.tryUseTimeUnit;
+ } else {
+ this.idPackage = false;
+ }
+ });
+ },
changeRadio(data) {
this.$emit('changeType', data);
if (data == '02' && this.ruleList.length) {
const arr = this.ruleList.map(item => {
return item.id;
});
- postFindPermission(arr).then(res => {
- this.isGoods = false;
- if (res.data && res.data.id) {
- this.isGoods = true;
- this.addModel.name = res.data.name;
- this.addModel.price = res.data.prdPrice || 0.01;
- this.addModel.remarks = res.data.remarks;
- this.addModel.tryUse = res.data.tryUse;
- this.addModel.tryUseTime = res.data.tryUseTime;
- this.addModel.tryUseTimeUnit = res.data.tryUseTimeUnit;
+ this.postFindPermission(arr);
+ } else if (data == '01' && this.ruleList.length) {
+ this.ruleList.map(item => {
+ if (!item.price) {
+ getGoodsByPermissionId(item.id).then(res => {
+ if (res.data && (res.data instanceof Object)) {
+ item.price = res.data.price;
+ item.goods = res.data;
+ }
+ });
}
});
}
@@ -263,15 +276,17 @@ export default {
},
addRuleForm(index, row) { // 添加权限获取对应的商品
row['isPut'] = true;
- getGoodsByPermissionId(row.id).then(res => {
- if (res.data && (res.data instanceof Object)) {
- row.price = res.data.price;
- if (this.addModel.type == '01') {
+ if (this.addModel.type == '01') {
+ getGoodsByPermissionId(row.id).then(res => {
+ if (res.data && (res.data instanceof Object)) {
+ row.price = res.data.price;
row.goods = res.data;
}
this.ruleList.push(row);
- }
- });
+ });
+ } else if (this.addModel.type == '02') {
+ this.ruleList.push(row);
+ }
},
dialogSelect(row) {
if (this.addModel.mapId) {
@@ -293,97 +308,29 @@ export default {
};
return model;
},
+ buildGoodModel(item) {
+ return {
+ goodItem: {
+ name: item.name,
+ permissionId: item.id,
+ permissionName: item.goods.name,
+ id: item.goods.id
+ },
+ permissionType: item.type,
+ permissionId: item.id,
+ isPackage: item.isPackage,
+ name: item.goods.name,
+ price: item.goods.price,
+ remarks: item.goods.remarks
+ };
+ },
async permissionNext() {
if ((this.addModel.type === '01' && this.ruleList.length) || (this.addModel.type === '02' && this.ruleList.length > 1) ) {
const arr = this.ruleList.map(item => { return item.id; });
if (this.addModel.type == '01') {
- const list = []; // 已有商品列表
- const goodsList = []; // 待创建商品列表
- this.ruleList.forEach(nor => {
- if (nor.payPrice) {
- nor.price = nor.payPrice;
- goodsList.push(this.buildModel(nor));
- }
- if (nor.price) {
- nor.payPrice = '';
- list.push(nor);
- }
- });
- if (goodsList.length) {
- try {
- const response = await postsPermissionGoods({goodsVOList: goodsList});
- this.goodsListNew = response.data;
- } catch (error) { this.goodsList = []; }
- }
- if (list.length == this.ruleList.length) {
- this.goodsList = [];
- this.ruleList.forEach(item => {
- this.goodsListNew.forEach(ele => {
- if (item.id == ele.permissionId) {
- item.goods = ele;
- }
- });
- const param = {
- goodItem: {
- name: item.name,
- permissionId: item.id,
- permissionName: item.goods.name,
- id: item.goods.id
- },
- permissionType: item.type,
- // mapId: item.mapId,
- permissionId: item.id,
- isPackage: item.isPackage,
- name: item.goods.name,
- price: item.goods.price,
- remarks: item.goods.remarks
- };
- item.goods && this.goodsList.push(param);
- });
- if (this.goodsList.length == this.ruleList.length) {
- this.$emit('permissionNext', this.goodsList);
- }
- } else {
- this.$messageBox('基础权限没有对应商品类型, 请填写商品价格会自动创建');
- }
+ this.basicPermissionsNext();
} else if (this.addModel.type == '02') {
- this.$refs.formData.validate((valid) => {
- if (valid) { // 判断是否有重复万能权限 有的话使用有的权限
- postFindPermission(arr).then(res => {
- this.addModel['relPermissions'] = arr;
- if (res.data) {
- this.addModel['id'] = res.data.id;
- }
- if (this.isGoods) { // 有商品传值
- const good = {
- id: res.data.goodsId,
- permissionId: res.data.id,
- name: this.addModel.name,
- price: this.addModel.price,
- remarks: this.addModel.remarks,
- tryUse: this.addModel.forever,
- tryUseTime: this.addModel.tryUseTime,
- tryUseTimeUnit: this.addModel.tryUseTimeUnit,
- list: this.ruleList
- };
- this.$emit('permissionNextOrder', this.addModel, good);
- } else {
- // 创建万能权限商品 接口
- const good = {
- name: this.addModel.name,
- permissionId: '',
- tryUse: this.addModel.forever,
- tryUseTime: this.addModel.tryUseTime,
- tryUseTimeUnit: this.addModel.tryUseTimeUnit,
- price: this.addModel.price,
- remarks: this.addModel.remarks,
- list: this.ruleList
- };
- this.$emit('permissionNextOrder', this.addModel, good);
- }
- }).catch((error) => { console.log(error); });
- }
- });
+ this.allPermissionNext(arr);
}
} else if (this.addModel.type === '02') {
this.$messageBox(this.$t('tip.createUniversalPermissionsTip'));
@@ -391,6 +338,93 @@ export default {
this.$messageBox(this.$t('tip.addPackage'));
}
},
+ async basicPermissionsNext() { // 基础权限下一步
+ const list = []; // 已有商品列表
+ const goodsList = []; // 待创建商品列表
+ let flag = true; // 校验商品创建成功
+ this.ruleList.forEach(nor => {
+ if (nor.payPrice) {
+ nor.price = nor.payPrice;
+ goodsList.push(this.buildModel(nor));
+ }
+ if (nor.price) {
+ nor.payPrice = '';
+ list.push(nor);
+ }
+ });
+ if (goodsList.length) {
+ try {
+ const response = await postsPermissionGoods(goodsList);
+ flag = false;
+ if (response.code == 200) {
+ this.goodsListNew = response.data;
+ flag = true;
+ }
+ } catch (error) { this.goodsList = []; flag = false; }
+ }
+ if (flag) {
+ if (list.length == this.ruleList.length) {
+ this.goodsList = [];
+ this.ruleList.forEach(item => {
+ this.goodsListNew.forEach(ele => {
+ if (item.id == ele.permissionId) {
+ item.goods = ele;
+ }
+ });
+ const param = this.buildGoodModel(item);
+ item.goods && this.goodsList.push(param);
+ });
+ if (this.goodsList.length == this.ruleList.length) {
+ this.$emit('permissionNext', this.goodsList);
+ }
+ } else {
+ this.$message('基础权限没有对应商品类型, 请填写商品价格会自动创建');
+ }
+ } else {
+ this.$message('商品创建失败!');
+ }
+ },
+ allPermissionNext(arr) { // 万能权限下一步
+ this.$refs.formData.validate((valid) => {
+ if (valid) { // 判断是否有重复万能权限 有的话使用有的权限
+ // postFindPermission(arr).then(res => {
+ this.addModel['relPermissions'] = arr; // 权限包ids
+ // if (res.data) {
+ this.addModel['id'] = this.permissionPackageId;
+ // }
+ // if (this.isGoods) { // 有商品传值
+ const good = {
+ id: this.permissionGoddsId,
+ permissionId: this.permissionPackageId,
+ name: this.addModel.name,
+ price: this.addModel.price,
+ remarks: this.addModel.remarks,
+ tryUse: this.addModel.forever,
+ tryUseTime: this.addModel.tryUseTime,
+ tryUseTimeUnit: this.addModel.tryUseTimeUnit,
+ list: this.ruleList
+ };
+ this.$emit('permissionNextOrder', this.addModel, good);
+ // }
+ // else {
+ // // 创建万能权限商品 接口
+ // const good = {
+ // id: '',
+ // permissionId: '',
+ // name: this.addModel.name,
+ // price: this.addModel.price,
+ // remarks: this.addModel.remarks,
+ // tryUse: this.addModel.forever,
+ // tryUseTime: this.addModel.tryUseTime,
+ // tryUseTimeUnit: this.addModel.tryUseTimeUnit,
+ // list: this.ruleList
+ // };
+ // this.$emit('permissionNextOrder', this.addModel, good);
+ // }
+ // }).catch((error) => { console.log(error); });
+ }
+ });
+ },
turnback() {
this.$router.go(-1);
}