Merge remote-tracking branch 'remotes/origin/dev' into test
This commit is contained in:
commit
ff26ebfc08
@ -124,7 +124,8 @@ export function getGoodsByPermissionId(id) {
|
||||
// 创建商品
|
||||
export function postsPermissionGoods(data) {
|
||||
return request({
|
||||
url: `/api/goods`,
|
||||
// url: `/api/goods`,
|
||||
url: `/api/goods/create/list`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
@ -138,3 +139,12 @@ export function postPermissionIdsGoods(data) {
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
// 创建万能权限商品
|
||||
export function postCreatePackage(data) {
|
||||
return request({
|
||||
url: `/api/goods/create/package`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
@ -107,7 +107,8 @@ export function cancalOrder(orderId) {
|
||||
// 快速创建权限
|
||||
export function createPermission(data) {
|
||||
return request({
|
||||
url: `/api/order/quicklyGenerateOrder`,
|
||||
// url: `/api/order/quicklyGenerateOrder`,
|
||||
url: `/api/distribute/createQuickly`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
|
@ -558,4 +558,5 @@ export default {
|
||||
chargeStationList:'Managed station list',
|
||||
createModel: 'Create model:',
|
||||
startingPoint: 'Starting point:',
|
||||
endingPoint: 'Ending point:'
|
||||
};
|
||||
|
@ -551,5 +551,6 @@ export default {
|
||||
rightAssociatedSection: '右关联区段:',
|
||||
chargeStationList:'管理车站列表',
|
||||
createModel: '创建方式:',
|
||||
startingPoint: '起点:'
|
||||
startingPoint: '起点:',
|
||||
endingPoint: '终点:'
|
||||
};
|
||||
|
@ -150,10 +150,6 @@ class Jlmap {
|
||||
}
|
||||
}
|
||||
|
||||
setLayerVisible(layer) {
|
||||
this.$painter.setLayerVisible(layer);
|
||||
}
|
||||
|
||||
setLevelVisible(list) {
|
||||
this.$painter.setLevelVisible(list);
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ class MouseController extends Eventful {
|
||||
deviceList.forEach( item =>{
|
||||
if (item.instance && item.instance._type == deviceType.Section) {
|
||||
let deviceBoundingRect = {};
|
||||
if (item.type == '03') {
|
||||
if (item.type == '04') {
|
||||
deviceBoundingRect = {
|
||||
x1: item.namePosition.x,
|
||||
y1: item.namePosition.y,
|
||||
|
@ -27,11 +27,6 @@ class Painter {
|
||||
* @param {*} config
|
||||
*/
|
||||
initLevels() {
|
||||
// 图层分级策略
|
||||
this.layerBranch = {};
|
||||
this.layerBranch['01'] = (type) => { return type == deviceType.Link; }; // 逻辑图层级
|
||||
this.layerBranch['02'] = (type) => { return type != deviceType.Link; }; // 物理图层级
|
||||
this.layerBranch['03'] = (type) => { return true; }; // 混合图层级
|
||||
|
||||
// 添加父级图层
|
||||
this.parentLevel = new Group({ name: '__parent__' });
|
||||
@ -43,9 +38,6 @@ class Painter {
|
||||
this.mapInstanceLevel[type] = level;
|
||||
this.parentLevel.add(level);
|
||||
});
|
||||
|
||||
// 设置默认显示图级
|
||||
this.setLayerVisible('02');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -193,21 +185,6 @@ class Painter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置逻辑和物理图层
|
||||
* @param {*} layer
|
||||
*/
|
||||
setLayerVisible(layer) {
|
||||
zrUtil.each(Object.values(deviceType), type => {
|
||||
const level = this.mapInstanceLevel[type];
|
||||
if (this.layerBranch[layer](type)) {
|
||||
level.show();
|
||||
} else {
|
||||
level.hide();
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置图层可见
|
||||
* @param {*} code
|
||||
|
@ -9,8 +9,8 @@ import { EAxle } from './EAxle'; // 创建计轴 (私有)
|
||||
import { EBackArrow, EBackArrowTriangle } from './EBackArrow'; // 折返进路箭头
|
||||
import ELimitName from './ELimitName'; // 成都三号线 限速名称
|
||||
import JTriangle from '../../utils/JTriangle';
|
||||
import Rect from 'zrender/src/graphic/shape/Rect';
|
||||
import router from '@/router';
|
||||
import EHighlight from '../element/EHighlight';
|
||||
|
||||
/** 区段*/
|
||||
export default class Section extends Group {
|
||||
@ -24,8 +24,8 @@ export default class Section extends Group {
|
||||
this.style = style;
|
||||
this.create();
|
||||
this.createMouseEvent();
|
||||
this.createMouse(); // 框选鼠标移入移事件
|
||||
this.setState(model);
|
||||
this.checkIsDrawMap();
|
||||
}
|
||||
|
||||
create() {
|
||||
@ -823,31 +823,6 @@ export default class Section extends Group {
|
||||
}
|
||||
}
|
||||
|
||||
createMouse() {
|
||||
const rect = this.getBoundingRect();
|
||||
this.lineBorder = new Rect({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z - 1,
|
||||
shape: rect,
|
||||
style: {
|
||||
lineDash: [3, 3],
|
||||
stroke: '#fff',
|
||||
fill: this.style.transparentColor
|
||||
}
|
||||
});
|
||||
|
||||
this.add(this.lineBorder);
|
||||
this.lineBorder.hide();
|
||||
}
|
||||
|
||||
mouseout() {
|
||||
this.lineBorder && this.lineBorder.show();
|
||||
}
|
||||
|
||||
mouseover() {
|
||||
this.lineBorder && this.lineBorder.hide();
|
||||
}
|
||||
|
||||
/** 计算提示位置*/
|
||||
getShapeTipPoint() {
|
||||
let rect = this.getBoundingRect();
|
||||
@ -874,4 +849,18 @@ export default class Section extends Group {
|
||||
return super.getBoundingRect();
|
||||
}
|
||||
}
|
||||
|
||||
drawSelected(selected) {
|
||||
this.highlight && this.highlight.drawSelected(selected);
|
||||
}
|
||||
|
||||
checkIsDrawMap() {
|
||||
const path = window.location.href;
|
||||
if (path.includes('/map/draw')) {
|
||||
this.highlight = new EHighlight(this.section);
|
||||
this.add(this.highlight);
|
||||
this.on('mouseout', () => { this.highlight.mouseout(); });
|
||||
this.on('mouseover', () => { this.highlight.mouseover(); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import ESigName from './ESigName';
|
||||
import EMouse from './EMouse';
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import BoundingRect from 'zrender/src/core/BoundingRect';
|
||||
import EHighlight from '../element/EHighlight';
|
||||
|
||||
class Signal extends Group {
|
||||
constructor(model, style) {
|
||||
@ -28,6 +29,7 @@ class Signal extends Group {
|
||||
this.createMouseEvent();
|
||||
this.transformRotation(this);
|
||||
this.setState(model);
|
||||
this.checkIsDrawMap();
|
||||
}
|
||||
|
||||
create() {
|
||||
@ -510,6 +512,19 @@ class Signal extends Group {
|
||||
y: rect.y - offsetY
|
||||
};
|
||||
}
|
||||
drawSelected(selected) {
|
||||
this.highlight && this.highlight.drawSelected(selected);
|
||||
}
|
||||
|
||||
checkIsDrawMap() {
|
||||
const path = window.location.href;
|
||||
if (path.includes('/map/draw')) {
|
||||
this.highlight = new EHighlight(this);
|
||||
this.add(this.highlight);
|
||||
this.on('mouseout', () => { this.highlight.mouseout(); });
|
||||
this.on('mouseover', () => { this.highlight.mouseover(); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default Signal;
|
||||
|
@ -2,73 +2,88 @@
|
||||
* 车站
|
||||
*/
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import ETextName from '../element/ETextName'; // 名称文字 (共有)
|
||||
import ETextName from '../element/ETextName';
|
||||
import EHighlight from '../element/EHighlight'; // 名称文字 (共有)
|
||||
|
||||
export default class Station extends Group {
|
||||
constructor(model, style) {
|
||||
super();
|
||||
this._code = model.code;
|
||||
this._type = model._type;
|
||||
this.zlevel = model.zlevel;
|
||||
this.z = 40;
|
||||
this.model = model;
|
||||
this.style = style;
|
||||
this.create();
|
||||
this.setState(model);
|
||||
}
|
||||
constructor(model, style) {
|
||||
super();
|
||||
this._code = model.code;
|
||||
this._type = model._type;
|
||||
this.zlevel = model.zlevel;
|
||||
this.z = 40;
|
||||
this.model = model;
|
||||
this.style = style;
|
||||
this.create();
|
||||
this.setState(model);
|
||||
this.checkIsDrawMap();
|
||||
}
|
||||
|
||||
create() {
|
||||
const model = this.model;
|
||||
const style = this.style;
|
||||
create() {
|
||||
const model = this.model;
|
||||
const style = this.style;
|
||||
|
||||
if (model.visible) {
|
||||
// 公里标名称是否显示
|
||||
this.stationText = new ETextName({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
position: [0, 0],
|
||||
x: model.position.x,
|
||||
y: model.position.y,
|
||||
fontWeight: model.fontWeight,
|
||||
fontSize: model.nameFont || 18,
|
||||
fontFamily: style.fontFamily,
|
||||
text: model.name,
|
||||
textAlign: 'middle',
|
||||
textVerticalAlign: 'top',
|
||||
textFill: model.nameFontColor
|
||||
});
|
||||
this.add(this.stationText);
|
||||
const path = window.location.href;
|
||||
if (style.Station.kmPostShow || path.includes('/map/draw')) {
|
||||
// 公里标是否显示
|
||||
let direction = 1;
|
||||
if (this.style.Station.kilometerPosition == 'up') {
|
||||
direction = -1;
|
||||
}
|
||||
this.mileageText = new ETextName({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
position: [0, 0],
|
||||
x: model.position.x,
|
||||
y: model.position.y + ((parseInt(model.nameFont) + 2) * direction),
|
||||
fontWeight: model.fontWeight,
|
||||
fontSize: model.kmPostFont || 18,
|
||||
fontFamily: style.fontFamily,
|
||||
text: model.kmPost,
|
||||
textAlign: 'middle',
|
||||
textVerticalAlign: 'top',
|
||||
textFill: model.kmPostFontColor
|
||||
});
|
||||
this.add(this.mileageText);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (model.visible) {
|
||||
// 公里标名称是否显示
|
||||
this.stationText = new ETextName({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
position: [0, 0],
|
||||
x: model.position.x,
|
||||
y: model.position.y,
|
||||
fontWeight: model.fontWeight,
|
||||
fontSize: model.nameFont || 18,
|
||||
fontFamily: style.fontFamily,
|
||||
text: model.name,
|
||||
textAlign: 'middle',
|
||||
textVerticalAlign: 'top',
|
||||
textFill: model.nameFontColor
|
||||
});
|
||||
this.add(this.stationText);
|
||||
const path = window.location.href;
|
||||
if (style.Station.kmPostShow || path.includes('/map/draw')) {
|
||||
// 公里标是否显示
|
||||
let direction = 1;
|
||||
if (this.style.Station.kilometerPosition == 'up') {
|
||||
direction = -1;
|
||||
}
|
||||
this.mileageText = new ETextName({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
position: [0, 0],
|
||||
x: model.position.x,
|
||||
y: model.position.y + ((parseInt(model.nameFont) + 2) * direction),
|
||||
fontWeight: model.fontWeight,
|
||||
fontSize: model.kmPostFont || 18,
|
||||
fontFamily: style.fontFamily,
|
||||
text: model.kmPost,
|
||||
textAlign: 'middle',
|
||||
textVerticalAlign: 'top',
|
||||
textFill: model.kmPostFontColor
|
||||
});
|
||||
this.add(this.mileageText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
setState(model) {
|
||||
}
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
setState(model) {
|
||||
}
|
||||
|
||||
getShapeTipPoint() {
|
||||
return null;
|
||||
}
|
||||
getShapeTipPoint() {
|
||||
return null;
|
||||
}
|
||||
drawSelected(selected) {
|
||||
this.highlight && this.highlight.drawSelected(selected);
|
||||
}
|
||||
|
||||
checkIsDrawMap() {
|
||||
const path = window.location.href;
|
||||
if (path.includes('/map/draw')) {
|
||||
this.highlight = new EHighlight(this);
|
||||
this.add(this.highlight);
|
||||
this.on('mouseout', () => { this.highlight.mouseout(); });
|
||||
this.on('mouseover', () => { this.highlight.mouseover(); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import ESafeStand from './ESafeStand';
|
||||
import ESafeEmergent from './ESafeEmergent';
|
||||
import EMouse from './EMouse';
|
||||
import EJump from './EJump';
|
||||
import EHighlight from '../element/EHighlight';
|
||||
|
||||
class StationStand extends Group {
|
||||
constructor(model, style) {
|
||||
@ -24,6 +25,7 @@ class StationStand extends Group {
|
||||
this.createMouseEvent();
|
||||
this.setVisible(model.visible);
|
||||
this.setState(model);
|
||||
this.checkIsDrawMap();
|
||||
}
|
||||
create() {
|
||||
const model = this.model;
|
||||
@ -413,5 +415,19 @@ class StationStand extends Group {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
drawSelected(selected) {
|
||||
this.highlight && this.highlight.drawSelected(selected);
|
||||
}
|
||||
|
||||
checkIsDrawMap() {
|
||||
const path = window.location.href;
|
||||
if (path.includes('/map/draw')) {
|
||||
this.highlight = new EHighlight(this);
|
||||
this.add(this.highlight);
|
||||
this.on('mouseout', () => { this.highlight.mouseout(); });
|
||||
this.on('mouseover', () => { this.highlight.mouseover(); });
|
||||
}
|
||||
}
|
||||
}
|
||||
export default StationStand;
|
||||
|
@ -10,6 +10,7 @@ import ESwLocal from './ESwLocal.js';
|
||||
import ESwLnversion from './ESwLnversion';
|
||||
import ELockRect from './ELockRect';
|
||||
import EMouse from './EMouse';
|
||||
import EHighlight from '../element/EHighlight';
|
||||
|
||||
export default class Switch extends Group {
|
||||
constructor(model, style) {
|
||||
@ -25,6 +26,7 @@ export default class Switch extends Group {
|
||||
this.createLockRect(); // 创建单锁矩形框显示
|
||||
this.createMouseEvent();
|
||||
this.setState(model);
|
||||
this.checkIsDrawMap();
|
||||
}
|
||||
|
||||
createMouseEvent() {
|
||||
@ -422,4 +424,18 @@ export default class Switch extends Group {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
drawSelected(selected) {
|
||||
this.highlight && this.highlight.drawSelected(selected);
|
||||
}
|
||||
|
||||
checkIsDrawMap() {
|
||||
const path = window.location.href;
|
||||
if (path.includes('/map/draw')) {
|
||||
this.highlight = new EHighlight(this);
|
||||
this.add(this.highlight);
|
||||
this.on('mouseout', () => { this.highlight.mouseout(); });
|
||||
this.on('mouseover', () => { this.highlight.mouseover(); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
47
src/jmapNew/shape/element/EHighlight.js
Normal file
47
src/jmapNew/shape/element/EHighlight.js
Normal file
@ -0,0 +1,47 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import Rect from 'zrender/src/graphic/shape/Rect';
|
||||
|
||||
class EHighlight extends Group {
|
||||
constructor(device) {
|
||||
super();
|
||||
this.device = device;
|
||||
this.selected = false;
|
||||
this.create();
|
||||
}
|
||||
create() {
|
||||
if (this.device) {
|
||||
const rect = this.device.getBoundingRect();
|
||||
this.lineBorder = new Rect({
|
||||
zlevel: this.device.zlevel,
|
||||
z: this.device.z + 1,
|
||||
shape: rect,
|
||||
style: {
|
||||
lineDash: [3, 3],
|
||||
stroke: '#fff',
|
||||
fill: 'rgba(204,255,255,0.5)'
|
||||
}
|
||||
});
|
||||
|
||||
this.add(this.lineBorder);
|
||||
this.lineBorder.hide();
|
||||
}
|
||||
}
|
||||
|
||||
mouseover() {
|
||||
this.lineBorder && this.lineBorder.show();
|
||||
}
|
||||
|
||||
mouseout() {
|
||||
!this.selected && this.lineBorder && this.lineBorder.hide();
|
||||
}
|
||||
drawSelected(selected) {
|
||||
if (selected && this.lineBorder) {
|
||||
this.lineBorder && this.lineBorder.show();
|
||||
this.selected = true;
|
||||
} else {
|
||||
this.lineBorder && this.lineBorder.hide();
|
||||
this.selected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
export default EHighlight;
|
@ -84,110 +84,110 @@ function saveMapDeviceDefaultRelations(state) {
|
||||
const map = state.map;
|
||||
const deviceMap = Vue.prototype.$jlmap.mapDevice;
|
||||
// 是否集中站
|
||||
if (map.stationControlList && map.stationControlList.length) {
|
||||
map.stationControlList.forEach(elem => {
|
||||
const station = deviceMap[elem.stationCode];
|
||||
if (station) {
|
||||
station.centralized = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
// if (map.stationControlList && map.stationControlList.length) {
|
||||
// map.stationControlList.forEach(elem => {
|
||||
// const station = deviceMap[elem.stationCode];
|
||||
// if (station) {
|
||||
// station.centralized = true;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// 设置区段关联
|
||||
if (map.sectionList && map.sectionList.length) {
|
||||
map.sectionList.forEach(elem => {
|
||||
if (elem.type !== '03') {
|
||||
const station = deviceMap[elem.parentCode];
|
||||
if (station) {
|
||||
elem.stationCode = station.stationCode;
|
||||
}
|
||||
} else {
|
||||
elem.parentCode = '';
|
||||
}
|
||||
// map.sectionList.forEach(elem => {
|
||||
// if (elem.type !== '03') {
|
||||
// const station = deviceMap[elem.parentCode];
|
||||
// if (station) {
|
||||
// elem.stationCode = station.stationCode;
|
||||
// }
|
||||
// } else {
|
||||
// elem.parentCode = '';
|
||||
// }
|
||||
|
||||
if (elem.type === '01') {
|
||||
elem.nameShow == true;
|
||||
}
|
||||
});
|
||||
// if (elem.type === '01') {
|
||||
// elem.nameShow == true;
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
// 站台轨设置
|
||||
if (map.stationStandList && map.stationStandList.length && map.sectionList && map.sectionList.length) {
|
||||
map.stationStandList.forEach((stand) => {
|
||||
const stopPoint = deviceMap[stand.stopPointCode];
|
||||
if (stopPoint) {
|
||||
map.sectionList.forEach(section => {
|
||||
if (section.type === '01' &&
|
||||
stopPoint.linkCode === section.linkCode &&
|
||||
stopPoint.offset >= section.offsetLeft &&
|
||||
stopPoint.offset <= section.offsetRight) {
|
||||
section.isStandTrack = true;
|
||||
if (!section.standTrackName) {
|
||||
section.standTrackName = section.name.replace(section.name.slice(0, 2), 'ZT');
|
||||
}
|
||||
if (!section.standTrackNamePosition) {
|
||||
section.standTrackNamePosition = { x: 0, y: 0 };
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// if (map.stationStandList && map.stationStandList.length && map.sectionList && map.sectionList.length) {
|
||||
// map.stationStandList.forEach((stand) => {
|
||||
// const stopPoint = deviceMap[stand.stopPointCode];
|
||||
// if (stopPoint) {
|
||||
// map.sectionList.forEach(section => {
|
||||
// if (section.type === '01' &&
|
||||
// stopPoint.linkCode === section.linkCode &&
|
||||
// stopPoint.offset >= section.offsetLeft &&
|
||||
// stopPoint.offset <= section.offsetRight) {
|
||||
// section.isStandTrack = true;
|
||||
// if (!section.standTrackName) {
|
||||
// section.standTrackName = section.name.replace(section.name.slice(0, 2), 'ZT');
|
||||
// }
|
||||
// if (!section.standTrackNamePosition) {
|
||||
// section.standTrackNamePosition = { x: 0, y: 0 };
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// 折返轨设置
|
||||
if (map.stopPointList && map.stopPointList.length && map.sectionList && map.sectionList.length) {
|
||||
map.stopPointList.forEach(stopPoint => {
|
||||
if (stopPoint.isTurningPoint) {
|
||||
map.sectionList.forEach(section => {
|
||||
if (section.type === '01' &&
|
||||
stopPoint.linkCode === section.linkCode &&
|
||||
stopPoint.offset >= section.offsetLeft &&
|
||||
stopPoint.offset <= section.offsetRight) {
|
||||
section.isReentryTrack = true;
|
||||
if (!section.reentryTrackName) {
|
||||
section.reentryTrackName = section.name.replace(section.name.slice(0, 2), 'ZF');
|
||||
}
|
||||
if (!section.reentryTrackNamePosition) {
|
||||
section.reentryTrackNamePosition = { x: 0, y: 0 };
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// if (map.stopPointList && map.stopPointList.length && map.sectionList && map.sectionList.length) {
|
||||
// map.stopPointList.forEach(stopPoint => {
|
||||
// if (stopPoint.isTurningPoint) {
|
||||
// map.sectionList.forEach(section => {
|
||||
// if (section.type === '01' &&
|
||||
// stopPoint.linkCode === section.linkCode &&
|
||||
// stopPoint.offset >= section.offsetLeft &&
|
||||
// stopPoint.offset <= section.offsetRight) {
|
||||
// section.isReentryTrack = true;
|
||||
// if (!section.reentryTrackName) {
|
||||
// section.reentryTrackName = section.name.replace(section.name.slice(0, 2), 'ZF');
|
||||
// }
|
||||
// if (!section.reentryTrackNamePosition) {
|
||||
// section.reentryTrackNamePosition = { x: 0, y: 0 };
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// 设置道岔区段
|
||||
if (map.switchList && map.switchList.length && map.sectionList && map.sectionList.length) {
|
||||
map.switchList.forEach(elem => {
|
||||
const sectiona = deviceMap[elem.sectionACode];
|
||||
if (sectiona && sectiona.type !== '03') {
|
||||
sectiona.nameShow = false;
|
||||
sectiona.isSwitchSection = true;
|
||||
sectiona.relSwitchCode = elem.code;
|
||||
// sectiona.nameShow = false;
|
||||
// sectiona.isSwitchSection = true;
|
||||
// sectiona.relSwitchCode = elem.code;
|
||||
}
|
||||
const sectionb = deviceMap[elem.sectionBCode];
|
||||
if (sectionb && sectionb.type !== '03') {
|
||||
sectionb.nameShow = false;
|
||||
sectionb.isSwitchSection = true;
|
||||
sectionb.relSwitchCode = elem.code;
|
||||
// sectionb.nameShow = false;
|
||||
// sectionb.isSwitchSection = true;
|
||||
// sectionb.relSwitchCode = elem.code;
|
||||
}
|
||||
const sectionc = deviceMap[elem.sectionCCode];
|
||||
if (sectionc && sectionc.type !== '03') {
|
||||
sectionc.nameShow = false;
|
||||
sectionc.isSwitchSection = true;
|
||||
sectionc.relSwitchCode = elem.code;
|
||||
}
|
||||
let sectionp = '';
|
||||
if (sectiona && sectiona.parentCode) {
|
||||
sectionp = deviceMap[sectiona.parentCode];
|
||||
} else if (sectionb && sectionb.parentCode) {
|
||||
sectionp = deviceMap[sectionb.parentCode];
|
||||
} else if (sectionc && sectionc.parentCode) {
|
||||
sectionp = deviceMap[sectionc.parentCode];
|
||||
}
|
||||
if (sectionp) {
|
||||
sectionp.relSwitchCode = elem.code;
|
||||
// sectionc.nameShow = false;
|
||||
// sectionc.isSwitchSection = true;
|
||||
// sectionc.relSwitchCode = elem.code;
|
||||
}
|
||||
// let sectionp = '';
|
||||
// if (sectiona && sectiona.parentCode) {
|
||||
// sectionp = deviceMap[sectiona.parentCode];
|
||||
// } else if (sectionb && sectionb.parentCode) {
|
||||
// sectionp = deviceMap[sectionb.parentCode];
|
||||
// } else if (sectionc && sectionc.parentCode) {
|
||||
// sectionp = deviceMap[sectionc.parentCode];
|
||||
// }
|
||||
// if (sectionp) {
|
||||
// sectionp.relSwitchCode = elem.code;
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ export default {
|
||||
// 默认个人地图绘制可以滚轮放大缩小 其他地图显示不允许此操作
|
||||
const path = window.location.href;
|
||||
let mouseWheelFlag = false;
|
||||
if (path.includes('design/userlist/map/draw')) {
|
||||
if (path.includes('design/userlist/map/draw') || path.includes('design/usermap/map/draw')) {
|
||||
mouseWheelFlag = true;
|
||||
}
|
||||
|
||||
@ -183,10 +183,6 @@ export default {
|
||||
}, 100);
|
||||
});
|
||||
},
|
||||
// 设置显示图级
|
||||
setLayerVisible(layer) {
|
||||
this.$jlmap && this.$jlmap.setLayerVisible(layer);
|
||||
},
|
||||
// 设置显示图层
|
||||
setLevelVisible(levels) {
|
||||
this.$jlmap && this.$jlmap.setLevelVisible(levels);
|
||||
|
@ -2,31 +2,13 @@
|
||||
<el-dialog v-dialogDrag :title="$t('map.layerDisplay')" :visible.sync="dialogTableVisible" class="view_box" width="460px" :before-close="doClose" :modal-append-to-body="false">
|
||||
<el-row type="flex" justify="center" class="content_box">
|
||||
<el-form label-width="80px" class="demo-ruleForm">
|
||||
<el-form-item :label="$t('map.viewShows')">
|
||||
<el-checkbox-group v-model="viewSelect" :min="1" @change="handleSelectView">
|
||||
<el-checkbox :label="ViewMode.LOGIC">{{ $t('map.logicalView') }}</el-checkbox>
|
||||
<el-checkbox :label="ViewMode.PHYSICAL">{{ $t('map.physicalView') }}</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('map.contentShows')">
|
||||
<el-row v-if="ViewMode.LOGIC === viewSelect[0] && viewSelect.length == 1" class="logical-view" type="flex" justify="center" style="width: 100%;">
|
||||
<el-checkbox-group v-model="logicalLevelsSelect" @change="handleSelectLogicalView">
|
||||
<el-checkbox v-for="view in LogicalViewTypeList" :key="view.code" :label="view.code" size="mini">
|
||||
{{ view.name }}</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-row>
|
||||
<el-row v-if="ViewMode.PHYSICAL === viewSelect[0] && viewSelect.length == 1" class="physical-view" type="flex" justify="center" style="width: 100%;">
|
||||
<el-row class="physical-view" type="flex" justify="center" style="width: 100%;">
|
||||
<el-checkbox-group v-model="physicalLevelsSelect" @change="handleSelectPhysicalView">
|
||||
<el-checkbox v-for="view in PhysicalViewTypeList" :key="view.code" :label="view.code">
|
||||
{{ view.name }}</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-row>
|
||||
<el-row v-if=" viewSelect.length == 2" class="physical-view" type="flex" justify="center" style="width: 100%;">
|
||||
<el-checkbox-group v-model="hybridLevelsSelect" @change="handleSelectHybridView">
|
||||
<el-checkbox v-for="view in HybridViewTypeList" :key="view.code" :label="view.code">
|
||||
{{ view.name }}</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
@ -51,22 +33,10 @@ export default {
|
||||
{ code: 'Signal', name: this.$t('map.signal') },
|
||||
{ code: 'Switch', name: this.$t('map.switch') }
|
||||
],
|
||||
HybridViewTypeList: [],
|
||||
|
||||
defaultLogicalSelect: [],
|
||||
defaultPhysicalSelect: [],
|
||||
defaultHybridSelect: [],
|
||||
|
||||
logicalLevelsSelect: [],
|
||||
physicalLevelsSelect: [],
|
||||
hybridLevelsSelect: [] // 混合图层
|
||||
// defaultPhysicalSelect: [], // 默认选中
|
||||
physicalLevelsSelect: [] // 选中list
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
'$store.state.map.mapDataLoadedCount': function (val) {
|
||||
this.handleSelectView(this.viewSelect);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initPage();
|
||||
},
|
||||
@ -78,53 +48,17 @@ export default {
|
||||
this.dialogTableVisible = false;
|
||||
},
|
||||
initPage() {
|
||||
this.$Dictionary.logicalViewType().then(list => {
|
||||
this.LogicalViewTypeList = list;
|
||||
list.forEach(v => {
|
||||
this.HybridViewTypeList.push(v);
|
||||
this.hybridLevelsSelect.push(v.code);
|
||||
this.defaultHybridSelect.push(v.code);
|
||||
});
|
||||
this.LogicalViewTypeList.forEach(elem => {
|
||||
this.logicalLevelsSelect.push(elem.code);
|
||||
this.defaultLogicalSelect.push(elem.code);
|
||||
});
|
||||
});
|
||||
this.$Dictionary.physicalViewType().then(list => {
|
||||
this.PhysicalViewTypeList = list;
|
||||
list.forEach(v => {
|
||||
this.HybridViewTypeList.push(v);
|
||||
this.hybridLevelsSelect.push(v.code);
|
||||
this.defaultHybridSelect.push(v.code);
|
||||
});
|
||||
this.PhysicalViewTypeList.forEach(elem => {
|
||||
this.physicalLevelsSelect.push(elem.code);
|
||||
this.defaultPhysicalSelect.push(elem.code);
|
||||
// this.defaultPhysicalSelect.push(elem.code);
|
||||
});
|
||||
});
|
||||
},
|
||||
handleSelectView(value) {
|
||||
if (value.length == 2) {
|
||||
this.$emit('handleSelectView', '03');
|
||||
this.hybridLevelsSelect = this.copyList(this.defaultHybridSelect);
|
||||
} else {
|
||||
this.$emit('handleSelectView', value);
|
||||
if (this.viewSelect[0] == this.ViewMode.LOGIC) {
|
||||
this.logicalLevelsSelect = this.copyList(this.defaultLogicalSelect);
|
||||
} else {
|
||||
this.physicalLevelsSelect = this.copyList(this.defaultPhysicalSelect);
|
||||
}
|
||||
}
|
||||
},
|
||||
handleSelectLogicalView(handle) {
|
||||
this.$emit('handleSelectLogicalView', handle);
|
||||
},
|
||||
handleSelectPhysicalView(handle) {
|
||||
this.$emit('handleSelectPhysicalView', handle);
|
||||
},
|
||||
handleSelectHybridView(handle) {
|
||||
this.$emit('handleSelectHybridView', handle);
|
||||
},
|
||||
copyList(list) {
|
||||
return JSON.parse(JSON.stringify(list));
|
||||
}
|
||||
|
@ -164,26 +164,11 @@ export default {
|
||||
this.$store.dispatch('menuOperation/setMapDrawSelectCount');
|
||||
}
|
||||
},
|
||||
handleSelectView(handle) {
|
||||
if (this.$refs.jlmapVisual) {
|
||||
this.$refs.jlmapVisual.setLayerVisible(handle);
|
||||
}
|
||||
},
|
||||
handleSelectLogicalView(handle) {
|
||||
if (this.$refs.jlmapVisual) {
|
||||
this.$refs.jlmapVisual.setLevelVisible(handle);
|
||||
}
|
||||
},
|
||||
handleSelectPhysicalView(handle) {
|
||||
if (this.$refs.jlmapVisual) {
|
||||
this.$refs.jlmapVisual.setLevelVisible(handle);
|
||||
}
|
||||
},
|
||||
handleSelectHybridView(handle) {
|
||||
if (this.$refs.jlmapVisual) {
|
||||
this.$refs.jlmapVisual.setLevelVisible(handle);
|
||||
}
|
||||
},
|
||||
clickEvent(em) {
|
||||
var device = this.getDeviceByEm(em);
|
||||
this.onSelect(device);
|
||||
@ -235,9 +220,8 @@ export default {
|
||||
if (this.$refs.jlmapVisual && map && parseInt(this.$route.params.mapId)) {
|
||||
if (this.verifySectionPoint(map)) {
|
||||
this.mapSaveing = true;
|
||||
this.$store.dispatch('map/saveMapDeviceDefaultRelations').then(() => {
|
||||
this.$store.dispatch('map/saveMapDeviceDefaultRelations').then(() => { // 草稿地图关系处理
|
||||
saveMap(Object.assign(map, { mapId: this.$route.params.mapId })).then(response => {
|
||||
// saveNewMap(Object.assign(map, { mapId: this.$route.params.mapId })).then(response => {
|
||||
this.$message.success(this.$t('tip.saveSuccessfully'));
|
||||
this.mapSaveing = false;
|
||||
this.initAutoSaveTask();
|
||||
|
@ -63,6 +63,7 @@
|
||||
:selected="selected"
|
||||
@updateMapModel="updateMapModel"
|
||||
@setCenter="setCenter"
|
||||
@standStationCode="standStationTab"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('map.zcZoneControl')" class="tab_pane_box" name="ZcControl">
|
||||
@ -89,22 +90,22 @@
|
||||
@setCenter="setCenter"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('map.counter')" class="tab_pane_box" name="Counter">
|
||||
<!-- <el-tab-pane :label="$t('map.counter')" class="tab_pane_box" name="Counter">
|
||||
<counter-draft
|
||||
ref="Counter"
|
||||
:selected="selected"
|
||||
@updateMapModel="updateMapModel"
|
||||
@setCenter="setCenter"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('map.delayUnlock')" class="tab_pane_box" name="DelayUnlock">
|
||||
</el-tab-pane> -->
|
||||
<!-- <el-tab-pane :label="$t('map.delayUnlock')" class="tab_pane_box" name="DelayUnlock">
|
||||
<delay-unlock-draft
|
||||
ref="DelayUnlock"
|
||||
:selected="selected"
|
||||
@updateMapModel="updateMapModel"
|
||||
@setCenter="setCenter"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tab-pane> -->
|
||||
<el-tab-pane :label="$t('map.train')" class="tab_pane_box" name="Train">
|
||||
<train-draft
|
||||
ref="Train"
|
||||
@ -145,14 +146,14 @@
|
||||
@setCenter="setCenter"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('map.button')" class="tab_pane_box" name="ButtonControl">
|
||||
<!-- <el-tab-pane :label="$t('map.button')" class="tab_pane_box" name="ButtonControl">
|
||||
<button-draft
|
||||
ref="ButtonControl"
|
||||
:selected="selected"
|
||||
@updateMapModel="updateMapModel"
|
||||
@setCenter="setCenter"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tab-pane> -->
|
||||
<el-tab-pane label="包围框" class="tab_pane_box" name="CheckBox">
|
||||
<checkbox-draft
|
||||
ref="CheckBox"
|
||||
@ -174,8 +175,8 @@ import SignalDraft from './signal';
|
||||
import StationDraft from './station';
|
||||
import StationStandDraft from './stationstand';
|
||||
import StationControlDraft from './stationcontrol';
|
||||
import CounterDraft from './counter';
|
||||
import DelayUnlockDraft from './delayunlock';
|
||||
// import CounterDraft from './counter';
|
||||
// import DelayUnlockDraft from './delayunlock';
|
||||
import TrainDraft from './train/index';
|
||||
import LineDraft from './line';
|
||||
import TextDraft from './text';
|
||||
@ -184,7 +185,7 @@ import ZcControlDraft from './zcControl';
|
||||
import LimitControlDraft from './limitControl';
|
||||
import LcControlDraft from './lcControl';
|
||||
import ImageControlDraft from './ImageControl';
|
||||
import ButtonDraft from './buttonDraft';
|
||||
// import ButtonDraft from './buttonDraft';
|
||||
import CheckboxDraft from './checkboxDraft';
|
||||
|
||||
import { ViewMode } from '@/scripts/ConstDic';
|
||||
@ -192,14 +193,14 @@ import { ViewMode } from '@/scripts/ConstDic';
|
||||
export default {
|
||||
name: 'MapOperate',
|
||||
components: {
|
||||
CounterDraft,
|
||||
// CounterDraft,
|
||||
SectionDraft,
|
||||
SwitchDraft,
|
||||
SignalDraft,
|
||||
StationDraft,
|
||||
StationStandDraft,
|
||||
StationControlDraft,
|
||||
DelayUnlockDraft,
|
||||
// DelayUnlockDraft,
|
||||
TrainWindowDraft,
|
||||
TrainDraft,
|
||||
LineDraft,
|
||||
@ -208,7 +209,7 @@ export default {
|
||||
LimitControlDraft,
|
||||
LcControlDraft,
|
||||
ImageControlDraft,
|
||||
ButtonDraft,
|
||||
// ButtonDraft,
|
||||
CheckboxDraft
|
||||
},
|
||||
props: {
|
||||
@ -230,6 +231,7 @@ export default {
|
||||
singlaType: '',
|
||||
stationType: '',
|
||||
switchType: '',
|
||||
stationStandType:'',
|
||||
ViewMode: ViewMode,
|
||||
LogicalViewTypeList: [
|
||||
{ code: 'Link', name: this.$t('map.link') }
|
||||
@ -246,7 +248,8 @@ export default {
|
||||
show: {
|
||||
mapEditShow: false,
|
||||
mapPaintShow: true
|
||||
}
|
||||
},
|
||||
oldDevice: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -286,12 +289,24 @@ export default {
|
||||
this.enabledTab = 'Switch';
|
||||
} else if (this.singlaType) {
|
||||
this.enabledTab = 'Signal';
|
||||
} else if (this.stationStandType) {
|
||||
this.enabledTab = 'StationStand';
|
||||
} else if (this.feild) {
|
||||
this.enabledTab = 'Section';
|
||||
} else {
|
||||
this.enabledTab = type;
|
||||
if ( this.oldDevice && device.instance && typeof device.instance.drawSelected === 'function') {
|
||||
this.oldDevice.instance.drawSelected(false);
|
||||
}
|
||||
if ( device && device.instance && typeof device.instance.drawSelected === 'function' ) {
|
||||
device.instance.drawSelected(true);
|
||||
}
|
||||
this.oldDevice = device;
|
||||
}
|
||||
},
|
||||
standStationTab(type) {
|
||||
this.stationStandType = type;
|
||||
},
|
||||
stationEnabledTab(type) {
|
||||
this.stationType = type;
|
||||
},
|
||||
|
@ -29,7 +29,7 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<div v-if="createModel.type == '01'" class="coordinate">
|
||||
<span class="title" style="width: 120px">起点:</span>
|
||||
<span class="title" style="width: 120px">{{ this.$t('map.startingPoint') }}</span>
|
||||
<div class="listWidth">
|
||||
<el-form-item label="x" prop="startPoint.x" label-width="25px">
|
||||
<el-input-number v-model="createModel.startPoint.x" />
|
||||
@ -41,20 +41,10 @@
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="createModel.type == '01'" class="coordinate">
|
||||
<span class="title" style="width: 120px">终点:</span>
|
||||
<div class="listWidth">
|
||||
<el-form-item label="x" prop="endPoint.x" label-width="25px">
|
||||
<el-input-number v-model="createModel.endPoint.x" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="listWidth">
|
||||
<el-form-item label="y" prop="endPoint.y" label-width="25px">
|
||||
<el-input-number v-model="createModel.endPoint.y" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
<el-form-item v-if="createModel.type == '02'" label="左关联区段:" prop="leftSectionCode">
|
||||
<el-form-item v-if="createModel.type == '01'" label="距离长度:" prop="length">
|
||||
<el-input-number v-model="createModel.length" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="createModel.type == '02'" :label="$t('map.leftAssociatedSection')" prop="leftSectionCode">
|
||||
<el-select v-model="createModel.leftSectionCode" filterable>
|
||||
<el-option
|
||||
v-for="item in PhysicalSectionList"
|
||||
@ -69,7 +59,7 @@
|
||||
@click="hover('getSectionStart')"
|
||||
>{{ $t('map.activate') }}</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="createModel.type == '02'" label="右关联区段:" prop="rightSectionCode">
|
||||
<el-form-item v-if="createModel.type == '02'" :label="$t('map.rightAssociatedSection')" prop="rightSectionCode">
|
||||
<el-select v-model="createModel.rightSectionCode" filterable>
|
||||
<el-option
|
||||
v-for="item in PhysicalSectionList"
|
||||
@ -89,7 +79,7 @@
|
||||
</div>
|
||||
<div class="button_box">
|
||||
<el-button-group class="map-draft-group">
|
||||
<el-button type="primary" size="small" @click="create">新建</el-button>
|
||||
<el-button type="primary" size="small" @click="create">{{ this.$t('map.newConstruction') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
@ -330,7 +320,7 @@ export default {
|
||||
createModel: {
|
||||
type: '01',
|
||||
startPoint: { x: 0, y: 0 },
|
||||
endPoint: { x: 0, y: 0 },
|
||||
length: 0,
|
||||
leftSectionCode: '',
|
||||
rightSectionCode: ''
|
||||
},
|
||||
@ -341,11 +331,8 @@ export default {
|
||||
'startPoint.y': [
|
||||
{ required: true, message: this.$t('rules.destinationCodePointY'), trigger: 'blur' }
|
||||
],
|
||||
'endPoint.x': [
|
||||
{ required: true, message: this.$t('rules.destinationCodePointX'), trigger: 'blur' }
|
||||
],
|
||||
'endPoint.y': [
|
||||
{ required: true, message: this.$t('rules.destinationCodePointY'), trigger: 'blur' }
|
||||
'length': [
|
||||
{ required: true, message: '请填写距离值', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
typeOptions: [{
|
||||
@ -518,9 +505,6 @@ export default {
|
||||
relSwitchCode: [
|
||||
{ required: true, message: this.$t('rules.sectionRelSwitchCode'), trigger: 'change' }
|
||||
],
|
||||
trainPosType: [
|
||||
{ required: true, message: this.$t('rules.pleaseSelectTrainDir'), trigger: 'change' }
|
||||
],
|
||||
leftSectionCode: [
|
||||
{ validator: validateLeftSection, trigger: 'change' }
|
||||
],
|
||||
@ -825,7 +809,7 @@ export default {
|
||||
this.editModel.points.splice(index, 1);
|
||||
this.logicSectionNums.splice(index, 1);
|
||||
},
|
||||
// 一键生成区段
|
||||
// 创建区段
|
||||
create() {
|
||||
const uid = getUID('Section');
|
||||
const model = {
|
||||
@ -871,7 +855,7 @@ export default {
|
||||
if (this.createModel.type == '01') {
|
||||
model.points = [
|
||||
{ x: this.createModel.startPoint.x, y: this.createModel.startPoint.y },
|
||||
{ x: this.createModel.endPoint.x, y: this.createModel.endPoint.y }
|
||||
{ x: this.createModel.startPoint.x + this.createModel.length, y: this.createModel.startPoint.y }
|
||||
];
|
||||
} else if (this.createModel.type == '02') {
|
||||
const startModel = this.$store.getters['map/getDeviceByCode'](this.createModel.leftSectionCode);
|
||||
|
@ -19,11 +19,17 @@
|
||||
<el-form ref="make" label-width="130px" :model="addModel" size="mini" :rules="mergeRules">
|
||||
<el-form-item :label="$t('map.physicalSegmentName')" prop="sectionCode">
|
||||
<el-select v-model="addModel.sectionCode" filterable>
|
||||
<el-option
|
||||
<!-- <el-option
|
||||
v-for="item in PhysicalSectionList"
|
||||
:key="item.code"
|
||||
:label="item.name + ' (' + item.code+ ')'"
|
||||
:value="item.code"
|
||||
/> -->
|
||||
<el-option
|
||||
v-for="item in signalSectionList"
|
||||
:key="item.code"
|
||||
:label="item.name + ' (' + item.code+ ')'"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button
|
||||
@ -329,17 +335,19 @@ export default {
|
||||
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
||||
},
|
||||
deviceSelect(selected) {
|
||||
this.$refs.dataform.resetFields();
|
||||
this.$refs.make.resetFields();
|
||||
if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase()) {
|
||||
// this.$refs.make.resetFields();
|
||||
if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() != 'selectSingalCode'.toUpperCase()) {
|
||||
this.$refs.dataform.resetFields();
|
||||
this.activeName = 'first';
|
||||
this.editModel = deepAssign(this.editModel, selected);
|
||||
this.editModel.potLampType = selected.potLampType || '01';
|
||||
this.editModel.rotate = selected.rotate || 0; // 角度
|
||||
}
|
||||
|
||||
if (this.field.toUpperCase() === 'selectSingalCode'.toUpperCase()) {
|
||||
this.addModel.sectionCode = selected.code;
|
||||
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'selectSingalCode'.toUpperCase()) {
|
||||
if (selected.type == '01') {
|
||||
this.addModel.sectionCode = selected.code;
|
||||
} else if (selected.type == '02') {
|
||||
this.addModel.sectionCode = selected.parentCode;
|
||||
}
|
||||
this.activeName = 'second';
|
||||
this.field = '';
|
||||
this.$emit('signalSectionCode', '');
|
||||
|
@ -41,6 +41,54 @@
|
||||
</el-button-group>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane class="view-control" label="控制模式" name="three">
|
||||
<div style="height: calc(100% - 46px);">
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper">
|
||||
111
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
<div class="button_box">
|
||||
<el-button-group class="map-draft-group">
|
||||
<el-button type="primary" size="small" @click="create">{{ $t('map.create') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane class="view-control" label="计数器" name="four">
|
||||
<div style="height: calc(100% - 46px);">
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper">
|
||||
222
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
<div class="button_box">
|
||||
<el-button-group class="map-draft-group">
|
||||
<el-button type="primary" size="small" @click="create">{{ $t('map.create') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane class="view-control" label="延迟解锁" name="five">
|
||||
<div style="height: calc(100% - 46px);">
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper">
|
||||
333
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
<div class="button_box">
|
||||
<el-button-group class="map-draft-group">
|
||||
<el-button type="primary" size="small" @click="create">{{ $t('map.create') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane class="view-control" label="按图折返" name="six">
|
||||
<div style="height: calc(100% - 46px);">
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper">
|
||||
444
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
<div class="button_box">
|
||||
<el-button-group class="map-draft-group">
|
||||
<el-button type="primary" size="small" @click="create">{{ $t('map.create') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</template>
|
||||
|
||||
@ -193,9 +241,9 @@ export default {
|
||||
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
||||
},
|
||||
deviceSelect(selected) {
|
||||
this.$refs.dataform.resetFields();
|
||||
this.$refs.make.resetFields();
|
||||
if (selected && selected._type.toUpperCase() === 'Station'.toUpperCase()) {
|
||||
// this.$refs.make.resetFields();
|
||||
if (this.field.toUpperCase() != 'selectStationCode'.toUpperCase() && selected && selected._type.toUpperCase() === 'Station'.toUpperCase()) {
|
||||
this.$refs.dataform.resetFields();
|
||||
this.activeName = 'first';
|
||||
this.editModel = deepAssign(this.editModel, selected);
|
||||
this.editModel.runPlanName = selected.runPlanName || '';
|
||||
@ -204,11 +252,19 @@ export default {
|
||||
return !data.centralized && data.code != this.editModel.code && !(data.controlled && data.concentrateStationCode != this.editModel.code);
|
||||
});
|
||||
}
|
||||
if (this.field.toUpperCase() === 'selectStationCode'.toUpperCase()) {
|
||||
this.addModel.sectionCode = selected.code;
|
||||
this.activeName = 'second';
|
||||
this.field = '';
|
||||
this.$emit('stationSectionCode', '');
|
||||
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'selectStationCode'.toUpperCase()) {
|
||||
if (selected.type == '01') {
|
||||
this.addModel.sectionCode = selected.code;
|
||||
this.activeName = 'second';
|
||||
this.field = '';
|
||||
this.$emit('stationSectionCode', '');
|
||||
} else if (selected.type == '02') {
|
||||
this.addModel.sectionCode = selected.parentCode;
|
||||
this.activeName = 'second';
|
||||
this.field = '';
|
||||
this.$emit('stationSectionCode', '');
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
// 选择管理车站
|
||||
@ -218,13 +274,13 @@ export default {
|
||||
const newModal = Object.assign({}, station);
|
||||
newModal.controlled = false;
|
||||
newModal.concentrateStationCode = '';
|
||||
this.setStationStand(station,'');
|
||||
this.setStationStand(station, '');
|
||||
data.forEach(each=>{
|
||||
switch (each) {
|
||||
case station.code: {
|
||||
newModal.controlled = true;
|
||||
newModal.concentrateStationCode = this.editModel.code;
|
||||
this.setStationStand(station,this.editModel.code);
|
||||
this.setStationStand(station, this.editModel.code);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -244,7 +300,7 @@ export default {
|
||||
this.edit();
|
||||
this.modifyChargeStation();
|
||||
this.setStationStand(this.editModel, '');
|
||||
}else {
|
||||
} else {
|
||||
this.setStationStand(this.editModel, this.editModel.code);
|
||||
}
|
||||
},
|
||||
|
@ -26,16 +26,11 @@
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('map.equipmentStation')" prop="deviceStationCode">
|
||||
<el-select v-model="addModel.deviceStationCode" filterable disabled>
|
||||
<el-option
|
||||
v-for="item in stationList"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button
|
||||
:type="field === 'standSelectStationCode' ? 'danger' : 'primary'"
|
||||
size="small"
|
||||
@click="hover('standSelectStationCode')"
|
||||
>{{ $t('map.activate') }}</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('map.stationstandDirection')" prop="doorLocationType">
|
||||
<el-select v-model="addModel.doorLocationType" filterable :placeholder="$t('map.pleaseSelect')">
|
||||
@ -107,6 +102,7 @@ export default {
|
||||
visible: true,
|
||||
direction: ''
|
||||
},
|
||||
field: '',
|
||||
addModel: {
|
||||
stationCode: '',
|
||||
doorLocationType: '01',
|
||||
@ -202,7 +198,7 @@ export default {
|
||||
],
|
||||
doorLocationType: [
|
||||
{ required: true, message: this.$t('rules.doorLocationType'), trigger: 'change' }
|
||||
],
|
||||
]
|
||||
};
|
||||
}
|
||||
},
|
||||
@ -228,25 +224,32 @@ export default {
|
||||
updateView() {
|
||||
this.edit();
|
||||
},
|
||||
changeStation(data){
|
||||
let station=this.stationList.find(elem => {return elem.code==data});
|
||||
if(station){
|
||||
if(station.centralized){
|
||||
this.addModel.deviceStationCode=station.code;
|
||||
}
|
||||
else{
|
||||
this.addModel.deviceStationCode=station.concentrateStationCode;
|
||||
changeStation(data) {
|
||||
const station = this.stationList.find(elem => { return elem.code == data; });
|
||||
if (station) {
|
||||
if (station.centralized) {
|
||||
this.addModel.deviceStationCode = station.code;
|
||||
} else {
|
||||
this.addModel.deviceStationCode = station.concentrateStationCode;
|
||||
}
|
||||
}
|
||||
},
|
||||
hover(field) {
|
||||
this.field = field === this.field ? '' : field;
|
||||
this.$emit('standStationCode', this.field);
|
||||
},
|
||||
deviceSelect(selected) {
|
||||
this.$refs.dataform.resetFields();
|
||||
this.$refs.make.resetFields();
|
||||
if (selected && selected._type.toUpperCase() === 'StationStand'.toUpperCase()) {
|
||||
// this.$refs.make.resetFields();
|
||||
if (this.field.toUpperCase() != 'standSelectStationCode'.toUpperCase() && selected && selected._type.toUpperCase() === 'StationStand'.toUpperCase()) {
|
||||
this.$refs.dataform.resetFields();
|
||||
this.activeName = 'first';
|
||||
this.editModel = deepAssign(this.editModel, selected);
|
||||
} else if (selected && selected._type.toUpperCase() === 'Station'.toUpperCase()) {
|
||||
}
|
||||
if (selected && selected._type.toUpperCase() === 'Station'.toUpperCase() && this.field.toUpperCase() === 'standSelectStationCode'.toUpperCase()) {
|
||||
this.addModel.stationCode = selected.code;
|
||||
this.activeName = 'second';
|
||||
this.field = '';
|
||||
this.$emit('standStationCode', '');
|
||||
}
|
||||
},
|
||||
create() {
|
||||
|
@ -195,8 +195,8 @@ export default {
|
||||
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
||||
},
|
||||
deviceSelect(selected) {
|
||||
this.$refs.dataform.resetFields();
|
||||
if (selected && selected._type.toUpperCase() === 'Switch'.toUpperCase()) {
|
||||
if (this.field.toUpperCase() != 'relevanceSectionList'.toUpperCase() && selected && selected._type.toUpperCase() === 'Switch'.toUpperCase()) {
|
||||
this.$refs.dataform.resetFields();
|
||||
this.activeName = 'first';
|
||||
this.editModel = deepAssign(this.editModel, selected);
|
||||
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'relevanceSectionList'.toUpperCase()) {
|
||||
@ -527,6 +527,7 @@ export default {
|
||||
});
|
||||
}
|
||||
});
|
||||
console.log(sectiona);
|
||||
|
||||
sectiona.relSwitchCode = elem.code;
|
||||
sectionb.relSwitchCode = elem.code;
|
||||
|
114
src/views/orderauthor/permission/create/edit.vue
Normal file
114
src/views/orderauthor/permission/create/edit.vue
Normal file
@ -0,0 +1,114 @@
|
||||
<template>
|
||||
<el-dialog v-dialogDrag :title="this.$t('orderAuthor.oneClickGenerationPermission')" :visible.sync="dialogShow" width="500px" :before-close="handleClose">
|
||||
<div>
|
||||
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogShow = false">{{ $t('map.cancel') }}</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="saveAs">{{ $t('map.confirm') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { updataCommodityList } from '@/api/management/goods';
|
||||
|
||||
export default {
|
||||
name: 'Edit',
|
||||
data() {
|
||||
return {
|
||||
dialogShow: false,
|
||||
loading: false,
|
||||
formModel: {
|
||||
id: '',
|
||||
name: '',
|
||||
price: 0
|
||||
// remarks: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
form() {
|
||||
return {
|
||||
labelWidth: '110px',
|
||||
items: [
|
||||
{ prop: 'name', label: this.$t('orderAuthor.commodityName') + ':', type: 'text', required: false },
|
||||
{ prop: 'price', label: this.$t('orderAuthor.price') + ':', type: 'number', required: false, min: 0.01, message: this.$t('global.yuan') }
|
||||
// { prop: 'remarks', label: this.$t('orderAuthor.describtion') + ':', type: 'textarea', required: false }
|
||||
]
|
||||
|
||||
};
|
||||
},
|
||||
rules() {
|
||||
return {
|
||||
name: [
|
||||
{ required: true, message: this.$t('rules.goodsNameInput'), trigger: 'blur' }
|
||||
],
|
||||
price: [
|
||||
{ required: true, message: this.$t('rules.totalPriceInput'), trigger: 'change' },
|
||||
{
|
||||
validator(rule, value, callback) {
|
||||
if (Number(value) >= 0) {
|
||||
if (String(value).split('.')[1] && String(value).split('.')[1].length > 2) {
|
||||
callback(new Error(this.$t('rules.totalPriceInputError1')));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
} else {
|
||||
callback(new Error(this.$t('rules.totalPriceInputError2')));
|
||||
}
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doShow(data) {
|
||||
this.dialogShow = true;
|
||||
console.log(data);
|
||||
this.formModel = {
|
||||
id: data.goods.id,
|
||||
name: data.name,
|
||||
price: data.price
|
||||
// remarks: data.remarks
|
||||
};
|
||||
},
|
||||
close() {
|
||||
this.formModel = {
|
||||
id: '',
|
||||
name: '',
|
||||
price: 0
|
||||
// remarks: ''
|
||||
};
|
||||
this.dialogShow = false;
|
||||
this.loading = false;
|
||||
},
|
||||
handleClose() {
|
||||
this.close();
|
||||
},
|
||||
buildModel() { // 构造基础数据
|
||||
return {
|
||||
id: this.formModel.id,
|
||||
name: this.formModel.name,
|
||||
price: this.formModel.price
|
||||
// remarks: this.formModel.remarks
|
||||
};
|
||||
},
|
||||
saveAs() {
|
||||
this.$refs.dataform.validateForm(() => {
|
||||
this.loading = true;
|
||||
updataCommodityList(this.buildModel()).then(response => {
|
||||
this.$message.success(this.$t('tip.updateSuccessfully'));
|
||||
this.$emit('reloadTable', this.buildModel());
|
||||
this.handleClose();
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.updateFailed'));
|
||||
this.handleClose();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -56,7 +56,7 @@ export default {
|
||||
this.display = 1;
|
||||
},
|
||||
// 万能权限,走订单路线
|
||||
permissionNextOrder(permission, good) {
|
||||
permissionNextOrder(good) {
|
||||
this.goodsList = [{
|
||||
isPackage: true,
|
||||
id: good.id,
|
||||
@ -66,7 +66,6 @@ export default {
|
||||
price: good.price,
|
||||
list: good.list
|
||||
}];
|
||||
this.$refs.orderForm.setOrderName(permission, good);
|
||||
this.display = 1;
|
||||
},
|
||||
orderNext(data) {
|
||||
|
@ -1,12 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="forms pack-rule">
|
||||
<el-table
|
||||
v-if="goodsList.length"
|
||||
:data="goodsList"
|
||||
border
|
||||
style="width: 100%; margin-bottom: 10px;"
|
||||
>
|
||||
<el-table v-if="goodsList.length" :data="goodsList" border style="width: 100%; margin-bottom: 10px;">
|
||||
<el-table-column prop="name" :label="$t('permission.goodsName')" />
|
||||
<el-table-column prop="price" :label="$t('permission.price')" width="100" />
|
||||
<el-table-column prop="remarks" label="描述" />
|
||||
@ -33,7 +28,6 @@ import { addOrganization, getOrganizationList } from '@/api/management/organizat
|
||||
import { getSellerList } from '@/api/management/user';
|
||||
import { createPermission } from '@/api/management/order';
|
||||
import PremissionList from './list';
|
||||
// import { deepAssign } from '@/utils/index';
|
||||
|
||||
export default {
|
||||
name: 'OrderForm',
|
||||
@ -64,7 +58,6 @@ export default {
|
||||
foreverInitData: false,
|
||||
canDistribute: true,
|
||||
urlInfo: {},
|
||||
goodsVo: {},
|
||||
orderList: [],
|
||||
formModel: {
|
||||
organizationId: '',
|
||||
@ -138,7 +131,7 @@ export default {
|
||||
return this.foreverInitData;
|
||||
},
|
||||
form() {
|
||||
const form = {
|
||||
return {
|
||||
labelWidth: this.$i18n.locale == 'en' ? '200px' : '145px',
|
||||
items: [
|
||||
{ prop: 'organizationId', label: this.$t('orderAuthor.organizationOrEnterprise'), type: 'select', options: this.OrganizationList, allowCreate: true, onChange: this.onChange },
|
||||
@ -156,7 +149,6 @@ export default {
|
||||
{ prop: 'canDistribute', label: this.$t('orderAuthor.optionPrivilegeTransfer'), type: 'radio', options: this.permissionList }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
},
|
||||
rules() {
|
||||
const _this = this;
|
||||
@ -329,18 +321,6 @@ export default {
|
||||
showPermission(index, row) {
|
||||
this.$refs.permissionList.doShow(row.list);
|
||||
},
|
||||
// 第一个参数 商品对象、 第二个参数 权限对象
|
||||
setOrderName(permission, good) {
|
||||
if (good) {
|
||||
this.formModel = { // 订单数据
|
||||
goodsName: good.name,
|
||||
price: good.price,
|
||||
goodsId: good.id
|
||||
};
|
||||
this.permissionVo = permission; // 权限对象
|
||||
this.goodsVo = good; // 商品对象
|
||||
}
|
||||
},
|
||||
buildModel() {
|
||||
// 如果新增的条目不存在字典当中,则需要在临时字典中取对应的值
|
||||
let orgzId = this.formModel.organizationId;
|
||||
@ -377,27 +357,24 @@ export default {
|
||||
packForm() {
|
||||
if (this.orderList && this.orderList.length) {
|
||||
const arr = this.goodsList.map(nor => {
|
||||
return nor.permissionId;
|
||||
return nor.goodItem.id;
|
||||
});
|
||||
const param = {
|
||||
isPackage: false,
|
||||
// 订单数据 formModel
|
||||
organizationId: this.formModel.organizationId,
|
||||
packageNum: this.formModel.amount,
|
||||
amount: this.formModel.amount,
|
||||
monthAmount: this.formModel.monthAmount,
|
||||
packageName: this.goodsVo.name,
|
||||
totalPrice: this.formModel.totalPrice,
|
||||
orderType: this.formModel.orderType,
|
||||
distributeType: this.formModel.canDistribute == '01',
|
||||
startTime: this.formModel.startTime,
|
||||
payStatus: this.formModel.payStatus,
|
||||
bizType: this.formModel.bizType,
|
||||
payWays: this.formModel.payWays,
|
||||
forever: this.formModel.forever,
|
||||
// 基础权限 list
|
||||
relPermissions: arr,
|
||||
orderDetailList: this.orderList
|
||||
canDistribute: this.formModel.canDistribute == '01',
|
||||
orderCreateVO: {
|
||||
amount: this.formModel.amount,
|
||||
contractNo: this.formModel.contractNo,
|
||||
forever: this.formModel.forever,
|
||||
goodsIds: arr,
|
||||
monthAmount: this.formModel.monthAmount,
|
||||
orderType: this.formModel.orderType,
|
||||
organizationId: this.formModel.organizationId,
|
||||
payStatus: this.formModel.payStatus,
|
||||
payWays: this.formModel.payWays,
|
||||
price: this.formModel.price,
|
||||
sellerId: this.formModel.sellerId,
|
||||
startTime: this.formModel.startTime
|
||||
}
|
||||
};
|
||||
createPermission(param).then(res => {
|
||||
this.urlInfo = {
|
||||
@ -416,43 +393,25 @@ export default {
|
||||
createPermission() {
|
||||
this.$refs.dataform.validateForm(() => {
|
||||
this.formModel.organizationId = this.buildModel();
|
||||
const arr = this.goodsList.map(nor => {
|
||||
return nor.id;
|
||||
});
|
||||
const param = {
|
||||
// createVO: {
|
||||
// isPackage: true,
|
||||
// relPermissions: this.permissionVo.relPermissions,
|
||||
// name: this.permissionVo.name,
|
||||
// id: this.permissionVo.id,
|
||||
// remarks: this.permissionVo.remarks
|
||||
// },
|
||||
// goodsVO: this.goodsVo,
|
||||
// orderList: [this.formModel],
|
||||
// canDistribute: this.formModel.canDistribute == '01'
|
||||
isPackage: true,
|
||||
// 订单数据 formModel
|
||||
organizationId: this.formModel.organizationId,
|
||||
packageNum: this.formModel.amount,
|
||||
startTime: this.formModel.startTime,
|
||||
monthAmount: this.formModel.monthAmount,
|
||||
distributeType: this.formModel.canDistribute == '01',
|
||||
bizType: this.formModel.bizType,
|
||||
payWays: this.formModel.payWays,
|
||||
forever: this.formModel.forever,
|
||||
payStatus: this.formModel.payStatus,
|
||||
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,
|
||||
// 权限包ids 默认名称是 商品名称
|
||||
relPermissions: this.permissionVo.relPermissions
|
||||
|
||||
// mapId: this.permissionVo.mapId
|
||||
// prdCode: this.permissionVo.prdCode
|
||||
canDistribute: this.formModel.canDistribute == '01',
|
||||
orderCreateVO: {
|
||||
amount: this.formModel.amount,
|
||||
contractNo: this.formModel.contractNo,
|
||||
forever: this.formModel.forever,
|
||||
goodsIds: arr,
|
||||
monthAmount: this.formModel.monthAmount,
|
||||
orderType: this.formModel.orderType,
|
||||
organizationId: this.formModel.organizationId,
|
||||
payStatus: this.formModel.payStatus,
|
||||
payWays: this.formModel.payWays,
|
||||
price: this.formModel.price,
|
||||
sellerId: this.formModel.sellerId,
|
||||
startTime: this.formModel.startTime
|
||||
}
|
||||
};
|
||||
createPermission(param).then(res => {
|
||||
this.urlInfo = {
|
||||
|
@ -4,12 +4,7 @@
|
||||
<div class="title_nav">
|
||||
<div class="map_title">{{ $t('orderAuthor.mapName') }}:</div>
|
||||
<el-select v-model="addModel.mapId" :disabled="ruleList.length ? true : false" size="small">
|
||||
<el-option
|
||||
v-for="item in mapList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
<el-option v-for="item in mapList" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="table_box">
|
||||
@ -32,6 +27,7 @@
|
||||
<el-table-column :label="this.$t('global.operate')" width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="deleteForm(scope.$index, scope.row)">{{ $t('global.delete') }}</el-button>
|
||||
<el-button v-if="addModel.type == '01'" type="text" size="small" @click="editForm(scope.$index, scope.row)">编辑</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -68,7 +64,7 @@
|
||||
<el-input-number v-model="addModel.price" :min="0.01" />
|
||||
<span style="padding-left: 20px; font-size: 12px; color: #a9a9a9;">{{ $t('global.yuan') }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item v-show="addModel.type == '02'" :label="$t('orderAuthor.whetherTrial')" prop="forever">
|
||||
<!-- <el-form-item v-show="addModel.type == '02'" :label="$t('orderAuthor.whetherTrial')" prop="forever">
|
||||
<el-radio-group v-model="addModel.forever">
|
||||
<el-radio v-for="option in $ConstSelect.Whether" :key="option.value" :label="option.value">{{ option.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
@ -86,7 +82,7 @@
|
||||
<el-form-item v-if="addModel.type == '02' && addModel.forever" :label="$t('global.duration') + ':'" prop="tryUseTime">
|
||||
<el-input-number v-model="addModel.tryUseTime" :min="1" />
|
||||
<span style="padding-left: 20px; font-size: 12px; color: #a9a9a9;">{{ TimeStyleDict[addModel.tryUseTimeUnit] }}</span>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
<choose-permission
|
||||
ref="choosePermission"
|
||||
@ -103,19 +99,22 @@
|
||||
<el-button type="primary" @click="permissionNext">{{ $t('orderAuthor.next') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
<edit ref="edit" @reloadTable="reloadTable" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ChoosePermission from '../../author/draft/choosePermission';
|
||||
import { getPublishMapListOnline } from '@/api/jmap/map';
|
||||
import { getGoodsByPermissionId, postsPermissionGoods } from '@/api/management/goods';
|
||||
import { getGoodsByPermissionId, postsPermissionGoods, updataCommodityList, postCreatePackage} from '@/api/management/goods';
|
||||
import { postFindPermission } from '@/api/management/order';
|
||||
import Edit from './edit';
|
||||
|
||||
export default {
|
||||
name: 'PermissionForm',
|
||||
components: {
|
||||
ChoosePermission
|
||||
ChoosePermission,
|
||||
Edit
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -145,6 +144,7 @@ export default {
|
||||
tryUseTimeUnit: '05',
|
||||
tryUseTime: 0
|
||||
},
|
||||
editIndex: 0,
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: this.$t('rules.enterPermissionName'), trigger: 'blur' }
|
||||
@ -179,52 +179,6 @@ export default {
|
||||
});
|
||||
}
|
||||
},
|
||||
changeBlur(data) { // 失去焦点设置最低价格
|
||||
if (data.payPrice < 0.01) {
|
||||
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;
|
||||
});
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
async loadInitData() {
|
||||
// 时间类型
|
||||
this.TimeStyleDict = {};
|
||||
@ -258,6 +212,62 @@ export default {
|
||||
console.error(error, this.$t('tip.publishMap'));
|
||||
}
|
||||
},
|
||||
changeBlur(data) { // 失去焦点设置最低价格
|
||||
if (data.payPrice < 0.01) {
|
||||
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.permissionId;
|
||||
this.permissionGoddsId = res.data.id;
|
||||
this.addModel.name = res.data.name;
|
||||
this.addModel.price = res.data.price || 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;
|
||||
});
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
editForm(index, row) {
|
||||
this.$refs.edit.doShow(row);
|
||||
this.editIndex = index;
|
||||
},
|
||||
reloadTable(data) {
|
||||
this.ruleList[this.editIndex].price = data.price;
|
||||
this.ruleList[this.editIndex].name = data.name;
|
||||
this.ruleList[this.editIndex].goods.price = data.price;
|
||||
this.ruleList[this.editIndex].goods.name = data.name;
|
||||
},
|
||||
computedName(list, code) {
|
||||
let name = '';
|
||||
list.forEach(elem => {
|
||||
@ -387,41 +397,44 @@ export default {
|
||||
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); });
|
||||
if (this.isGoods) { // 有商品 走更新 无商品 创建
|
||||
const param = {
|
||||
id: this.permissionGoddsId,
|
||||
name: this.addModel.name,
|
||||
price: this.addModel.price,
|
||||
remarks: this.addModel.remarks
|
||||
};
|
||||
updataCommodityList(param).then(res => {
|
||||
const good = {
|
||||
id: this.permissionGoddsId,
|
||||
permissionId: this.permissionPackageId,
|
||||
name: this.addModel.name,
|
||||
price: this.addModel.price,
|
||||
remarks: this.addModel.remarks,
|
||||
list: this.ruleList
|
||||
};
|
||||
this.$emit('permissionNextOrder', good);
|
||||
});
|
||||
} else {
|
||||
// 创建万能权限商品
|
||||
const param = {
|
||||
name: this.addModel.name,
|
||||
price: this.addModel.price,
|
||||
relPermissionIds: arr,
|
||||
remarks: this.addModel.remarks,
|
||||
tryUse: this.addModel.forever,
|
||||
tryUseTime: this.addModel.tryUseTime,
|
||||
tryUseTimeUnit: this.addModel.tryUseTimeUnit
|
||||
};
|
||||
postCreatePackage(param).then(res => {
|
||||
const good = Object.assign(res.data, { list: this.ruleList });
|
||||
this.isGoods = true;
|
||||
this.permissionGoddsId = res.data.id;
|
||||
this.$emit('permissionNextOrder', good);
|
||||
}).catch(() => {
|
||||
this.$message('创建万能权限商品失败');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user