Skip to content

Commit

Permalink
chore: 根据前端最新 ESLint 配置优化代码生成模板
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles7c committed May 10, 2024
1 parent 61dd3a4 commit 044b4b6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@
</template>

<script setup lang="ts">
import { get${classNamePrefix}, add${classNamePrefix}, update${classNamePrefix} } from '@/apis'
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'
const emit = defineEmits<{
(e: 'save-success'): void
}>()
const dataId = ref('')
const isUpdate = computed(() => !!dataId.value)
const title = computed(() => (isUpdate.value ? '修改${businessName}' : '新增${businessName}'))
Expand Down Expand Up @@ -95,9 +99,5 @@ const save = async () => {
}
}
const emit = defineEmits<{
(e: 'save-success'): void
}>()
defineExpose({ onAdd, onUpdate })
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
</template>

<script lang="ts" setup>
import { get${classNamePrefix}, type ${classNamePrefix}DetailResp } from '@/apis'
import { useWindowSize } from '@vueuse/core'
import { type ${classNamePrefix}DetailResp, get${classNamePrefix} } from '@/apis'
const { width } = useWindowSize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
:loading="loading"
:scroll="{ x: '100%', y: '100%', minWidth: 1000 }"
:pagination="pagination"
:disabledColumnKeys="['name']"
:disabled-tools="['size']"
:disabled-column-keys="['name']"
@refresh="search"
>
<template #custom-left>
Expand Down Expand Up @@ -60,34 +61,16 @@
</template>

<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}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 { useTable, useDownload } from '@/hooks'
import { useDownload, useTable } from '@/hooks'
import { isMobile } from '@/utils'
import has from '@/utils/has'
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>({
<#list fieldConfigs as fieldConfig>
<#if fieldConfig.showInQuery>
Expand Down Expand Up @@ -115,6 +98,24 @@ const reset = () => {
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) => {
return handleDelete(() => delete${classNamePrefix}(item.id), {
Expand Down

0 comments on commit 044b4b6

Please sign in to comment.