feat: 添加 PCascadeSelect 组件,更新相关配置和依赖
Some checks failed
/ test (push) Successful in 3s
/ surge (push) Failing after 2m27s

This commit is contained in:
严浩
2024-12-23 18:25:10 +08:00
parent 70a9aa5b79
commit a3e6509783
7 changed files with 265 additions and 69 deletions

View File

@ -3,6 +3,7 @@ import { FormKitNode } from '@formkit/core';
import { text } from '@formkit/inputs';
import Swal from 'sweetalert2';
import dayjs from 'dayjs';
import { arrayToTree } from 'utils4u/array';
async function submit(formData: Record<string, any>, formNode: FormKitNode) {
console.group('submit');
@ -27,6 +28,44 @@ const K_OPTIONS = [
const promiseOptions = new Promise<typeof K_OPTIONS>(resolve => {
setTimeout(() => resolve(K_OPTIONS), 1000);
});
const K_FLAT_TREE = [
{
dictLabel: '北京市',
dictValue: '110000',
fullName: '北京市',
abbrName: '北京',
dictParent: '00',
},
{
dictLabel: '山西省',
dictValue: '140000',
fullName: '山西省',
abbrName: '山西',
dictParent: '00',
},
{
dictLabel: '太原市',
dictValue: '140100',
fullName: '山西省,太原市',
abbrName: '山西太原',
dictParent: '140000',
},
{
dictLabel: '大同市',
dictValue: '140200',
fullName: '山西省,大同市',
abbrName: '山西大同',
dictParent: '140000',
},
]
const promiseCascadeOptions = new Promise<typeof K_FLAT_TREE>((resolve) => {
setTimeout(() => {
resolve(arrayToTree(K_FLAT_TREE, { id: 'dictValue', parentId: 'dictParent', rootId: '00' }));
}, 1000);
});
/* const funcOptions = async () => {
await new Promise(r => setTimeout(r, 1000))
return K_OPTIONS;
@ -99,6 +138,15 @@ const promiseOptions = new Promise<typeof K_OPTIONS>(resolve => {
optionLabel="label"
optionValue="value"
/>
<FormKit
type="PCascadeSelect"
name="PCascadeSelect"
label="级联选择框"
validation="required"
:options="promiseCascadeOptions"
optionLabel="dictLabel"
optionValue="dictValue"
/>
<FormKit
type="PDatePicker"
name="PDatePicker"