From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目
---
src/components/FormCreate/src/config/selectRule.ts | 181 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 181 insertions(+), 0 deletions(-)
diff --git a/src/components/FormCreate/src/config/selectRule.ts b/src/components/FormCreate/src/config/selectRule.ts
new file mode 100644
index 0000000..a6f3841
--- /dev/null
+++ b/src/components/FormCreate/src/config/selectRule.ts
@@ -0,0 +1,181 @@
+const selectRule = [
+ {
+ type: 'select',
+ field: 'selectType',
+ title: '閫夋嫨鍣ㄧ被鍨�',
+ value: 'select',
+ options: [
+ { label: '涓嬫媺妗�', value: 'select' },
+ { label: '鍗曢�夋', value: 'radio' },
+ { label: '澶氶�夋', value: 'checkbox' }
+ ],
+ // 鍙傝�� https://www.form-create.com/v3/guide/control 缁勪欢鑱斿姩锛屽崟閫夋鍜屽閫夋涓嶉渶瑕佸閫夊睘鎬�
+ control: [
+ {
+ value: 'select',
+ condition: '==',
+ method: 'hidden',
+ rule: [
+ 'multiple',
+ 'clearable',
+ 'collapseTags',
+ 'multipleLimit',
+ 'allowCreate',
+ 'filterable',
+ 'noMatchText',
+ 'remote',
+ 'remoteMethod',
+ 'reserveKeyword',
+ 'defaultFirstOption',
+ 'automaticDropdown'
+ ]
+ }
+ ]
+ },
+ {
+ type: 'switch',
+ field: 'filterable',
+ title: '鏄惁鍙悳绱�'
+ },
+ { type: 'switch', field: 'multiple', title: '鏄惁澶氶��' },
+ {
+ type: 'switch',
+ field: 'disabled',
+ title: '鏄惁绂佺敤'
+ },
+ { type: 'switch', field: 'clearable', title: '鏄惁鍙互娓呯┖閫夐」' },
+ {
+ type: 'switch',
+ field: 'collapseTags',
+ title: '澶氶�夋椂鏄惁灏嗛�変腑鍊兼寜鏂囧瓧鐨勫舰寮忓睍绀�'
+ },
+ {
+ type: 'inputNumber',
+ field: 'multipleLimit',
+ title: '澶氶�夋椂鐢ㄦ埛鏈�澶氬彲浠ラ�夋嫨鐨勯」鐩暟锛屼负 0 鍒欎笉闄愬埗',
+ props: { min: 0 }
+ },
+ {
+ type: 'input',
+ field: 'autocomplete',
+ title: 'autocomplete 灞炴��'
+ },
+ { type: 'input', field: 'placeholder', title: '鍗犱綅绗�' },
+ { type: 'switch', field: 'allowCreate', title: '鏄惁鍏佽鐢ㄦ埛鍒涘缓鏂版潯鐩�' },
+ {
+ type: 'input',
+ field: 'noMatchText',
+ title: '鎼滅储鏉′欢鏃犲尮閰嶆椂鏄剧ず鐨勬枃瀛�'
+ },
+ { type: 'input', field: 'noDataText', title: '閫夐」涓虹┖鏃舵樉绀虹殑鏂囧瓧' },
+ {
+ type: 'switch',
+ field: 'reserveKeyword',
+ title: '澶氶�変笖鍙悳绱㈡椂锛屾槸鍚﹀湪閫変腑涓�涓�夐」鍚庝繚鐣欏綋鍓嶇殑鎼滅储鍏抽敭璇�'
+ },
+ {
+ type: 'switch',
+ field: 'defaultFirstOption',
+ title: '鍦ㄨ緭鍏ユ鎸変笅鍥炶溅锛岄�夋嫨绗竴涓尮閰嶉」'
+ },
+ {
+ type: 'switch',
+ field: 'popperAppendToBody',
+ title: '鏄惁灏嗗脊鍑烘鎻掑叆鑷� body 鍏冪礌',
+ value: true
+ },
+ {
+ type: 'switch',
+ field: 'automaticDropdown',
+ title: '瀵逛簬涓嶅彲鎼滅储鐨� Select锛屾槸鍚﹀湪杈撳叆妗嗚幏寰楃劍鐐瑰悗鑷姩寮瑰嚭閫夐」鑿滃崟'
+ }
+]
+
+const apiSelectRule = [
+ {
+ type: 'input',
+ field: 'url',
+ title: 'url 鍦板潃',
+ props: {
+ placeholder: '/system/user/simple-list'
+ }
+ },
+ {
+ type: 'select',
+ field: 'method',
+ title: '璇锋眰绫诲瀷',
+ value: 'GET',
+ options: [
+ { label: 'GET', value: 'GET' },
+ { label: 'POST', value: 'POST' }
+ ],
+ control: [
+ {
+ value: 'GET',
+ condition: '!=',
+ method: 'hidden',
+ rule: [
+ {
+ type: 'input',
+ field: 'data',
+ title: '璇锋眰鍙傛暟 JSON 鏍煎紡',
+ props: {
+ autosize: true,
+ type: 'textarea',
+ placeholder: '{"type": 1}'
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ type: 'input',
+ field: 'labelField',
+ title: 'label 灞炴��',
+ info: '鍙互浣跨敤 el 琛ㄨ揪寮忥細${灞炴�锛屾潵瀹炵幇澶嶆潅鏁版嵁缁勫悎銆傚锛�${nickname}-${id}',
+ props: {
+ placeholder: 'nickname'
+ }
+ },
+ {
+ type: 'input',
+ field: 'valueField',
+ title: 'value 灞炴��',
+ info: '鍙互浣跨敤 el 琛ㄨ揪寮忥細${灞炴�锛屾潵瀹炵幇澶嶆潅鏁版嵁缁勫悎銆傚锛�${nickname}-${id}',
+ props: {
+ placeholder: 'id'
+ }
+ },
+ {
+ type: 'input',
+ field: 'parseFunc',
+ title: '閫夐」瑙f瀽鍑芥暟',
+ info: `data 涓烘帴鍙h繑鍥炲��,闇�瑕佸啓涓�涓尶鍚嶅嚱鏁拌В鏋愯繑鍥炲�间负閫夋嫨鍣� options 鍒楄〃
+ (data: any)=>{ label: string; value: any }[]`,
+ props: {
+ autosize: true,
+ rows: { minRows: 2, maxRows: 6 },
+ type: 'textarea',
+ placeholder: `
+ function (data) {
+ console.log(data)
+ return data.list.map(item=> ({label: item.nickname,value: item.id}))
+ }`
+ }
+ },
+ {
+ type: 'switch',
+ field: 'remote',
+ info: '鏄惁鍙悳绱�',
+ title: '鍏朵腑鐨勯�夐」鏄惁浠庢湇鍔″櫒杩滅▼鍔犺浇'
+ },
+ {
+ type: 'input',
+ field: 'remoteField',
+ title: '璇锋眰鍙傛暟',
+ info: '杩滅▼璇锋眰鏃惰姹傛惡甯︾殑鍙傛暟鍚嶇О锛屽锛歯ame'
+ }
+]
+
+export { selectRule, apiSelectRule }
--
Gitblit v1.8.0