mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat: 新增代码生成页面
This commit is contained in:
@ -4,8 +4,8 @@ import { useDictStore } from '@/store/modules/dict';
|
||||
export function useDict() {
|
||||
const dictStore = useDictStore();
|
||||
|
||||
async function getDictData(...args: Array<string>) {
|
||||
const dictData: { [key: string]: Array<Api.System.DictData> } = {};
|
||||
async function getDictData(...args: string[]) {
|
||||
const dictData: { [key: string]: Api.System.DictData[] } = {};
|
||||
const promises = args.map(async dictType => {
|
||||
dictData[dictType] = [];
|
||||
const dicts = dictStore.getDict(dictType);
|
||||
@ -22,7 +22,7 @@ export function useDict() {
|
||||
return dictData;
|
||||
}
|
||||
|
||||
async function getDictRecord(...args: Array<string>) {
|
||||
async function getDictRecord(...args: string[]) {
|
||||
const dictRecord: { [key: string]: { [key: string]: string } } = {};
|
||||
const dictData = await getDictData(...args);
|
||||
Object.keys(dictData).forEach(dictType => {
|
||||
@ -36,8 +36,8 @@ export function useDict() {
|
||||
return dictRecord;
|
||||
}
|
||||
|
||||
async function getDictOptions(...args: Array<string>) {
|
||||
const dictOptions: { [key: string]: Array<CommonType.Option> } = {};
|
||||
async function getDictOptions(...args: string[]) {
|
||||
const dictOptions: { [key: string]: CommonType.Option[] } = {};
|
||||
const dictData = await getDictData(...args);
|
||||
Object.keys(dictData).forEach(dictType => {
|
||||
dictOptions[dictType] = dictData[dictType].map(dict => ({ label: dict.dictLabel!, value: dict.dictValue! }));
|
||||
@ -50,7 +50,7 @@ export function useDict() {
|
||||
return transformDictByOptions(code, dictData[type]);
|
||||
}
|
||||
|
||||
function transformDictByOptions(code: string, options: Array<Api.System.DictData>) {
|
||||
function transformDictByOptions(code: string, options: Api.System.DictData[]) {
|
||||
return options.find(item => item.dictValue === code)?.dictLabel;
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ export function useTableOperate<T extends TableData = TableData>(data: Ref<T[]>,
|
||||
/** the editing row data */
|
||||
const editingData: Ref<T | null> = ref(null);
|
||||
|
||||
function handleEdit(field: keyof T, id: string) {
|
||||
function handleEdit(field: keyof T, id: CommonType.IdType) {
|
||||
operateType.value = 'edit';
|
||||
const findItem = data.value.find(item => item[field] === id) || null;
|
||||
editingData.value = jsonClone(findItem);
|
||||
@ -237,7 +237,7 @@ export function useTableOperate<T extends TableData = TableData>(data: Ref<T[]>,
|
||||
}
|
||||
|
||||
/** the checked row keys of table */
|
||||
const checkedRowKeys = ref<string[]>([]);
|
||||
const checkedRowKeys = ref<CommonType.IdType[]>([]);
|
||||
|
||||
/** the hook after the batch delete operation is completed */
|
||||
async function onBatchDeleted() {
|
||||
|
@ -137,7 +137,7 @@ export function useTreeTableOperate<T extends TableData = TableData>(_: Ref<T[]>
|
||||
}
|
||||
|
||||
/** the checked row keys of table */
|
||||
const checkedRowKeys = ref<string[]>([]);
|
||||
const checkedRowKeys = ref<CommonType.IdType[]>([]);
|
||||
|
||||
function clearCheckedRowKeys() {
|
||||
checkedRowKeys.value = [];
|
||||
|
Reference in New Issue
Block a user