2019-07-26 13:32:43 +08:00
|
|
|
<template>
|
2019-08-08 14:32:32 +08:00
|
|
|
<div>
|
|
|
|
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
|
|
|
</div>
|
2019-07-26 13:32:43 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-08-08 14:32:32 +08:00
|
|
|
import { publishLessonList, delPublishLesson, putLessonOnLine, putLessonOffLine } from '@/api/jmap/lesson';
|
2019-08-29 17:16:33 +08:00
|
|
|
import { getSkinCodeList } from '@/api/management/mapskin';
|
2019-08-08 14:32:32 +08:00
|
|
|
import localStore from 'storejs';
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-08 14:32:32 +08:00
|
|
|
export default {
|
|
|
|
name: 'PublishMap',
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
cityList: [],
|
2019-08-29 17:16:33 +08:00
|
|
|
skinCodeList: [],
|
2019-08-08 14:32:32 +08:00
|
|
|
pagerConfig: {
|
|
|
|
pageSize: 'pageSize',
|
|
|
|
pageIndex: 'pageNum'
|
|
|
|
},
|
|
|
|
queryForm: {
|
|
|
|
labelWidth: '80px',
|
|
|
|
reset: true,
|
|
|
|
queryObject: {
|
|
|
|
name: {
|
|
|
|
type: 'text',
|
2019-08-29 17:16:33 +08:00
|
|
|
label: this.$t('global.name')
|
2019-08-08 14:32:32 +08:00
|
|
|
},
|
|
|
|
cityCode: {
|
|
|
|
type: 'select',
|
2019-08-29 17:16:33 +08:00
|
|
|
label: this.$t('publish.city'),
|
2019-08-08 14:32:32 +08:00
|
|
|
config: {
|
|
|
|
data: []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-08 14:32:32 +08:00
|
|
|
},
|
|
|
|
queryList: {
|
|
|
|
query: publishLessonList,
|
|
|
|
selectCheckShow: false,
|
|
|
|
indexShow: true,
|
|
|
|
columns: [
|
|
|
|
{
|
2019-08-29 17:16:33 +08:00
|
|
|
title: this.$t('global.name'),
|
2019-08-08 14:32:32 +08:00
|
|
|
prop: 'name'
|
|
|
|
},
|
|
|
|
{
|
2019-08-29 17:16:33 +08:00
|
|
|
title: this.$t('publish.city'),
|
2019-08-08 14:32:32 +08:00
|
|
|
prop: 'cityCode',
|
|
|
|
type: 'tag',
|
2019-08-08 15:57:36 +08:00
|
|
|
columnValue: (row) => { return this.$convertField(row.cityCode, this.cityList, ['code', 'name']); },
|
2019-08-08 14:32:32 +08:00
|
|
|
tagType: (row) => { return 'success'; }
|
|
|
|
},
|
|
|
|
{
|
2019-08-29 17:16:33 +08:00
|
|
|
title: this.$t('publish.lessonIntroduction'),
|
2019-08-08 14:32:32 +08:00
|
|
|
prop: 'remarks'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'button',
|
2019-08-29 17:16:33 +08:00
|
|
|
title: this.$t('global.operate'),
|
2019-08-08 14:32:32 +08:00
|
|
|
width: '250',
|
|
|
|
buttons: [
|
|
|
|
{
|
2019-08-29 17:16:33 +08:00
|
|
|
name: this.$t('global.putaway'),
|
2019-08-08 14:32:32 +08:00
|
|
|
handleClick: this.handlePutaway,
|
|
|
|
type: '',
|
|
|
|
showControl: (row) => { return row.status != 1; }
|
|
|
|
},
|
|
|
|
{
|
2019-08-29 17:16:33 +08:00
|
|
|
name: this.$t('global.soldOut'),
|
2019-08-08 14:32:32 +08:00
|
|
|
handleClick: this.handleSoldOut,
|
|
|
|
type: 'warning',
|
|
|
|
showControl: (row) => { return row.status == 1; }
|
|
|
|
},
|
|
|
|
{
|
2019-08-29 17:16:33 +08:00
|
|
|
name: this.$t('global.delete'),
|
2019-08-08 14:32:32 +08:00
|
|
|
handleClick: this.handleDelete,
|
|
|
|
type: 'danger',
|
|
|
|
showControl: () => { return this.isShow != -1; }
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-08 14:32:32 +08:00
|
|
|
currentModel: {}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
isShow() {
|
|
|
|
return this.$store.getters['roles'].indexOf('05');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.loadInitData();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
loadInitData() {
|
|
|
|
this.cityList = [];
|
|
|
|
this.$Dictionary.cityType().then(list => {
|
|
|
|
this.cityList = list;
|
|
|
|
this.cityList.forEach(elem => {
|
|
|
|
this.queryForm.queryObject.cityCode.config.data.push({ value: elem.code, label: elem.name });
|
|
|
|
});
|
|
|
|
}).catch(() => {
|
2019-08-29 17:16:33 +08:00
|
|
|
this.$messageBox(this.$t('error.loadingCityListFailed'));
|
2019-08-08 14:32:32 +08:00
|
|
|
});
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-29 17:16:33 +08:00
|
|
|
this.skinCodeList = [];
|
|
|
|
getSkinCodeList().then(response => {
|
|
|
|
this.skinCodeList = response.data;
|
2019-08-08 14:32:32 +08:00
|
|
|
});
|
|
|
|
},
|
|
|
|
// 编辑
|
|
|
|
handleEdit(index, row) {
|
|
|
|
},
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-08 14:32:32 +08:00
|
|
|
// 删除
|
|
|
|
handleDelete(index, row) {
|
2019-08-29 17:16:33 +08:00
|
|
|
this.$confirm(this.$t('publish.wellDelType'), this.$t('global.tips'), {
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
2019-08-08 14:32:32 +08:00
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
delPublishLesson(row.id).then(response => {
|
2019-08-29 17:16:33 +08:00
|
|
|
this.$message.success(this.$t('publish.deleteSuccess'));
|
2019-08-08 14:32:32 +08:00
|
|
|
this.reloadTable();
|
|
|
|
localStore.remove('mapId');
|
|
|
|
}).catch(() => {
|
|
|
|
this.reloadTable();
|
2019-08-29 17:16:33 +08:00
|
|
|
this.$messageBox(this.$t('error.deleteFailed'));
|
2019-08-08 14:32:32 +08:00
|
|
|
});
|
|
|
|
}).catch(() => { });
|
|
|
|
},
|
|
|
|
handlePutaway(index, row) {
|
2019-08-29 17:16:33 +08:00
|
|
|
this.$confirm(this.$t('publish.wellPutawayTraining'), this.$t('global.tips'), {
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
2019-08-08 14:32:32 +08:00
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
putLessonOnLine(row.id).then(response => {
|
2019-08-29 17:16:33 +08:00
|
|
|
this.$message.success(this.$t('publish.operationSuccess'));
|
2019-08-08 14:32:32 +08:00
|
|
|
this.reloadTable();
|
|
|
|
}).catch(() => {
|
|
|
|
this.reloadTable();
|
2019-08-29 17:16:33 +08:00
|
|
|
this.$messageBox(this.$t('error.operationFailure'));
|
2019-08-08 14:32:32 +08:00
|
|
|
});
|
|
|
|
}).catch(() => { });
|
|
|
|
},
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-08 14:32:32 +08:00
|
|
|
handleSoldOut(index, row) {
|
2019-08-29 17:16:33 +08:00
|
|
|
this.$confirm(this.$t('publish.wellSoldOutTraining'), this.$t('global.tips'), {
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
2019-08-08 14:32:32 +08:00
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
putLessonOffLine(row.id).then(response => {
|
2019-08-29 17:16:33 +08:00
|
|
|
this.$message.success(this.$t('publish.operationSuccess'));
|
2019-08-08 14:32:32 +08:00
|
|
|
this.reloadTable();
|
|
|
|
}).catch(() => {
|
|
|
|
this.reloadTable();
|
2019-08-29 17:16:33 +08:00
|
|
|
this.$messageBox(this.$t('error.operationFailure'));
|
2019-08-08 14:32:32 +08:00
|
|
|
});
|
|
|
|
}).catch(() => { });
|
|
|
|
},
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-08 14:32:32 +08:00
|
|
|
reloadTable() {
|
|
|
|
this.queryList.reload();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|