132 lines
4.1 KiB
Vue
132 lines
4.1 KiB
Vue
<template>
|
|
<div>
|
|
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
|
<add-voice ref="addVoice" @reloadTable="reloadTable" />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { pagedAudioResources, deleteAudioResources } from '@/api/audioResources';
|
|
import AddVoice from './add';
|
|
export default {
|
|
name: 'DeviceManage',
|
|
components: {
|
|
AddVoice
|
|
},
|
|
data() {
|
|
return {
|
|
examResultList: [],
|
|
url: '',
|
|
pagerConfig: {
|
|
pageSize: 'pageSize',
|
|
pageIndex: 'pageNum'
|
|
},
|
|
queryForm: {
|
|
labelWidth: '120px',
|
|
reset: true,
|
|
queryObject: {
|
|
name: {
|
|
type: 'text',
|
|
label: '名称:'
|
|
},
|
|
desc: {
|
|
type: 'text',
|
|
label: '描述'
|
|
}
|
|
}
|
|
},
|
|
queryList: {
|
|
query: pagedAudioResources,
|
|
selectCheckShow: false,
|
|
indexShow: true,
|
|
columns: [
|
|
{
|
|
title: '名称',
|
|
prop: 'name'
|
|
},
|
|
{
|
|
title: '描述',
|
|
prop: 'desc'
|
|
},
|
|
{
|
|
title: 'url',
|
|
prop: 'url'
|
|
},
|
|
{
|
|
title: '创建时间',
|
|
prop: 'createTime',
|
|
type: 'tag',
|
|
columnValue: (row) => { return this.handleTime(row.createTime); },
|
|
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() {
|
|
},
|
|
methods: {
|
|
createProjectDevice() {
|
|
this.$refs.add.show();
|
|
},
|
|
handleTime(time) {
|
|
const timeList = time.split('T');
|
|
let newTime = '';
|
|
if (timeList.length > 1) {
|
|
newTime = timeList[0] + ' ' + timeList[1];
|
|
} else {
|
|
newTime = time;
|
|
}
|
|
return newTime;
|
|
},
|
|
// 删除
|
|
handleDelete(index, row) {
|
|
this.$confirm('此操作将删除该音频资源数据!', this.$t('global.tips'), {
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
cancelButtonText: this.$t('global.cancel'),
|
|
type: 'warning'
|
|
}).then(() => {
|
|
deleteAudioResources(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.addVoice.show();
|
|
},
|
|
editConfig(index, row) {
|
|
this.$refs.addVoice.show(row);
|
|
},
|
|
reloadTable() {
|
|
this.queryList.reload();
|
|
}
|
|
}
|
|
};
|
|
</script>
|