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