refactor: 更换 ESLint 配置为 @antfu/eslint-config

This commit is contained in:
2024-05-10 22:29:45 +08:00
parent 5101dd12d9
commit bfc8e42bad
148 changed files with 7314 additions and 5046 deletions

View File

@@ -14,11 +14,14 @@
</template>
<script setup lang="ts">
import { getDict, addDict, updateDict } from '@/apis'
import { Message } from '@arco-design/web-vue'
import { GiForm, type Columns } from '@/components/GiForm'
import { addDict, getDict, updateDict } from '@/apis'
import { type Columns, GiForm } from '@/components/GiForm'
import { useForm } from '@/hooks'
const emit = defineEmits<{
(e: 'save-success'): void
}>()
const dataId = ref('')
const isUpdate = computed(() => !!dataId.value)
const title = computed(() => (isUpdate.value ? '修改字典' : '新增字典'))
@@ -91,9 +94,5 @@ const save = async () => {
}
}
const emit = defineEmits<{
(e: 'save-success'): void
}>()
defineExpose({ onAdd, onUpdate })
</script>

View File

@@ -8,8 +8,8 @@
:loading="loading"
:scroll="{ x: '100%', y: '100%', minWidth: 1000 }"
:pagination="pagination"
:disabledTools="['size']"
:disabledColumnKeys="['name']"
:disabled-tools="['size']"
:disabled-column-keys="['name']"
@refresh="search"
>
<template #custom-left>
@@ -52,8 +52,8 @@
</template>
<script setup lang="ts">
import { listDict, deleteDict, type DictResp, type DictQuery } from '@/apis'
import DictAddModal from './DictAddModal.vue'
import { type DictQuery, type DictResp, deleteDict, listDict } from '@/apis'
import DictItemModal from '@/views/system/dict/item/index.vue'
import type { TableInstanceColumns } from '@/components/GiTable/type'
import { useTable } from '@/hooks'
@@ -62,6 +62,24 @@ import has from '@/utils/has'
defineOptions({ name: 'SystemDict' })
const queryForm = reactive<DictQuery>({
sort: ['createTime,desc']
})
const {
tableData: dataList,
loading,
pagination,
search,
handleDelete
} = useTable((p) => listDict({ ...queryForm, page: p.page, size: p.size }), { immediate: true })
// 重置
const reset = () => {
queryForm.description = undefined
search()
}
const columns: TableInstanceColumns[] = [
{
title: '序号',
@@ -87,24 +105,6 @@ const columns: TableInstanceColumns[] = [
}
]
const queryForm = reactive<DictQuery>({
sort: ['createTime,desc']
})
const {
tableData: dataList,
loading,
pagination,
search,
handleDelete
} = useTable((p) => listDict({ ...queryForm, page: p.page, size: p.size }), { immediate: true })
// 重置
const reset = () => {
queryForm.description = undefined
search()
}
// 删除
const onDelete = (item: DictResp) => {
return handleDelete(() => deleteDict(item.id), { content: `是否确定删除字典 [${item.name}]`, showModal: true })

View File

@@ -22,11 +22,14 @@
</template>
<script setup lang="ts">
import { getDictItem, addDictItem, updateDictItem } from '@/apis'
import { Message } from '@arco-design/web-vue'
import { GiForm, type Columns } from '@/components/GiForm'
import { addDictItem, getDictItem, updateDictItem } from '@/apis'
import { type Columns, GiForm } from '@/components/GiForm'
import { useForm } from '@/hooks'
const emit = defineEmits<{
(e: 'save-success'): void
}>()
const dictId = ref('')
const dataId = ref('')
const isUpdate = computed(() => !!dataId.value)
@@ -126,9 +129,5 @@ const save = async () => {
}
}
const emit = defineEmits<{
(e: 'save-success'): void
}>()
defineExpose({ onAdd, onUpdate })
</script>

View File

@@ -1,7 +1,7 @@
<template>
<a-modal
v-model:visible="visible"
:title="'字典项管理(' + dictCode + ')'"
:title="`字典项管理(${dictCode})`"
title-align="start"
:mask-closable="false"
:esc-to-close="false"
@@ -11,15 +11,14 @@
hide-cancel
>
<GiTable
ref="tableRef"
row-key="id"
:data="dataList"
:columns="columns"
:loading="loading"
:scroll="{ x: '100%', y: '100%', minWidth: 800 }"
:pagination="pagination"
:disabledTools="['size']"
:disabledColumnKeys="['label']"
:disabled-tools="['size']"
:disabled-column-keys="['label']"
@refresh="search"
>
<template #custom-left>
@@ -63,14 +62,38 @@
</template>
<script lang="ts" setup>
import { listDictItem, deleteDictItem, type DictItemResp, type DictItemQuery } from '@/apis'
import { useWindowSize } from '@vueuse/core'
import DictItemAddModal from './DictItemAddModal.vue'
import { type DictItemQuery, type DictItemResp, deleteDictItem, listDictItem } from '@/apis'
import type { TableInstanceColumns } from '@/components/GiTable/type'
import { useTable } from '@/hooks'
import { isMobile } from '@/utils'
import { useWindowSize } from '@vueuse/core'
const { width } = useWindowSize()
const dictId = ref('')
const queryForm = reactive<DictItemQuery>({
sort: ['createTime,desc']
})
const {
tableData: dataList,
loading,
pagination,
search,
handleDelete
} = useTable((p) => listDictItem({ ...queryForm, dictId: dictId.value, page: p.page, size: p.size }), {
immediate: true
})
// 重置
const reset = () => {
queryForm.description = undefined
queryForm.status = undefined
search()
}
const columns: TableInstanceColumns[] = [
{
title: '序号',
@@ -99,11 +122,6 @@ const columns: TableInstanceColumns[] = [
{ title: '操作', slotName: 'action', width: 130, align: 'center', fixed: !isMobile() ? 'right' : undefined }
]
const queryForm = reactive<DictItemQuery>({
sort: ['createTime,desc']
})
const dictId = ref('')
const dictCode = ref('')
const visible = ref(false)
// 打开
@@ -116,23 +134,6 @@ const open = (id: string, code: string) => {
}
defineExpose({ open })
const {
tableData: dataList,
loading,
pagination,
search,
handleDelete
} = useTable((p) => listDictItem({ ...queryForm, dictId: dictId.value, page: p.page, size: p.size }), {
immediate: true
})
// 重置
const reset = () => {
queryForm.description = undefined
queryForm.status = undefined
search()
}
// 删除
const onDelete = (item: DictItemResp) => {
return handleDelete(() => deleteDictItem(item.id), { content: `是否确定删除 [${item.label}]`, showModal: false })