# Conflicts:
#	src/views/map/runplan/index.vue
This commit is contained in:
joylink_cuiweidong 2019-10-30 14:04:22 +08:00
commit de1b8d579e
27 changed files with 2544 additions and 2921 deletions

View File

@ -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
});
}

View File

@ -19,12 +19,13 @@ import JointTraining from '@/views/jointTraining/index';
import Error401 from '@/views/error-page/401';
import Errpr404 from '@/views/error-page/404';
import SkinCode from '@/views/map/skinCode/index';
import SkinCodeDraft from '@/views/map/skinCode/draft';
import Mapdraft from '@/views/map/mapdraft/index';
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 Mapedit from '@/views/map/mapdraft/mapedit/index';
import Runplan from '@/views/map/runplan/index';
import MapProduct from '@/views/map/product/index';
// import Runplan from '@/views/map/runplan/index';
import RunplanView from '@/views/map/runplan/chart';
import Trainingrecord from '@/views/lesson/trainingrecord/index';
@ -53,22 +54,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';
@ -320,7 +322,7 @@ export const constantRoutes = [
];
export const asyncRouter = [
{
{ // 公共地图
path: '/design',
component: Layout,
redirect: '/design/home',
@ -423,7 +425,7 @@ export const asyncRouter = [
}
]
},
{
{ // 个人地图
path: '/design/userlist',
redirect: '/design/userlist/home',
component: Layout,
@ -483,7 +485,7 @@ export const asyncRouter = [
}
]
},
{
{ // 全屏战场图
path: '/display/:mode',
component: Display,
meta: {
@ -504,7 +506,7 @@ export const asyncRouter = [
},
hidden: true
},
{
{ // 综合演练室
path: '/trainroom',
component: TrainRoom,
meta: {
@ -523,46 +525,46 @@ export const asyncRouter = [
},
hidden: true
},
{
path: '/map',
meta: {
i18n: 'router.mapManage',
roles: [admin, mapCreater, userDesign]
},
hidden: true,
component: Layout,
children: [
{
path: 'draw',
redirect: '/map/draw/0/draft',
component: Mapdraft,
meta: {
i18n: 'router.mapDraw'
},
children: [
{
path: ':mapId/:view',
component: Mapedit,
hidden: true
}
]
},
{
path: 'runPlan',
redirect: '/map/runPlan/view/draft',
component: Runplan,
meta: {
i18n: 'router.runPlanManage'
},
children: [{
path: 'view/:mode',
component: RunplanView,
hidden: true
}]
}
]
},
{
// {
// path: '/map',
// meta: {
// i18n: 'router.mapManage',
// roles: [admin, mapCreater, userDesign]
// },
// hidden: true,
// component: Layout,
// children: [
// {
// path: 'draw',
// redirect: '/map/draw/0/draft',
// component: Mapdraft,
// meta: {
// i18n: 'router.mapDraw'
// },
// children: [
// {
// path: ':mapId/:view',
// component: Mapedit,
// hidden: true
// }
// ]
// },
// {
// path: 'runPlan',
// redirect: '/map/runPlan/view/draft',
// component: Runplan,
// meta: {
// i18n: 'router.runPlanManage'
// },
// children: [{
// path: 'view/:mode',
// component: RunplanView,
// hidden: true
// }]
// }
// ]
// },
{ // 实训平台
path: '/trainingPlatform',
component: Layout,
hidden: true,
@ -655,96 +657,96 @@ export const asyncRouter = [
}
]
},
{
path: '/dp',
hidden: true,
redirect: '/dp/home',
component: ScreenMonitor,
meta: {
roles: [admin, userScreen, user]
},
children: [
{
path: 'home',
component: ScreenMonitorHome,
meta: {
i18n: 'router.dpSystem'
},
target: true
},
{
path: 'detail/:lessonId',
component: ScreenMonitorDetail,
hidden: true
},
{
path: 'pay/:lessonId',
component: Pay,
hidden: true
}
]
},
{
// {
// path: '/dp',
// hidden: true,
// redirect: '/dp/home',
// component: ScreenMonitor,
// meta: {
// roles: [admin, userScreen, user]
// },
// children: [
// {
// path: 'home',
// component: ScreenMonitorHome,
// meta: {
// i18n: 'router.dpSystem'
// },
// target: true
// },
// {
// path: 'detail/:lessonId',
// component: ScreenMonitorDetail,
// hidden: true
// },
// {
// path: 'pay/:lessonId',
// component: Pay,
// hidden: true
// }
// ]
// },
{ // 运行图编辑
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: {
@ -828,7 +830,7 @@ export const asyncRouter = [
}
]
},
{
{ // 订单权限管理
path: '/orderauthor',
component: Layout,
meta: {
@ -920,7 +922,7 @@ export const asyncRouter = [
}
]
},
{
{ // 系统管理
path: '/system',
component: Layout,
meta: {
@ -1036,7 +1038,7 @@ export const asyncRouter = [
}
]
},
{
{ // 发布申请
path: '/apply',
component: Layout,
meta: {

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View 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>

File diff suppressed because it is too large Load Diff

View File

@ -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>

View File

@ -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>

View File

@ -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>&nbsp;{{ 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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>&nbsp;{{ 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>

View File

@ -15,45 +15,45 @@ 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 });
});
}
}
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>

View File

@ -1,212 +0,0 @@
<template>
<div class="card-box">
<!-- <turnback-bar :title="turnbackBarTitle" /> -->
<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 -160 + 'px'}" style="padding-top: 40px">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
</el-scrollbar>
</el-card>
<div class="draft">
<el-button-group>
<el-button v-if="isAdd" type="primary" style="margin-left: 120px" @click="create">{{ $t('global.create') }}</el-button>
<el-button v-if="isEdit" type="warning" style="margin-left: 120px" @click="update">{{ $t('global.update') }}</el-button>
<el-button type="primary" @click="turnback">{{ $t('global.return') }}</el-button>
</el-button-group>
</div>
</div>
</template>
<script>
import { addSkinCode, querySkinCode, updateSkinCode, querySkinCodeExistByCode } from '@/api/management/mapskin';
export default {
name: 'DictionaryDetailEdit',
data() {
return {
display: 1,
formModel: {
id: '',
code: '',
name: '',
origin: { x: 0, y: 0 },
scaling: '1',
linkWidth: 0,
zoneWidth: 0,
watermarkShow: false
}
};
},
computed: {
title() {
if (this.isAdd) {
return this.$t('map.addMapSkin');
}
if (this.isEdit) {
return this.$t('map.updateMapSkin');
}
return '';
},
isAdd() {
return this.$route.params.mode.toUpperCase() == 'add'.toUpperCase();
},
isEdit() {
return this.$route.params.mode.toUpperCase() == 'edit'.toUpperCase();
},
isDisabled() {
return this.isEdit;
},
form() {
const form = {
labelWidth: '140px',
items: [
{ prop: 'code', label: this.$t('map.skinCoding'), type: 'text', required: false, disabled: this.isDisabled },
{ prop: 'name', label: this.$t('map.skinDesignation'), type: 'text', required: false },
{ prop: 'origin', label: this.$t('map.coordinatesOrigin'), type: 'point', required: false },
{ prop: 'scaling', label: this.$t('map.scaling'), type: 'number', required: false, message: this.$t('rules.maxScaling') }
]
};
return form;
},
rules() {
const baseRules = {
code: [
{ required: true, message: this.$t('rules.skinCodingInput'), trigger: 'blur' }
],
name: [
{ required: true, message: this.$t('rules.skinDesignationInput'), trigger: 'blur' }
],
origin: [
{ required: true, message: this.$t('rules.coordinatesOriginInput'), trigger: 'blur' }
],
scaling: [
{ required: true, message: this.$t('rules.scalingInput'), trigger: 'blur' },
{
validator(rule, value, callback) {
if (Number(value) >= 1 && Number(value) <= 8) {
callback();
} else {
callback(new Error(this.$t('rules.scalingInputPrompt')));
}
},
trigger: 'blur'
}
]
};
//
this.$nextTick(function () {
this.$refs.dataform.clearValidate();
});
return baseRules;
},
height() {
return this.$store.state.app.height - 130;
}
},
mounted() {
this.initLoadPage();
},
methods: {
initLoadPage() {
//
this.display = 1;
this.formModel = {
id: '',
code: '',
name: '',
origin: { x: 0, y: 0 },
scaling: '1'
};
if (this.isEdit) {
querySkinCode(this.$route.params.skinCodeId).then(response => {
this.formModel = response.data;
});
}
//
this.$nextTick(() => {
this.$refs.dataform.resetForm();
});
},
create() {
this.formModel.id = '';
this.$refs.dataform.validateForm(() => {
querySkinCodeExistByCode(this.formModel.code).then(resp => {
addSkinCode(this.formModel).then(response => {
this.turnback();
this.$message.success(this.$t('tip.creatingSuccessful'));
}).catch(() => {
this.$messageBox(this.$t('tip.creatingFailed'));
});
}).catch(() => {
this.$messageBox(this.$t('tip.skinCodingExist'));
});
});
},
update() {
this.formModel.id = this.$route.params.skinCodeId;
this.$refs.dataform.validateForm(() => {
updateSkinCode(this.formModel).then(response => {
this.turnback();
this.$message.success(this.$t('tip.updateSuccessfully'));
}).catch(() => {
this.$messageBox(this.$t('tip.updateFailed'));
});
});
},
turnback() {
this.$router.go(-1);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.steps {
width: 940px;
margin: 0 auto;
margin-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-form-item__content>.el-input>.el-input__inner {
float: left;
width: calc(600px);
}
.el-input-number {
float: left;
width: calc(250px);
}
}
}
.draft {
width: 300px;
margin: 20px auto;
}
</style>

View File

@ -1,124 +0,0 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</div>
</template>
<script>
import { UrlConfig } from '@/router/index';
import { getSkinCodePageList, delSkinCode } from '@/api/management/mapskin';
import { getSkinCodeList } from '@/api/management/mapskin';
export default {
name: 'SkinCode',
data() {
return {
prdTypeList: [],
skinCodeList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '80px',
reset: true,
queryObject: {
name: {
type: 'text',
label: this.$t('map.skinDesignation')
},
code: {
type: 'text',
label: this.$t('map.skinCoding')
}
}
},
queryList: {
query: getSkinCodePageList,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('map.skinCoding'),
prop: 'code'
},
{
title: this.$t('map.skinDesignation'),
prop: 'name'
},
{
title: this.$t('map.coordinatesOrigin'),
prop: 'origin',
type: 'tag',
columnValue: (row) => { return `(${row.origin.x}, ${row.origin.y})`; },
tagType: () => { return ''; }
},
{
title: this.$t('map.scalingColon'),
prop: 'scaling'
},
{
type: 'button',
title: this.$t('global.operate'),
width: '250',
buttons: [
{
name: this.$t('global.edit'),
handleClick: this.handleEdit,
type: ''
},
{
name: this.$t('global.delete'),
handleClick: this.handleDelete,
type: 'danger'
}
]
}
],
actions: [
{ text: this.$t('global.add'), handler: this.handleAdd }
]
}
};
},
created() {
this.loadInitData();
},
methods: {
loadInitData() {
this.prdTypeList = [];
this.$Dictionary.productPostType().then(list => {
this.prdTypeList = list;
});
this.skinCodeList = [];
getSkinCodeList().then(response => {
this.skinCodeList = response.data;
});
},
handleAdd() {
this.$router.push(`${UrlConfig.map.skinCodeDraft}/add/null`);
},
handleEdit(index, row) {
this.$router.push(`${UrlConfig.map.skinCodeDraft}/edit/${row.id}`);
},
handleDelete(index, row) {
this.$confirm(this.$t('tip.skinDeleteConfirmation'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
delSkinCode(row.id).then(() => {
this.$message.success(this.$t('tip.skinDeleteSuccessfully'),);
}).catch(() => {
this.$messageBox(this.$t('tip.skinDeleteFailed'));
});
}).catch(() => {
});
},
reloadTable() {
this.queryList.reload();
}
}
};
</script>

View File

@ -33,7 +33,7 @@ import { addOrganization, getOrganizationList } from '@/api/management/organizat
import { getSellerList } from '@/api/management/user';
import { createPermission } from '@/api/management/order';
import PremissionList from './list';
import { deepAssign } from '@/utils/index';
// import { deepAssign } from '@/utils/index';
export default {
name: 'OrderForm',
@ -364,10 +364,11 @@ export default {
this.orderList = [];
this.goodsList.forEach(item => {
this.formModel.organizationId = this.buildModel();
const param = deepAssign({}, this.formModel);
param.goodsId = item.id;
param.goodsName = item.name;
param.price = item.price;
// const param = deepAssign({}, this.formModel);
const param = {
goodItem: item.goodItem,
permissionType: item.permissionType
};
this.orderList.push(param);
});
this.packForm(); //
@ -379,9 +380,27 @@ export default {
return nor.permissionId;
});
const param = {
createVO: {isPackage: false, relPermissions: arr},
orderList: this.orderList,
canDistribute: this.formModel.canDistribute == '01'
// createVO: {isPackage: false, relPermissions: arr},
// orderList: this.orderList,
// canDistribute: this.formModel.canDistribute == '01'
isPackage: false,
organizationId: this.formModel.organizationId,
packageNum: this.formModel.amount,
amount: this.formModel.amount,
monthAmount: this.formModel.monthAmount,
packageName: this.goodsVo.name,
totalPrice: this.formModel.totalPrice,
orderType: this.formModel.orderType,
distributeType: this.formModel.canDistribute == '01',
startTime: this.formModel.startTime,
payStatus: this.formModel.payStatus,
bizType: this.formModel.bizType,
payWays: this.formModel.payWays,
forever: this.formModel.forever,
// mapId: this.goodsList[0].mapId,
relPermissions: arr,
orderDetailList: this.orderList
};
createPermission(param).then(res => {
this.urlInfo = {
@ -389,8 +408,8 @@ export default {
title: this.$t('orderAuthor.permissionToDistributeQRCode')
};
this.$emit('orderNext', this.urlInfo);
}).catch(error => {
console.log(error);
}).catch((error) => {
this.$messageBox(`${error.message}`);
});
} else {
this.$messageBox(this.$t('tip.selectPackagingRecord'));
@ -401,16 +420,40 @@ export default {
this.$refs.dataform.validateForm(() => {
this.formModel.organizationId = this.buildModel();
const param = {
createVO: {
isPackage: true,
relPermissions: this.permissionVo.relPermissions,
name: this.permissionVo.name,
id: this.permissionVo.id,
remarks: this.permissionVo.remarks
},
goodsVO: this.goodsVo,
orderList: [this.formModel],
canDistribute: this.formModel.canDistribute == '01'
// createVO: {
// isPackage: true,
// relPermissions: this.permissionVo.relPermissions,
// name: this.permissionVo.name,
// id: this.permissionVo.id,
// remarks: this.permissionVo.remarks
// },
// goodsVO: this.goodsVo,
// orderList: [this.formModel],
// canDistribute: this.formModel.canDistribute == '01'
isPackage: true,
organizationId: this.formModel.organizationId,
packageNum: this.formModel.amount,
startTime: this.formModel.startTime,
monthAmount: this.formModel.monthAmount,
distributeType: this.formModel.canDistribute == '01',
bizType: this.formModel.bizType,
payWays: this.formModel.payWays,
forever: this.formModel.forever,
payStatus: this.formModel.payStatus,
totalPrice: this.formModel.totalPrice,
contractNo: this.formModel.contractNo,
orderType: this.formModel.orderType,
packageName: this.goodsVo.name,
remarks: this.goodsVo.remarks,
price: this.goodsVo.price,
tryUse: this.goodsVo.tryUse,
tryUseTime: this.goodsVo.tryUseTime,
tryUseTimeUnit: this.goodsVo.tryUseTimeUnit,
relPermissions: this.permissionVo.relPermissions,
mapId: this.permissionVo.mapId
// prdCode: this.permissionVo.prdCode
};
createPermission(param).then(res => {
this.urlInfo = {

View File

@ -194,7 +194,7 @@ export default {
},
changeRadio(data) {
this.$emit('changeType', data);
if (data == '02') {
if (data == '02' && this.ruleList.length) {
const arr = this.ruleList.map(item => {
return item.id;
});
@ -323,7 +323,22 @@ export default {
item.goods = ele;
}
});
item.goods && this.goodsList.push(item.goods);
const param = {
goodItem: {
name: item.name,
permissionId: item.id,
permissionName: item.goods.name,
id: item.goods.id
},
permissionType: item.type,
// mapId: item.mapId,
permissionId: item.id,
isPackage: item.isPackage,
name: item.goods.name,
price: item.goods.price,
remarks: item.goods.remarks
};
item.goods && this.goodsList.push(param);
});
if (this.goodsList.length == this.ruleList.length) {
this.$emit('permissionNext', this.goodsList);

View File

@ -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>

View 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>

View 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>

View 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>&nbsp;{{ 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>

View File

@ -0,0 +1,202 @@
<template>
<div class="card-box">
<el-steps class="steps" :active="display">
<el-step :title="title" icon="el-icon-edit-outline" />
<el-step icon="el-icon-upload" />
</el-steps>
<el-card class="forms">
<div style="padding-top: 40px; padding-bottom: 20px;">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
</div>
</el-card>
<div class="draft">
<el-button-group>
<el-button v-if="isAdd" type="primary" style="margin-left: 120px" @click="create">{{ $t('global.create') }}</el-button>
<el-button v-if="isEdit" type="warning" style="margin-left: 120px" @click="update">{{ $t('global.update') }}</el-button>
<el-button type="primary" @click="turnback">{{ $t('global.return') }}</el-button>
</el-button-group>
</div>
</div>
</template>
<script>
import { addSkinCode, querySkinCode, updateSkinCode, querySkinCodeExistByCode } from '@/api/management/mapskin';
export default {
name: 'DictionaryDetailEdit',
data() {
return {
display: 1,
formModel: {
id: '',
code: '',
name: '',
origin: { x: 0, y: 0 },
scaling: '1',
linkWidth: 0,
zoneWidth: 0,
watermarkShow: false
}
};
},
computed: {
title() {
if (this.isAdd) {
return this.$t('map.addMapSkin');
}
if (this.isEdit) {
return this.$t('map.updateMapSkin');
}
return '';
},
isAdd() {
return this.$route.params.mode.toUpperCase() == 'add'.toUpperCase();
},
isEdit() {
return this.$route.params.mode.toUpperCase() == 'edit'.toUpperCase();
},
isDisabled() {
return this.isEdit;
},
form() {
const form = {
labelWidth: '140px',
items: [
{ prop: 'code', label: this.$t('map.skinCoding'), type: 'text', required: false, disabled: this.isDisabled },
{ prop: 'name', label: this.$t('map.skinDesignation'), type: 'text', required: false },
{ prop: 'origin', label: this.$t('map.coordinatesOrigin'), type: 'point', required: false },
{ prop: 'scaling', label: this.$t('map.scaling'), type: 'number', required: false, message: this.$t('rules.maxScaling') }
]
};
return form;
},
rules() {
const baseRules = {
code: [
{ required: true, message: this.$t('rules.skinCodingInput'), trigger: 'blur' }
],
name: [
{ required: true, message: this.$t('rules.skinDesignationInput'), trigger: 'blur' }
],
origin: [
{ required: true, message: this.$t('rules.coordinatesOriginInput'), trigger: 'blur' }
],
scaling: [
{ required: true, message: this.$t('rules.scalingInput'), trigger: 'blur' },
{
validator(rule, value, callback) {
if (Number(value) >= 1 && Number(value) <= 8) {
callback();
} else {
callback(new Error(this.$t('rules.scalingInputPrompt')));
}
},
trigger: 'blur'
}
]
};
return baseRules;
}
},
mounted() {
this.initLoadPage();
},
methods: {
initLoadPage() {
//
this.display = 1;
this.formModel = {
id: '',
code: '',
name: '',
origin: { x: 0, y: 0 },
scaling: '1'
};
if (this.isEdit) {
querySkinCode(this.$route.params.skinCodeId).then(response => {
this.formModel = response.data;
});
}
//
this.$nextTick(() => {
this.$refs.dataform.resetForm();
});
},
create() {
this.formModel.id = '';
this.$refs.dataform.validateForm(() => {
querySkinCodeExistByCode(this.formModel.code).then(resp => {
addSkinCode(this.formModel).then(response => {
this.turnback();
this.$message.success(this.$t('tip.creatingSuccessful'));
}).catch(() => {
this.$messageBox(this.$t('tip.creatingFailed'));
});
}).catch(() => {
this.$messageBox(this.$t('tip.skinCodingExist'));
});
});
},
update() {
this.formModel.id = this.$route.params.skinCodeId;
this.$refs.dataform.validateForm(() => {
updateSkinCode(this.formModel).then(response => {
this.turnback();
this.$message.success(this.$t('tip.updateSuccessfully'));
}).catch(() => {
this.$messageBox(this.$t('tip.updateFailed'));
});
});
},
turnback() {
this.$router.go(-1);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.steps {
width: 940px;
margin: 0 auto;
margin-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-form-item__content>.el-input>.el-input__inner {
float: left;
width: calc(600px);
}
.el-input-number {
float: left;
width: calc(250px);
}
}
}
.draft {
width: 300px;
margin: 20px auto;
}
</style>

View File

@ -0,0 +1,124 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</div>
</template>
<script>
import { UrlConfig } from '@/router/index';
import { getSkinCodePageList, delSkinCode } from '@/api/management/mapskin';
import { getSkinCodeList } from '@/api/management/mapskin';
export default {
name: 'SkinCode',
data() {
return {
prdTypeList: [],
skinCodeList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '80px',
reset: true,
queryObject: {
name: {
type: 'text',
label: this.$t('map.skinDesignation')
},
code: {
type: 'text',
label: this.$t('map.skinCoding')
}
}
},
queryList: {
query: getSkinCodePageList,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('map.skinCoding'),
prop: 'code'
},
{
title: this.$t('map.skinDesignation'),
prop: 'name'
},
{
title: this.$t('map.coordinatesOrigin'),
prop: 'origin',
type: 'tag',
columnValue: (row) => { return `(${row.origin.x}, ${row.origin.y})`; },
tagType: () => { return ''; }
},
{
title: this.$t('map.scalingColon'),
prop: 'scaling'
},
{
type: 'button',
title: this.$t('global.operate'),
width: '250',
buttons: [
{
name: this.$t('global.edit'),
handleClick: this.handleEdit,
type: ''
},
{
name: this.$t('global.delete'),
handleClick: this.handleDelete,
type: 'danger'
}
]
}
],
actions: [
{ text: this.$t('global.add'), handler: this.handleAdd }
]
}
};
},
created() {
this.loadInitData();
},
methods: {
loadInitData() {
this.prdTypeList = [];
this.$Dictionary.productPostType().then(list => {
this.prdTypeList = list;
});
this.skinCodeList = [];
getSkinCodeList().then(response => {
this.skinCodeList = response.data;
});
},
handleAdd() {
this.$router.push(`${UrlConfig.map.skinCodeDraft}/add/null`);
},
handleEdit(index, row) {
this.$router.push(`${UrlConfig.map.skinCodeDraft}/edit/${row.id}`);
},
handleDelete(index, row) {
this.$confirm(this.$t('tip.skinDeleteConfirmation'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
delSkinCode(row.id).then(() => {
this.$message.success(this.$t('tip.skinDeleteSuccessfully'),);
}).catch(() => {
this.$messageBox(this.$t('tip.skinDeleteFailed'));
});
}).catch(() => {
});
},
reloadTable() {
this.queryList.reload();
}
}
};
</script>