mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-11 06:57:12 +08:00
chore: 根据前端最新 ESLint 配置优化代码生成模板
This commit is contained in:
@@ -14,11 +14,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { get${classNamePrefix}, add${classNamePrefix}, update${classNamePrefix} } from '@/apis'
|
|
||||||
import { Message } from '@arco-design/web-vue'
|
import { Message } from '@arco-design/web-vue'
|
||||||
import { GiForm, type Columns } from '@/components/GiForm'
|
import { get${classNamePrefix}, add${classNamePrefix}, update${classNamePrefix} } from '@/apis'
|
||||||
|
import { type Columns, GiForm } from '@/components/GiForm'
|
||||||
import { useForm } from '@/hooks'
|
import { useForm } from '@/hooks'
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'save-success'): void
|
||||||
|
}>()
|
||||||
|
|
||||||
const dataId = ref('')
|
const dataId = ref('')
|
||||||
const isUpdate = computed(() => !!dataId.value)
|
const isUpdate = computed(() => !!dataId.value)
|
||||||
const title = computed(() => (isUpdate.value ? '修改${businessName}' : '新增${businessName}'))
|
const title = computed(() => (isUpdate.value ? '修改${businessName}' : '新增${businessName}'))
|
||||||
@@ -95,9 +99,5 @@ const save = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'save-success'): void
|
|
||||||
}>()
|
|
||||||
|
|
||||||
defineExpose({ onAdd, onUpdate })
|
defineExpose({ onAdd, onUpdate })
|
||||||
</script>
|
</script>
|
||||||
|
@@ -14,8 +14,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { get${classNamePrefix}, type ${classNamePrefix}DetailResp } from '@/apis'
|
|
||||||
import { useWindowSize } from '@vueuse/core'
|
import { useWindowSize } from '@vueuse/core'
|
||||||
|
import { type ${classNamePrefix}DetailResp, get${classNamePrefix} } from '@/apis'
|
||||||
|
|
||||||
const { width } = useWindowSize()
|
const { width } = useWindowSize()
|
||||||
|
|
||||||
|
@@ -9,7 +9,8 @@
|
|||||||
:loading="loading"
|
:loading="loading"
|
||||||
:scroll="{ x: '100%', y: '100%', minWidth: 1000 }"
|
:scroll="{ x: '100%', y: '100%', minWidth: 1000 }"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
:disabledColumnKeys="['name']"
|
:disabled-tools="['size']"
|
||||||
|
:disabled-column-keys="['name']"
|
||||||
@refresh="search"
|
@refresh="search"
|
||||||
>
|
>
|
||||||
<template #custom-left>
|
<template #custom-left>
|
||||||
@@ -60,34 +61,16 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { list${classNamePrefix}, delete${classNamePrefix}, export${classNamePrefix}, type ${classNamePrefix}Resp, type ${classNamePrefix}Query } from '@/apis'
|
|
||||||
import ${classNamePrefix}AddModal from './${classNamePrefix}AddModal.vue'
|
import ${classNamePrefix}AddModal from './${classNamePrefix}AddModal.vue'
|
||||||
import ${classNamePrefix}DetailDrawer from './${classNamePrefix}DetailDrawer.vue'
|
import ${classNamePrefix}DetailDrawer from './${classNamePrefix}DetailDrawer.vue'
|
||||||
|
import { type ${classNamePrefix}Resp, type ${classNamePrefix}Query, delete${classNamePrefix}, export${classNamePrefix}, list${classNamePrefix} } from '@/apis'
|
||||||
import type { TableInstanceColumns } from '@/components/GiTable/type'
|
import type { TableInstanceColumns } from '@/components/GiTable/type'
|
||||||
import { useTable, useDownload } from '@/hooks'
|
import { useDownload, useTable } from '@/hooks'
|
||||||
import { isMobile } from '@/utils'
|
import { isMobile } from '@/utils'
|
||||||
import has from '@/utils/has'
|
import has from '@/utils/has'
|
||||||
|
|
||||||
defineOptions({ name: '${classNamePrefix}' })
|
defineOptions({ name: '${classNamePrefix}' })
|
||||||
|
|
||||||
const columns: TableInstanceColumns[] = [
|
|
||||||
<#if fieldConfigs??>
|
|
||||||
<#list fieldConfigs as fieldConfig>
|
|
||||||
<#if fieldConfig.showInList>
|
|
||||||
{ title: '${fieldConfig.comment}', dataIndex: '${fieldConfig.fieldName}', slotName: ${fieldConfig.fieldName} },
|
|
||||||
</#if>
|
|
||||||
</#list>
|
|
||||||
</#if>
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
slotName: 'action',
|
|
||||||
width: 130,
|
|
||||||
align: 'center',
|
|
||||||
fixed: !isMobile() ? 'right' : undefined,
|
|
||||||
show: has.hasPermOr(['${apiModuleName}:${apiName}:update', '${apiModuleName}:${apiName}:delete'])
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
const queryForm = reactive<${classNamePrefix}Query>({
|
const queryForm = reactive<${classNamePrefix}Query>({
|
||||||
<#list fieldConfigs as fieldConfig>
|
<#list fieldConfigs as fieldConfig>
|
||||||
<#if fieldConfig.showInQuery>
|
<#if fieldConfig.showInQuery>
|
||||||
@@ -115,6 +98,24 @@ const reset = () => {
|
|||||||
search()
|
search()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const columns: TableInstanceColumns[] = [
|
||||||
|
<#if fieldConfigs??>
|
||||||
|
<#list fieldConfigs as fieldConfig>
|
||||||
|
<#if fieldConfig.showInList>
|
||||||
|
{ title: '${fieldConfig.comment}', dataIndex: '${fieldConfig.fieldName}', slotName: ${fieldConfig.fieldName} },
|
||||||
|
</#if>
|
||||||
|
</#list>
|
||||||
|
</#if>
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
slotName: 'action',
|
||||||
|
width: 130,
|
||||||
|
align: 'center',
|
||||||
|
fixed: !isMobile() ? 'right' : undefined,
|
||||||
|
show: has.hasPermOr(['${apiModuleName}:${apiName}:update', '${apiModuleName}:${apiName}:delete'])
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
const onDelete = (item: ${classNamePrefix}Resp) => {
|
const onDelete = (item: ${classNamePrefix}Resp) => {
|
||||||
return handleDelete(() => delete${classNamePrefix}(item.id), {
|
return handleDelete(() => delete${classNamePrefix}(item.id), {
|
||||||
|
Reference in New Issue
Block a user