el-plus-crud 0.0.11 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +115 -3
  3. package/build.js +31 -9
  4. package/dist/components/el-plus-form/ElPlusForm.vue.d.ts +320 -0
  5. package/dist/components/el-plus-form/ElPlusFormDialog.vue.d.ts +74 -0
  6. package/dist/components/el-plus-form/components/ElPlusFormArea.vue.d.ts +44 -0
  7. package/dist/components/el-plus-form/components/ElPlusFormAutocomplete.vue.d.ts +55 -0
  8. package/dist/components/el-plus-form/components/ElPlusFormBtn.vue.d.ts +44 -0
  9. package/dist/components/el-plus-form/components/ElPlusFormBtns.vue.d.ts +42 -0
  10. package/dist/components/el-plus-form/components/ElPlusFormCascader.vue.d.ts +44 -0
  11. package/dist/components/el-plus-form/components/ElPlusFormCascaderPanel.vue.d.ts +51 -0
  12. package/dist/components/el-plus-form/components/ElPlusFormCheckbox.vue.d.ts +44 -0
  13. package/dist/components/el-plus-form/components/ElPlusFormCheckboxButton.vue.d.ts +44 -0
  14. package/dist/components/el-plus-form/components/ElPlusFormColor.vue.d.ts +44 -0
  15. package/dist/components/el-plus-form/components/ElPlusFormDate.vue.d.ts +44 -0
  16. package/dist/components/el-plus-form/components/ElPlusFormDaterange.vue.d.ts +51 -0
  17. package/dist/components/el-plus-form/components/ElPlusFormDatetime.vue.d.ts +44 -0
  18. package/dist/components/el-plus-form/components/ElPlusFormFile.vue.d.ts +48 -0
  19. package/dist/components/el-plus-form/components/ElPlusFormImage.vue.d.ts +48 -0
  20. package/dist/components/el-plus-form/components/ElPlusFormInput.vue.d.ts +50 -0
  21. package/dist/components/el-plus-form/components/ElPlusFormLink.vue.d.ts +53 -0
  22. package/dist/components/el-plus-form/components/ElPlusFormNbinput.vue.d.ts +61 -0
  23. package/dist/components/el-plus-form/components/ElPlusFormNumber.vue.d.ts +57 -0
  24. package/dist/components/el-plus-form/components/ElPlusFormQuickInput.vue.d.ts +51 -0
  25. package/dist/components/el-plus-form/components/ElPlusFormRadio.vue.d.ts +44 -0
  26. package/dist/components/el-plus-form/components/ElPlusFormRate.vue.d.ts +44 -0
  27. package/dist/components/el-plus-form/components/ElPlusFormSelect.vue.d.ts +56 -0
  28. package/dist/components/el-plus-form/components/ElPlusFormSlider.vue.d.ts +44 -0
  29. package/dist/components/el-plus-form/components/ElPlusFormStatus.vue.d.ts +44 -0
  30. package/dist/components/el-plus-form/components/ElPlusFormSwitch.vue.d.ts +50 -0
  31. package/dist/components/el-plus-form/components/ElPlusFormTag.vue.d.ts +48 -0
  32. package/dist/components/el-plus-form/components/ElPlusFormText.vue.d.ts +48 -0
  33. package/dist/components/el-plus-form/components/ElPlusFormTextarea.vue.d.ts +51 -0
  34. package/dist/components/el-plus-form/components/ElPlusFormTransfer.vue.d.ts +57 -0
  35. package/dist/components/el-plus-form/components/ElPlusFormTree.vue.d.ts +50 -0
  36. package/dist/components/el-plus-form/components/ElPlusFormTreeSelect.vue.d.ts +50 -0
  37. package/dist/components/el-plus-form/components/ElPlusFormUpload.vue.d.ts +51 -0
  38. package/dist/components/el-plus-form/components/components/file-icons/FileIcons.vue.d.ts +42 -0
  39. package/dist/components/el-plus-form/components/components/file-icons/data/index.d.ts +15 -0
  40. package/dist/components/el-plus-form/components/index.d.ts +3 -0
  41. package/dist/components/el-plus-form/data/file.d.ts +63 -0
  42. package/dist/components/el-plus-form/mixins/index.d.ts +28 -0
  43. package/dist/components/el-plus-form/util/index.d.ts +47 -0
  44. package/dist/components/el-plus-form/util/validate.d.ts +253 -0
  45. package/dist/components/el-plus-table/ElPlusTable.vue.d.ts +155 -0
  46. package/dist/components/el-plus-table/components/columnItem.vue.d.ts +42 -0
  47. package/dist/components/el-plus-table/components/header.vue.d.ts +93 -0
  48. package/dist/components/el-plus-table/components/settingColumn.vue.d.ts +28 -0
  49. package/dist/components/el-plus-table/util/index.d.ts +26 -0
  50. package/dist/components-list.d.ts +2 -0
  51. package/dist/config/index.d.ts +2 -0
  52. package/dist/el-plus-crud.mjs +6968 -0
  53. package/dist/el-plus-crud.umd.js +27 -0
  54. package/dist/index.d.ts +11 -0
  55. package/dist/style.css +1 -1
  56. package/lib/components/el-plus-form/ElPlusForm.vue +20 -8
  57. package/lib/components/el-plus-form/components/ElPlusFormArea.vue +59 -0
  58. package/lib/components/el-plus-form/components/ElPlusFormBtn.vue +1 -1
  59. package/lib/components/el-plus-form/components/ElPlusFormCascader.vue +25 -2
  60. package/lib/components/el-plus-form/components/ElPlusFormDate.vue +3 -1
  61. package/lib/components/el-plus-form/components/ElPlusFormFile.vue +1 -1
  62. package/lib/components/el-plus-form/components/ElPlusFormInput.vue +4 -2
  63. package/lib/components/el-plus-form/components/ElPlusFormLink.vue +20 -10
  64. package/lib/components/el-plus-form/components/ElPlusFormNumber.vue +37 -6
  65. package/lib/components/el-plus-form/components/ElPlusFormQuickInput.vue +92 -0
  66. package/lib/components/el-plus-form/components/ElPlusFormSelect.vue +16 -4
  67. package/lib/components/el-plus-form/components/ElPlusFormText.vue +0 -16
  68. package/lib/components/el-plus-form/components/ElPlusFormTextarea.vue +4 -2
  69. package/lib/components/el-plus-form/components/ElPlusFormUpload.vue +364 -0
  70. package/lib/components/el-plus-form/components/components/file-icons/images/doc.svg +12 -12
  71. package/lib/components/el-plus-form/components/components/file-icons/images/file.svg +18 -18
  72. package/lib/components/el-plus-form/components/components/file-icons/images/jpg.svg +13 -13
  73. package/lib/components/el-plus-form/components/components/file-icons/images/pdf.svg +12 -12
  74. package/lib/components/el-plus-form/components/components/file-icons/images/png.svg +12 -12
  75. package/lib/components/el-plus-form/components/components/file-icons/images/ppt.svg +12 -12
  76. package/lib/components/el-plus-form/components/components/file-icons/images/xls.svg +12 -12
  77. package/lib/components/el-plus-form/components/index.js +17 -0
  78. package/lib/components/el-plus-form/components/index.ts +1 -1
  79. package/lib/components/el-plus-form/util/index.ts +0 -9
  80. package/lib/components/el-plus-table/ElPlusTable.vue +28 -14
  81. package/lib/components/el-plus-table/components/columnItem.vue +22 -3
  82. package/lib/components/el-plus-table/components/header.vue +57 -37
  83. package/lib/components/el-plus-table/components/settingColumn.vue +6 -4
  84. package/lib/components/el-plus-table/util/index.ts +24 -0
  85. package/lib/components-list.ts +67 -0
  86. package/lib/config/index.ts +29 -9
  87. package/lib/default.d.ts +4 -4
  88. package/lib/index.ts +9 -84
  89. package/package.json +6 -4
  90. package/types/formList.d.ts +44 -3
  91. package/vite.config.ts +12 -2
  92. package/dist/el-plus-crud.umd.cjs +0 -27
  93. package/lib/components/el-plus-form/components/ElPlusFormPassword.vue +0 -39
  94. package/lib/components/el-plus-form/components/components/IconSelectorList.vue +0 -92
  95. package/lib/config/form.ts +0 -12
  96. package/lib/index.d.ts +0 -3
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- @charset "UTF-8";.ElPlusFormAutocomplete-panel[data-v-9a2a6259],.el-plus-form-btn-group{display:flex}.el-plus-form-btn-group .group-menu-btn{margin-left:10px}.ElPlusFormCascader-panel[data-v-8b943369],.ElPlusFormCascaderPanel-panel[data-v-2c8fbcd6],.ElPlusFormCheckbox-panel[data-v-d9495439],.ElPlusFormCheckboxButton-panel[data-v-01d22bc6],.ElPlusFormColor-panel[data-v-b0687872],.ElPlusFormDate-panel[data-v-1d69d940],.el-plusF-form-daterange-panel[data-v-2f54b570],.ElPlusFormDatetime-panel[data-v-e8947510]{display:flex}.file-icons-panel[data-v-e0d1255f]{width:100%}.file-icons-panel .file-list[data-v-e0d1255f]{width:100%;display:flex;flex-direction:column}.file-icons-panel .file-list .file-item[data-v-e0d1255f]{display:flex;flex-direction:row;align-items:center;width:100%;height:28px;line-height:28px;padding-left:10px;background:#f5f7fa;margin-bottom:10px;cursor:pointer;font-size:13px;font-weight:400;color:#303133}.file-icons-panel .file-list .file-item[data-v-e0d1255f]:hover{background:#e7e8eb;color:#1890ff}.file-icons-panel .file-list .file-item .file-name[data-v-e0d1255f]{margin-left:10px}.file-icons-panel .card-list[data-v-e0d1255f]{width:100%;display:flex;flex-direction:row}.file-icons-panel .card-list .file-item[data-v-e0d1255f]{display:flex;flex-direction:column;align-items:center}.file-icons-panel .card-list .file-item .file-name[data-v-e0d1255f]{margin-top:10px}.ele-form-file{width:100%;display:flex;justify-content:center;margin-top:10px}.ele-form-file .form-file-list{display:flex;flex-direction:column;width:100%}.ele-form-file .no-img-tip{width:100%;color:#999;padding-left:20px}.ele-form-image{display:flex;flex-wrap:wrap}.ele-form-image .no-img-tip{color:#999}.ele-form-image .el-image{margin-left:10px;margin-bottom:10px}.ele-form-image .el-image{border-radius:5px;margin-bottom:10px}.ele-form-image .el-image .el-image__error{font-size:12px;line-height:13px}.el-plus-form-link[data-v-1947aab1]{width:100%}.el-plus-form-link .items-panel[data-v-1947aab1] .el-input__inner{cursor:pointer}.el-plus-form-link[data-v-1947aab1] .el-tag__close{display:none!important}.form-link-dialog{width:100%;display:flex;box-sizing:border-box}.form-link-dialog .panel-left{flex:1;height:500px;display:flex;flex-direction:column}.form-link-dialog .panel-left .dept-breadcrumb{width:100%;padding:0 10px;margin-bottom:20px;cursor:pointer}.form-link-dialog .panel-right{max-width:40%;margin-left:20px;border-left:1px var(--el-border-color) var(--el-border-style);padding:20px;display:flex;overflow:hidden;flex-direction:column}.form-link-dialog .panel-right .right-title{width:100%;font-size:14px;color:#999;margin-bottom:20px}.form-link-dialog .panel-right .tag-list{width:100%;height:400px;overflow:hidden}.form-link-dialog .panel-right .tag-list .tag-item .el-tag__content{max-width:100px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.form-link-dialog .panel-right .btn-panel{width:100%;min-height:50px;padding-top:10px;display:flex;justify-content:center}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none}input[type=number]{-moz-appearance:textfield}.ElPlusFormNumber-panel[data-v-8ab5b54a]{width:100%!important;max-width:100%}.ElPlusFormNumber-panel[data-v-8ab5b54a] .el-input__wrapper input{text-align:left!important}.ElPlusFormRadio-panel[data-v-2d59dd3c],.ElPlusFormRate-panel[data-v-c585734a]{display:flex}.el-plus-form-select-options{width:100%;display:flex;justify-content:space-between;align-items:center}.el-plus-form-select-options>div{color:#aaa;max-width:40%;font-size:12px;word-break:break-all}.el-select-dropdown__item{height:auto;white-space:break-spaces}.ElPlusFormSlider-panel[data-v-b3d36458]{display:flex}.ElPlusFormStatus-panel[data-v-87ed9e56]{display:flex;line-height:25px;align-items:center}.ElPlusFormStatus-panel i[data-v-87ed9e56]{display:inline-block;min-width:10px;min-height:10px;border-radius:50%;margin-right:5px}.ElPlusFormStatus-panel .status-danger[data-v-87ed9e56]{background:#f56c6c}.ElPlusFormStatus-panel .status-success[data-v-87ed9e56]{background:#67c23a}.ElPlusFormStatus-panel .status-warning[data-v-87ed9e56]{background:#e6a23c}.ElPlusFormStatus-panel .status-info[data-v-87ed9e56]{background:#909399}.ele-form-text[data-v-e3c3f0d0]{color:#606266;word-break:break-all;display:flex;align-items:center}.ele-form-text-click[data-v-e3c3f0d0]{color:#1890ff;cursor:pointer}.ele-form-transfer[data-v-6262dcef]{line-height:1}.el-plus-form-tree[data-v-4aa78551]{width:100%}.el-plus-form-panel .el-plus-form--inline .el-plus-form-btns{width:auto}.el-plus-form-panel .el-form--inline .el-form-item{margin-right:12px!important}.el-plus-form-panel .el-plus-form-col--break{clear:both}.el-plus-form-panel .el-plus-form-tip{color:#909399;line-height:1.5em;margin-top:3px}.el-plus-form-panel .el-plus-form-tip code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}.el-plus-form-panel .el-form-item--default{margin-bottom:18px!important}.el-plus-table-edit-column[data-v-f91a3dba]{margin:0 10px;display:inline-block}.el-plus-table-edit-column .select-panel[data-v-f91a3dba]{width:100%;height:30px;padding:0 10px;border-bottom:1px solid #eee;margin-bottom:10px}.el-plus-table-header-info .el-plus-table-header-form{display:flex;flex-wrap:wrap;align-items:center}.el-plus-table-header-info .el-plus-table-header-form .el-form{display:flex;justify-content:flex-start;flex-wrap:wrap}.el-plus-table-header-info .el-plus-table-header-form .el-form .el-form-item{margin-bottom:16px!important}.el-plus-table-header-info .el-plus-table-header-form .el-form .el-form-item .el-form-item__label{width:auto!important}.el-plus-table-header-info .el-plus-table-header-form .el-form .waterfall-panel{width:auto!important;align-items:center}.el-plus-table-header-info .el-plus-table-header-form .el-plus-table-header-btns{display:flex;align-items:center;flex-wrap:wrap}.el-plus-table-header-info .el-plus-table-header-form .el-plus-table-header-btns .el-plus-table-header-btn{height:40px;display:flex;align-items:center;margin-right:10px}.el-plus-table-header-info[data-v-8c541368]{width:100%}.el-plus-table-column-item[data-v-1037cba6]{width:100%;display:flex}.el-plus-table-column-item[data-v-1037cba6] .ele-form-text{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.el-plus-table-column-row[data-v-1037cba6]{flex-direction:row}.el-plus-table-column-row>div[data-v-1037cba6]{margin-right:10px}.el-plus-table-column-row>div[data-v-1037cba6]:last-child{margin:0}.el-plus-table-column-column[data-v-1037cba6]{flex-direction:column}.el-plus-table-column-column>div[data-v-1037cba6]{margin-bottom:10px}.el-plus-table-column-column>div[data-v-1037cba6]:last-child{margin:0}.el-plus-table-content{background-color:#fff;border-radius:5px;padding:10px;width:100%;max-height:100%;overflow:hidden;display:flex;flex-direction:column;position:relative}.el-plus-table-content .th-required{position:relative}.el-plus-table-content .th-required:before{content:"*";position:absolute;left:-10px;font-size:16px;top:2px;color:#ff3b30;font-weight:700}.el-plus-table-content .select-items{display:flex;flex-wrap:wrap;align-items:center}.el-plus-table-content .select-items .title{font-size:18px;font-weight:700;margin-right:20px}.el-plus-table-content .select-items .select-item{margin:5px 10px 5px 0}.el-plus-table-content .select-items .select-item:last-child{margin-right:0}.el-plus-table-content .table-tabs-panel{margin-bottom:16px}.el-plus-table-content .summary-row{width:100%;background-color:var(--el-table-row-hover-bg-color);color:var(--el-table-text-color);padding:16px 20px;line-height:24px;height:40px;display:flex;position:relative}.el-plus-table-content .summary-row .summary-item{display:flex;align-items:center;margin-right:30px}.el-plus-table-content .summary-row .summary-item>span{margin-right:20px}.el-plus-table-content .el-plus-table-main{width:100%;flex:1;max-height:100%;display:flex;flex-direction:column}.el-plus-table-content .el-plus-table-main .el-table .cell{display:flex;align-items:center}.el-plus-table-content .pager-statistic{width:100%;position:fixed;height:32px;line-height:32px;bottom:0;text-align:right;min-width:900px}.el-plus-table-content .pager-statistic .statistic-item{display:inline-block}.el-plus-table-content .el-cascader__label{width:300px!important}.el-plus-table-content .bottom-page-static-info{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;min-height:41px;margin-top:10px}.el-plus-table-content .bottom-page-static-info .page-info{margin-right:30px}.el-plus-table-content .common-list-export-excel{background:#20a0ff;text-decoration:none;color:#fff;font-size:12px;height:29px;line-height:30px;display:block;margin-top:5px;border-radius:3px;padding:0 10px}.el-plus-table-content .common-list-export-excel:hover{background:#58b6ff}.el-plus-table-content .el-table__empty-block{height:auto!important}
1
+ @charset "UTF-8";.ElPlusFormArea-panel[data-v-a9653fd0],.ElPlusFormAutocomplete-panel[data-v-9a2a6259],.el-plus-form-btn-group{display:flex}.el-plus-form-btn-group .group-menu-btn{margin-left:10px}.ElPlusFormCascader-panel[data-v-ab6b4aed],.ElPlusFormCascaderPanel-panel[data-v-2c8fbcd6],.ElPlusFormCheckbox-panel[data-v-d9495439],.ElPlusFormCheckboxButton-panel[data-v-01d22bc6],.ElPlusFormColor-panel[data-v-b0687872],.ElPlusFormDate-panel[data-v-7295d086],.el-plusF-form-daterange-panel[data-v-2f54b570],.ElPlusFormDatetime-panel[data-v-e8947510]{display:flex}.file-icons-panel[data-v-e0d1255f]{width:100%}.file-icons-panel .file-list[data-v-e0d1255f]{width:100%;display:flex;flex-direction:column}.file-icons-panel .file-list .file-item[data-v-e0d1255f]{display:flex;flex-direction:row;align-items:center;width:100%;height:28px;line-height:28px;padding-left:10px;background:#f5f7fa;margin-bottom:10px;cursor:pointer;font-size:13px;font-weight:400;color:#303133}.file-icons-panel .file-list .file-item[data-v-e0d1255f]:hover{background:#e7e8eb;color:#1890ff}.file-icons-panel .file-list .file-item .file-name[data-v-e0d1255f]{margin-left:10px}.file-icons-panel .card-list[data-v-e0d1255f]{width:100%;display:flex;flex-direction:row}.file-icons-panel .card-list .file-item[data-v-e0d1255f]{display:flex;flex-direction:column;align-items:center}.file-icons-panel .card-list .file-item .file-name[data-v-e0d1255f]{margin-top:10px}.ele-form-file{width:100%;display:flex;justify-content:center;margin-top:10px}.ele-form-file .form-file-list{display:flex;flex-direction:column;width:100%}.ele-form-file .no-img-tip{width:100%;color:#999;padding-left:20px}.ele-form-image{display:flex;flex-wrap:wrap}.ele-form-image .no-img-tip{color:#999}.ele-form-image .el-image{margin-left:10px;margin-bottom:10px}.ele-form-image .el-image{border-radius:5px;margin-bottom:10px}.ele-form-image .el-image .el-image__error{font-size:12px;line-height:13px}.el-plus-form-link[data-v-e9e128a8]{width:100%}.el-plus-form-link .items-panel[data-v-e9e128a8] .el-input__inner{cursor:pointer}.el-plus-form-link[data-v-e9e128a8] .el-tag__close{display:none!important}.form-link-dialog{width:100%;display:flex;box-sizing:border-box}.form-link-dialog .panel-left{min-width:60%;height:500px;display:flex;flex-direction:column}.form-link-dialog .panel-left .dept-breadcrumb{width:100%;padding:0 10px;margin-bottom:20px;cursor:pointer}.form-link-dialog .panel-right{min-width:40%;max-width:40%;margin-left:20px;border-left:1px var(--el-border-color) var(--el-border-style);padding:20px;display:flex;overflow:hidden;flex-direction:column}.form-link-dialog .panel-right .right-title{width:100%;font-size:14px;color:#999;margin-bottom:20px}.form-link-dialog .panel-right .tag-list{width:100%;height:400px;overflow:hidden}.form-link-dialog .panel-right .tag-list .tag-item .el-tag__content{max-width:100px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.form-link-dialog .panel-right .btn-panel{width:100%;min-height:50px;padding-top:10px;display:flex;justify-content:center}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none}input[type=number]{-moz-appearance:textfield}.ElPlusFormNumber-panel[data-v-9e51e72b]{width:100%!important;max-width:100%}.ElPlusFormNumber-panel[data-v-9e51e72b] .el-input__wrapper input{text-align:left!important}.el-plus-form-quick-input{width:100%;display:flex;align-items:center;margin-top:10px}.el-plus-form-quick-input .el-tag{margin-right:10px}.ElPlusFormRadio-panel[data-v-2d59dd3c],.ElPlusFormRate-panel[data-v-c585734a]{display:flex}.el-plus-form-select-options{width:100%;display:flex;justify-content:space-between;align-items:center}.el-plus-form-select-options>div{color:#aaa;max-width:40%;font-size:12px;word-break:break-all}.el-select-dropdown__item{height:auto;white-space:break-spaces}.ElPlusFormSlider-panel[data-v-b3d36458]{display:flex}.ElPlusFormStatus-panel[data-v-87ed9e56]{display:flex;line-height:25px;align-items:center}.ElPlusFormStatus-panel i[data-v-87ed9e56]{display:inline-block;min-width:10px;min-height:10px;border-radius:50%;margin-right:5px}.ElPlusFormStatus-panel .status-danger[data-v-87ed9e56]{background:#f56c6c}.ElPlusFormStatus-panel .status-success[data-v-87ed9e56]{background:#67c23a}.ElPlusFormStatus-panel .status-warning[data-v-87ed9e56]{background:#e6a23c}.ElPlusFormStatus-panel .status-info[data-v-87ed9e56]{background:#909399}.ele-form-text[data-v-07e15a42]{color:#606266;word-break:break-all;display:flex;align-items:center}.ele-form-text-click[data-v-07e15a42]{color:#1890ff;cursor:pointer}.ele-form-transfer[data-v-6262dcef]{line-height:1}.el-plus-form-tree[data-v-4aa78551]{width:100%}.ele-form-upload-image{width:100%;display:flex}.ele-form-upload-image .ele-image-upload{display:flex;justify-content:flex-start;width:100%}.ele-form-upload-image .upload-panel-icon{margin:auto}.ele-form-upload-image .upload-disabled .el-upload--picture-card{cursor:not-allowed!important}.ele-form-upload-image .el-icon-close-tip{display:none!important}.ele-form-upload-image .el-upload--picture-card{margin-bottom:12px}.ele-form-upload-image .over-limit .el-upload--picture-card{display:none!important}.ele-form-upload-image .el-upload--picture-card,.ele-form-upload-image .el-upload-list--picture-card .el-upload-list__item{width:100px!important;height:100px!important;border:none!important}.ele-form-upload-image .el-upload-dragger{display:flex;padding:0!important;min-height:100px}.ele-form-upload-image .el-upload-dragger .el-upload__text{font-size:12px!important;color:#999}.ele-form-upload-image .el-upload-dragger .el-upload__text2{font-size:16px;color:#303133;line-height:22px;margin-top:16px;margin-bottom:16px}.ele-form-upload-image .el-progress-circle{width:90px!important;height:90px!important;margin:auto}.ele-form-upload-image .el-upload-list--picture-card .el-upload-list__item-thumbnail{object-fit:cover!important}.ele-form-upload-image .el-icon--close-tip{display:none!important}.ele-form-upload-file .ele-image-upload{flex-direction:column}.ele-form-upload-file .el-upload-list__item{margin:0!important}.ele-form-upload-file .el-form-item--default .el-form-item__content,.ele-form-upload-file .el-upload-list__item-name{line-height:20px!important;font-size:12px!important}.el-plus-form-panel .el-plus-form--inline .el-plus-form-btns{width:auto}.el-plus-form-panel .el-form--inline .el-form-item{margin-right:12px!important}.el-plus-form-panel .el-plus-form-col--break{clear:both}.el-plus-form-panel .el-plus-form-tip{color:#909399;line-height:1.5em;margin-top:3px}.el-plus-form-panel .el-plus-form-tip code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}.el-plus-form-panel .el-plus-form-column-panel>.el-form-item--default{margin-bottom:18px!important}.el-plus-form-panel .el-plus-form-column-panel>.el-form-item--default>.el-form-item__label{line-height:40px;margin-bottom:0}.el-plus-table-edit-column[data-v-76fa7ef7]{margin:0 10px;display:inline-block}.el-plus-table-edit-column .select-panel[data-v-76fa7ef7]{width:100%;height:30px;padding:0 10px;border-bottom:1px solid #eee;margin-bottom:10px}.el-plus-table-header-info .el-plus-table-header-form{display:flex;flex-wrap:wrap;align-items:center}.el-plus-table-header-info .el-plus-table-header-form .el-form{display:flex;justify-content:flex-start;flex-wrap:wrap}.el-plus-table-header-info .el-plus-table-header-form .el-form .el-form-item{margin-bottom:16px!important}.el-plus-table-header-info .el-plus-table-header-form .el-form .el-form-item .el-form-item__label{width:auto!important}.el-plus-table-header-info .el-plus-table-header-form .el-form .waterfall-panel{width:auto!important;align-items:center}.el-plus-table-header-info .el-plus-table-header-form .el-form .table-header-form-btns{white-space:nowrap;display:flex;flex-wrap:wrap;align-items:center}.el-plus-table-header-info .el-plus-table-header-form .el-form .table-header-form-btns>*{margin-bottom:16px}.el-plus-table-header-info .el-plus-table-header-form .el-plus-table-header-btns{display:flex;align-items:center;flex-wrap:wrap}.el-plus-table-header-info .el-plus-table-header-form .el-plus-table-header-btns .el-plus-table-header-btn{height:40px;display:flex;align-items:center;margin-right:10px}.el-plus-table-header-info[data-v-6ce69554]{width:100%}.el-plus-table-column-item[data-v-53e27808]{width:100%;display:flex}.el-plus-table-column-item[data-v-53e27808] .ele-form-text{display:inline-block;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.el-plus-table-column-row[data-v-53e27808]{flex-direction:row}.el-plus-table-column-row>div[data-v-53e27808]{margin-right:10px}.el-plus-table-column-row>div[data-v-53e27808]:last-child{margin:0}.el-plus-table-column-column[data-v-53e27808]{flex-direction:row}.el-plus-table-column-column>div[data-v-53e27808]{margin-bottom:10px}.el-plus-table-column-column>div[data-v-53e27808]:last-child{margin:0}.el-plus-table-content{background-color:#fff;border-radius:5px;padding:10px;width:100%;max-height:100%;overflow:hidden;display:flex;flex-direction:column;position:relative}.el-plus-table-content .th-required{position:relative}.el-plus-table-content .th-required:before{content:"*";position:absolute;left:-10px;font-size:16px;top:2px;color:#ff3b30;font-weight:700}.el-plus-table-content .select-items{display:flex;flex-wrap:wrap;align-items:center}.el-plus-table-content .select-items .title{font-size:18px;font-weight:700;margin-right:20px}.el-plus-table-content .select-items .select-item{margin:5px 10px 5px 0}.el-plus-table-content .select-items .select-item:last-child{margin-right:0}.el-plus-table-content .table-tabs-panel{margin-bottom:16px}.el-plus-table-content .summary-row{width:100%;background-color:var(--el-table-row-hover-bg-color);color:var(--el-table-text-color);padding:16px 20px;line-height:24px;height:40px;display:flex;position:relative}.el-plus-table-content .summary-row .summary-item{display:flex;align-items:center;margin-right:30px}.el-plus-table-content .summary-row .summary-item>span{margin-right:20px}.el-plus-table-content .el-plus-table-main{width:100%;flex:1;max-height:100%;display:flex;flex-direction:column}.el-plus-table-content .el-plus-table-main .el-table .cell{display:flex;align-items:center}.el-plus-table-content .pager-statistic{width:100%;position:fixed;height:32px;line-height:32px;bottom:0;text-align:right;min-width:900px}.el-plus-table-content .pager-statistic .statistic-item{display:inline-block}.el-plus-table-content .el-cascader__label{width:300px!important}.el-plus-table-content .bottom-page-static-info{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;min-height:41px;margin-top:10px}.el-plus-table-content .bottom-page-static-info .page-info{margin-right:30px}.el-plus-table-content .common-list-export-excel{background:#20a0ff;text-decoration:none;color:#fff;font-size:12px;height:29px;line-height:30px;display:block;margin-top:5px;border-radius:3px;padding:0 10px}.el-plus-table-content .common-list-export-excel:hover{background:#58b6ff}.el-plus-table-content .el-table__empty-block{height:auto!important}
@@ -45,7 +45,6 @@ import * as validates from './util/validate'
45
45
  import { typeList } from './components/index'
46
46
  import ElPlusFormBtn from './components/ElPlusFormBtn.vue'
47
47
  import { cloneDeep } from 'lodash'
48
-
49
48
  // IFormProps定义
50
49
  export interface IFormProps {
51
50
  // 表单描述
@@ -103,6 +102,7 @@ export interface IFormProps {
103
102
  // 其他钩子 直接放到attrs里面去了
104
103
  }
105
104
 
105
+ const defaultConf = inject('defaultConf') as ICRUDConfig
106
106
  // 定义全局的format对象
107
107
  const elPlusFormFormat = inject('format') as any
108
108
 
@@ -180,6 +180,8 @@ const innerIsLoading = ref(false)
180
180
 
181
181
  let oldFormData = null as any
182
182
 
183
+ const size = computed(() => props.size || defaultConf.size)
184
+
183
185
  // 整体的布局方式
184
186
  const formLayout = computed(() => ({ display: 'flex', flexDirection: props.isTable ? 'row' : 'column' })) as any
185
187
 
@@ -314,6 +316,10 @@ const initFormAttrs = throttle(() => {
314
316
  if (formItem.default !== undefined && formItem.default !== null && props.modelValue[field] === undefined) {
315
317
  props.modelValue[field] = formItem.default
316
318
  }
319
+ // 这里初始化一下默认选中项
320
+ if (formItem.defaultItem !== undefined && formItem.defaultItem !== null && props.modelValue[field] === undefined) {
321
+ props.modelValue[field] = formItem.defaultItem.value
322
+ }
317
323
  // 这里格式化一下数据
318
324
  if (formItem.format) {
319
325
  if (typeof formItem.format === 'string') {
@@ -342,7 +348,7 @@ const btnList = computed(() => {
342
348
  field: '_reset_btn',
343
349
  desc: {
344
350
  label: props.cancelBtnText || '取消',
345
- size: props.size,
351
+ size: size.value,
346
352
  disabled: innerIsLoading.value,
347
353
  on: { click: () => emits('cancel') }
348
354
  }
@@ -355,7 +361,7 @@ const btnList = computed(() => {
355
361
  desc: {
356
362
  label: props.resetBtnText || '重置',
357
363
  confirm: `确定要${props.resetBtnText || '重置'}?`,
358
- size: props.size,
364
+ size: size.value,
359
365
  disabled: innerIsLoading.value,
360
366
  on: { click: reset }
361
367
  }
@@ -367,7 +373,7 @@ const btnList = computed(() => {
367
373
  field: '_reset_btn',
368
374
  desc: {
369
375
  label: props.submitBtnText || '提交',
370
- size: props.size,
376
+ size: size.value,
371
377
  type: 'primary',
372
378
  loading: props.isLoading || innerIsLoading.value,
373
379
  on: { click: handleSubmitForm }
@@ -564,7 +570,6 @@ const handleSubmitForm = async () => {
564
570
  nextTick(() => {
565
571
  if (tempAttr.success && typeof tempAttr.success === 'function') {
566
572
  tempAttr.success({ response, formData: props.modelValue, callback: () => (innerIsLoading.value = false) } as IFormBack)
567
- reset()
568
573
  }
569
574
  })
570
575
  } catch (error) {
@@ -606,7 +611,8 @@ const handleSubmitForm = async () => {
606
611
  emits('request', postData)
607
612
  }
608
613
  } catch (error) {
609
- // console.log('error: ', error)
614
+ // eslint-disable-next-line no-console
615
+ console.log('error: ', error)
610
616
  }
611
617
  }
612
618
 
@@ -737,8 +743,14 @@ defineExpose({ submit: handleSubmitForm, getData: getFormData, validate: validat
737
743
  background-color: #f9f2f4;
738
744
  border-radius: 4px;
739
745
  }
740
- .el-form-item--default {
741
- margin-bottom: 18px !important;
746
+ .el-plus-form-column-panel {
747
+ & > .el-form-item--default {
748
+ margin-bottom: 18px !important;
749
+ & > .el-form-item__label {
750
+ line-height: 40px;
751
+ margin-bottom: 0;
752
+ }
753
+ }
742
754
  }
743
755
  }
744
756
  </style>
@@ -0,0 +1,59 @@
1
+ <template>
2
+ <el-cascader v-if="areaList && areaList.length" class="ElPlusFormArea-panel" v-bind="attrs" v-on="onEvents" v-model="currentValue" :options="areaList" />
3
+ </template>
4
+ <script lang="ts">
5
+ export default {
6
+ name: 'ElPlusFormArea',
7
+ inheritAttrs: false,
8
+ typeName: 'area',
9
+ customOptions: {}
10
+ }
11
+ </script>
12
+ <script lang="ts" setup>
13
+ import { onMounted, ref, useAttrs, onBeforeMount, inject } from 'vue'
14
+ import { getAttrs, getEvents } from '../mixins'
15
+
16
+ const globalData = inject('globalData') as any
17
+
18
+ const props = defineProps<{
19
+ modelValue?: Array<any> | null
20
+ field: string
21
+ desc: { [key: string]: any }
22
+ formData: { [key: string]: any }
23
+ }>()
24
+
25
+ const emits = defineEmits(['update:modelValue'])
26
+ const areaList = ref([] as any)
27
+ const attrs = ref({} as any)
28
+ const onEvents = ref(getEvents(props))
29
+ const currentValue = ref(props.modelValue)
30
+
31
+ emits('update:modelValue', currentValue)
32
+
33
+ /**
34
+ * 远程加载数据
35
+ * @param node
36
+ * @param resolve
37
+ */
38
+ // async function lazyLoad(node: any, resolve: any) {
39
+ // resolve(
40
+ // ((await queryAreaByPId(node && node.value ? node.value : '0')) as Array<any>).map((item) => {
41
+ // item.leaf = true
42
+ // return item
43
+ // })
44
+ // )
45
+ // }
46
+
47
+ onBeforeMount(async () => {
48
+ attrs.value = await getAttrs(props, { props: { value: 'id', label: 'name', children: 'childs', checkStrictly: !!props.desc.checkStrictly }, clearable: true, filterable: true, ...useAttrs() })
49
+ })
50
+
51
+ onMounted(async () => {
52
+ areaList.value = (globalData.areaList || []) as any[]
53
+ })
54
+ </script>
55
+ <style lang="scss" scoped>
56
+ .ElPlusFormArea-panel {
57
+ display: flex;
58
+ }
59
+ </style>
@@ -26,8 +26,8 @@ export default {
26
26
  }
27
27
  </script>
28
28
  <script lang="ts" setup>
29
- import { ref, computed, useAttrs, watch } from 'vue'
30
29
  import { cloneDeep } from 'lodash'
30
+ import { ref, computed, useAttrs, watch } from 'vue'
31
31
 
32
32
  const props = defineProps<{
33
33
  field?: string
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <el-cascader class="ElPlusFormCascader-panel" v-bind="attrs" v-on="onEvents" :options="props.desc.options" v-model="currentValue" />
2
+ <el-cascader class="ElPlusFormCascader-panel" v-bind="attrs" v-on="onEvents" :options="options" v-model="currentValue" />
3
3
  </template>
4
4
  <script lang="ts">
5
5
  export default {
@@ -10,8 +10,11 @@ export default {
10
10
  }
11
11
  </script>
12
12
  <script lang="ts" setup>
13
- import { ref, useAttrs, onBeforeMount } from 'vue'
13
+ import { ref, useAttrs, onBeforeMount, inject, reactive, watch } from 'vue'
14
14
  import { getAttrs, getEvents } from '../mixins'
15
+ import { isEqual } from 'lodash'
16
+
17
+ const globalData = inject('globalData') as any
15
18
 
16
19
  const props = defineProps<{
17
20
  modelValue?: Array<string> | string | null
@@ -26,10 +29,30 @@ emits('update:modelValue', currentValue)
26
29
 
27
30
  const attrs = ref({} as any)
28
31
  const onEvents = ref(getEvents(props))
32
+ const options = reactive([] as any[])
29
33
 
30
34
  onBeforeMount(async () => {
31
35
  attrs.value = await getAttrs(props, { clearable: true, props: { value: 'value', label: 'label', children: 'children', checkStrictly: !!props.desc.checkStrictly }, ...useAttrs() })
32
36
  })
37
+
38
+ //监听options数据
39
+ watch(
40
+ () => props.desc.options,
41
+ async (data) => {
42
+ if (typeof data === 'string') {
43
+ options.splice(0, options.length, ...(globalData[data] || []))
44
+ } else if (typeof data === 'function') {
45
+ options.splice(0, options.length, ...(await data(props.formData)))
46
+ } else if (Array.isArray(data)) {
47
+ if (data && options && !isEqual(data, options)) {
48
+ options.splice(0, options.length, ...data)
49
+ }
50
+ } else {
51
+ options.splice(0, options.length)
52
+ }
53
+ },
54
+ { immediate: true }
55
+ )
33
56
  </script>
34
57
  <style lang="scss" scoped>
35
58
  .ElPlusFormCascader-panel {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <el-date-picker class="ElPlusFormDate-panel" v-bind="attrs" v-on="onEvents" v-model="currentValue" />
2
+ <el-date-picker v-if="isInit" class="ElPlusFormDate-panel" v-bind="attrs" v-on="onEvents" v-model="currentValue" />
3
3
  </template>
4
4
  <script lang="ts">
5
5
  export default {
@@ -21,6 +21,7 @@ const props = defineProps<{
21
21
  }>()
22
22
 
23
23
  const emits = defineEmits(['update:modelValue'])
24
+ const isInit = ref(false)
24
25
  const attrs = ref({} as any)
25
26
  const onEvents = ref(getEvents(props))
26
27
  const currentValue = ref(props.modelValue)
@@ -28,6 +29,7 @@ emits('update:modelValue', currentValue)
28
29
 
29
30
  onBeforeMount(async () => {
30
31
  attrs.value = await getAttrs(props, { valueFormat: 'YYYY-MM-DD HH:mm:ss', editable: false, ...useAttrs() })
32
+ isInit.value = true
31
33
  })
32
34
  </script>
33
35
  <style lang="scss" scoped>
@@ -3,7 +3,7 @@
3
3
  <template v-if="props.modelValue && props.modelValue.length > 0">
4
4
  <FileIcons :files="props.modelValue" showName preview />
5
5
  </template>
6
- <span v-else class="no-img-tip">暂无</span>
6
+ <span v-else class="no-img-tip">暂无内容</span>
7
7
  </div>
8
8
  </template>
9
9
  <script lang="ts">
@@ -14,9 +14,11 @@ export default {
14
14
  }
15
15
  </script>
16
16
  <script lang="ts" setup>
17
- import { ref, watch, useAttrs, useSlots, onBeforeMount } from 'vue'
17
+ import { ref, watch, useAttrs, useSlots, onBeforeMount, inject } from 'vue'
18
18
  import { getAttrs, getEvents } from '../mixins'
19
19
 
20
+ const defaultConf = inject('defaultConf') as ICRUDConfig
21
+
20
22
  const props = defineProps<{
21
23
  modelValue?: string | null
22
24
  field: string
@@ -32,7 +34,7 @@ const currentValue = ref()
32
34
  emits('update:modelValue', currentValue)
33
35
 
34
36
  onBeforeMount(async () => {
35
- attrs.value = await getAttrs(props, { autocomplete: 'new-password', maxlength: 20, clearable: true, ...useAttrs() })
37
+ attrs.value = await getAttrs(props, { autocomplete: 'new-password', maxlength: defaultConf.form?.leng.input, clearable: true, ...useAttrs() })
36
38
  })
37
39
 
38
40
  watch(
@@ -4,7 +4,7 @@
4
4
  <el-option v-for="option in options" :key="option.value" v-bind="option" />
5
5
  </el-select>
6
6
  <!-- 弹框 -->
7
- <el-dialog :width="desc.dialogWidth || '1000px'" :title="desc.placeholder || '选择' + desc.label" draggable :closeOnClickModal="false" showCancel v-model="isShowDialog" append-to-body destroy-on-close>
7
+ <el-dialog :width="desc.dialogWidth || '1000px'" :title="desc.title || desc.placeholder || '请选择' + desc.label" draggable :closeOnClickModal="false" showCancel v-model="isShowDialog" append-to-body destroy-on-close>
8
8
  <div style="width: 100%" class="form-link-dialog">
9
9
  <div class="panel-left">
10
10
  <!-- 左侧列表 -->
@@ -42,10 +42,11 @@ import { getEvents } from '../mixins'
42
42
  interface ILinkItem {
43
43
  label: string
44
44
  value: string
45
+ dataItem: { [key: string]: any }
45
46
  }
46
47
 
47
48
  const props = defineProps<{
48
- modelValue?: any
49
+ modelValue?: []
49
50
  field: string
50
51
  loading?: boolean
51
52
  desc: { [key: string]: any }
@@ -56,7 +57,7 @@ const onEvents = ref(getEvents(props))
56
57
 
57
58
  const emits = defineEmits(['update:modelValue', 'change', 'input', 'validateThis'])
58
59
 
59
- const currentValue = ref(props.modelValue)
60
+ const currentValue = ref(props.modelValue as any[])
60
61
  emits('update:modelValue', currentValue)
61
62
 
62
63
  // 顶部的select
@@ -68,7 +69,8 @@ const topAttrs = reactive({
68
69
  size: props.desc.size,
69
70
  collapseTags: true,
70
71
  collapseTagsTooltip: true,
71
- clearable: true
72
+ clearable: true,
73
+ placeholder: props.desc.placeholder || '请选择' + props.desc.label
72
74
  })
73
75
 
74
76
  // 显示弹框
@@ -110,7 +112,7 @@ function handelTableSelection(selection: any[]) {
110
112
  // 这里全是新增
111
113
  selectData.splice(0, selectData.length)
112
114
  selection.map((row) => {
113
- selectData.push({ label: row[props.desc.lkey || 'name'], value: row[vkey.value] })
115
+ selectData.push({ label: row[props.desc.lkey || 'name'], value: row[vkey.value], dataItem: row })
114
116
  })
115
117
  }
116
118
 
@@ -120,7 +122,7 @@ function handelTableSelection(selection: any[]) {
120
122
  */
121
123
  function handelSignleSelect({ row }: IBtnBack) {
122
124
  selectData.splice(0, selectData.length)
123
- selectData.push({ label: row[props.desc.lkey || 'name'], value: row[vkey.value] })
125
+ selectData.push({ label: row[props.desc.lkey || 'name'], value: row[vkey.value], dataItem: row })
124
126
  // 直接关闭
125
127
  submit()
126
128
  }
@@ -151,15 +153,22 @@ function cancel() {
151
153
  function submit() {
152
154
  options.splice(0, options.length, ...selectData)
153
155
  const tempIds = [] as string[]
156
+ const tempNames = [] as string[]
154
157
  values.splice(0, values.length)
155
158
 
156
159
  // 遍历数据
157
160
  selectData.map((item) => {
158
161
  values.push(item.value)
159
162
  tempIds.push(item.value)
163
+ tempNames.push(item.label)
160
164
  })
161
165
  // 设置值
162
- currentValue.value = selectData.length > 0 ? tempIds : null
166
+ currentValue.value = selectData.length > 0 ? [tempIds, tempNames] : []
167
+
168
+ // 触发外部change事件
169
+ if (onEvents.value.change) {
170
+ onEvents.value.change(props.formData, null, currentValue.value)
171
+ }
163
172
 
164
173
  isShowDialog.value = false
165
174
  emits('validateThis')
@@ -188,7 +197,7 @@ watch(
188
197
  }
189
198
  tableConfig.value = tempConfig
190
199
  },
191
- { deep: true }
200
+ { deep: true, immediate: true }
192
201
  )
193
202
 
194
203
  onMounted(async () => {})
@@ -215,7 +224,8 @@ onMounted(async () => {})
215
224
  box-sizing: border-box;
216
225
 
217
226
  .panel-left {
218
- flex: 1;
227
+ // flex: 1;
228
+ min-width: 60%;
219
229
  height: 500px;
220
230
  display: flex;
221
231
  flex-direction: column;
@@ -229,7 +239,7 @@ onMounted(async () => {})
229
239
  }
230
240
 
231
241
  .panel-right {
232
- // min-width: 40%;
242
+ min-width: 40%;
233
243
  max-width: 40%;
234
244
  margin-left: 20px;
235
245
  border-left: 1px var(--el-border-color) var(--el-border-style);
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <el-input-number class="ElPlusFormNumber-panel" v-bind="attrs" v-on="onEvents" v-model="currentValue" onkeypress="return( /[\d\.]/.test(String.fromCharCode(event.keyCode)))" />
2
+ <el-input-number class="ElPlusFormNumber-panel" v-bind="attrs" v-on="onEvents" v-model="currentValue" @focus="handelFocus" @blur="handelBlur" onkeypress="return( /[\d\.]/.test(String.fromCharCode(event.keyCode)))" />
3
3
  </template>
4
4
  <script lang="ts">
5
5
  export default {
@@ -10,10 +10,12 @@ export default {
10
10
  }
11
11
  </script>
12
12
  <script lang="ts" setup>
13
- import { ref, computed, useAttrs, onBeforeMount, nextTick } from 'vue'
13
+ import { ref, computed, useAttrs, onBeforeMount, nextTick, inject } from 'vue'
14
14
  import { getAttrs, getEvents } from '../mixins'
15
15
  import { ElMessage } from 'element-plus'
16
16
 
17
+ const defaultConf = inject('defaultConf') as ICRUDConfig
18
+
17
19
  const props = defineProps<{
18
20
  modelValue?: number | null
19
21
  field: string
@@ -22,23 +24,52 @@ const props = defineProps<{
22
24
  formData: { [key: string]: any }
23
25
  rowIndex?: number
24
26
  }>()
25
- const emits = defineEmits(['update:modelValue'])
27
+
28
+ const emits = defineEmits(['update:modelValue', 'validateThis'])
26
29
  const currentValue = ref(props.modelValue)
27
30
  emits('update:modelValue', currentValue)
28
31
  const attrs = ref({} as any)
29
32
  const onEvents = ref(getEvents(props))
30
33
 
34
+ const isDoChange = ref(false)
35
+
31
36
  onBeforeMount(async () => {
32
- attrs.value = await getAttrs(props, { min: 0, max: 999999999, precision: 0, controlsPosition: 'right', ...useAttrs() })
37
+ attrs.value = await getAttrs(props, { ...defaultConf.form?.leng.nbinput, ...useAttrs() })
33
38
  delete attrs.value.min
34
39
  delete attrs.value.max
35
40
  })
36
41
 
42
+ /**
43
+ * 获取焦点
44
+ */
45
+ function handelFocus() {
46
+ isDoChange.value = false
47
+ }
48
+
49
+ /**
50
+ * 处理失去焦点
51
+ * @param event
52
+ */
53
+ function handelBlur() {
54
+ if (!isDoChange.value) {
55
+ if (!currentValue.value) {
56
+ nextTick(() => {
57
+ currentValue.value = numBindAttr.value.min ?? 0
58
+ })
59
+ } else {
60
+ handelValChange(currentValue.value, 0)
61
+ }
62
+ }
63
+ nextTick(() => {
64
+ emits('validateThis')
65
+ })
66
+ }
67
+
37
68
  /**
38
69
  * 绑定属性
39
70
  */
40
71
  const numBindAttr = computed(() => {
41
- let numAttrs = props.desc.attrs || { min: 0, max: 999999999, precision: 0, controlsPosition: 'right' }
72
+ let numAttrs = props.desc.attrs || defaultConf.form?.leng.nbinput
42
73
  if (typeof props.desc.attrs === 'function') {
43
74
  numAttrs = props.desc.attrs(props.formData)
44
75
  }
@@ -61,7 +92,6 @@ if (currentValue.value !== undefined && currentValue.value !== null) {
61
92
  }
62
93
 
63
94
  const change = onEvents.value.change
64
-
65
95
  if (change) {
66
96
  onEvents.value.change = (val: any, oldVal: any) => {
67
97
  handelValChange(val, oldVal)
@@ -75,6 +105,7 @@ if (change) {
75
105
  * @param val
76
106
  */
77
107
  function handelValChange(val: any, oldVal: any) {
108
+ isDoChange.value = true
78
109
  if (val !== oldVal) {
79
110
  if (val < numBindAttr.value.min) {
80
111
  ElMessage.warning(`${props.desc?.label || ''}最少不能低于${numBindAttr.value.min}`)
@@ -0,0 +1,92 @@
1
+ <template>
2
+ <el-input :class="desc.class" :style="desc.style" type="textarea" v-bind="attrs" v-model="currentValue" v-on="onEvents"> </el-input>
3
+ <div class="el-plus-form-quick-input">
4
+ <el-tag v-for="(option, index) in options" :key="index" type="info" @click="changeTip(option.label)">{{ option.label }}</el-tag>
5
+ </div>
6
+ </template>
7
+ <script lang="ts">
8
+ export default {
9
+ name: 'ElPlusFormQuickinput',
10
+ inheritAttrs: false,
11
+ typeName: 'quickinput',
12
+ customOptions: {}
13
+ }
14
+ </script>
15
+ <script lang="ts" setup>
16
+ import { ref, useAttrs, watch, onBeforeMount, inject, reactive } from 'vue'
17
+ import { getAttrs, getEvents } from '../mixins'
18
+ import { isEqual } from 'lodash'
19
+
20
+ const globalData = inject('globalData') as any
21
+ const defaultConf = inject('defaultConf') as ICRUDConfig
22
+
23
+ const props = defineProps<{
24
+ modelValue?: string | null
25
+ field: string
26
+ loading?: boolean
27
+ desc: { [key: string]: any }
28
+ formData: { [key: string]: any }
29
+ }>()
30
+
31
+ const emits = defineEmits(['update:modelValue', 'validateThis'])
32
+ const attrs = ref({} as any)
33
+ const onEvents = ref(getEvents(props))
34
+ const options = reactive([] as any[])
35
+ const currentValue = ref(props.modelValue)
36
+ emits('update:modelValue', currentValue)
37
+
38
+ onBeforeMount(async () => {
39
+ attrs.value = await getAttrs(props, { maxlength: defaultConf.form?.leng.textare, showWordLimit: true, rows: 3, ...useAttrs() })
40
+ })
41
+
42
+ /**
43
+ *
44
+ * @param text
45
+ * 选中
46
+ */
47
+ function changeTip(text: any) {
48
+ currentValue.value = text
49
+ emits('validateThis')
50
+ }
51
+
52
+ watch(
53
+ () => props.modelValue,
54
+ (data: string | null | undefined) => {
55
+ // 这里要截取一下字符串长度
56
+ if (data && data.length > attrs.value.maxlength) {
57
+ data = data.substring(0, attrs.value.maxlength)
58
+ }
59
+ currentValue.value = data
60
+ },
61
+ { immediate: true }
62
+ )
63
+ watch(
64
+ () => props.desc.options,
65
+ async (data) => {
66
+ if (typeof data === 'string') {
67
+ // // 从全局数据中获取options
68
+ options.splice(0, options.length, ...(globalData[data] || []))
69
+ } else if (typeof data === 'function') {
70
+ options.splice(0, options.length, ...(await data(props.formData)))
71
+ } else if (Array.isArray(data)) {
72
+ if (data && options && !isEqual(data, options)) {
73
+ options.splice(0, options.length, ...data)
74
+ }
75
+ } else {
76
+ options.splice(0, options.length)
77
+ }
78
+ },
79
+ { immediate: true }
80
+ )
81
+ </script>
82
+ <style lang="scss">
83
+ .el-plus-form-quick-input {
84
+ width: 100%;
85
+ display: flex;
86
+ align-items: center;
87
+ margin-top: 10px;
88
+ .el-tag {
89
+ margin-right: 10px;
90
+ }
91
+ }
92
+ </style>
@@ -22,6 +22,7 @@ import { ElMessage } from 'element-plus'
22
22
  import { getAttrs } from '../mixins'
23
23
  import { isEqual } from 'lodash'
24
24
 
25
+ const defaultConf = inject('defaultConf') as ICRUDConfig
25
26
  const globalData = inject('globalData') as any
26
27
 
27
28
  const props = defineProps<{
@@ -58,6 +59,17 @@ if (props.desc.remote) {
58
59
  if (oldQuery.value !== query) {
59
60
  oldQuery.value = query
60
61
  options.splice(0, options.length, ...(await props.desc.remote(query)))
62
+ if (query === '') {
63
+ // 判断是否有默认选项
64
+ if (props.desc.defaultItem) {
65
+ // 这里需要判断下默认值是否已经出现在了options中,如果存在,则需要删除
66
+ const index = options.findIndex((item) => item.value === props.desc.defaultItem.value)
67
+ if (index >= 0) {
68
+ options.splice(index, 1)
69
+ }
70
+ options.unshift(props.desc.defaultItem)
71
+ }
72
+ }
61
73
  }
62
74
  }
63
75
  }
@@ -102,7 +114,7 @@ watch(
102
114
  async (data) => {
103
115
  if (typeof data === 'string') {
104
116
  // 从全局数据中获取options
105
- options.splice(0, options.length, ...globalData[data])
117
+ options.splice(0, options.length, ...(globalData[data] || []))
106
118
  } else if (typeof data === 'function') {
107
119
  options.splice(0, options.length, ...(await data(props.formData)))
108
120
  } else if (Array.isArray(data)) {
@@ -120,9 +132,9 @@ watch(
120
132
  () => currentValue.value,
121
133
  (val: any) => {
122
134
  if (attrs.value.allowCreate) {
123
- if (val && Array.isArray(val) && (val as Array<any>).some((item) => typeof item === 'string' && item.length > 20)) {
124
- ElMessage.warning('最大长度为: ' + 20)
125
- currentValue.value = (val as Array<string>).filter((item) => typeof item !== 'string' || item.length <= 20)
135
+ if (val && Array.isArray(val) && (val as Array<any>).some((item) => typeof item === 'string' && item.length > (defaultConf.form?.leng.input || 20))) {
136
+ ElMessage.warning('最大长度为: ' + (defaultConf.form?.leng.input || 20))
137
+ currentValue.value = (val as Array<string>).filter((item) => typeof item !== 'string' || item.length <= (defaultConf.form?.leng.input || 20))
126
138
  }
127
139
  }
128
140
  }