Update publicUnit.vue

修复删除不刷新bug
This commit is contained in:
TimSpan 2024-11-29 17:38:02 +08:00
parent edff88dd0c
commit 74a97da1ff
1 changed files with 12 additions and 13 deletions

View File

@ -304,7 +304,7 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => {
icon: ' ', icon: ' ',
centered: true, centered: true,
content: () => <FormProMax ref={_formRef} v-model:value={_formParams.value} formItemOptions={_formOptions.value} />, content: () => <FormProMax ref={_formRef} v-model:value={_formParams.value} formItemOptions={_formOptions.value} />,
onOk: async () => { onOk: debounce(async () => {
await _formRef.value?.validate() await _formRef.value?.validate()
const resp = await api.post('/eu/add_upd', { const resp = await api.post('/eu/add_upd', {
@ -318,7 +318,7 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => {
await tableRef.value?.requestGetTableData() await tableRef.value?.requestGetTableData()
callback && callback() callback && callback()
}, }, 300),
}) })
} }
@ -486,7 +486,15 @@ const formItemOptions = ref<FormProMaxItemOptions<serviceProjectSaveOrUpdatePara
}, },
}) })
const _tableRef = ref<ComponentExposed<typeof TableProMax>>(null) const _tableRef = ref(null)
const deleteAccount = async (snowFlakeId) => {
const resp = await api.delete('/m2/eu/deleteSpById', {
serviceProjectId: snowFlakeId,
})
message.success(resp.message)
await _tableRef.value?.requestGetTableData()
}
const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => { const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => {
const _columns: _TableProps['columns'] = [ const _columns: _TableProps['columns'] = [
{ {
@ -624,16 +632,7 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) =>
> >
编辑 编辑
</a-button> </a-button>
<a-popconfirm <a-popconfirm title='确认删除账号吗?' onConfirm={() => deleteAccount(record.snowFlakeId)}>
title='确认删除账号吗?'
onConfirm={async () => {
const resp = await api.delete('/m2/eu/deleteSpById', {
serviceProjectId: record.snowFlakeId,
})
message.success(resp.message)
await _tableRef.value?.requestGetTableData()
}}
>
<a-button danger>删除</a-button> <a-button danger>删除</a-button>
</a-popconfirm> </a-popconfirm>
</a-space> </a-space>