139 lines
4.5 KiB
Vue
139 lines
4.5 KiB
Vue
|
<template>
|
||
|
<div>
|
||
|
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||
|
<dictionary-edit ref="create" type="ADD" @reloadTable="reloadTable" />
|
||
|
<dictionary-edit ref="edit" type="EDIT" @reloadTable="reloadTable" />
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import { list, del } from '@/api/management/dictionary';
|
||
|
import DictionaryEdit from '@/views/system/dictionary/edit';
|
||
|
|
||
|
export default {
|
||
|
name: 'Dictionary',
|
||
|
components: {
|
||
|
DictionaryEdit
|
||
|
},
|
||
|
data() {
|
||
|
return {
|
||
|
pagerConfig: {
|
||
|
pageSize: 'pageSize',
|
||
|
pageIndex: 'pageNum'
|
||
|
},
|
||
|
queryForm: {
|
||
|
labelWidth: '80px',
|
||
|
reset: true,
|
||
|
queryObject: {
|
||
|
code: {
|
||
|
type: 'text',
|
||
|
label: this.$t('system.code')
|
||
|
},
|
||
|
name: {
|
||
|
type: 'text',
|
||
|
label: this.$t('system.name')
|
||
|
},
|
||
|
status: {
|
||
|
type: 'select',
|
||
|
label: this.$t('system.status'),
|
||
|
config: {
|
||
|
data: this.$ConstSelect.Status
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
},
|
||
|
queryList: {
|
||
|
query: list,
|
||
|
selectCheckShow: false,
|
||
|
indexShow: true,
|
||
|
columns: [
|
||
|
{
|
||
|
title: this.$t('system.code'),
|
||
|
prop: 'code'
|
||
|
},
|
||
|
{
|
||
|
title: this.$t('system.name'),
|
||
|
prop: 'name'
|
||
|
},
|
||
|
{
|
||
|
title: this.$t('system.status'),
|
||
|
prop: 'status',
|
||
|
type: 'tag',
|
||
|
columnValue: (row) => { return this.$ConstSelect.translate(row.status, 'Status'); },
|
||
|
tagType: (row) => { if (row.status === '0') { return 'danger'; } else { return 'success'; } }
|
||
|
},
|
||
|
{
|
||
|
title: this.$t('system.remarks'),
|
||
|
prop: 'remarks'
|
||
|
},
|
||
|
{
|
||
|
type: 'button',
|
||
|
title: this.$t('global.operate'),
|
||
|
width: '250',
|
||
|
buttons: [
|
||
|
{
|
||
|
name: this.$t('global.detail'),
|
||
|
handleClick: this.handleViewDetail
|
||
|
},
|
||
|
{
|
||
|
name: this.$t('global.edit'),
|
||
|
handleClick: this.handleEdit
|
||
|
},
|
||
|
{
|
||
|
name: this.$t('global.delete'),
|
||
|
handleClick: this.handleDelete,
|
||
|
type: 'danger'
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
actions: [
|
||
|
{ text: this.$t('global.add'), handler: this.handleAdd }
|
||
|
// { text: '批量删除', btnCode: 'employee_delete', handler: this.handleBatchDelete, type: 'danger' }
|
||
|
]
|
||
|
},
|
||
|
|
||
|
currentModel: {}
|
||
|
};
|
||
|
},
|
||
|
|
||
|
methods: {
|
||
|
handleViewDetail(index, row) {
|
||
|
this.$router.push({ path: `/system/dictionary/detail`, query: { id: row.id } });
|
||
|
},
|
||
|
|
||
|
handleEdit(index, row) {
|
||
|
this.$refs.edit.show(row.id);
|
||
|
},
|
||
|
|
||
|
handleAdd() {
|
||
|
this.$refs.create.show();
|
||
|
},
|
||
|
|
||
|
handleBatchDelete() {
|
||
|
},
|
||
|
|
||
|
handleDelete(index, row) {
|
||
|
this.$confirm(this.$t('system.wellDelType'), this.$t('global.tips'), {
|
||
|
confirmButtonText: this.$t('global.confirm'),
|
||
|
cancelButtonText: this.$t('global.cancel'),
|
||
|
type: 'warning'
|
||
|
}).then(() => {
|
||
|
del(row.id).then(response => {
|
||
|
this.$message.success(this.$t('system.deleteSuccess'));
|
||
|
this.reloadTable();
|
||
|
}).catch(() => {
|
||
|
this.reloadTable();
|
||
|
this.$messageBox(this.$t('error.deleteFailed'));
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
|
||
|
reloadTable() {
|
||
|
this.queryList.reload();
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
</script>
|