import SaveForm from '@/components/save-form' import Pagination from '@/components/pagination' import { NButton, NDataTable, NModal, NSpace, useDialog, useMessage } from 'naive-ui' import { defineComponent, onMounted, reactive, ref } from 'vue' import { helpCenterCatalogPage, helpCenterCatalogRemove } from '../../api' import HelpCenterCategoryOperation from '../modal/help-center-category-operation' export default defineComponent({ name: 'content-flash', setup() { const dialog = useDialog() const message = useMessage() const state = reactive({ loading: false, pagination: { page: 1, rows: 10, pageTotal: 0 }, dataList: [] as any, visiableCategory: false, categoryOperation: 'add', categoryData: {} as any }) const columns = () => { return [ { title: '编号', key: 'id' }, { title: '名称', key: 'name' }, { title: '操作', key: 'operation', render(row: any) { return ( { state.visiableCategory = true state.categoryOperation = 'edit' state.categoryData = row }} > 修改 onRmove(row)} //v-auth="helpCenterCatalog/remove1599695049448595458" > 删除 ) } } ] } const onRmove = (row: any): void => { console.log(row, 'row') dialog.warning({ title: '警告', content: `是否删除该数据?`, positiveText: '确定', negativeText: '取消', onPositiveClick: async () => { try { await helpCenterCatalogRemove({ id: row.id }) getList() message.success('删除成功') } catch {} } }) } const getList = async () => { try { state.loading = true const { data } = await helpCenterCatalogPage({ ...state.pagination }) state.loading = false state.pagination.pageTotal = Number(data.total) state.dataList = data.rows || [] } catch { state.loading = false } } onMounted(() => { getList() }) return () => (
{ state.visiableCategory = true state.categoryOperation = 'add' state.categoryData = {} }} > 添加分类
(state.visiableCategory = false)} onGetList={getList} />
) } })