config.js 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. export const formConf = {
  2. formRef: 'formRef',
  3. formModel: 'formData',
  4. size: 'default',
  5. labelPosition: 'right',
  6. labelWidth: 100,
  7. formRules: 'rules',
  8. gutter: 15,
  9. disabled: false,
  10. span: 24,
  11. formBtns: true,
  12. }
  13. export const inputComponents = [
  14. {
  15. label: '单行文本',
  16. tag: 'el-input',
  17. tagIcon: 'input',
  18. type: 'text',
  19. placeholder: '请输入',
  20. defaultValue: undefined,
  21. span: 24,
  22. labelWidth: null,
  23. style: { width: '100%' },
  24. clearable: true,
  25. prepend: '',
  26. append: '',
  27. 'prefix-icon': '',
  28. 'suffix-icon': '',
  29. maxlength: null,
  30. 'show-word-limit': false,
  31. readonly: false,
  32. disabled: false,
  33. required: true,
  34. regList: [],
  35. changeTag: true,
  36. document: 'https://element-plus.org/zh-CN/component/input',
  37. },
  38. {
  39. label: '多行文本',
  40. tag: 'el-input',
  41. tagIcon: 'textarea',
  42. type: 'textarea',
  43. placeholder: '请输入',
  44. defaultValue: undefined,
  45. span: 24,
  46. labelWidth: null,
  47. autosize: {
  48. minRows: 4,
  49. maxRows: 4,
  50. },
  51. style: { width: '100%' },
  52. maxlength: null,
  53. 'show-word-limit': false,
  54. readonly: false,
  55. disabled: false,
  56. required: true,
  57. regList: [],
  58. changeTag: true,
  59. document: 'https://element-plus.org/zh-CN/component/input',
  60. },
  61. {
  62. label: '密码',
  63. tag: 'el-input',
  64. tagIcon: 'password',
  65. type: 'password',
  66. placeholder: '请输入',
  67. defaultValue: undefined,
  68. span: 24,
  69. 'show-password': true,
  70. labelWidth: null,
  71. style: { width: '100%' },
  72. clearable: true,
  73. prepend: '',
  74. append: '',
  75. 'prefix-icon': '',
  76. 'suffix-icon': '',
  77. maxlength: null,
  78. 'show-word-limit': false,
  79. readonly: false,
  80. disabled: false,
  81. required: true,
  82. regList: [],
  83. changeTag: true,
  84. document: 'https://element-plus.org/zh-CN/component/input',
  85. },
  86. {
  87. label: '计数器',
  88. tag: 'el-input-number',
  89. tagIcon: 'number',
  90. placeholder: '',
  91. defaultValue: undefined,
  92. span: 24,
  93. labelWidth: null,
  94. min: undefined,
  95. max: undefined,
  96. step: undefined,
  97. 'step-strictly': false,
  98. precision: undefined,
  99. 'controls-position': '',
  100. disabled: false,
  101. required: true,
  102. regList: [],
  103. changeTag: true,
  104. document: 'https://element-plus.org/zh-CN/component/input-number',
  105. },
  106. ]
  107. export const selectComponents = [
  108. {
  109. label: '下拉选择',
  110. tag: 'el-select',
  111. tagIcon: 'select',
  112. placeholder: '请选择',
  113. defaultValue: undefined,
  114. span: 24,
  115. labelWidth: null,
  116. style: { width: '100%' },
  117. clearable: true,
  118. disabled: false,
  119. required: true,
  120. filterable: false,
  121. multiple: false,
  122. options: [
  123. {
  124. label: '选项一',
  125. value: 1,
  126. },
  127. {
  128. label: '选项二',
  129. value: 2,
  130. },
  131. ],
  132. regList: [],
  133. changeTag: true,
  134. document: 'https://element-plus.org/zh-CN/component/select',
  135. },
  136. {
  137. label: '级联选择',
  138. tag: 'el-cascader',
  139. tagIcon: 'cascader',
  140. placeholder: '请选择',
  141. defaultValue: [],
  142. span: 24,
  143. labelWidth: null,
  144. style: { width: '100%' },
  145. props: {
  146. props: {
  147. multiple: false,
  148. },
  149. },
  150. 'show-all-levels': true,
  151. disabled: false,
  152. clearable: true,
  153. filterable: false,
  154. required: true,
  155. options: [
  156. {
  157. id: 1,
  158. value: 1,
  159. label: '选项1',
  160. children: [
  161. {
  162. id: 2,
  163. value: 2,
  164. label: '选项1-1',
  165. },
  166. ],
  167. },
  168. ],
  169. dataType: 'dynamic',
  170. labelKey: 'label',
  171. valueKey: 'value',
  172. childrenKey: 'children',
  173. separator: '/',
  174. regList: [],
  175. changeTag: true,
  176. document: 'https://element-plus.org/zh-CN/component/cascader',
  177. },
  178. {
  179. label: '单选框组',
  180. tag: 'el-radio-group',
  181. tagIcon: 'radio',
  182. defaultValue: 0,
  183. span: 24,
  184. labelWidth: null,
  185. style: {},
  186. optionType: 'default',
  187. border: false,
  188. size: 'default',
  189. disabled: false,
  190. required: true,
  191. options: [
  192. {
  193. label: '选项一',
  194. value: 1,
  195. },
  196. {
  197. label: '选项二',
  198. value: 2,
  199. },
  200. ],
  201. regList: [],
  202. changeTag: true,
  203. document: 'https://element-plus.org/zh-CN/component/radio',
  204. },
  205. {
  206. label: '多选框组',
  207. tag: 'el-checkbox-group',
  208. tagIcon: 'checkbox',
  209. defaultValue: [],
  210. span: 24,
  211. labelWidth: null,
  212. style: {},
  213. optionType: 'default',
  214. border: false,
  215. size: 'default',
  216. disabled: false,
  217. required: true,
  218. options: [
  219. {
  220. label: '选项一',
  221. value: 1,
  222. },
  223. {
  224. label: '选项二',
  225. value: 2,
  226. },
  227. ],
  228. regList: [],
  229. changeTag: true,
  230. document: 'https://element-plus.org/zh-CN/component/checkbox',
  231. },
  232. {
  233. label: '开关',
  234. tag: 'el-switch',
  235. tagIcon: 'switch',
  236. defaultValue: false,
  237. span: 24,
  238. labelWidth: null,
  239. style: {},
  240. disabled: false,
  241. required: true,
  242. 'active-text': '',
  243. 'inactive-text': '',
  244. 'active-color': null,
  245. 'inactive-color': null,
  246. 'active-value': true,
  247. 'inactive-value': false,
  248. regList: [],
  249. changeTag: true,
  250. document: 'https://element-plus.org/zh-CN/component/switch',
  251. },
  252. {
  253. label: '滑块',
  254. tag: 'el-slider',
  255. tagIcon: 'slider',
  256. defaultValue: null,
  257. span: 24,
  258. labelWidth: null,
  259. disabled: false,
  260. required: true,
  261. min: 0,
  262. max: 100,
  263. step: 1,
  264. 'show-stops': false,
  265. range: false,
  266. regList: [],
  267. changeTag: true,
  268. document: 'https://element-plus.org/zh-CN/component/slider',
  269. },
  270. {
  271. label: '时间选择',
  272. tag: 'el-time-picker',
  273. tagIcon: 'time',
  274. placeholder: '请选择',
  275. defaultValue: '',
  276. span: 24,
  277. labelWidth: null,
  278. style: { width: '100%' },
  279. disabled: false,
  280. clearable: true,
  281. required: true,
  282. format: 'HH:mm:ss',
  283. 'value-format': 'HH:mm:ss',
  284. regList: [],
  285. changeTag: true,
  286. document: 'https://element-plus.org/zh-CN/component/time-picker',
  287. },
  288. {
  289. label: '时间范围',
  290. tag: 'el-time-picker',
  291. tagIcon: 'time-range',
  292. defaultValue: null,
  293. span: 24,
  294. labelWidth: null,
  295. style: { width: '100%' },
  296. disabled: false,
  297. clearable: true,
  298. required: true,
  299. 'is-range': true,
  300. 'range-separator': '至',
  301. 'start-placeholder': '开始时间',
  302. 'end-placeholder': '结束时间',
  303. format: 'HH:mm:ss',
  304. 'value-format': 'HH:mm:ss',
  305. regList: [],
  306. changeTag: true,
  307. document: 'https://element-plus.org/zh-CN/component/time-picker',
  308. },
  309. {
  310. label: '日期选择',
  311. tag: 'el-date-picker',
  312. tagIcon: 'date',
  313. placeholder: '请选择',
  314. defaultValue: null,
  315. type: 'date',
  316. span: 24,
  317. labelWidth: null,
  318. style: { width: '100%' },
  319. disabled: false,
  320. clearable: true,
  321. required: true,
  322. format: 'YYYY-MM-DD',
  323. 'value-format': 'YYYY-MM-DD',
  324. readonly: false,
  325. regList: [],
  326. changeTag: true,
  327. document: 'https://element-plus.org/zh-CN/component/date-picker',
  328. },
  329. {
  330. label: '日期范围',
  331. tag: 'el-date-picker',
  332. tagIcon: 'date-range',
  333. defaultValue: null,
  334. span: 24,
  335. labelWidth: null,
  336. style: { width: '100%' },
  337. type: 'daterange',
  338. 'range-separator': '至',
  339. 'start-placeholder': '开始日期',
  340. 'end-placeholder': '结束日期',
  341. disabled: false,
  342. clearable: true,
  343. required: true,
  344. format: 'YYYY-MM-DD',
  345. 'value-format': 'YYYY-MM-DD',
  346. readonly: false,
  347. regList: [],
  348. changeTag: true,
  349. document: 'https://element-plus.org/zh-CN/component/date-picker',
  350. },
  351. {
  352. label: '评分',
  353. tag: 'el-rate',
  354. tagIcon: 'rate',
  355. defaultValue: 0,
  356. span: 24,
  357. labelWidth: null,
  358. style: {},
  359. max: 5,
  360. 'allow-half': false,
  361. 'show-text': false,
  362. 'show-score': false,
  363. disabled: false,
  364. required: true,
  365. regList: [],
  366. changeTag: true,
  367. document: 'https://element-plus.org/zh-CN/component/rate',
  368. },
  369. {
  370. label: '颜色选择',
  371. tag: 'el-color-picker',
  372. tagIcon: 'color',
  373. defaultValue: null,
  374. labelWidth: null,
  375. 'show-alpha': false,
  376. 'color-format': '',
  377. disabled: false,
  378. required: true,
  379. size: 'default',
  380. regList: [],
  381. changeTag: true,
  382. document: 'https://element-plus.org/zh-CN/component/color-picker',
  383. },
  384. {
  385. label: '上传',
  386. tag: 'el-upload',
  387. tagIcon: 'upload',
  388. action: 'https://jsonplaceholder.typicode.com/posts/',
  389. defaultValue: null,
  390. labelWidth: null,
  391. disabled: false,
  392. required: true,
  393. accept: '',
  394. name: 'file',
  395. 'auto-upload': true,
  396. showTip: false,
  397. buttonText: '点击上传',
  398. fileSize: 2,
  399. sizeUnit: 'MB',
  400. 'list-type': 'text',
  401. multiple: false,
  402. regList: [],
  403. changeTag: true,
  404. document: 'https://element-plus.org/zh-CN/component/upload',
  405. tip: '只能上传不超过 2MB 的文件',
  406. style: { width: '100%' },
  407. },
  408. ]
  409. export const layoutComponents = [
  410. {
  411. layout: 'rowFormItem',
  412. tagIcon: 'row',
  413. type: 'default',
  414. justify: 'start',
  415. align: 'top',
  416. label: '行容器',
  417. layoutTree: true,
  418. children: [],
  419. document: 'https://element-plus.org/zh-CN/component/layout',
  420. },
  421. {
  422. layout: 'colFormItem',
  423. label: '按钮',
  424. changeTag: true,
  425. labelWidth: null,
  426. tag: 'el-button',
  427. tagIcon: 'button',
  428. span: 24,
  429. default: '主要按钮',
  430. type: 'primary',
  431. icon: 'Search',
  432. size: 'default',
  433. disabled: false,
  434. document: 'https://element-plus.org/zh-CN/component/button',
  435. },
  436. ]
  437. // 组件rule的触发方式,无触发方式的组件不生成rule
  438. export const trigger = {
  439. 'el-input': 'blur',
  440. 'el-input-number': 'blur',
  441. 'el-select': 'change',
  442. 'el-radio-group': 'change',
  443. 'el-checkbox-group': 'change',
  444. 'el-cascader': 'change',
  445. 'el-time-picker': 'change',
  446. 'el-date-picker': 'change',
  447. 'el-rate': 'change',
  448. }