refactor: vue3 delete function

This commit is contained in:
xingyu
2022-07-28 15:56:38 +08:00
parent ee6317e906
commit b167f54813
26 changed files with 45 additions and 147 deletions

View File

@@ -74,11 +74,6 @@
} }
} }
// 删除操作
const handleDelete = (row: ${simpleClassName}VO) => {
delList(row.id, false)
}
// ========== 详情相关 ========== // ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref const detailRef = ref() // 详情 Ref
@@ -161,7 +156,7 @@
link link
type="primary" type="primary"
v-hasPermi="['${permissionPrefix}:delete']" v-hasPermi="['${permissionPrefix}:delete']"
@click="handleDelete(row)" @click="delList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>

View File

@@ -68,11 +68,6 @@ const submitForm = async () => {
} }
} }
// 删除操作
const handleDelete = (row: FormVO) => {
delList(row.id, false)
}
// ========== 详情相关 ========== // ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref const detailRef = ref() // 详情 Ref
@@ -125,7 +120,12 @@ getList()
<el-button link type="primary" v-hasPermi="['bpm:form:update']" @click="handleDetail(row)"> <el-button link type="primary" v-hasPermi="['bpm:form:update']" @click="handleDetail(row)">
<Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }} <Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }}
</el-button> </el-button>
<el-button link type="primary" v-hasPermi="['bpm:form:delete']" @click="handleDelete(row)"> <el-button
link
type="primary"
v-hasPermi="['bpm:form:delete']"
@click="delList(row.id, false)"
>
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>
</template> </template>

View File

@@ -45,7 +45,10 @@ const crudSchemas = reactive<CrudSchema[]>([
}, },
{ {
label: '备注', label: '备注',
field: 'remark' field: 'remark',
table: {
show: false
}
}, },
{ {
label: t('common.createTime'), label: t('common.createTime'),

View File

@@ -82,11 +82,6 @@ const submitForm = async () => {
} }
} }
// 删除操作
const handleDelete = (row: UserGroupVO) => {
delList(row.id, false)
}
// 根据用户名获取用户真实名 // 根据用户名获取用户真实名
const getUserNickName = (userId: number) => { const getUserNickName = (userId: number) => {
for (const user of userOptions.value) { for (const user of userOptions.value) {
@@ -168,7 +163,7 @@ onMounted(async () => {
link link
type="primary" type="primary"
v-hasPermi="['bpm:user-group:delete']" v-hasPermi="['bpm:user-group:delete']"
@click="handleDelete(row)" @click="delList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>

View File

@@ -25,7 +25,7 @@ const dialogVisible = ref(false) // 是否显示弹出层
const dialogTitle = ref('') // 弹出层标题 const dialogTitle = ref('') // 弹出层标题
// 导出操作 // 导出操作
const handleExport = async () => { const handleExport = async () => {
await exportList('用户数据.xls') await exportList('错误数据.xls')
} }
// 详情操作 // 详情操作

View File

@@ -49,10 +49,6 @@ const handleGenTable = async (row: CodegenTableVO) => {
const res = await CodegenApi.downloadCodegenApi(row.id) const res = await CodegenApi.downloadCodegenApi(row.id)
download.zip(res, 'codegen-' + row.className + '.zip') download.zip(res, 'codegen-' + row.className + '.zip')
} }
// 删除操作
const handleDelete = (row: CodegenTableVO) => {
delList(row.id, false)
}
// 查询操作 // 查询操作
const handleQuery = () => { const handleQuery = () => {
getList() getList()
@@ -112,7 +108,7 @@ getList()
link link
type="primary" type="primary"
v-hasPermi="['infra:codegen:delete']" v-hasPermi="['infra:codegen:delete']"
@click="handleDelete(row)" @click="delList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>

View File

@@ -74,11 +74,6 @@ const submitForm = async () => {
} }
} }
// 删除操作
const handleDelete = (row: ConfigVO) => {
delList(row.id, false)
}
// ========== 详情相关 ========== // ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref const detailRef = ref() // 详情 Ref
@@ -156,7 +151,7 @@ getList()
link link
type="primary" type="primary"
v-hasPermi="['infra:config:delete']" v-hasPermi="['infra:config:delete']"
@click="handleDelete(row)" @click="delList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>

View File

@@ -79,11 +79,6 @@ const submitForm = async () => {
} }
} }
// 删除操作
const handleDelete = (row: FileConfigVO) => {
delList(row.id, false)
}
// ========== 详情相关 ========== // ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref const detailRef = ref() // 详情 Ref
@@ -169,7 +164,7 @@ getList()
link link
type="primary" type="primary"
v-hasPermi="['infra:file-config:delete']" v-hasPermi="['infra:file-config:delete']"
@click="handleDelete(row)" @click="delList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>

View File

@@ -69,10 +69,6 @@ const excelUploadError = (): void => {
const detailRef = ref() // 详情 Ref const detailRef = ref() // 详情 Ref
const dialogVisible = ref(false) // 是否显示弹出层 const dialogVisible = ref(false) // 是否显示弹出层
const dialogTitle = ref('') // 弹出层标题 const dialogTitle = ref('') // 弹出层标题
// 删除操作
const handleDelete = (row: FileVO) => {
delList(row.id, false)
}
// 详情操作 // 详情操作
const handleDetail = (row: FileVO) => { const handleDetail = (row: FileVO) => {
// 设置数据 // 设置数据
@@ -128,7 +124,7 @@ getList()
link link
type="primary" type="primary"
v-hasPermi="['infra:file:delete']" v-hasPermi="['infra:file:delete']"
@click="handleDelete(row)" @click="delList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>

View File

@@ -92,11 +92,6 @@ const submitForm = async () => {
} }
} }
// 删除操作
const handleDelete = (row: JobVO) => {
delList(row.id, false)
}
// ========== 详情相关 ========== // ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref const detailRef = ref() // 详情 Ref
@@ -157,7 +152,12 @@ getList()
<el-button link type="primary" v-hasPermi="['infra:job:query']" @click="handleDetail(row)"> <el-button link type="primary" v-hasPermi="['infra:job:query']" @click="handleDetail(row)">
<Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }} <Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }}
</el-button> </el-button>
<el-button link type="primary" v-hasPermi="['infra:job:delete']" @click="handleDelete(row)"> <el-button
link
type="primary"
v-hasPermi="['infra:job:delete']"
@click="delList(row.id, false)"
>
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>
<el-button link type="primary" v-hasPermi="['infra:job:trigger']" @click="handleRun(row)"> <el-button link type="primary" v-hasPermi="['infra:job:trigger']" @click="handleRun(row)">

View File

@@ -74,11 +74,6 @@ const submitForm = async () => {
} }
} }
// 删除操作
const handleDelete = (row: AppVO) => {
delList(row.id, false)
}
// ========== 详情相关 ========== // ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref const detailRef = ref() // 详情 Ref
@@ -153,7 +148,7 @@ getList()
link link
type="primary" type="primary"
v-hasPermi="['system:post:delete']" v-hasPermi="['system:post:delete']"
@click="handleDelete(row)" @click="delList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>

View File

@@ -74,11 +74,6 @@ const submitForm = async () => {
} }
} }
// 删除操作
const handleDelete = (row: MerchantVO) => {
delList(row.id, false)
}
// ========== 详情相关 ========== // ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref const detailRef = ref() // 详情 Ref
@@ -153,7 +148,7 @@ getList()
link link
type="primary" type="primary"
v-hasPermi="['system:post:delete']" v-hasPermi="['system:post:delete']"
@click="handleDelete(row)" @click="delList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>

View File

@@ -71,11 +71,6 @@ const submitForm = async () => {
} }
} }
// 删除操作
const handleDelete = (row: OrderVO) => {
delList(row.id, false)
}
// ========== 详情相关 ========== // ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref const detailRef = ref() // 详情 Ref
@@ -133,7 +128,12 @@ getList()
<el-button link type="primary" v-hasPermi="['pay:order:update']" @click="handleDetail(row)"> <el-button link type="primary" v-hasPermi="['pay:order:update']" @click="handleDetail(row)">
<Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }} <Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }}
</el-button> </el-button>
<el-button link type="primary" v-hasPermi="['pay:order:delete']" @click="handleDelete(row)"> <el-button
link
type="primary"
v-hasPermi="['pay:order:delete']"
@click="delList(row.id, false)"
>
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>
</template> </template>

View File

@@ -26,11 +26,6 @@ const handleExport = async () => {
const dialogVisible = ref(false) // 是否显示弹出层 const dialogVisible = ref(false) // 是否显示弹出层
const dialogTitle = ref('edit') // 弹出层标题 const dialogTitle = ref('edit') // 弹出层标题
// 删除操作
const handleDelete = (row: RefundVO) => {
delList(row.id, false)
}
// ========== 详情相关 ========== // ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref const detailRef = ref() // 详情 Ref
@@ -95,7 +90,7 @@ getList()
link link
type="primary" type="primary"
v-hasPermi="['system:post:delete']" v-hasPermi="['system:post:delete']"
@click="handleDelete(row)" @click="delList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>

View File

@@ -38,10 +38,6 @@ const handleTypeUpdate = async (row: DictTypeVO) => {
const res = await DictTypeApi.getDictTypeApi(row.id) const res = await DictTypeApi.getDictTypeApi(row.id)
unref(typeFormRef)?.setValues(res) unref(typeFormRef)?.setValues(res)
} }
// 字典分类删除操作
const handleTypeDelete = async (row: DictTypeVO) => {
await delTypeList(row.id, false)
}
// ========== 字典数据列表相关 ========== // ========== 字典数据列表相关 ==========
const tableTypeSelect = ref(false) const tableTypeSelect = ref(false)
@@ -71,10 +67,6 @@ const handleDataUpdate = async (row: DictDataVO) => {
const res = await DictDataApi.getDictDataApi(row.id) const res = await DictDataApi.getDictDataApi(row.id)
unref(dataFormRef)?.setValues(res) unref(dataFormRef)?.setValues(res)
} }
// 字典数据删除操作
const handleDataDelete = async (row: DictTypeVO) => {
await delDataList(row.id, false)
}
// 字典分类点击行事件 // 字典分类点击行事件
const parentType = ref('') const parentType = ref('')
const onClickType = async (data: { [key: string]: any }) => { const onClickType = async (data: { [key: string]: any }) => {
@@ -195,7 +187,7 @@ onMounted(async () => {
link link
type="primary" type="primary"
v-hasPermi="['system:dict:delete']" v-hasPermi="['system:dict:delete']"
@click="handleTypeDelete(row)" @click="delTypeList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>
@@ -252,7 +244,7 @@ onMounted(async () => {
link link
type="primary" type="primary"
v-hasPermi="['system:dict:delete']" v-hasPermi="['system:dict:delete']"
@click="handleDataDelete(row)" @click="delDataList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>

View File

@@ -68,11 +68,6 @@ const submitForm = async () => {
} }
} }
// 删除操作
const handleDelete = (row: ErrorCodeVO) => {
delList(row.id, false)
}
// ========== 详情相关 ========== // ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref const detailRef = ref() // 详情 Ref
@@ -139,7 +134,7 @@ getList()
link link
type="primary" type="primary"
v-hasPermi="['system:error-code:delete']" v-hasPermi="['system:error-code:delete']"
@click="handleDelete(row)" @click="delList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>

View File

@@ -67,11 +67,6 @@ const submitForm = async () => {
} }
} }
// 删除操作
const handleDelete = (row: NoticeVO) => {
delList(row.id, false)
}
// ========== 详情相关 ========== // ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref const detailRef = ref() // 详情 Ref
@@ -141,7 +136,7 @@ getList()
link link
type="primary" type="primary"
v-hasPermi="['system:notice:delete']" v-hasPermi="['system:notice:delete']"
@click="handleDelete(row)" @click="delList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>

View File

@@ -68,11 +68,6 @@ const submitForm = async () => {
} }
} }
// 删除操作
const handleDelete = (row: OAuth2ClientVo) => {
delList(row.id, false)
}
// ========== 详情相关 ========== // ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref const detailRef = ref() // 详情 Ref
@@ -152,7 +147,7 @@ getList()
link link
type="primary" type="primary"
v-hasPermi="['system:oauth2-client:delete']" v-hasPermi="['system:oauth2-client:delete']"
@click="handleDelete(row)" @click="delList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>

View File

@@ -74,11 +74,6 @@ const submitForm = async () => {
} }
} }
// 删除操作
const handleDelete = (row: PostVO) => {
delList(row.id, false)
}
// ========== 详情相关 ========== // ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref const detailRef = ref() // 详情 Ref
@@ -153,7 +148,7 @@ getList()
link link
type="primary" type="primary"
v-hasPermi="['system:post:delete']" v-hasPermi="['system:post:delete']"
@click="handleDelete(row)" @click="delList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>

View File

@@ -83,11 +83,6 @@ const submitForm = async () => {
} }
} }
// 删除操作
const handleDelete = (row: RoleVO) => {
delList(row.id, false)
}
// ========== 详情相关 ========== // ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref const detailRef = ref() // 详情 Ref
@@ -221,7 +216,7 @@ getList()
link link
type="primary" type="primary"
v-hasPermi="['system:role:delete']" v-hasPermi="['system:role:delete']"
@click="handleDelete(row)" @click="delList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>

View File

@@ -79,11 +79,6 @@ const submitForm = async () => {
} }
} }
// 删除操作
const handleDelete = (row: SensitiveWordVO) => {
delList(row.id, false)
}
// ========== 详情相关 ========== // ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref const detailRef = ref() // 详情 Ref
@@ -171,7 +166,7 @@ onMounted(async () => {
link link
type="primary" type="primary"
v-hasPermi="['system:post:delete']" v-hasPermi="['system:post:delete']"
@click="handleDelete(row)" @click="delList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>

View File

@@ -68,11 +68,6 @@ const submitForm = async () => {
} }
} }
// 删除操作
const handleDelete = (row: SmsChannelVO) => {
delList(row.id, false)
}
// ========== 详情相关 ========== // ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref const detailRef = ref() // 详情 Ref
@@ -142,7 +137,7 @@ getList()
link link
type="primary" type="primary"
v-hasPermi="['system:sms-channel:delete']" v-hasPermi="['system:sms-channel:delete']"
@click="handleDelete(row)" @click="delList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>

View File

@@ -68,11 +68,6 @@ const submitForm = async () => {
} }
} }
// 删除操作
const handleDelete = (row: SmsTemplateVO) => {
delList(row.id, false)
}
// ========== 详情相关 ========== // ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref const detailRef = ref() // 详情 Ref
@@ -190,7 +185,7 @@ getList()
link link
type="primary" type="primary"
v-hasPermi="['system:sms-template:delete']" v-hasPermi="['system:sms-template:delete']"
@click="handleDelete(row)" @click="delList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>

View File

@@ -97,11 +97,6 @@ const submitForm = async () => {
} }
} }
// 删除操作
const handleDelete = (row: TenantVO) => {
delList(row.id, false)
}
// ========== 详情相关 ========== // ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref const detailRef = ref() // 详情 Ref
@@ -191,7 +186,7 @@ onMounted(async () => {
link link
type="primary" type="primary"
v-hasPermi="['system:tenant:delete']" v-hasPermi="['system:tenant:delete']"
@click="handleDelete(row)" @click="delList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>

View File

@@ -101,11 +101,6 @@ const submitForm = async () => {
} }
} }
// 删除操作
const handleDelete = (row: TenantPackageVO) => {
delList(row.id, false)
}
// ========== 初始化 ========== // ========== 初始化 ==========
onMounted(async () => { onMounted(async () => {
await getList() await getList()
@@ -149,7 +144,7 @@ onMounted(async () => {
<el-button link type="primary" @click="handleUpdate(row)"> <el-button link type="primary" @click="handleUpdate(row)">
<Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }} <Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }}
</el-button> </el-button>
<el-button link type="primary" @click="handleDelete(row)"> <el-button link type="primary" @click="delList(row.id, false)">
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>
</template> </template>

View File

@@ -164,10 +164,6 @@ const handleResetPwd = (row: UserVO) => {
}) })
}) })
} }
// 删除操作
const handleDelete = (row: UserVO) => {
delList(row.id, false)
}
// 导出操作 // 导出操作
const handleExport = async () => { const handleExport = async () => {
@@ -360,7 +356,7 @@ getList()
link link
type="primary" type="primary"
v-hasPermi="['system:user:delete']" v-hasPermi="['system:user:delete']"
@click="handleDelete(row)" @click="delList(row.id, false)"
> >
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</el-button> </el-button>