rt-sim-training-client/src/views/system/iscsResourcesManage/index.vue
2022-09-22 17:40:50 +08:00

205 lines
6.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<add-resources
ref="addResources"
:map-list="mapList"
:system-list="systemList"
:type-list="typeList"
@reloadTable="reloadTable"
/>
</div>
</template>
<script>
import { pagedIscsResources, deleteIscsResources } from '@/api/iscs';
import AddResources from './add';
import { getPublishMapListOnline } from '@/api/jmap/map';
const systemMap = {
PA: '广播系统',
PIS: '乘客信息'
};
const systemList = [
{ value: 'PA', label: '广播信息' },
{ value: 'PIS', label: '乘客信息' }
];
const typeMap = {
RECORDING: '预录',
EMERGENCY_RECORDING: '紧急预录',
BGM: '背景音乐'
};
const typeList = [
{ value: 'RECORDING', label: '预录' },
{ value: 'EMERGENCY_RECORDING', label: '紧急预录' },
{ value: 'BGM', label: '背景音乐' },
{ value: 'ATS', label: 'ATS预录' }
];
export default {
name: 'DeviceManage',
components: {
AddResources
},
data() {
return {
examResultList: [],
systemList: systemList,
typeList: typeList,
url: '',
mapList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '120px',
reset: true,
queryObject: {
mapId: {
type: 'select',
label: '地图',
config: {
data: []
}
},
system: {
type: 'select',
label: '系统',
config: {
data: systemList
}
},
type: {
type: 'select',
label: '类型',
config: {
data: typeList
}
}
}
},
queryList: {
query: pagedIscsResources,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '地图',
prop: 'mapId',
type: 'tag',
columnValue: (row) => { return this.getMapName(row.mapId); },
tagType: (row) => { return 'success'; }
},
{
title: '系统',
prop: 'system',
type: 'tag',
columnValue: (row) => { return systemMap[row.system]; },
tagType: (row) => { return 'success'; }
},
{
title: '类型',
prop: 'type',
type: 'tag',
columnValue: (row) => { return typeMap[row.type]; },
tagType: (row) => { return 'success'; }
},
{
title: '资源',
prop: 'resources',
type: 'tagMore',
columnValue: (row) => { return this.getResources(row.resources); },
tagType: (row) => { return 'success'; }
},
{
type: 'button',
title: this.$t('global.operate'),
width: '300',
buttons: [
// {
// name: '编辑',
// handleClick: this.editConfig
// },
{
name: this.$t('global.delete'),
handleClick: this.handleDelete,
type: 'danger'
}
]
}
],
actions: [
{ text: this.$t('global.add'), handler: this.createAudioResources}
]
},
currentModel: {}
};
},
computed: {
},
mounted() {
getPublishMapListOnline().then(resp => {
this.mapList = resp.data;
const list = [];
this.mapList.forEach(elem => {
list.push({ label: elem.name, value: elem.id });
});
this.queryForm.queryObject.mapId.config.data = list;
}).catch(() => {
this.$message.error('获取地图列表失败!');
});
},
methods: {
createProjectDevice() {
this.$refs.addResources.show();
},
getMapName(mapId) {
const mapInfo = this.mapList.find(elem => elem.id == mapId);
return mapInfo ? mapInfo.name : '';
},
handleTime(time) {
const timeList = time.split('T');
let newTime = '';
if (timeList.length > 1) {
newTime = timeList[0] + ' ' + timeList[1];
} else {
newTime = time;
}
return newTime;
},
getResources(resources) {
const array = [];
resources.forEach(elem => {
array.push(elem.name);
});
return array;
},
// 删除
handleDelete(index, row) {
this.$confirm('此操作将删除该ISCS资源数据', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
deleteIscsResources(row.id).then(response => {
this.$message.success(this.$t('system.deleteSuccess'));
this.reloadTable();
}).catch(() => {
this.reloadTable();
this.$messageBox(this.$t('error.deleteFailed'));
});
});
},
createAudioResources() {
this.$refs.addResources.show();
},
editConfig(index, row) {
this.$refs.addResources.show(row);
},
reloadTable() {
this.queryList.reload();
}
}
};
</script>