This commit is contained in:
fan 2019-10-21 16:07:28 +08:00
commit 81edd3c5c2
7 changed files with 182 additions and 29 deletions

View File

@ -48,3 +48,12 @@ export function getSubSystemDetail(id) {
method: 'get'
});
}
export function getMapSystemPageList(params) {
/** 分页查询地图系统 */
return request({
url: `/api/mapSystem`,
method: 'get',
params
});
}

View File

@ -25,6 +25,7 @@ import trainRoom from './trainRoom';
import menu from './menu';
import ibp from './ibp';
import approval from './approval';
import systemGenerate from './systemGenerate';
export default {
...enLocale,
@ -53,5 +54,6 @@ export default {
trainRoom,
menu,
ibp,
approval
approval,
systemGenerate
};

View File

@ -0,0 +1,9 @@
export default {
map: 'Map',
mapName: 'Map Name',
prdName: 'Product Name',
name: 'Name',
type: 'Type',
updateData: 'Modify',
generate: 'Generate'
};

View File

@ -25,6 +25,7 @@ import trainRoom from './trainRoom';
import menu from './menu';
import ibp from './ibp';
import approval from './approval';
import systemGenerate from './systemGenerate';
export default {
...cnLocale,
@ -53,5 +54,6 @@ export default {
trainRoom,
menu,
ibp,
approval
approval,
systemGenerate
};

View File

@ -0,0 +1,9 @@
export default {
map: '地图',
mapName: '地图名称',
prdName: '产品名称',
name: '名称',
type: '类型',
updateData: '更新',
generate: '生成'
};

View File

@ -103,7 +103,11 @@ export default {
{ enlabel: 'Pending review', label: '待审核', value: '1'},
{ enlabel: 'Successfully released', label: '发布成功', value: '2'},
{ enlabel: 'Overrule', label: '被驳回', value: '3'}
],
productType: [
{ enlabel: 'Lesson System', label: '教学系统', value: 'Lesson'},
{ enlabel: 'Exam System', label: '考试系统', value: 'Exam'},
{ enlabel: 'Simulation System', label: '仿真系统', value: 'Simulation'}
]
}
};

View File

@ -1,9 +1,10 @@
<template>
<el-card>
<div slot="header" style="text-align: center;">
<!-- <div slot="header" style="text-align: center;">
<b>地图子系统生成</b>
</div>
<div style="margin:50px" :style="{ height: height - 160 +'px' }">
</div> -->
<QueryListPage ref="subSystemListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<!-- <div style="margin:50px" :style="{ height: height - 160 +'px' }">
<el-select v-model="mapId" clearable placeholder="请选择地图">
<el-option
v-for="item in mapList"
@ -13,29 +14,109 @@
</el-option>
</el-select>
<el-button type="primary" @click="generate">生成</el-button>
</div>
</div> -->
</el-card>
</template>
<script>
import Cookies from 'js-cookie';
import { listPublishMap } from '@/api/jmap/map';
import { generateMapSystem } from '@/api/trainingPlatform';
import { generateMapSystem,getMapSystemPageList } from '@/api/trainingPlatform';
import ConstConfig from '@/scripts/ConstConfig';
export default {
name: 'SystemGenerate',
data() {
return{
mapList:[],
mapId: ''
prdTypeList:[],
mapId: '',
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '100px',
reset: true,
queryObject: {
mapId: {
type: 'select',
label: this.$t('systemGenerate.map'),
config: {
data: []
}
},
'name': {
type: 'text',
label: this.$t('systemGenerate.name')
},
'type': {
type: 'select',
label: this.$t('systemGenerate.type'),
config: {
data: []
}
},
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('systemGenerate.name'),
prop: 'name'
},
{
title: this.$t('systemGenerate.type'),
type: 'tag',
prop: 'type',
columnValue: (row) => { return this.$convertField(row.type , this.prdTypeList, ['value', 'label']); },
tagType: (row) => { return ''; }
},
{
title: this.$t('systemGenerate.mapName'),
type: 'tag',
prop: 'mapName',
columnValue: (row) => { return row.mapName},
tagType: (row) => { return ''; }
},
{
title: this.$t('systemGenerate.prdName'),
prop: 'prdName'
},
{
type: 'button',
title: this.$t('global.operate'),
width: '400',
buttons: [
{
name: this.$t('systemGenerate.updateData'),
handleClick: this.updateData,
type: ''
},
],
},
],
actions: [
{ text: this.$t('global.add'), handler: this.handleAdd },
{ text: this.$t('systemGenerate.generate'), handler: this.generate }
]
},
}
},
created(){
listPublishMap().then(response=>{
response.data.forEach(elem => {
this.mapList.push({ value: elem.id, label: elem.name });
});
});
// created(){
// listPublishMap().then(response=>{
// response.data.forEach(elem => {
// this.mapList.push({ value: elem.id, label: elem.name });
// });
// });
// },
mounted(){
this.loadInitData();
},
computed: {
height() {
@ -43,20 +124,57 @@
}
},
methods: {
generate() {
if(!this.mapId){this.$messageBox('请选择要生成子系统的地图!'); return;}
this.$confirm('此操作将生成该地图下子系统,是否继续?', this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
generateMapSystem(this.mapId).then(response => {
this.$message.success('生成该地图下子系统成功!');
}).catch(() => {
this.$messageBox('生成该地图下子系统失败!');
updateData(index,row){
},
handleAdd(){
},
async loadInitData() {
try {
//
this.mapList = [];
const res = await listPublishMap();
this.allMapList=res.data;
res.data.forEach(elem => {
this.queryForm.queryObject.mapId.config.data.push({ value: elem.id, label: elem.name });
});
}).catch(() => { });
}
let productTypeList=ConstConfig.ConstSelect.productType;
if(Cookies.get("user_lang")=="en"){
productTypeList.forEach(elem => {
this.queryForm.queryObject.type.config.data.push({ value: elem.value, label: elem.enlabel });
this.prdTypeList.push({ value: elem.value, label: elem.enlabel });
});
}else{
productTypeList.forEach(elem => {
this.queryForm.queryObject.type.config.data.push({ value: elem.value, label: elem.label });
this.prdTypeList.push({ value: elem.value, label: elem.label });
});
}
} catch (error) {
console.error(error, '获取发布地图');
}
},
generate() {
},
// generate() {
// if(!this.mapId){this.$messageBox(''); return;}
// this.$confirm('', this.$t('tip.hint'), {
// confirmButtonText: this.$t('tip.confirm'),
// cancelButtonText: this.$t('tip.cancel'),
// type: 'warning'
// }).then(() => {
// generateMapSystem(this.mapId).then(response => {
// this.$message.success('');
// }).catch(() => {
// this.$messageBox('');
// });
// }).catch(() => { });
// },
queryFunction(params) {
return getMapSystemPageList(params);
},
}
}
</script>