修改接口
This commit is contained in:
parent
72c1f1d4ca
commit
6343a79f81
@ -1,313 +1,320 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-card v-loading="loading">
|
<el-card v-loading="loading">
|
||||||
<div slot="header" style="text-align: center;">
|
<div slot="header" style="text-align: center;">
|
||||||
<span v-if="hasProduct"><b>仿真名称: {{ courseModel.name }}</b></span>
|
<span v-if="hasProduct"><b>仿真名称: {{ courseModel.name }}</b></span>
|
||||||
<span v-else>无仿真产品</span>
|
<span v-else>无仿真产品</span>
|
||||||
</div>
|
</div>
|
||||||
<el-tabs type="border-card" @tab-click="handleLeave" :value="currentPrdCode"
|
<el-tabs
|
||||||
:style="{ height: height-50 +'px' }">
|
type="border-card"
|
||||||
<el-tab-pane v-for="item in productList" :key="item.code" :name="item.code" :label="item.name"
|
:value="currentPrdCode"
|
||||||
style="padding: 5px" :style="{ height: height-160 +'px' }">
|
:style="{ height: height-50 +'px' }"
|
||||||
<el-scrollbar wrapClass="scrollbar-wrapper" :style="{ height: height-170 +'px' }">
|
@tab-click="handleLeave"
|
||||||
<p class="list-item">
|
>
|
||||||
<span class="list-label">产品说明:</span>
|
<el-tab-pane
|
||||||
<span class="list-elem">{{ courseModel.remarks }}</span>
|
v-for="item in productList"
|
||||||
</p>
|
:key="item.code"
|
||||||
<p class="list-item">
|
:name="item.code"
|
||||||
<span class="list-label">权限列表:</span>
|
:label="item.name"
|
||||||
</p>
|
style="padding: 5px"
|
||||||
<limit-list :ref="`limit_${item.code}`" :courseModel="courseModel" @initLoadPage="initLoadPage">
|
:style="{ height: height-160 +'px' }"
|
||||||
</limit-list>
|
>
|
||||||
</el-scrollbar>
|
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: height-170 +'px' }">
|
||||||
</el-tab-pane>
|
<p class="list-item">
|
||||||
<div class="btn-buy" v-if="hasProduct">
|
<span class="list-label">产品说明:</span>
|
||||||
<el-button type="success" @click="buy">购买</el-button>
|
<span class="list-elem">{{ courseModel.remarks }}</span>
|
||||||
<el-button type="primary" @click="distribute" v-if="hasPermssion">权限分发</el-button>
|
</p>
|
||||||
<el-button type="primary" @click="transfer" v-if="hasPermssion">权限转赠</el-button>
|
<p class="list-item">
|
||||||
<el-button type="primary" @click="start" v-show="isStartDemon">开始仿真</el-button>
|
<span class="list-label">权限列表:</span>
|
||||||
<el-button type="primary" @click="start" v-show="isCreateRoom">创建房间</el-button>
|
</p>
|
||||||
<el-button type="primary" @click="joinRoom" v-show="isInRoom">进入房间</el-button>
|
<limit-list :ref="`limit_${item.code}`" :course-model="courseModel" @initLoadPage="initLoadPage" />
|
||||||
</div>
|
</el-scrollbar>
|
||||||
</el-tabs>
|
</el-tab-pane>
|
||||||
</el-card>
|
<div v-if="hasProduct" class="btn-buy">
|
||||||
|
<el-button type="success" @click="buy">购买</el-button>
|
||||||
|
<el-button v-if="hasPermssion" type="primary" @click="distribute">权限分发</el-button>
|
||||||
|
<el-button v-if="hasPermssion" type="primary" @click="transfer">权限转赠</el-button>
|
||||||
|
<el-button v-show="isStartDemon" type="primary" @click="start">开始仿真</el-button>
|
||||||
|
<el-button v-show="isCreateRoom" type="primary" @click="start">创建房间</el-button>
|
||||||
|
<el-button v-show="isInRoom" type="primary" @click="joinRoom">进入房间</el-button>
|
||||||
|
</div>
|
||||||
|
</el-tabs>
|
||||||
|
</el-card>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getCourseLessonTree } from '@/api/management/exam';
|
import { getPublishMapInfo } from '@/api/jmap/map';
|
||||||
import { getProductList, getPublishMapInfo } from '@/api/jmap/map';
|
import { getGoodsTryUse } from '@/api/management/goods';
|
||||||
import { getGoodsTryUse } from '@/api/management/goods';
|
import { getCommodityMapProduct, getMapProductDetail } from '@/api/management/mapprd';
|
||||||
import { getCommodityMapProduct, getMapProductDetail } from '@/api/management/mapprd';
|
import { PermissionType } from '@/scripts/ConstDic';
|
||||||
import { mapGetters } from 'vuex';
|
import { launchFullscreen } from '@/utils/screen';
|
||||||
import { PermissionType } from '@/scripts/ConstDic';
|
import { queryPermissionSimulation } from '@/api/management/author';
|
||||||
import { launchFullscreen } from '@/utils/screen';
|
import { postCreateRoom, getjointTraining, checkRoomExist } from '@/api/chat';
|
||||||
import { queryPermissionSimulation } from '@/api/management/author';
|
import { UrlConfig } from '@/router/index';
|
||||||
import { postCreateRoom, getjointTraining, checkRoomExist } from '@/api/chat';
|
import { simulationNotify } from '@/api/simulation';
|
||||||
import { UrlConfig } from '@/router/index';
|
import localStore from 'storejs';
|
||||||
import { simulationNotify } from '@/api/simulation';
|
import LimitList from '@/views/components/limits/index';
|
||||||
import localStore from 'storejs';
|
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
|
||||||
import LimitList from "@/views/components/limits/index";
|
|
||||||
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ExamDetailList',
|
name: 'ExamDetailList',
|
||||||
mixins: [
|
components: {
|
||||||
WindowResizeHandler
|
LimitList
|
||||||
],
|
},
|
||||||
components: {
|
filters: {
|
||||||
LimitList
|
setTime(val) {
|
||||||
},
|
if (val <= 1) {
|
||||||
data() {
|
return `0分钟`;
|
||||||
return {
|
} else if (val > 1 && val <= 60) {
|
||||||
height: '',
|
return '1分钟';
|
||||||
tryTime: 0,
|
} else if (val > 60) {
|
||||||
goodsId: '',
|
const time = parseInt(val / 60);
|
||||||
tryUser: 0,
|
return `${time}分钟`;
|
||||||
loading: true,
|
}
|
||||||
currentLessonId: '',
|
}
|
||||||
currentPrdCode: '',
|
},
|
||||||
productList: [],
|
mixins: [
|
||||||
courseModel: {
|
WindowResizeHandler
|
||||||
id: '',
|
],
|
||||||
name: '',
|
data() {
|
||||||
mapId: '',
|
return {
|
||||||
skinCode: '',
|
height: '',
|
||||||
remarks: '',
|
tryTime: 0,
|
||||||
prdType: '',
|
goodsId: '',
|
||||||
prdCode: '',
|
tryUser: 0,
|
||||||
pmsList: [],
|
loading: true,
|
||||||
},
|
currentLessonId: '',
|
||||||
EffectiveTypeList: [],
|
currentPrdCode: '',
|
||||||
jointShow: false,
|
productList: [],
|
||||||
jointGroup: '',
|
courseModel: {
|
||||||
}
|
id: '',
|
||||||
},
|
name: '',
|
||||||
filters: {
|
mapId: '',
|
||||||
setTime(val) {
|
skinCode: '',
|
||||||
if (val <= 1) {
|
remarks: '',
|
||||||
return `0分钟`;
|
prdType: '',
|
||||||
} else if (1 < val && val <= 60) {
|
prdCode: '',
|
||||||
return '1分钟';
|
pmsList: []
|
||||||
} else if (val > 60) {
|
},
|
||||||
let time = parseInt(val / 60);
|
EffectiveTypeList: [],
|
||||||
return `${time}分钟`;
|
jointShow: false,
|
||||||
}
|
jointGroup: ''
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
hasProduct() {
|
hasProduct() {
|
||||||
return this.productList.length;
|
return this.productList.length;
|
||||||
},
|
},
|
||||||
hasPermssion() {
|
hasPermssion() {
|
||||||
let isShow = false;
|
let isShow = false;
|
||||||
if (this.courseModel.pmsList.length) {
|
if (this.courseModel.pmsList.length) {
|
||||||
isShow = true;
|
isShow = true;
|
||||||
}
|
}
|
||||||
return isShow;
|
return isShow;
|
||||||
},
|
},
|
||||||
isStartDemon() {
|
isStartDemon() {
|
||||||
return this.courseModel.prdType !== '03' && (this.hasPermssion || this.tryTime > 0);
|
return this.courseModel.prdType !== '03' && (this.hasPermssion || this.tryTime > 0);
|
||||||
},
|
},
|
||||||
isCreateRoom() {
|
isCreateRoom() {
|
||||||
return this.courseModel.prdType === '03' && this.hasPermssion && !this.jointShow
|
return this.courseModel.prdType === '03' && this.hasPermssion && !this.jointShow;
|
||||||
},
|
},
|
||||||
isInRoom() {
|
isInRoom() {
|
||||||
return this.courseModel.prdType == '03' && this.hasPermssion && this.jointShow
|
return this.courseModel.prdType == '03' && this.hasPermssion && this.jointShow;
|
||||||
},
|
},
|
||||||
mapId() {
|
mapId() {
|
||||||
return this.$route.params.mapId;
|
return this.$route.params.mapId;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'$route': function (val) {
|
'$route': function (val) {
|
||||||
this.loadInitData();
|
this.loadInitData();
|
||||||
},
|
},
|
||||||
'currentPrdCode': function (code) {
|
'currentPrdCode': function (code) {
|
||||||
this.initLoadPage({ id: this.mapId, code: code });
|
this.initLoadPage({ id: this.mapId, code: code });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
this.loadInitData();
|
this.loadInitData();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async loadInitData() {
|
async loadInitData() {
|
||||||
this.$Dictionary.effectiveType().then(list => {
|
this.$Dictionary.effectiveType().then(list => {
|
||||||
this.EffectiveTypeList = list;
|
this.EffectiveTypeList = list;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.currentPrdCode = '';
|
this.currentPrdCode = '';
|
||||||
this.productList = [];
|
this.productList = [];
|
||||||
try {
|
try {
|
||||||
if (parseInt(this.mapId)) {
|
if (parseInt(this.mapId)) {
|
||||||
this.getJointTrainingList();
|
this.getJointTrainingList();
|
||||||
let rest = await getPublishMapInfo(this.mapId);
|
const rest = await getPublishMapInfo(this.mapId);
|
||||||
if (rest && rest.code == 200) {
|
if (rest && rest.code == 200) {
|
||||||
let resp = await getCommodityMapProduct(rest.data.skinCode);
|
const resp = await getCommodityMapProduct(rest.data.skinCode);
|
||||||
if (resp.data && resp.data.length) {
|
if (resp.data && resp.data.length) {
|
||||||
this.productList = resp.data.sort((a, b) => {
|
this.productList = resp.data.sort((a, b) => {
|
||||||
return Number(b.prdType) - Number(a.prdType);
|
return Number(b.prdType) - Number(a.prdType);
|
||||||
})
|
});
|
||||||
|
|
||||||
this.currentPrdCode = localStore.get(this.$route.path) || this.productList[0].code;
|
this.currentPrdCode = localStore.get(this.$route.path) || this.productList[0].code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.$messageBox('获取产品列表失败');
|
this.$messageBox('获取产品列表失败');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
resizeHandler: function () {
|
resizeHandler: function () {
|
||||||
this.height = this._clientHeight;
|
this.height = this._clientHeight;
|
||||||
},
|
},
|
||||||
async getJointTrainingList() {
|
async getJointTrainingList() {
|
||||||
try {
|
try {
|
||||||
if (this.mapId) {
|
if (this.mapId) {
|
||||||
let res = await checkRoomExist({ mapId: this.mapId });
|
const res = await checkRoomExist({ mapId: this.mapId });
|
||||||
this.jointGroup = res.data;
|
this.jointGroup = res.data;
|
||||||
this.jointShow = false;
|
this.jointShow = false;
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
this.jointShow = true;
|
this.jointShow = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error, '获取是否拥有综合演练房间');
|
console.error(error, '获取是否拥有综合演练房间');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async handleLeave(tab) {
|
async handleLeave(tab) {
|
||||||
this.currentPrdCode = tab.name;
|
this.currentPrdCode = tab.name;
|
||||||
localStore.set(this.$route.path, this.currentPrdCode);
|
localStore.set(this.$route.path, this.currentPrdCode);
|
||||||
},
|
},
|
||||||
async initLoadPage(data) {
|
async initLoadPage(data) {
|
||||||
this.loading = true
|
this.loading = true;
|
||||||
if (data && parseInt(data.id) && data.code) {
|
if (data && parseInt(data.id) && data.code) {
|
||||||
try {
|
try {
|
||||||
let resp = await getMapProductDetail(data.code);
|
const resp = await getMapProductDetail(data.code);
|
||||||
this.tryUser = 0;
|
this.tryUser = 0;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.courseModel = {
|
this.courseModel = {
|
||||||
id: resp.data.id,
|
id: resp.data.id,
|
||||||
name: resp.data.name,
|
name: resp.data.name,
|
||||||
mapId: data.id,
|
mapId: data.id,
|
||||||
skinCode: resp.data.skinCode,
|
skinCode: resp.data.skinCode,
|
||||||
remarks: resp.data.remarks,
|
remarks: resp.data.remarks,
|
||||||
prdType: resp.data.prdType,
|
prdType: resp.data.prdType,
|
||||||
prdCode: resp.data.code,
|
prdCode: resp.data.code,
|
||||||
pmsList: resp.data.pmsList || [],
|
pmsList: resp.data.pmsList || [],
|
||||||
PermissionType: PermissionType.SIMULATION
|
PermissionType: PermissionType.SIMULATION
|
||||||
};
|
};
|
||||||
|
|
||||||
let rest = await queryPermissionSimulation({ mapId: this.courseModel.mapId, prdCode: this.courseModel.prdCode });
|
const rest = await queryPermissionSimulation({ mapId: this.courseModel.mapId, prdCode: this.courseModel.prdCode });
|
||||||
this.courseModel.pmsList = rest.data;
|
this.courseModel.pmsList = rest.data;
|
||||||
if (!this.courseModel.pmsList.length) {
|
if (!this.courseModel.pmsList.length) {
|
||||||
this.tryUser = 1;
|
this.tryUser = 1;
|
||||||
let paras = {
|
const paras = {
|
||||||
mapId: data.id,
|
mapId: data.id,
|
||||||
mapProductCode: data.code,
|
mapProductCode: data.code,
|
||||||
productType: PermissionType.SIMULATION
|
productType: PermissionType.SIMULATION
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let resr = await getGoodsTryUse(paras);
|
const resr = await getGoodsTryUse(paras);
|
||||||
if (resr.data.tryTime <= 0) {
|
if (resr.data.tryTime <= 0) {
|
||||||
this.tryTime = 0;
|
this.tryTime = 0;
|
||||||
} else {
|
} else {
|
||||||
this.tryTime = resr.data.tryTime;
|
this.tryTime = resr.data.tryTime;
|
||||||
this.goodsId = resr.data.goodsId;
|
this.goodsId = resr.data.goodsId;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.tryTime = 0;
|
this.tryTime = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.$messageBox('刷新失败');
|
this.$messageBox('刷新失败');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async joinRoom() {
|
async joinRoom() {
|
||||||
await getjointTraining(this.jointGroup);
|
await getjointTraining(this.jointGroup);
|
||||||
let query = { skinCode: this.courseModel.skinCode, group: this.jointGroup };
|
const query = { skinCode: this.courseModel.skinCode, group: this.jointGroup };
|
||||||
this.$router.push({ path: `/trainroom`, query: query });
|
this.$router.push({ path: `/trainroom`, query: query });
|
||||||
},
|
},
|
||||||
async start() {
|
async start() {
|
||||||
if (this.courseModel.prdType == '03') {
|
if (this.courseModel.prdType == '03') {
|
||||||
try {
|
try {
|
||||||
let param = {
|
const param = {
|
||||||
mapId: Number(this.mapId),
|
mapId: Number(this.mapId),
|
||||||
prdCode: this.courseModel.prdCode,
|
prdCode: this.courseModel.prdCode
|
||||||
}
|
};
|
||||||
let res = await postCreateRoom(param);
|
const res = await postCreateRoom(param);
|
||||||
if (res && res.code == 200) {
|
if (res && res.code == 200) {
|
||||||
let query = { skinCode: this.courseModel.skinCode, group: res.data };
|
const query = { skinCode: this.courseModel.skinCode, group: res.data };
|
||||||
this.$router.push({ path: `/trainroom`, query: query });
|
this.$router.push({ path: `/trainroom`, query: query });
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.code == 20001) {
|
if (error.code == 20001) {
|
||||||
this.$confirm(`每个用户只能创建一个综合演练房间, 是否进入房间`, '提示', {
|
this.$confirm(`每个用户只能创建一个综合演练房间, 是否进入房间`, '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => { }).catch(() => { })
|
}).then(() => { }).catch(() => { });
|
||||||
}
|
}
|
||||||
if (error.code == 500009) {
|
if (error.code == 500009) {
|
||||||
this.$messageBox(error.message);
|
this.$messageBox(error.message);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
} else {
|
} else {
|
||||||
const loading = this.$loading({
|
this.loading = this.$loading({
|
||||||
lock: true,
|
lock: true,
|
||||||
text: 'Loading',
|
text: 'Loading',
|
||||||
spinner: 'el-icon-loading',
|
spinner: 'el-icon-loading',
|
||||||
background: 'rgba(0, 0, 0, 0.7)'
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
});
|
});
|
||||||
if (this.courseModel.pmsList.length) {
|
if (this.courseModel.pmsList.length) {
|
||||||
this.jump();
|
this.jump();
|
||||||
} else {
|
} else {
|
||||||
if (this.tryTime <= 1) {
|
if (this.tryTime <= 1) {
|
||||||
this.loading.close();
|
this.loading.close();
|
||||||
this.$confirm('您没有权限,请前往购买产品', '提示', {
|
this.$confirm('您没有权限,请前往购买产品', '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.buy();
|
this.buy();
|
||||||
}).catch(() => { })
|
}).catch(() => { });
|
||||||
} else {
|
} else {
|
||||||
this.jump();
|
this.jump();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
jump() {
|
jump() {
|
||||||
let data = { mapId: this.courseModel.mapId, code: this.currentPrdCode }
|
const data = { mapId: this.courseModel.mapId, code: this.currentPrdCode };
|
||||||
simulationNotify(data).then(resp => {
|
simulationNotify(data).then(resp => {
|
||||||
// try 0 有权限不走试用
|
// try 0 有权限不走试用
|
||||||
let query = { skinCode: this.courseModel.skinCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, code: this.currentPrdCode, goodsId: this.goodsId, try: this.tryUser };
|
const query = { skinCode: this.courseModel.skinCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, code: this.currentPrdCode, goodsId: this.goodsId, try: this.tryUser };
|
||||||
this.$router.push({ path: `${UrlConfig.display}/demon`, query: query });
|
this.$router.push({ path: `${UrlConfig.display}/demon`, query: query });
|
||||||
launchFullscreen();
|
launchFullscreen();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.$messageBox(`创建仿真失败: ${error.message}`);
|
this.$messageBox(`创建仿真失败: ${error.message}`);
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
buy() {
|
buy() {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: `${UrlConfig.demonstration.pay}/${this.courseModel.id}`,
|
path: `${UrlConfig.demonstration.pay}/${this.courseModel.id}`,
|
||||||
query: { permissionType: PermissionType.SIMULATION, prdCode: this.courseModel.prdCode, mapId: this.courseModel.mapId }
|
query: { permissionType: PermissionType.SIMULATION, prdCode: this.courseModel.prdCode, mapId: this.courseModel.mapId }
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
transfer() {
|
transfer() {
|
||||||
if (this.$refs) {
|
if (this.$refs) {
|
||||||
this.$refs[`limit_${this.currentPrdCode}`][0].transfer(this.courseModel);
|
this.$refs[`limit_${this.currentPrdCode}`][0].transfer(this.courseModel);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
distribute() {
|
distribute() {
|
||||||
if (this.$refs) {
|
if (this.$refs) {
|
||||||
this.$refs[`limit_${this.currentPrdCode}`][0].distribute(this.courseModel);
|
this.$refs[`limit_${this.currentPrdCode}`][0].distribute(this.courseModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
::-webkit-scrollbar {
|
::-webkit-scrollbar {
|
||||||
|
@ -43,10 +43,8 @@
|
|||||||
<menu-system-time ref="menuSystemTime" :offset="offset" :group="group" />
|
<menu-system-time ref="menuSystemTime" :offset="offset" :group="group" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Three-Test v-show="simulationShow" :panelShow="simulationShow" ref="ThreeTest" @showpanel="showpanel">
|
<Three-Test v-show="simulationShow" ref="ThreeTest" :panel-show="simulationShow" @showpanel="showpanel" />
|
||||||
</Three-Test>
|
<Jl3d-Simulation v-show="drivingShow" ref="Jl3dSimulation" :panel-show="drivingShow" @showdriving="showdriving" />
|
||||||
<Jl3d-Simulation v-show="drivingShow" :panelShow="drivingShow" ref="Jl3dSimulation" @showdriving="showdriving">
|
|
||||||
</Jl3d-Simulation>
|
|
||||||
|
|
||||||
<fault-choose ref="faultChoose" :group="group" />
|
<fault-choose ref="faultChoose" :group="group" />
|
||||||
<run-plan-Load ref="runPlanLoad" :group="group" />
|
<run-plan-Load ref="runPlanLoad" :group="group" />
|
||||||
@ -79,7 +77,7 @@ import { runDiagramQuit, loadQuest, getSimulationInfo } from '@/api/simulation';
|
|||||||
import { OperateMode, TrainingMode } from '@/scripts/ConstDic';
|
import { OperateMode, TrainingMode } from '@/scripts/ConstDic';
|
||||||
import { checkLoginLine } from '@/api/login';
|
import { checkLoginLine } from '@/api/login';
|
||||||
// import { isFullscreen } from '@/utils/screen';
|
// import { isFullscreen } from '@/utils/screen';
|
||||||
import { loadMapData,loadMapDataById } from '@/utils/loaddata';
|
import { loadMapData, loadMapDataById } from '@/utils/loaddata';
|
||||||
import { getPublishMapInfo } from '@/api/jmap/map';
|
import { getPublishMapInfo } from '@/api/jmap/map';
|
||||||
// import { handleToken } from '@/utils/auth';
|
// import { handleToken } from '@/utils/auth';
|
||||||
import { EventBus } from '@/scripts/event-bus';
|
import { EventBus } from '@/scripts/event-bus';
|
||||||
@ -89,7 +87,6 @@ import Vue from 'vue';
|
|||||||
import ThreeTest from '@/views/jlmap3d/index';
|
import ThreeTest from '@/views/jlmap3d/index';
|
||||||
import Jl3dSimulation from '@/views/jlmap3d/simulation/jl3dsimulation';
|
import Jl3dSimulation from '@/views/jlmap3d/simulation/jl3dsimulation';
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DisplayDraft',
|
name: 'DisplayDraft',
|
||||||
components: {
|
components: {
|
||||||
@ -197,13 +194,13 @@ export default {
|
|||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
this.group = this.$route.query.group || '';
|
this.group = this.$route.query.group || '';
|
||||||
const loading = this.$loading({
|
this.loading = this.$loading({
|
||||||
lock: true ,
|
lock: true,
|
||||||
text: 'Loading',
|
text: 'Loading',
|
||||||
spinner: 'el-icon-loading',
|
spinner: 'el-icon-loading',
|
||||||
background: 'rgba(0, 0, 0, 0.7)'
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
});
|
});
|
||||||
loading.close();
|
this.loading.close();
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
this.mode = this.$route.params.mode;
|
this.mode = this.$route.params.mode;
|
||||||
@ -450,12 +447,12 @@ export default {
|
|||||||
},
|
},
|
||||||
// 选择脚本
|
// 选择脚本
|
||||||
async selectQuest(row, id) {
|
async selectQuest(row, id) {
|
||||||
let res = await loadQuest(row.id, id, this.group);
|
const res = await loadQuest(row.id, id, this.group);
|
||||||
if (res && res.code == 200) {
|
if (res && res.code == 200) {
|
||||||
this.questId = parseInt(row.id);
|
this.questId = parseInt(row.id);
|
||||||
if(res.data && res.data.mapLocation) {
|
if (res.data && res.data.mapLocation) {
|
||||||
let mapLocation={"offsetX":res.data.mapLocation.x,"offsetY":res.data.mapLocation.y,"scaleRate":res.data.mapLocation.scale};
|
const mapLocation={'offsetX': res.data.mapLocation.x, 'offsetY': res.data.mapLocation.y, 'scaleRate': res.data.mapLocation.scale};
|
||||||
Vue.prototype.$jlmap.setOptions(mapLocation)
|
Vue.prototype.$jlmap.setOptions(mapLocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,8 +480,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 通过id加载地图数据
|
// 通过id加载地图数据
|
||||||
async loadMapDataById(mapId)
|
async loadMapDataById(mapId) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
await loadMapDataById(mapId);
|
await loadMapDataById(mapId);
|
||||||
await this.$store.dispatch('training/setMapDefaultState');
|
await this.$store.dispatch('training/setMapDefaultState');
|
||||||
|
@ -1,230 +1,226 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-card>
|
<el-card>
|
||||||
<div slot="header" style="text-align: center;">
|
<div slot="header" style="text-align: center;">
|
||||||
<b>试卷名称: {{ examDetails.name }}</b>
|
<b>试卷名称: {{ examDetails.name }}</b>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin:50px; overflow-y: auto;">
|
<div style="margin:50px; overflow-y: auto;">
|
||||||
<el-scrollbar wrapClass="scrollbar-wrapper" :style="{ height: height - 190 +'px' }">
|
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: height - 190 +'px' }">
|
||||||
<p class="list-item">
|
<p class="list-item">
|
||||||
<span class="list-label">考试时间:</span>
|
<span class="list-label">考试时间:</span>
|
||||||
<span class="list-elem" v-if="examDetails.startTime">
|
<span v-if="examDetails.startTime" class="list-elem">
|
||||||
{{ examDetails.startTime }} - {{examDetails.endTime }}</span>
|
{{ examDetails.startTime }} - {{ examDetails.endTime }}</span>
|
||||||
<span class="list-elem" v-else>随时都可以考试</span>
|
<span v-else class="list-elem">随时都可以考试</span>
|
||||||
</p>
|
</p>
|
||||||
<p class="list-item">
|
<p class="list-item">
|
||||||
<span class="list-label">考试说明:</span>
|
<span class="list-label">考试说明:</span>
|
||||||
<span class="list-elem">{{ examDetails.remarks }}</span>
|
<span class="list-elem">{{ examDetails.remarks }}</span>
|
||||||
</p>
|
</p>
|
||||||
<p class="list-item">
|
<p class="list-item">
|
||||||
<span class="list-label">考试时长:</span>
|
<span class="list-label">考试时长:</span>
|
||||||
<span class="list-elem">{{ parseInt(examDetails.duration) / 60 }}分钟</span>
|
<span class="list-elem">{{ parseInt(examDetails.duration) / 60 }}分钟</span>
|
||||||
</p>
|
</p>
|
||||||
<p class="list-item">
|
<p class="list-item">
|
||||||
<span class="list-label">考试满分:</span>
|
<span class="list-label">考试满分:</span>
|
||||||
<span class="list-elem">{{ examDetails.fullPoint }}分</span>
|
<span class="list-elem">{{ examDetails.fullPoint }}分</span>
|
||||||
</p>
|
</p>
|
||||||
<p class="list-item">
|
<p class="list-item">
|
||||||
<span class="list-label">考试及格分:</span>
|
<span class="list-label">考试及格分:</span>
|
||||||
<span class="list-elem">{{ examDetails.passingPoint }}分</span>
|
<span class="list-elem">{{ examDetails.passingPoint }}分</span>
|
||||||
</p>
|
</p>
|
||||||
<p class="list-item">
|
<p class="list-item">
|
||||||
<span class="list-label">考试规则:</span>
|
<span class="list-label">考试规则:</span>
|
||||||
<span class="list-elem">
|
<span class="list-elem">
|
||||||
<p class="list-table">
|
<p class="list-table">
|
||||||
<el-table :data="examDetails.examDefinitionRulesVOList" border show-summary>
|
<el-table :data="examDetails.examDefinitionRulesVOList" border show-summary>
|
||||||
<el-table-column prop="name" label="实训类型" width="180">
|
<el-table-column prop="name" label="实训类型" width="180" />
|
||||||
</el-table-column>
|
<el-table-column prop="num" label="题数" />
|
||||||
<el-table-column prop="num" label="题数">
|
<el-table-column prop="point" label="分值" />
|
||||||
</el-table-column>
|
<el-table-column prop="chapterIdLong" label="总分" />
|
||||||
<el-table-column prop="point" label="分值">
|
</el-table>
|
||||||
</el-table-column>
|
</p>
|
||||||
<el-table-column prop="chapterIdLong" label="总分">
|
</span>
|
||||||
</el-table-column>
|
</p>
|
||||||
</el-table>
|
</el-scrollbar>
|
||||||
</p>
|
</div>
|
||||||
</span>
|
<div class="btn-start">
|
||||||
</p>
|
<el-button type="primary" @click="exmaStart">开始考试</el-button>
|
||||||
</el-scrollbar>
|
</div>
|
||||||
</div>
|
</el-card>
|
||||||
<div class="btn-start">
|
|
||||||
<el-button type="primary" @click="exmaStart">开始考试</el-button>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { examNotify } from '@/api/simulation';
|
import { examNotify } from '@/api/simulation';
|
||||||
import { getExamLessonDetail } from '@/api/management/exam';
|
import { getExamLessonDetail } from '@/api/management/exam';
|
||||||
import { generateExamList } from '@/api/management/userexam';
|
import { generateExamList } from '@/api/management/userexam';
|
||||||
import { getPublishLessonDetail } from "@/api/jmap/lesson";
|
import { getPublishLessonDetail } from '@/api/jmap/lesson';
|
||||||
import { PermissionType } from '@/scripts/ConstDic';
|
import { PermissionType } from '@/scripts/ConstDic';
|
||||||
import { getDetailList } from '@/api/management/dictionary';
|
import { getDetailList } from '@/api/management/dictionary';
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import { launchFullscreen } from '@/utils/screen';
|
import { launchFullscreen } from '@/utils/screen';
|
||||||
import { UrlConfig } from '@/router/index';
|
import { UrlConfig } from '@/router/index';
|
||||||
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
|
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ExamDetailView',
|
name: 'ExamDetailView',
|
||||||
mixins: [
|
mixins: [
|
||||||
WindowResizeHandler
|
WindowResizeHandler
|
||||||
],
|
],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
height: '',
|
height: '',
|
||||||
examDetails: {
|
examDetails: {
|
||||||
lessonId: '',
|
lessonId: '',
|
||||||
name: '',
|
name: '',
|
||||||
remarks: '',
|
remarks: '',
|
||||||
examDefinitionRulesVOList: [],
|
examDefinitionRulesVOList: [],
|
||||||
startTime: '',
|
startTime: '',
|
||||||
endTime: '',
|
endTime: '',
|
||||||
fullPoint: '',
|
fullPoint: '',
|
||||||
passingPoint: '',
|
passingPoint: '',
|
||||||
duration: '',
|
duration: '',
|
||||||
type: '',
|
type: ''
|
||||||
},
|
},
|
||||||
typeList: [],
|
typeList: [],
|
||||||
examList: [],
|
examList: [],
|
||||||
trainingOperateTypeMap: {},
|
trainingOperateTypeMap: {}
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'$route.params.examId': function (val) {
|
'$route.params.examId': function (val) {
|
||||||
this.loadInitPage(val);
|
this.loadInitPage(val);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters('trainingList', [
|
...mapGetters('trainingList', [
|
||||||
'trainingList'
|
'trainingList'
|
||||||
]),
|
])
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
this.trainingOperateTypeMap = {};
|
this.trainingOperateTypeMap = {};
|
||||||
this.$Dictionary.stationControl().then(list => {
|
this.$Dictionary.stationControl().then(list => {
|
||||||
this.trainingOperateTypeMap['01'] = list; //控制权实训
|
this.trainingOperateTypeMap['01'] = list; // 控制权实训
|
||||||
});
|
});
|
||||||
this.$Dictionary.signalOperation().then(list => {
|
this.$Dictionary.signalOperation().then(list => {
|
||||||
this.trainingOperateTypeMap['02'] = list; //信号机实训
|
this.trainingOperateTypeMap['02'] = list; // 信号机实训
|
||||||
});
|
});
|
||||||
this.$Dictionary.switchOperation().then(list => {
|
this.$Dictionary.switchOperation().then(list => {
|
||||||
this.trainingOperateTypeMap['03'] = list; //道岔实训
|
this.trainingOperateTypeMap['03'] = list; // 道岔实训
|
||||||
});
|
});
|
||||||
this.$Dictionary.sectionOperation().then(list => {
|
this.$Dictionary.sectionOperation().then(list => {
|
||||||
this.trainingOperateTypeMap['04'] = list; //区段实训
|
this.trainingOperateTypeMap['04'] = list; // 区段实训
|
||||||
});
|
});
|
||||||
this.$Dictionary.stationStandOperation().then(list => {
|
this.$Dictionary.stationStandOperation().then(list => {
|
||||||
this.trainingOperateTypeMap['05'] = list; //站台实训
|
this.trainingOperateTypeMap['05'] = list; // 站台实训
|
||||||
});
|
});
|
||||||
this.$Dictionary.trainPlanOperation().then(list => {
|
this.$Dictionary.trainPlanOperation().then(list => {
|
||||||
this.trainingOperateTypeMap['06'] = list; //行车计划实训
|
this.trainingOperateTypeMap['06'] = list; // 行车计划实训
|
||||||
});
|
});
|
||||||
this.$Dictionary.trainOperation().then(list => {
|
this.$Dictionary.trainOperation().then(list => {
|
||||||
this.trainingOperateTypeMap['07'] = list; //列车实训
|
this.trainingOperateTypeMap['07'] = list; // 列车实训
|
||||||
});
|
});
|
||||||
await this.getList();
|
await this.getList();
|
||||||
this.loadInitPage(this.$route.params.examId);
|
this.loadInitPage(this.$route.params.examId);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
resizeHandler: function () {
|
resizeHandler: function () {
|
||||||
this.height = this._clientHeight;
|
this.height = this._clientHeight;
|
||||||
},
|
},
|
||||||
async getList() {
|
async getList() {
|
||||||
this.typeList = [];
|
this.typeList = [];
|
||||||
await getDetailList('training_type').then(res => {
|
await getDetailList('training_type').then(res => {
|
||||||
this.typeList = res.data;
|
this.typeList = res.data;
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
reject(error);
|
reject(error);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async loadInitPage(examId) {
|
async loadInitPage(examId) {
|
||||||
if (examId) {
|
if (examId) {
|
||||||
let res = await getExamLessonDetail(examId);
|
const res = await getExamLessonDetail(examId);
|
||||||
this.examDetails = res.data
|
this.examDetails = res.data;
|
||||||
this.examDetails.examDefinitionRulesVOList.forEach((res, index) => {
|
this.examDetails.examDefinitionRulesVOList.forEach((res, index) => {
|
||||||
res.chapterIdLong = Number(res.num) * Number(res.point)
|
res.chapterIdLong = Number(res.num) * Number(res.point);
|
||||||
this.typeList.forEach(v => {
|
this.typeList.forEach(v => {
|
||||||
if (res.trainingType == v.code) {
|
if (res.trainingType == v.code) {
|
||||||
this.examDetails.examDefinitionRulesVOList[index].name = v.name;
|
this.examDetails.examDefinitionRulesVOList[index].name = v.name;
|
||||||
if (res.operateType) {
|
if (res.operateType) {
|
||||||
this.trainingOperateTypeMap[res.trainingType].forEach(item => {
|
this.trainingOperateTypeMap[res.trainingType].forEach(item => {
|
||||||
if (item.code == res.operateType) {
|
if (item.code == res.operateType) {
|
||||||
this.examDetails.examDefinitionRulesVOList[index].name = `${this.examDetails.examDefinitionRulesVOList[index].name}-${item.name}`;
|
this.examDetails.examDefinitionRulesVOList[index].name = `${this.examDetails.examDefinitionRulesVOList[index].name}-${item.name}`;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
let resp = await generateExamList(this.examDetails.id)
|
const resp = await generateExamList(this.examDetails.id);
|
||||||
this.examList = resp.data.userExamQuestionsVOs;
|
this.examList = resp.data.userExamQuestionsVOs;
|
||||||
this.userExam = resp.data;
|
this.userExam = resp.data;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buy() {
|
buy() {
|
||||||
getPublishLessonDetail({ id: this.examDetails.lessonId }).then((res) => {
|
getPublishLessonDetail({ id: this.examDetails.lessonId }).then((res) => {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: `${UrlConfig.exam.pay}/${this.examDetails.lessonId}`,
|
path: `${UrlConfig.exam.pay}/${this.examDetails.lessonId}`,
|
||||||
query: { permissionType: PermissionType.EXAM, prdCode: res.data.prdCode, mapId: res.data.mapId }
|
query: { permissionType: PermissionType.EXAM, prdCode: res.data.prdCode, mapId: res.data.mapId }
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
async examDetail() {
|
async examDetail() {
|
||||||
let data = this.examDetails
|
const data = this.examDetails;
|
||||||
try {
|
try {
|
||||||
let response = await generateExamList(data.id)
|
const response = await generateExamList(data.id);
|
||||||
this.userExam = response.data;
|
this.userExam = response.data;
|
||||||
let list = response.data.userExamQuestionsVOs;
|
const list = response.data.userExamQuestionsVOs;
|
||||||
await this.$store.dispatch('exam/start')
|
await this.$store.dispatch('exam/start');
|
||||||
await this.$store.dispatch('exam/setUsedTime', this.userExam.usedTime);
|
await this.$store.dispatch('exam/setUsedTime', this.userExam.usedTime);
|
||||||
await this.$store.dispatch('exam/setTotalTime', this.userExam.duration);
|
await this.$store.dispatch('exam/setTotalTime', this.userExam.duration);
|
||||||
await this.$store.dispatch('trainingList/setTrainingList', list);
|
await this.$store.dispatch('trainingList/setTrainingList', list);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.loading.close();
|
this.loading.close();
|
||||||
//判断是否有考试权限,如果没有权限则跳到购买页面,否则报错
|
// 判断是否有考试权限,如果没有权限则跳到购买页面,否则报错
|
||||||
if (error.code === 500004) {
|
if (error.code === 500004) {
|
||||||
this.$confirm('无此课程的考试权限,请前往购买!', '提示', {
|
this.$confirm('无此课程的考试权限,请前往购买!', '提示', {
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
center: true
|
center: true
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.buy();
|
this.buy();
|
||||||
}).catch(() => { });
|
}).catch(() => { });
|
||||||
} else if (error.code === 500005) {
|
} else if (error.code === 500005) {
|
||||||
this.$messageBox('不在考试范围之内');
|
this.$messageBox('不在考试范围之内');
|
||||||
} else {
|
} else {
|
||||||
this.$messageBox(`${error.message}`);
|
this.$messageBox(`${error.message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
exmaStart() {
|
exmaStart() {
|
||||||
const loading = this.$loading({
|
this.loading = this.$loading({
|
||||||
lock: true,
|
lock: true,
|
||||||
text: 'Loading',
|
text: 'Loading',
|
||||||
spinner: 'el-icon-loading',
|
spinner: 'el-icon-loading',
|
||||||
background: 'rgba(0, 0, 0, 0.7)'
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
});
|
});
|
||||||
this.examDetail();
|
this.examDetail();
|
||||||
if (this.examList.length) {
|
if (this.examList.length) {
|
||||||
examNotify({ examId: this.$route.params.examId }).then(resp => {
|
examNotify({ examId: this.$route.params.examId }).then(resp => {
|
||||||
let query = {
|
const query = {
|
||||||
group: resp.data,
|
group: resp.data,
|
||||||
trainingId: this.examList[0].trainingId,
|
trainingId: this.examList[0].trainingId,
|
||||||
userExamId: this.userExam.id,
|
userExamId: this.userExam.id,
|
||||||
examQuestionId: this.examList[0].id
|
examQuestionId: this.examList[0].id
|
||||||
};
|
};
|
||||||
this.$router.push({ path: `${UrlConfig.display}/exam`, query: query });
|
this.$router.push({ path: `${UrlConfig.display}/exam`, query: query });
|
||||||
launchFullscreen();
|
launchFullscreen();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.$messageBox(`创建仿真失败: ${error.message}`);
|
this.$messageBox(`创建仿真失败: ${error.message}`);
|
||||||
this.loading.close();
|
this.loading.close();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
@import "src/styles/mixin.scss";
|
@import "src/styles/mixin.scss";
|
||||||
|
@ -1,279 +1,300 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-card class="map-list-main" v-loading="loading">
|
<el-card v-loading="loading" class="map-list-main">
|
||||||
<div slot="header" class="clearfix">
|
<div slot="header" class="clearfix">
|
||||||
<span>草稿地图列表</span>
|
<span>草稿地图列表</span>
|
||||||
<el-button type="text" @click="createMap" style="float: right; padding: 3px 0">新建</el-button>
|
<el-button type="text" style="float: right; padding: 3px 0" @click="createMap">新建</el-button>
|
||||||
<!-- <el-button type="text" v-if="$route.params.mapId != 0" @click="doExportFront" style="float: right; padding: 3px 0; margin-right: 9px;">导出地图</el-button> -->
|
<!-- <el-button type="text" v-if="$route.params.mapId != 0" @click="doExportFront" style="float: right; padding: 3px 0; margin-right: 9px;">导出地图</el-button> -->
|
||||||
<el-button type="text" class="uploadDemo">
|
<el-button type="text" class="uploadDemo">
|
||||||
<input type="file" @change="importf" ref="files" class="file_box"
|
<input
|
||||||
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" />
|
ref="files"
|
||||||
导入地图
|
type="file"
|
||||||
</el-button>
|
class="file_box"
|
||||||
</div>
|
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
|
||||||
<el-scrollbar wrapClass="scrollbar-wrapper" :style="{height: height + 'px'}">
|
@change="importf"
|
||||||
<el-tree ref="tree" :data="mapList" node-key="id" highlight-current :props="defaultProps"
|
>
|
||||||
@node-click="handleNodeClick" @node-contextmenu="showContextMenu" class="tree-height-max">
|
导入地图
|
||||||
<span slot-scope="{ node, data }">
|
</el-button>
|
||||||
<span v-if="node.data.type == 'skin'" class="el-icon-news"> {{ node.label }}</span>
|
</div>
|
||||||
<span v-if="node.data.type == 'map'" class="el-icon-edit-outline"> {{ node.label }}</span>
|
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height + 'px'}">
|
||||||
</span>
|
<el-tree
|
||||||
</el-tree>
|
ref="tree"
|
||||||
</el-scrollbar>
|
:data="mapList"
|
||||||
<map-create ref="mapCreate" @refresh="refresh" :skinCode="skinCode" @editmap="handleNodeClick"></map-create>
|
node-key="id"
|
||||||
<map-operate-menu ref="menu" :point="point" :editModel="editModel" @editRoute="editRoute" @setSwitch="setSwitch"
|
highlight-current
|
||||||
@editMap="handleNodeClick" @pathUnit="pathUnit" @refresh="refresh"></map-operate-menu>
|
:props="defaultProps"
|
||||||
|
class="tree-height-max"
|
||||||
|
@node-click="handleNodeClick"
|
||||||
|
@node-contextmenu="showContextMenu"
|
||||||
|
>
|
||||||
|
<span slot-scope="{ node, data }">
|
||||||
|
<span v-if="node.data.type == 'skin'" class="el-icon-news"> {{ node.label }}</span>
|
||||||
|
<span v-if="node.data.type == 'map'" class="el-icon-edit-outline"> {{ 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"
|
||||||
|
@editRoute="editRoute"
|
||||||
|
@setSwitch="setSwitch"
|
||||||
|
@editMap="handleNodeClick"
|
||||||
|
@pathUnit="pathUnit"
|
||||||
|
@refresh="refresh"
|
||||||
|
/>
|
||||||
|
|
||||||
</el-card>
|
</el-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { DeviceMenu } from '@/scripts/ConstDic';
|
import { DeviceMenu } from '@/scripts/ConstDic';
|
||||||
import { deleteMap, listMap, getMapTree, newMap, publishMap, editMap, saveAsMap, getMapDetail, postBuildMapImport } from '@/api/jmap/mapdraft'
|
import { deleteMap, listMap, getMapTree, newMap, publishMap, editMap, saveAsMap, getMapDetail, postBuildMapImport } from '@/api/jmap/mapdraft';
|
||||||
import PopMenu from '@/components/PopMenu';
|
import PopMenu from '@/components/PopMenu';
|
||||||
import MapOperateMenu from './operateMenu';
|
import MapOperateMenu from './operateMenu';
|
||||||
import MapCreate from './create';
|
import MapCreate from './create';
|
||||||
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
|
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
|
||||||
import XLSX from 'xlsx';
|
import XLSX from 'xlsx';
|
||||||
import { translate, translateSheetTitle } from '@/scripts/translate';
|
import { translate, translateSheetTitle } from '@/scripts/translate';
|
||||||
import { sheet_to_json } from '@/utils/Export2Excel';
|
import { sheet_to_json } from '@/utils/Export2Excel';
|
||||||
import localStore from 'storejs';
|
import localStore from 'storejs';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'MapListDraft',
|
name: 'MapListDraft',
|
||||||
components: {
|
components: {
|
||||||
PopMenu,
|
PopMenu,
|
||||||
MapCreate,
|
MapCreate,
|
||||||
MapOperateMenu
|
MapOperateMenu
|
||||||
},
|
},
|
||||||
mixins: [WindowResizeHandler],
|
mixins: [WindowResizeHandler],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
height: 0,
|
height: 0,
|
||||||
loading: true,
|
loading: true,
|
||||||
activeName: 'first',
|
activeName: 'first',
|
||||||
mapList: [],
|
mapList: [],
|
||||||
defaultProps: {
|
defaultProps: {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'name'
|
label: 'name'
|
||||||
},
|
},
|
||||||
editModel: {},
|
editModel: {},
|
||||||
skinCode: '',
|
skinCode: '',
|
||||||
point: {
|
point: {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0
|
y: 0
|
||||||
},
|
}
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
resizeHandler() {
|
resizeHandler() {
|
||||||
this.height = this._clientHeight - 115;
|
this.height = this._clientHeight - 115;
|
||||||
},
|
},
|
||||||
getSkinStyle(node) {
|
getSkinStyle(node) {
|
||||||
let next = node;
|
let next = node;
|
||||||
while (next) {
|
while (next) {
|
||||||
if (next.data && next.data.type == 'skin') {
|
if (next.data && next.data.type == 'skin') {
|
||||||
this.skinCode = next.data.id;
|
this.skinCode = next.data.id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
next = next.parent;
|
next = next.parent;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showContextMenu(e, obj, node, vueElem) {
|
showContextMenu(e, obj, node, vueElem) {
|
||||||
if (obj && obj.type == 'map') {
|
if (obj && obj.type == 'map') {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let menu = DeviceMenu.Map;
|
const menu = DeviceMenu.Map;
|
||||||
|
|
||||||
this.point = {
|
this.point = {
|
||||||
x: e.clientX,
|
x: e.clientX,
|
||||||
y: e.clientY
|
y: e.clientY
|
||||||
}
|
};
|
||||||
this.editModel = obj;
|
this.editModel = obj;
|
||||||
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
|
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleNodeClick(obj, node) {
|
handleNodeClick(obj, node) {
|
||||||
this.getSkinStyle(node);
|
this.getSkinStyle(node);
|
||||||
if (obj && obj.type == 'map') {
|
if (obj && obj.type == 'map') {
|
||||||
this.$store.dispatch('menuOperation/setPopMenu', { position: null, menu: null });
|
this.$store.dispatch('menuOperation/setPopMenu', { position: null, menu: null });
|
||||||
this.$emit('mapSelected', { mapInfo: obj, view: 'draft' });
|
this.$emit('mapSelected', { mapInfo: obj, view: 'draft' });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
editRoute() {
|
editRoute() {
|
||||||
this.$emit('mapSelected', { mapInfo: this.editModel, view: 'route' });
|
this.$emit('mapSelected', { mapInfo: this.editModel, view: 'route' });
|
||||||
},
|
},
|
||||||
setSwitch() {
|
setSwitch() {
|
||||||
this.$emit('mapSelected', { mapInfo: this.editModel, view: 'swtich' });
|
this.$emit('mapSelected', { mapInfo: this.editModel, view: 'swtich' });
|
||||||
},
|
},
|
||||||
pathUnit() {
|
pathUnit() {
|
||||||
this.$emit('mapSelected', { mapInfo: this.editModel, view: 'path' });
|
this.$emit('mapSelected', { mapInfo: this.editModel, view: 'path' });
|
||||||
},
|
},
|
||||||
createMap() {
|
createMap() {
|
||||||
this.$refs.mapCreate.show();
|
this.$refs.mapCreate.show();
|
||||||
},
|
},
|
||||||
refresh() {
|
refresh() {
|
||||||
this.mapList = [];
|
this.mapList = [];
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
getMapTree().then(response => {
|
getMapTree().then(response => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.mapList = response.data;
|
this.mapList = response.data;
|
||||||
this.$refs.tree.setCurrentKey(this.$route.params.mapId); // value 绑定的node-key
|
this.$refs.tree.setCurrentKey(this.$route.params.mapId); // value 绑定的node-key
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.$messageBox('刷新树级列表失败');
|
this.$messageBox('刷新树级列表失败');
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
importf() {//导入
|
importf() { // 导入
|
||||||
const loading = this.$loading({
|
const loading = this.$loading({
|
||||||
lock: true,
|
lock: true,
|
||||||
text: '正在导入中...',
|
text: '正在导入中...',
|
||||||
spinner: 'el-icon-loading',
|
spinner: 'el-icon-loading',
|
||||||
background: 'rgba(0, 0, 0, 0.7)'
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
});
|
});
|
||||||
let obj = this.$refs.files;
|
const obj = this.$refs.files;
|
||||||
let wb;
|
let wb;
|
||||||
if (!obj.files) return;
|
if (!obj.files) return;
|
||||||
let f = obj.files[0];
|
const f = obj.files[0];
|
||||||
let reader = new FileReader();
|
const reader = new FileReader();
|
||||||
const that = this;
|
const that = this;
|
||||||
reader.onload = function (e) {
|
reader.onload = function (e) {
|
||||||
let data = e.target.result;
|
const data = e.target.result;
|
||||||
if (that.rABS) {
|
if (that.rABS) {
|
||||||
wb = XLSX.read(btoa(that.fixdata(data)), {//手动转化
|
wb = XLSX.read(btoa(that.fixdata(data)), {// 手动转化
|
||||||
type: 'base64'
|
type: 'base64'
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
wb = XLSX.read(data, {
|
wb = XLSX.read(data, {
|
||||||
type: 'binary'
|
type: 'binary'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let resultJSONData = { 'devices': {} };
|
const resultJSONData = { 'devices': {} };
|
||||||
for (let index in wb.Sheets) {
|
for (const index in wb.Sheets) {
|
||||||
|
|
||||||
let titleNum = that.formatSheetTitle(index);
|
const titleNum = that.formatSheetTitle(index);
|
||||||
let key = translateSheetTitle.sheetName[titleNum];
|
const key = translateSheetTitle.sheetName[titleNum];
|
||||||
|
|
||||||
let filterVal = that.handelData(key);
|
const filterVal = that.handelData(key);
|
||||||
let jsonData = sheet_to_json(wb.Sheets[index])
|
const jsonData = sheet_to_json(wb.Sheets[index]);
|
||||||
let data = that.formatJson(filterVal, jsonData, key);
|
const data = that.formatJson(filterVal, jsonData, key);
|
||||||
if (key === 'base') {
|
if (key === 'base') {
|
||||||
Object.assign(resultJSONData, data[0]);
|
Object.assign(resultJSONData, data[0]);
|
||||||
} else if (key === 'skinVO') {
|
} else if (key === 'skinVO') {
|
||||||
resultJSONData['devices'][key] = data[0];
|
resultJSONData['devices'][key] = data[0];
|
||||||
} else {
|
} else {
|
||||||
resultJSONData['devices'][key] = data;
|
resultJSONData['devices'][key] = data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
that.resultJSON = resultJSONData;
|
that.resultJSON = resultJSONData;
|
||||||
if (that.resultJSON) {
|
if (that.resultJSON) {
|
||||||
postBuildMapImport(that.resultJSON).then(res => {
|
postBuildMapImport(that.resultJSON).then(res => {
|
||||||
loading.close();
|
loading.close();
|
||||||
that.$message.success('导入成功!');
|
that.$message.success('导入成功!');
|
||||||
that.refresh();
|
that.refresh();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
loading.close();
|
loading.close();
|
||||||
that.$message.error('导入失败' + error.message);
|
that.$message.error('导入失败' + error.message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
obj.value = ''; // 清空上次导入文件
|
obj.value = ''; // 清空上次导入文件
|
||||||
};
|
};
|
||||||
if (that.rABS) {
|
if (that.rABS) {
|
||||||
reader.readAsArrayBuffer(f);
|
reader.readAsArrayBuffer(f);
|
||||||
} else {
|
} else {
|
||||||
reader.readAsBinaryString(f);
|
reader.readAsBinaryString(f);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 转换数据格式
|
// 转换数据格式
|
||||||
handelData(key) {
|
handelData(key) {
|
||||||
let tHeader = [];
|
const tHeader = [];
|
||||||
let tHeaderF = [];
|
const tHeaderF = [];
|
||||||
if (translate[key]) {
|
if (translate[key]) {
|
||||||
translate[key].columns.forEach(item => {
|
translate[key].columns.forEach(item => {
|
||||||
tHeader.push(item.tHeader);
|
tHeader.push(item.tHeader);
|
||||||
tHeaderF.push(item.key);
|
tHeaderF.push(item.key);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let filterVal = {
|
const filterVal = {
|
||||||
tHeader: tHeader,
|
tHeader: tHeader,
|
||||||
tHeaderF: tHeaderF,
|
tHeaderF: tHeaderF
|
||||||
};
|
};
|
||||||
return filterVal;
|
return filterVal;
|
||||||
},
|
},
|
||||||
//文件流转BinaryString
|
// 文件流转BinaryString
|
||||||
fixdata(data) {
|
fixdata(data) {
|
||||||
var o = "",
|
var o = '';
|
||||||
l = 0,
|
var l = 0;
|
||||||
w = 10240;
|
var w = 10240;
|
||||||
for (; l < data.byteLength / w; ++l) o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w, l * w + w)));
|
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)));
|
o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w)));
|
||||||
return o;
|
return o;
|
||||||
},
|
},
|
||||||
// 转换属性名称 格式
|
// 转换属性名称 格式
|
||||||
formatJson(filterVal, jsonData, key) {
|
formatJson(filterVal, jsonData, key) {
|
||||||
jsonData.map((item, index) => {
|
jsonData.map((item, index) => {
|
||||||
let json = {};
|
const json = {};
|
||||||
filterVal.tHeader.map((j, o) => {
|
filterVal.tHeader.map((j, o) => {
|
||||||
if (item[j] != undefined) {
|
if (item[j] != undefined) {
|
||||||
json[filterVal.tHeaderF[o]] = translate[key].columns[o].formatter(item[j]);
|
json[filterVal.tHeaderF[o]] = translate[key].columns[o].formatter(item[j]);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
jsonData.splice(index, 1, json);
|
jsonData.splice(index, 1, json);
|
||||||
})
|
});
|
||||||
return jsonData;
|
return jsonData;
|
||||||
},
|
},
|
||||||
// 转换sheet名字
|
// 转换sheet名字
|
||||||
formatSheetTitle(title) {
|
formatSheetTitle(title) {
|
||||||
let index;
|
let index;
|
||||||
translateSheetTitle.sheetTitle.forEach((v, i) => {
|
translateSheetTitle.sheetTitle.forEach((v, i) => {
|
||||||
if (title == v) index = i;
|
if (title == v) index = i;
|
||||||
})
|
});
|
||||||
return index;
|
return index;
|
||||||
},
|
},
|
||||||
|
|
||||||
// 前端方式导出
|
// 前端方式导出
|
||||||
async doExportFront() {
|
async doExportFront() {
|
||||||
let res = await getMapDetail(this.$route.params.mapId);
|
const res = await getMapDetail(this.$route.params.mapId);
|
||||||
let resultData = res.data;
|
const resultData = res.data;
|
||||||
if (resultData === false) {
|
if (resultData === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let self = this;
|
const self = this;
|
||||||
import('@/utils/Export2Excel').then(excel => {
|
import('@/utils/Export2Excel').then(excel => {
|
||||||
self.queryExportData(resultData).then(data => {
|
self.queryExportData(resultData).then(data => {
|
||||||
excel.export_json_excel(data, resultData.name);
|
excel.export_json_excel(data, resultData.name);
|
||||||
|
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
self.$message.error('导出执行异常:' + error.message);
|
self.$message.error('导出执行异常:' + error.message);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 格式化数据列表
|
// 格式化数据列表
|
||||||
queryExportData(data) {
|
queryExportData(data) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let result = {
|
const result = {
|
||||||
base: [],
|
base: []
|
||||||
};
|
};
|
||||||
let obj = {};
|
const obj = {};
|
||||||
for (let i in data) {
|
for (const i in data) {
|
||||||
if (typeof data[i] != 'object') {
|
if (typeof data[i] != 'object') {
|
||||||
obj[i] = data[i];
|
obj[i] = data[i];
|
||||||
} else if (data[i] instanceof Array) {
|
} else if (data[i] instanceof Array) {
|
||||||
if (data[i].length) {
|
if (data[i].length) {
|
||||||
result[i] = [...data[i]];
|
result[i] = [...data[i]];
|
||||||
}
|
}
|
||||||
} else if (data[i] instanceof Object) {
|
} else if (data[i] instanceof Object) {
|
||||||
obj[i] = data[i];
|
obj[i] = data[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.base.push(obj);
|
result.base.push(obj);
|
||||||
resolve(result);
|
resolve(result);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped rel="stylesheet/scss" lang="scss">
|
<style scoped rel="stylesheet/scss" lang="scss">
|
||||||
.uploadDemo {
|
.uploadDemo {
|
||||||
|
@ -1,213 +1,223 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="card-box">
|
<div class="card-box">
|
||||||
<el-steps class="steps" :active="display">
|
<el-steps class="steps" :active="display">
|
||||||
<el-step :title="title" icon="el-icon-edit-outline"></el-step>
|
<el-step :title="title" icon="el-icon-edit-outline" />
|
||||||
<el-step title="" icon="el-icon-upload"></el-step>
|
<el-step title="" icon="el-icon-upload" />
|
||||||
</el-steps>
|
</el-steps>
|
||||||
<el-card class="forms">
|
<el-card class="forms">
|
||||||
<el-scrollbar wrapClass="scrollbar-wrapper" :style="{height:height-160 + 'px'}" style="padding-top: 40px">
|
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height:height-160 + 'px'}" style="padding-top: 40px">
|
||||||
<el-form ref="form" :model="courseModel" :rules="rules" label-width="135px">
|
<el-form ref="form" :model="courseModel" :rules="rules" label-width="135px">
|
||||||
<el-form-item label="课程名称:" prop="name">
|
<el-form-item label="课程名称:" prop="name">
|
||||||
<el-input v-model="courseModel.name"></el-input>
|
<el-input v-model="courseModel.name" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="关联皮肤:" prop="skinCode">
|
<el-form-item label="关联皮肤:" prop="skinCode">
|
||||||
<el-select v-model="courseModel.skinCode" placeholder="请选择" :disabled="true">
|
<el-select v-model="courseModel.skinCode" placeholder="请选择" :disabled="true">
|
||||||
<el-option v-for="(item,index) in skinStyleList" :key="index" :label="item.name"
|
<el-option
|
||||||
:value="item.code"></el-option>
|
v-for="(item,index) in skinStyleList"
|
||||||
</el-select>
|
:key="index"
|
||||||
</el-form-item>
|
:label="item.name"
|
||||||
<el-form-item label="关联产品:" prop="prdCode">
|
:value="item.code"
|
||||||
<el-select v-model="courseModel.prdCode" placeholder="请选择" :disabled="isEdit">
|
/>
|
||||||
<el-option v-for="(item,index) in productList" :key="index" :label="item.name"
|
</el-select>
|
||||||
:value="item.code"></el-option>
|
</el-form-item>
|
||||||
</el-select>
|
<el-form-item label="关联产品:" prop="prdCode">
|
||||||
</el-form-item>
|
<el-select v-model="courseModel.prdCode" placeholder="请选择" :disabled="isEdit">
|
||||||
<el-form-item label="课程说明:" prop="remarks">
|
<el-option
|
||||||
<el-input type="textarea" :autosize="{ minRows: 6, maxRows: 6}" placeholder="请输入内容"
|
v-for="(item,index) in productList"
|
||||||
v-model="courseModel.remarks">
|
:key="index"
|
||||||
</el-input>
|
:label="item.name"
|
||||||
</el-form-item>
|
:value="item.code"
|
||||||
</el-form>
|
/>
|
||||||
</el-scrollbar>
|
</el-select>
|
||||||
</el-card>
|
</el-form-item>
|
||||||
<div class="draft">
|
<el-form-item label="课程说明:" prop="remarks">
|
||||||
<el-button-group>
|
<el-input
|
||||||
<template v-if="!isEdit">
|
v-model="courseModel.remarks"
|
||||||
<el-button type="primary" @click="create" v-if="courseModel.skinCode">创建</el-button>
|
type="textarea"
|
||||||
</template>
|
:autosize="{ minRows: 6, maxRows: 6}"
|
||||||
<template v-else>
|
placeholder="请输入内容"
|
||||||
<el-button type="primary" @click="update">更新</el-button>
|
/>
|
||||||
<el-button type="primary" @click="publish">发布</el-button>
|
</el-form-item>
|
||||||
<el-button type="danger" @click="deleteLesson">删除</el-button>
|
</el-form>
|
||||||
</template>
|
</el-scrollbar>
|
||||||
</el-button-group>
|
</el-card>
|
||||||
</div>
|
<div class="draft">
|
||||||
<publish-lesson ref="publishLesson"></publish-lesson>
|
<el-button-group>
|
||||||
|
<template v-if="!isEdit">
|
||||||
|
<el-button v-if="courseModel.skinCode" type="primary" @click="create">创建</el-button>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<el-button type="primary" @click="update">更新</el-button>
|
||||||
|
<el-button type="primary" @click="publish">发布</el-button>
|
||||||
|
<el-button type="danger" @click="deleteLesson">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-button-group>
|
||||||
</div>
|
</div>
|
||||||
|
<publish-lesson ref="publishLesson" />
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { createLesson, updateLesson, getLessonDetail, delLesson } from '@/api/jmap/lessondraft'
|
import { createLesson, updateLesson, getLessonDetail, delLesson } from '@/api/jmap/lessondraft';
|
||||||
import { getCommodityMapProduct } from '@/api/management/mapprd';
|
import { getCommodityMapProduct } from '@/api/management/mapprd';
|
||||||
import { listPublishMap, getPublishMapInfo } from '@/api/jmap/map';
|
import { getSkinStyleList } from '@/api/management/mapskin';
|
||||||
import { getSkinStyleList } from '@/api/management/mapskin';
|
import PublishLesson from './publish';
|
||||||
import localStore from 'storejs';
|
|
||||||
import PublishLesson from './publish';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'courseEdit',
|
name: 'CourseEdit',
|
||||||
props: {
|
components: {
|
||||||
height: {
|
PublishLesson
|
||||||
type: Number
|
},
|
||||||
}
|
props: {
|
||||||
},
|
height: {
|
||||||
components: {
|
type: Number,
|
||||||
PublishLesson
|
required: true
|
||||||
},
|
}
|
||||||
data() {
|
},
|
||||||
return {
|
data() {
|
||||||
isEdit: false,
|
return {
|
||||||
display: 1,
|
isEdit: false,
|
||||||
productList: [],
|
display: 1,
|
||||||
skinStyleList: [],
|
productList: [],
|
||||||
courseModel: {
|
skinStyleList: [],
|
||||||
id: '',
|
courseModel: {
|
||||||
prdCode: '',
|
id: '',
|
||||||
product: [],
|
prdCode: '',
|
||||||
skinCode: '',
|
product: [],
|
||||||
name: '',
|
skinCode: '',
|
||||||
remarks: '',
|
name: '',
|
||||||
}
|
remarks: ''
|
||||||
}
|
}
|
||||||
},
|
};
|
||||||
computed: {
|
},
|
||||||
title() {
|
computed: {
|
||||||
return this.isEdit ? '编辑课程' : '创建课程';
|
title() {
|
||||||
},
|
return this.isEdit ? '编辑课程' : '创建课程';
|
||||||
rules() {
|
},
|
||||||
let baseRules = {
|
rules() {
|
||||||
name: [
|
const baseRules = {
|
||||||
{ required: true, message: '请输入课程名称', trigger: 'change' }
|
name: [
|
||||||
],
|
{ required: true, message: '请输入课程名称', trigger: 'change' }
|
||||||
skinCode: [
|
],
|
||||||
{ required: true, message: '请选择皮肤类型', trigger: 'change' }
|
skinCode: [
|
||||||
],
|
{ required: true, message: '请选择皮肤类型', trigger: 'change' }
|
||||||
prdCode: [
|
],
|
||||||
{ required: true, message: '请选择关联产品', trigger: 'change' }
|
prdCode: [
|
||||||
],
|
{ required: true, message: '请选择关联产品', trigger: 'change' }
|
||||||
remarks: [
|
],
|
||||||
{ required: true, message: '请输入课程说明', trigger: 'change' }
|
remarks: [
|
||||||
],
|
{ required: true, message: '请输入课程说明', trigger: 'change' }
|
||||||
}
|
]
|
||||||
return baseRules;
|
};
|
||||||
}
|
return baseRules;
|
||||||
},
|
}
|
||||||
mounted() {
|
},
|
||||||
this.skinStyleList = [];
|
mounted() {
|
||||||
getSkinStyleList().then(response => {
|
this.skinStyleList = [];
|
||||||
this.skinStyleList = response.data;
|
getSkinStyleList().then(response => {
|
||||||
})
|
this.skinStyleList = response.data;
|
||||||
},
|
});
|
||||||
methods: {
|
},
|
||||||
initData(isNew, node) {
|
methods: {
|
||||||
this.isEdit = !isNew;
|
initData(isNew, node) {
|
||||||
this.clearForm();
|
this.isEdit = !isNew;
|
||||||
if (!isNew) {
|
this.clearForm();
|
||||||
this.refresh(node);
|
if (!isNew) {
|
||||||
} else {
|
this.refresh(node);
|
||||||
this.courseModel.skinCode = node.data.id;
|
} else {
|
||||||
}
|
this.courseModel.skinCode = node.data.id;
|
||||||
|
}
|
||||||
|
|
||||||
this.productList = [];
|
this.productList = [];
|
||||||
getCommodityMapProduct(this.getParentSkin(node)).then(response => {
|
getCommodityMapProduct(this.getParentSkin(node)).then(response => {
|
||||||
this.productList = response.data || [];
|
this.productList = response.data || [];
|
||||||
this.productList = this.productList.filter(elem => { return elem.prdType != '03' })
|
this.productList = this.productList.filter(elem => { return elem.prdType != '03'; });
|
||||||
})
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
clearForm() {
|
clearForm() {
|
||||||
this.courseModel.id = '';
|
this.courseModel.id = '';
|
||||||
this.$refs.form.resetFields();
|
this.$refs.form.resetFields();
|
||||||
},
|
},
|
||||||
create() {
|
create() {
|
||||||
this.$refs.form.validate((valid) => {
|
this.$refs.form.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
let model = {
|
const model = {
|
||||||
skinCode: this.courseModel.skinCode,
|
skinCode: this.courseModel.skinCode,
|
||||||
prdCode: this.courseModel.prdCode,
|
prdCode: this.courseModel.prdCode,
|
||||||
name: this.courseModel.name,
|
name: this.courseModel.name,
|
||||||
remarks: this.courseModel.remarks
|
remarks: this.courseModel.remarks
|
||||||
}
|
};
|
||||||
createLesson(model).then(response => {
|
createLesson(model).then(response => {
|
||||||
this.$emit('refresh');
|
this.$emit('refresh');
|
||||||
this.$message.success('创建成功');
|
this.$message.success('创建成功');
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.$messageBox('创建失败')
|
this.$messageBox('创建失败');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
update() {
|
update() {
|
||||||
this.$refs.form.validate((valid) => {
|
this.$refs.form.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
let model = {
|
const model = {
|
||||||
id: this.courseModel.id,
|
id: this.courseModel.id,
|
||||||
skinCode: this.courseModel.skinCode,
|
skinCode: this.courseModel.skinCode,
|
||||||
prdCode: this.courseModel.prdCode,
|
prdCode: this.courseModel.prdCode,
|
||||||
name: this.courseModel.name,
|
name: this.courseModel.name,
|
||||||
remarks: this.courseModel.remarks
|
remarks: this.courseModel.remarks
|
||||||
}
|
};
|
||||||
updateLesson(model).then(response => {
|
updateLesson(model).then(response => {
|
||||||
this.$emit('refresh');
|
this.$emit('refresh');
|
||||||
this.$message.success('更新成功');
|
this.$message.success('更新成功');
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.$messageBox('更新失败')
|
this.$messageBox('更新失败');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
publish() {
|
publish() {
|
||||||
this.$refs.publishLesson.doShow(this.courseModel);
|
this.$refs.publishLesson.doShow(this.courseModel);
|
||||||
},
|
},
|
||||||
deleteLesson() {
|
deleteLesson() {
|
||||||
delLesson(this.courseModel).then(response => {
|
delLesson(this.courseModel).then(response => {
|
||||||
this.$message.success('删除成功');
|
this.$message.success('删除成功');
|
||||||
this.$refs.form.resetFields();
|
this.$refs.form.resetFields();
|
||||||
this.isEdit = false,
|
this.isEdit = false,
|
||||||
this.$emit('refresh');
|
this.$emit('refresh');
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.$messageBox('删除失败');
|
this.$messageBox('删除失败');
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getParentSkin(node) {
|
getParentSkin(node) {
|
||||||
let next = node;
|
let next = node;
|
||||||
let skinCode = '';
|
let skinCode = '';
|
||||||
while (next) {
|
while (next) {
|
||||||
if (next.data && next.data.type == 'skin') {
|
if (next.data && next.data.type == 'skin') {
|
||||||
skinCode = next.data.id;
|
skinCode = next.data.id;
|
||||||
}
|
}
|
||||||
next = next.parent;
|
next = next.parent;
|
||||||
}
|
}
|
||||||
return skinCode;
|
return skinCode;
|
||||||
},
|
},
|
||||||
refresh(node) {
|
refresh(node) {
|
||||||
if (node && node.data) {
|
if (node && node.data) {
|
||||||
getLessonDetail(node.data).then(response => {
|
getLessonDetail(node.data).then(response => {
|
||||||
let data = response.data;
|
const data = response.data;
|
||||||
this.courseModel = {
|
this.courseModel = {
|
||||||
id: data.id,
|
id: data.id,
|
||||||
skinCode: this.getParentSkin(node),
|
skinCode: this.getParentSkin(node),
|
||||||
prdCode: data.prdCode,
|
prdCode: data.prdCode,
|
||||||
name: data.name,
|
name: data.name,
|
||||||
remarks: data.remarks,
|
remarks: data.remarks
|
||||||
};
|
};
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.$messageBox('获取课程信息失败')
|
this.$messageBox('获取课程信息失败');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
@ -263,4 +273,4 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 20px auto;
|
margin: 20px auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,317 +1,327 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="operation.title" :visible.sync="dialogShow" width="500px" :before-close="close">
|
<el-dialog :title="operation.title" :visible.sync="dialogShow" width="500px" :before-close="close">
|
||||||
<el-form ref="form" :model="operateModel" label-width="100px" :rules="rules" size="mini">
|
<el-form ref="form" :model="operateModel" label-width="100px" :rules="rules" size="mini">
|
||||||
<el-form-item label="皮肤类型:" prop="skinCode">
|
<el-form-item label="皮肤类型:" prop="skinCode">
|
||||||
<el-select v-model="operateModel.skinCode" @change="skinStyleChoose">
|
<el-select v-model="operateModel.skinCode" @change="skinStyleChoose">
|
||||||
<el-option v-for="option in skinStyleList" :key="option.code" :label="option.name"
|
<el-option
|
||||||
:value="option.code">
|
v-for="option in skinStyleList"
|
||||||
</el-option>
|
:key="option.code"
|
||||||
</el-select>
|
:label="option.name"
|
||||||
</el-form-item>
|
:value="option.code"
|
||||||
<el-form-item label="产品类型:" prop="prdCode">
|
/>
|
||||||
<el-select v-model="operateModel.prdCode" @change="prdChange">
|
</el-select>
|
||||||
<el-option v-for="option in productList" :key="option.code" :label="option.name"
|
</el-form-item>
|
||||||
:value="option.code">
|
<el-form-item label="产品类型:" prop="prdCode">
|
||||||
</el-option>
|
<el-select v-model="operateModel.prdCode" @change="prdChange">
|
||||||
</el-select>
|
<el-option
|
||||||
</el-form-item>
|
v-for="option in productList"
|
||||||
<el-form-item label="实训类型:" prop="type">
|
:key="option.code"
|
||||||
<el-select v-model="operateModel.type" @change="typeChange">
|
:label="option.name"
|
||||||
<el-option v-for="option in trainingTypeLists" :key="option.code" :label="option.name"
|
:value="option.code"
|
||||||
:value="option.code">
|
/>
|
||||||
</el-option>
|
</el-select>
|
||||||
</el-select>
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item label="实训类型:" prop="type">
|
||||||
<el-form-item label="操作类型:" prop="operateType">
|
<el-select v-model="operateModel.type" @change="typeChange">
|
||||||
<el-select v-model="operateModel.operateType" multiple>
|
<el-option
|
||||||
<el-option v-for="option in trainingTypeMap[operateModel.type]" :key="option.code"
|
v-for="option in trainingTypeLists"
|
||||||
:label="option.name" :value="option.code">
|
:key="option.code"
|
||||||
</el-option>
|
:label="option.name"
|
||||||
</el-select>
|
:value="option.code"
|
||||||
</el-form-item>
|
/>
|
||||||
<el-form-item label="最小用时:" prop="minDuration" v-if="isUpdate">
|
</el-select>
|
||||||
<el-input-number v-model="operateModel.minDuration" :min="0" :max="10000"></el-input-number>s
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item label="操作类型:" prop="operateType">
|
||||||
<el-form-item label="最大用时:" prop="maxDuration" v-if="isUpdate">
|
<el-select v-model="operateModel.operateType" multiple>
|
||||||
<el-input-number v-model="operateModel.maxDuration" :min="0" :max="10000"></el-input-number>s
|
<el-option
|
||||||
</el-form-item>
|
v-for="option in trainingTypeMap[operateModel.type]"
|
||||||
<el-form-item label="实训描述:" prop="remarks" v-if="isUpdate">
|
:key="option.code"
|
||||||
<el-input type="textarea" v-model="operateModel.remarks"></el-input>
|
:label="option.name"
|
||||||
</el-form-item>
|
:value="option.code"
|
||||||
</el-form>
|
/>
|
||||||
<span slot="footer" class="dialog-footer">
|
</el-select>
|
||||||
<el-button @click="handleClose">取 消</el-button>
|
</el-form-item>
|
||||||
<el-button type="primary" @click="handleDeal" :loading="loading">确 定</el-button>
|
<el-form-item v-if="isUpdate" label="最小用时:" prop="minDuration">
|
||||||
</span>
|
<el-input-number v-model="operateModel.minDuration" :min="0" :max="10000" />s
|
||||||
</el-dialog>
|
</el-form-item>
|
||||||
|
<el-form-item v-if="isUpdate" label="最大用时:" prop="maxDuration">
|
||||||
|
<el-input-number v-model="operateModel.maxDuration" :min="0" :max="10000" />s
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="isUpdate" label="实训描述:" prop="remarks">
|
||||||
|
<el-input v-model="operateModel.remarks" type="textarea" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="handleClose">取 消</el-button>
|
||||||
|
<el-button type="primary" :loading="loading" @click="handleDeal">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getPublishMapInfo } from '@/api/jmap/map';
|
import { addAutoTraining, updateAutoTraining, deleteAutoTraining } from '@/api/jmap/training';
|
||||||
import { addAutoTraining, updateAutoTraining, deleteAutoTraining } from '@/api/jmap/training';
|
import { getOperateTrainingList } from '@/api/management/operation';
|
||||||
import { getOperateTrainingList } from '@/api/management/operation';
|
import { getCommodityMapProduct } from '@/api/management/mapprd';
|
||||||
import { getCommodityMapProduct } from '@/api/management/mapprd';
|
|
||||||
import localStore from 'storejs';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TrainingAdd',
|
name: 'TrainingAdd',
|
||||||
props: {
|
props: {
|
||||||
skinStyleList: {
|
skinStyleList: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
trainingTypeList: {
|
trainingTypeList: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
trainingOperateTypeMap: {
|
trainingOperateTypeMap: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
var minDurations = (rule, value, callback) => {
|
var minDurations = (rule, value, callback) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return callback(new Error('请输入标准用时'));
|
return callback(new Error('请输入标准用时'));
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!Number.isInteger(value)) {
|
if (!Number.isInteger(value)) {
|
||||||
callback(new Error('请输入数字值'));
|
callback(new Error('请输入数字值'));
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
};
|
};
|
||||||
var maxDurations = (rule, value, callback) => {
|
var maxDurations = (rule, value, callback) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return callback(new Error('请输入标准用时'));
|
return callback(new Error('请输入标准用时'));
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!Number.isInteger(value)) {
|
if (!Number.isInteger(value)) {
|
||||||
callback(new Error('请输入数字值'));
|
callback(new Error('请输入数字值'));
|
||||||
} else {
|
} else {
|
||||||
if (value < this.operateModel.minDuration) {
|
if (value < this.operateModel.minDuration) {
|
||||||
callback(new Error('必须大于最小时间'));
|
callback(new Error('必须大于最小时间'));
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
var checkOperateType = (rule, value, callback) => {
|
var checkOperateType = (rule, value, callback) => {
|
||||||
if (value.length <= 0) {
|
if (value.length <= 0) {
|
||||||
return callback(new Error('请选择实训类型'));
|
return callback(new Error('请选择实训类型'));
|
||||||
} else if (this.operation.event == '02' && value.length !== 1) {
|
} else if (this.operation.event == '02' && value.length !== 1) {
|
||||||
return callback(new Error('只能选择一个实训类型'));
|
return callback(new Error('只能选择一个实训类型'));
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
var checkRemarks = (rule, value, callback) => {
|
// var checkRemarks = (rule, value, callback) => {
|
||||||
if (this.operation.event == '02' && !value) {
|
// if (this.operation.event == '02' && !value) {
|
||||||
return callback(new Error('请输入实训描述'));
|
// return callback(new Error('请输入实训描述'));
|
||||||
}
|
// }
|
||||||
callback();
|
// callback();
|
||||||
};
|
// };
|
||||||
|
|
||||||
return {
|
return {
|
||||||
dialogShow: false,
|
dialogShow: false,
|
||||||
productTypesList: [],
|
productTypesList: [],
|
||||||
trainTypesList: [],
|
trainTypesList: [],
|
||||||
productList: [],
|
productList: [],
|
||||||
checkList: [],
|
checkList: [],
|
||||||
operateModel: {
|
operateModel: {
|
||||||
name: '',
|
name: '',
|
||||||
type: '',
|
type: '',
|
||||||
skinCode: '',
|
skinCode: '',
|
||||||
prdCode: '',
|
prdCode: '',
|
||||||
operateType: [],
|
operateType: [],
|
||||||
maxDuration: 0,
|
maxDuration: 0,
|
||||||
minDuration: 0,
|
minDuration: 0,
|
||||||
remarks: '',
|
remarks: ''
|
||||||
},
|
},
|
||||||
loading: false,
|
loading: false,
|
||||||
trainingTypeLists: [],
|
trainingTypeLists: [],
|
||||||
trainingTypeMap: {},
|
trainingTypeMap: {},
|
||||||
operation: {
|
operation: {
|
||||||
event: '',
|
event: '',
|
||||||
title: '',
|
title: ''
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
skinCode: [
|
skinCode: [
|
||||||
{ required: true, message: '请输入地图名称', trigger: 'change' }
|
{ required: true, message: '请输入地图名称', trigger: 'change' }
|
||||||
],
|
],
|
||||||
prdCode: [
|
prdCode: [
|
||||||
{ required: true, message: '请输入产品类型', trigger: 'change' }
|
{ required: true, message: '请输入产品类型', trigger: 'change' }
|
||||||
],
|
],
|
||||||
type: [
|
type: [
|
||||||
{ required: true, message: '请输入实训类型', trigger: 'change' }
|
{ required: true, message: '请输入实训类型', trigger: 'change' }
|
||||||
],
|
],
|
||||||
operateType: [
|
operateType: [
|
||||||
{ required: true, validator: checkOperateType, trigger: 'change' }
|
{ required: true, validator: checkOperateType, trigger: 'change' }
|
||||||
],
|
],
|
||||||
minDuration: [
|
minDuration: [
|
||||||
{ required: true, validator: minDurations, trigger: 'blur' }
|
{ required: true, validator: minDurations, trigger: 'blur' }
|
||||||
],
|
],
|
||||||
maxDuration: [
|
maxDuration: [
|
||||||
{ required: true, validator: maxDurations, trigger: 'blur' }
|
{ required: true, validator: maxDurations, trigger: 'blur' }
|
||||||
],
|
]
|
||||||
// remarks: [
|
// remarks: [
|
||||||
// { required: true, validator: checkRemarks, trigger: 'blur' }
|
// { required: true, validator: checkRemarks, trigger: 'blur' }
|
||||||
// ]
|
// ]
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
isUpdate() {
|
isUpdate() {
|
||||||
return this.operation.event == '02';
|
return this.operation.event == '02';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
show(data) {
|
show(data) {
|
||||||
this.operation = {
|
this.operation = {
|
||||||
event: data.event,
|
event: data.event,
|
||||||
title: data.title
|
title: data.title
|
||||||
}
|
};
|
||||||
this.dialogShow = true;
|
this.dialogShow = true;
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
this.dialogShow = false;
|
this.dialogShow = false;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
skinStyleChoose(skinCode) {
|
skinStyleChoose(skinCode) {
|
||||||
this.operateModel.prdCode = '';
|
this.operateModel.prdCode = '';
|
||||||
this.productList = [];
|
this.productList = [];
|
||||||
if (skinCode) {
|
if (skinCode) {
|
||||||
getCommodityMapProduct(skinCode).then((response) => {
|
getCommodityMapProduct(skinCode).then((response) => {
|
||||||
this.productList = response.data;
|
this.productList = response.data;
|
||||||
this.productList = this.productList.filter(elem => { return elem.prdType != '03'; })
|
this.productList = this.productList.filter(elem => { return elem.prdType != '03'; });
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async prdChange(prdCode) {
|
async prdChange(prdCode) {
|
||||||
this.trainingTypeMap = {};
|
this.trainingTypeMap = {};
|
||||||
this.operateModel.operateType = [];
|
this.operateModel.operateType = [];
|
||||||
|
|
||||||
let skinStyleObj = this.skinStyleList.find(elem => { return elem.code === this.operateModel.skinCode }) || {};
|
const skinStyleObj = this.skinStyleList.find(elem => { return elem.code === this.operateModel.skinCode; }) || {};
|
||||||
let prdTypeObj = this.productList.find(elem => { return elem.code === prdCode }) || {};
|
const prdTypeObj = this.productList.find(elem => { return elem.code === prdCode; }) || {};
|
||||||
let res = await getOperateTrainingList({ skinCode: skinStyleObj.code, productType: prdTypeObj.prdType });
|
const res = await getOperateTrainingList({ skinCode: skinStyleObj.code, productType: prdTypeObj.prdType });
|
||||||
if (res && res.code == 200) {
|
if (res && res.code == 200) {
|
||||||
this.trainingTypeLists = res.data;
|
this.trainingTypeLists = res.data;
|
||||||
this.trainingTypeList.forEach(elem => {
|
this.trainingTypeList.forEach(elem => {
|
||||||
this.trainingTypeLists.forEach(item => {
|
this.trainingTypeLists.forEach(item => {
|
||||||
if (item.id == elem.code) {
|
if (item.id == elem.code) {
|
||||||
item.name = elem.name;
|
item.name = elem.name;
|
||||||
item.code = elem.code;
|
item.code = elem.code;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.trainingOperateTypeMap[item.id].forEach(i => {
|
this.trainingOperateTypeMap[item.id].forEach(i => {
|
||||||
item.children.forEach(v => {
|
item.children.forEach(v => {
|
||||||
if (i.code == v.id) {
|
if (i.code == v.id) {
|
||||||
v.name = i.name;
|
v.name = i.name;
|
||||||
v.code = i.code;
|
v.code = i.code;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
this.trainingTypeLists.forEach(item => {
|
this.trainingTypeLists.forEach(item => {
|
||||||
item.children.forEach(v => {
|
item.children.forEach(v => {
|
||||||
if (!this.trainingTypeMap[item.id]) {
|
if (!this.trainingTypeMap[item.id]) {
|
||||||
this.trainingTypeMap[item.id] = [];
|
this.trainingTypeMap[item.id] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
this.trainingTypeMap[item.id].push({
|
this.trainingTypeMap[item.id].push({
|
||||||
name: v.name,
|
name: v.name,
|
||||||
code: v.code,
|
code: v.code
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
typeChange(type) {
|
typeChange(type) {
|
||||||
this.operateModel.operateType = [];
|
this.operateModel.operateType = [];
|
||||||
this.trainTypesList = this.trainingOperateTypeMap[type] || []
|
this.trainTypesList = this.trainingOperateTypeMap[type] || [];
|
||||||
},
|
},
|
||||||
// 取消
|
// 取消
|
||||||
handleClose() {
|
handleClose() {
|
||||||
this.dialogShow = false;
|
this.dialogShow = false;
|
||||||
},
|
},
|
||||||
// 确定
|
// 确定
|
||||||
handleDeal() {
|
handleDeal() {
|
||||||
this.$refs.form.validate((valid) => {
|
this.$refs.form.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
if (this.operation.event == '01') { //add
|
if (this.operation.event == '01') { // add
|
||||||
//创建实训
|
// 创建实训
|
||||||
let data = {
|
const data = {
|
||||||
skinCode: this.operateModel.skinCode,
|
skinCode: this.operateModel.skinCode,
|
||||||
name: this.operateModel.name,
|
name: this.operateModel.name,
|
||||||
prdCode: this.operateModel.prdCode,
|
prdCode: this.operateModel.prdCode,
|
||||||
trainingType: this.operateModel.type,
|
trainingType: this.operateModel.type,
|
||||||
operateType: this.operateModel.operateType
|
operateType: this.operateModel.operateType
|
||||||
}
|
};
|
||||||
|
|
||||||
addAutoTraining(data).then(response => {
|
addAutoTraining(data).then(response => {
|
||||||
this.$message.success('自动生成实训成功!');
|
this.$message.success('自动生成实训成功!');
|
||||||
this.$emit('refresh');
|
this.$emit('refresh');
|
||||||
this.close();
|
this.close();
|
||||||
}).catch(error => {
|
}).catch(() => {
|
||||||
this.$messageBox('生成实训失败');
|
this.$messageBox('生成实训失败');
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
} else if (this.operation.event == '02') { //edit
|
} else if (this.operation.event == '02') { // edit
|
||||||
//更新实训
|
// 更新实训
|
||||||
let data = {
|
const data = {
|
||||||
skinCode: this.operateModel.skinCode,
|
skinCode: this.operateModel.skinCode,
|
||||||
name: this.operateModel.name,
|
name: this.operateModel.name,
|
||||||
prdCode: this.operateModel.prdCode,
|
prdCode: this.operateModel.prdCode,
|
||||||
trainingType: this.operateModel.type,
|
trainingType: this.operateModel.type,
|
||||||
operateType: this.operateModel.operateType,
|
operateType: this.operateModel.operateType,
|
||||||
remarks: this.operateModel.remarks,
|
remarks: this.operateModel.remarks,
|
||||||
minDuration: this.operateModel.minDuration,
|
minDuration: this.operateModel.minDuration,
|
||||||
maxDuration: this.operateModel.maxDuration
|
maxDuration: this.operateModel.maxDuration
|
||||||
}
|
};
|
||||||
|
|
||||||
updateAutoTraining(data).then(response => {
|
updateAutoTraining(data).then(response => {
|
||||||
this.$message.success('更新自动生成实训成功!');
|
this.$message.success('更新自动生成实训成功!');
|
||||||
this.$emit('refresh');
|
this.$emit('refresh');
|
||||||
this.close();
|
this.close();
|
||||||
}).catch(error => {
|
}).catch(() => {
|
||||||
this.$messageBox('更新自动生成实训失败');
|
this.$messageBox('更新自动生成实训失败');
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
})
|
});
|
||||||
} else if (this.operation.event == '03') { //delete
|
} else if (this.operation.event == '03') { // delete
|
||||||
//删除实训
|
// 删除实训
|
||||||
let data = {
|
const data = {
|
||||||
skinCode: this.operateModel.skinCode,
|
skinCode: this.operateModel.skinCode,
|
||||||
name: this.operateModel.name,
|
name: this.operateModel.name,
|
||||||
prdCode: this.operateModel.prdCode,
|
prdCode: this.operateModel.prdCode,
|
||||||
trainingType: `${this.operateModel.type}`,
|
trainingType: `${this.operateModel.type}`,
|
||||||
operateType: `${this.operateModel.operateType.join(',')}`,
|
operateType: `${this.operateModel.operateType.join(',')}`
|
||||||
}
|
};
|
||||||
|
|
||||||
deleteAutoTraining(data).then(response => {
|
deleteAutoTraining(data).then(response => {
|
||||||
this.$message.success('删除自动生成实训成功!');
|
this.$message.success('删除自动生成实训成功!');
|
||||||
this.$emit('refresh');
|
this.$emit('refresh');
|
||||||
this.close();
|
this.close();
|
||||||
}).catch(error => {
|
}).catch(() => {
|
||||||
this.$messageBox('删除自动生成实训失败');
|
this.$messageBox('删除自动生成实训失败');
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.el-checkbox {
|
.el-checkbox {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// import { listPublishMap, putMapProductOnLine, putMapProductOffLine } from '@/api/jmap/mapdraft';
|
|
||||||
// import { getPublishMapInfo } from '@/api/jmap/map';
|
|
||||||
import { pageQueryTraining } from '@/api/jmap/training';
|
import { pageQueryTraining } from '@/api/jmap/training';
|
||||||
import { trainingNotify } from '@/api/simulation';
|
import { trainingNotify } from '@/api/simulation';
|
||||||
import { getCommodityMapProduct, getProductList } from '@/api/management/mapprd';
|
import { getCommodityMapProduct, getProductList } from '@/api/management/mapprd';
|
||||||
|
@ -1,346 +1,342 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<!-- <turnback-bar :title="turnbackBarTitle"></turnback-bar> -->
|
<!-- <turnback-bar :title="turnbackBarTitle"></turnback-bar> -->
|
||||||
<div class="card-box">
|
<div class="card-box">
|
||||||
<el-steps class="steps" :active="display">
|
<el-steps class="steps" :active="display">
|
||||||
<el-step :title="title" icon="el-icon-edit-outline"></el-step>
|
<el-step :title="title" icon="el-icon-edit-outline" />
|
||||||
<el-step title="" icon="el-icon-upload"></el-step>
|
<el-step title="" icon="el-icon-upload" />
|
||||||
</el-steps>
|
</el-steps>
|
||||||
<el-card class="forms">
|
<el-card class="forms">
|
||||||
<el-scrollbar wrapClass="scrollbar-wrapper" :style="{height:height -70 + 'px'}"
|
<el-scrollbar
|
||||||
style="padding-top: 40px">
|
wrap-class="scrollbar-wrapper"
|
||||||
<data-form ref="dataform" :form="form" :formModel="formModel" :rules="rules"></data-form>
|
:style="{height:height -70 + 'px'}"
|
||||||
</el-scrollbar>
|
style="padding-top: 40px"
|
||||||
</el-card>
|
>
|
||||||
<div class="draft">
|
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
|
||||||
<el-button-group>
|
</el-scrollbar>
|
||||||
<el-button type="primary" @click="create" v-if="isAdd">{{$t('global.create')}}</el-button>
|
</el-card>
|
||||||
<el-button type="warning" @click="update" v-if="isEdit">{{$t('global.update')}}</el-button>
|
<div class="draft">
|
||||||
<el-button type="primary" @click="turnback">{{$t('global.return')}}</el-button>
|
<el-button-group>
|
||||||
</el-button-group>
|
<el-button v-if="isAdd" type="primary" @click="create">{{ $t('global.create') }}</el-button>
|
||||||
</div>
|
<el-button v-if="isEdit" type="warning" @click="update">{{ $t('global.update') }}</el-button>
|
||||||
</div>
|
<el-button type="primary" @click="turnback">{{ $t('global.return') }}</el-button>
|
||||||
|
</el-button-group>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getOrderDetail, updateOrder } from '@/api/management/order';
|
import { listPublishMap, getPublishMapInfo } from '@/api/jmap/map';
|
||||||
import { addOrganization } from '@/api/management/organization';
|
import { saveCommodityList, getCommodityDetailById, updataCommodityList } from '@/api/management/goods';
|
||||||
import { getOrderCharge } from '@/api/management/order';
|
import { getCommodityMapProduct } from '@/api/management/mapprd';
|
||||||
import { getMapLesson } from '@/api/management/dictionary';
|
import { getCommodityProductLesson } from '@/api/jmap/lesson';
|
||||||
import { listPublishMap, getPublishMapInfo } from '@/api/jmap/map';
|
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
|
||||||
import { saveCommodityList, getCommodityDetailById, updataCommodityList } from '@/api/management/goods';
|
|
||||||
import { getCommodityMapProduct } from '@/api/management/mapprd';
|
|
||||||
import { getCommodityProductLesson } from '@/api/jmap/lesson';
|
|
||||||
import { validateCharCode } from '@/utils/validate';
|
|
||||||
import { UrlConfig } from '@/router/index';
|
|
||||||
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DictionaryDetailEdit',
|
name: 'DictionaryDetailEdit',
|
||||||
mixins: [
|
mixins: [
|
||||||
WindowResizeHandler
|
WindowResizeHandler
|
||||||
],
|
],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
type: '',
|
type: '',
|
||||||
height: '',
|
height: '',
|
||||||
display: 1,
|
display: 1,
|
||||||
foreverInitData: false,
|
foreverInitData: false,
|
||||||
dataLesson: [],
|
dataLesson: [],
|
||||||
productList: [],
|
productList: [],
|
||||||
mapIdList: [],
|
mapIdList: [],
|
||||||
productTypeList: [],
|
productTypeList: [],
|
||||||
mapProductCodeList: [],
|
mapProductCodeList: [],
|
||||||
mapProductCodeListFilter: [],
|
mapProductCodeListFilter: [],
|
||||||
lessonIdList: [],
|
lessonIdList: [],
|
||||||
TimeStyleList: [],
|
TimeStyleList: [],
|
||||||
TimeStyleDict: {},
|
TimeStyleDict: {},
|
||||||
formModel: {
|
formModel: {
|
||||||
name: '',
|
name: '',
|
||||||
skinCode: '',
|
skinCode: '',
|
||||||
productType: '01',
|
productType: '01',
|
||||||
mapId: '',
|
mapId: '',
|
||||||
mapProductCode: '',
|
mapProductCode: '',
|
||||||
lessonId: '',
|
lessonId: '',
|
||||||
forever: false,
|
forever: false,
|
||||||
tryUseTime: 0,
|
tryUseTime: 0,
|
||||||
tryUseTimeUnit: '05',
|
tryUseTimeUnit: '05',
|
||||||
price: 0,
|
price: 0,
|
||||||
remarks: '',
|
remarks: ''
|
||||||
},
|
}
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
// turnbackBarTitle() {
|
// turnbackBarTitle() {
|
||||||
// return '';
|
// return '';
|
||||||
// },
|
// },
|
||||||
isAdd() {
|
isAdd() {
|
||||||
return this.type === 'ADD';
|
return this.type === 'ADD';
|
||||||
},
|
},
|
||||||
isEdit() {
|
isEdit() {
|
||||||
return (this.type === 'EDIT') && !isNaN(Number(this.$route.params.commodityId));;
|
return (this.type === 'EDIT') && !isNaN(Number(this.$route.params.commodityId));
|
||||||
},
|
},
|
||||||
title() {
|
title() {
|
||||||
return this.isAdd ? this.$t('orderAuthor.addGoods') : (this.isEdit ? this.$t('orderAuthor.addGoods') : this.$t('orderAuthor.unknownRouter'));
|
return this.isAdd ? this.$t('orderAuthor.addGoods') : (this.isEdit ? this.$t('orderAuthor.addGoods') : this.$t('orderAuthor.unknownRouter'));
|
||||||
},
|
},
|
||||||
isShowLesson() {
|
isShowLesson() {
|
||||||
return this.formModel.productType === '01' || this.formModel.productType === '02'; // 教学类型,考试类型
|
return this.formModel.productType === '01' || this.formModel.productType === '02'; // 教学类型,考试类型
|
||||||
},
|
},
|
||||||
isShowSimulation() {
|
isShowSimulation() {
|
||||||
return this.formModel.productType === '03'; // 仿真类型
|
return this.formModel.productType === '03'; // 仿真类型
|
||||||
},
|
},
|
||||||
isShowScreen() {
|
isShowScreen() {
|
||||||
return this.formModel.productType === '04'; // 大屏类型
|
return this.formModel.productType === '04'; // 大屏类型
|
||||||
},
|
},
|
||||||
isShowForever() {
|
isShowForever() {
|
||||||
return this.formModel.forever;
|
return this.formModel.forever;
|
||||||
},
|
},
|
||||||
isDisabled() {
|
isDisabled() {
|
||||||
return this.isEdit
|
return this.isEdit;
|
||||||
},
|
},
|
||||||
foreverIsDisabled() {
|
foreverIsDisabled() {
|
||||||
return this.foreverInitData
|
return this.foreverInitData;
|
||||||
},
|
},
|
||||||
payTypeIsDisabled() {
|
payTypeIsDisabled() {
|
||||||
return this.isEdit
|
return this.isEdit;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
form() {
|
||||||
|
const form = {
|
||||||
|
labelWidth: '135px',
|
||||||
|
items: [
|
||||||
|
{ prop: 'name', label: this.$t('orderAuthor.commodityName'), type: 'text', required: false },
|
||||||
|
{ prop: 'productType', label: this.$t('orderAuthor.productType'), type: 'select', required: false, disabled: this.isDisabled, options: this.productTypeList, change: true, onChange: this.typeChange },
|
||||||
|
{ prop: 'mapId', label: this.$t('orderAuthor.map'), type: 'select', required: false, disabled: this.isDisabled, options: this.mapIdList, show: this.isShowLesson || this.isShowSimulation, change: true, onChange: this.mapChange },
|
||||||
|
{ prop: 'mapProductCode', label: this.$t('orderAuthor.productName'), type: 'select', required: false, disabled: this.isDisabled, options: this.mapProductCodeListFilter, show: this.isShowLesson || this.isShowSimulation, change: true, onChange: this.productChange },
|
||||||
|
{ prop: 'lessonId', label: this.$t('orderAuthor.lesson'), type: 'select', required: false, disabled: this.isDisabled, options: this.lessonIdList, show: this.isShowLesson },
|
||||||
|
{ prop: 'forever', label: this.$t('orderAuthor.whetherTrial'), type: 'radio', required: false, options: this.$ConstSelect.Whether, disabled: this.foreverIsDisabled },
|
||||||
|
{ prop: 'tryUseTimeUnit', label: this.$t('orderAuthor.unitOfTime'), type: 'select', required: false, disabled: this.foreverIsDisabled, show: this.isShowForever, options: this.TimeStyleList },
|
||||||
|
{ prop: 'tryUseTime', label: this.$t('orderAuthor.trialTime'), type: 'number', required: false, disabled: this.foreverIsDisabled, show: this.isShowForever, message: `${this.TimeStyleDict[this.formModel.tryUseTimeUnit]}` },
|
||||||
|
{ prop: 'price', label: this.$t('orderAuthor.price'), type: 'number', required: false, min: 0.01, message: this.$t('global.yuan') },
|
||||||
|
{ prop: 'remarks', label: this.$t('orderAuthor.describtion'), type: 'textarea', required: false }
|
||||||
|
]
|
||||||
|
|
||||||
form() {
|
};
|
||||||
let form = {
|
return form;
|
||||||
labelWidth: '135px',
|
},
|
||||||
items: [
|
|
||||||
{ prop: 'name', label: this.$t('orderAuthor.commodityName'), type: 'text', required: false },
|
|
||||||
{ prop: 'productType', label: this.$t('orderAuthor.productType'), type: 'select', required: false, disabled: this.isDisabled, options: this.productTypeList, change: true, onChange: this.typeChange },
|
|
||||||
{ prop: 'mapId', label: this.$t('orderAuthor.map'), type: 'select', required: false, disabled: this.isDisabled, options: this.mapIdList, show: this.isShowLesson || this.isShowSimulation, change: true, onChange: this.mapChange },
|
|
||||||
{ prop: 'mapProductCode', label: this.$t('orderAuthor.productName'), type: 'select', required: false, disabled: this.isDisabled, options: this.mapProductCodeListFilter, show: this.isShowLesson || this.isShowSimulation, change: true, onChange: this.productChange },
|
|
||||||
{ prop: 'lessonId', label: this.$t('orderAuthor.lesson'), type: 'select', required: false, disabled: this.isDisabled, options: this.lessonIdList, show: this.isShowLesson },
|
|
||||||
{ prop: 'forever', label: this.$t('orderAuthor.whetherTrial'), type: 'radio', required: false, options: this.$ConstSelect.Whether, disabled: this.foreverIsDisabled },
|
|
||||||
{ prop: 'tryUseTimeUnit', label: this.$t('orderAuthor.unitOfTime'), type: 'select', required: false, disabled: this.foreverIsDisabled, show: this.isShowForever, options: this.TimeStyleList },
|
|
||||||
{ prop: 'tryUseTime', label: this.$t('orderAuthor.trialTime'), type: 'number', required: false, disabled: this.foreverIsDisabled, show: this.isShowForever, message: `${this.TimeStyleDict[this.formModel.tryUseTimeUnit]}` },
|
|
||||||
{ prop: 'price', label: this.$t('orderAuthor.price'), type: 'number', required: false, min: 0.01, message: this.$t('global.yuan') },
|
|
||||||
{ prop: 'remarks', label: this.$t('orderAuthor.describtion'), type: 'textarea', required: false, },
|
|
||||||
]
|
|
||||||
|
|
||||||
}
|
rules() {
|
||||||
return form
|
const baseRules = {
|
||||||
},
|
name: [
|
||||||
|
{ required: true, message: this.$t('orderAuthor.goodsNameInput'), trigger: 'blur' }
|
||||||
|
],
|
||||||
|
productType: [
|
||||||
|
{ required: true, message: this.$t('orderAuthor.productTypeInput'), trigger: 'change' }
|
||||||
|
],
|
||||||
|
mapId: [
|
||||||
|
{ required: true, message: this.$t('orderAuthor.mapInput'), trigger: 'change' }
|
||||||
|
],
|
||||||
|
mapProductCode: [
|
||||||
|
{ required: true, message: this.$t('orderAuthor.productInput'), trigger: 'change' }
|
||||||
|
],
|
||||||
|
lessonId: [
|
||||||
|
{ required: true, message: this.$t('orderAuthor.lessonInput'), trigger: 'change' }
|
||||||
|
],
|
||||||
|
forever: [
|
||||||
|
{ required: true, message: this.$t('orderAuthor.foreverRadio'), trigger: 'change' }
|
||||||
|
],
|
||||||
|
tryUseTime: [
|
||||||
|
{ required: true, message: this.$t('orderAuthor.trialTimeInput'), trigger: 'change' }
|
||||||
|
],
|
||||||
|
tryUseTimeUnit: [
|
||||||
|
{ required: true, message: this.$t('orderAuthor.unitOfTimeRadio'), trigger: 'change' }
|
||||||
|
],
|
||||||
|
price: [
|
||||||
|
{ required: true, message: this.$t('orderAuthor.totalPriceInput'), trigger: 'change' },
|
||||||
|
{
|
||||||
|
validator(rule, value, callback) {
|
||||||
|
if (Number(value) >= 0) {
|
||||||
|
if (String(value).split('.')[1] && String(value).split('.')[1].length > 2) {
|
||||||
|
callback(new Error(this.$t('orderAuthor.totalPriceInputError1')));
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
callback(new Error(this.$t('orderAuthor.totalPriceInputError2')));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
remarks: [
|
||||||
|
{ required: true, message: this.$t('orderAuthor.goodsDescribtionInput'), trigger: 'blur' }
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
rules() {
|
// 清空表单验证提示信息
|
||||||
let baseRules = {
|
this.$nextTick(function () {
|
||||||
name: [
|
this.$refs.dataform.clearValidate();
|
||||||
{ required: true, message: this.$t('orderAuthor.goodsNameInput'), trigger: 'blur' }
|
});
|
||||||
],
|
|
||||||
productType: [
|
|
||||||
{ required: true, message: this.$t('orderAuthor.productTypeInput'), trigger: 'change' }
|
|
||||||
],
|
|
||||||
mapId: [
|
|
||||||
{ required: true, message: this.$t('orderAuthor.mapInput'), trigger: 'change' }
|
|
||||||
],
|
|
||||||
mapProductCode: [
|
|
||||||
{ required: true, message: this.$t('orderAuthor.productInput'), trigger: 'change' }
|
|
||||||
],
|
|
||||||
lessonId: [
|
|
||||||
{ required: true, message: this.$t('orderAuthor.lessonInput'), trigger: 'change' }
|
|
||||||
],
|
|
||||||
forever: [
|
|
||||||
{ required: true, message: this.$t('orderAuthor.foreverRadio'), trigger: 'change' }
|
|
||||||
],
|
|
||||||
tryUseTime: [
|
|
||||||
{ required: true, message: this.$t('orderAuthor.trialTimeInput'), trigger: 'change' }
|
|
||||||
],
|
|
||||||
tryUseTimeUnit: [
|
|
||||||
{ required: true, message: this.$t('orderAuthor.unitOfTimeRadio'), trigger: 'change' }
|
|
||||||
],
|
|
||||||
price: [
|
|
||||||
{ required: true, message: this.$t('orderAuthor.totalPriceInput'), trigger: 'change' },
|
|
||||||
{
|
|
||||||
validator(rule, value, callback) {
|
|
||||||
if (Number(value) >= 0) {
|
|
||||||
if (String(value).split('.')[1] && String(value).split('.')[1].length > 2) {
|
|
||||||
callback(new Error(this.$t('orderAuthor.totalPriceInputError1')));
|
|
||||||
} else {
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
callback(new Error(this.$t('orderAuthor.totalPriceInputError2')));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
trigger: 'blur',
|
|
||||||
}
|
|
||||||
],
|
|
||||||
remarks: [
|
|
||||||
{ required: true, message: this.$t('orderAuthor.goodsDescribtionInput'), trigger: 'blur' }
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
//清空表单验证提示信息
|
return baseRules;
|
||||||
this.$nextTick(function () {
|
}
|
||||||
this.$refs.dataform.clearValidate();
|
},
|
||||||
});
|
mounted() {
|
||||||
|
this.initLoadPage();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
resizeHandler: function () {
|
||||||
|
this.height = this._clientHeight - 170;
|
||||||
|
},
|
||||||
|
async initLoadPage() {
|
||||||
|
// 加载字典数据
|
||||||
|
// 加载地图,产品,课程
|
||||||
|
this.mapIdList.length = 0;
|
||||||
|
try {
|
||||||
|
const response = await listPublishMap();
|
||||||
|
// this.dataLesson = response.data;
|
||||||
|
const data = response.data;
|
||||||
|
if (data && data.length) {
|
||||||
|
data.forEach(elem => {
|
||||||
|
this.mapIdList.push({ value: elem.id, label: elem.name });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
this.$messageBox(this.$t('error.getItemListFailed'));
|
||||||
|
}
|
||||||
|
// 产品类型
|
||||||
|
this.$Dictionary.productType().then(list => {
|
||||||
|
this.$convertList(list, this.productTypeList, elem => {
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
return baseRules;
|
// 时间类型
|
||||||
}
|
this.TimeStyleDict = {};
|
||||||
},
|
this.$Dictionary.timeStyleType().then(list => {
|
||||||
mounted() {
|
this.$convertList(list, this.TimeStyleList, elem => {
|
||||||
this.initLoadPage();
|
return true;
|
||||||
},
|
});
|
||||||
methods: {
|
list.forEach(elem => {
|
||||||
resizeHandler: function () {
|
this.TimeStyleDict[elem.code] = elem.name;
|
||||||
this.height = this._clientHeight - 170;
|
});
|
||||||
},
|
});
|
||||||
async initLoadPage() {
|
|
||||||
// 加载字典数据
|
|
||||||
// 加载地图,产品,课程
|
|
||||||
this.mapIdList.length = 0;
|
|
||||||
try {
|
|
||||||
let response = await listPublishMap();
|
|
||||||
// this.dataLesson = response.data;
|
|
||||||
let data = response.data;
|
|
||||||
if (data && data.length) {
|
|
||||||
data.forEach(elem => {
|
|
||||||
this.mapIdList.push({ value: elem.id, label: elem.name });
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
this.$messageBox(this.$t('error.getItemListFailed'));
|
|
||||||
}
|
|
||||||
// 产品类型
|
|
||||||
this.$Dictionary.productType().then(list => {
|
|
||||||
this.$convertList(list, this.productTypeList, elem => {
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// 时间类型
|
// 清空数据
|
||||||
this.TimeStyleDict = {};
|
this.$refs.dataform.resetForm();
|
||||||
this.$Dictionary.timeStyleType().then(list => {
|
|
||||||
this.$convertList(list, this.TimeStyleList, elem => {
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
list.forEach(elem => {
|
|
||||||
this.TimeStyleDict[elem.code] = elem.name;
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
//清空数据
|
// 获取操作模式
|
||||||
this.$refs.dataform.resetForm();
|
this.type = String(this.$route.params.mode).toUpperCase();
|
||||||
|
if (this.type === 'EDIT') {
|
||||||
//获取操作模式
|
try {
|
||||||
this.type = String(this.$route.params.mode).toUpperCase();
|
const res = await getCommodityDetailById(this.$route.params.commodityId);
|
||||||
if (this.type === 'EDIT') {
|
this.mapChange(res.data.mapId);
|
||||||
try {
|
this.productChange(res.data.mapProductCode);
|
||||||
let res = await getCommodityDetailById(this.$route.params.commodityId);
|
this.formModel = {
|
||||||
this.mapChange(res.data.mapId);
|
name: res.data.name,
|
||||||
this.productChange(res.data.mapProductCode);
|
productType: res.data.productType,
|
||||||
this.formModel = {
|
mapId: res.data.mapId,
|
||||||
name: res.data.name,
|
mapProductCode: res.data.mapProductCode,
|
||||||
productType: res.data.productType,
|
lessonId: res.data.lessonId,
|
||||||
mapId: res.data.mapId,
|
forever: res.data.tryUse,
|
||||||
mapProductCode: res.data.mapProductCode,
|
tryUseTime: res.data.tryUseTime,
|
||||||
lessonId: res.data.lessonId,
|
tryUseTimeUnit: res.data.tryUseTimeUnit || '05',
|
||||||
forever: res.data.tryUse,
|
price: res.data.price,
|
||||||
tryUseTime: res.data.tryUseTime,
|
remarks: res.data.remarks,
|
||||||
tryUseTimeUnit: res.data.tryUseTimeUnit || '05',
|
id: res.data.id
|
||||||
price: res.data.price,
|
};
|
||||||
remarks: res.data.remarks,
|
} catch (err) {
|
||||||
id: res.data.id,
|
this.$messageBox(this.$t('error.getItemListFailed'));
|
||||||
};
|
}
|
||||||
} catch (err) {
|
}
|
||||||
this.$messageBox(this.$t('error.getItemListFailed'));
|
// 清空表单验证提示信息
|
||||||
}
|
this.$nextTick(function () {
|
||||||
}
|
this.$refs.dataform.clearValidate();
|
||||||
//清空表单验证提示信息
|
});
|
||||||
this.$nextTick(function () {
|
},
|
||||||
this.$refs.dataform.clearValidate();
|
typeChange(type) {
|
||||||
});
|
this.mapProductCodeListFilter = this.mapProductCodeList.filter(elem => {
|
||||||
},
|
if (type != '03') { // 不是仿真时,过滤综合演练
|
||||||
typeChange(type) {
|
return elem.prdType != '03';
|
||||||
this.mapProductCodeListFilter = this.mapProductCodeList.filter(elem => {
|
} else {
|
||||||
if (type != '03') { //不是仿真时,过滤综合演练
|
return true;
|
||||||
return elem.prdType != '03';
|
}
|
||||||
} else {
|
});
|
||||||
return true;
|
},
|
||||||
}
|
async mapChange(mapId) {
|
||||||
})
|
this.mapProductCodeList = [];
|
||||||
},
|
this.formModel.mapProductCode = '';
|
||||||
async mapChange(mapId) {
|
this.lessonIdList = [];
|
||||||
this.mapProductCodeList = [];
|
this.formModel.lessonId = '';
|
||||||
this.formModel.mapProductCode = '';
|
try {
|
||||||
this.lessonIdList = [];
|
const rest = await getPublishMapInfo(mapId);
|
||||||
this.formModel.lessonId = '';
|
if (rest && rest.code == 200) {
|
||||||
try {
|
const resp = await getCommodityMapProduct(rest.data.skinCode);
|
||||||
let rest = await getPublishMapInfo(mapId);
|
if (resp && resp.code == 200) {
|
||||||
if (rest && rest.code == 200) {
|
resp.data.forEach(ele => {
|
||||||
let resp = await getCommodityMapProduct(rest.data.skinCode);
|
this.mapProductCodeList.push({ value: ele.code, label: ele.name, prdType: ele.prdType });
|
||||||
if (resp && resp.code == 200) {
|
this.typeChange(this.formModel.productType);
|
||||||
resp.data.forEach(ele => {
|
});
|
||||||
this.mapProductCodeList.push({ value: ele.code, label: ele.name, prdType: ele.prdType });
|
}
|
||||||
this.typeChange(this.formModel.productType);
|
}
|
||||||
})
|
} catch (err) {
|
||||||
}
|
this.$messageBox(this.$t('error.getMapProductListFailed'));
|
||||||
}
|
}
|
||||||
} catch (err) {
|
},
|
||||||
this.$messageBox(this.$t('error.getMapProductListFailed'));
|
async productChange(productId) {
|
||||||
}
|
this.formModel.lessonId = '';
|
||||||
},
|
this.lessonIdList = [];
|
||||||
async productChange(productId) {
|
try {
|
||||||
this.formModel.lessonId = '';
|
const rest = await getCommodityProductLesson(productId);
|
||||||
this.lessonIdList = [];
|
if (rest && rest.code == 200) {
|
||||||
try {
|
rest.data.forEach(ele => {
|
||||||
let rest = await getCommodityProductLesson(productId);
|
this.lessonIdList.push({ value: ele.id, label: ele.name });
|
||||||
if (rest && rest.code == 200) {
|
});
|
||||||
rest.data.forEach(ele => {
|
}
|
||||||
this.lessonIdList.push({ value: ele.id, label: ele.name });
|
} catch (err) {
|
||||||
})
|
this.$messageBox(this.$t('error.getLessonListFailed'));
|
||||||
}
|
}
|
||||||
} catch (err) {
|
},
|
||||||
this.$messageBox(this.$t('error.getLessonListFailed'));
|
buildModel() {
|
||||||
}
|
// 构造基础数据
|
||||||
},
|
const model = {
|
||||||
buildModel() {
|
name: this.formModel.name,
|
||||||
//构造基础数据
|
productType: this.formModel.productType,
|
||||||
let model = {
|
mapId: this.formModel.mapId,
|
||||||
name: this.formModel.name,
|
mapProductCode: this.formModel.mapProductCode,
|
||||||
productType: this.formModel.productType,
|
lessonId: this.formModel.lessonId,
|
||||||
mapId: this.formModel.mapId,
|
tryUse: this.formModel.forever,
|
||||||
mapProductCode: this.formModel.mapProductCode,
|
tryUseTime: this.formModel.tryUseTime,
|
||||||
lessonId: this.formModel.lessonId,
|
tryUseTimeUnit: this.formModel.tryUseTimeUnit,
|
||||||
tryUse: this.formModel.forever,
|
price: this.formModel.price,
|
||||||
tryUseTime: this.formModel.tryUseTime,
|
remarks: this.formModel.remarks,
|
||||||
tryUseTimeUnit: this.formModel.tryUseTimeUnit,
|
id: this.formModel.id
|
||||||
price: this.formModel.price,
|
};
|
||||||
remarks: this.formModel.remarks,
|
return model;
|
||||||
id: this.formModel.id,
|
},
|
||||||
}
|
create() {
|
||||||
return model;
|
this.$refs.dataform.validateForm(() => {
|
||||||
},
|
saveCommodityList(this.buildModel()).then(response => {
|
||||||
create() {
|
this.turnback();
|
||||||
this.$refs.dataform.validateForm(() => {
|
this.$message.success(this.$t('tip.creatingSuccessful'));
|
||||||
saveCommodityList(this.buildModel()).then(response => {
|
}).catch(() => {
|
||||||
this.turnback();
|
this.$messageBox(this.$t('tip.creatingFailed'));
|
||||||
this.$message.success(this.$t('tip.creatingSuccessful'));
|
});
|
||||||
}).catch(error => {
|
});
|
||||||
this.$messageBox(this.$t('tip.creatingFailed'));
|
},
|
||||||
});
|
update() {
|
||||||
});
|
this.$refs.dataform.validateForm(() => {
|
||||||
},
|
updataCommodityList(this.buildModel()).then(response => {
|
||||||
update() {
|
this.turnback();
|
||||||
this.$refs.dataform.validateForm(() => {
|
this.$message.success(this.$t('tip.updateSuccessfully'));
|
||||||
updataCommodityList(this.buildModel()).then(response => {
|
}).catch(() => {
|
||||||
this.turnback();
|
this.$messageBox(this.$t('tip.updateFailed'));
|
||||||
this.$message.success(this.$t('tip.updateSuccessfully'));
|
});
|
||||||
}).catch(error => {
|
});
|
||||||
this.$messageBox(this.$t('tip.updateFailed'))
|
},
|
||||||
});
|
turnback() {
|
||||||
})
|
this.$router.go(-1);
|
||||||
},
|
}
|
||||||
turnback() {
|
}
|
||||||
this.$router.go(-1)
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
|
@ -1,313 +1,305 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="title" :visible.sync="show" width="800px" :before-close="doClose" center>
|
<el-dialog :title="title" :visible.sync="show" width="800px" :before-close="doClose" center>
|
||||||
<data-form ref="dataform" :form="form" :formModel="formModel" :rules="rules"></data-form>
|
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="draftRule" :disabled="disabled">{{ isAdd? '添加': '修改'}}
|
<el-button type="primary" :disabled="disabled" @click="draftRule">{{ isAdd? '添加': '修改' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button @click="doClose">取 消</el-button>
|
<el-button @click="doClose">取 消</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getPublishMapInfo } from '@/api/jmap/map';
|
import { getPublishMapInfo } from '@/api/jmap/map';
|
||||||
import { getCommodityMapProduct } from '@/api/management/mapprd';
|
import { getCommodityMapProduct } from '@/api/management/mapprd';
|
||||||
import { OperatorModel, PermissionType } from '@/scripts/ConstDic';
|
import { OperatorModel, PermissionType } from '@/scripts/ConstDic';
|
||||||
import { getTotalRemains } from '@/api/management/author';
|
import { getTotalRemains } from '@/api/management/author';
|
||||||
import { superAdmin } from '@/router';
|
import { superAdmin } from '@/router';
|
||||||
import { getDimUserList } from '@/api/management/user';
|
import { getDimUserList } from '@/api/management/user';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'EditRule',
|
name: 'EditRule',
|
||||||
props: {
|
props: {
|
||||||
PermissionTypeList: {
|
permissionTypeList: {
|
||||||
type: Array
|
type: Array,
|
||||||
},
|
required: true
|
||||||
PublishMapList: {
|
},
|
||||||
type: Array
|
publishMapList: {
|
||||||
},
|
type: Array,
|
||||||
PublisLessonList: {
|
required: true
|
||||||
type: Array
|
},
|
||||||
},
|
publisLessonList: {
|
||||||
},
|
type: Array,
|
||||||
data() {
|
required: true
|
||||||
return {
|
}
|
||||||
show: false,
|
},
|
||||||
type: '',
|
data() {
|
||||||
mapProductList: [],
|
return {
|
||||||
filterPublisLessonList: [],
|
show: false,
|
||||||
formModel: {
|
type: '',
|
||||||
permissionType: '',
|
mapProductList: [],
|
||||||
mapId: '',
|
filterPublisLessonList: [],
|
||||||
lessonId: '',
|
formModel: {
|
||||||
mapProductCode: '',
|
permissionType: '',
|
||||||
date: '',
|
mapId: '',
|
||||||
amount: 0,
|
lessonId: '',
|
||||||
ownerId: '',
|
mapProductCode: '',
|
||||||
roleName: '',
|
date: '',
|
||||||
},
|
amount: 0,
|
||||||
DatePicker: {
|
ownerId: '',
|
||||||
shortcuts: [{
|
roleName: ''
|
||||||
text: '今天',
|
},
|
||||||
onClick(picker) {
|
DatePicker: {
|
||||||
picker.$emit('pick', new Date());
|
shortcuts: [{
|
||||||
}
|
text: '今天',
|
||||||
}]
|
onClick(picker) {
|
||||||
},
|
picker.$emit('pick', new Date());
|
||||||
numberMessage: '',
|
}
|
||||||
}
|
}]
|
||||||
},
|
},
|
||||||
|
numberMessage: ''
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
form() {
|
form() {
|
||||||
let form = {
|
const form = {
|
||||||
labelWidth: '120px',
|
labelWidth: '120px',
|
||||||
items: [
|
items: [
|
||||||
{ prop: 'permissionType', label: '权限类型', type: 'select', required: false, disabled: !this.isAdd, options: this.PermissionTypeList, change: true, onChange: this.permissionTypeChange },
|
{ prop: 'permissionType', label: '权限类型', type: 'select', required: false, disabled: !this.isAdd, options: this.PermissionTypeList, change: true, onChange: this.permissionTypeChange },
|
||||||
{ prop: 'mapId', label: '地图名称', type: 'select', required: false, disabled: !this.isAdd, show: this.isShowMap, options: this.PublishMapList, change: true, onChange: this.mapChange },
|
{ prop: 'mapId', label: '地图名称', type: 'select', required: false, disabled: !this.isAdd, show: this.isShowMap, options: this.PublishMapList, change: true, onChange: this.mapChange },
|
||||||
{ prop: 'mapProductCode', label: '地图产品名称', type: 'select', required: false, disabled: !this.isAdd, show: this.isShowMapProduct, options: this.mapProductList, change: true, onChange: this.mapProductChange },
|
{ prop: 'mapProductCode', label: '地图产品名称', type: 'select', required: false, disabled: !this.isAdd, show: this.isShowMapProduct, options: this.mapProductList, change: true, onChange: this.mapProductChange },
|
||||||
{ prop: 'lessonId', label: '课程名称', type: 'select', required: false, disabled: !this.isAdd, show: this.isShowLesson, options: this.filterPublisLessonList },
|
{ prop: 'lessonId', label: '课程名称', type: 'select', required: false, disabled: !this.isAdd, show: this.isShowLesson, options: this.filterPublisLessonList },
|
||||||
{ prop: 'roleName', label: '选择权限所有者', type: 'complete', required: false, disabled: !this.isAdd, show: this.isShowRole, querySearchAsync: this.querySearchAsync, handleSelect: this.prdSelect, placeholder: '请输入昵称/名字/手机号' },
|
{ prop: 'roleName', label: '选择权限所有者', type: 'complete', required: false, disabled: !this.isAdd, show: this.isShowRole, querySearchAsync: this.querySearchAsync, handleSelect: this.prdSelect, placeholder: '请输入昵称/名字/手机号' },
|
||||||
{ prop: 'date', label: '选择时间', type: 'daterange', required: false, viewFormat: "yyyy-MM-dd HH:mm:ss", valueFormat: "yyyy-MM-dd HH:mm:ss" },
|
{ prop: 'date', label: '选择时间', type: 'daterange', required: false, viewFormat: 'yyyy-MM-dd HH:mm:ss', valueFormat: 'yyyy-MM-dd HH:mm:ss' },
|
||||||
{ prop: 'amount', label: '权限个数', type: 'number', required: false, min: 0, max: this.maxTotal, message: this.numberMessage },
|
{ prop: 'amount', label: '权限个数', type: 'number', required: false, min: 0, max: this.maxTotal, message: this.numberMessage }
|
||||||
]
|
]
|
||||||
}
|
};
|
||||||
return form
|
return form;
|
||||||
},
|
},
|
||||||
rules() {
|
rules() {
|
||||||
let crules = {
|
const crules = {
|
||||||
permissionType: [
|
permissionType: [
|
||||||
{ required: true, message: '请选择权限类型', trigger: 'change' }
|
{ required: true, message: '请选择权限类型', trigger: 'change' }
|
||||||
],
|
],
|
||||||
mapId: [
|
mapId: [
|
||||||
{ required: true, message: '请选择地图名称', trigger: 'change' }
|
{ required: true, message: '请选择地图名称', trigger: 'change' }
|
||||||
],
|
],
|
||||||
mapProductCode: [
|
mapProductCode: [
|
||||||
{ required: true, message: '请选择地图产品名称', trigger: 'change' }
|
{ required: true, message: '请选择地图产品名称', trigger: 'change' }
|
||||||
],
|
],
|
||||||
lessonId: [
|
lessonId: [
|
||||||
{ required: true, message: '请选择课程', trigger: 'change' }
|
{ required: true, message: '请选择课程', trigger: 'change' }
|
||||||
],
|
],
|
||||||
date: [
|
date: [
|
||||||
{ required: true, message: '请输入时间', trigger: 'blur' }
|
{ required: true, message: '请输入时间', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
amount: [
|
amount: [
|
||||||
{ required: true, message: '请输入权限个数', trigger: 'change' },
|
{ required: true, message: '请输入权限个数', trigger: 'change' },
|
||||||
{
|
{
|
||||||
validator(rule, value, callback) {
|
validator(rule, value, callback) {
|
||||||
if (Number.isInteger(Number(value)) && Number(value) > 0) {
|
if (Number.isInteger(Number(value)) && Number(value) > 0) {
|
||||||
callback();
|
callback();
|
||||||
} else {
|
} else {
|
||||||
callback(new Error("权限个数必须大于0"));
|
callback(new Error('权限个数必须大于0'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
trigger: 'blur',
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
};
|
||||||
return crules
|
return crules;
|
||||||
},
|
},
|
||||||
title() {
|
title() {
|
||||||
if (this.isAdd) {
|
if (this.isAdd) {
|
||||||
return '增加权限打包规则';
|
return '增加权限打包规则';
|
||||||
} else {
|
} else {
|
||||||
return '编辑权限打包规则';
|
return '编辑权限打包规则';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
disabled() {
|
disabled() {
|
||||||
return this.formModel.amount > this.maxTotal || this.formModel.amount <= 0;
|
return this.formModel.amount > this.maxTotal || this.formModel.amount <= 0;
|
||||||
},
|
},
|
||||||
isAdd() {
|
isAdd() {
|
||||||
return this.type == 'add';
|
return this.type == 'add';
|
||||||
},
|
},
|
||||||
isShowMap() {
|
isShowMap() {
|
||||||
if (this.formModel.permissionType !== '04') {
|
return this.formModel.permissionType !== '04';
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
isShowRole() {
|
|
||||||
if (this.$store.state.user.roles.indexOf(superAdmin) != -1) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
isShowMapProduct() {
|
|
||||||
if (this.formModel.permissionType !== '04') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
isShowLesson() {
|
|
||||||
if (this.formModel.permissionType != '04' && this.formModel.permissionType != '03') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
formModel: {
|
|
||||||
handler: function (val, old) {
|
|
||||||
this.setTotalMax();
|
|
||||||
},
|
|
||||||
deep: true
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
setTotalMax() {
|
|
||||||
let endTime;
|
|
||||||
let startTime;
|
|
||||||
if (this.formModel.date) {
|
|
||||||
endTime = this.formModel.date[1];
|
|
||||||
startTime = this.formModel.date[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
var validator = {}
|
},
|
||||||
validator[PermissionType.LESSON] = () => { return this.formModel.lessonId && this.formModel.mapId && this.formModel.mapProductCode };
|
isShowRole() {
|
||||||
validator[PermissionType.EXAM] = () => { return this.formModel.lessonId && this.formModel.mapId && this.formModel.mapProductCode };
|
return this.$store.state.user.roles.indexOf(superAdmin) != -1;
|
||||||
validator[PermissionType.SIMULATION] = () => { return this.formModel.mapId && this.formModel.mapProductCode };
|
},
|
||||||
validator[PermissionType.SCREEN] = () => { return true };
|
isShowMapProduct() {
|
||||||
|
return this.formModel.permissionType !== '04';
|
||||||
|
},
|
||||||
|
isShowLesson() {
|
||||||
|
return this.formModel.permissionType != '04' && this.formModel.permissionType != '03';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
formModel: {
|
||||||
|
handler: function (val, old) {
|
||||||
|
this.setTotalMax();
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
setTotalMax() {
|
||||||
|
let endTime;
|
||||||
|
let startTime;
|
||||||
|
if (this.formModel.date) {
|
||||||
|
endTime = this.formModel.date[1];
|
||||||
|
startTime = this.formModel.date[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
var validator = {};
|
||||||
|
validator[PermissionType.LESSON] = () => { return this.formModel.lessonId && this.formModel.mapId && this.formModel.mapProductCode; };
|
||||||
|
validator[PermissionType.EXAM] = () => { return this.formModel.lessonId && this.formModel.mapId && this.formModel.mapProductCode; };
|
||||||
|
validator[PermissionType.SIMULATION] = () => { return this.formModel.mapId && this.formModel.mapProductCode; };
|
||||||
|
validator[PermissionType.SCREEN] = () => { return true; };
|
||||||
|
|
||||||
if (endTime && startTime && this.formModel.permissionType && validator[this.formModel.permissionType]()) {
|
if (endTime && startTime && this.formModel.permissionType && validator[this.formModel.permissionType]()) {
|
||||||
let model = {
|
const model = {
|
||||||
startTime: startTime,
|
startTime: startTime,
|
||||||
endTime: endTime,
|
endTime: endTime,
|
||||||
type: this.formModel.permissionType,
|
type: this.formModel.permissionType,
|
||||||
ownerId: this.formModel.ownerId,
|
ownerId: this.formModel.ownerId
|
||||||
}
|
};
|
||||||
|
|
||||||
if (this.formModel.permissionType == PermissionType.LESSON || this.formModel.permissionType == PermissionType.EXAM) {
|
if (this.formModel.permissionType == PermissionType.LESSON || this.formModel.permissionType == PermissionType.EXAM) {
|
||||||
model['lessonId'] = this.formModel.lessonId;
|
model['lessonId'] = this.formModel.lessonId;
|
||||||
model['mapId'] = this.formModel.mapId;
|
model['mapId'] = this.formModel.mapId;
|
||||||
model['mapProductCode'] = this.formModel.mapProductCode;
|
model['mapProductCode'] = this.formModel.mapProductCode;
|
||||||
} else if (this.formModel.permissionType == PermissionType.SIMULATION) {
|
} else if (this.formModel.permissionType == PermissionType.SIMULATION) {
|
||||||
model['mapId'] = this.formModel.mapId;
|
model['mapId'] = this.formModel.mapId;
|
||||||
model['mapProductCode'] = this.formModel.mapProductCode;
|
model['mapProductCode'] = this.formModel.mapProductCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTotalRemains(model).then(response => {
|
getTotalRemains(model).then(response => {
|
||||||
this.maxTotal = response.data;
|
this.maxTotal = response.data;
|
||||||
this.numberMessage = `(剩余最大权限个数:${this.maxTotal})`
|
this.numberMessage = `(剩余最大权限个数:${this.maxTotal})`;
|
||||||
}).catch(error => {
|
}).catch(() => {
|
||||||
this.numberMessage = '';
|
this.numberMessage = '';
|
||||||
})
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.numberMessage = '';
|
this.numberMessage = '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
permissionTypeChange() {
|
permissionTypeChange() {
|
||||||
this.formModel.mapId = '';
|
this.formModel.mapId = '';
|
||||||
this.formModel.mapProductCode = '';
|
this.formModel.mapProductCode = '';
|
||||||
this.formModel.lessonId = '';
|
this.formModel.lessonId = '';
|
||||||
},
|
},
|
||||||
mapChange(mapId) {
|
mapChange(mapId) {
|
||||||
this.formModel.mapProductCode = '';
|
this.formModel.mapProductCode = '';
|
||||||
this.formModel.lessonId = '';
|
this.formModel.lessonId = '';
|
||||||
this.mapProductList = [];
|
this.mapProductList = [];
|
||||||
getPublishMapInfo(mapId).then(resp => {
|
getPublishMapInfo(mapId).then(resp => {
|
||||||
getCommodityMapProduct(resp.data.skinCode).then(rest => {
|
getCommodityMapProduct(resp.data.skinCode).then(rest => {
|
||||||
let list = rest.data || [];
|
const list = rest.data || [];
|
||||||
this.mapProductList = list.map(elem => {
|
this.mapProductList = list.map(elem => {
|
||||||
return { value: elem.code, label: elem.name };
|
return { value: elem.code, label: elem.name };
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
mapProductChange(mapProductCode) {
|
mapProductChange(mapProductCode) {
|
||||||
this.formModel.lessonId = '';
|
this.formModel.lessonId = '';
|
||||||
this.filterPublisLessonList = this.PublisLessonList.filter(elem => { return elem.mapId == this.formModel.mapId && elem.prdCode == this.formModel.mapProductCode });
|
this.filterPublisLessonList = this.PublisLessonList.filter(elem => { return elem.mapId == this.formModel.mapId && elem.prdCode == this.formModel.mapProductCode; });
|
||||||
},
|
},
|
||||||
// 搜索查询input
|
// 搜索查询input
|
||||||
async querySearchAsync(queryString, cb) {
|
async querySearchAsync(queryString, cb) {
|
||||||
// 根据queryString 查询用户 并显示
|
// 根据queryString 查询用户 并显示
|
||||||
let results = [];
|
const results = [];
|
||||||
if (queryString) {
|
if (queryString) {
|
||||||
try {
|
try {
|
||||||
let params = {
|
const params = {
|
||||||
fuzzyParam: queryString,
|
fuzzyParam: queryString
|
||||||
};
|
};
|
||||||
let res = await getDimUserList(params);
|
const res = await getDimUserList(params);
|
||||||
let list = res.data;
|
const list = res.data;
|
||||||
list.forEach(item => {
|
list.forEach(item => {
|
||||||
let value = {
|
const value = {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
value: `${item.nickname}(${item.name})${item.mobile}`
|
value: `${item.nickname}(${item.name})${item.mobile}`
|
||||||
}
|
};
|
||||||
results.push(value);
|
results.push(value);
|
||||||
})
|
});
|
||||||
cb(results);
|
cb(results);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error, '查询用户list');
|
console.error(error, '查询用户list');
|
||||||
cb(results);
|
cb(results);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cb(results);
|
cb(results);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
prdSelect(item) {
|
prdSelect(item) {
|
||||||
this.formModel.ownerId = item.id;
|
this.formModel.ownerId = item.id;
|
||||||
},
|
},
|
||||||
doShow(data) {
|
doShow(data) {
|
||||||
this.show = true
|
this.show = true;
|
||||||
this.type = data.type;
|
this.type = data.type;
|
||||||
if (!this.isAdd) {
|
if (!this.isAdd) {
|
||||||
let model = data.item;
|
const model = data.item;
|
||||||
this.formModel = {
|
this.formModel = {
|
||||||
permissionType: model.permissionType,
|
permissionType: model.permissionType,
|
||||||
mapId: model.mapId,
|
mapId: model.mapId,
|
||||||
lessonId: model.lessonId,
|
lessonId: model.lessonId,
|
||||||
mapProductCode: model.mapProductCode,
|
mapProductCode: model.mapProductCode,
|
||||||
date: [model.startTime, model.endTime],
|
date: [model.startTime, model.endTime],
|
||||||
amount: model.amount,
|
amount: model.amount,
|
||||||
ownerId: this.formModel.ownerId,
|
ownerId: this.formModel.ownerId,
|
||||||
roleName: this.formModel.roleName,
|
roleName: this.formModel.roleName
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
this.formModel.amount = 0;
|
this.formModel.amount = 0;
|
||||||
},
|
},
|
||||||
doClose() {
|
doClose() {
|
||||||
this.show = false;
|
this.show = false;
|
||||||
},
|
},
|
||||||
draftRule() {
|
draftRule() {
|
||||||
if (this.formModel.amount <= this.maxTotal && this.formModel.amount) {
|
if (this.formModel.amount <= this.maxTotal && this.formModel.amount) {
|
||||||
this.$refs.dataform.validateForm(() => {
|
this.$refs.dataform.validateForm(() => {
|
||||||
if (this.isAdd) {
|
if (this.isAdd) {
|
||||||
this.$emit('addRuleForm', {
|
this.$emit('addRuleForm', {
|
||||||
operator: OperatorModel.TRANSFER,
|
operator: OperatorModel.TRANSFER,
|
||||||
permissionType: this.formModel.permissionType,
|
permissionType: this.formModel.permissionType,
|
||||||
mapId: this.isShowMap ? this.formModel.mapId : '',
|
mapId: this.isShowMap ? this.formModel.mapId : '',
|
||||||
lessonId: this.isShowLesson ? this.formModel.lessonId : '',
|
lessonId: this.isShowLesson ? this.formModel.lessonId : '',
|
||||||
mapProductCode: this.isShowMapProduct ? this.formModel.mapProductCode : '',
|
mapProductCode: this.isShowMapProduct ? this.formModel.mapProductCode : '',
|
||||||
startTime: this.formModel.date[0],
|
startTime: this.formModel.date[0],
|
||||||
endTime: this.formModel.date[1],
|
endTime: this.formModel.date[1],
|
||||||
amount: this.formModel.amount,
|
amount: this.formModel.amount,
|
||||||
ownerId: this.formModel.ownerId,
|
ownerId: this.formModel.ownerId,
|
||||||
roleName: this.formModel.roleName,
|
roleName: this.formModel.roleName
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
this.$emit('editRuleForm', {
|
this.$emit('editRuleForm', {
|
||||||
operator: OperatorModel.TRANSFER,
|
operator: OperatorModel.TRANSFER,
|
||||||
permissionType: this.formModel.permissionType,
|
permissionType: this.formModel.permissionType,
|
||||||
mapId: this.isShowMap ? this.formModel.mapId : '',
|
mapId: this.isShowMap ? this.formModel.mapId : '',
|
||||||
lessonId: this.isShowLesson ? this.formModel.lessonId : '',
|
lessonId: this.isShowLesson ? this.formModel.lessonId : '',
|
||||||
mapProductCode: this.isShowMapProduct ? this.formModel.mapProductCode : '',
|
mapProductCode: this.isShowMapProduct ? this.formModel.mapProductCode : '',
|
||||||
startTime: this.formModel.date[0],
|
startTime: this.formModel.date[0],
|
||||||
endTime: this.formModel.date[1],
|
endTime: this.formModel.date[1],
|
||||||
amount: this.formModel.amount,
|
amount: this.formModel.amount,
|
||||||
ownerId: this.formModel.ownerId,
|
ownerId: this.formModel.ownerId,
|
||||||
roleName: this.formModel.roleName,
|
roleName: this.formModel.roleName
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
this.doClose();
|
this.doClose();
|
||||||
})
|
});
|
||||||
} else {
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
/deep/ {
|
/deep/ {
|
||||||
.el-select {
|
.el-select {
|
||||||
@ -325,4 +317,4 @@
|
|||||||
width: calc(250px);
|
width: calc(250px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,254 +1,261 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-card>
|
<el-card>
|
||||||
<div class="pack-box" :style="{ height: height +'px' }">
|
<div class="pack-box" :style="{ height: height +'px' }">
|
||||||
<el-scrollbar wrapClass="scrollbar-wrapper" style="">
|
<el-scrollbar wrap-class="scrollbar-wrapper" style="">
|
||||||
<el-steps class="steps" :active="display">
|
<el-steps class="steps" :active="display">
|
||||||
<el-step title="制定打包规则" icon="el-icon-edit"></el-step>
|
<el-step title="制定打包规则" icon="el-icon-edit" />
|
||||||
<el-step icon="el-icon-setting"></el-step>
|
<el-step icon="el-icon-setting" />
|
||||||
</el-steps>
|
</el-steps>
|
||||||
<el-card class="forms pack-rule">
|
<el-card class="forms pack-rule">
|
||||||
<el-button class="addList" @click="dialogAdd" size="small">添加规则</el-button>
|
<el-button class="addList" size="small" @click="dialogAdd">添加规则</el-button>
|
||||||
<el-table :data="ruleList" border show-summary :summary-method="getSummaries" style="width: 100%"
|
<el-table
|
||||||
:height="height-300">
|
:data="ruleList"
|
||||||
<el-table-column prop="permissionType" label="权限类型" width="80">
|
border
|
||||||
<template slot-scope="scope">
|
show-summary
|
||||||
{{computedName(PermissionTypeList, scope.row.permissionType)}}
|
:summary-method="getSummaries"
|
||||||
</template>
|
style="width: 100%"
|
||||||
</el-table-column>
|
:height="height-300"
|
||||||
<el-table-column prop="mapId" label="地图名称">
|
>
|
||||||
<template slot-scope="scope">
|
<el-table-column prop="permissionType" label="权限类型" width="80">
|
||||||
{{computedName(PublishMapList, scope.row.mapId)}}
|
<template slot-scope="scope">
|
||||||
</template>
|
{{ computedName(PermissionTypeList, scope.row.permissionType) }}
|
||||||
</el-table-column>
|
</template>
|
||||||
<el-table-column prop="mapProductCode" label="产品名称" width="80">
|
</el-table-column>
|
||||||
<template slot-scope="scope">
|
<el-table-column prop="mapId" label="地图名称">
|
||||||
{{scope.row.mapProductCode}}
|
<template slot-scope="scope">
|
||||||
</template>
|
{{ computedName(PublishMapList, scope.row.mapId) }}
|
||||||
</el-table-column>
|
</template>
|
||||||
<el-table-column prop="lessonId" label="课程名称">
|
</el-table-column>
|
||||||
<template slot-scope="scope">
|
<el-table-column prop="mapProductCode" label="产品名称" width="80">
|
||||||
{{computedName(PublisLessonList, scope.row.lessonId)}}
|
<template slot-scope="scope">
|
||||||
</template>
|
{{ scope.row.mapProductCode }}
|
||||||
</el-table-column>
|
</template>
|
||||||
<el-table-column prop="startTime" label="起始时间" width="80">
|
</el-table-column>
|
||||||
</el-table-column>
|
<el-table-column prop="lessonId" label="课程名称">
|
||||||
<el-table-column prop="endTime" label="结束时间" width="80">
|
<template slot-scope="scope">
|
||||||
</el-table-column>
|
{{ computedName(PublisLessonList, scope.row.lessonId) }}
|
||||||
<el-table-column prop="amount" label="分配权限数量" width="110">
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="90">
|
<el-table-column prop="startTime" label="起始时间" width="80" />
|
||||||
<template slot-scope="scope">
|
<el-table-column prop="endTime" label="结束时间" width="80" />
|
||||||
<el-button type="text" size="small" @click="dialogEdit(scope.row)">修改</el-button>
|
<el-table-column prop="amount" label="分配权限数量" width="110" />
|
||||||
<el-button type="text" size="small" @click="deleteForm(scope.row)">删除</el-button>
|
<el-table-column label="操作" width="90">
|
||||||
</template>
|
<template slot-scope="scope">
|
||||||
</el-table-column>
|
<el-button type="text" size="small" @click="dialogEdit(scope.row)">修改</el-button>
|
||||||
</el-table>
|
<el-button type="text" size="small" @click="deleteForm(scope.row)">删除</el-button>
|
||||||
</el-card>
|
</template>
|
||||||
<div class="draft">
|
</el-table-column>
|
||||||
<el-button-group>
|
</el-table>
|
||||||
<el-button type="primary" @click="packForm" v-if="!urlInfo.url">打包</el-button>
|
</el-card>
|
||||||
<el-button type="primary" @click="QrCodeShow" v-if="urlInfo.url">获取二维码</el-button>
|
<div class="draft">
|
||||||
<el-button type="primary" @click="turnback">返回</el-button>
|
<el-button-group>
|
||||||
</el-button-group>
|
<el-button v-if="!urlInfo.url" type="primary" @click="packForm">打包</el-button>
|
||||||
</div>
|
<el-button v-if="urlInfo.url" type="primary" @click="qrcodeShow">获取二维码</el-button>
|
||||||
<edit-rule ref="addRule" :PermissionTypeList="PermissionTypeList" :PublisLessonList="PublisLessonList"
|
<el-button type="primary" @click="turnback">返回</el-button>
|
||||||
:PublishMapList="PublishMapList" @editRuleForm="editRuleForm" @addRuleForm="addRuleForm">
|
</el-button-group>
|
||||||
</edit-rule>
|
|
||||||
</el-scrollbar>
|
|
||||||
</div>
|
</div>
|
||||||
<qr-code ref="qrCode"></qr-code>
|
<edit-rule
|
||||||
<can-transfer ref="canDistribute" @distribute="distribute"></can-transfer>
|
ref="addRule"
|
||||||
</el-card>
|
:permission-type-list="PermissionTypeList"
|
||||||
|
:publis-lesson-list="PublisLessonList"
|
||||||
|
:publish-map-list="PublishMapList"
|
||||||
|
@editRuleForm="editRuleForm"
|
||||||
|
@addRuleForm="addRuleForm"
|
||||||
|
/>
|
||||||
|
</el-scrollbar>
|
||||||
|
</div>
|
||||||
|
<qr-code ref="qrCode" />
|
||||||
|
<can-transfer ref="canDistribute" @distribute="distribute" />
|
||||||
|
</el-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { UrlConfig } from '@/router/index';
|
import { listPublishMap, getPublishMapInfo } from '@/api/jmap/map';
|
||||||
import { listPublishMap, getPublishMapInfo } from '@/api/jmap/map';
|
import { getPublishLessonList } from '@/api/jmap/lesson';
|
||||||
import { getPublishLessonList } from '@/api/jmap/lesson';
|
import { getCommodityMapProduct } from '@/api/management/mapprd';
|
||||||
import { getCommodityMapProduct } from '@/api/management/mapprd';
|
import { packagePermissionDistribute } from '@/api/management/distribute';
|
||||||
import { packagePermissionDistribute } from '@/api/management/distribute';
|
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
|
||||||
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
|
import QrCode from '@/components/QrCode';
|
||||||
import QrCode from "@/components/QrCode";
|
import EditRule from './editRule';
|
||||||
import EditRule from './editRule';
|
import CanTransfer from './canDistribute';
|
||||||
import CanTransfer from './canDistribute';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'packRule',
|
name: 'PackRule',
|
||||||
mixins: [
|
components: {
|
||||||
WindowResizeHandler
|
EditRule,
|
||||||
],
|
QrCode,
|
||||||
components: {
|
CanTransfer
|
||||||
EditRule,
|
},
|
||||||
QrCode,
|
mixins: [
|
||||||
CanTransfer
|
WindowResizeHandler
|
||||||
},
|
],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
display: 1,
|
display: 1,
|
||||||
height: 0,
|
height: 0,
|
||||||
urlInfo: {},
|
urlInfo: {},
|
||||||
PermissionTypeList: [],
|
PermissionTypeList: [],
|
||||||
PublisLessonList: [],
|
PublisLessonList: [],
|
||||||
PublishMapList: [],
|
PublishMapList: [],
|
||||||
ruleList: [],
|
ruleList: []
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.loadInitData();
|
this.loadInitData();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getSummaries(param) {
|
getSummaries(param) {
|
||||||
const { columns, data } = param;
|
const { columns, data } = param;
|
||||||
const sums = [];
|
const sums = [];
|
||||||
columns.forEach((column, index) => {
|
columns.forEach((column, index) => {
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
sums[index] = '总数';
|
sums[index] = '总数';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index === 6) {
|
if (index === 6) {
|
||||||
const values = data.map(item => Number(item[column.property]));
|
const values = data.map(item => Number(item[column.property]));
|
||||||
if (!values.every(value => isNaN(value))) {
|
if (!values.every(value => isNaN(value))) {
|
||||||
sums[index] = values.reduce((prev, curr) => {
|
sums[index] = values.reduce((prev, curr) => {
|
||||||
const value = Number(curr);
|
const value = Number(curr);
|
||||||
if (!isNaN(value)) {
|
if (!isNaN(value)) {
|
||||||
return prev + curr;
|
return prev + curr;
|
||||||
} else {
|
} else {
|
||||||
return prev;
|
return prev;
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return sums;
|
return sums;
|
||||||
},
|
},
|
||||||
resizeHandler: function () {
|
resizeHandler: function () {
|
||||||
this.height = this._clientHeight - 63;
|
this.height = this._clientHeight - 63;
|
||||||
},
|
},
|
||||||
computedName(list, code) {
|
computedName(list, code) {
|
||||||
let name = '';
|
let name = '';
|
||||||
list.forEach(elem => {
|
list.forEach(elem => {
|
||||||
if (elem.value == code) {
|
if (elem.value == code) {
|
||||||
name = elem.label;
|
name = elem.label;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return name;
|
return name;
|
||||||
},
|
},
|
||||||
async computedMapProduct(item) {
|
async computedMapProduct(item) {
|
||||||
let name = '';
|
let name = '';
|
||||||
let resp = await getPublishMapInfo(item.mapId);
|
const resp = await getPublishMapInfo(item.mapId);
|
||||||
let rest = await getCommodityMapProduct(resp.data.skinCode);
|
const rest = await getCommodityMapProduct(resp.data.skinCode);
|
||||||
let list = rest.data || [];
|
const list = rest.data || [];
|
||||||
list.forEach(elem => {
|
list.forEach(elem => {
|
||||||
if (elem.id = item.mapProductCode) {
|
if (elem.id == item.mapProductCode) {
|
||||||
name = elem.name;
|
name = elem.name;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
return name;
|
return name;
|
||||||
},
|
},
|
||||||
loadInitData() {
|
loadInitData() {
|
||||||
this.PermissionTypeList = [];
|
this.PermissionTypeList = [];
|
||||||
this.$Dictionary.permissionType().then(list => {
|
this.$Dictionary.permissionType().then(list => {
|
||||||
this.PermissionTypeList = list.map(elem => {
|
this.PermissionTypeList = list.map(elem => {
|
||||||
return { value: elem.code, label: elem.name }
|
return { value: elem.code, label: elem.name };
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.EffectiveTypeList = [];
|
this.EffectiveTypeList = [];
|
||||||
this.$Dictionary.effectiveType().then(list => {
|
this.$Dictionary.effectiveType().then(list => {
|
||||||
this.EffectiveTypeList = list.map(elem => {
|
this.EffectiveTypeList = list.map(elem => {
|
||||||
return { value: elem.code, label: elem.name }
|
return { value: elem.code, label: elem.name };
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.PublishMapList = [];
|
this.PublishMapList = [];
|
||||||
listPublishMap().then(response => {
|
listPublishMap().then(response => {
|
||||||
let list = response.data || [];
|
const list = response.data || [];
|
||||||
this.PublishMapList = list.map(elem => {
|
this.PublishMapList = list.map(elem => {
|
||||||
return { value: elem.id, label: elem.name }
|
return { value: elem.id, label: elem.name };
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
this.PublisLessonList = [];
|
this.PublisLessonList = [];
|
||||||
getPublishLessonList().then(response => {
|
getPublishLessonList().then(response => {
|
||||||
let list = response.data || [];
|
const list = response.data || [];
|
||||||
this.PublisLessonList = list.map(elem => {
|
this.PublisLessonList = list.map(elem => {
|
||||||
return { value: elem.id, label: elem.name, mapId: elem.mapId, prdCode: elem.prdCode }
|
return { value: elem.id, label: elem.name, mapId: elem.mapId, prdCode: elem.prdCode };
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
turnback() {
|
turnback() {
|
||||||
this.$router.go(-1)
|
this.$router.go(-1);
|
||||||
},
|
},
|
||||||
dialogAdd() {
|
dialogAdd() {
|
||||||
this.$refs.addRule.doShow({ type: 'add' });
|
this.$refs.addRule.doShow({ type: 'add' });
|
||||||
},
|
},
|
||||||
dialogEdit(item) {
|
dialogEdit(item) {
|
||||||
this.$refs.addRule.doShow({ type: 'edit', item: item });
|
this.$refs.addRule.doShow({ type: 'edit', item: item });
|
||||||
},
|
},
|
||||||
deleteForm(item) {
|
deleteForm(item) {
|
||||||
var index = this.ruleList.indexOf(item)
|
var index = this.ruleList.indexOf(item);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
this.ruleList.splice(index, 1);
|
this.ruleList.splice(index, 1);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addRuleForm(item) {
|
addRuleForm(item) {
|
||||||
let index = this.ruleList.findIndex(elem => {
|
const index = this.ruleList.findIndex(elem => {
|
||||||
return item.mapId == elem.mapId &&
|
return item.mapId == elem.mapId &&
|
||||||
item.lessonId == elem.lessonId &&
|
item.lessonId == elem.lessonId &&
|
||||||
item.mapProductCode == elem.mapProductCode &&
|
item.mapProductCode == elem.mapProductCode &&
|
||||||
item.permissionType == elem.permissionType
|
item.permissionType == elem.permissionType;
|
||||||
})
|
});
|
||||||
|
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
this.ruleList.push(item);
|
this.ruleList.push(item);
|
||||||
} else {
|
} else {
|
||||||
this.$message.warning('已存在此类型规则');
|
this.$message.warning('已存在此类型规则');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
editRuleForm(item) {
|
editRuleForm(item) {
|
||||||
let index = this.ruleList.findIndex(elem => {
|
const index = this.ruleList.findIndex(elem => {
|
||||||
return item.mapId == elem.mapId &&
|
return item.mapId == elem.mapId &&
|
||||||
item.lessonId == elem.lessonId &&
|
item.lessonId == elem.lessonId &&
|
||||||
item.mapProductCode == elem.mapProductCode &&
|
item.mapProductCode == elem.mapProductCode &&
|
||||||
item.permissionType == elem.permissionType
|
item.permissionType == elem.permissionType;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
Object.assign(this.ruleList[index], item);
|
Object.assign(this.ruleList[index], item);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
packForm() {
|
packForm() {
|
||||||
if (this.ruleList.length) {
|
if (this.ruleList.length) {
|
||||||
this.$refs.canDistribute.doShow();
|
this.$refs.canDistribute.doShow();
|
||||||
} else {
|
} else {
|
||||||
this.$messageBox('请添加规则');
|
this.$messageBox('请添加规则');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
distribute(data) {
|
distribute(data) {
|
||||||
this.url = '';
|
this.url = '';
|
||||||
this.ruleList.forEach(item => {
|
this.ruleList.forEach(item => {
|
||||||
item.canDistribute = data.canDistribute;
|
item.canDistribute = data.canDistribute;
|
||||||
});
|
});
|
||||||
packagePermissionDistribute(this.ruleList).then(resp => {
|
packagePermissionDistribute(this.ruleList).then(resp => {
|
||||||
this.urlInfo = {
|
this.urlInfo = {
|
||||||
url: resp.data,
|
url: resp.data,
|
||||||
title: '权限分发二维码'
|
title: '权限分发二维码'
|
||||||
};
|
};
|
||||||
this.QrCodeShow();
|
this.qrcodeShow();
|
||||||
}).catch(error => {
|
}).catch(() => {
|
||||||
this.$messageBox('打包权限失败');
|
this.$messageBox('打包权限失败');
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
QrCodeShow() {
|
qrcodeShow() {
|
||||||
if (this.$refs) {
|
if (this.$refs) {
|
||||||
this.$refs.qrCode.doShow(this.urlInfo);
|
this.$refs.qrCode.doShow(this.urlInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
.pack-box {
|
.pack-box {
|
||||||
@ -307,4 +314,4 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 20px auto;
|
margin: 20px auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,112 +1,112 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-card>
|
<el-card>
|
||||||
<div slot="header" style="text-align: center;">
|
<div slot="header" style="text-align: center;">
|
||||||
<b>实训名称: {{ courseModel.name }}</b>
|
<b>实训名称: {{ courseModel.name }}</b>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin:50px">
|
<div style="margin:50px">
|
||||||
<el-scrollbar wrapClass="scrollbar-wrapper" :style="{ height: height - 190 +'px' }">
|
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: height - 190 +'px' }">
|
||||||
<p class="list-item">
|
<p class="list-item">
|
||||||
<span class="list-label">完成实训最佳用时:</span>
|
<span class="list-label">完成实训最佳用时:</span>
|
||||||
<span class="list-elem"> {{ courseModel.minDuration | setTime}} 秒</span>
|
<span class="list-elem"> {{ courseModel.minDuration | setTime }} 秒</span>
|
||||||
</p>
|
</p>
|
||||||
<p class="list-item">
|
<p class="list-item">
|
||||||
<span class="list-label">完成实训最大用时:</span>
|
<span class="list-label">完成实训最大用时:</span>
|
||||||
<span class="list-elem">{{ courseModel.maxDuration | setTime}} 秒</span>
|
<span class="list-elem">{{ courseModel.maxDuration | setTime }} 秒</span>
|
||||||
</p>
|
</p>
|
||||||
<p class="list-item">
|
<p class="list-item">
|
||||||
<span class="list-label">实训说明:</span>
|
<span class="list-label">实训说明:</span>
|
||||||
<span class="list-elem">{{ courseModel.remarks }}</span>
|
<span class="list-elem">{{ courseModel.remarks }}</span>
|
||||||
</p>
|
</p>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn-start">
|
<div class="btn-start">
|
||||||
<el-button type="primary" @click="start">开始实训</el-button>
|
<el-button type="primary" @click="start">开始实训</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from "vuex";
|
import { mapGetters } from 'vuex';
|
||||||
import { getTrainingDetail, } from "@/api/jmap/training";
|
import { getTrainingDetail } from '@/api/jmap/training';
|
||||||
import { trainingNotify } from '@/api/simulation';
|
import { trainingNotify } from '@/api/simulation';
|
||||||
import { PermissionType } from "@/scripts/ConstDic";
|
import { PermissionType } from '@/scripts/ConstDic';
|
||||||
import { UrlConfig } from '@/router/index';
|
import { UrlConfig } from '@/router/index';
|
||||||
import { launchFullscreen } from '@/utils/screen';
|
import { launchFullscreen } from '@/utils/screen';
|
||||||
import WindowResizeHandler from "@/mixin/WindowResizeHandler";
|
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "LessonPracticalDetail",
|
name: 'LessonPracticalDetail',
|
||||||
components: {},
|
components: {},
|
||||||
data() {
|
filters: {
|
||||||
return {
|
setTime(val) {
|
||||||
height: "",
|
return val;
|
||||||
courseModel: {
|
}
|
||||||
id: "",
|
},
|
||||||
name: "",
|
mixins: [WindowResizeHandler],
|
||||||
maxDuration: "",
|
data() {
|
||||||
minDuration: "",
|
return {
|
||||||
remarks: "",
|
height: '',
|
||||||
updateTime: ""
|
courseModel: {
|
||||||
}
|
id: '',
|
||||||
};
|
name: '',
|
||||||
},
|
maxDuration: '',
|
||||||
mixins: [WindowResizeHandler],
|
minDuration: '',
|
||||||
filters: {
|
remarks: '',
|
||||||
setTime(val) {
|
updateTime: ''
|
||||||
return val;
|
}
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
$route(newVal) {
|
$route(newVal) {
|
||||||
this.initLoadPage();
|
this.initLoadPage();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initLoadPage();
|
this.initLoadPage();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
resizeHandler: function () {
|
resizeHandler: function () {
|
||||||
this.height = this._clientHeight;
|
this.height = this._clientHeight;
|
||||||
},
|
},
|
||||||
initLoadPage() {
|
initLoadPage() {
|
||||||
let data = { id: this.$route.params.trainingId };
|
const data = { id: this.$route.params.trainingId };
|
||||||
if (parseInt(data.id)) {
|
if (parseInt(data.id)) {
|
||||||
getTrainingDetail(data)
|
getTrainingDetail(data)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.courseModel = {
|
this.courseModel = {
|
||||||
id: res.data.id,
|
id: res.data.id,
|
||||||
name: res.data.name,
|
name: res.data.name,
|
||||||
maxDuration: res.data.maxDuration,
|
maxDuration: res.data.maxDuration,
|
||||||
remarks: res.data.remarks,
|
remarks: res.data.remarks,
|
||||||
minDuration: res.data.minDuration,
|
minDuration: res.data.minDuration,
|
||||||
updateTime: res.data.updateTime
|
updateTime: res.data.updateTime
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
this.$message.error("获取课程信息失败:" + error.message);
|
this.$message.error('获取课程信息失败:' + error.message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
start() {
|
start() {
|
||||||
const loading = this.$loading({
|
const loading = this.$loading({
|
||||||
lock: true,
|
lock: true,
|
||||||
text: 'Loading',
|
text: 'Loading',
|
||||||
spinner: 'el-icon-loading',
|
spinner: 'el-icon-loading',
|
||||||
background: 'rgba(0, 0, 0, 0.7)'
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
});
|
});
|
||||||
trainingNotify({ trainingId: this.$route.params.trainingId }).then(resp => {
|
trainingNotify({ trainingId: this.$route.params.trainingId }).then(resp => {
|
||||||
let query = {
|
const query = {
|
||||||
group: resp.data, trainingId: this.$route.params.trainingId, lessonId: this.$route.params.lessonId
|
group: resp.data, trainingId: this.$route.params.trainingId, lessonId: this.$route.params.lessonId
|
||||||
};
|
};
|
||||||
this.$router.push({ path: `${UrlConfig.display}/teach`, query: query });
|
this.$router.push({ path: `${UrlConfig.display}/teach`, query: query });
|
||||||
launchFullscreen();
|
launchFullscreen();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.$messageBox(`创建仿真失败: ${error.message}`);
|
this.$messageBox(`创建仿真失败: ${error.message}`);
|
||||||
loading.close();
|
loading.close();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
@import "src/styles/mixin.scss";
|
@import "src/styles/mixin.scss";
|
||||||
|
Loading…
Reference in New Issue
Block a user