修改接口

This commit is contained in:
ival 2019-08-14 14:01:28 +08:00
parent 72c1f1d4ca
commit 6343a79f81
11 changed files with 2303 additions and 2270 deletions

View File

@ -4,11 +4,21 @@
<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"
>
<el-tab-pane
v-for="item in productList"
:key="item.code"
:name="item.code"
:label="item.name"
style="padding: 5px"
:style="{ height: height-160 +'px' }"
>
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: height-170 +'px' }">
<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>
@ -16,45 +26,54 @@
<p class="list-item"> <p class="list-item">
<span class="list-label">权限列表</span> <span class="list-label">权限列表</span>
</p> </p>
<limit-list :ref="`limit_${item.code}`" :courseModel="courseModel" @initLoadPage="initLoadPage"> <limit-list :ref="`limit_${item.code}`" :course-model="courseModel" @initLoadPage="initLoadPage" />
</limit-list>
</el-scrollbar> </el-scrollbar>
</el-tab-pane> </el-tab-pane>
<div class="btn-buy" v-if="hasProduct"> <div v-if="hasProduct" class="btn-buy">
<el-button type="success" @click="buy">购买</el-button> <el-button type="success" @click="buy">购买</el-button>
<el-button type="primary" @click="distribute" v-if="hasPermssion">权限分发</el-button> <el-button v-if="hasPermssion" type="primary" @click="distribute">权限分发</el-button>
<el-button type="primary" @click="transfer" v-if="hasPermssion">权限转赠</el-button> <el-button v-if="hasPermssion" type="primary" @click="transfer">权限转赠</el-button>
<el-button type="primary" @click="start" v-show="isStartDemon">开始仿真</el-button> <el-button v-show="isStartDemon" type="primary" @click="start">开始仿真</el-button>
<el-button type="primary" @click="start" v-show="isCreateRoom">创建房间</el-button> <el-button v-show="isCreateRoom" type="primary" @click="start">创建房间</el-button>
<el-button type="primary" @click="joinRoom" v-show="isInRoom">进入房间</el-button> <el-button v-show="isInRoom" type="primary" @click="joinRoom">进入房间</el-button>
</div> </div>
</el-tabs> </el-tabs>
</el-card> </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: [
WindowResizeHandler
],
components: { components: {
LimitList LimitList
}, },
filters: {
setTime(val) {
if (val <= 1) {
return `0分钟`;
} else if (val > 1 && val <= 60) {
return '1分钟';
} else if (val > 60) {
const time = parseInt(val / 60);
return `${time}分钟`;
}
}
},
mixins: [
WindowResizeHandler
],
data() { data() {
return { return {
height: '', height: '',
@ -73,24 +92,12 @@
remarks: '', remarks: '',
prdType: '', prdType: '',
prdCode: '', prdCode: '',
pmsList: [], pmsList: []
}, },
EffectiveTypeList: [], EffectiveTypeList: [],
jointShow: false, jointShow: false,
jointGroup: '', jointGroup: ''
} };
},
filters: {
setTime(val) {
if (val <= 1) {
return `0分钟`;
} else if (1 < val && val <= 60) {
return '1分钟';
} else if (val > 60) {
let time = parseInt(val / 60);
return `${time}分钟`;
}
}
}, },
computed: { computed: {
hasProduct() { hasProduct() {
@ -107,10 +114,10 @@
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;
@ -138,13 +145,13 @@
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;
} }
@ -161,7 +168,7 @@
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) {
@ -177,10 +184,10 @@
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 = {
@ -195,18 +202,18 @@
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 {
@ -227,19 +234,19 @@
}, },
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) {
@ -248,14 +255,14 @@
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',
@ -272,7 +279,7 @@
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.buy(); this.buy();
}).catch(() => { }) }).catch(() => { });
} else { } else {
this.jump(); this.jump();
} }
@ -280,15 +287,15 @@
} }
}, },
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({
@ -307,7 +314,7 @@
} }
} }
} }
} };
</script> </script>
<style scoped> <style scoped>
::-webkit-scrollbar { ::-webkit-scrollbar {

View File

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

View File

@ -4,12 +4,12 @@
<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>
@ -32,14 +32,10 @@
<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-column>
<el-table-column prop="chapterIdLong" label="总分">
</el-table-column>
</el-table> </el-table>
</p> </p>
</span> </span>
@ -52,18 +48,18 @@
</el-card> </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
@ -81,12 +77,12 @@
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) {
@ -96,30 +92,30 @@
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);
@ -138,10 +134,10 @@
}, },
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;
@ -151,12 +147,12 @@
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;
} }
@ -167,22 +163,22 @@
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: '取消',
@ -200,7 +196,7 @@
} }
}, },
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',
@ -209,7 +205,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,
@ -220,11 +216,11 @@
}).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";

View File

@ -1,44 +1,65 @@
<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"
class="file_box"
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
@change="importf"
>
导入地图 导入地图
</el-button> </el-button>
</div> </div>
<el-scrollbar wrapClass="scrollbar-wrapper" :style="{height: height + 'px'}"> <el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height + 'px'}">
<el-tree ref="tree" :data="mapList" node-key="id" highlight-current :props="defaultProps" <el-tree
@node-click="handleNodeClick" @node-contextmenu="showContextMenu" class="tree-height-max"> ref="tree"
:data="mapList"
node-key="id"
highlight-current
:props="defaultProps"
class="tree-height-max"
@node-click="handleNodeClick"
@node-contextmenu="showContextMenu"
>
<span slot-scope="{ node, data }"> <span slot-scope="{ node, data }">
<span v-if="node.data.type == 'skin'" class="el-icon-news">&nbsp;{{ node.label }}</span> <span v-if="node.data.type == 'skin'" class="el-icon-news">&nbsp;{{ node.label }}</span>
<span v-if="node.data.type == 'map'" class="el-icon-edit-outline">&nbsp;{{ node.label }}</span> <span v-if="node.data.type == 'map'" class="el-icon-edit-outline">&nbsp;{{ node.label }}</span>
</span> </span>
</el-tree> </el-tree>
</el-scrollbar> </el-scrollbar>
<map-create ref="mapCreate" @refresh="refresh" :skinCode="skinCode" @editmap="handleNodeClick"></map-create> <map-create ref="mapCreate" :skin-code="skinCode" @refresh="refresh" @editmap="handleNodeClick" />
<map-operate-menu ref="menu" :point="point" :editModel="editModel" @editRoute="editRoute" @setSwitch="setSwitch" <map-operate-menu
@editMap="handleNodeClick" @pathUnit="pathUnit" @refresh="refresh"></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,
@ -61,8 +82,8 @@
point: { point: {
x: 0, x: 0,
y: 0 y: 0
},
} }
};
}, },
mounted() { mounted() {
this.refresh(); this.refresh();
@ -84,12 +105,12 @@
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 });
} }
@ -123,26 +144,26 @@
}).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 {
@ -150,15 +171,15 @@
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') {
@ -188,25 +209,25 @@
}, },
// //
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;
@ -214,14 +235,14 @@
// //
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
@ -229,18 +250,18 @@
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);
@ -253,11 +274,11 @@
// //
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) {
@ -273,7 +294,7 @@
}); });
} }
} }
} };
</script> </script>
<style scoped rel="stylesheet/scss" lang="scss"> <style scoped rel="stylesheet/scss" lang="scss">
.uploadDemo { .uploadDemo {

View File

@ -1,31 +1,42 @@
<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"
:key="index"
:label="item.name"
:value="item.code"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="关联产品:" prop="prdCode"> <el-form-item label="关联产品:" prop="prdCode">
<el-select v-model="courseModel.prdCode" placeholder="请选择" :disabled="isEdit"> <el-select v-model="courseModel.prdCode" placeholder="请选择" :disabled="isEdit">
<el-option v-for="(item,index) in productList" :key="index" :label="item.name" <el-option
:value="item.code"></el-option> v-for="(item,index) in productList"
:key="index"
:label="item.name"
:value="item.code"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="课程说明:" prop="remarks"> <el-form-item label="课程说明:" prop="remarks">
<el-input type="textarea" :autosize="{ minRows: 6, maxRows: 6}" placeholder="请输入内容" <el-input
v-model="courseModel.remarks"> v-model="courseModel.remarks"
</el-input> type="textarea"
:autosize="{ minRows: 6, maxRows: 6}"
placeholder="请输入内容"
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-scrollbar> </el-scrollbar>
@ -33,7 +44,7 @@
<div class="draft"> <div class="draft">
<el-button-group> <el-button-group>
<template v-if="!isEdit"> <template v-if="!isEdit">
<el-button type="primary" @click="create" v-if="courseModel.skinCode">创建</el-button> <el-button v-if="courseModel.skinCode" type="primary" @click="create">创建</el-button>
</template> </template>
<template v-else> <template v-else>
<el-button type="primary" @click="update">更新</el-button> <el-button type="primary" @click="update">更新</el-button>
@ -42,28 +53,27 @@
</template> </template>
</el-button-group> </el-button-group>
</div> </div>
<publish-lesson ref="publishLesson"></publish-lesson> <publish-lesson ref="publishLesson" />
</div> </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: {
height: {
type: Number
}
},
components: { components: {
PublishLesson PublishLesson
}, },
props: {
height: {
type: Number,
required: true
}
},
data() { data() {
return { return {
isEdit: false, isEdit: false,
@ -76,16 +86,16 @@
product: [], product: [],
skinCode: '', skinCode: '',
name: '', name: '',
remarks: '', remarks: ''
}
} }
};
}, },
computed: { computed: {
title() { title() {
return this.isEdit ? '编辑课程' : '创建课程'; return this.isEdit ? '编辑课程' : '创建课程';
}, },
rules() { rules() {
let baseRules = { const baseRules = {
name: [ name: [
{ required: true, message: '请输入课程名称', trigger: 'change' } { required: true, message: '请输入课程名称', trigger: 'change' }
], ],
@ -97,8 +107,8 @@
], ],
remarks: [ remarks: [
{ required: true, message: '请输入课程说明', trigger: 'change' } { required: true, message: '请输入课程说明', trigger: 'change' }
], ]
} };
return baseRules; return baseRules;
} }
}, },
@ -106,7 +116,7 @@
this.skinStyleList = []; this.skinStyleList = [];
getSkinStyleList().then(response => { getSkinStyleList().then(response => {
this.skinStyleList = response.data; this.skinStyleList = response.data;
}) });
}, },
methods: { methods: {
initData(isNew, node) { initData(isNew, node) {
@ -121,8 +131,8 @@
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() {
@ -132,17 +142,17 @@
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('创建失败');
}); });
} }
}); });
@ -150,18 +160,18 @@
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('更新失败');
}); });
} }
}); });
@ -193,21 +203,21 @@
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>

View File

@ -3,57 +3,67 @@
<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"
:label="option.name"
:value="option.code"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="产品类型:" prop="prdCode"> <el-form-item label="产品类型:" prop="prdCode">
<el-select v-model="operateModel.prdCode" @change="prdChange"> <el-select v-model="operateModel.prdCode" @change="prdChange">
<el-option v-for="option in productList" :key="option.code" :label="option.name" <el-option
:value="option.code"> v-for="option in productList"
</el-option> :key="option.code"
:label="option.name"
:value="option.code"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="实训类型:" prop="type"> <el-form-item label="实训类型:" prop="type">
<el-select v-model="operateModel.type" @change="typeChange"> <el-select v-model="operateModel.type" @change="typeChange">
<el-option v-for="option in trainingTypeLists" :key="option.code" :label="option.name" <el-option
:value="option.code"> v-for="option in trainingTypeLists"
</el-option> :key="option.code"
:label="option.name"
:value="option.code"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="操作类型:" prop="operateType"> <el-form-item label="操作类型:" prop="operateType">
<el-select v-model="operateModel.operateType" multiple> <el-select v-model="operateModel.operateType" multiple>
<el-option v-for="option in trainingTypeMap[operateModel.type]" :key="option.code" <el-option
:label="option.name" :value="option.code"> v-for="option in trainingTypeMap[operateModel.type]"
</el-option> :key="option.code"
:label="option.name"
:value="option.code"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="最小用时:" prop="minDuration" v-if="isUpdate"> <el-form-item v-if="isUpdate" label="最小用时:" prop="minDuration">
<el-input-number v-model="operateModel.minDuration" :min="0" :max="10000"></el-input-number>s <el-input-number v-model="operateModel.minDuration" :min="0" :max="10000" />s
</el-form-item> </el-form-item>
<el-form-item label="最大用时:" prop="maxDuration" v-if="isUpdate"> <el-form-item v-if="isUpdate" label="最大用时:" prop="maxDuration">
<el-input-number v-model="operateModel.maxDuration" :min="0" :max="10000"></el-input-number>s <el-input-number v-model="operateModel.maxDuration" :min="0" :max="10000" />s
</el-form-item> </el-form-item>
<el-form-item label="实训描述:" prop="remarks" v-if="isUpdate"> <el-form-item v-if="isUpdate" label="实训描述:" prop="remarks">
<el-input type="textarea" v-model="operateModel.remarks"></el-input> <el-input v-model="operateModel.remarks" type="textarea" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="handleClose"> </el-button> <el-button @click="handleClose"> </el-button>
<el-button type="primary" @click="handleDeal" :loading="loading"> </el-button> <el-button type="primary" :loading="loading" @click="handleDeal"> </el-button>
</span> </span>
</el-dialog> </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: {
@ -107,15 +117,15 @@
} else { } else {
callback(); callback();
} }
}
var checkRemarks = (rule, value, callback) => {
if (this.operation.event == '02' && !value) {
return callback(new Error('请输入实训描述'));
}
callback();
}; };
// var checkRemarks = (rule, value, callback) => {
// if (this.operation.event == '02' && !value) {
// return callback(new Error(''));
// }
// callback();
// };
return { return {
dialogShow: false, dialogShow: false,
productTypesList: [], productTypesList: [],
@ -130,14 +140,14 @@
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: [
@ -157,12 +167,12 @@
], ],
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() {
@ -174,7 +184,7 @@
this.operation = { this.operation = {
event: data.event, event: data.event,
title: data.title title: data.title
} };
this.dialogShow = true; this.dialogShow = true;
}, },
close() { close() {
@ -187,17 +197,17 @@
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 => {
@ -213,10 +223,10 @@
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 => {
@ -226,15 +236,15 @@
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() {
@ -245,27 +255,27 @@
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,
@ -274,40 +284,40 @@
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>

View File

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

View File

@ -3,20 +3,23 @@
<!-- <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'}"
style="padding-top: 40px"
>
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
</el-scrollbar> </el-scrollbar>
</el-card> </el-card>
<div class="draft"> <div class="draft">
<el-button-group> <el-button-group>
<el-button type="primary" @click="create" v-if="isAdd">{{$t('global.create')}}</el-button> <el-button v-if="isAdd" type="primary" @click="create">{{ $t('global.create') }}</el-button>
<el-button type="warning" @click="update" v-if="isEdit">{{$t('global.update')}}</el-button> <el-button v-if="isEdit" type="warning" @click="update">{{ $t('global.update') }}</el-button>
<el-button type="primary" @click="turnback">{{$t('global.return')}}</el-button> <el-button type="primary" @click="turnback">{{ $t('global.return') }}</el-button>
</el-button-group> </el-button-group>
</div> </div>
</div> </div>
@ -24,19 +27,13 @@
</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
@ -67,9 +64,9 @@
tryUseTime: 0, tryUseTime: 0,
tryUseTimeUnit: '05', tryUseTimeUnit: '05',
price: 0, price: 0,
remarks: '', remarks: ''
},
} }
};
}, },
computed: { computed: {
// turnbackBarTitle() { // turnbackBarTitle() {
@ -79,7 +76,7 @@
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'));
@ -97,18 +94,17 @@
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() { form() {
let form = { const form = {
labelWidth: '135px', labelWidth: '135px',
items: [ items: [
{ prop: 'name', label: this.$t('orderAuthor.commodityName'), type: 'text', required: false }, { prop: 'name', label: this.$t('orderAuthor.commodityName'), type: 'text', required: false },
@ -120,15 +116,15 @@
{ prop: 'tryUseTimeUnit', label: this.$t('orderAuthor.unitOfTime'), type: 'select', required: false, disabled: this.foreverIsDisabled, show: this.isShowForever, options: this.TimeStyleList }, { 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: '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: '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, }, { prop: 'remarks', label: this.$t('orderAuthor.describtion'), type: 'textarea', required: false }
] ]
} };
return form return form;
}, },
rules() { rules() {
let baseRules = { const baseRules = {
name: [ name: [
{ required: true, message: this.$t('orderAuthor.goodsNameInput'), trigger: 'blur' } { required: true, message: this.$t('orderAuthor.goodsNameInput'), trigger: 'blur' }
], ],
@ -167,15 +163,15 @@
callback(new Error(this.$t('orderAuthor.totalPriceInputError2'))); callback(new Error(this.$t('orderAuthor.totalPriceInputError2')));
} }
}, },
trigger: 'blur', trigger: 'blur'
} }
], ],
remarks: [ remarks: [
{ required: true, message: this.$t('orderAuthor.goodsDescribtionInput'), trigger: 'blur' } { required: true, message: this.$t('orderAuthor.goodsDescribtionInput'), trigger: 'blur' }
], ]
} };
// //
this.$nextTick(function () { this.$nextTick(function () {
this.$refs.dataform.clearValidate(); this.$refs.dataform.clearValidate();
}); });
@ -195,13 +191,13 @@
// , // ,
this.mapIdList.length = 0; this.mapIdList.length = 0;
try { try {
let response = await listPublishMap(); const response = await listPublishMap();
// this.dataLesson = response.data; // this.dataLesson = response.data;
let data = response.data; const data = response.data;
if (data && data.length) { if (data && data.length) {
data.forEach(elem => { data.forEach(elem => {
this.mapIdList.push({ value: elem.id, label: elem.name }); this.mapIdList.push({ value: elem.id, label: elem.name });
}) });
} }
} catch (error) { } catch (error) {
this.$messageBox(this.$t('error.getItemListFailed')); this.$messageBox(this.$t('error.getItemListFailed'));
@ -221,17 +217,17 @@
}); });
list.forEach(elem => { list.forEach(elem => {
this.TimeStyleDict[elem.code] = elem.name; this.TimeStyleDict[elem.code] = elem.name;
}) });
}); });
// //
this.$refs.dataform.resetForm(); this.$refs.dataform.resetForm();
// //
this.type = String(this.$route.params.mode).toUpperCase(); this.type = String(this.$route.params.mode).toUpperCase();
if (this.type === 'EDIT') { if (this.type === 'EDIT') {
try { try {
let res = await getCommodityDetailById(this.$route.params.commodityId); const res = await getCommodityDetailById(this.$route.params.commodityId);
this.mapChange(res.data.mapId); this.mapChange(res.data.mapId);
this.productChange(res.data.mapProductCode); this.productChange(res.data.mapProductCode);
this.formModel = { this.formModel = {
@ -245,25 +241,25 @@
tryUseTimeUnit: res.data.tryUseTimeUnit || '05', tryUseTimeUnit: res.data.tryUseTimeUnit || '05',
price: res.data.price, price: res.data.price,
remarks: res.data.remarks, remarks: res.data.remarks,
id: res.data.id, id: res.data.id
}; };
} catch (err) { } catch (err) {
this.$messageBox(this.$t('error.getItemListFailed')); this.$messageBox(this.$t('error.getItemListFailed'));
} }
} }
// //
this.$nextTick(function () { this.$nextTick(function () {
this.$refs.dataform.clearValidate(); this.$refs.dataform.clearValidate();
}); });
}, },
typeChange(type) { typeChange(type) {
this.mapProductCodeListFilter = this.mapProductCodeList.filter(elem => { this.mapProductCodeListFilter = this.mapProductCodeList.filter(elem => {
if (type != '03') { //仿, if (type != '03') { // 仿,
return elem.prdType != '03'; return elem.prdType != '03';
} else { } else {
return true; return true;
} }
}) });
}, },
async mapChange(mapId) { async mapChange(mapId) {
this.mapProductCodeList = []; this.mapProductCodeList = [];
@ -271,14 +267,14 @@
this.lessonIdList = []; this.lessonIdList = [];
this.formModel.lessonId = ''; this.formModel.lessonId = '';
try { try {
let rest = await getPublishMapInfo(mapId); const rest = await getPublishMapInfo(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 && resp.code == 200) { if (resp && resp.code == 200) {
resp.data.forEach(ele => { resp.data.forEach(ele => {
this.mapProductCodeList.push({ value: ele.code, label: ele.name, prdType: ele.prdType }); this.mapProductCodeList.push({ value: ele.code, label: ele.name, prdType: ele.prdType });
this.typeChange(this.formModel.productType); this.typeChange(this.formModel.productType);
}) });
} }
} }
} catch (err) { } catch (err) {
@ -289,19 +285,19 @@
this.formModel.lessonId = ''; this.formModel.lessonId = '';
this.lessonIdList = []; this.lessonIdList = [];
try { try {
let rest = await getCommodityProductLesson(productId); const rest = await getCommodityProductLesson(productId);
if (rest && rest.code == 200) { if (rest && rest.code == 200) {
rest.data.forEach(ele => { rest.data.forEach(ele => {
this.lessonIdList.push({ value: ele.id, label: ele.name }); this.lessonIdList.push({ value: ele.id, label: ele.name });
}) });
} }
} catch (err) { } catch (err) {
this.$messageBox(this.$t('error.getLessonListFailed')); this.$messageBox(this.$t('error.getLessonListFailed'));
} }
}, },
buildModel() { buildModel() {
// //
let model = { const model = {
name: this.formModel.name, name: this.formModel.name,
productType: this.formModel.productType, productType: this.formModel.productType,
mapId: this.formModel.mapId, mapId: this.formModel.mapId,
@ -312,8 +308,8 @@
tryUseTimeUnit: this.formModel.tryUseTimeUnit, tryUseTimeUnit: this.formModel.tryUseTimeUnit,
price: this.formModel.price, price: this.formModel.price,
remarks: this.formModel.remarks, remarks: this.formModel.remarks,
id: this.formModel.id, id: this.formModel.id
} };
return model; return model;
}, },
create() { create() {
@ -321,7 +317,7 @@
saveCommodityList(this.buildModel()).then(response => { saveCommodityList(this.buildModel()).then(response => {
this.turnback(); this.turnback();
this.$message.success(this.$t('tip.creatingSuccessful')); this.$message.success(this.$t('tip.creatingSuccessful'));
}).catch(error => { }).catch(() => {
this.$messageBox(this.$t('tip.creatingFailed')); this.$messageBox(this.$t('tip.creatingFailed'));
}); });
}); });
@ -331,16 +327,16 @@
updataCommodityList(this.buildModel()).then(response => { updataCommodityList(this.buildModel()).then(response => {
this.turnback(); this.turnback();
this.$message.success(this.$t('tip.updateSuccessfully')); this.$message.success(this.$t('tip.updateSuccessfully'));
}).catch(error => { }).catch(() => {
this.$messageBox(this.$t('tip.updateFailed')) this.$messageBox(this.$t('tip.updateFailed'));
});
}); });
})
}, },
turnback() { turnback() {
this.$router.go(-1) this.$router.go(-1);
}
} }
} }
};
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -1,8 +1,8 @@
<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>
@ -10,25 +10,28 @@
</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: { publishMapList: {
type: Array type: Array,
}, required: true
PublisLessonList: {
type: Array
}, },
publisLessonList: {
type: Array,
required: true
}
}, },
data() { data() {
return { return {
@ -44,7 +47,7 @@
date: '', date: '',
amount: 0, amount: 0,
ownerId: '', ownerId: '',
roleName: '', roleName: ''
}, },
DatePicker: { DatePicker: {
shortcuts: [{ shortcuts: [{
@ -54,13 +57,13 @@
} }
}] }]
}, },
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 },
@ -68,14 +71,14 @@
{ 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' }
], ],
@ -98,14 +101,14 @@
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) {
@ -121,33 +124,26 @@
return this.type == 'add'; return this.type == 'add';
}, },
isShowMap() { isShowMap() {
if (this.formModel.permissionType !== '04') { return this.formModel.permissionType !== '04';
return true;
}
}, },
isShowRole() { isShowRole() {
if (this.$store.state.user.roles.indexOf(superAdmin) != -1) { return this.$store.state.user.roles.indexOf(superAdmin) != -1;
return true;
}
}, },
isShowMapProduct() { isShowMapProduct() {
if (this.formModel.permissionType !== '04') { return this.formModel.permissionType !== '04';
return true;
}
}, },
isShowLesson() { isShowLesson() {
if (this.formModel.permissionType != '04' && this.formModel.permissionType != '03') { return this.formModel.permissionType != '04' && this.formModel.permissionType != '03';
return true;
} }
}, },
},
watch: { watch: {
formModel: { formModel: {
handler: function (val, old) { handler: function (val, old) {
this.setTotalMax(); this.setTotalMax();
}, },
deep: true deep: true
}, }
}, },
methods: { methods: {
setTotalMax() { setTotalMax() {
@ -158,20 +154,19 @@
startTime = this.formModel.date[0]; startTime = this.formModel.date[0];
} }
var validator = {} var validator = {};
validator[PermissionType.LESSON] = () => { return this.formModel.lessonId && this.formModel.mapId && this.formModel.mapProductCode }; 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.EXAM] = () => { return this.formModel.lessonId && this.formModel.mapId && this.formModel.mapProductCode; };
validator[PermissionType.SIMULATION] = () => { return this.formModel.mapId && this.formModel.mapProductCode }; validator[PermissionType.SIMULATION] = () => { return this.formModel.mapId && this.formModel.mapProductCode; };
validator[PermissionType.SCREEN] = () => { return true }; 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;
@ -184,10 +179,10 @@
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 = '';
@ -204,35 +199,35 @@
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');
@ -246,10 +241,10 @@
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,
@ -258,8 +253,8 @@
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;
@ -281,8 +276,8 @@
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,
@ -294,20 +289,17 @@
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 {

View File

@ -1,41 +1,44 @@
<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"
border
show-summary
:summary-method="getSummaries"
style="width: 100%"
:height="height-300"
>
<el-table-column prop="permissionType" label="权限类型" width="80"> <el-table-column prop="permissionType" label="权限类型" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
{{computedName(PermissionTypeList, scope.row.permissionType)}} {{ computedName(PermissionTypeList, scope.row.permissionType) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="mapId" label="地图名称"> <el-table-column prop="mapId" label="地图名称">
<template slot-scope="scope"> <template slot-scope="scope">
{{computedName(PublishMapList, scope.row.mapId)}} {{ computedName(PublishMapList, scope.row.mapId) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="mapProductCode" label="产品名称" width="80"> <el-table-column prop="mapProductCode" label="产品名称" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.mapProductCode}} {{ scope.row.mapProductCode }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="lessonId" label="课程名称"> <el-table-column prop="lessonId" label="课程名称">
<template slot-scope="scope"> <template slot-scope="scope">
{{computedName(PublisLessonList, scope.row.lessonId)}} {{ computedName(PublisLessonList, scope.row.lessonId) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="startTime" label="起始时间" width="80"> <el-table-column prop="startTime" label="起始时间" width="80" />
</el-table-column> <el-table-column prop="endTime" label="结束时间" width="80" />
<el-table-column prop="endTime" label="结束时间" width="80"> <el-table-column prop="amount" label="分配权限数量" width="110" />
</el-table-column>
<el-table-column prop="amount" label="分配权限数量" width="110">
</el-table-column>
<el-table-column label="操作" width="90"> <el-table-column label="操作" width="90">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="small" @click="dialogEdit(scope.row)">修改</el-button> <el-button type="text" size="small" @click="dialogEdit(scope.row)">修改</el-button>
@ -46,42 +49,46 @@
</el-card> </el-card>
<div class="draft"> <div class="draft">
<el-button-group> <el-button-group>
<el-button type="primary" @click="packForm" v-if="!urlInfo.url">打包</el-button> <el-button v-if="!urlInfo.url" type="primary" @click="packForm">打包</el-button>
<el-button type="primary" @click="QrCodeShow" v-if="urlInfo.url">获取二维码</el-button> <el-button v-if="urlInfo.url" type="primary" @click="qrcodeShow">获取二维码</el-button>
<el-button type="primary" @click="turnback">返回</el-button> <el-button type="primary" @click="turnback">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
<edit-rule ref="addRule" :PermissionTypeList="PermissionTypeList" :PublisLessonList="PublisLessonList" <edit-rule
:PublishMapList="PublishMapList" @editRuleForm="editRuleForm" @addRuleForm="addRuleForm"> ref="addRule"
</edit-rule> :permission-type-list="PermissionTypeList"
:publis-lesson-list="PublisLessonList"
:publish-map-list="PublishMapList"
@editRuleForm="editRuleForm"
@addRuleForm="addRuleForm"
/>
</el-scrollbar> </el-scrollbar>
</div> </div>
<qr-code ref="qrCode"></qr-code> <qr-code ref="qrCode" />
<can-transfer ref="canDistribute" @distribute="distribute"></can-transfer> <can-transfer ref="canDistribute" @distribute="distribute" />
</el-card> </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: [
WindowResizeHandler
],
components: { components: {
EditRule, EditRule,
QrCode, QrCode,
CanTransfer CanTransfer
}, },
mixins: [
WindowResizeHandler
],
data() { data() {
return { return {
display: 1, display: 1,
@ -90,8 +97,8 @@
PermissionTypeList: [], PermissionTypeList: [],
PublisLessonList: [], PublisLessonList: [],
PublishMapList: [], PublishMapList: [],
ruleList: [], ruleList: []
} };
}, },
mounted() { mounted() {
this.loadInitData(); this.loadInitData();
@ -137,50 +144,50 @@
}, },
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' });
@ -189,18 +196,18 @@
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);
@ -209,11 +216,11 @@
} }
}, },
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) {
@ -237,18 +244,18 @@
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 {

View File

@ -4,14 +4,14 @@
<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>
@ -26,36 +26,36 @@
</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() {
return {
height: "",
courseModel: {
id: "",
name: "",
maxDuration: "",
minDuration: "",
remarks: "",
updateTime: ""
}
};
},
mixins: [WindowResizeHandler],
filters: { filters: {
setTime(val) { setTime(val) {
return val; return val;
} }
}, },
mixins: [WindowResizeHandler],
data() {
return {
height: '',
courseModel: {
id: '',
name: '',
maxDuration: '',
minDuration: '',
remarks: '',
updateTime: ''
}
};
},
watch: { watch: {
$route(newVal) { $route(newVal) {
this.initLoadPage(); this.initLoadPage();
@ -69,7 +69,7 @@
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 => {
@ -83,7 +83,7 @@
}; };
}) })
.catch(error => { .catch(error => {
this.$message.error("获取课程信息失败:" + error.message); this.$message.error('获取课程信息失败:' + error.message);
}); });
} }
}, },
@ -95,7 +95,7 @@
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 });
@ -106,7 +106,7 @@
}); });
} }
} }
} };
</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";