合并代码
This commit is contained in:
commit
6d0edb2370
@ -2,113 +2,113 @@ import request from '@/utils/request';
|
||||
|
||||
/** 获取发布地图树*/
|
||||
export function getPublishMapTree(cityCode) {
|
||||
return request({
|
||||
url: `/api/mapPrd/${cityCode}/tree`,
|
||||
method: 'get'
|
||||
});
|
||||
return request({
|
||||
url: `/api/mapPrd/${cityCode}/tree`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取产品详细内容*/
|
||||
export function getProductDetail(prdCode) {
|
||||
return request({
|
||||
url: `/api/mapPrd/${prdCode}`,
|
||||
method: 'get'
|
||||
});
|
||||
return request({
|
||||
url: `/api/mapPrd/${prdCode}`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
/** 检查实训编码是否已存在*/
|
||||
export function checkCodeExist(data) {
|
||||
return request({
|
||||
url: '/api/mapPrd/checkCodeExist',
|
||||
method: 'get',
|
||||
params: data
|
||||
});
|
||||
return request({
|
||||
url: '/api/mapPrd/checkCodeExist',
|
||||
method: 'get',
|
||||
params: data
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取产品类目数*/
|
||||
/** 获取产品树*/
|
||||
export function getProductTree() {
|
||||
return request({
|
||||
url: `/api/mapPrd/tree`,
|
||||
method: 'get'
|
||||
});
|
||||
return request({
|
||||
url: `/api/mapPrd/tree`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
/** 创建实训类目*/
|
||||
export function createTrainingCategory(data) {
|
||||
return request({
|
||||
url: '/api/mapPrd',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
return request({
|
||||
url: '/api/mapPrd',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
/** 更新实训类目*/
|
||||
export function updateTrainingCategory(data) {
|
||||
return request({
|
||||
url: `/api/mapPrd/${data.id}`,
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
return request({
|
||||
url: `/api/mapPrd/${data.id}`,
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除实训类目*/
|
||||
export function deleteTrainingCategory(data) {
|
||||
return request({
|
||||
url: `/api/mapPrd/${data.id}`,
|
||||
method: 'delete'
|
||||
});
|
||||
return request({
|
||||
url: `/api/mapPrd/${data.id}`,
|
||||
method: 'delete'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取地图下的产品列表
|
||||
*/
|
||||
export function getCommodityMapProduct(skinCode) {
|
||||
return request({
|
||||
url: `/api/mapPrd/${skinCode}/list`,
|
||||
method: 'get'
|
||||
});
|
||||
return request({
|
||||
url: `/api/mapPrd/${skinCode}/list`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取地图下的产品详情
|
||||
*/
|
||||
export function getMapProductDetail(prdCode) {
|
||||
return request({
|
||||
url: `/api/mapPrd/${prdCode}`,
|
||||
method: 'get'
|
||||
});
|
||||
return request({
|
||||
url: `/api/mapPrd/${prdCode}`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取产品管理列表*/
|
||||
export function getProductList(data) {
|
||||
return request({
|
||||
url: `/api/mapPrd/list`,
|
||||
method: 'get',
|
||||
params: data
|
||||
});
|
||||
return request({
|
||||
url: `/api/mapPrd/list`,
|
||||
method: 'get',
|
||||
params: data
|
||||
});
|
||||
}
|
||||
|
||||
/** 发布地图产品上架*/
|
||||
export function putMapProductOnLine(id) {
|
||||
return request({
|
||||
url: `/api/mapPrd/${id}/onLine`,
|
||||
method: 'put'
|
||||
});
|
||||
return request({
|
||||
url: `/api/mapPrd/${id}/onLine`,
|
||||
method: 'put'
|
||||
});
|
||||
}
|
||||
|
||||
/** 发布地图产品下架*/
|
||||
export function putMapProductOffLine(id) {
|
||||
return request({
|
||||
url: `/api/mapPrd/${id}/offLine`,
|
||||
method: 'put'
|
||||
});
|
||||
return request({
|
||||
url: `/api/mapPrd/${id}/offLine`,
|
||||
method: 'put'
|
||||
});
|
||||
}
|
||||
|
||||
/** 校验产品code是否已存在*/
|
||||
export function checkMapProductCodeExist(params) {
|
||||
return request({
|
||||
url: `/api/mapPrd/checkCodeExist`,
|
||||
method: 'get',
|
||||
params: params
|
||||
});
|
||||
return request({
|
||||
url: `/api/mapPrd/checkCodeExist`,
|
||||
method: 'get',
|
||||
params: params
|
||||
});
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ export function publishRunPlan(data) {
|
||||
*/
|
||||
export function importRunPlan(data) {
|
||||
return request({
|
||||
url: `/api/runPlan/draft/${data.skinCode}/prdPlan`,
|
||||
url: `/api/runPlan/draft/${data.mapId}/prdPlan`,
|
||||
method: 'post',
|
||||
data: data.runPlanList
|
||||
});
|
||||
@ -135,17 +135,17 @@ export function getRpListByMapId(mapId) {
|
||||
}
|
||||
|
||||
/** 获取站间运行时间*/
|
||||
export function getStationRunning(skinCode) {
|
||||
export function getStationRunning(mapId) {
|
||||
return request({
|
||||
url: `/api/runPlan/draft/${skinCode}/stationRunning`,
|
||||
url: `/api/runPlan/draft/${mapId}/stationRunning`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
/** 设置站间运行时间*/
|
||||
export function setStationRunning(skinCode, data) {
|
||||
export function setStationRunning(mapId, data) {
|
||||
return request({
|
||||
url: `/api/runPlan/draft/${skinCode}/stationRunning`,
|
||||
url: `/api/runPlan/draft/${mapId}/stationRunning`,
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
|
@ -119,240 +119,236 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import XLSX from 'xlsx';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { importRunPlan } from '@/api/runplan';
|
||||
import { launchFullscreen } from '@/utils/screen';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
|
||||
export default {
|
||||
name: 'PlanMenuBar',
|
||||
props: {
|
||||
skinCode: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
classA: -1,
|
||||
classB: -1,
|
||||
tempClassA: -1,
|
||||
tempClassB: -1,
|
||||
menu: [
|
||||
{
|
||||
title: '文件(F)',
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '显示(V)',
|
||||
children: [
|
||||
// {
|
||||
// title: '缩放',
|
||||
// },
|
||||
// {
|
||||
// title: '单色显示历史计划',
|
||||
// },
|
||||
// {
|
||||
// title: '彩色显示历史计划'
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '编辑(E)',
|
||||
children: [
|
||||
// {
|
||||
// title: '修改',
|
||||
// click: this.handleEditPlanningTrain
|
||||
// },
|
||||
// {
|
||||
// title: '加任务',
|
||||
// click: this.handleAddTask
|
||||
// },
|
||||
// {
|
||||
// title: '删任务',
|
||||
// click: this.handleDeleteTask
|
||||
// },
|
||||
// {
|
||||
// title: '改表号',
|
||||
// click: this.handleModifyingPlanId
|
||||
// },
|
||||
// {
|
||||
// title: '平移多辆车',
|
||||
// click: this.handleTranslationalMulTrain
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '工具(T)',
|
||||
children: [
|
||||
{
|
||||
title: '查看计划列表',
|
||||
click: this.handleViewPlanSchedule
|
||||
},
|
||||
{
|
||||
title: '创建一周计划',
|
||||
click: this.handleCreateWeekPlan
|
||||
},
|
||||
{
|
||||
title: '加载当天计划',
|
||||
click: this.handleReloadTodayPlan
|
||||
}
|
||||
// {
|
||||
// title: '有效性检查',
|
||||
// click: this.handleValidityCheck
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '帮助(H)',
|
||||
children: [
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('training', [
|
||||
'mode'
|
||||
]),
|
||||
...mapGetters('map', [
|
||||
'stationList'
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
tempClassA() {
|
||||
this.classA = this.$store.state.menuOperation.break ? -1 : this.tempClassA;
|
||||
},
|
||||
tempClassB() {
|
||||
this.classB = this.$store.state.menuOperation.break ? -1 : this.tempClassB;
|
||||
},
|
||||
'$store.state.menuOperation.break': function (val) {
|
||||
if (val) {
|
||||
this.classA = this.classB = -1;
|
||||
} else {
|
||||
this.classA = this.tempClassA;
|
||||
this.classB = this.tempClassB;
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initMenu();
|
||||
},
|
||||
methods: {
|
||||
initMenu() {
|
||||
this.clickEvent();
|
||||
this.closeMenu();
|
||||
},
|
||||
clickEvent() {
|
||||
const self = this;
|
||||
window.onclick = function (e) {
|
||||
self.closeMenu(false);
|
||||
};
|
||||
},
|
||||
noShowingChildren(children) {
|
||||
if (!children || children.length <= 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
hasShowingChildren(children) {
|
||||
if (children && children.length > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
closeMenu() {
|
||||
this.classA = this.tempClassA = -1;
|
||||
this.classB = this.tempClassB = -1;
|
||||
},
|
||||
hookClick(item, event) {
|
||||
this.closeMenu();
|
||||
// launchFullscreen();
|
||||
setTimeout(() => {
|
||||
if (item && typeof item.click == 'function') {
|
||||
item.click();
|
||||
}
|
||||
}, 500);
|
||||
},
|
||||
popupMenuA(item, index) {
|
||||
this.clickEvent();
|
||||
this.tempClassA = index;
|
||||
this.tempClassB = -1;
|
||||
},
|
||||
popupMenuB(item, index) {
|
||||
this.tempClassB = index;
|
||||
},
|
||||
openLoadFile(item) {
|
||||
const obj = this.$refs[item.title][0];
|
||||
if (obj.files) {
|
||||
const file = obj.files[0];
|
||||
item.click(file);
|
||||
obj.value = '';
|
||||
}
|
||||
},
|
||||
doClose() {
|
||||
this.$nextTick(() => {
|
||||
EventBus.$emit('closeMenu');
|
||||
});
|
||||
},
|
||||
// 刷新
|
||||
refresh() {
|
||||
this.closeMenu(true);
|
||||
EventBus.$emit('refresh');
|
||||
},
|
||||
undeveloped() {
|
||||
this.doClose();
|
||||
this.$alert('实现中......', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
}
|
||||
});
|
||||
},
|
||||
// 修改计划
|
||||
handleEditPlanningTrain() {
|
||||
this.$emit('dispatchDialog', { name: 'modifyingPlan' });
|
||||
},
|
||||
// 添加任务
|
||||
handleAddTask() {
|
||||
const params = this.$store.state.runPlan.selected;
|
||||
this.$emit('dispatchDialog', { name: 'addTask', params });
|
||||
},
|
||||
// 删除任务
|
||||
handleDeleteTask() {
|
||||
const params = this.$store.state.runPlan.selected;
|
||||
this.$emit('dispatchDialog', { name: 'deleteTask', params });
|
||||
},
|
||||
// 修改任务
|
||||
handleModifyingTask() {
|
||||
const params = this.$store.state.runPlan.selected;
|
||||
this.$emit('dispatchDialog', { name: 'modifyingTask', params });
|
||||
},
|
||||
// 改表号
|
||||
handleModifyingPlanId() {
|
||||
this.$emit('dispatchDialog', { name: 'modifyingPlanId' });
|
||||
},
|
||||
// 平移多辆车
|
||||
handleTranslationalMulTrain() {
|
||||
this.$emit('dispatchDialog', { name: 'translationalMulTrain' });
|
||||
},
|
||||
// 查看计划列表
|
||||
handleViewPlanSchedule() {
|
||||
this.$emit('dispatchDialog', { name: 'managePlanList' });
|
||||
},
|
||||
// 创建一周计划
|
||||
handleCreateWeekPlan() {
|
||||
this.$emit('dispatchDialog', { name: 'createWeekPlan' });
|
||||
},
|
||||
// 创建当天计划
|
||||
handleReloadTodayPlan() {
|
||||
this.$emit('dispatchDialog', { name: 'createTodayPlan' });
|
||||
},
|
||||
// 有效性检查
|
||||
handleValidityCheck() {
|
||||
}
|
||||
}
|
||||
name: 'PlanMenuBar',
|
||||
props: {
|
||||
skinCode: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
classA: -1,
|
||||
classB: -1,
|
||||
tempClassA: -1,
|
||||
tempClassB: -1,
|
||||
menu: [
|
||||
{
|
||||
title: '文件(F)',
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '显示(V)',
|
||||
children: [
|
||||
// {
|
||||
// title: '缩放',
|
||||
// },
|
||||
// {
|
||||
// title: '单色显示历史计划',
|
||||
// },
|
||||
// {
|
||||
// title: '彩色显示历史计划'
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '编辑(E)',
|
||||
children: [
|
||||
// {
|
||||
// title: '修改',
|
||||
// click: this.handleEditPlanningTrain
|
||||
// },
|
||||
// {
|
||||
// title: '加任务',
|
||||
// click: this.handleAddTask
|
||||
// },
|
||||
// {
|
||||
// title: '删任务',
|
||||
// click: this.handleDeleteTask
|
||||
// },
|
||||
// {
|
||||
// title: '改表号',
|
||||
// click: this.handleModifyingPlanId
|
||||
// },
|
||||
// {
|
||||
// title: '平移多辆车',
|
||||
// click: this.handleTranslationalMulTrain
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '工具(T)',
|
||||
children: [
|
||||
{
|
||||
title: '查看计划列表',
|
||||
click: this.handleViewPlanSchedule
|
||||
},
|
||||
{
|
||||
title: '创建一周计划',
|
||||
click: this.handleCreateWeekPlan
|
||||
},
|
||||
{
|
||||
title: '加载当天计划',
|
||||
click: this.handleReloadTodayPlan
|
||||
}
|
||||
// {
|
||||
// title: '有效性检查',
|
||||
// click: this.handleValidityCheck
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '帮助(H)',
|
||||
children: [
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('training', [
|
||||
'mode'
|
||||
]),
|
||||
...mapGetters('map', [
|
||||
'stationList'
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
tempClassA() {
|
||||
this.classA = this.$store.state.menuOperation.break ? -1 : this.tempClassA;
|
||||
},
|
||||
tempClassB() {
|
||||
this.classB = this.$store.state.menuOperation.break ? -1 : this.tempClassB;
|
||||
},
|
||||
'$store.state.menuOperation.break': function (val) {
|
||||
if (val) {
|
||||
this.classA = this.classB = -1;
|
||||
} else {
|
||||
this.classA = this.tempClassA;
|
||||
this.classB = this.tempClassB;
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initMenu();
|
||||
},
|
||||
methods: {
|
||||
initMenu() {
|
||||
this.clickEvent();
|
||||
this.closeMenu();
|
||||
},
|
||||
clickEvent() {
|
||||
const self = this;
|
||||
window.onclick = function (e) {
|
||||
self.closeMenu(false);
|
||||
};
|
||||
},
|
||||
noShowingChildren(children) {
|
||||
if (!children || children.length <= 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
hasShowingChildren(children) {
|
||||
if (children && children.length > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
closeMenu() {
|
||||
this.classA = this.tempClassA = -1;
|
||||
this.classB = this.tempClassB = -1;
|
||||
},
|
||||
hookClick(item, event) {
|
||||
this.closeMenu();
|
||||
setTimeout(() => {
|
||||
if (item && typeof item.click == 'function') {
|
||||
item.click();
|
||||
}
|
||||
}, 500);
|
||||
},
|
||||
popupMenuA(item, index) {
|
||||
this.clickEvent();
|
||||
this.tempClassA = index;
|
||||
this.tempClassB = -1;
|
||||
},
|
||||
popupMenuB(item, index) {
|
||||
this.tempClassB = index;
|
||||
},
|
||||
openLoadFile(item) {
|
||||
const obj = this.$refs[item.title][0];
|
||||
if (obj.files) {
|
||||
const file = obj.files[0];
|
||||
item.click(file);
|
||||
obj.value = '';
|
||||
}
|
||||
},
|
||||
doClose() {
|
||||
this.$nextTick(() => {
|
||||
EventBus.$emit('closeMenu');
|
||||
});
|
||||
},
|
||||
// 刷新
|
||||
refresh() {
|
||||
this.closeMenu(true);
|
||||
EventBus.$emit('refresh');
|
||||
},
|
||||
undeveloped() {
|
||||
this.doClose();
|
||||
this.$alert('实现中......', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
}
|
||||
});
|
||||
},
|
||||
// 修改计划
|
||||
handleEditPlanningTrain() {
|
||||
this.$emit('dispatchDialog', { name: 'modifyingPlan' });
|
||||
},
|
||||
// 添加任务
|
||||
handleAddTask() {
|
||||
const params = this.$store.state.runPlan.selected;
|
||||
this.$emit('dispatchDialog', { name: 'addTask', params });
|
||||
},
|
||||
// 删除任务
|
||||
handleDeleteTask() {
|
||||
const params = this.$store.state.runPlan.selected;
|
||||
this.$emit('dispatchDialog', { name: 'deleteTask', params });
|
||||
},
|
||||
// 修改任务
|
||||
handleModifyingTask() {
|
||||
const params = this.$store.state.runPlan.selected;
|
||||
this.$emit('dispatchDialog', { name: 'modifyingTask', params });
|
||||
},
|
||||
// 改表号
|
||||
handleModifyingPlanId() {
|
||||
this.$emit('dispatchDialog', { name: 'modifyingPlanId' });
|
||||
},
|
||||
// 平移多辆车
|
||||
handleTranslationalMulTrain() {
|
||||
this.$emit('dispatchDialog', { name: 'translationalMulTrain' });
|
||||
},
|
||||
// 查看计划列表
|
||||
handleViewPlanSchedule() {
|
||||
this.$emit('dispatchDialog', { name: 'managePlanList' });
|
||||
},
|
||||
// 创建一周计划
|
||||
handleCreateWeekPlan() {
|
||||
this.$emit('dispatchDialog', { name: 'createWeekPlan' });
|
||||
},
|
||||
// 创建当天计划
|
||||
handleReloadTodayPlan() {
|
||||
this.$emit('dispatchDialog', { name: 'createTodayPlan' });
|
||||
},
|
||||
// 有效性检查
|
||||
handleValidityCheck() {
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -119,240 +119,236 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import XLSX from 'xlsx';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { importRunPlan } from '@/api/runplan';
|
||||
import { launchFullscreen } from '@/utils/screen';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
|
||||
export default {
|
||||
name: 'PlanMenuBar',
|
||||
props: {
|
||||
skinCode: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
classA: -1,
|
||||
classB: -1,
|
||||
tempClassA: -1,
|
||||
tempClassB: -1,
|
||||
menu: [
|
||||
{
|
||||
title: '文件(F)',
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '显示(V)',
|
||||
children: [
|
||||
// {
|
||||
// title: '缩放',
|
||||
// },
|
||||
// {
|
||||
// title: '单色显示历史计划',
|
||||
// },
|
||||
// {
|
||||
// title: '彩色显示历史计划'
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '编辑(E)',
|
||||
children: [
|
||||
// {
|
||||
// title: '修改',
|
||||
// click: this.handleEditPlanningTrain
|
||||
// },
|
||||
// {
|
||||
// title: '加任务',
|
||||
// click: this.handleAddTask
|
||||
// },
|
||||
// {
|
||||
// title: '删任务',
|
||||
// click: this.handleDeleteTask
|
||||
// },
|
||||
// {
|
||||
// title: '改表号',
|
||||
// click: this.handleModifyingPlanId
|
||||
// },
|
||||
// {
|
||||
// title: '平移多辆车',
|
||||
// click: this.handleTranslationalMulTrain
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '工具(T)',
|
||||
children: [
|
||||
{
|
||||
title: '查看计划列表',
|
||||
click: this.handleViewPlanSchedule
|
||||
},
|
||||
{
|
||||
title: '创建一周计划',
|
||||
click: this.handleCreateWeekPlan
|
||||
},
|
||||
{
|
||||
title: '加载当天计划',
|
||||
click: this.handleReloadTodayPlan
|
||||
}
|
||||
// {
|
||||
// title: '有效性检查',
|
||||
// click: this.handleValidityCheck
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '帮助(H)',
|
||||
children: [
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('training', [
|
||||
'mode'
|
||||
]),
|
||||
...mapGetters('map', [
|
||||
'stationList'
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
tempClassA() {
|
||||
this.classA = this.$store.state.menuOperation.break ? -1 : this.tempClassA;
|
||||
},
|
||||
tempClassB() {
|
||||
this.classB = this.$store.state.menuOperation.break ? -1 : this.tempClassB;
|
||||
},
|
||||
'$store.state.menuOperation.break': function (val) {
|
||||
if (val) {
|
||||
this.classA = this.classB = -1;
|
||||
} else {
|
||||
this.classA = this.tempClassA;
|
||||
this.classB = this.tempClassB;
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initMenu();
|
||||
},
|
||||
methods: {
|
||||
initMenu() {
|
||||
this.clickEvent();
|
||||
this.closeMenu();
|
||||
},
|
||||
clickEvent() {
|
||||
const self = this;
|
||||
window.onclick = function (e) {
|
||||
self.closeMenu(false);
|
||||
};
|
||||
},
|
||||
noShowingChildren(children) {
|
||||
if (!children || children.length <= 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
hasShowingChildren(children) {
|
||||
if (children && children.length > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
closeMenu() {
|
||||
this.classA = this.tempClassA = -1;
|
||||
this.classB = this.tempClassB = -1;
|
||||
},
|
||||
hookClick(item, event) {
|
||||
this.closeMenu();
|
||||
// launchFullscreen();
|
||||
setTimeout(() => {
|
||||
if (item && typeof item.click == 'function') {
|
||||
item.click();
|
||||
}
|
||||
}, 500);
|
||||
},
|
||||
popupMenuA(item, index) {
|
||||
this.clickEvent();
|
||||
this.tempClassA = index;
|
||||
this.tempClassB = -1;
|
||||
},
|
||||
popupMenuB(item, index) {
|
||||
this.tempClassB = index;
|
||||
},
|
||||
openLoadFile(item) {
|
||||
const obj = this.$refs[item.title][0];
|
||||
if (obj.files) {
|
||||
const file = obj.files[0];
|
||||
item.click(file);
|
||||
obj.value = '';
|
||||
}
|
||||
},
|
||||
doClose() {
|
||||
this.$nextTick(() => {
|
||||
EventBus.$emit('closeMenu');
|
||||
});
|
||||
},
|
||||
// 刷新
|
||||
refresh() {
|
||||
this.closeMenu(true);
|
||||
EventBus.$emit('refresh');
|
||||
},
|
||||
undeveloped() {
|
||||
this.doClose();
|
||||
this.$alert('实现中......', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
}
|
||||
});
|
||||
},
|
||||
// 修改计划
|
||||
handleEditPlanningTrain() {
|
||||
this.$emit('dispatchDialog', { name: 'modifyingPlan' });
|
||||
},
|
||||
// 添加任务
|
||||
handleAddTask() {
|
||||
const params = this.$store.state.runPlan.selected;
|
||||
this.$emit('dispatchDialog', { name: 'addTask', params });
|
||||
},
|
||||
// 删除任务
|
||||
handleDeleteTask() {
|
||||
const params = this.$store.state.runPlan.selected;
|
||||
this.$emit('dispatchDialog', { name: 'deleteTask', params });
|
||||
},
|
||||
// 修改任务
|
||||
handleModifyingTask() {
|
||||
const params = this.$store.state.runPlan.selected;
|
||||
this.$emit('dispatchDialog', { name: 'modifyingTask', params });
|
||||
},
|
||||
// 改表号
|
||||
handleModifyingPlanId() {
|
||||
this.$emit('dispatchDialog', { name: 'modifyingPlanId' });
|
||||
},
|
||||
// 平移多辆车
|
||||
handleTranslationalMulTrain() {
|
||||
this.$emit('dispatchDialog', { name: 'translationalMulTrain' });
|
||||
},
|
||||
// 查看计划列表
|
||||
handleViewPlanSchedule() {
|
||||
this.$emit('dispatchDialog', { name: 'managePlanList' });
|
||||
},
|
||||
// 创建一周计划
|
||||
handleCreateWeekPlan() {
|
||||
this.$emit('dispatchDialog', { name: 'createWeekPlan' });
|
||||
},
|
||||
// 创建当天计划
|
||||
handleReloadTodayPlan() {
|
||||
this.$emit('dispatchDialog', { name: 'createTodayPlan' });
|
||||
},
|
||||
// 有效性检查
|
||||
handleValidityCheck() {
|
||||
}
|
||||
}
|
||||
name: 'PlanMenuBar',
|
||||
props: {
|
||||
skinCode: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
classA: -1,
|
||||
classB: -1,
|
||||
tempClassA: -1,
|
||||
tempClassB: -1,
|
||||
menu: [
|
||||
{
|
||||
title: '文件(F)',
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '显示(V)',
|
||||
children: [
|
||||
// {
|
||||
// title: '缩放',
|
||||
// },
|
||||
// {
|
||||
// title: '单色显示历史计划',
|
||||
// },
|
||||
// {
|
||||
// title: '彩色显示历史计划'
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '编辑(E)',
|
||||
children: [
|
||||
// {
|
||||
// title: '修改',
|
||||
// click: this.handleEditPlanningTrain
|
||||
// },
|
||||
// {
|
||||
// title: '加任务',
|
||||
// click: this.handleAddTask
|
||||
// },
|
||||
// {
|
||||
// title: '删任务',
|
||||
// click: this.handleDeleteTask
|
||||
// },
|
||||
// {
|
||||
// title: '改表号',
|
||||
// click: this.handleModifyingPlanId
|
||||
// },
|
||||
// {
|
||||
// title: '平移多辆车',
|
||||
// click: this.handleTranslationalMulTrain
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '工具(T)',
|
||||
children: [
|
||||
{
|
||||
title: '查看计划列表',
|
||||
click: this.handleViewPlanSchedule
|
||||
},
|
||||
{
|
||||
title: '创建一周计划',
|
||||
click: this.handleCreateWeekPlan
|
||||
},
|
||||
{
|
||||
title: '加载当天计划',
|
||||
click: this.handleReloadTodayPlan
|
||||
}
|
||||
// {
|
||||
// title: '有效性检查',
|
||||
// click: this.handleValidityCheck
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '帮助(H)',
|
||||
children: [
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('training', [
|
||||
'mode'
|
||||
]),
|
||||
...mapGetters('map', [
|
||||
'stationList'
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
tempClassA() {
|
||||
this.classA = this.$store.state.menuOperation.break ? -1 : this.tempClassA;
|
||||
},
|
||||
tempClassB() {
|
||||
this.classB = this.$store.state.menuOperation.break ? -1 : this.tempClassB;
|
||||
},
|
||||
'$store.state.menuOperation.break': function (val) {
|
||||
if (val) {
|
||||
this.classA = this.classB = -1;
|
||||
} else {
|
||||
this.classA = this.tempClassA;
|
||||
this.classB = this.tempClassB;
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initMenu();
|
||||
},
|
||||
methods: {
|
||||
initMenu() {
|
||||
this.clickEvent();
|
||||
this.closeMenu();
|
||||
},
|
||||
clickEvent() {
|
||||
const self = this;
|
||||
window.onclick = function (e) {
|
||||
self.closeMenu(false);
|
||||
};
|
||||
},
|
||||
noShowingChildren(children) {
|
||||
if (!children || children.length <= 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
hasShowingChildren(children) {
|
||||
if (children && children.length > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
closeMenu() {
|
||||
this.classA = this.tempClassA = -1;
|
||||
this.classB = this.tempClassB = -1;
|
||||
},
|
||||
hookClick(item, event) {
|
||||
this.closeMenu();
|
||||
setTimeout(() => {
|
||||
if (item && typeof item.click == 'function') {
|
||||
item.click();
|
||||
}
|
||||
}, 500);
|
||||
},
|
||||
popupMenuA(item, index) {
|
||||
this.clickEvent();
|
||||
this.tempClassA = index;
|
||||
this.tempClassB = -1;
|
||||
},
|
||||
popupMenuB(item, index) {
|
||||
this.tempClassB = index;
|
||||
},
|
||||
openLoadFile(item) {
|
||||
const obj = this.$refs[item.title][0];
|
||||
if (obj.files) {
|
||||
const file = obj.files[0];
|
||||
item.click(file);
|
||||
obj.value = '';
|
||||
}
|
||||
},
|
||||
doClose() {
|
||||
this.$nextTick(() => {
|
||||
EventBus.$emit('closeMenu');
|
||||
});
|
||||
},
|
||||
// 刷新
|
||||
refresh() {
|
||||
this.closeMenu(true);
|
||||
EventBus.$emit('refresh');
|
||||
},
|
||||
undeveloped() {
|
||||
this.doClose();
|
||||
this.$alert('实现中......', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
}
|
||||
});
|
||||
},
|
||||
// 修改计划
|
||||
handleEditPlanningTrain() {
|
||||
this.$emit('dispatchDialog', { name: 'modifyingPlan' });
|
||||
},
|
||||
// 添加任务
|
||||
handleAddTask() {
|
||||
const params = this.$store.state.runPlan.selected;
|
||||
this.$emit('dispatchDialog', { name: 'addTask', params });
|
||||
},
|
||||
// 删除任务
|
||||
handleDeleteTask() {
|
||||
const params = this.$store.state.runPlan.selected;
|
||||
this.$emit('dispatchDialog', { name: 'deleteTask', params });
|
||||
},
|
||||
// 修改任务
|
||||
handleModifyingTask() {
|
||||
const params = this.$store.state.runPlan.selected;
|
||||
this.$emit('dispatchDialog', { name: 'modifyingTask', params });
|
||||
},
|
||||
// 改表号
|
||||
handleModifyingPlanId() {
|
||||
this.$emit('dispatchDialog', { name: 'modifyingPlanId' });
|
||||
},
|
||||
// 平移多辆车
|
||||
handleTranslationalMulTrain() {
|
||||
this.$emit('dispatchDialog', { name: 'translationalMulTrain' });
|
||||
},
|
||||
// 查看计划列表
|
||||
handleViewPlanSchedule() {
|
||||
this.$emit('dispatchDialog', { name: 'managePlanList' });
|
||||
},
|
||||
// 创建一周计划
|
||||
handleCreateWeekPlan() {
|
||||
this.$emit('dispatchDialog', { name: 'createWeekPlan' });
|
||||
},
|
||||
// 创建当天计划
|
||||
handleReloadTodayPlan() {
|
||||
this.$emit('dispatchDialog', { name: 'createTodayPlan' });
|
||||
},
|
||||
// 有效性检查
|
||||
handleValidityCheck() {
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -119,240 +119,236 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import XLSX from 'xlsx';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { importRunPlan } from '@/api/runplan';
|
||||
import { launchFullscreen } from '@/utils/screen';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
|
||||
export default {
|
||||
name: 'PlanMenuBar',
|
||||
props: {
|
||||
skinCode: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
classA: -1,
|
||||
classB: -1,
|
||||
tempClassA: -1,
|
||||
tempClassB: -1,
|
||||
menu: [
|
||||
{
|
||||
title: '文件(F)',
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '显示(V)',
|
||||
children: [
|
||||
// {
|
||||
// title: '缩放',
|
||||
// },
|
||||
// {
|
||||
// title: '单色显示历史计划',
|
||||
// },
|
||||
// {
|
||||
// title: '彩色显示历史计划'
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '编辑(E)',
|
||||
children: [
|
||||
// {
|
||||
// title: '修改',
|
||||
// click: this.handleEditPlanningTrain
|
||||
// },
|
||||
// {
|
||||
// title: '加任务',
|
||||
// click: this.handleAddTask
|
||||
// },
|
||||
// {
|
||||
// title: '删任务',
|
||||
// click: this.handleDeleteTask
|
||||
// },
|
||||
// {
|
||||
// title: '改表号',
|
||||
// click: this.handleModifyingPlanId
|
||||
// },
|
||||
// {
|
||||
// title: '平移多辆车',
|
||||
// click: this.handleTranslationalMulTrain
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '工具(T)',
|
||||
children: [
|
||||
{
|
||||
title: '查看计划列表',
|
||||
click: this.handleViewPlanSchedule
|
||||
},
|
||||
{
|
||||
title: '创建一周计划',
|
||||
click: this.handleCreateWeekPlan
|
||||
},
|
||||
{
|
||||
title: '加载当天计划',
|
||||
click: this.handleReloadTodayPlan
|
||||
}
|
||||
// {
|
||||
// title: '有效性检查',
|
||||
// click: this.handleValidityCheck
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '帮助(H)',
|
||||
children: [
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('training', [
|
||||
'mode'
|
||||
]),
|
||||
...mapGetters('map', [
|
||||
'stationList'
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
tempClassA() {
|
||||
this.classA = this.$store.state.menuOperation.break ? -1 : this.tempClassA;
|
||||
},
|
||||
tempClassB() {
|
||||
this.classB = this.$store.state.menuOperation.break ? -1 : this.tempClassB;
|
||||
},
|
||||
'$store.state.menuOperation.break': function (val) {
|
||||
if (val) {
|
||||
this.classA = this.classB = -1;
|
||||
} else {
|
||||
this.classA = this.tempClassA;
|
||||
this.classB = this.tempClassB;
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initMenu();
|
||||
},
|
||||
methods: {
|
||||
initMenu() {
|
||||
this.clickEvent();
|
||||
this.closeMenu();
|
||||
},
|
||||
clickEvent() {
|
||||
const self = this;
|
||||
window.onclick = function (e) {
|
||||
self.closeMenu(false);
|
||||
};
|
||||
},
|
||||
noShowingChildren(children) {
|
||||
if (!children || children.length <= 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
hasShowingChildren(children) {
|
||||
if (children && children.length > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
closeMenu() {
|
||||
this.classA = this.tempClassA = -1;
|
||||
this.classB = this.tempClassB = -1;
|
||||
},
|
||||
hookClick(item, event) {
|
||||
this.closeMenu();
|
||||
// launchFullscreen();
|
||||
setTimeout(() => {
|
||||
if (item && typeof item.click == 'function') {
|
||||
item.click();
|
||||
}
|
||||
}, 500);
|
||||
},
|
||||
popupMenuA(item, index) {
|
||||
this.clickEvent();
|
||||
this.tempClassA = index;
|
||||
this.tempClassB = -1;
|
||||
},
|
||||
popupMenuB(item, index) {
|
||||
this.tempClassB = index;
|
||||
},
|
||||
openLoadFile(item) {
|
||||
const obj = this.$refs[item.title][0];
|
||||
if (obj.files) {
|
||||
const file = obj.files[0];
|
||||
item.click(file);
|
||||
obj.value = '';
|
||||
}
|
||||
},
|
||||
doClose() {
|
||||
this.$nextTick(() => {
|
||||
EventBus.$emit('closeMenu');
|
||||
});
|
||||
},
|
||||
// 刷新
|
||||
refresh() {
|
||||
this.closeMenu(true);
|
||||
EventBus.$emit('refresh');
|
||||
},
|
||||
undeveloped() {
|
||||
this.doClose();
|
||||
this.$alert('实现中......', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
}
|
||||
});
|
||||
},
|
||||
// 修改计划
|
||||
handleEditPlanningTrain() {
|
||||
this.$emit('dispatchDialog', { name: 'modifyingPlan' });
|
||||
},
|
||||
// 添加任务
|
||||
handleAddTask() {
|
||||
const params = this.$store.state.runPlan.selected;
|
||||
this.$emit('dispatchDialog', { name: 'addTask', params });
|
||||
},
|
||||
// 删除任务
|
||||
handleDeleteTask() {
|
||||
const params = this.$store.state.runPlan.selected;
|
||||
this.$emit('dispatchDialog', { name: 'deleteTask', params });
|
||||
},
|
||||
// 修改任务
|
||||
handleModifyingTask() {
|
||||
const params = this.$store.state.runPlan.selected;
|
||||
this.$emit('dispatchDialog', { name: 'modifyingTask', params });
|
||||
},
|
||||
// 改表号
|
||||
handleModifyingPlanId() {
|
||||
this.$emit('dispatchDialog', { name: 'modifyingPlanId' });
|
||||
},
|
||||
// 平移多辆车
|
||||
handleTranslationalMulTrain() {
|
||||
this.$emit('dispatchDialog', { name: 'translationalMulTrain' });
|
||||
},
|
||||
// 查看计划列表
|
||||
handleViewPlanSchedule() {
|
||||
this.$emit('dispatchDialog', { name: 'managePlanList' });
|
||||
},
|
||||
// 创建一周计划
|
||||
handleCreateWeekPlan() {
|
||||
this.$emit('dispatchDialog', { name: 'createWeekPlan' });
|
||||
},
|
||||
// 创建当天计划
|
||||
handleReloadTodayPlan() {
|
||||
this.$emit('dispatchDialog', { name: 'createTodayPlan' });
|
||||
},
|
||||
// 有效性检查
|
||||
handleValidityCheck() {
|
||||
}
|
||||
}
|
||||
name: 'PlanMenuBar',
|
||||
props: {
|
||||
skinCode: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
classA: -1,
|
||||
classB: -1,
|
||||
tempClassA: -1,
|
||||
tempClassB: -1,
|
||||
menu: [
|
||||
{
|
||||
title: '文件(F)',
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '显示(V)',
|
||||
children: [
|
||||
// {
|
||||
// title: '缩放',
|
||||
// },
|
||||
// {
|
||||
// title: '单色显示历史计划',
|
||||
// },
|
||||
// {
|
||||
// title: '彩色显示历史计划'
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '编辑(E)',
|
||||
children: [
|
||||
// {
|
||||
// title: '修改',
|
||||
// click: this.handleEditPlanningTrain
|
||||
// },
|
||||
// {
|
||||
// title: '加任务',
|
||||
// click: this.handleAddTask
|
||||
// },
|
||||
// {
|
||||
// title: '删任务',
|
||||
// click: this.handleDeleteTask
|
||||
// },
|
||||
// {
|
||||
// title: '改表号',
|
||||
// click: this.handleModifyingPlanId
|
||||
// },
|
||||
// {
|
||||
// title: '平移多辆车',
|
||||
// click: this.handleTranslationalMulTrain
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '工具(T)',
|
||||
children: [
|
||||
{
|
||||
title: '查看计划列表',
|
||||
click: this.handleViewPlanSchedule
|
||||
},
|
||||
{
|
||||
title: '创建一周计划',
|
||||
click: this.handleCreateWeekPlan
|
||||
},
|
||||
{
|
||||
title: '加载当天计划',
|
||||
click: this.handleReloadTodayPlan
|
||||
}
|
||||
// {
|
||||
// title: '有效性检查',
|
||||
// click: this.handleValidityCheck
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '帮助(H)',
|
||||
children: [
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('training', [
|
||||
'mode'
|
||||
]),
|
||||
...mapGetters('map', [
|
||||
'stationList'
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
tempClassA() {
|
||||
this.classA = this.$store.state.menuOperation.break ? -1 : this.tempClassA;
|
||||
},
|
||||
tempClassB() {
|
||||
this.classB = this.$store.state.menuOperation.break ? -1 : this.tempClassB;
|
||||
},
|
||||
'$store.state.menuOperation.break': function (val) {
|
||||
if (val) {
|
||||
this.classA = this.classB = -1;
|
||||
} else {
|
||||
this.classA = this.tempClassA;
|
||||
this.classB = this.tempClassB;
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initMenu();
|
||||
},
|
||||
methods: {
|
||||
initMenu() {
|
||||
this.clickEvent();
|
||||
this.closeMenu();
|
||||
},
|
||||
clickEvent() {
|
||||
const self = this;
|
||||
window.onclick = function (e) {
|
||||
self.closeMenu(false);
|
||||
};
|
||||
},
|
||||
noShowingChildren(children) {
|
||||
if (!children || children.length <= 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
hasShowingChildren(children) {
|
||||
if (children && children.length > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
closeMenu() {
|
||||
this.classA = this.tempClassA = -1;
|
||||
this.classB = this.tempClassB = -1;
|
||||
},
|
||||
hookClick(item, event) {
|
||||
this.closeMenu();
|
||||
setTimeout(() => {
|
||||
if (item && typeof item.click == 'function') {
|
||||
item.click();
|
||||
}
|
||||
}, 500);
|
||||
},
|
||||
popupMenuA(item, index) {
|
||||
this.clickEvent();
|
||||
this.tempClassA = index;
|
||||
this.tempClassB = -1;
|
||||
},
|
||||
popupMenuB(item, index) {
|
||||
this.tempClassB = index;
|
||||
},
|
||||
openLoadFile(item) {
|
||||
const obj = this.$refs[item.title][0];
|
||||
if (obj.files) {
|
||||
const file = obj.files[0];
|
||||
item.click(file);
|
||||
obj.value = '';
|
||||
}
|
||||
},
|
||||
doClose() {
|
||||
this.$nextTick(() => {
|
||||
EventBus.$emit('closeMenu');
|
||||
});
|
||||
},
|
||||
// 刷新
|
||||
refresh() {
|
||||
this.closeMenu(true);
|
||||
EventBus.$emit('refresh');
|
||||
},
|
||||
undeveloped() {
|
||||
this.doClose();
|
||||
this.$alert('实现中......', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
}
|
||||
});
|
||||
},
|
||||
// 修改计划
|
||||
handleEditPlanningTrain() {
|
||||
this.$emit('dispatchDialog', { name: 'modifyingPlan' });
|
||||
},
|
||||
// 添加任务
|
||||
handleAddTask() {
|
||||
const params = this.$store.state.runPlan.selected;
|
||||
this.$emit('dispatchDialog', { name: 'addTask', params });
|
||||
},
|
||||
// 删除任务
|
||||
handleDeleteTask() {
|
||||
const params = this.$store.state.runPlan.selected;
|
||||
this.$emit('dispatchDialog', { name: 'deleteTask', params });
|
||||
},
|
||||
// 修改任务
|
||||
handleModifyingTask() {
|
||||
const params = this.$store.state.runPlan.selected;
|
||||
this.$emit('dispatchDialog', { name: 'modifyingTask', params });
|
||||
},
|
||||
// 改表号
|
||||
handleModifyingPlanId() {
|
||||
this.$emit('dispatchDialog', { name: 'modifyingPlanId' });
|
||||
},
|
||||
// 平移多辆车
|
||||
handleTranslationalMulTrain() {
|
||||
this.$emit('dispatchDialog', { name: 'translationalMulTrain' });
|
||||
},
|
||||
// 查看计划列表
|
||||
handleViewPlanSchedule() {
|
||||
this.$emit('dispatchDialog', { name: 'managePlanList' });
|
||||
},
|
||||
// 创建一周计划
|
||||
handleCreateWeekPlan() {
|
||||
this.$emit('dispatchDialog', { name: 'createWeekPlan' });
|
||||
},
|
||||
// 创建当天计划
|
||||
handleReloadTodayPlan() {
|
||||
this.$emit('dispatchDialog', { name: 'createTodayPlan' });
|
||||
},
|
||||
// 有效性检查
|
||||
handleValidityCheck() {
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -21,12 +21,11 @@ import Errpr404 from '@/views/error-page/404';
|
||||
|
||||
import SkinCode from '@/views/system/skinCode/index';
|
||||
import SkinCodeDraft from '@/views/system/skinCode/draft';
|
||||
import MapProduct from '@/views/system/product/index';
|
||||
|
||||
import Mapdraft from '@/views/map/mapdraft/index';
|
||||
// import Mapdraft from '@/views/map/mapdraft/index';
|
||||
import Mapedit from '@/views/map/mapdraft/mapedit/index';
|
||||
import Runplan from '@/views/map/runplan/index';
|
||||
import MapProduct from '@/views/map/product/index';
|
||||
import RunplanView from '@/views/map/runplan/chart';
|
||||
// import Runplan from '@/views/map/runplan/index';
|
||||
|
||||
import Trainingrecord from '@/views/lesson/trainingrecord/index';
|
||||
import TrainingrecordManage from '@/views/lesson/trainingrecord/manage/index';
|
||||
@ -53,22 +52,23 @@ import PublishExamRule from '@/views/publish/examRule/index';
|
||||
import PublishExamRuleDraft from '@/views/publish/examRule/draft/index';
|
||||
|
||||
import DemonstrationDetail from '@/views/demonstration/detail/index';
|
||||
import ScreenMonitor from '@/views/screenMonitor/index';
|
||||
import ScreenMonitorHome from '@/views/screenMonitor/home';
|
||||
import ScreenMonitorDetail from '@/views/screenMonitor/detail/index';
|
||||
// import ScreenMonitor from '@/views/screenMonitor/index';
|
||||
// import ScreenMonitorHome from '@/views/screenMonitor/home';
|
||||
// import ScreenMonitorDetail from '@/views/screenMonitor/detail/index';
|
||||
|
||||
import PlanMonitorEditTool from '@/views/planMonitor/editTool/index';
|
||||
import PlanMonitorEditUserTool from '@/views/planMonitor/editTool/userindex';
|
||||
import PlanMonitor from '@/views/planMonitor/index';
|
||||
import PlanMonitorHome from '@/views/planMonitor/home';
|
||||
// import PlanMonitor from '@/views/planMonitor/index';
|
||||
// import PlanMonitorHome from '@/views/planMonitor/home';
|
||||
import PlanMonitorDetail from '@/views/planMonitor/detail';
|
||||
|
||||
import DesignPlatformHome from '@/views/designPlatform/home';
|
||||
import DesignPlatform from '@/views/designPlatform/index';
|
||||
import DesignPlatformUser from '@/views/designPlatform/userIndex';
|
||||
import MapPreview from '@/views/designPlatform/mapPreview';
|
||||
|
||||
import Replay from '@/views/replay/index';
|
||||
import DesignPlatformUser from '@/views/designUser/index';
|
||||
|
||||
// import Replay from '@/views/replay/index';
|
||||
import Package from '@/views/package/index';
|
||||
import PackageDraft from '@/views/package/draft/ruleForm';
|
||||
import PackageDetail from '@/views/package/detail';
|
||||
@ -82,6 +82,7 @@ import RunPlanTemplate from '@/views/publish/runPlanTemplate/index';
|
||||
import RunPlanEveryDay from '@/views/publish/runPlanEveryDay/index';
|
||||
import ProductStatus from '@/views/publish/productStatus/index';
|
||||
import PublishLesson from '@/views/publish/publishLesson/index';
|
||||
import RunplanView from '@/views/publish/runPlanView/index';
|
||||
|
||||
import IbpEdit from '@/views/ibp/ibpDraft/ibpEdit/index';
|
||||
import TrainingPlatform from '@/views/trainingPlatform/index';
|
||||
@ -320,7 +321,7 @@ export const constantRoutes = [
|
||||
];
|
||||
|
||||
export const asyncRouter = [
|
||||
{
|
||||
{ // 公共地图
|
||||
path: '/design',
|
||||
component: Layout,
|
||||
redirect: '/design/home',
|
||||
@ -423,7 +424,7 @@ export const asyncRouter = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
{ // 个人地图
|
||||
path: '/design/userlist',
|
||||
redirect: '/design/userlist/home',
|
||||
component: Layout,
|
||||
@ -483,7 +484,7 @@ export const asyncRouter = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
{ // 全屏战场图
|
||||
path: '/display/:mode',
|
||||
component: Display,
|
||||
meta: {
|
||||
@ -504,7 +505,7 @@ export const asyncRouter = [
|
||||
},
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
{ // 综合演练室
|
||||
path: '/trainroom',
|
||||
component: TrainRoom,
|
||||
meta: {
|
||||
@ -679,67 +680,67 @@ export const asyncRouter = [
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
{
|
||||
{ // 运行图编辑
|
||||
path: '/plan/usertool',
|
||||
component: PlanMonitorEditUserTool,
|
||||
meta: {
|
||||
},
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
{ // 运行图编辑
|
||||
path: '/plan/tool',
|
||||
component: PlanMonitorEditTool,
|
||||
meta: {
|
||||
},
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/plan',
|
||||
redirect: '/plan/home',
|
||||
component: PlanMonitor,
|
||||
hidden: true,
|
||||
meta: {
|
||||
roles: [admin, user, userDesign]
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'home',
|
||||
component: PlanMonitorHome,
|
||||
meta: {
|
||||
i18n: 'router.planSystem'
|
||||
},
|
||||
target: true
|
||||
},
|
||||
{
|
||||
path: 'detail/:lessonId',
|
||||
component: PlanMonitorDetail,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'pay/:lessonId',
|
||||
component: Pay,
|
||||
hidden: true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/replay',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
meta: {
|
||||
roles: [admin, userDesign]
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'manage',
|
||||
component: Replay,
|
||||
meta: {
|
||||
i18n: 'router.replayManage'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
// { // 琏计划
|
||||
// path: '/plan',
|
||||
// redirect: '/plan/home',
|
||||
// component: PlanMonitor,
|
||||
// hidden: true,
|
||||
// meta: {
|
||||
// roles: [admin, user, userDesign]
|
||||
// },
|
||||
// children: [
|
||||
// {
|
||||
// path: 'home',
|
||||
// component: PlanMonitorHome,
|
||||
// meta: {
|
||||
// i18n: 'router.planSystem'
|
||||
// },
|
||||
// target: true
|
||||
// },
|
||||
// {
|
||||
// path: 'detail/:lessonId',
|
||||
// component: PlanMonitorDetail,
|
||||
// hidden: true
|
||||
// },
|
||||
// {
|
||||
// path: 'pay/:lessonId',
|
||||
// component: Pay,
|
||||
// hidden: true
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// path: '/replay',
|
||||
// component: Layout,
|
||||
// hidden: true,
|
||||
// meta: {
|
||||
// roles: [admin, userDesign]
|
||||
// },
|
||||
// children: [
|
||||
// {
|
||||
// path: 'manage',
|
||||
// component: Replay,
|
||||
// meta: {
|
||||
// i18n: 'router.replayManage'
|
||||
// }
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
{ // 发布内容管理
|
||||
path: '/publish',
|
||||
component: Layout,
|
||||
meta: {
|
||||
@ -823,7 +824,7 @@ export const asyncRouter = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
{ // 订单权限管理
|
||||
path: '/orderauthor',
|
||||
component: Layout,
|
||||
meta: {
|
||||
@ -915,7 +916,7 @@ export const asyncRouter = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
{ // 系统管理
|
||||
path: '/system',
|
||||
component: Layout,
|
||||
meta: {
|
||||
@ -1031,7 +1032,7 @@ export const asyncRouter = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
{ // 发布申请
|
||||
path: '/apply',
|
||||
component: Layout,
|
||||
meta: {
|
||||
|
@ -10,8 +10,8 @@
|
||||
<script>
|
||||
import RunPlanOperate from './operate';
|
||||
import { reviewRunPlanList,publishRunPlan,rejectRunPlan,previewRunPlan } from '@/api/designPlatform';
|
||||
// import { listPublishMap } from '@/api/jmap/map';
|
||||
import { getSkinCodeList } from '@/api/management/mapskin';
|
||||
import { listPublishMap } from '@/api/jmap/map';
|
||||
// import { getSkinCodeList } from '@/api/management/mapskin';
|
||||
|
||||
import { launchFullscreen } from '@/utils/screen';
|
||||
import { UrlConfig } from '@/router/index';
|
||||
@ -26,14 +26,14 @@
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
skinList:[],
|
||||
mapList:[],
|
||||
queryForm: {
|
||||
labelWidth: '150px',
|
||||
reset: true,
|
||||
queryObject: {
|
||||
mapId: {
|
||||
type: 'select',
|
||||
label: this.$t('approval.skin'),
|
||||
label: this.$t('approval.map'),
|
||||
config: {
|
||||
data: []
|
||||
}
|
||||
@ -60,11 +60,11 @@
|
||||
prop: 'name'
|
||||
},
|
||||
{
|
||||
title: this.$t('approval.skin'),
|
||||
title: this.$t('approval.map'),
|
||||
prop: 'mapId ',
|
||||
width:250,
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return this.$convertField(row.skinCode , this.skinList, ['value', 'label']); },
|
||||
columnValue: (row) => {return this.$convertField(row.mapId , this.mapList, ['value', 'label']); },
|
||||
tagType: (row) => { return ''; }
|
||||
},
|
||||
{
|
||||
@ -127,10 +127,10 @@
|
||||
async loadInitData() {
|
||||
try {
|
||||
// 获取地图
|
||||
this.skinList = [];
|
||||
const res = await getSkinCodeList();
|
||||
this.skinList = res.data.map(elem => { return { value: elem.code, label: elem.name } });
|
||||
this.queryForm.queryObject.mapId.config.data=this.skinList;
|
||||
this.mapList = [];
|
||||
const res = await listPublishMap();
|
||||
this.mapList = res.data.map(elem => { return { value: elem.id, label: elem.name } });
|
||||
this.queryForm.queryObject.mapId.config.data=this.mapList;
|
||||
} catch (error) {
|
||||
console.error(error, '获取发布地图');
|
||||
}
|
||||
|
@ -29,24 +29,24 @@ import home5 from '@/assets/home/tring4.jpg';
|
||||
import home6 from '@/assets/home/demon2.jpg';
|
||||
|
||||
export default {
|
||||
name: 'Home',
|
||||
data() {
|
||||
return {
|
||||
listImg: [
|
||||
{ src: home1 },
|
||||
{ src: home2 },
|
||||
{ src: home3 },
|
||||
{ src: home4 },
|
||||
{ src: home5 },
|
||||
{ src: home6 }
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
height() {
|
||||
return this.$store.state.app.height - 93;
|
||||
}
|
||||
}
|
||||
name: 'Home',
|
||||
data() {
|
||||
return {
|
||||
listImg: [
|
||||
{ src: home1 },
|
||||
{ src: home2 },
|
||||
{ src: home3 },
|
||||
{ src: home4 },
|
||||
{ src: home5 },
|
||||
{ src: home6 }
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
height() {
|
||||
return this.$store.state.app.height - 93;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
|
@ -19,70 +19,70 @@ import localStore from 'storejs';
|
||||
import { getSessionStorage, setSessionStorage } from '@/utils/auth';
|
||||
|
||||
export default {
|
||||
name: 'DesignPlatform',
|
||||
components: {
|
||||
demonList,
|
||||
drapLeft
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
listShow: true,
|
||||
widthLeft: Number(localStore.get('LeftWidth')) || 450,
|
||||
productList: [],
|
||||
skinCode: '',
|
||||
currentWidth: ''
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'lessonbar'
|
||||
]),
|
||||
width() {
|
||||
return this.$store.state.app.width;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'lessonbar.opened': function (val) {
|
||||
this.listShow = val;
|
||||
},
|
||||
widthLeft(val) {
|
||||
this.setMapResize(val);
|
||||
},
|
||||
'$store.state.app.windowSizeCount': function() {
|
||||
this.resize();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.currentWidth=this.$store.state.app.width - this.widthLeft;
|
||||
const againEnter = getSessionStorage('againEnter') || null;
|
||||
if (!againEnter) {
|
||||
launchFullscreen();
|
||||
setSessionStorage('againEnter', true);
|
||||
}
|
||||
this.resize();
|
||||
this.widthLeft = Number(localStore.get('LeftWidth'));
|
||||
},
|
||||
methods: {
|
||||
refresh() {
|
||||
this.$refs && this.$refs.demonList && this.$refs.demonList.loadInitData();
|
||||
},
|
||||
drapWidth(width) {
|
||||
this.widthLeft = Number(width);
|
||||
},
|
||||
resize() {
|
||||
this.widthLeft = Number(localStore.get('LeftWidth')) || this.widthLeft;
|
||||
const width = this.$store.state.app.width - 521 - this.widthLeft;
|
||||
// const height = this.$store.state.app.height - 90;
|
||||
this.$store.dispatch('config/resize', { width: width });
|
||||
},
|
||||
setMapResize(LeftWidth) {
|
||||
this.currentWidth=this.$store.state.app.width - this.widthLeft;
|
||||
const widths = this.$store.state.app.width - 521 - LeftWidth;
|
||||
// const heights = this.$store.state.app.height - 90;
|
||||
this.$store.dispatch('config/resize', { width: widths });
|
||||
}
|
||||
name: 'DesignPlatform',
|
||||
components: {
|
||||
demonList,
|
||||
drapLeft
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
listShow: true,
|
||||
widthLeft: Number(localStore.get('LeftWidth')) || 450,
|
||||
productList: [],
|
||||
skinCode: '',
|
||||
currentWidth: ''
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'lessonbar'
|
||||
]),
|
||||
width() {
|
||||
return this.$store.state.app.width;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'lessonbar.opened': function (val) {
|
||||
this.listShow = val;
|
||||
},
|
||||
widthLeft(val) {
|
||||
this.setMapResize(val);
|
||||
},
|
||||
'$store.state.app.windowSizeCount': function() {
|
||||
this.resize();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.currentWidth = this.$store.state.app.width - this.widthLeft;
|
||||
const againEnter = getSessionStorage('againEnter') || null;
|
||||
if (!againEnter) {
|
||||
launchFullscreen();
|
||||
setSessionStorage('againEnter', true);
|
||||
}
|
||||
this.resize();
|
||||
this.widthLeft = Number(localStore.get('LeftWidth'));
|
||||
},
|
||||
methods: {
|
||||
refresh() {
|
||||
this.$refs && this.$refs.demonList && this.$refs.demonList.loadInitData();
|
||||
},
|
||||
drapWidth(width) {
|
||||
this.widthLeft = Number(width);
|
||||
},
|
||||
resize() {
|
||||
this.widthLeft = Number(localStore.get('LeftWidth')) || this.widthLeft;
|
||||
const width = this.$store.state.app.width - 521 - this.widthLeft;
|
||||
// const height = this.$store.state.app.height - 90;
|
||||
this.$store.dispatch('config/resize', { width: width });
|
||||
},
|
||||
setMapResize(LeftWidth) {
|
||||
this.currentWidth = this.$store.state.app.width - this.widthLeft;
|
||||
const widths = this.$store.state.app.width - 521 - LeftWidth;
|
||||
// const heights = this.$store.state.app.height - 90;
|
||||
this.$store.dispatch('config/resize', { width: widths });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
|
@ -9,104 +9,104 @@ import { loadMapDataById } from '@/utils/loaddata';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
|
||||
export default {
|
||||
name: 'MapPreview',
|
||||
components: {
|
||||
JlmapVisual
|
||||
},
|
||||
props: {
|
||||
widthLeft: {
|
||||
type: Number,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
size: {
|
||||
width: document.documentElement.clientWidth - 400,
|
||||
height: document.documentElement.clientHeight - 80
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
mapId() {
|
||||
return this.$route.params.mapId;
|
||||
},
|
||||
height() {
|
||||
return this.$store.state.app.height - 50-30;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
widthLeft(val) {
|
||||
this.setWindowSize();
|
||||
},
|
||||
$route() {
|
||||
this.$nextTick(() => {
|
||||
this.initLoadData();
|
||||
});
|
||||
},
|
||||
// '$store.state.map.mapViewLoadedCount': function (val) {
|
||||
// // this.subscribe();
|
||||
// debugger;
|
||||
// this.$store.dispatch('map/setTrainWindowShow', false);
|
||||
// },
|
||||
'$store.state.app.windowSizeCount': function() {
|
||||
this.setWindowSize();
|
||||
}
|
||||
},
|
||||
async beforeDestroy() {
|
||||
// await this.clearAllTimer();
|
||||
// if (!this.isReplay) {
|
||||
// await this.quit();
|
||||
// }
|
||||
// await this.$store.dispatch('training/reset');
|
||||
await this.$store.dispatch('map/mapClear');
|
||||
// EventBus.$off('clearCheckLogin');
|
||||
},
|
||||
async mounted() {
|
||||
await this.setWindowSize();
|
||||
await this.initLoadData();
|
||||
},
|
||||
methods: {
|
||||
async initLoadData() {
|
||||
if (parseInt(this.mapId)) {
|
||||
await this.loadMapDataById(this.mapId);
|
||||
} else {
|
||||
this.endViewLoading();
|
||||
}
|
||||
},
|
||||
// 通过id加载地图数据
|
||||
async loadMapDataById(mapId) {
|
||||
try {
|
||||
await this.$store.dispatch('training/changeMode', { mode: null });
|
||||
await loadMapDataById(mapId);
|
||||
await this.$store.dispatch('training/over');
|
||||
await this.$store.dispatch('training/setMapDefaultState');
|
||||
await this.$store.dispatch('map/clearJlmapTrainView');
|
||||
await this.$store.dispatch('map/setTrainWindowShow', false);
|
||||
} catch (error) {
|
||||
this.$messageBox(`获取地图数据失败: ${error.message}`);
|
||||
this.endViewLoading();
|
||||
}
|
||||
},
|
||||
// 结束加载状态
|
||||
endViewLoading(isSuccess) {
|
||||
if (!isSuccess) {
|
||||
this.$store.dispatch('map/mapClear');
|
||||
}
|
||||
name: 'MapPreview',
|
||||
components: {
|
||||
JlmapVisual
|
||||
},
|
||||
props: {
|
||||
widthLeft: {
|
||||
type: Number,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
size: {
|
||||
width: document.documentElement.clientWidth - 400,
|
||||
height: document.documentElement.clientHeight - 80
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
mapId() {
|
||||
return this.$route.params.mapId;
|
||||
},
|
||||
height() {
|
||||
return this.$store.state.app.height - 50 - 30;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
widthLeft(val) {
|
||||
this.setWindowSize();
|
||||
},
|
||||
$route() {
|
||||
this.$nextTick(() => {
|
||||
this.initLoadData();
|
||||
});
|
||||
},
|
||||
// '$store.state.map.mapViewLoadedCount': function (val) {
|
||||
// // this.subscribe();
|
||||
// debugger;
|
||||
// this.$store.dispatch('map/setTrainWindowShow', false);
|
||||
// },
|
||||
'$store.state.app.windowSizeCount': function() {
|
||||
this.setWindowSize();
|
||||
}
|
||||
},
|
||||
async beforeDestroy() {
|
||||
// await this.clearAllTimer();
|
||||
// if (!this.isReplay) {
|
||||
// await this.quit();
|
||||
// }
|
||||
// await this.$store.dispatch('training/reset');
|
||||
await this.$store.dispatch('map/mapClear');
|
||||
// EventBus.$off('clearCheckLogin');
|
||||
},
|
||||
async mounted() {
|
||||
await this.setWindowSize();
|
||||
await this.initLoadData();
|
||||
},
|
||||
methods: {
|
||||
async initLoadData() {
|
||||
if (parseInt(this.mapId)) {
|
||||
await this.loadMapDataById(this.mapId);
|
||||
} else {
|
||||
this.endViewLoading();
|
||||
}
|
||||
},
|
||||
// 通过id加载地图数据
|
||||
async loadMapDataById(mapId) {
|
||||
try {
|
||||
await this.$store.dispatch('training/changeMode', { mode: null });
|
||||
await loadMapDataById(mapId);
|
||||
await this.$store.dispatch('training/over');
|
||||
await this.$store.dispatch('training/setMapDefaultState');
|
||||
await this.$store.dispatch('map/clearJlmapTrainView');
|
||||
await this.$store.dispatch('map/setTrainWindowShow', false);
|
||||
} catch (error) {
|
||||
this.$messageBox(`获取地图数据失败: ${error.message}`);
|
||||
this.endViewLoading();
|
||||
}
|
||||
},
|
||||
// 结束加载状态
|
||||
endViewLoading(isSuccess) {
|
||||
if (!isSuccess) {
|
||||
this.$store.dispatch('map/mapClear');
|
||||
}
|
||||
|
||||
this.$nextTick(() => {
|
||||
EventBus.$emit('viewLoading', false);
|
||||
});
|
||||
},
|
||||
setWindowSize() {
|
||||
this.$nextTick(() => {
|
||||
const width = this.$store.state.app.width-(this.widthLeft||450);
|
||||
const height = this.height;
|
||||
this.$store.dispatch('config/resize', { width, height });
|
||||
// this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: this.offsetStationCode });
|
||||
});
|
||||
}
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
EventBus.$emit('viewLoading', false);
|
||||
});
|
||||
},
|
||||
setWindowSize() {
|
||||
this.$nextTick(() => {
|
||||
const width = this.$store.state.app.width - (this.widthLeft || 450);
|
||||
const height = this.height;
|
||||
this.$store.dispatch('config/resize', { width, height });
|
||||
// this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: this.offsetStationCode });
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
@ -1,136 +0,0 @@
|
||||
<template>
|
||||
<div class="app-wrapper" style="height: 100%;">
|
||||
<map-create ref="mapCreate" :skin-code="skinCode" @refresh="refresh1" @editmap="handleNodeClick" />
|
||||
<div v-show="listShow" class="examList" :style="{width: widthLeft+'px'}">
|
||||
<demon-list ref="demonList" :width="widthLeft" @createMap="createMap" />
|
||||
</div>
|
||||
<drap-left :width-left="widthLeft" @drapWidth="drapWidth" />
|
||||
<transition>
|
||||
<router-view :product-list="productList" />
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import demonList from './userDemonList';
|
||||
import drapLeft from '@/views/components/drapLeft/index';
|
||||
import { launchFullscreen } from '@/utils/screen';
|
||||
import localStore from 'storejs';
|
||||
import { getSessionStorage, setSessionStorage } from '@/utils/auth';
|
||||
import MapCreate from '@/views/map/mapdraft/mapmanage/create';
|
||||
import { UrlConfig } from '@/router/index';
|
||||
|
||||
export default {
|
||||
name: 'DesignPlatform',
|
||||
components: {
|
||||
demonList,
|
||||
drapLeft,
|
||||
MapCreate
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
listShow: true,
|
||||
widthLeft: Number(localStore.get('LeftWidth')) || 450,
|
||||
productList: [],
|
||||
skinCode: ''
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'lessonbar'
|
||||
]),
|
||||
width() {
|
||||
return this.$store.state.app.width;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'lessonbar.opened': function (val) {
|
||||
this.listShow = val;
|
||||
},
|
||||
widthLeft(val) {
|
||||
this.setMapResize(val);
|
||||
},
|
||||
'$store.state.app.windowSizeCount': function() {
|
||||
this.resize();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const againEnter = getSessionStorage('againEnter') || null;
|
||||
if (!againEnter) {
|
||||
launchFullscreen();
|
||||
setSessionStorage('againEnter', true);
|
||||
}
|
||||
this.resize();
|
||||
this.widthLeft = Number(localStore.get('LeftWidth'));
|
||||
},
|
||||
methods: {
|
||||
refresh() {
|
||||
this.$refs && this.$refs.demonList && this.$refs.demonList.loadInitData();
|
||||
},
|
||||
drapWidth(width) {
|
||||
this.widthLeft = Number(width);
|
||||
},
|
||||
|
||||
createMap() {
|
||||
this.$refs.mapCreate.show();
|
||||
},
|
||||
|
||||
refresh1() {
|
||||
this.$refs.demonList.loadInitData();
|
||||
},
|
||||
|
||||
getSkinCode(node) {
|
||||
let next = node;
|
||||
while (next) {
|
||||
if (next.data && next.data.type == 'skin') {
|
||||
this.skinCode = next.data.id;
|
||||
break;
|
||||
}
|
||||
next = next.parent;
|
||||
}
|
||||
},
|
||||
handleNodeClick(obj, node) {
|
||||
this.getSkinCode(node);
|
||||
if (obj && obj.type == 'map') {
|
||||
this.editModel = obj;
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: null, menu: null });
|
||||
this.mapSelected({ view: 'draft' });
|
||||
}
|
||||
},
|
||||
mapSelected(data) {
|
||||
if (data && this.editModel) {
|
||||
this.$router.push({ path: `${UrlConfig.map.draft}/${this.editModel.id}/${data.view}`, query: { name: this.editModel.name } });
|
||||
}
|
||||
},
|
||||
resize() {
|
||||
this.widthLeft = Number(localStore.get('LeftWidth')) || this.widthLeft;
|
||||
const width = this.$store.state.app.width - 521 - this.widthLeft;
|
||||
const height = this.$store.state.app.height - 90;
|
||||
this.$store.dispatch('config/resize', { width: width, height: height });
|
||||
},
|
||||
setMapResize(LeftWidth) {
|
||||
const widths = this.$store.state.app.width - 521 - LeftWidth;
|
||||
const heights = this.$store.state.app.height - 90;
|
||||
this.$store.dispatch('config/resize', { width: widths, height: heights });
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
@import "src/styles/mixin.scss";
|
||||
|
||||
.app-wrapper {
|
||||
@include clearfix;
|
||||
position: relative;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.examList {
|
||||
float: left;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
136
src/views/designUser/index.vue
Normal file
136
src/views/designUser/index.vue
Normal file
@ -0,0 +1,136 @@
|
||||
<template>
|
||||
<div class="app-wrapper" style="height: 100%;">
|
||||
<map-create ref="mapCreate" :skin-code="skinCode" @refresh="refresh1" @editmap="handleNodeClick" />
|
||||
<div v-show="listShow" class="examList" :style="{width: widthLeft+'px'}">
|
||||
<demon-list ref="demonList" :width="widthLeft" @createMap="createMap" />
|
||||
</div>
|
||||
<drap-left :width-left="widthLeft" @drapWidth="drapWidth" />
|
||||
<transition>
|
||||
<router-view :product-list="productList" />
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import demonList from './demonList';
|
||||
import drapLeft from '@/views/components/drapLeft/index';
|
||||
import { launchFullscreen } from '@/utils/screen';
|
||||
import localStore from 'storejs';
|
||||
import { getSessionStorage, setSessionStorage } from '@/utils/auth';
|
||||
import MapCreate from '@/views/map/mapdraft/mapmanage/create';
|
||||
import { UrlConfig } from '@/router/index';
|
||||
|
||||
export default {
|
||||
name: 'DesignPlatform',
|
||||
components: {
|
||||
demonList,
|
||||
drapLeft,
|
||||
MapCreate
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
listShow: true,
|
||||
widthLeft: Number(localStore.get('LeftWidth')) || 450,
|
||||
productList: [],
|
||||
skinCode: ''
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'lessonbar'
|
||||
]),
|
||||
width() {
|
||||
return this.$store.state.app.width;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'lessonbar.opened': function (val) {
|
||||
this.listShow = val;
|
||||
},
|
||||
widthLeft(val) {
|
||||
this.setMapResize(val);
|
||||
},
|
||||
'$store.state.app.windowSizeCount': function() {
|
||||
this.resize();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const againEnter = getSessionStorage('againEnter') || null;
|
||||
if (!againEnter) {
|
||||
launchFullscreen();
|
||||
setSessionStorage('againEnter', true);
|
||||
}
|
||||
this.resize();
|
||||
this.widthLeft = Number(localStore.get('LeftWidth'));
|
||||
},
|
||||
methods: {
|
||||
refresh() {
|
||||
this.$refs && this.$refs.demonList && this.$refs.demonList.loadInitData();
|
||||
},
|
||||
drapWidth(width) {
|
||||
this.widthLeft = Number(width);
|
||||
},
|
||||
|
||||
createMap() {
|
||||
this.$refs.mapCreate.show();
|
||||
},
|
||||
|
||||
refresh1() {
|
||||
this.$refs.demonList.loadInitData();
|
||||
},
|
||||
|
||||
getSkinCode(node) {
|
||||
let next = node;
|
||||
while (next) {
|
||||
if (next.data && next.data.type == 'skin') {
|
||||
this.skinCode = next.data.id;
|
||||
break;
|
||||
}
|
||||
next = next.parent;
|
||||
}
|
||||
},
|
||||
handleNodeClick(obj, node) {
|
||||
this.getSkinCode(node);
|
||||
if (obj && obj.type == 'map') {
|
||||
this.editModel = obj;
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: null, menu: null });
|
||||
this.mapSelected({ view: 'draft' });
|
||||
}
|
||||
},
|
||||
mapSelected(data) {
|
||||
if (data && this.editModel) {
|
||||
this.$router.push({ path: `${UrlConfig.map.draft}/${this.editModel.id}/${data.view}`, query: { name: this.editModel.name } });
|
||||
}
|
||||
},
|
||||
resize() {
|
||||
this.widthLeft = Number(localStore.get('LeftWidth')) || this.widthLeft;
|
||||
const width = this.$store.state.app.width - 521 - this.widthLeft;
|
||||
const height = this.$store.state.app.height - 90;
|
||||
this.$store.dispatch('config/resize', { width: width, height: height });
|
||||
},
|
||||
setMapResize(LeftWidth) {
|
||||
const widths = this.$store.state.app.width - 521 - LeftWidth;
|
||||
const heights = this.$store.state.app.height - 90;
|
||||
this.$store.dispatch('config/resize', { width: widths, height: heights });
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
@import "src/styles/mixin.scss";
|
||||
|
||||
.app-wrapper {
|
||||
@include clearfix;
|
||||
position: relative;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.examList {
|
||||
float: left;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
@ -1,69 +0,0 @@
|
||||
<template>
|
||||
<div id="mapMain" class="mapDraft">
|
||||
<div class="map-list" :style="{width: widthLeft+'px'}">
|
||||
<map-list-operation ref="mapListOperation" />
|
||||
</div>
|
||||
<drap-left :width-left="widthLeft" @drapWidth="drapWidth" />
|
||||
<transition>
|
||||
<router-view />
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import MapListOperation from './mapmanage/maplist';
|
||||
import localStore from 'storejs';
|
||||
import DrapLeft from '@/views/components/drapLeft/index';
|
||||
|
||||
export default {
|
||||
name: 'MapDraft',
|
||||
components: {
|
||||
MapListOperation,
|
||||
DrapLeft
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
widthLeft: 320
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
widthLeft(val) {
|
||||
this.setMapResize(val);
|
||||
},
|
||||
'$store.state.app.windowSizeCount': function() {
|
||||
this.resize();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch('training/setPrdType', null);
|
||||
this.resize();
|
||||
},
|
||||
methods: {
|
||||
drapWidth(width) {
|
||||
this.widthLeft = Number(width);
|
||||
},
|
||||
resize() {
|
||||
this.widthLeft = Number(localStore.get('LeftWidth')) || this.widthLeft;
|
||||
const width = this.$store.state.app.width - 521 - this.widthLeft;
|
||||
const height = this.$store.state.app.height - 90;
|
||||
this.$store.dispatch('config/resize', { width: width, height: height });
|
||||
},
|
||||
setMapResize(LeftWidth) {
|
||||
const widths = this.$store.state.app.width - 521 - LeftWidth;
|
||||
const heights = this.$store.state.app.height - 90;
|
||||
this.$store.dispatch('config/resize', { width: widths, height: heights });
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
@import "src/styles/mixin.scss";
|
||||
|
||||
.mapDraft {
|
||||
overflow: hidden;
|
||||
|
||||
.map-list {
|
||||
float: left;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -59,287 +59,287 @@ import ConfigMap from './configMap';
|
||||
import DataRelation from './dataRelation/index';
|
||||
|
||||
export default {
|
||||
name: 'MapView',
|
||||
components: {
|
||||
JlmapVisual,
|
||||
MapOperate,
|
||||
DataRelation,
|
||||
ConfigMap
|
||||
// MapCreate,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
viewSelect: ViewMode.MIX,
|
||||
mapSaveing: false,
|
||||
ViewMode: ViewMode,
|
||||
viewDraft: 'draft',
|
||||
autoSaveTask: null,
|
||||
selected: null,
|
||||
mapInfo: { name: this.$t('map.pleaseSelectMap') },
|
||||
timeDemon: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
cardHeight() {
|
||||
return this.$store.state.app.height - 195-30;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$store.state.map.mapDataLoadedCount': function (val) {
|
||||
this.initAutoSaveTask();
|
||||
},
|
||||
$route() {
|
||||
this.$nextTick(() => {
|
||||
this.loadInitPage();
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loadInitPage();
|
||||
this.timeDemon = setInterval(() => {
|
||||
checkLoginLine();
|
||||
}, 5000 * 60);
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.clearAutoSave();
|
||||
this.$store.dispatch('map/mapClear');
|
||||
if (this.timeDemon) {
|
||||
clearTimeout(this.timeDemon);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
endViewLoading(isSuccess) {
|
||||
if (!isSuccess) {
|
||||
this.$store.dispatch('map/mapClear');
|
||||
}
|
||||
name: 'MapView',
|
||||
components: {
|
||||
JlmapVisual,
|
||||
MapOperate,
|
||||
DataRelation,
|
||||
ConfigMap
|
||||
// MapCreate,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
viewSelect: ViewMode.MIX,
|
||||
mapSaveing: false,
|
||||
ViewMode: ViewMode,
|
||||
viewDraft: 'draft',
|
||||
autoSaveTask: null,
|
||||
selected: null,
|
||||
mapInfo: { name: this.$t('map.pleaseSelectMap') },
|
||||
timeDemon: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
cardHeight() {
|
||||
return this.$store.state.app.height - 195 - 30;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$store.state.map.mapDataLoadedCount': function (val) {
|
||||
this.initAutoSaveTask();
|
||||
},
|
||||
$route() {
|
||||
this.$nextTick(() => {
|
||||
this.loadInitPage();
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loadInitPage();
|
||||
this.timeDemon = setInterval(() => {
|
||||
checkLoginLine();
|
||||
}, 5000 * 60);
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.clearAutoSave();
|
||||
this.$store.dispatch('map/mapClear');
|
||||
if (this.timeDemon) {
|
||||
clearTimeout(this.timeDemon);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
endViewLoading(isSuccess) {
|
||||
if (!isSuccess) {
|
||||
this.$store.dispatch('map/mapClear');
|
||||
}
|
||||
|
||||
this.$nextTick(() => {
|
||||
EventBus.$emit('viewLoading', false);
|
||||
});
|
||||
},
|
||||
showMap() {
|
||||
this.$refs.configMap.doShow();
|
||||
},
|
||||
selectViewDraft(data) {
|
||||
this.viewDraft = data;
|
||||
},
|
||||
loadInitPage() {
|
||||
this.$store.dispatch('training/changeMode', { mode: TrainingMode.MAP_EDIT });
|
||||
this.mapInfo = { name: this.$t('map.pleaseSelectMap'), id: this.$route.params.mapId };
|
||||
if (parseInt(this.mapInfo.id)) {
|
||||
this.mapInfo.name = this.$route.query.name;
|
||||
getMapDetail(this.$route.params.mapId).then(response => {
|
||||
this.$store.dispatch('map/setMapData', response.data).then(resp => {
|
||||
this.$store.dispatch('training/setMapDefaultState');
|
||||
});
|
||||
this.setDelayUnlockStatus(response.data, '00');
|
||||
this.initAutoSaveTask();
|
||||
}).catch((error) => {
|
||||
console.log(error);
|
||||
this.$messageBox(this.$t('tip.failedLoadMap'));
|
||||
this.endViewLoading();
|
||||
});
|
||||
} else {
|
||||
this.endViewLoading();
|
||||
}
|
||||
},
|
||||
initAutoSaveTask() {
|
||||
const timeout = 1000 * 60 * 3;
|
||||
this.clearAutoSave(this.autoSaveTask);
|
||||
if (this.viewDraft == 'draft') {
|
||||
this.autoSaveTask = setInterval(this.saveMapEvent, timeout);
|
||||
}
|
||||
},
|
||||
clearAutoSave() {
|
||||
if (this.autoSaveTask) {
|
||||
clearInterval(this.autoSaveTask);
|
||||
this.autoSaveTask = null;
|
||||
}
|
||||
},
|
||||
handleSelectControlPage (model) {
|
||||
if (this.$refs && this.$refs.mapOperate) {
|
||||
this.$refs.mapOperate.handleSelectControlPage(model);
|
||||
this.$store.dispatch('menuOperation/setMapDrawSelectCount');
|
||||
}
|
||||
},
|
||||
handleSelectView(handle) {
|
||||
if (this.$refs && this.$refs.jlmapVisual) {
|
||||
this.$refs.jlmapVisual.setLayerVisible(handle);
|
||||
}
|
||||
},
|
||||
handleSelectLogicalView(handle) {
|
||||
if (this.$refs && this.$refs.jlmapVisual) {
|
||||
this.$refs.jlmapVisual.setLevelVisible(handle);
|
||||
}
|
||||
},
|
||||
handleSelectPhysicalView(handle) {
|
||||
if (this.$refs && this.$refs.jlmapVisual) {
|
||||
this.$refs.jlmapVisual.setLevelVisible(handle);
|
||||
}
|
||||
},
|
||||
handleSelectHybridView(handle) {
|
||||
if (this.$refs && this.$refs.jlmapVisual) {
|
||||
this.$refs.jlmapVisual.setLevelVisible(handle);
|
||||
}
|
||||
},
|
||||
clickEvent(em) {
|
||||
var device = this.getDeviceByEm(em);
|
||||
this.onSelect(device);
|
||||
if (this.$refs.dataRelation) {
|
||||
this.$refs.dataRelation.setSelected(device);
|
||||
}
|
||||
},
|
||||
// 获取设备数据
|
||||
getDeviceByEm(em) {
|
||||
var device = this.$store.getters['map/getDeviceByCode'](em.deviceCode) || null;
|
||||
if (device) {
|
||||
device._viewVal = em.val;
|
||||
}
|
||||
return device;
|
||||
},
|
||||
onSelect(device) {
|
||||
this.selected = device || null;
|
||||
this.selected && this.handleSelectControlPage(device);
|
||||
},
|
||||
onContextmenu(em) {
|
||||
this.point = {
|
||||
x: em.clientX,
|
||||
y: em.clientY
|
||||
};
|
||||
if (!em.deviceType) {
|
||||
var menu = getDeviceMenuByDeviceType('Cancel');
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
|
||||
}
|
||||
},
|
||||
saveMapEvent() {
|
||||
if (this.$refs.jlmapVisual) {
|
||||
const map = this.$store.state.map.map;
|
||||
if (map && parseInt(this.$route.params.mapId)) {
|
||||
for (const i in map.sectionList) {
|
||||
if (map.sectionList[i].points.length > 0) {
|
||||
for (let index = 0; index < map.sectionList[i].points.length; index++) {
|
||||
if (String(map.sectionList[i].points[index].x) == 'undefined' || String(map.sectionList[i].points[index].y) == 'undefined') {
|
||||
this.$messageBox(this.$t('tip.sectionPointsDeficiency'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.$messageBox(this.$t('tip.sectionPointsDeficiency'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
EventBus.$emit('viewLoading', false);
|
||||
});
|
||||
},
|
||||
showMap() {
|
||||
this.$refs.configMap.doShow();
|
||||
},
|
||||
selectViewDraft(data) {
|
||||
this.viewDraft = data;
|
||||
},
|
||||
loadInitPage() {
|
||||
this.$store.dispatch('training/changeMode', { mode: TrainingMode.MAP_EDIT });
|
||||
this.mapInfo = { name: this.$t('map.pleaseSelectMap'), id: this.$route.params.mapId };
|
||||
if (parseInt(this.mapInfo.id)) {
|
||||
this.mapInfo.name = this.$route.query.name;
|
||||
getMapDetail(this.$route.params.mapId).then(response => {
|
||||
this.$store.dispatch('map/setMapData', response.data).then(resp => {
|
||||
this.$store.dispatch('training/setMapDefaultState');
|
||||
});
|
||||
this.setDelayUnlockStatus(response.data, '00');
|
||||
this.initAutoSaveTask();
|
||||
}).catch((error) => {
|
||||
console.log(error);
|
||||
this.$messageBox(this.$t('tip.failedLoadMap'));
|
||||
this.endViewLoading();
|
||||
});
|
||||
} else {
|
||||
this.endViewLoading();
|
||||
}
|
||||
},
|
||||
initAutoSaveTask() {
|
||||
const timeout = 1000 * 60 * 3;
|
||||
this.clearAutoSave(this.autoSaveTask);
|
||||
if (this.viewDraft == 'draft') {
|
||||
this.autoSaveTask = setInterval(this.saveMapEvent, timeout);
|
||||
}
|
||||
},
|
||||
clearAutoSave() {
|
||||
if (this.autoSaveTask) {
|
||||
clearInterval(this.autoSaveTask);
|
||||
this.autoSaveTask = null;
|
||||
}
|
||||
},
|
||||
handleSelectControlPage (model) {
|
||||
if (this.$refs && this.$refs.mapOperate) {
|
||||
this.$refs.mapOperate.handleSelectControlPage(model);
|
||||
this.$store.dispatch('menuOperation/setMapDrawSelectCount');
|
||||
}
|
||||
},
|
||||
handleSelectView(handle) {
|
||||
if (this.$refs && this.$refs.jlmapVisual) {
|
||||
this.$refs.jlmapVisual.setLayerVisible(handle);
|
||||
}
|
||||
},
|
||||
handleSelectLogicalView(handle) {
|
||||
if (this.$refs && this.$refs.jlmapVisual) {
|
||||
this.$refs.jlmapVisual.setLevelVisible(handle);
|
||||
}
|
||||
},
|
||||
handleSelectPhysicalView(handle) {
|
||||
if (this.$refs && this.$refs.jlmapVisual) {
|
||||
this.$refs.jlmapVisual.setLevelVisible(handle);
|
||||
}
|
||||
},
|
||||
handleSelectHybridView(handle) {
|
||||
if (this.$refs && this.$refs.jlmapVisual) {
|
||||
this.$refs.jlmapVisual.setLevelVisible(handle);
|
||||
}
|
||||
},
|
||||
clickEvent(em) {
|
||||
var device = this.getDeviceByEm(em);
|
||||
this.onSelect(device);
|
||||
if (this.$refs.dataRelation) {
|
||||
this.$refs.dataRelation.setSelected(device);
|
||||
}
|
||||
},
|
||||
// 获取设备数据
|
||||
getDeviceByEm(em) {
|
||||
var device = this.$store.getters['map/getDeviceByCode'](em.deviceCode) || null;
|
||||
if (device) {
|
||||
device._viewVal = em.val;
|
||||
}
|
||||
return device;
|
||||
},
|
||||
onSelect(device) {
|
||||
this.selected = device || null;
|
||||
this.selected && this.handleSelectControlPage(device);
|
||||
},
|
||||
onContextmenu(em) {
|
||||
this.point = {
|
||||
x: em.clientX,
|
||||
y: em.clientY
|
||||
};
|
||||
if (!em.deviceType) {
|
||||
var menu = getDeviceMenuByDeviceType('Cancel');
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
|
||||
}
|
||||
},
|
||||
saveMapEvent() {
|
||||
if (this.$refs.jlmapVisual) {
|
||||
const map = this.$store.state.map.map;
|
||||
if (map && parseInt(this.$route.params.mapId)) {
|
||||
for (const i in map.sectionList) {
|
||||
if (map.sectionList[i].points.length > 0) {
|
||||
for (let index = 0; index < map.sectionList[i].points.length; index++) {
|
||||
if (String(map.sectionList[i].points[index].x) == 'undefined' || String(map.sectionList[i].points[index].y) == 'undefined') {
|
||||
this.$messageBox(this.$t('tip.sectionPointsDeficiency'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.$messageBox(this.$t('tip.sectionPointsDeficiency'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.mapSaveing = true;
|
||||
this.$store.dispatch('map/saveMapDeviceDefaultRelations').then(() => {
|
||||
saveMap(Object.assign(map, { mapId: this.$route.params.mapId })).then(response => {
|
||||
this.$message.success(this.$t('tip.saveSuccessfully'));
|
||||
this.mapSaveing = false;
|
||||
this.initAutoSaveTask();
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
this.$messageBox(this.$t('tip.saveFailed'));
|
||||
this.mapSaveing = false;
|
||||
if (error.code === 40004 || error.code === 40005 || error.code === 40003) {
|
||||
this.clearAutoSave();
|
||||
} else {
|
||||
this.initAutoSaveTask();
|
||||
}
|
||||
});
|
||||
}).catch(error => {
|
||||
console.log(error, '错误提示');
|
||||
this.mapSaveing = false;
|
||||
this.$messageBox(this.$t('tip.saveFailed'));
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
verifyMapEvent() {
|
||||
if (this.$refs.jlmapVisual) {
|
||||
const map = this.$store.state.map.map;
|
||||
if (map && this.$route.params.mapId) {
|
||||
verifyMap(this.$route.params.mapId).then(res => {
|
||||
if (res.data.length) {
|
||||
this.tableToExcel(res.data);
|
||||
this.$messageBox(this.$t('tip.dataValidationFailed'));
|
||||
} else {
|
||||
this.$message.success(this.$t('tip.dataValidationSuccess'));
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.requestFailed'));
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
this.mapSaveing = true;
|
||||
this.$store.dispatch('map/saveMapDeviceDefaultRelations').then(() => {
|
||||
saveMap(Object.assign(map, { mapId: this.$route.params.mapId })).then(response => {
|
||||
this.$message.success(this.$t('tip.saveSuccessfully'));
|
||||
this.mapSaveing = false;
|
||||
this.initAutoSaveTask();
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
this.$messageBox(this.$t('tip.saveFailed'));
|
||||
this.mapSaveing = false;
|
||||
if (error.code === 40004 || error.code === 40005 || error.code === 40003) {
|
||||
this.clearAutoSave();
|
||||
} else {
|
||||
this.initAutoSaveTask();
|
||||
}
|
||||
});
|
||||
}).catch(error => {
|
||||
console.log(error, '错误提示');
|
||||
this.mapSaveing = false;
|
||||
this.$messageBox(this.$t('tip.saveFailed'));
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
verifyMapEvent() {
|
||||
if (this.$refs.jlmapVisual) {
|
||||
const map = this.$store.state.map.map;
|
||||
if (map && this.$route.params.mapId) {
|
||||
verifyMap(this.$route.params.mapId).then(res => {
|
||||
if (res.data.length) {
|
||||
this.tableToExcel(res.data);
|
||||
this.$messageBox(this.$t('tip.dataValidationFailed'));
|
||||
} else {
|
||||
this.$message.success(this.$t('tip.dataValidationSuccess'));
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.requestFailed'));
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
tableToExcel(data) {
|
||||
const filterVal = ['index'];
|
||||
const arr = [];
|
||||
data.forEach(item => {
|
||||
arr.push({ index: item });
|
||||
});
|
||||
const dataList = this.formatJson(filterVal, arr);
|
||||
tableToExcel(data) {
|
||||
const filterVal = ['index'];
|
||||
const arr = [];
|
||||
data.forEach(item => {
|
||||
arr.push({ index: item });
|
||||
});
|
||||
const dataList = this.formatJson(filterVal, arr);
|
||||
import('@/utils/Export2Excel').then(excel => {
|
||||
excel.export_json_to_excel([this.$t('tip.dataQuestion')], dataList, this.$t('tip.dataList'));
|
||||
excel.export_json_to_excel([this.$t('tip.dataQuestion')], dataList, this.$t('tip.dataList'));
|
||||
});
|
||||
},
|
||||
formatJson(filterVal, jsonData) {
|
||||
return jsonData.map(v => filterVal.map(j => v[j]));
|
||||
},
|
||||
},
|
||||
formatJson(filterVal, jsonData) {
|
||||
return jsonData.map(v => filterVal.map(j => v[j]));
|
||||
},
|
||||
|
||||
setDelayUnlockStatus(data, status) {
|
||||
if (data && data.delayShowList) {
|
||||
data.delayShowList.forEach(elem => {
|
||||
elem.status = status;
|
||||
});
|
||||
}
|
||||
},
|
||||
// 增加数据数据 给vuex map对象中
|
||||
addOrUpdateMapModel(obj) {
|
||||
this.$store.dispatch('map/updateMapDevices', obj);
|
||||
},
|
||||
// 删除数据 同时del map
|
||||
delMapModel(obj) {
|
||||
this.$store.dispatch('map/deleteMapDevices', obj).then(() => {
|
||||
this.selected = null;
|
||||
});
|
||||
},
|
||||
// 设置显示中心
|
||||
setCenter(code) {
|
||||
this.$refs.jlmapVisual.setCenter(code);
|
||||
},
|
||||
createMap() {
|
||||
this.$refs.mapCreate.show();
|
||||
},
|
||||
importf() {
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在导入中...',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
setTimeout(() => {
|
||||
const obj = this.$refs.files;
|
||||
if (!obj.files) return;
|
||||
const f = obj.files[0];
|
||||
const reader = new FileReader();
|
||||
const that = this;
|
||||
reader.readAsText(f, 'utf-8');
|
||||
reader.onload = function(e) {
|
||||
const data = e.target.result;
|
||||
postBuildMapImport(JSON.parse(data)).then(res => {
|
||||
loading.close();
|
||||
that.$message.success('导入成功!');
|
||||
that.refresh();
|
||||
loading.close();
|
||||
}).catch(error => {
|
||||
loading.close();
|
||||
that.$message.error('导入失败' + error.message);
|
||||
});
|
||||
obj.value = '';
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
setDelayUnlockStatus(data, status) {
|
||||
if (data && data.delayShowList) {
|
||||
data.delayShowList.forEach(elem => {
|
||||
elem.status = status;
|
||||
});
|
||||
}
|
||||
},
|
||||
// 增加数据数据 给vuex map对象中
|
||||
addOrUpdateMapModel(obj) {
|
||||
this.$store.dispatch('map/updateMapDevices', obj);
|
||||
},
|
||||
// 删除数据 同时del map
|
||||
delMapModel(obj) {
|
||||
this.$store.dispatch('map/deleteMapDevices', obj).then(() => {
|
||||
this.selected = null;
|
||||
});
|
||||
},
|
||||
// 设置显示中心
|
||||
setCenter(code) {
|
||||
this.$refs.jlmapVisual.setCenter(code);
|
||||
},
|
||||
createMap() {
|
||||
this.$refs.mapCreate.show();
|
||||
},
|
||||
importf() {
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在导入中...',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
setTimeout(() => {
|
||||
const obj = this.$refs.files;
|
||||
if (!obj.files) return;
|
||||
const f = obj.files[0];
|
||||
const reader = new FileReader();
|
||||
const that = this;
|
||||
reader.readAsText(f, 'utf-8');
|
||||
reader.onload = function(e) {
|
||||
const data = e.target.result;
|
||||
postBuildMapImport(JSON.parse(data)).then(res => {
|
||||
loading.close();
|
||||
that.$message.success('导入成功!');
|
||||
that.refresh();
|
||||
loading.close();
|
||||
}).catch(error => {
|
||||
loading.close();
|
||||
that.$message.error('导入失败' + error.message);
|
||||
});
|
||||
obj.value = '';
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
|
@ -1,361 +0,0 @@
|
||||
<template>
|
||||
<el-card v-loading="loading" class="map-list-main">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>{{ $t('map.sketchMap') }}</span>
|
||||
<el-button type="text" style="float: right; padding: 3px 0" @click="createMap">{{ $t('map.newConstruction') }}</el-button>
|
||||
<el-button type="text" class="uploadDemo">
|
||||
<!-- <input
|
||||
ref="files"
|
||||
type="file"
|
||||
class="file_box"
|
||||
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
|
||||
@change="importf"
|
||||
> -->
|
||||
<input
|
||||
ref="files"
|
||||
type="file"
|
||||
class="file_box"
|
||||
accept=".json, application/json"
|
||||
@change="importf"
|
||||
>
|
||||
{{ $t('map.importMap') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height + 'px'}">
|
||||
<el-tree
|
||||
ref="tree"
|
||||
:data="mapList"
|
||||
node-key="id"
|
||||
highlight-current
|
||||
:props="defaultProps"
|
||||
class="tree-height-max"
|
||||
@node-click="handleNodeClick"
|
||||
@node-contextmenu="showContextMenu"
|
||||
>
|
||||
<span slot-scope="{ node }">
|
||||
<span v-if="node.data.type == 'skin'" class="el-icon-news"></span>
|
||||
<span v-if="node.data.type == 'map'" class="el-icon-edit-outline"></span>
|
||||
<span> {{ node.label }}</span>
|
||||
</span>
|
||||
</el-tree>
|
||||
</el-scrollbar>
|
||||
<map-create ref="mapCreate" :skin-code="skinCode" @refresh="refresh" @editmap="handleNodeClick" />
|
||||
<map-operate-menu
|
||||
ref="menu"
|
||||
:point="point"
|
||||
:edit-model="editModel"
|
||||
:skin-code="skinCode"
|
||||
@refresh="refresh"
|
||||
@jlmap3d="jlmap3d"
|
||||
/>
|
||||
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { DeviceMenu } from '@/scripts/ConstDic';
|
||||
import { getMapTree, getMapDetail, postBuildMapImport } from '@/api/jmap/mapdraft';
|
||||
import { UrlConfig } from '@/router/index';
|
||||
import { translate, translateSheetTitle } from '@/scripts/translate';
|
||||
// import { sheet_to_json } from '@/utils/Export2Excel';
|
||||
// import PopMenu from '@/components/PopMenu';
|
||||
import MapOperateMenu from './operateMenu';
|
||||
import MapCreate from './create';
|
||||
// import XLSX from 'xlsx';
|
||||
|
||||
export default {
|
||||
name: 'MapListDraft',
|
||||
components: {
|
||||
MapCreate,
|
||||
MapOperateMenu
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
activeName: 'first',
|
||||
mapList: [],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
},
|
||||
editModel: {},
|
||||
skinCode: '',
|
||||
point: {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
height() {
|
||||
return this.$store.state.app.height - 115;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.refresh();
|
||||
},
|
||||
methods: {
|
||||
getSkinCode(node) {
|
||||
let next = node;
|
||||
while (next) {
|
||||
if (next.data && next.data.type == 'skin') {
|
||||
this.skinCode = next.data.id;
|
||||
break;
|
||||
}
|
||||
next = next.parent;
|
||||
}
|
||||
},
|
||||
showContextMenu(e, obj, node, vueElem) {
|
||||
if (obj && obj.type == 'map') {
|
||||
e.preventDefault();
|
||||
const menu = DeviceMenu.Map;
|
||||
|
||||
this.point = {
|
||||
x: e.clientX,
|
||||
y: e.clientY
|
||||
};
|
||||
this.editModel = obj;
|
||||
this.editModel.skinCode = node.parent.data.id;
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
|
||||
}
|
||||
},
|
||||
handleNodeClick(obj, node) {
|
||||
this.getSkinCode(node);
|
||||
if (obj && obj.type == 'map') {
|
||||
this.editModel = obj;
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: null, menu: null });
|
||||
this.mapSelected({ view: 'draft' });
|
||||
}
|
||||
},
|
||||
mapSelected(data) {
|
||||
if (data && this.editModel) {
|
||||
this.$router.push({ path: `${UrlConfig.map.draft}/${this.editModel.id}/${data.view}`, query: { name: this.editModel.name } });
|
||||
}
|
||||
},
|
||||
jlmap3d() {
|
||||
this.$router.push({ path: '/jlmap3d/edit', query: { mapid: this.editModel.id } });
|
||||
},
|
||||
createMap() {
|
||||
this.$refs.mapCreate.show();
|
||||
},
|
||||
refresh() {
|
||||
this.mapList = [];
|
||||
this.loading = true;
|
||||
getMapTree().then(response => {
|
||||
this.loading = false;
|
||||
this.mapList = response.data;
|
||||
this.$refs.tree.setCurrentKey(this.$route.params.mapId); // value 绑定的node-key
|
||||
}).catch(() => {
|
||||
this.$messageBox('刷新树级列表失败');
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
|
||||
importf() {
|
||||
// const loading = this.$loading({
|
||||
// lock: true,
|
||||
// text: '正在导入中...',
|
||||
// spinner: 'el-icon-loading',
|
||||
// background: 'rgba(0, 0, 0, 0.7)'
|
||||
// });
|
||||
// const obj = this.$refs.files;
|
||||
// let wb;
|
||||
// if (!obj.files) return;
|
||||
// const f = obj.files[0];
|
||||
// const reader = new FileReader();
|
||||
// const that = this;
|
||||
// reader.onload = function (e) {
|
||||
// const data = e.target.result;
|
||||
// if (that.rABS) {
|
||||
// wb = XLSX.read(btoa(that.fixdata(data)), {// 手动转化
|
||||
// type: 'base64'
|
||||
// });
|
||||
// } else {
|
||||
// wb = XLSX.read(data, {
|
||||
// type: 'binary'
|
||||
// });
|
||||
// }
|
||||
// const resultJSONData = { 'devices': {} };
|
||||
// for (const index in wb.Sheets) {
|
||||
|
||||
// const titleNum = that.formatSheetTitle(index);
|
||||
// const key = translateSheetTitle.sheetName[titleNum];
|
||||
|
||||
// const filterVal = that.handelData(key);
|
||||
// const jsonData = sheet_to_json(wb.Sheets[index]);
|
||||
// const data = that.formatJson(filterVal, jsonData, key);
|
||||
// if (key === 'base') {
|
||||
// Object.assign(resultJSONData, data[0]);
|
||||
// } else if (key === 'skinVO') {
|
||||
// resultJSONData['devices'][key] = data[0];
|
||||
// } else {
|
||||
// resultJSONData['devices'][key] = data;
|
||||
// }
|
||||
// }
|
||||
// that.resultJSON = resultJSONData;
|
||||
// if (that.resultJSON) {
|
||||
// postBuildMapImport(that.resultJSON).then(res => {
|
||||
// loading.close();
|
||||
// that.$message.success('导入成功!');
|
||||
// that.refresh();
|
||||
// }).catch(error => {
|
||||
// loading.close();
|
||||
// that.$message.error('导入失败' + error.message);
|
||||
// });
|
||||
// }
|
||||
// obj.value = ''; // 清空上次导入文件
|
||||
// };
|
||||
// if (that.rABS) {
|
||||
// reader.readAsArrayBuffer(f);
|
||||
// } else {
|
||||
// reader.readAsBinaryString(f);
|
||||
// }
|
||||
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在导入中...',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
setTimeout(() => {
|
||||
const obj = this.$refs.files;
|
||||
if (!obj.files) return;
|
||||
const f = obj.files[0];
|
||||
const reader = new FileReader();
|
||||
const that = this;
|
||||
reader.readAsText(f, 'utf-8');
|
||||
reader.onload = function(e) {
|
||||
const data = e.target.result;
|
||||
postBuildMapImport(JSON.parse(data)).then(res => {
|
||||
loading.close();
|
||||
that.$message.success('导入成功!');
|
||||
that.refresh();
|
||||
loading.close();
|
||||
}).catch(error => {
|
||||
loading.close();
|
||||
that.$message.error('导入失败' + error.message);
|
||||
});
|
||||
obj.value = '';
|
||||
};
|
||||
});
|
||||
|
||||
},
|
||||
// 转换数据格式
|
||||
handelData(key) {
|
||||
const tHeader = [];
|
||||
const tHeaderF = [];
|
||||
if (translate[key]) {
|
||||
translate[key].columns.forEach(item => {
|
||||
tHeader.push(item.tHeader);
|
||||
tHeaderF.push(item.key);
|
||||
});
|
||||
}
|
||||
const filterVal = {
|
||||
tHeader: tHeader,
|
||||
tHeaderF: tHeaderF
|
||||
};
|
||||
return filterVal;
|
||||
},
|
||||
// 文件流转BinaryString
|
||||
fixdata(data) {
|
||||
var o = '';
|
||||
var l = 0;
|
||||
var w = 10240;
|
||||
for (; l < data.byteLength / w; ++l) o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w, l * w + w)));
|
||||
o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w)));
|
||||
return o;
|
||||
},
|
||||
// 转换属性名称 格式
|
||||
formatJson(filterVal, jsonData, key) {
|
||||
jsonData.map((item, index) => {
|
||||
const json = {};
|
||||
filterVal.tHeader.map((j, o) => {
|
||||
if (item[j] != undefined) {
|
||||
json[filterVal.tHeaderF[o]] = translate[key].columns[o].formatter(item[j]);
|
||||
}
|
||||
});
|
||||
jsonData.splice(index, 1, json);
|
||||
});
|
||||
return jsonData;
|
||||
},
|
||||
// 转换sheet名字
|
||||
formatSheetTitle(title) {
|
||||
let index;
|
||||
translateSheetTitle.sheetTitle.forEach((v, i) => {
|
||||
if (title == v) index = i;
|
||||
});
|
||||
return index;
|
||||
},
|
||||
|
||||
// 前端方式导出
|
||||
async doExportFront() {
|
||||
const res = await getMapDetail(this.$route.params.mapId);
|
||||
const resultData = res.data;
|
||||
if (resultData === false) {
|
||||
return;
|
||||
}
|
||||
const self = this;
|
||||
import('@/utils/Export2Excel').then(excel => {
|
||||
self.queryExportData(resultData).then(data => {
|
||||
excel.export_json_excel(data, resultData.name);
|
||||
}).catch(error => {
|
||||
self.$message.error('导出执行异常:' + error.message);
|
||||
});
|
||||
});
|
||||
},
|
||||
// 格式化数据列表
|
||||
queryExportData(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const result = {
|
||||
base: []
|
||||
};
|
||||
const obj = {};
|
||||
for (const i in data) {
|
||||
if (typeof data[i] != 'object') {
|
||||
obj[i] = data[i];
|
||||
} else if (data[i] instanceof Array) {
|
||||
if (data[i].length) {
|
||||
result[i] = [...data[i]];
|
||||
}
|
||||
} else if (data[i] instanceof Object) {
|
||||
obj[i] = data[i];
|
||||
}
|
||||
}
|
||||
result.base.push(obj);
|
||||
resolve(result);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped rel="stylesheet/scss" lang="scss">
|
||||
.uploadDemo {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
float: right;
|
||||
padding: 3px 0;
|
||||
margin-right: 3px;
|
||||
cursor: pointer;
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.el-tree {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
.el-card__body {
|
||||
padding: 0px;
|
||||
}
|
||||
.el-tree-node.is-current>.el-tree-node__content {
|
||||
background-color: #e4e3e3 !important;
|
||||
}
|
||||
</style>
|
@ -19,196 +19,196 @@ import MapPublish from './publish';
|
||||
import { mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
name: 'MapOperateMenu',
|
||||
components: {
|
||||
PopMenu,
|
||||
MapEdit,
|
||||
MapSaveAs,
|
||||
MapPublish
|
||||
},
|
||||
props: {
|
||||
point: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
skinCode: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
editModel: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menuMap: [
|
||||
{
|
||||
label: this.$t('map.updateObj'),
|
||||
handler: this.updateObj
|
||||
},
|
||||
// {
|
||||
// label: this.$t('map.updateObjAxis'),
|
||||
// handler: this.updateObjAxis
|
||||
// },
|
||||
{
|
||||
label: this.$t('map.saveAs'),
|
||||
handler: this.saveAs
|
||||
},
|
||||
{
|
||||
label: this.$t('map.deleteObj'),
|
||||
handler: this.deleteObj
|
||||
},
|
||||
{
|
||||
label: this.$t('map.jlmap3d'),
|
||||
handler: this.jlmap3d
|
||||
}
|
||||
],
|
||||
publishMapMenu: {
|
||||
label: this.$t('map.publish'),
|
||||
handler: this.publish
|
||||
},
|
||||
menuNormal: [],
|
||||
menu: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'stationList'
|
||||
]),
|
||||
hasRelease() {
|
||||
return this.$store.state.user.roles.includes('04') ||
|
||||
name: 'MapOperateMenu',
|
||||
components: {
|
||||
PopMenu,
|
||||
MapEdit,
|
||||
MapSaveAs,
|
||||
MapPublish
|
||||
},
|
||||
props: {
|
||||
point: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
skinCode: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
editModel: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menuMap: [
|
||||
{
|
||||
label: this.$t('map.updateObj'),
|
||||
handler: this.updateObj
|
||||
},
|
||||
// {
|
||||
// label: this.$t('map.updateObjAxis'),
|
||||
// handler: this.updateObjAxis
|
||||
// },
|
||||
{
|
||||
label: this.$t('map.saveAs'),
|
||||
handler: this.saveAs
|
||||
},
|
||||
{
|
||||
label: this.$t('map.deleteObj'),
|
||||
handler: this.deleteObj
|
||||
},
|
||||
{
|
||||
label: this.$t('map.jlmap3d'),
|
||||
handler: this.jlmap3d
|
||||
}
|
||||
],
|
||||
publishMapMenu: {
|
||||
label: this.$t('map.publish'),
|
||||
handler: this.publish
|
||||
},
|
||||
menuNormal: [],
|
||||
menu: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'stationList'
|
||||
]),
|
||||
hasRelease() {
|
||||
return this.$store.state.user.roles.includes('04') ||
|
||||
this.$store.state.user.roles.includes('05');
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$store.state.menuOperation.menuCount': function (val) {
|
||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Map)) {
|
||||
this.menu = [...this.menuMap];
|
||||
if (this.hasRelease) {
|
||||
this.menu.push(this.publishMapMenu);
|
||||
}
|
||||
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||
} else if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Cancel)) {
|
||||
this.initCancelMenu();
|
||||
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||
} else {
|
||||
this.doClose();
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.closeEvent();
|
||||
},
|
||||
methods: {
|
||||
closeEvent() {
|
||||
const self = this;
|
||||
window.onclick = function (e) {
|
||||
self.doClose();
|
||||
};
|
||||
},
|
||||
doShow(point) {
|
||||
this.closeEvent();
|
||||
if (this.$refs && this.$refs.popMenu) {
|
||||
this.$refs.popMenu.resetShowPosition(point);
|
||||
}
|
||||
},
|
||||
doClose() {
|
||||
if (this.$refs && this.$refs.popMenu) {
|
||||
this.$refs.popMenu.close();
|
||||
}
|
||||
},
|
||||
updateObj() {
|
||||
this.doClose();
|
||||
if (this.$refs && this.$refs.edit) {
|
||||
this.$refs.edit.show('editCode');
|
||||
}
|
||||
},
|
||||
updateObjAxis() {
|
||||
this.doClose();
|
||||
if (this.$refs && this.$refs.axisEdit) {
|
||||
this.$refs.axisEdit.show('editPoint');
|
||||
}
|
||||
},
|
||||
saveAs() {
|
||||
this.doClose();
|
||||
if (this.$refs && this.$refs.saveAs) {
|
||||
this.$refs.saveAs.show();
|
||||
}
|
||||
},
|
||||
publish() {
|
||||
this.doClose();
|
||||
if (this.$refs && this.$refs.publish) {
|
||||
this.$refs.publish.show();
|
||||
}
|
||||
},
|
||||
deleteObj() {
|
||||
this.doClose();
|
||||
const _that = this;
|
||||
this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), {
|
||||
confirmButtonText: this.$t('map.confirm'),
|
||||
cancelButtonText: this.$t('map.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteMap(this.editModel.id).then(response => {
|
||||
if (this.editModel.id == this.$route.params.mapId) {
|
||||
this.$store.dispatch('map/mapClear').then(() => {
|
||||
_that.$emit('editMap', null);
|
||||
// _that.$router.push({ path: `${UrlConfig.map.draft}/0/draft` });
|
||||
_that.$router.push({ path: `${UrlConfig.designUser.prefix}` });
|
||||
});
|
||||
}
|
||||
_that.refresh();
|
||||
_that.$message.success(this.$t('map.successfullyDelete'));
|
||||
}).catch(error => {
|
||||
_that.$message.error(this.$t('map.failDelete') + error.message);
|
||||
});
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
jlmap3d() {
|
||||
this.$emit('jlmap3d');
|
||||
},
|
||||
refresh() {
|
||||
this.$emit('refresh');
|
||||
},
|
||||
initCancelMenu() {
|
||||
this.menuNormal = [];
|
||||
this.stationList.forEach(station => {
|
||||
if (station.code === station.concentrateStationCode) {
|
||||
const node = {
|
||||
label: station.name,
|
||||
children: []
|
||||
};
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$store.state.menuOperation.menuCount': function (val) {
|
||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Map)) {
|
||||
this.menu = [...this.menuMap];
|
||||
if (this.hasRelease) {
|
||||
this.menu.push(this.publishMapMenu);
|
||||
}
|
||||
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||
} else if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Cancel)) {
|
||||
this.initCancelMenu();
|
||||
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||
} else {
|
||||
this.doClose();
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.closeEvent();
|
||||
},
|
||||
methods: {
|
||||
closeEvent() {
|
||||
const self = this;
|
||||
window.onclick = function (e) {
|
||||
self.doClose();
|
||||
};
|
||||
},
|
||||
doShow(point) {
|
||||
this.closeEvent();
|
||||
if (this.$refs && this.$refs.popMenu) {
|
||||
this.$refs.popMenu.resetShowPosition(point);
|
||||
}
|
||||
},
|
||||
doClose() {
|
||||
if (this.$refs && this.$refs.popMenu) {
|
||||
this.$refs.popMenu.close();
|
||||
}
|
||||
},
|
||||
updateObj() {
|
||||
this.doClose();
|
||||
if (this.$refs && this.$refs.edit) {
|
||||
this.$refs.edit.show('editCode');
|
||||
}
|
||||
},
|
||||
updateObjAxis() {
|
||||
this.doClose();
|
||||
if (this.$refs && this.$refs.axisEdit) {
|
||||
this.$refs.axisEdit.show('editPoint');
|
||||
}
|
||||
},
|
||||
saveAs() {
|
||||
this.doClose();
|
||||
if (this.$refs && this.$refs.saveAs) {
|
||||
this.$refs.saveAs.show();
|
||||
}
|
||||
},
|
||||
publish() {
|
||||
this.doClose();
|
||||
if (this.$refs && this.$refs.publish) {
|
||||
this.$refs.publish.show();
|
||||
}
|
||||
},
|
||||
deleteObj() {
|
||||
this.doClose();
|
||||
const _that = this;
|
||||
this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), {
|
||||
confirmButtonText: this.$t('map.confirm'),
|
||||
cancelButtonText: this.$t('map.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteMap(this.editModel.id).then(response => {
|
||||
if (this.editModel.id == this.$route.params.mapId) {
|
||||
this.$store.dispatch('map/mapClear').then(() => {
|
||||
_that.$emit('editMap', null);
|
||||
// _that.$router.push({ path: `${UrlConfig.map.draft}/0/draft` });
|
||||
_that.$router.push({ path: `${UrlConfig.designUser.prefix}` });
|
||||
});
|
||||
}
|
||||
_that.refresh();
|
||||
_that.$message.success(this.$t('map.successfullyDelete'));
|
||||
}).catch(error => {
|
||||
_that.$message.error(this.$t('map.failDelete') + error.message);
|
||||
});
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
jlmap3d() {
|
||||
this.$emit('jlmap3d');
|
||||
},
|
||||
refresh() {
|
||||
this.$emit('refresh');
|
||||
},
|
||||
initCancelMenu() {
|
||||
this.menuNormal = [];
|
||||
this.stationList.forEach(station => {
|
||||
if (station.code === station.concentrateStationCode) {
|
||||
const node = {
|
||||
label: station.name,
|
||||
children: []
|
||||
};
|
||||
|
||||
this.stationList.forEach(elem => {
|
||||
if (elem.visible) {
|
||||
let next = elem;
|
||||
while (next.code != next.concentrateStationCode || !next.concentrateStationCode) {
|
||||
next = this.$store.getters['map/getDeviceByCode'](next.concentrateStationCode);
|
||||
}
|
||||
this.stationList.forEach(elem => {
|
||||
if (elem.visible) {
|
||||
let next = elem;
|
||||
while (next.code != next.concentrateStationCode || !next.concentrateStationCode) {
|
||||
next = this.$store.getters['map/getDeviceByCode'](next.concentrateStationCode);
|
||||
}
|
||||
|
||||
if (station.code == next.code) {
|
||||
node.children.push({
|
||||
code: elem.code,
|
||||
label: elem.name,
|
||||
handler: this.mapLocation
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
if (station.code == next.code) {
|
||||
node.children.push({
|
||||
code: elem.code,
|
||||
label: elem.name,
|
||||
handler: this.mapLocation
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.menuNormal.push(node);
|
||||
}
|
||||
});
|
||||
this.menu = [...this.menuNormal];
|
||||
},
|
||||
mapLocation(item) {
|
||||
if (item) {
|
||||
this.doClose();
|
||||
this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: item.code });
|
||||
}
|
||||
}
|
||||
}
|
||||
this.menuNormal.push(node);
|
||||
}
|
||||
});
|
||||
this.menu = [...this.menuNormal];
|
||||
},
|
||||
mapLocation(item) {
|
||||
if (item) {
|
||||
this.doClose();
|
||||
this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: item.code });
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -1,312 +0,0 @@
|
||||
<template>
|
||||
<div v-loading="loading" class="card-box">
|
||||
<el-steps class="steps" :active="display">
|
||||
<el-step :title="title" icon="el-icon-edit-outline" />
|
||||
<el-step title="" icon="el-icon-upload" />
|
||||
</el-steps>
|
||||
<el-card class="forms">
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height:height -120 + 'px'}" style="padding-top: 40px">
|
||||
<el-form ref="form" :model="addModel" label-width="140px">
|
||||
<el-form-item :label="$t('map.skinStyleColon')" prop="mapName">
|
||||
<el-input v-model="addModel.mapName" :disabled="true" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('map.productType') + ':'" prop="prdType">
|
||||
<el-radio-group v-model="addModel.prdType" :disabled="isUpdate">
|
||||
<template v-for="item in chooseList">
|
||||
<el-radio-button :key="item.code" :label="item.code">{{ item.name }}</el-radio-button>
|
||||
</template>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('map.productCode') + ':'"
|
||||
prop="code"
|
||||
:rules="node && node.data.type ==='skin' ? baseRules.code:{}"
|
||||
>
|
||||
<el-input v-model="addModel.code" :disabled="codeDisabled" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('map.productName') + ':'" prop="name" :rules="baseRules.name">
|
||||
<el-input v-model="addModel.name" />
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="isShowTrainTypes"
|
||||
:label="$t('map.associateTrainingTypes') + ':'"
|
||||
prop="trainTypes"
|
||||
:rules="baseRules.trainTypes"
|
||||
>
|
||||
<el-select v-model="addModel.trainTypes" multiple :placeholder="$t('map.pleaseSelect')" @change="trainTypesChange">
|
||||
<el-option
|
||||
v-for="item in trainTypesList"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('map.productDescription') + ':'" prop="remarks" :rules="baseRules.remarks">
|
||||
<el-input v-model="addModel.remarks" type="textarea" :rows="4" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-scrollbar>
|
||||
</el-card>
|
||||
<div class="draft">
|
||||
<el-button-group>
|
||||
<el-button v-if="isCreate" type="primary" @click="create">{{ $t('map.create') }}</el-button>
|
||||
<el-button v-if="isUpdate" type="primary" @click="update">{{ $t('map.updata') }}</el-button>
|
||||
<el-button v-if="isDelete" type="danger" @click="deleteObj">{{ $t('map.deleteObj') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createTrainingCategory, updateTrainingCategory, getProductDetail, deleteTrainingCategory, checkMapProductCodeExist } from '@/api/management/mapprd';
|
||||
|
||||
export default {
|
||||
name: 'ShowDetail',
|
||||
props: {
|
||||
height: {
|
||||
type: Number,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
node: null,
|
||||
display: 1,
|
||||
codeDisabled: true,
|
||||
rules: {},
|
||||
trainTypesList: [],
|
||||
initTrainTypes: [],
|
||||
chooseList: [],
|
||||
addModel: {
|
||||
id: '',
|
||||
mapId: '',
|
||||
mapName: '',
|
||||
skinCode: '',
|
||||
name: '',
|
||||
remarks: '',
|
||||
code: '',
|
||||
prdType: '01',
|
||||
trainTypes: []
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
title() {
|
||||
if (this.node && this.node.data) {
|
||||
if (this.node.data.type === 'Skin') {
|
||||
return this.$t('map.createProductCategories');
|
||||
} else if (this.node.data.type === 'Prd' ||
|
||||
this.node.data.type === 'Prd') {
|
||||
return this.$t('map.editTraining');
|
||||
}
|
||||
}
|
||||
return this.$t('map.selectOperation');
|
||||
},
|
||||
isCreate() {
|
||||
return this.node && this.node.data.type === 'Skin';
|
||||
},
|
||||
isUpdate() {
|
||||
return this.node && this.node.data.type === 'Prd';
|
||||
},
|
||||
isDelete() {
|
||||
return this.node && this.node.data.type === 'Prd';
|
||||
},
|
||||
isShowTrainTypes() {
|
||||
return this.addModel.prdType != '03' && this.addModel.prdType != '04';
|
||||
},
|
||||
baseRules() {
|
||||
return {
|
||||
code: [
|
||||
{ required: true, message: this.$t('rules.productCodeEnter'), trigger: 'change' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: this.$t('rules.productNameEnter'), trigger: 'change' }
|
||||
],
|
||||
remarks: [
|
||||
{ required: true, message: this.$t('rules.productDescriptionEnter'), trigger: 'change' }
|
||||
],
|
||||
trainTypes: [
|
||||
{ required: true, message: this.$t('rules.trainingTypeSelect'), trigger: 'change' }
|
||||
]
|
||||
};
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$Dictionary.trainingType().then(list => {
|
||||
this.trainTypesList = list;
|
||||
});
|
||||
this.$Dictionary.productPostType().then(list => {
|
||||
this.chooseList = list;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
loadData(node) {
|
||||
if (node) {
|
||||
// 清除数据
|
||||
this.node = node;
|
||||
this.initTrainTypes = [];
|
||||
this.$refs.form.resetFields();
|
||||
this.loading = true;
|
||||
if (node.data.type === 'Skin') {
|
||||
this.codeDisabled = false;
|
||||
this.addModel.mapName = node.data.name;
|
||||
this.addModel.skinCode = node.data.id;
|
||||
this.loading = false;
|
||||
} else if (node.data.type === 'Prd') {
|
||||
this.codeDisabled = true;
|
||||
getProductDetail(node.data.id).then(response => {
|
||||
this.addModel.mapName = node.parent.data.name;
|
||||
this.addModel.mapId = node.parent.data.id;
|
||||
this.addModel.name = response.data.name;
|
||||
this.addModel.remarks = response.data.remarks;
|
||||
this.addModel.prdType = response.data.prdType;
|
||||
this.addModel.code = response.data.code;
|
||||
this.addModel.skinCode = response.data.skinCode;
|
||||
this.addModel.trainTypes = this.initTrainTypes = response.data.trainTypes;
|
||||
this.addModel.id = response.data.id;
|
||||
this.loading = false;
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
} else {
|
||||
this.addModel.prdType = '01';
|
||||
this.loading = false;
|
||||
}
|
||||
|
||||
// 清除表单验证提示信息
|
||||
this.$nextTick(function () {
|
||||
this.$refs.form.clearValidate();
|
||||
});
|
||||
}
|
||||
},
|
||||
create() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
skinCode: this.addModel.skinCode,
|
||||
mapName: this.addModel.mapName,
|
||||
name: this.addModel.name,
|
||||
remarks: this.addModel.remarks,
|
||||
prdType: this.addModel.prdType,
|
||||
code: this.addModel.code,
|
||||
trainTypes: this.isShowTrainTypes ? this.addModel.trainTypes : []
|
||||
};
|
||||
checkMapProductCodeExist({ code: this.addModel.code }).then(response => {
|
||||
if (!response.data) {
|
||||
createTrainingCategory(data).then(response => {
|
||||
this.initTrainTypes = this.addModel.trainTypes;
|
||||
this.$emit('refresh');
|
||||
this.$message.success(this.$t('tip.productCreationSuccessfully'));
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.productCreationFailed'));
|
||||
});
|
||||
} else {
|
||||
this.$messageBox(this.$t('tip.productCodeExists'));
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.productCodeExists'));
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
update() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.addModel.trainTypes = this.isShowTrainTypes ? this.addModel.trainTypes : [];
|
||||
updateTrainingCategory(this.addModel).then(response => {
|
||||
this.initTrainTypes = this.addModel.trainTypes;
|
||||
this.$message.success(this.$t('tip.updateProductSuccessfully'));
|
||||
this.$emit('refresh');
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.updateProductFailed'));
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
trainTypesChange(tag) {
|
||||
if (this.initTrainTypes && this.initTrainTypes.length > 0) {
|
||||
this.initTrainTypes.forEach(elem => {
|
||||
if (this.addModel.trainTypes.indexOf(elem) < 0) {
|
||||
this.addModel.trainTypes = this.initTrainTypes;
|
||||
this.$messageBox(this.$t('tip.narrowScope'));
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
deleteObj() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
deleteTrainingCategory(this.addModel).then(response => {
|
||||
this.$message.success(this.$t('tip.deleteProductSuccessfully'));
|
||||
this.$refs.form.resetFields();
|
||||
this.node = null;
|
||||
this.$emit('refresh');
|
||||
}).catch(error => {
|
||||
if (error.code === 500009) {
|
||||
this.$messageBox(this.$t('tip.cannotDeleteProduct'));
|
||||
} else {
|
||||
this.$messageBox(this.$t('tip.deleteProductFailed'));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
@import "src/styles/mixin.scss";
|
||||
|
||||
.card-box {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.steps {
|
||||
width: 980px;
|
||||
margin: 0 auto;
|
||||
padding-top: 20px;
|
||||
height: 100%;
|
||||
|
||||
/deep/ {
|
||||
.el-step__icon.is-icon {
|
||||
width: 95px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.forms {
|
||||
width: 800px;
|
||||
margin: 0 auto;
|
||||
margin-top: 20px;
|
||||
|
||||
/deep/ {
|
||||
.el-select {
|
||||
float: left;
|
||||
width: calc(600px);
|
||||
}
|
||||
|
||||
.el-textarea {
|
||||
float: left;
|
||||
width: calc(600px);
|
||||
}
|
||||
|
||||
.el-form-item__content>.el-input {
|
||||
float: left;
|
||||
width: calc(600px);
|
||||
}
|
||||
|
||||
.el-input-number {
|
||||
float: left;
|
||||
width: calc(250px);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.draft {
|
||||
width: 300px;
|
||||
text-align: center;
|
||||
margin: 20px auto;
|
||||
}
|
||||
</style>
|
@ -1,59 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="training-tree">
|
||||
<training-tree-operate ref="trainingTree" :height="height" @loadData="loadData" />
|
||||
</div>
|
||||
<div class="training-draft" :style="{width: width +'px'}">
|
||||
<edit-detail-operate ref="training" :height="height" @refresh="refresh" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TrainingTreeOperate from './tree';
|
||||
import EditDetailOperate from './edit';
|
||||
|
||||
export default {
|
||||
name: 'TrainingEditOperate',
|
||||
components: {
|
||||
EditDetailOperate,
|
||||
TrainingTreeOperate
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
width() {
|
||||
return this.$store.state.app.width - 420;
|
||||
},
|
||||
height() {
|
||||
return this.$store.state.app.height -150;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadData(node) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.training.loadData(node);
|
||||
});
|
||||
},
|
||||
refresh() {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.trainingTree.refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
@import "src/styles/mixin.scss";
|
||||
|
||||
.training-tree {
|
||||
float: left;
|
||||
width: 420px;
|
||||
}
|
||||
|
||||
.training-draft {
|
||||
float: left;
|
||||
}
|
||||
</style>
|
@ -1,119 +0,0 @@
|
||||
<template>
|
||||
<el-card v-loading="loading" class="map-list-main">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>{{ $t('map.productCategories') }}</span>
|
||||
</div>
|
||||
<el-input v-model="filterText" :placeholder="$t('tip.enterKeywordsFiltering')" clearable />
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: height +'px' }">
|
||||
<el-tree
|
||||
ref="trainingTree"
|
||||
:data="treeData"
|
||||
:filter-node-method="filterNode"
|
||||
:lazy="false"
|
||||
:props="defaultProps"
|
||||
class="tree-height-max"
|
||||
expand-on-click-node
|
||||
highlight-current
|
||||
@node-click="clickEvent"
|
||||
>
|
||||
<span slot-scope="{ node }">
|
||||
<span v-if="node.data.type == 'skin'" class="el-icon-news" />
|
||||
<span v-if="node.data.type == 'prd'" class="el-icon-tickets" />
|
||||
<span v-if="node.data.type == 'trainingType'" class="el-icon-document" />
|
||||
<span v-if="node.data.type == 'trainingType'" class="el-icon-edit" />
|
||||
<span> {{ node.label }}</span>
|
||||
</span>
|
||||
</el-tree>
|
||||
</el-scrollbar>
|
||||
</el-card>
|
||||
</template>
|
||||
<script>
|
||||
import { getProductTree } from '@/api/management/mapprd';
|
||||
|
||||
export default {
|
||||
name: 'TreeOperate',
|
||||
props: {
|
||||
height: {
|
||||
type: Number,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
},
|
||||
filterText: '',
|
||||
treeData: [],
|
||||
node: {},
|
||||
point: {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
filterText(val) {
|
||||
this.$refs.trainingTree.filter(val);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.refresh();
|
||||
},
|
||||
methods: {
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.name.indexOf(value) !== -1;
|
||||
},
|
||||
showContextMenu(e, obj, node, vueElem) {
|
||||
e.preventDefault();
|
||||
this.point = {
|
||||
x: e.clientX,
|
||||
y: e.clientY
|
||||
};
|
||||
if (obj) {
|
||||
this.node = node;
|
||||
this.$refs.menu.show();
|
||||
}
|
||||
},
|
||||
clickEvent(obj, node, data) {
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: null, menu: null });
|
||||
this.$emit('loadData', node);
|
||||
},
|
||||
convertTreeData(list) {
|
||||
const tree = [];
|
||||
if (list && list.length) {
|
||||
/* 去除列表的training节点*/
|
||||
list.forEach(elem => {
|
||||
elem.children = this.convertTreeData(elem.children);
|
||||
if (elem.type !== 'TrainingType') {
|
||||
tree.push(elem);
|
||||
}
|
||||
});
|
||||
}
|
||||
return tree;
|
||||
},
|
||||
refresh() {
|
||||
getProductTree().then(response => {
|
||||
this.treeData = this.convertTreeData(response.data);
|
||||
this.$nextTick(() => { this.loading = false; });
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.refreshFailure'));
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.el-tree {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.el-tree-node.is-current>.el-tree-node__content {
|
||||
background-color: #e4e3e3 !important;
|
||||
}
|
||||
</style>
|
@ -1,84 +0,0 @@
|
||||
<template>
|
||||
<el-dialog v-dialogDrag :title="this.$t('map.setupOperationGraph')" :visible.sync="dialogShow" width="600px" :before-close="doClose" append-to-body>
|
||||
<el-form ref="form" :model="formModel" label-width="160px" size="mini" :rules="rules">
|
||||
<el-form-item :label="this.$t('map.selectOperationGraphDataRange')+':'" prop="timeArea">
|
||||
<el-time-picker
|
||||
v-model="formModel.timeArea"
|
||||
is-range
|
||||
range-separator="this.$t('map.to')"
|
||||
start-placeholder="this.$t('global.startTime')"
|
||||
end-placeholder="this.$t('global.endTime')"
|
||||
placeholder="this.$t('map.selectionTimeRange')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogShow = false">{{ $t('global.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="handle">{{ $t(global.confirm) }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'ChartSetting',
|
||||
data() {
|
||||
return {
|
||||
dialogShow: false,
|
||||
intervalList: [
|
||||
{ code: '01', value: this.$t('map.pointSystem1') },
|
||||
{ code: '02', value: this.$t('map.pointSystem2') },
|
||||
{ code: '05', value: this.$t('map.pointSystem5') }
|
||||
],
|
||||
formModel: {
|
||||
timeArea: [new Date(2018, 10, 1), new Date(2018, 10, 1)]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
rules() {
|
||||
return {
|
||||
timeArea: [
|
||||
{ required: true, message: this.$t('rules.selectDataRange'), trigger: 'change' }
|
||||
]
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doShow() {
|
||||
this.dialogShow = true;
|
||||
},
|
||||
doClose() {
|
||||
this.dialogShow = false;
|
||||
},
|
||||
handle() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
const baseDate = new Date(2018, 10, 1);
|
||||
const model = {
|
||||
startValue: this.formModel.timeArea[0].valueOf() - baseDate.valueOf(),
|
||||
endValue: this.formModel.timeArea[1].valueOf() - baseDate.valueOf(),
|
||||
intervalLevel: parseFloat('01')
|
||||
};
|
||||
this.$emit('settingExac', model);
|
||||
this.doClose();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
@import "src/styles/mixin.scss";
|
||||
|
||||
.dialog {
|
||||
border-color: black;
|
||||
border-style: solid;
|
||||
border-top-width: 2px;
|
||||
border-right-width: 2px;
|
||||
border-bottom-width: 2px;
|
||||
border-left-width: 2px;
|
||||
}
|
||||
</style>
|
@ -1,70 +0,0 @@
|
||||
<template>
|
||||
<div class="main">
|
||||
<div class="list" :style="{width: widthLeft+'px'}">
|
||||
<chart-list ref="list" :height="height" />
|
||||
</div>
|
||||
<drap-left :width-left="widthLeft" @drapWidth="drapWidth" />
|
||||
<transition>
|
||||
<router-view style="float: right;" :style="{width: width+'px'}" />
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DrapLeft from '@/views/components/drapLeft/index';
|
||||
import ChartList from './manage/list';
|
||||
|
||||
export default {
|
||||
name: 'RunPlan',
|
||||
components: {
|
||||
DrapLeft,
|
||||
ChartList
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
widthLeft: 320
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
width() {
|
||||
return this.$store.state.app.width - this.widthLeft;
|
||||
},
|
||||
height() {
|
||||
return this.$store.state.app.height;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
widthLeft(val) {
|
||||
this.setRunPlanResize(val);
|
||||
},
|
||||
'$store.state.app.windowSizeCount': function() {
|
||||
this.setRunPlanResize(this.widthLeft);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.setRunPlanResize();
|
||||
},
|
||||
methods: {
|
||||
drapWidth(width) {
|
||||
this.widthLeft = Number(width);
|
||||
},
|
||||
setRunPlanResize(LeftWidth) {
|
||||
this.$nextTick(() => {
|
||||
this.$store.dispatch('runPlan/resize', { width: this.width, height: this.height - 60 });
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
@import "src/styles/mixin.scss";
|
||||
|
||||
.main {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.list {
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -1,68 +0,0 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-dialogDrag
|
||||
:title="title"
|
||||
:visible.sync="dialogShow"
|
||||
:width="width + 'px'"
|
||||
:before-close="doClose"
|
||||
:z-index="2000"
|
||||
:modal="false"
|
||||
:close-on-click-modal="false"
|
||||
append-to-body
|
||||
>
|
||||
<el-row>
|
||||
<el-input v-model="context" type="textarea" :rows="10" readonly />
|
||||
</el-row>
|
||||
<el-row type="flex" justify="center" class="button-group">
|
||||
<el-button @click="handleCommit">{{ $t('global.confirm') }}</el-button>
|
||||
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
|
||||
</el-row>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'ValidityCheck',
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogShow: false,
|
||||
loading: false,
|
||||
params: {
|
||||
contextList: []
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
title() {
|
||||
return this.$t('map.validityCheck');
|
||||
},
|
||||
width() {
|
||||
return 800;
|
||||
},
|
||||
context() {
|
||||
return this.params.contextList.join('\n');
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
doShow(params) {
|
||||
this.params = params || {};
|
||||
this.dialogShow = true;
|
||||
},
|
||||
doClose() {
|
||||
this.loading = false;
|
||||
this.dialogShow = false;
|
||||
},
|
||||
handleCommit() {
|
||||
this.doClose();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
@import "src/styles/mixin.scss";
|
||||
</style>
|
@ -1,351 +0,0 @@
|
||||
<template>
|
||||
<el-dialog v-dialogDrag :title="this.$t('map.createNewOperationGraph')+selected.name" :visible.sync="dialogShow" width="600px" :before-close="close">
|
||||
<el-steps :active="active" finish-status="success" simple>
|
||||
<el-step :title="this.$t('map.setOperatingSpeed')" icon="el-icon-edit" />
|
||||
<el-step :title="this.$t('map.createOperationGraph')" icon="el-icon-upload" />
|
||||
</el-steps>
|
||||
<el-card shadow="never" style="margin-top: 10px">
|
||||
<div v-show="isSpeed">
|
||||
<el-form
|
||||
ref="speed"
|
||||
label-position="right"
|
||||
:model="levelModel"
|
||||
label-width="130px"
|
||||
size="mini"
|
||||
style="margin-top: 20px;"
|
||||
:rules="levelRules"
|
||||
>
|
||||
<!-- <el-form-item label="皮肤类型:" prop="skinCode">
|
||||
<el-select v-model="levelModel.skinCode" :disabled="true">
|
||||
<el-option v-for="item in SkinCodeList" :key="item.code" :label="item.code"
|
||||
:value="item.code"></el-option>
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item :label="this.$t('map.speedClass1')+':'" prop="level1">
|
||||
<el-input-number v-model="levelModel.level1" :disabled="disabled" :min="1" />
|
||||
<span>km/h</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('map.speedClass2')+':'" prop="level2">
|
||||
<el-input-number v-model="levelModel.level2" :disabled="disabled" :min="1" />
|
||||
<span>km/h</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('map.speedClass3')+':'" prop="level3">
|
||||
<el-input-number v-model="levelModel.level3" :disabled="disabled" :min="1" />
|
||||
<span>km/h</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('map.speedClass4')+':'" prop="level4">
|
||||
<el-input-number v-model="levelModel.level4" :disabled="disabled" :min="1" />
|
||||
<span>km/h</span>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div v-show="isChart">
|
||||
<el-form
|
||||
ref="chart"
|
||||
label-position="right"
|
||||
:model="chartModel"
|
||||
label-width="130px"
|
||||
size="mini"
|
||||
style="margin-top: 20px;"
|
||||
:rules="chartRules"
|
||||
>
|
||||
<el-form-item :label="this.$t('map.name')+':'" prop="name">
|
||||
<el-input v-model="chartModel.name" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('map.startingRunningDirection')+':'" prop="direct">
|
||||
<el-select v-model="chartModel.direct" :placeholder="this.$t('map.pleaseSelect')">
|
||||
<el-option
|
||||
v-for="option in RunDirectionTypeList"
|
||||
:key="option.code"
|
||||
:label="option.name"
|
||||
:value="option.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('map.timeBetweenDepartures')+':'" prop="timeInterval">
|
||||
<el-input-number v-model="chartModel.timeInterval" :min="0" />s
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('global.startTime')+':'" prop="startTime">
|
||||
<el-time-picker v-model="chartModel.startTime" value-format="HH:mm:ss" :placeholder="this.$t('global.startTime')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('global.endTime')+':'" prop="endTime">
|
||||
<el-time-picker v-model="chartModel.endTime" value-format="HH:mm:ss" :placeholder="this.$t('global.endTime')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('map.stopTime')+':'" prop="parkingTime">
|
||||
<el-input-number v-model="chartModel.parkingTime" :min="0" />s
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('map.entranceStation')+':'" prop="entrance">
|
||||
<el-select v-model="chartModel.entrance" :placeholder="this.$t('map.pleaseSelect')">
|
||||
<el-option
|
||||
v-for="option in stationList"
|
||||
:key="option.code"
|
||||
:label="option.name"
|
||||
:value="option.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('map.exportStation')+':'" prop="exit">
|
||||
<el-select v-model="chartModel.exit" :placeholder="this.$t('map.pleaseSelect')">
|
||||
<el-option
|
||||
v-for="option in stationList"
|
||||
:key="option.code"
|
||||
:label="option.name"
|
||||
:value="option.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-card>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" :disabled="isSpeed" @click="back"><span>{{ $t('global.previousStep') }}</span></el-button>
|
||||
<el-button type="primary" :loading="loading" @click="next">
|
||||
<span v-if="isSpeed && disabled">{{ $t('global.skip') }}</span>
|
||||
<span v-if="isSpeed && !disabled">{{ $t('global.create') }}</span>
|
||||
<span v-if="isChart">{{ $t('global.confirm') }}</span>
|
||||
</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { getStationListBySkinCode, getSpeedLevels, newSpeedLevels, newRunPlan } from '@/api/runplan';
|
||||
import { getSkinCodeList } from '@/api/management/mapskin';
|
||||
|
||||
export default {
|
||||
name: 'ChartCreate',
|
||||
props: {
|
||||
selected: {
|
||||
type: Object,
|
||||
default: function () {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogShow: false,
|
||||
loading: false,
|
||||
disabled: false,
|
||||
active: 0,
|
||||
stationList: [],
|
||||
RunDirectionTypeList: [],
|
||||
SkinCodeList: [],
|
||||
levelModel: {
|
||||
skinCode: '',
|
||||
level1: '',
|
||||
level2: '',
|
||||
level3: '',
|
||||
level4: ''
|
||||
},
|
||||
chartModel: {
|
||||
skinCode: '',
|
||||
name: '',
|
||||
direct: '',
|
||||
timeInterval: '',
|
||||
startTime: '06:00:00',
|
||||
endTime: '18:00:00',
|
||||
parkingTime: 0,
|
||||
entrance: '',
|
||||
exit: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('runPlan', [
|
||||
'stations'
|
||||
]),
|
||||
isSpeed() {
|
||||
return this.active <= 0;
|
||||
},
|
||||
isChart() {
|
||||
return this.active >= 1;
|
||||
},
|
||||
levelRules() {
|
||||
return {
|
||||
level1: [
|
||||
{ required: true, message: this.$t('rules.speedLevelEnter1'), trigger: 'change' }
|
||||
],
|
||||
level2: [
|
||||
{ required: true, message: this.$t('rules.speedLevelEnter2'), trigger: 'change' }
|
||||
],
|
||||
level3: [
|
||||
{ required: true, message: this.$t('rules.speedLevelEnter3'), trigger: 'change' }
|
||||
],
|
||||
level4: [
|
||||
{ required: true, message: this.$t('rules.speedLevelEnter4'), trigger: 'change' }
|
||||
]
|
||||
};
|
||||
},
|
||||
chartRules() {
|
||||
return {
|
||||
name: [
|
||||
{ required: true, message: this.$t('rules.pleaseInputName'), trigger: 'blur' }
|
||||
],
|
||||
direct: [
|
||||
{ required: true, message: this.$t('rules.drivingDirectionSelect'), trigger: 'change' }
|
||||
],
|
||||
timeInterval: [
|
||||
{ required: true, message: this.$t('rules.timeBetweenDeparturesEnter'), trigger: 'blur' }
|
||||
],
|
||||
startTime: [
|
||||
{ required: true, message: this.$t('global.enterStartTime'), trigger: 'blur' }
|
||||
],
|
||||
endTime: [
|
||||
{ required: true, message: this.$t('global.enterEndTime'), trigger: 'blur' }
|
||||
],
|
||||
parkingTime: [
|
||||
{ required: true, message: this.$t('rules.stopTimeEnter'), trigger: 'blur' }
|
||||
],
|
||||
entrance: [
|
||||
{ required: true, message: this.$t('rules.entranceStationSelect'), trigger: 'change' }
|
||||
],
|
||||
exit: [
|
||||
{ required: true, message: this.$t('rules.exportStationSelect'), trigger: 'change' }
|
||||
]
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initLoadData() {
|
||||
this.active = 0;
|
||||
this.disabled = false;
|
||||
this.querySpeedLevelData();
|
||||
this.$Dictionary.runDirectionType().then(list => {
|
||||
this.RunDirectionTypeList = list.filter(it => { return it.code !== '03'; });
|
||||
});
|
||||
|
||||
this.SkinCodeList = [];
|
||||
getSkinCodeList().then(response => {
|
||||
this.SkinCodeList = response.data;
|
||||
});
|
||||
},
|
||||
show(select) {
|
||||
getStationListBySkinCode(select.id).then(response => {
|
||||
if (response.code == 200) {
|
||||
this.stationList = response.data;
|
||||
}
|
||||
});
|
||||
this.dialogShow = true;
|
||||
this.initLoadData();
|
||||
},
|
||||
close() {
|
||||
if (this.$refs.speed) {
|
||||
this.$refs.speed.resetFields();
|
||||
}
|
||||
if (this.$refs.chart) {
|
||||
this.$refs.chart.resetFields();
|
||||
}
|
||||
this.dialogShow = false;
|
||||
},
|
||||
querySpeedLevelData() {
|
||||
getSpeedLevels(this.selected.id).then(response => {
|
||||
if (response.data.level1 ||
|
||||
response.data.level2 ||
|
||||
response.data.level3 ||
|
||||
response.data.level4) {
|
||||
this.levelModel = response.data;
|
||||
this.disabled = true;
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('error.getSpeedLevelFailed'));
|
||||
});
|
||||
},
|
||||
createSpeedRank() {
|
||||
this.$refs.speed.validate((valid) => {
|
||||
if (valid && this.selected && this.selected.id && !this.disabled) {
|
||||
const model = {
|
||||
skinCode: this.selected.id,
|
||||
level1: this.levelModel.level1,
|
||||
level2: this.levelModel.level2,
|
||||
level3: this.levelModel.level3,
|
||||
level4: this.levelModel.level4
|
||||
};
|
||||
this.loading = true;
|
||||
newSpeedLevels(model).then(response => {
|
||||
this.disabled = true;
|
||||
this.active = 1;
|
||||
this.loading = false;
|
||||
}).catch(error => {
|
||||
if (error.code === 20001) {
|
||||
this.active = 1;
|
||||
this.$messageBox(this.$t('error.speedRatingExists'));
|
||||
} else {
|
||||
this.$messageBox(this.$t('error.createSpeedLevelFailed'));
|
||||
}
|
||||
this.loading = false;
|
||||
});
|
||||
} else {
|
||||
this.active = 1;
|
||||
}
|
||||
});
|
||||
},
|
||||
createRunPlan() {
|
||||
this.$refs.chart.validate((valid) => {
|
||||
if (valid && this.selected && this.selected.id && this.disabled) {
|
||||
const model = {
|
||||
name: this.chartModel.name,
|
||||
skinCode: this.selected.id,
|
||||
direct: this.chartModel.direct,
|
||||
timeInterval: this.chartModel.timeInterval,
|
||||
startTime: this.chartModel.startTime,
|
||||
endTime: this.chartModel.endTime,
|
||||
parkingTime: this.chartModel.parkingTime,
|
||||
entrance: this.chartModel.entrance,
|
||||
exit: this.chartModel.exit
|
||||
};
|
||||
this.loading = true;
|
||||
newRunPlan(model).then(response => {
|
||||
this.active = 2;
|
||||
this.loading = false;
|
||||
this.$emit('refresh');
|
||||
setTimeout(() => {
|
||||
this.close();
|
||||
}, 1000);
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('map.createOperationGraphFailed'));
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
back() {
|
||||
this.active > 0 && this.active--;
|
||||
this.loading = false;
|
||||
},
|
||||
next() {
|
||||
switch (this.active) {
|
||||
case 0: this.createSpeedRank(); break;
|
||||
case 1: this.createRunPlan(); break;
|
||||
default: this.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
@import "src/styles/mixin.scss";
|
||||
|
||||
/deep/ {
|
||||
.el-select {
|
||||
float: left;
|
||||
width: calc(400px);
|
||||
}
|
||||
|
||||
.el-form-item__content>.el-input {
|
||||
float: left;
|
||||
width: calc(400px);
|
||||
}
|
||||
|
||||
.el-form-item__content>.el-date-editor {
|
||||
float: left;
|
||||
width: calc(200px);
|
||||
}
|
||||
|
||||
.el-input-number {
|
||||
float: left;
|
||||
width: calc(200px);
|
||||
}
|
||||
}
|
||||
</style>
|
@ -1,109 +0,0 @@
|
||||
<template>
|
||||
<el-dialog v-dialogDrag :title="this.$t('map.importOperationGraph')" :visible.sync="dialogShow" width="600px" :before-close="close">
|
||||
<el-form ref="form" label-position="right" :model="model" size="mini" :rules="rules">
|
||||
<el-form-item prop="filename">
|
||||
<el-input v-model="model.filename" type="file" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="importf">{{ $t('map.import') }}</el-button>
|
||||
<el-button @click="close">{{ $t('global.cancel') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import XLSX from 'xlsx';
|
||||
import { sheet_to_json } from '@/utils/Export2Excel';
|
||||
|
||||
export default {
|
||||
name: 'ChartImport',
|
||||
props: {
|
||||
selected: {
|
||||
type: Object,
|
||||
default: function () {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogShow: false,
|
||||
model: {
|
||||
filename: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
rules() {
|
||||
return {
|
||||
filename: [
|
||||
{ required: true, message: this.$t('rules.selectImportFiles'), trigger: 'change' }
|
||||
]
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
show() {
|
||||
this.dialogShow = true;
|
||||
},
|
||||
close() {
|
||||
this.dialogShow = false;
|
||||
},
|
||||
importf() {
|
||||
const that = this;
|
||||
const filename = this.model.filename.replace('/', '\\');
|
||||
const index = filename.lastIndexOf('\\');
|
||||
const file = new File([filename.substr(0, index)], filename.substr(index + 1), { type: 'application/vnd.ms-excel' });
|
||||
|
||||
if (file) {
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: this.$t('tip.underImport'),
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
|
||||
const reader = new FileReader();
|
||||
if (reader) {
|
||||
reader.onload = function (e) {
|
||||
let wb;
|
||||
const data = e.target.result;
|
||||
if (that.rABS) {
|
||||
wb = XLSX.read(btoa(that.fixdata(data)), { // 手动转化
|
||||
type: 'base64'
|
||||
});
|
||||
} else {
|
||||
wb = XLSX.read(data, {
|
||||
type: 'binary'
|
||||
});
|
||||
}
|
||||
|
||||
if (wb) {
|
||||
for (const index in wb.Sheets) {
|
||||
sheet_to_json(wb.Sheets[index]);
|
||||
}
|
||||
that.model.filename = ''; // 清空上次导入文件
|
||||
loading.close();
|
||||
}
|
||||
};
|
||||
|
||||
if (that.rABS) {
|
||||
reader.readAsArrayBuffer(file);
|
||||
} else {
|
||||
reader.readAsBinaryString(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
/deep/ {
|
||||
.el-input__inner {
|
||||
padding: 0 0;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -1,144 +0,0 @@
|
||||
<template>
|
||||
<el-card v-loading="loading" class="skin-list-main">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>{{ $t('map.mapList') }}</span>
|
||||
</div>
|
||||
<el-input v-model="filterText" :placeholder="this.$t('global.filteringKeywords')" clearable />
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: (height)+'px'}">
|
||||
<el-tree
|
||||
ref="runPlanList"
|
||||
:data="mapList"
|
||||
:filter-node-method="filterNode"
|
||||
node-key="id"
|
||||
highlight-current
|
||||
:props="defaultProps"
|
||||
class="tree-height-max"
|
||||
@node-click="handleNodeClick"
|
||||
@node-contextmenu="showContextMenu"
|
||||
>
|
||||
<span slot-scope="{ node, data }">
|
||||
<el-tooltip class="item" effect="dark" :content="node.label" placement="top" :open-delay="1000">
|
||||
<template v-if="data.type=='skin'">
|
||||
<span class="el-icon-news"></span>
|
||||
<span> {{ node.label }}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span class="el-icon-document"></span>
|
||||
<span> {{ node.label }}</span>
|
||||
</template>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</el-tree>
|
||||
</el-scrollbar>
|
||||
<chart-operate-menu ref="menu" :point="point" :selected="selected" @refresh="refresh" />
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getRunPlanList } from '@/api/runplan';
|
||||
import { DeviceMenu } from '@/scripts/ConstDic';
|
||||
import { UrlConfig } from '@/router/index';
|
||||
import ChartOperateMenu from './operateMenu';
|
||||
|
||||
export default {
|
||||
name: 'ChartList',
|
||||
components: {
|
||||
ChartOperateMenu
|
||||
},
|
||||
props: {
|
||||
height: {
|
||||
type: Number,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
activeName: 'first',
|
||||
filterText: '',
|
||||
mapList: [],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
},
|
||||
point: {
|
||||
x: 0,
|
||||
y: 0
|
||||
},
|
||||
selected: {}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
filterText(val) {
|
||||
this.$refs.runPlanList.filter(val);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.refresh();
|
||||
this.$store.dispatch('runPlan/clear');
|
||||
},
|
||||
methods: {
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.name.indexOf(value) !== -1;
|
||||
},
|
||||
refresh() {
|
||||
this.loading = true;
|
||||
getRunPlanList().then(response => {
|
||||
this.mapList = response.data;
|
||||
this.$nextTick(() => { this.loading = false; });
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
this.$messageBox(this.$t('error.refreshOperationGraphFailed'));
|
||||
});
|
||||
},
|
||||
handleNodeClick(obj, node) {
|
||||
this.$store.dispatch('runPlan/clear').then(() => {
|
||||
if (obj.type === 'Skin') {
|
||||
this.$router.push({ path: `${UrlConfig.map.runPlanView}/draft`, query: { skinCode: obj.id, planId: null } });
|
||||
} else {
|
||||
this.$router.push({ path: `${UrlConfig.map.runPlanView}/draft`, query: { skinCode: node.parent.data.id, planId: obj.id } });
|
||||
}
|
||||
});
|
||||
},
|
||||
showContextMenu(e, obj, node, vueElem) {
|
||||
e.preventDefault();
|
||||
this.selected = obj;
|
||||
this.point = {
|
||||
x: e.clientX,
|
||||
y: e.clientY
|
||||
};
|
||||
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: DeviceMenu.RunPlan });
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped rel="stylesheet/scss" lang="scss">
|
||||
.uploadDemo {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
float: right;
|
||||
padding: 3px 0;
|
||||
margin-right: 3px;
|
||||
cursor: pointer;
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.el-tree {
|
||||
overflow: hidden !important;
|
||||
}
|
||||
|
||||
.el-tree-node.is-current>.el-tree-node__content {
|
||||
background-color: #e4e3e3 !important;
|
||||
}
|
||||
</style>
|
@ -1,192 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<pop-menu ref="popMenu" :menu="menu" />
|
||||
<chart-create ref="create" :selected="selected" @refresh="refresh" />
|
||||
<chart-publish ref="publish" :selected="selected" @refresh="refresh" @showCheckInfo="showCheckInfo" />
|
||||
<chart-check ref="check" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { UrlConfig } from '@/router/index';
|
||||
import { DeviceMenu } from '@/scripts/ConstDic';
|
||||
import { deleteRunPlan, importRunPlan } from '@/api/runplan';
|
||||
import ChartCreate from './create';
|
||||
import ChartPublish from './publish';
|
||||
import ChartCheck from './check';
|
||||
import PopMenu from '@/components/PopMenu';
|
||||
import XLSX from 'xlsx';
|
||||
|
||||
export default {
|
||||
name: 'MapOperateMenu',
|
||||
components: {
|
||||
PopMenu,
|
||||
ChartCreate,
|
||||
ChartPublish,
|
||||
ChartCheck
|
||||
},
|
||||
props: {
|
||||
point: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
selected: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menu1: [
|
||||
// {
|
||||
// label: this.$t('map.createOperationGraph'),
|
||||
// handler: this.createChart
|
||||
// },
|
||||
{
|
||||
label: this.$t('map.importOperationGraph'),
|
||||
handler: this.importChart,
|
||||
type: 'file'
|
||||
}
|
||||
],
|
||||
menu2: [
|
||||
{
|
||||
label: this.$t('map.publishOperationGraph'),
|
||||
handler: this.publishChart
|
||||
},
|
||||
{
|
||||
label: this.$t('map.deleteOperationGraph'),
|
||||
handler: this.deleteChart
|
||||
}
|
||||
],
|
||||
menu: []
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
'$store.state.menuOperation.menuCount': function (val) {
|
||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.RunPlan)) {
|
||||
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||
} else {
|
||||
this.doClose();
|
||||
}
|
||||
},
|
||||
selected: function (val) {
|
||||
if (val.type === 'skin') this.menu = this.menu1;
|
||||
if (val.type === 'plan') this.menu = this.menu2;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const self = this;
|
||||
window.onclick = function (e) {
|
||||
self.doClose();
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
doShow(point) {
|
||||
if (this.$refs && this.$refs.popMenu) {
|
||||
this.$refs.popMenu.resetShowPosition(point);
|
||||
}
|
||||
},
|
||||
doClose() {
|
||||
if (this.$refs && this.$refs.popMenu) {
|
||||
this.$refs.popMenu.close();
|
||||
}
|
||||
},
|
||||
createChart() {
|
||||
this.doClose();
|
||||
if (this.$refs && this.$refs.create) {
|
||||
this.$refs.create.show(this.selected);
|
||||
}
|
||||
},
|
||||
publishChart() {
|
||||
this.doClose();
|
||||
if (this.$refs && this.$refs.publish) {
|
||||
this.$refs.publish.show();
|
||||
}
|
||||
},
|
||||
showCheckInfo(info) {
|
||||
if (this.$refs && this.$refs.check) {
|
||||
this.$refs.check.doShow(info);
|
||||
}
|
||||
},
|
||||
deleteChart() {
|
||||
if (this.selected && this.selected.status !== '01') { // 不是正在创建的情况
|
||||
deleteRunPlan(this.selected.id).then(Response => {
|
||||
if (this.selected.id === this.$route.query.planId) {
|
||||
this.$router.push({ path: `${UrlConfig.map.runPlanView}/draft` });
|
||||
}
|
||||
|
||||
this.refresh();
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.deleteOperationGraphFailed'));
|
||||
});
|
||||
} else {
|
||||
this.$messageBox(this.$t('error.cannotDeleted'));
|
||||
}
|
||||
},
|
||||
importChart(file) {
|
||||
const skinCode= this.selected ? this.selected.id : null;
|
||||
if (file && skinCode) {
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
visible: true,
|
||||
text: this.$t('tip.underImport'),
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
|
||||
const that = this;
|
||||
const reader = new FileReader();
|
||||
if (reader) {
|
||||
reader.onload = function (e) {
|
||||
let wb;
|
||||
const data = e.target.result;
|
||||
if (that.rABS) {
|
||||
wb = XLSX.read(btoa(that.fixdata(data)), { // 手动转化
|
||||
type: 'base64'
|
||||
});
|
||||
} else {
|
||||
wb = XLSX.read(data, {
|
||||
type: 'binary'
|
||||
});
|
||||
}
|
||||
|
||||
if (wb) {
|
||||
try {
|
||||
let jsonData = [];
|
||||
const PlanConvert = that.$theme.loadPlanConvert(skinCode);
|
||||
for (const index in wb.Sheets) {
|
||||
jsonData = PlanConvert.importData(wb.Sheets[index], jsonData);
|
||||
}
|
||||
|
||||
importRunPlan({ skinCode: skinCode, runPlanList: jsonData }).then(response => {
|
||||
loading.close();
|
||||
that.refresh();
|
||||
that.$message.success(that.$t('tip.importOperationGraphSuccessfully'));
|
||||
}).catch(() => {
|
||||
loading.close();
|
||||
that.refresh();
|
||||
that.$message.warning(that.$t('tip.importOperationGraphFailed'));
|
||||
});
|
||||
} catch (error) {
|
||||
loading.close();
|
||||
that.refresh();
|
||||
that.$message.warning(that.$t('tip.parsingOperationGraphFailed'));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (that.rABS) {
|
||||
reader.readAsArrayBuffer(file);
|
||||
} else {
|
||||
reader.readAsBinaryString(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.doClose();
|
||||
},
|
||||
refresh() {
|
||||
this.$emit('refresh');
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -1,86 +0,0 @@
|
||||
<template>
|
||||
<el-dialog v-dialogDrag :title="this.$t('map.operationGraphPublished')" :visible.sync="dialogShow" width="30%" :before-close="handleClose">
|
||||
<div>
|
||||
<el-form ref="form" label-position="right" :model="editModel" label-width="120px" size="mini" :rules="rules">
|
||||
<el-form-item :label="this.$t('map.operationGraphName')" prop="name">
|
||||
<el-input v-model="editModel.name" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button :disabled="loading" @click="dialogShow = false">{{ $t('global.cancel') }}</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="publish">{{ $t('global.confirm') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { publishRunPlan } from '@/api/runplan';
|
||||
|
||||
export default {
|
||||
name: 'ChartPublish',
|
||||
props: {
|
||||
selected: {
|
||||
type: Object,
|
||||
default: function () {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogShow: false,
|
||||
loading: false,
|
||||
editModel: {
|
||||
planId: '',
|
||||
name: ''
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: '请输入运行图名称', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
'selected': function (val) {
|
||||
if (val) { this.editModel.name = val.name; }
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
show() {
|
||||
this.dialogShow = true;
|
||||
},
|
||||
close() {
|
||||
this.$refs.form.resetFields();
|
||||
this.dialogShow = false;
|
||||
},
|
||||
handleClose() {
|
||||
this.close();
|
||||
},
|
||||
publish() {
|
||||
if (this.selected && this.selected.status !== '01') {
|
||||
this.loading = true;
|
||||
this.editModel.planId = this.selected.id;
|
||||
publishRunPlan(this.editModel).then(resp => {
|
||||
this.loading = false;
|
||||
if (resp.data && resp.data.length) {
|
||||
this.$emit('showCheckInfo', { contextList: resp.data });
|
||||
} else {
|
||||
this.$message.success(this.$t('tip.publishedOperationalGraphSuccessfully'));
|
||||
}
|
||||
this.close();
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.publishedOperationalGraphFailed'));
|
||||
this.loading = false;
|
||||
this.close();
|
||||
});
|
||||
} else {
|
||||
this.$messageBox(this.$t('error.cannotPublished'));
|
||||
this.close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -113,9 +113,8 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import XLSX from 'xlsx';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { importRunPlan, planEffectiveCheck, runPlanNotify } from '@/api/runplan';
|
||||
import { planEffectiveCheck, runPlanNotify } from '@/api/runplan';
|
||||
import { launchFullscreen } from '@/utils/screen';
|
||||
import { UrlConfig } from '@/router/index';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
@ -147,32 +146,11 @@ export default {
|
||||
{
|
||||
title: this.$t('planMonitor.file'),
|
||||
children: [
|
||||
// {
|
||||
// title: this.$t('planMonitor.openRunningDiagram'),
|
||||
// click: this.handleOpenRunPlan
|
||||
// },
|
||||
// {
|
||||
// type: 'file',
|
||||
// title: '导入运行图',
|
||||
// click: this.handleImportRunPlan
|
||||
// },
|
||||
// {
|
||||
// title: this.$t('planMonitor.createRunningDiagram'),
|
||||
// click: this.handleCreateEmptyPlan
|
||||
// },
|
||||
// {
|
||||
// title: '修改运行图名称',
|
||||
// click: this.handleEditPlan
|
||||
// },
|
||||
{
|
||||
title: this.$t('planMonitor.modifyStationIntervalTime'),
|
||||
click: this.handleModifyingStationIntervalTime
|
||||
// disabledCallback: () => { return !this.$route.query.planId },
|
||||
}
|
||||
// {
|
||||
// title: '删除运行图',
|
||||
// click: this.handledeleteRunPlan
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -278,7 +256,6 @@ export default {
|
||||
}else{
|
||||
this.isNotUser=true;
|
||||
}
|
||||
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('training', [
|
||||
@ -405,17 +382,6 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
// 打开运行图列表
|
||||
// handleOpenRunPlan() {
|
||||
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
|
||||
// },
|
||||
// handledeleteRunPlan() {
|
||||
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'delete'} });
|
||||
// },
|
||||
// 修改运行图名称
|
||||
// handleEditPlan() {
|
||||
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'edit'} });
|
||||
// },
|
||||
loadingScreen() {
|
||||
this.loading = this.$loading({
|
||||
lock: true,
|
||||
@ -424,64 +390,6 @@ export default {
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
},
|
||||
// 导入运行图
|
||||
handleImportRunPlan(file) {
|
||||
if (file) {
|
||||
this.loadingScreen();
|
||||
setTimeout(() => {
|
||||
const that = this;
|
||||
const reader = new FileReader();
|
||||
if (reader) {
|
||||
reader.onload = function (e) {
|
||||
let wb;
|
||||
const data = e.target.result;
|
||||
if (that.rABS) {
|
||||
wb = XLSX.read(btoa(that.fixdata(data)), { // 手动转化
|
||||
type: 'base64'
|
||||
});
|
||||
} else {
|
||||
wb = XLSX.read(data, {
|
||||
type: 'binary'
|
||||
});
|
||||
}
|
||||
if (wb) {
|
||||
try {
|
||||
let jsonData = [];
|
||||
for (const index in wb.Sheets) {
|
||||
jsonData = that.planConvert.importData(wb.Sheets[index], jsonData);
|
||||
}
|
||||
|
||||
importRunPlan({ skinCode: that.$route.query.skinCode || '02', runPlanList: jsonData }).then(response => {
|
||||
that.loading.close();
|
||||
that.refresh();
|
||||
that.handleOpenRunPlan();
|
||||
}).catch(error => {
|
||||
that.loading.close();
|
||||
that.refresh();
|
||||
that.$message.warning(that.$t('tip.importRunGraphFailed') + error.message);
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
that.loading.close();
|
||||
that.refresh();
|
||||
that.$message.warning(that.$t('tip.parseRunGraphFailed') + error.message);
|
||||
}
|
||||
}
|
||||
};
|
||||
if (that.rABS) {
|
||||
reader.readAsArrayBuffer(file);
|
||||
} else {
|
||||
reader.readAsBinaryString(file);
|
||||
}
|
||||
}
|
||||
}, 50);
|
||||
}
|
||||
this.closeMenu();
|
||||
},
|
||||
// 新建运行图
|
||||
// handleCreateEmptyPlan() {
|
||||
// this.$emit('dispatchDialog', { name: 'createEmptyPlan', params: {} });
|
||||
// },
|
||||
// 修改站间运行时间
|
||||
handleModifyingStationIntervalTime() {
|
||||
this.$emit('dispatchDialog', { name: 'modifyingStationIntervalTime', params: {} });
|
||||
|
@ -211,9 +211,9 @@ export default {
|
||||
});
|
||||
}
|
||||
|
||||
const skinCode = this.$route.query.skinCode;
|
||||
const mapId = this.$route.query.mapId;
|
||||
if (skinCode) {
|
||||
getStationRunning(skinCode).then(resp => { // 查询是否有站间运行时间
|
||||
getStationRunning(mapId).then(resp => { // 查询是否有站间运行时间
|
||||
const list = resp.data;
|
||||
list.forEach(elem => {
|
||||
this.stopStationMap[[elem.startSectionCode, elem.endSectionCode].toString()] = elem;
|
||||
|
@ -229,7 +229,7 @@ export default {
|
||||
jsonData = that.planConvert.importData(wb.Sheets[index], jsonData);
|
||||
}
|
||||
|
||||
importRunPlan({ skinCode: that.$route.query.skinCode || '02', runPlanList: jsonData }).then(response => {
|
||||
importRunPlan({ mapId: that.$route.params.mapId || '02', runPlanList: jsonData }).then(response => {
|
||||
that.loadingDig.close();
|
||||
that.$message.success(that.$t('tip.importOperationGraphSuccessfully'));
|
||||
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
|
||||
|
@ -142,7 +142,7 @@ export default {
|
||||
|
||||
this.stationIntervalData = [];
|
||||
if (this.$route.query.skinCode) {
|
||||
getStationRunning(this.$route.query.skinCode).then(resp => {
|
||||
getStationRunning(this.$route.query.mapId).then(resp => {
|
||||
const list = resp.data;
|
||||
list.forEach(elem => {
|
||||
elem.isEditStatus = false;
|
||||
@ -183,7 +183,7 @@ export default {
|
||||
this.stationIntervalData.forEach(elem => {
|
||||
data.push(elem.runPlanLevelVO);
|
||||
});
|
||||
setStationRunning(this.$route.query.skinCode, data).then(resp => {
|
||||
setStationRunning(this.$route.query.mapId, data).then(resp => {
|
||||
this.stationIntervalData.forEach(elem => {
|
||||
elem.isEditStatus = false;
|
||||
});
|
||||
|
@ -347,7 +347,8 @@ export default {
|
||||
}
|
||||
},
|
||||
loadInitData(params) {
|
||||
const skinCode = this.$route.query.skinCode;
|
||||
const skinCode = this.$route.query.skinCode;
|
||||
const mapId = this.$route.query.mapId;
|
||||
this.isPlan = params.isPlan;
|
||||
this.editModel.taskIndex = params.taskIndex;
|
||||
this.editModel.serviceNumber = params.serviceNumber;
|
||||
@ -361,8 +362,8 @@ export default {
|
||||
this.editModel.startTime = formatTime(trainInfo.stationTimeList[0].secondTime + this.PlanConvert.TranslationTime);
|
||||
}
|
||||
|
||||
if (skinCode) {
|
||||
getStationRunning(skinCode).then(resp => {
|
||||
if (mapId) {
|
||||
getStationRunning(mapId).then(resp => {
|
||||
const list = resp.data;
|
||||
list.forEach(elem => {
|
||||
this.stopStationMap[[elem.startSectionCode, elem.endSectionCode].toString()] = elem;
|
||||
|
@ -12,122 +12,122 @@ import { launchFullscreen } from '@/utils/screen';
|
||||
import { UrlConfig } from '@/router/index';
|
||||
|
||||
export default {
|
||||
name: 'ManagementList',
|
||||
name: 'ManagementList',
|
||||
|
||||
data() {
|
||||
return {
|
||||
EffectiveTypeList: [],
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
queryForm: {
|
||||
labelWidth: '120px',
|
||||
queryObject: {
|
||||
mapName: {
|
||||
type: 'text',
|
||||
label: this.$t('replay.mapName')
|
||||
}
|
||||
}
|
||||
},
|
||||
queryList: {
|
||||
query: getSimulationRelpayList,
|
||||
selectCheckShow: false,
|
||||
indexShow: true,
|
||||
columns: [
|
||||
{
|
||||
title: this.$t('replay.mapName'),
|
||||
prop: 'mapName'
|
||||
},
|
||||
{
|
||||
title: this.$t('replay.creatorId'),
|
||||
prop: 'creatorId'
|
||||
},
|
||||
{
|
||||
title: this.$t('replay.createTime'),
|
||||
prop: 'createTime'
|
||||
},
|
||||
{
|
||||
title: this.$t('global.status'),
|
||||
prop: 'status',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']); },
|
||||
tagType: (row) => {
|
||||
switch (row.status) {
|
||||
case '1': return 'success';
|
||||
default: return 'danger';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('global.operate'),
|
||||
width: '250',
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('replay.replay'),
|
||||
handleClick: this.rePlay,
|
||||
type: '',
|
||||
showControl: (row) => { return row.status == '1'; }
|
||||
},
|
||||
{
|
||||
name: this.$t('global.delete'),
|
||||
handleClick: this.delete,
|
||||
type: 'danger',
|
||||
showControl: (row) => { return this.role; }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
EffectiveTypeList: [],
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
pageIndex: 'pageNum'
|
||||
},
|
||||
queryForm: {
|
||||
labelWidth: '120px',
|
||||
queryObject: {
|
||||
mapName: {
|
||||
type: 'text',
|
||||
label: this.$t('replay.mapName')
|
||||
}
|
||||
}
|
||||
},
|
||||
queryList: {
|
||||
query: getSimulationRelpayList,
|
||||
selectCheckShow: false,
|
||||
indexShow: true,
|
||||
columns: [
|
||||
{
|
||||
title: this.$t('replay.mapName'),
|
||||
prop: 'mapName'
|
||||
},
|
||||
{
|
||||
title: this.$t('replay.creatorId'),
|
||||
prop: 'creatorId'
|
||||
},
|
||||
{
|
||||
title: this.$t('replay.createTime'),
|
||||
prop: 'createTime'
|
||||
},
|
||||
{
|
||||
title: this.$t('global.status'),
|
||||
prop: 'status',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']); },
|
||||
tagType: (row) => {
|
||||
switch (row.status) {
|
||||
case '1': return 'success';
|
||||
default: return 'danger';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
title: this.$t('global.operate'),
|
||||
width: '250',
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('replay.replay'),
|
||||
handleClick: this.rePlay,
|
||||
type: '',
|
||||
showControl: (row) => { return row.status == '1'; }
|
||||
},
|
||||
{
|
||||
name: this.$t('global.delete'),
|
||||
handleClick: this.delete,
|
||||
type: 'danger',
|
||||
showControl: (row) => { return this.role; }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
currentModel: {}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
role() {
|
||||
return this.$store.state.user.roles.includes('04') ||
|
||||
currentModel: {}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
role() {
|
||||
return this.$store.state.user.roles.includes('04') ||
|
||||
this.$store.state.user.roles.includes('05');
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loadInitData();
|
||||
},
|
||||
methods: {
|
||||
loadInitData() {
|
||||
this.EffectiveTypeList = [];
|
||||
this.$Dictionary.effectiveType().then(list => {
|
||||
this.EffectiveTypeList = list.map(elem => { return { value: elem.code, label: elem.name }; });
|
||||
});
|
||||
},
|
||||
reloadTable() {
|
||||
this.queryList.reload();
|
||||
},
|
||||
rePlay(index, data) {
|
||||
getPublishMapInfo(data.mapId).then(resp => {
|
||||
const model = resp.data;
|
||||
simulationRelpay(data.id).then(rest => {
|
||||
const query = { skinCode: model.skinCode, group: rest.data, replayId: data.id, createTime: data.createTime, destroyTime: data.destroyTime };
|
||||
this.$router.push({ path: `${UrlConfig.display}/replay`, query: query });
|
||||
launchFullscreen();
|
||||
});
|
||||
});
|
||||
},
|
||||
delete(index, data) {
|
||||
this.$confirm(this.$t('replay.wellDelReplay'), this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
delSimulationRecord(data.id).then(response => {
|
||||
this.$message.success(this.$t('replay.deleteSuccess'));
|
||||
this.reloadTable();
|
||||
}).catch(() => {
|
||||
this.reloadTable();
|
||||
this.$messageBox(this.$t('error.deleteFailedv'));
|
||||
});
|
||||
}).catch(() => { });
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loadInitData();
|
||||
},
|
||||
methods: {
|
||||
loadInitData() {
|
||||
this.EffectiveTypeList = [];
|
||||
this.$Dictionary.effectiveType().then(list => {
|
||||
this.EffectiveTypeList = list.map(elem => { return { value: elem.code, label: elem.name }; });
|
||||
});
|
||||
},
|
||||
reloadTable() {
|
||||
this.queryList.reload();
|
||||
},
|
||||
rePlay(index, data) {
|
||||
getPublishMapInfo(data.mapId).then(resp => {
|
||||
const model = resp.data;
|
||||
simulationRelpay(data.id).then(rest => {
|
||||
const query = { skinCode: model.skinCode, group: rest.data, replayId: data.id, createTime: data.createTime, destroyTime: data.destroyTime };
|
||||
this.$router.push({ path: `${UrlConfig.display}/replay`, query: query });
|
||||
launchFullscreen();
|
||||
});
|
||||
});
|
||||
},
|
||||
delete(index, data) {
|
||||
this.$confirm(this.$t('replay.wellDelReplay'), this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
delSimulationRecord(data.id).then(response => {
|
||||
this.$message.success(this.$t('replay.deleteSuccess'));
|
||||
this.reloadTable();
|
||||
}).catch(() => {
|
||||
this.reloadTable();
|
||||
this.$messageBox(this.$t('error.deleteFailedv'));
|
||||
});
|
||||
}).catch(() => { });
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
305
src/views/system/product/edit.vue
Normal file
305
src/views/system/product/edit.vue
Normal file
@ -0,0 +1,305 @@
|
||||
<template>
|
||||
<div v-loading="loading" class="card-box">
|
||||
<el-steps class="steps" :active="display">
|
||||
<el-step :title="title" icon="el-icon-edit-outline" />
|
||||
<el-step title="" icon="el-icon-upload" />
|
||||
</el-steps>
|
||||
<el-card class="forms" style="padding-top: 40px">
|
||||
<el-form ref="form" :model="addModel" label-width="140px">
|
||||
<el-form-item :label="$t('map.skinStyleColon')" prop="mapName">
|
||||
<el-input v-model="addModel.mapName" :disabled="true" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('map.productType') + ':'" prop="prdType">
|
||||
<el-radio-group v-model="addModel.prdType" :disabled="isUpdate">
|
||||
<template v-for="item in chooseList">
|
||||
<el-radio-button :key="item.code" :label="item.code">{{ item.name }}</el-radio-button>
|
||||
</template>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('map.productCode') + ':'"
|
||||
prop="code"
|
||||
:rules="node && node.data.type ==='skin' ? baseRules.code:{}"
|
||||
>
|
||||
<el-input v-model="addModel.code" :disabled="codeDisabled" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('map.productName') + ':'" prop="name" :rules="baseRules.name">
|
||||
<el-input v-model="addModel.name" />
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="isShowTrainTypes"
|
||||
:label="$t('map.associateTrainingTypes') + ':'"
|
||||
prop="trainTypes"
|
||||
:rules="baseRules.trainTypes"
|
||||
>
|
||||
<el-select v-model="addModel.trainTypes" multiple :placeholder="$t('map.pleaseSelect')" @change="trainTypesChange">
|
||||
<el-option
|
||||
v-for="item in trainTypesList"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('map.productDescription') + ':'" prop="remarks" :rules="baseRules.remarks">
|
||||
<el-input v-model="addModel.remarks" type="textarea" :rows="4" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<div class="draft">
|
||||
<el-button-group>
|
||||
<el-button v-if="isCreate" type="primary" @click="create">{{ $t('map.create') }}</el-button>
|
||||
<el-button v-if="isUpdate" type="primary" @click="update">{{ $t('map.updata') }}</el-button>
|
||||
<el-button v-if="isDelete" type="danger" @click="deleteObj">{{ $t('map.deleteObj') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createTrainingCategory, updateTrainingCategory, getProductDetail, deleteTrainingCategory, checkMapProductCodeExist } from '@/api/management/mapprd';
|
||||
|
||||
export default {
|
||||
name: 'ShowDetail',
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
node: null,
|
||||
display: 1,
|
||||
codeDisabled: true,
|
||||
rules: {},
|
||||
trainTypesList: [],
|
||||
initTrainTypes: [],
|
||||
chooseList: [],
|
||||
addModel: {
|
||||
id: '',
|
||||
mapId: '',
|
||||
mapName: '',
|
||||
skinCode: '',
|
||||
name: '',
|
||||
remarks: '',
|
||||
code: '',
|
||||
prdType: '01',
|
||||
trainTypes: []
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
title() {
|
||||
if (this.node && this.node.data) {
|
||||
if (this.node.data.type === 'Skin') {
|
||||
return this.$t('map.createProductCategories');
|
||||
} else if (this.node.data.type === 'Prd' ||
|
||||
this.node.data.type === 'Prd') {
|
||||
return this.$t('map.editTraining');
|
||||
}
|
||||
}
|
||||
return this.$t('map.selectOperation');
|
||||
},
|
||||
isCreate() {
|
||||
return this.node && this.node.data.type === 'Skin';
|
||||
},
|
||||
isUpdate() {
|
||||
return this.node && this.node.data.type === 'Prd';
|
||||
},
|
||||
isDelete() {
|
||||
return this.node && this.node.data.type === 'Prd';
|
||||
},
|
||||
isShowTrainTypes() {
|
||||
return this.addModel.prdType != '03' && this.addModel.prdType != '04';
|
||||
},
|
||||
baseRules() {
|
||||
return {
|
||||
code: [
|
||||
{ required: true, message: this.$t('rules.productCodeEnter'), trigger: 'change' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: this.$t('rules.productNameEnter'), trigger: 'change' }
|
||||
],
|
||||
remarks: [
|
||||
{ required: true, message: this.$t('rules.productDescriptionEnter'), trigger: 'change' }
|
||||
],
|
||||
trainTypes: [
|
||||
{ required: true, message: this.$t('rules.trainingTypeSelect'), trigger: 'change' }
|
||||
]
|
||||
};
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$Dictionary.trainingType().then(list => {
|
||||
this.trainTypesList = list;
|
||||
});
|
||||
this.$Dictionary.productPostType().then(list => {
|
||||
this.chooseList = list;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
loadData(node) {
|
||||
if (node) {
|
||||
// 清除数据
|
||||
this.node = node;
|
||||
this.initTrainTypes = [];
|
||||
this.$refs.form.resetFields();
|
||||
this.loading = true;
|
||||
if (node.data.type === 'Skin') {
|
||||
this.codeDisabled = false;
|
||||
this.addModel.mapName = node.data.name;
|
||||
this.addModel.skinCode = node.data.id;
|
||||
this.loading = false;
|
||||
} else if (node.data.type === 'Prd') {
|
||||
this.codeDisabled = true;
|
||||
getProductDetail(node.data.id).then(response => {
|
||||
this.addModel.mapName = node.parent.data.name;
|
||||
this.addModel.mapId = node.parent.data.id;
|
||||
this.addModel.name = response.data.name;
|
||||
this.addModel.remarks = response.data.remarks;
|
||||
this.addModel.prdType = response.data.prdType;
|
||||
this.addModel.code = response.data.code;
|
||||
this.addModel.skinCode = response.data.skinCode;
|
||||
this.addModel.trainTypes = this.initTrainTypes = response.data.trainTypes;
|
||||
this.addModel.id = response.data.id;
|
||||
this.loading = false;
|
||||
}).catch((error) => {
|
||||
this.loading = false;
|
||||
this.$message.error(error.message);
|
||||
});
|
||||
} else {
|
||||
this.addModel.prdType = '01';
|
||||
this.loading = false;
|
||||
}
|
||||
|
||||
// 清除表单验证提示信息
|
||||
this.$nextTick(function () {
|
||||
this.$refs.form.clearValidate();
|
||||
});
|
||||
}
|
||||
},
|
||||
create() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
skinCode: this.addModel.skinCode,
|
||||
mapName: this.addModel.mapName,
|
||||
name: this.addModel.name,
|
||||
remarks: this.addModel.remarks,
|
||||
prdType: this.addModel.prdType,
|
||||
code: this.addModel.code,
|
||||
trainTypes: this.isShowTrainTypes ? this.addModel.trainTypes : []
|
||||
};
|
||||
checkMapProductCodeExist({ code: this.addModel.code }).then(response => {
|
||||
if (!response.data) {
|
||||
createTrainingCategory(data).then(response => {
|
||||
this.initTrainTypes = this.addModel.trainTypes;
|
||||
this.$emit('refresh');
|
||||
this.$message.success(this.$t('tip.productCreationSuccessfully'));
|
||||
}).catch((error) => {
|
||||
this.$message.error(`${this.$t('tip.productCreationFailed')}, ${error.message}`);
|
||||
});
|
||||
} else {
|
||||
this.$message(this.$t('tip.productCodeExists'));
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$message(this.$t('tip.productCodeExists'));
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
update() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.addModel.trainTypes = this.isShowTrainTypes ? this.addModel.trainTypes : [];
|
||||
updateTrainingCategory(this.addModel).then(response => {
|
||||
this.initTrainTypes = this.addModel.trainTypes;
|
||||
this.$message.success(this.$t('tip.updateProductSuccessfully'));
|
||||
this.$emit('refresh');
|
||||
}).catch((error) => {
|
||||
this.$message.error(`${this.$t('tip.updateProductFailed')}, ${error.message}`);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
trainTypesChange(tag) {
|
||||
if (this.initTrainTypes && this.initTrainTypes.length > 0) {
|
||||
this.initTrainTypes.forEach(elem => {
|
||||
if (this.addModel.trainTypes.indexOf(elem) < 0) {
|
||||
this.addModel.trainTypes = this.initTrainTypes;
|
||||
this.$messageBox(this.$t('tip.narrowScope'));
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
deleteObj() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
deleteTrainingCategory(this.addModel).then(response => {
|
||||
this.$message.success(this.$t('tip.deleteProductSuccessfully'));
|
||||
this.$refs.form.resetFields();
|
||||
this.node = null;
|
||||
this.$emit('refresh');
|
||||
}).catch(error => {
|
||||
if (error.code === 500009) {
|
||||
this.$message.error(this.$t('tip.cannotDeleteProduct'));
|
||||
} else {
|
||||
this.$message.error(this.$t('tip.deleteProductFailed'));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
@import "src/styles/mixin.scss";
|
||||
|
||||
.card-box {
|
||||
padding-top: 20px;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.steps {
|
||||
width: 980px;
|
||||
margin: 0 auto;
|
||||
|
||||
/deep/ {
|
||||
.el-step__icon.is-icon {
|
||||
width: 95px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.forms {
|
||||
width: 800px;
|
||||
margin: 0 auto;
|
||||
margin-top: 20px;
|
||||
|
||||
/deep/ {
|
||||
.el-select {
|
||||
float: left;
|
||||
width: calc(600px);
|
||||
}
|
||||
|
||||
.el-textarea {
|
||||
float: left;
|
||||
width: calc(600px);
|
||||
}
|
||||
|
||||
.el-form-item__content>.el-input {
|
||||
float: left;
|
||||
width: calc(600px);
|
||||
}
|
||||
|
||||
.el-input-number {
|
||||
float: left;
|
||||
width: calc(250px);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.draft {
|
||||
width: 300px;
|
||||
text-align: center;
|
||||
margin: 20px auto;
|
||||
}
|
||||
</style>
|
58
src/views/system/product/index.vue
Normal file
58
src/views/system/product/index.vue
Normal file
@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<div class="contnt_box">
|
||||
<div class="training-tree">
|
||||
<training-tree-operate ref="trainingTree" @loadData="loadData" />
|
||||
</div>
|
||||
<div class="training-draft">
|
||||
<edit-detail-operate ref="training" @refresh="refresh" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TrainingTreeOperate from './tree';
|
||||
import EditDetailOperate from './edit';
|
||||
|
||||
// 产品编辑
|
||||
export default {
|
||||
name: 'TrainingEditOperate',
|
||||
components: {
|
||||
EditDetailOperate,
|
||||
TrainingTreeOperate
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
loadData(node) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.training.loadData(node);
|
||||
});
|
||||
},
|
||||
refresh() {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.trainingTree.refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
@import "src/styles/mixin.scss";
|
||||
|
||||
.contnt_box{
|
||||
height: 100%;
|
||||
.training-tree {
|
||||
float: left;
|
||||
width: 420px;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.training-draft {
|
||||
float: left;
|
||||
width: calc(100% - 420px);
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
130
src/views/system/product/tree.vue
Normal file
130
src/views/system/product/tree.vue
Normal file
@ -0,0 +1,130 @@
|
||||
<template>
|
||||
<div v-loading="loading" class="joylink-card map-list-main">
|
||||
<div class="clearfix">
|
||||
<span>{{ $t('map.productCategories') }}</span>
|
||||
</div>
|
||||
<el-input v-model="filterText" :placeholder="$t('tip.enterKeywordsFiltering')" clearable />
|
||||
<div style="height: calc(100% - 87px);">
|
||||
<el-tree
|
||||
ref="trainingTree"
|
||||
:data="treeData"
|
||||
:filter-node-method="filterNode"
|
||||
:lazy="false"
|
||||
:props="defaultProps"
|
||||
class="tree-height-max"
|
||||
expand-on-click-node
|
||||
highlight-current
|
||||
@node-click="clickEvent"
|
||||
>
|
||||
<span slot-scope="{ node }">
|
||||
<span v-if="node.data.type == 'skin'" class="el-icon-news" />
|
||||
<span v-if="node.data.type == 'prd'" class="el-icon-tickets" />
|
||||
<span v-if="node.data.type == 'trainingType'" class="el-icon-document" />
|
||||
<span v-if="node.data.type == 'trainingType'" class="el-icon-edit" />
|
||||
<span> {{ node.label }}</span>
|
||||
</span>
|
||||
</el-tree>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getProductTree } from '@/api/management/mapprd';
|
||||
|
||||
export default {
|
||||
name: 'TreeOperate',
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
},
|
||||
filterText: '',
|
||||
treeData: [],
|
||||
node: {},
|
||||
point: {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
filterText(val) {
|
||||
this.$refs.trainingTree.filter(val);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.refresh();
|
||||
},
|
||||
methods: {
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.name.indexOf(value) !== -1;
|
||||
},
|
||||
showContextMenu(e, obj, node, vueElem) {
|
||||
e.preventDefault();
|
||||
this.point = {
|
||||
x: e.clientX,
|
||||
y: e.clientY
|
||||
};
|
||||
if (obj) {
|
||||
this.node = node;
|
||||
this.$refs.menu.show();
|
||||
}
|
||||
},
|
||||
clickEvent(obj, node, data) {
|
||||
this.$store.dispatch('menuOperation/setPopMenu', { position: null, menu: null });
|
||||
this.$emit('loadData', node);
|
||||
},
|
||||
convertTreeData(list) {
|
||||
const tree = [];
|
||||
if (list && list.length) {
|
||||
/* 去除列表的training节点*/
|
||||
list.forEach(elem => {
|
||||
elem.children = this.convertTreeData(elem.children);
|
||||
if (elem.type !== 'TrainingType') {
|
||||
tree.push(elem);
|
||||
}
|
||||
});
|
||||
}
|
||||
return tree;
|
||||
},
|
||||
refresh() {
|
||||
getProductTree().then(response => {
|
||||
this.treeData = this.convertTreeData(response.data);
|
||||
this.$nextTick(() => { this.loading = false; });
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.refreshFailure'));
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.map-list-main{
|
||||
height: 100%;
|
||||
}
|
||||
.clearfix{
|
||||
padding: 0 20px;
|
||||
border-bottom: 1px solid #EBEEF5;
|
||||
box-sizing: border-box;
|
||||
height: 47px;
|
||||
line-height: 47px;
|
||||
}
|
||||
.tree-height-max{
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.el-tree {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.el-tree-node.is-current>.el-tree-node__content {
|
||||
background-color: #e4e3e3 !important;
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user