22 <div class =" table-page" >
33 <GiTable
44 ref =" tableRef"
5- row-key =" id"
65 title =" 部门管理"
6+ row-key =" id"
77 :data =" dataList"
88 :columns =" columns"
99 :loading =" loading"
1010 :scroll =" { x: '100%', y: '100%', minWidth: 1000 }"
1111 :pagination =" false"
12- :disabled-tools =" ['size']"
1312 :disabled-column-keys =" ['name']"
1413 @refresh =" search"
1514 >
1817 <IconRight v-else />
1918 </template >
2019 <template #toolbar-left >
21- <a-input v-model =" name" placeholder =" 请输入名称" allow-clear @change = " search " >
20+ <a-input v-model =" name" placeholder =" 请输入名称" allow-clear >
2221 <template #prefix ><icon-search /></template >
2322 </a-input >
2423 <a-button @click =" reset" >
4544 </template >
4645 <template #action =" { record } " >
4746 <a-space >
48- <a-link v-permission =" ['system:dept:update']" @click =" onUpdate(record)" >修改</a-link >
49- <a-link v-permission =" ['system:dept:add']" @click =" onAdd(record.id)" >新增</a-link >
47+ <a-link v-permission =" ['system:dept:update']" title =" 修改" @click =" onUpdate(record)" >修改</a-link >
5048 <a-link
5149 v-permission =" ['system:dept:delete']"
5250 status =" danger"
53- :title =" record.isSystem ? '系统内置数据不能删除' : undefined"
5451 :disabled =" record.isSystem"
52+ :title =" record.isSystem ? '系统内置数据不能删除' : '删除'"
5553 @click =" onDelete(record)"
5654 >
5755 删除
5856 </a-link >
57+ <a-link v-permission =" ['system:dept:add']" title =" 新增" @click =" onAdd(record.id)" >新增</a-link >
5958 </a-space >
6059 </template >
6160 </GiTable >
6261
63- <DeptAddModal ref =" DeptAddModalRef" @save-success =" search" />
62+ <DeptAddModal ref =" DeptAddModalRef" :depts = " dataList " @save-success =" search" />
6463 </div >
6564</template >
6665
6766<script setup lang="ts">
6867import DeptAddModal from ' ./DeptAddModal.vue'
69- import { type DeptQuery , type DeptResp , deleteDept , exportDept , listDept } from ' @/apis/system'
70- import type GiTable from ' @/components/GiTable/index.vue'
68+ import { type DeptQuery , type DeptResp , deleteDept , exportDept , listDept } from ' @/apis/system/dept'
7169import type { TableInstanceColumns } from ' @/components/GiTable/type'
70+ import type GiTable from ' @/components/GiTable/index.vue'
7271import { useDownload , useTable } from ' @/hooks'
7372import { isMobile } from ' @/utils'
7473import has from ' @/utils/has'
7574
7675defineOptions ({ name: ' SystemDept' })
7776
78- const tableRef = ref <InstanceType <typeof GiTable >>()
7977const queryForm = reactive <DeptQuery >({})
78+ const tableRef = ref <InstanceType <typeof GiTable >>()
8079const {
8180 tableData,
8281 loading,
@@ -92,7 +91,6 @@ const {
9291})
9392
9493// 过滤树
95- const name = ref (' ' )
9694const searchData = (name : string ) => {
9795 const loop = (data : DeptResp []) => {
9896 const result = [] as DeptResp []
@@ -114,25 +112,27 @@ const searchData = (name: string) => {
114112 return loop (tableData .value )
115113}
116114
115+ const name = ref (' ' )
117116const dataList = computed (() => {
118117 if (! name .value ) return tableData .value
119118 return searchData (name .value )
120119})
121120
122121const columns: TableInstanceColumns [] = [
123122 { title: ' 名称' , dataIndex: ' name' , minWidth: 170 , ellipsis: true , tooltip: true },
124- { title: ' 状态' , slotName: ' status' , align: ' center' },
123+ { title: ' 状态' , dataIndex: ' status ' , slotName: ' status' , align: ' center' },
125124 { title: ' 排序' , dataIndex: ' sort' , align: ' center' , show: false },
126- { title: ' 系统内置' , slotName: ' isSystem' , align: ' center' , show: false },
125+ { title: ' 系统内置' , dataIndex: ' isSystem ' , slotName: ' isSystem' , align: ' center' , show: false },
127126 { title: ' 描述' , dataIndex: ' description' , ellipsis: true , tooltip: true },
128127 { title: ' 创建人' , dataIndex: ' createUserString' , ellipsis: true , tooltip: true , show: false },
129128 { title: ' 创建时间' , dataIndex: ' createTime' , width: 180 },
130129 { title: ' 修改人' , dataIndex: ' updateUserString' , ellipsis: true , tooltip: true , show: false },
131130 { title: ' 修改时间' , dataIndex: ' updateTime' , width: 180 , show: false },
132131 {
133132 title: ' 操作' ,
133+ dataIndex: ' action' ,
134134 slotName: ' action' ,
135- width: 180 ,
135+ width: 160 ,
136136 align: ' center' ,
137137 fixed: ! isMobile () ? ' right' : undefined ,
138138 show: has .hasPermOr ([' system:dept:update' , ' system:dept:delete' , ' system:dept:add' ]),
@@ -147,7 +147,7 @@ const reset = () => {
147147// 删除
148148const onDelete = (record : DeptResp ) => {
149149 return handleDelete (() => deleteDept (record .id ), {
150- content: ` 是否确定删除 [ ${record .name }] ?` ,
150+ content: ` 是否确定删除部门「 ${record .name }」 ?` ,
151151 showModal: true ,
152152 })
153153}
0 commit comments