perf(projects): perf page manage_role, useTable
This commit is contained in:
parent
0e9e2e1dc0
commit
39aa7aa2de
@ -71,8 +71,13 @@ export function useNaiveForm() {
|
||||
await formRef.value?.validate();
|
||||
}
|
||||
|
||||
async function restoreValidation() {
|
||||
formRef.value?.restoreValidation();
|
||||
}
|
||||
|
||||
return {
|
||||
formRef,
|
||||
validate
|
||||
validate,
|
||||
restoreValidation
|
||||
};
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import type { DataTableBaseColumn, DataTableExpandColumn, DataTableSelectionColu
|
||||
import type { TableColumnGroup } from 'naive-ui/es/data-table/src/interface';
|
||||
import { useBoolean, useLoading } from '@sa/hooks';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
import { $t } from '@/locales';
|
||||
|
||||
type BaseData = Record<string, unknown>;
|
||||
|
||||
@ -174,6 +175,7 @@ function useTableColumn<TableData extends BaseData, CustomColumnKey = never>(
|
||||
|
||||
function reloadColumns() {
|
||||
allColumns.value = factory();
|
||||
filteredColumns.value = getFilteredColumns(factory());
|
||||
}
|
||||
|
||||
function getFilteredColumns(aColumns: TableColumn<TableData, CustomColumnKey>[]) {
|
||||
@ -191,7 +193,7 @@ function useTableColumn<TableData extends BaseData, CustomColumnKey = never>(
|
||||
if (column.type === 'selection') {
|
||||
cols.push({
|
||||
key: SELECTION_KEY,
|
||||
title: '勾选',
|
||||
title: $t('common.check'),
|
||||
checked: true
|
||||
});
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ const local: App.I18n.Schema = {
|
||||
},
|
||||
common: {
|
||||
action: '操作',
|
||||
add: '添加',
|
||||
add: '新增',
|
||||
addSuccess: '添加成功',
|
||||
backToHome: '返回首页',
|
||||
batchDelete: '批量删除',
|
||||
@ -265,7 +265,7 @@ const local: App.I18n.Schema = {
|
||||
roleCode: '角色编码',
|
||||
roleStatus: '角色状态',
|
||||
roleDesc: '角色描述',
|
||||
addRole: '添加角色',
|
||||
addRole: '新增角色',
|
||||
editRole: '编辑角色',
|
||||
status: {
|
||||
enable: '启用',
|
||||
|
@ -36,7 +36,7 @@ const visible = defineModel<boolean>('visible', {
|
||||
default: false
|
||||
});
|
||||
|
||||
const { formRef, validate } = useNaiveForm();
|
||||
const { formRef, validate, restoreValidation } = useNaiveForm();
|
||||
const { defaultRequiredRule } = useFormRules();
|
||||
|
||||
const title = computed(() => {
|
||||
@ -94,6 +94,7 @@ async function handleSubmit() {
|
||||
watch(visible, () => {
|
||||
if (visible.value) {
|
||||
handleUpdateModelWhenEdit();
|
||||
restoreValidation();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user