mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 10:57:13 +08:00 
			
		
		
		
	chore: 根据前端最新 ESLint 配置优化代码生成模板
This commit is contained in:
		| @@ -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}')) | ||||
| @@ -95,9 +99,5 @@ const save = async () => { | ||||
|   } | ||||
| } | ||||
|  | ||||
| const emit = defineEmits<{ | ||||
|   (e: 'save-success'): void | ||||
| }>() | ||||
|  | ||||
| defineExpose({ onAdd, onUpdate }) | ||||
| </script> | ||||
|   | ||||
| @@ -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() | ||||
|  | ||||
|   | ||||
| @@ -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> | ||||
| @@ -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> | ||||
| @@ -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), { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user