refactor: 优化 GiTable 列类型使用

This commit is contained in:
2024-04-16 20:20:57 +08:00
parent 2e2927a189
commit 35c59e219e
11 changed files with 32 additions and 28 deletions

View File

@@ -7,13 +7,13 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {useAppStore} from "@/stores"; import { useAppStore } from '@/stores'
const appStore= useAppStore(); const appStore = useAppStore()
appStore.initWebConfig() appStore.initWebConfig()
const webTitle = computed(() => appStore.getTitle()); const webTitle = computed(() => appStore.getTitle())
const webLogo = computed(() => appStore.getLogo()); const webLogo = computed(() => appStore.getLogo())
interface Props { interface Props {
collapsed?: boolean collapsed?: boolean

View File

@@ -78,8 +78,8 @@ import { encryptByRsa } from '@/utils/encrypt'
const appStore = useAppStore() const appStore = useAppStore()
appStore.initWebConfig() appStore.initWebConfig()
const webTitle = computed(() => appStore.getTitle()); computed(() => appStore.getTitle())
const webLogo = computed(() => appStore.getLogo()); const webLogo = computed(() => appStore.getLogo())
defineOptions({ name: 'Login' }) defineOptions({ name: 'Login' })

View File

@@ -46,13 +46,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { exportLoginLog, listLog } from '@/apis' import { exportLoginLog, listLog } from '@/apis'
import type { TableInstance } from '@arco-design/web-vue' import type { TableInstanceColumns } from '@/components/GiTable/type'
import DateRangePicker from '@/components/DateRangePicker/index.vue' import DateRangePicker from '@/components/DateRangePicker/index.vue'
import { useTable, useDownload } from '@/hooks' import { useTable, useDownload } from '@/hooks'
defineOptions({ name: 'LoginLog' }) defineOptions({ name: 'LoginLog' })
const columns: TableInstance['columns'] = [ const columns: TableInstanceColumns[] = [
{ {
title: '序号', title: '序号',
width: 66, width: 66,

View File

@@ -57,14 +57,14 @@
<script setup lang="ts"> <script setup lang="ts">
import { listLog, exportOperationLog, type LogResp } from '@/apis' import { listLog, exportOperationLog, type LogResp } from '@/apis'
import type { TableInstance } from '@arco-design/web-vue' import type { TableInstanceColumns } from '@/components/GiTable/type'
import DateRangePicker from '@/components/DateRangePicker/index.vue' import DateRangePicker from '@/components/DateRangePicker/index.vue'
import OperationLogDetailDrawer from './OperationLogDetailDrawer.vue' import OperationLogDetailDrawer from './OperationLogDetailDrawer.vue'
import { useTable, useDownload } from '@/hooks' import { useTable, useDownload } from '@/hooks'
defineOptions({ name: 'OperationLog' }) defineOptions({ name: 'OperationLog' })
const columns: TableInstance['columns'] = [ const columns: TableInstanceColumns[] = [
{ {
title: '序号', title: '序号',
width: 66, width: 66,

View File

@@ -44,7 +44,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { listOnlineUser, kickout } from '@/apis' import { listOnlineUser, kickout } from '@/apis'
import { Message, type TableInstance } from '@arco-design/web-vue' import { Message } from '@arco-design/web-vue'
import type { TableInstanceColumns } from '@/components/GiTable/type'
import DateRangePicker from '@/components/DateRangePicker/index.vue' import DateRangePicker from '@/components/DateRangePicker/index.vue'
import { useUserStore } from '@/stores' import { useUserStore } from '@/stores'
import { useTable } from '@/hooks' import { useTable } from '@/hooks'
@@ -52,7 +53,7 @@ import { isMobile } from '@/utils'
defineOptions({ name: 'OnlineUser' }) defineOptions({ name: 'OnlineUser' })
const columns: TableInstance['columns'] = [ const columns: TableInstanceColumns[] = [
{ {
title: '序号', title: '序号',
width: 66, width: 66,

View File

@@ -82,8 +82,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { listDept, deleteDept, exportDept, type DeptResp, type DeptQuery } from '@/apis' import { listDept, deleteDept, exportDept, type DeptResp, type DeptQuery } from '@/apis'
import { Message, type TableInstance } from '@arco-design/web-vue' import { Message } from '@arco-design/web-vue'
import type GiTable from '@/components/GiTable/index.vue' import type GiTable from '@/components/GiTable/index.vue'
import type { TableInstanceColumns } from '@/components/GiTable/type'
import AddDeptModal from './AddDeptModal.vue' import AddDeptModal from './AddDeptModal.vue'
import { DisEnableStatusList } from '@/constant/common' import { DisEnableStatusList } from '@/constant/common'
import { useDownload } from '@/hooks' import { useDownload } from '@/hooks'
@@ -91,7 +92,7 @@ import { isMobile } from '@/utils'
defineOptions({ name: 'Dept' }) defineOptions({ name: 'Dept' })
const columns: TableInstance['columns'] = [ const columns: TableInstanceColumns[] = [
{ title: '名称', dataIndex: 'name', width: 170, ellipsis: true, tooltip: true }, { title: '名称', dataIndex: 'name', width: 170, ellipsis: true, tooltip: true },
{ title: '状态', slotName: 'status', align: 'center' }, { title: '状态', slotName: 'status', align: 'center' },
{ title: '排序', dataIndex: 'sort', align: 'center', show: false }, { title: '排序', dataIndex: 'sort', align: 'center', show: false },

View File

@@ -55,15 +55,15 @@
<script setup lang="ts"> <script setup lang="ts">
import { listDict, deleteDict, type DictResp } from '@/apis' import { listDict, deleteDict, type DictResp } from '@/apis'
import type { TableInstance } from '@arco-design/web-vue'
import AddDictModal from './AddDictModal.vue' import AddDictModal from './AddDictModal.vue'
import DictItemModal from '@/views/system/dict/item/index.vue' import DictItemModal from '@/views/system/dict/item/index.vue'
import type { TableInstanceColumns } from '@/components/GiTable/type'
import { useTable } from '@/hooks' import { useTable } from '@/hooks'
import { isMobile } from '@/utils' import { isMobile } from '@/utils'
defineOptions({ name: 'Dict' }) defineOptions({ name: 'Dict' })
const columns: TableInstance['columns'] = [ const columns: TableInstanceColumns[] = [
{ {
title: '序号', title: '序号',
width: 66, width: 66,

View File

@@ -63,12 +63,12 @@
<script lang="ts" setup> <script lang="ts" setup>
import { listDictItem, deleteDictItem, type DictItemResp } from '@/apis' import { listDictItem, deleteDictItem, type DictItemResp } from '@/apis'
import type { TableInstance } from '@arco-design/web-vue'
import AddDictItemModal from './AddDictItemModal.vue' import AddDictItemModal from './AddDictItemModal.vue'
import type { TableInstanceColumns } from '@/components/GiTable/type'
import { useTable } from '@/hooks' import { useTable } from '@/hooks'
import { isMobile } from '@/utils' import { isMobile } from '@/utils'
const columns: TableInstance['columns'] = [ const columns: TableInstanceColumns[] = [
{ {
title: '序号', title: '序号',
width: 66, width: 66,

View File

@@ -94,15 +94,16 @@
<script setup lang="ts"> <script setup lang="ts">
import { listMenu, deleteMenu, type MenuResp, type MenuQuery } from '@/apis' import { listMenu, deleteMenu, type MenuResp, type MenuQuery } from '@/apis'
import { Message, type TableInstance } from '@arco-design/web-vue' import { Message } from '@arco-design/web-vue'
import type GiTable from '@/components/GiTable/index.vue' import type GiTable from '@/components/GiTable/index.vue'
import type { TableInstanceColumns } from '@/components/GiTable/type'
import AddMenuModal from './AddMenuModal.vue' import AddMenuModal from './AddMenuModal.vue'
import { DisEnableStatusList } from '@/constant/common' import { DisEnableStatusList } from '@/constant/common'
import { isMobile } from '@/utils' import { isMobile } from '@/utils'
defineOptions({ name: 'Menu' }) defineOptions({ name: 'Menu' })
const columns: TableInstance['columns'] = [ const columns: TableInstanceColumns[] = [
{ title: '菜单标题', dataIndex: 'title', slotName: 'title', width: 170, fixed: !isMobile() ? 'left' : undefined }, { title: '菜单标题', dataIndex: 'title', slotName: 'title', width: 170, fixed: !isMobile() ? 'left' : undefined },
{ title: '类型', slotName: 'type', align: 'center' }, { title: '类型', slotName: 'type', align: 'center' },
{ title: '状态', slotName: 'status', align: 'center' }, { title: '状态', slotName: 'status', align: 'center' },

View File

@@ -70,9 +70,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { listRole, deleteRole, type RoleResp } from '@/apis' import { listRole, deleteRole, type RoleResp } from '@/apis'
import type { TableInstance } from '@arco-design/web-vue'
import AddRoleModal from './AddRoleModal.vue' import AddRoleModal from './AddRoleModal.vue'
import RoleDetailDrawer from './RoleDetailDrawer.vue' import RoleDetailDrawer from './RoleDetailDrawer.vue'
import type { TableInstanceColumns } from '@/components/GiTable/type'
import { useTable } from '@/hooks' import { useTable } from '@/hooks'
import { useDict } from '@/hooks/app' import { useDict } from '@/hooks/app'
import { isMobile } from '@/utils' import { isMobile } from '@/utils'
@@ -82,7 +82,7 @@ defineOptions({ name: 'Role' })
const { data_scope_enum } = useDict('data_scope_enum') const { data_scope_enum } = useDict('data_scope_enum')
const columns: TableInstance['columns'] = [ const columns: TableInstanceColumns[] = [
{ {
title: '序号', title: '序号',
width: 66, width: 66,

View File

@@ -102,10 +102,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { listUser, deleteUser, exportUser, type UserResp } from '@/apis' import { listUser, deleteUser, exportUser, type UserResp } from '@/apis'
import type { TableInstance, TreeInstance } from '@arco-design/web-vue'
import UserAddModal from './UserAddModal.vue' import UserAddModal from './UserAddModal.vue'
import UserDetailDrawer from './UserDetailDrawer.vue' import UserDetailDrawer from './UserDetailDrawer.vue'
import UserResetPwdModal from './UserResetPwdModal.vue' import UserResetPwdModal from './UserResetPwdModal.vue'
import type { TreeInstance } from '@arco-design/web-vue'
import type { TableInstanceColumns } from '@/components/GiTable/type'
import { useTable, useDownload } from '@/hooks' import { useTable, useDownload } from '@/hooks'
import { useDept } from '@/hooks/app' import { useDept } from '@/hooks/app'
import { isMobile } from '@/utils' import { isMobile } from '@/utils'
@@ -114,7 +115,7 @@ import { DisEnableStatusList } from '@/constant/common'
defineOptions({ name: 'User' }) defineOptions({ name: 'User' })
const columns: TableInstance['columns'] = [ const columns: TableInstanceColumns[] = [
{ {
title: '序号', title: '序号',
width: 66, width: 66,