|
|
|
@ -7,9 +7,15 @@
@@ -7,9 +7,15 @@
|
|
|
|
|
<BasicTable @register="registerTable" |
|
|
|
|
@selection-change="handleSelectionChange" |
|
|
|
|
> |
|
|
|
|
<template #tableTitle> |
|
|
|
|
<ATag color="red" |
|
|
|
|
style="font-size: 14px;font-weight: 700;" |
|
|
|
|
>>>字典数据列表[{{state.dictType}}]</ATag> |
|
|
|
|
</template> |
|
|
|
|
<template #toolbar> |
|
|
|
|
<a-button v-auth="['dictData_add']" |
|
|
|
|
type="primary" |
|
|
|
|
:disabled="!state.dictType" |
|
|
|
|
@click="handleAdd()" |
|
|
|
|
>新增字典数据</a-button> |
|
|
|
|
<a-button v-auth="['dictData_edit']" |
|
|
|
@ -51,7 +57,7 @@
@@ -51,7 +57,7 @@
|
|
|
|
|
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
|
|
|
|
* author entfrm开发团队-王翔 |
|
|
|
|
*/ |
|
|
|
|
import {defineComponent, ref, reactive, toRaw} from 'vue'; |
|
|
|
|
import { defineComponent, reactive, toRaw } from 'vue'; |
|
|
|
|
import { PageWrapper } from '/@/components/Page'; |
|
|
|
|
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
|
|
|
|
import { columns, searchFormSchema } from './dictdata.data'; |
|
|
|
@ -59,17 +65,18 @@
@@ -59,17 +65,18 @@
|
|
|
|
|
import { useModal } from '/@/components/Modal'; |
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'; |
|
|
|
|
import DictDataModal from './DictDataModal.vue'; |
|
|
|
|
import { Tag } from 'ant-design-vue'; |
|
|
|
|
|
|
|
|
|
/** 类型规范统一声明定义区域 */ |
|
|
|
|
interface TableState { |
|
|
|
|
dictType: String; |
|
|
|
|
dictType: string; |
|
|
|
|
single: boolean; |
|
|
|
|
multiple: boolean; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export default defineComponent({ |
|
|
|
|
name: 'DictDataManagement', |
|
|
|
|
components: { BasicTable, PageWrapper, DictDataModal, TableAction }, |
|
|
|
|
components: { BasicTable, PageWrapper, DictDataModal, TableAction, ATag: Tag }, |
|
|
|
|
setup() { |
|
|
|
|
|
|
|
|
|
/** 通用变量统一声明区域 */ |
|
|
|
@ -83,8 +90,7 @@
@@ -83,8 +90,7 @@
|
|
|
|
|
}); |
|
|
|
|
const { createConfirm, createMessage } = useMessage(); |
|
|
|
|
const [registerModal, { openModal }] = useModal(); |
|
|
|
|
const [registerTable, { reload, setProps, clearSelectedRowKeys, getSelectRowKeys }] = useTable({ |
|
|
|
|
title: '>>字典项列表', |
|
|
|
|
const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys, getForm, setProps }] = useTable({ |
|
|
|
|
api: listDictData, |
|
|
|
|
rowKey: 'id', |
|
|
|
|
columns, |
|
|
|
@ -98,6 +104,7 @@
@@ -98,6 +104,7 @@
|
|
|
|
|
showTableSetting: true, |
|
|
|
|
bordered: true, |
|
|
|
|
showIndexColumn: false, |
|
|
|
|
clickToRowSelect: false, |
|
|
|
|
actionColumn: { |
|
|
|
|
width: 220, |
|
|
|
|
title: '操作', |
|
|
|
@ -105,14 +112,13 @@
@@ -105,14 +112,13 @@
|
|
|
|
|
slots: { customRender: 'action' }, |
|
|
|
|
fixed: false |
|
|
|
|
}, |
|
|
|
|
handleSearchInfoFn: () => clearSelectedRowKeys(), |
|
|
|
|
immediate: false |
|
|
|
|
handleSearchInfoFn: () => clearSelectedRowKeys() |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
/** 根据字典类型查找字典数据 */ |
|
|
|
|
function filterByDictType(dictType: string) { |
|
|
|
|
setProps({ searchInfo: { dictType } }); |
|
|
|
|
state.dictType = dictType; |
|
|
|
|
getForm().setFieldsValue({ dictType: state.dictType }); |
|
|
|
|
reload(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -125,13 +131,13 @@
@@ -125,13 +131,13 @@
|
|
|
|
|
|
|
|
|
|
/** 新增按钮操作,行内新增与工具栏局域新增通用 */ |
|
|
|
|
function handleAdd() { |
|
|
|
|
openModal(true,{ _tag: 'add' }); |
|
|
|
|
openModal(true,{ _tag: 'add', dictType: state.dictType }); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** 编辑按钮操作,行内编辑 */ |
|
|
|
|
function handleEdit(record?: Recordable) { |
|
|
|
|
record = record || { id: getSelectRowKeys() }; |
|
|
|
|
openModal(true, { _tag: 'edit', record }); |
|
|
|
|
openModal(true, { _tag: 'edit', record, dictType: state.dictType }); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** 删除按钮操作,行内删除 */ |
|
|
|
|