el-plus-crud 0.1.13 → 0.1.14

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 (50) hide show
  1. package/.eslintignore +18 -18
  2. package/.eslintrc.js +78 -78
  3. package/.lintstagedrc +3 -3
  4. package/.prettierrc.js +39 -39
  5. package/CHANGELOG.md +261 -259
  6. package/LICENSE +21 -21
  7. package/README.md +19 -19
  8. package/build.js +31 -31
  9. package/dist/el-plus-crud.mjs +1952 -1952
  10. package/example/App.vue +252 -252
  11. package/example/main.js +18 -18
  12. package/example/style.css +4 -4
  13. package/index.html +13 -13
  14. package/lib/components/el-plus-form/ElPlusForm.vue +4 -7
  15. package/lib/components/el-plus-form/ElPlusFormDialog.vue +93 -93
  16. package/lib/components/el-plus-form/ElPlusFormGroup.vue +201 -201
  17. package/lib/components/el-plus-form/components/ElPlusFormCascader.vue +65 -65
  18. package/lib/components/el-plus-form/components/ElPlusFormCascaderPanel.vue +72 -72
  19. package/lib/components/el-plus-form/components/ElPlusFormCheckbox.vue +81 -81
  20. package/lib/components/el-plus-form/components/ElPlusFormImage.vue +115 -115
  21. package/lib/components/el-plus-form/components/ElPlusFormLink.vue +285 -285
  22. package/lib/components/el-plus-form/components/ElPlusFormQuickInput.vue +98 -98
  23. package/lib/components/el-plus-form/components/ElPlusFormRadio.vue +69 -69
  24. package/lib/components/el-plus-form/components/ElPlusFormSelect.vue +185 -185
  25. package/lib/components/el-plus-form/components/ElPlusFormStatus.vue +102 -102
  26. package/lib/components/el-plus-form/components/ElPlusFormText.vue +113 -113
  27. package/lib/components/el-plus-form/components/ElPlusFormTree.vue +79 -79
  28. package/lib/components/el-plus-form/components/ElPlusFormTreeSelect.vue +62 -62
  29. package/lib/components/el-plus-form/components/components/file-icons/data/index.ts +27 -27
  30. package/lib/components/el-plus-form/components/components/file-icons/images/doc.svg +12 -12
  31. package/lib/components/el-plus-form/components/components/file-icons/images/file.svg +18 -18
  32. package/lib/components/el-plus-form/components/components/file-icons/images/jpg.svg +13 -13
  33. package/lib/components/el-plus-form/components/components/file-icons/images/pdf.svg +12 -12
  34. package/lib/components/el-plus-form/components/components/file-icons/images/png.svg +12 -12
  35. package/lib/components/el-plus-form/components/components/file-icons/images/ppt.svg +12 -12
  36. package/lib/components/el-plus-form/components/components/file-icons/images/xls.svg +12 -12
  37. package/lib/components/el-plus-form/components/index.ts +17 -17
  38. package/lib/components/el-plus-form/data/file.ts +74 -74
  39. package/lib/components/el-plus-form/util/validate.ts +346 -346
  40. package/lib/components/el-plus-table/ElPlusTable.vue +972 -972
  41. package/lib/components/el-plus-table/components/columnItem.vue +220 -220
  42. package/lib/components/el-plus-table/components/header.vue +345 -345
  43. package/lib/components/el-plus-table/components/statisticInfo.vue +47 -47
  44. package/lib/index.d.ts +4 -4
  45. package/lib/util/index.ts +390 -390
  46. package/package.json +70 -70
  47. package/tsconfig.json +78 -78
  48. package/types/global.d.ts +13 -13
  49. package/types/index.d.ts +561 -561
  50. package/vite.config.ts +78 -78
package/example/App.vue CHANGED
@@ -1,252 +1,252 @@
1
- <template>
2
- <el-config-provider :locale="zhCn">
3
- <div class="layout-padding">
4
- <ElPlusTable ref="listTableRef" :tableConfig="tableConfig" colMinWidth="100px" :isIndex="false" headerAlign="center"></ElPlusTable>
5
-
6
- <ElPlusFormGroup v-model="formData" :formGroup="formGroupConfig">
7
- <template #default0>default0插槽</template>
8
- <template #default1>default1插槽</template>
9
- <template #default2>default2插槽</template>
10
- </ElPlusFormGroup>
11
- </div>
12
- </el-config-provider>
13
- </template>
14
-
15
- <script setup lang="ts" name="systemUser">
16
- import { reactive, ref, onMounted } from 'vue'
17
- import zhCn from 'element-plus/es/locale/lang/zh-cn'
18
- import { ElMessage } from 'element-plus'
19
- import { IFormBack, IFormDesc, IFormGroupConfig, ITableConfig } from 'types'
20
-
21
- let formData = reactive({
22
- name: ''
23
- } as any)
24
- const formGroupConfig = ref({
25
- column: 2,
26
- // requestFn: () => {},
27
- beforeRequest: (data: any) => {
28
- return data
29
- },
30
- success: (formBack: IFormBack) => {
31
- ElMessage.success('保存成功~')
32
- // 表单回调
33
- formBack.callBack && formBack.callBack()
34
- },
35
- group: [
36
- {
37
- title: '基本信息',
38
- formDesc: {
39
- name: { type: 'input', label: '名称', require: true, attrs: { maxlength: 30 } },
40
- contactsName: { type: 'input', label: '联系人', require: true, attrs: { maxlength: 20 } },
41
- contactsPhone: { type: 'input', label: '联系电话', rules: 'phone', require: true }
42
- } as IFormDesc
43
- },
44
- {
45
- title: '地址信息',
46
- formDesc: {
47
- // _area: { type: 'area', label: '所在地区', require: true },
48
- address: { type: 'input', label: '详细地址', require: true, attrs: { maxlength: 50 } }
49
- } as IFormDesc
50
- },
51
- // {
52
- // title: '文件上传',
53
- // formDesc: {
54
- // businessLicense: { type: 'upload', label: '营业执照', require: true, colspan: 2 },
55
- // appendix: { type: 'upload', upType: 'file', label: '附件', multiple: true, require: true, colspan: 2 }
56
- // } as IFormDesc
57
- // },
58
- {
59
- title: '备注信息',
60
- formDesc: {
61
- remark: { type: 'textarea', label: '备注', colspan: 2, require: true }
62
- } as IFormDesc
63
- }
64
- ]
65
- } as IFormGroupConfig)
66
-
67
- const tableConfig = ref({
68
- // fetch: queryDistributorPage,
69
- // tbName: 'goodsList',
70
- column: [
71
- { prop: 'distributorName', label: '二级企业名称', width: '120px', fixed: 'left' },
72
- { prop: 'distributorName', label: '经营主体', width: '160px', fixed: 'left' },
73
- {
74
- label: '合同执行',
75
- children: [
76
- {
77
- label: '采购业务',
78
- children: [
79
- {
80
- label: '本月发生',
81
- children: [
82
- { prop: 'goodsName', label: '数量(万吨)' },
83
- { prop: 'goodsName', label: '金额(万元)' }
84
- ]
85
- },
86
- {
87
- label: '本年累计数',
88
- children: [
89
- {
90
- label: '上游供应',
91
- children: [
92
- { prop: 'goodsName', label: '区域' },
93
- { prop: 'goodsName', label: '供应方性质' }
94
- ]
95
- },
96
- {
97
- label: '数量(万吨)',
98
- children: [
99
- { prop: 'goodsName', label: '数值' },
100
- { prop: 'goodsName', label: '去年金额' },
101
- { prop: 'goodsName', label: '同比' }
102
- ]
103
- },
104
- {
105
- label: '金额(万元)',
106
- children: [
107
- { prop: 'goodsName', label: '数值' },
108
- { prop: 'goodsName', label: '去年金额' },
109
- { prop: 'goodsName', label: '同比' }
110
- ]
111
- }
112
- ]
113
- }
114
- ]
115
- },
116
- {
117
- label: '销售业务',
118
- children: [
119
- {
120
- label: '本月发生',
121
- children: [
122
- { prop: 'goodsName', label: '数量(万吨)' },
123
- { prop: 'goodsName', label: '金额(万元)' }
124
- ]
125
- },
126
- {
127
- label: '本年累计数',
128
- children: [
129
- {
130
- label: '上游供应',
131
- children: [
132
- { prop: 'goodsName', label: '区域' },
133
- { prop: 'goodsName', label: '供应方性质' }
134
- ]
135
- },
136
- {
137
- label: '数量(万吨)',
138
- children: [
139
- { prop: 'goodsName', label: '数值' },
140
- { prop: 'goodsName', label: '去年金额' },
141
- { prop: 'goodsName', label: '同比' }
142
- ]
143
- },
144
- {
145
- label: '金额(万元)',
146
- children: [
147
- { prop: 'goodsName', label: '数值' },
148
- { prop: 'goodsName', label: '去年金额' },
149
- { prop: 'goodsName', label: '同比' }
150
- ]
151
- }
152
- ]
153
- }
154
- ]
155
- }
156
- ]
157
- },
158
- {
159
- label: '财务数据',
160
- children: [
161
- {
162
- label: '营业收入',
163
- children: [
164
- {
165
- label: '本月发生',
166
- children: [
167
- { prop: 'goodsName', label: '数量(万吨)' },
168
- { prop: 'goodsName', label: '金额(万元)' }
169
- ]
170
- },
171
- {
172
- label: '本年累计数',
173
- children: [
174
- { prop: 'goodsName', label: '数量(万吨)' },
175
- { prop: 'goodsName', label: '金额(万元)' },
176
- { prop: 'goodsName', label: '去年金额' },
177
- { prop: 'goodsName', label: '同比' }
178
- ]
179
- }
180
- ]
181
- },
182
- {
183
- label: '营业成本',
184
- children: [
185
- {
186
- label: '本月发生',
187
- children: [
188
- { prop: 'goodsName', label: '数量(万吨)' },
189
- { prop: 'goodsName', label: '金额(万元)' }
190
- ]
191
- },
192
- {
193
- label: '本年累计数',
194
- children: [
195
- { prop: 'goodsName', label: '数量(万吨)' },
196
- { prop: 'goodsName', label: '金额(万元)' },
197
- { prop: 'goodsName', label: '去年金额' },
198
- { prop: 'goodsName', label: '同比' }
199
- ]
200
- }
201
- ]
202
- },
203
- {
204
- label: '业务毛利率',
205
- children: [
206
- { prop: 'goodsName', label: '数值' },
207
- { prop: 'goodsName', label: '去年数值' },
208
- { prop: 'goodsName', label: '同比' }
209
- ]
210
- },
211
- {
212
- label: '营业利润',
213
- children: [
214
- { prop: 'goodsName', label: '金额(万元)' },
215
- { prop: 'goodsName', label: '去年金额' },
216
- { prop: 'goodsName', label: '同比' }
217
- ]
218
- }
219
- ]
220
- },
221
- {
222
- label: '操作',
223
- fixed: 'right',
224
- type: 'btns',
225
- btns: []
226
- }
227
- ],
228
- queryMap: {},
229
- toolbar: {
230
- // 功能按钮列表
231
- btns: [{ label: '新增商品', type: 'add', on: { click: () => {} } }],
232
- formConfig: {
233
- beforeRequest: (data: any) => {
234
- if (data.goodsKinds) {
235
- data.goodsKinds = data.goodsKinds[data.goodsKinds.length - 1]
236
- }
237
- return data
238
- },
239
- formDesc: {
240
- searchKey: { type: 'input', label: '输入查询', placeholder: '物料编码、商品条码、商品名称、自编码、属性' }
241
- // enabled: { type: 'select', label: '状态', options: 'enabledList' }
242
- }
243
- }
244
- // 导出信息
245
- // export: { url: exportUrl, name: '商品信息导出' }
246
- }
247
- } as ITableConfig)
248
-
249
- onMounted(async () => {
250
- // 初始化部门列表
251
- })
252
- </script>
1
+ <template>
2
+ <el-config-provider :locale="zhCn">
3
+ <div class="layout-padding">
4
+ <ElPlusTable ref="listTableRef" :tableConfig="tableConfig" colMinWidth="100px" :isIndex="false" headerAlign="center"></ElPlusTable>
5
+
6
+ <ElPlusFormGroup v-model="formData" :formGroup="formGroupConfig">
7
+ <template #default0>default0插槽</template>
8
+ <template #default1>default1插槽</template>
9
+ <template #default2>default2插槽</template>
10
+ </ElPlusFormGroup>
11
+ </div>
12
+ </el-config-provider>
13
+ </template>
14
+
15
+ <script setup lang="ts" name="systemUser">
16
+ import { reactive, ref, onMounted } from 'vue'
17
+ import zhCn from 'element-plus/es/locale/lang/zh-cn'
18
+ import { ElMessage } from 'element-plus'
19
+ import { IFormBack, IFormDesc, IFormGroupConfig, ITableConfig } from 'types'
20
+
21
+ let formData = reactive({
22
+ name: ''
23
+ } as any)
24
+ const formGroupConfig = ref({
25
+ column: 2,
26
+ // requestFn: () => {},
27
+ beforeRequest: (data: any) => {
28
+ return data
29
+ },
30
+ success: (formBack: IFormBack) => {
31
+ ElMessage.success('保存成功~')
32
+ // 表单回调
33
+ formBack.callBack && formBack.callBack()
34
+ },
35
+ group: [
36
+ {
37
+ title: '基本信息',
38
+ formDesc: {
39
+ name: { type: 'input', label: '名称', require: true, attrs: { maxlength: 30 } },
40
+ contactsName: { type: 'input', label: '联系人', require: true, attrs: { maxlength: 20 } },
41
+ contactsPhone: { type: 'input', label: '联系电话', rules: 'phone', require: true }
42
+ } as IFormDesc
43
+ },
44
+ {
45
+ title: '地址信息',
46
+ formDesc: {
47
+ // _area: { type: 'area', label: '所在地区', require: true },
48
+ address: { type: 'input', label: '详细地址', require: true, attrs: { maxlength: 50 } }
49
+ } as IFormDesc
50
+ },
51
+ // {
52
+ // title: '文件上传',
53
+ // formDesc: {
54
+ // businessLicense: { type: 'upload', label: '营业执照', require: true, colspan: 2 },
55
+ // appendix: { type: 'upload', upType: 'file', label: '附件', multiple: true, require: true, colspan: 2 }
56
+ // } as IFormDesc
57
+ // },
58
+ {
59
+ title: '备注信息',
60
+ formDesc: {
61
+ remark: { type: 'textarea', label: '备注', colspan: 2, require: true }
62
+ } as IFormDesc
63
+ }
64
+ ]
65
+ } as IFormGroupConfig)
66
+
67
+ const tableConfig = ref({
68
+ // fetch: queryDistributorPage,
69
+ // tbName: 'goodsList',
70
+ column: [
71
+ { prop: 'distributorName', label: '二级企业名称', width: '120px', fixed: 'left' },
72
+ { prop: 'distributorName', label: '经营主体', width: '160px', fixed: 'left' },
73
+ {
74
+ label: '合同执行',
75
+ children: [
76
+ {
77
+ label: '采购业务',
78
+ children: [
79
+ {
80
+ label: '本月发生',
81
+ children: [
82
+ { prop: 'goodsName', label: '数量(万吨)' },
83
+ { prop: 'goodsName', label: '金额(万元)' }
84
+ ]
85
+ },
86
+ {
87
+ label: '本年累计数',
88
+ children: [
89
+ {
90
+ label: '上游供应',
91
+ children: [
92
+ { prop: 'goodsName', label: '区域' },
93
+ { prop: 'goodsName', label: '供应方性质' }
94
+ ]
95
+ },
96
+ {
97
+ label: '数量(万吨)',
98
+ children: [
99
+ { prop: 'goodsName', label: '数值' },
100
+ { prop: 'goodsName', label: '去年金额' },
101
+ { prop: 'goodsName', label: '同比' }
102
+ ]
103
+ },
104
+ {
105
+ label: '金额(万元)',
106
+ children: [
107
+ { prop: 'goodsName', label: '数值' },
108
+ { prop: 'goodsName', label: '去年金额' },
109
+ { prop: 'goodsName', label: '同比' }
110
+ ]
111
+ }
112
+ ]
113
+ }
114
+ ]
115
+ },
116
+ {
117
+ label: '销售业务',
118
+ children: [
119
+ {
120
+ label: '本月发生',
121
+ children: [
122
+ { prop: 'goodsName', label: '数量(万吨)' },
123
+ { prop: 'goodsName', label: '金额(万元)' }
124
+ ]
125
+ },
126
+ {
127
+ label: '本年累计数',
128
+ children: [
129
+ {
130
+ label: '上游供应',
131
+ children: [
132
+ { prop: 'goodsName', label: '区域' },
133
+ { prop: 'goodsName', label: '供应方性质' }
134
+ ]
135
+ },
136
+ {
137
+ label: '数量(万吨)',
138
+ children: [
139
+ { prop: 'goodsName', label: '数值' },
140
+ { prop: 'goodsName', label: '去年金额' },
141
+ { prop: 'goodsName', label: '同比' }
142
+ ]
143
+ },
144
+ {
145
+ label: '金额(万元)',
146
+ children: [
147
+ { prop: 'goodsName', label: '数值' },
148
+ { prop: 'goodsName', label: '去年金额' },
149
+ { prop: 'goodsName', label: '同比' }
150
+ ]
151
+ }
152
+ ]
153
+ }
154
+ ]
155
+ }
156
+ ]
157
+ },
158
+ {
159
+ label: '财务数据',
160
+ children: [
161
+ {
162
+ label: '营业收入',
163
+ children: [
164
+ {
165
+ label: '本月发生',
166
+ children: [
167
+ { prop: 'goodsName', label: '数量(万吨)' },
168
+ { prop: 'goodsName', label: '金额(万元)' }
169
+ ]
170
+ },
171
+ {
172
+ label: '本年累计数',
173
+ children: [
174
+ { prop: 'goodsName', label: '数量(万吨)' },
175
+ { prop: 'goodsName', label: '金额(万元)' },
176
+ { prop: 'goodsName', label: '去年金额' },
177
+ { prop: 'goodsName', label: '同比' }
178
+ ]
179
+ }
180
+ ]
181
+ },
182
+ {
183
+ label: '营业成本',
184
+ children: [
185
+ {
186
+ label: '本月发生',
187
+ children: [
188
+ { prop: 'goodsName', label: '数量(万吨)' },
189
+ { prop: 'goodsName', label: '金额(万元)' }
190
+ ]
191
+ },
192
+ {
193
+ label: '本年累计数',
194
+ children: [
195
+ { prop: 'goodsName', label: '数量(万吨)' },
196
+ { prop: 'goodsName', label: '金额(万元)' },
197
+ { prop: 'goodsName', label: '去年金额' },
198
+ { prop: 'goodsName', label: '同比' }
199
+ ]
200
+ }
201
+ ]
202
+ },
203
+ {
204
+ label: '业务毛利率',
205
+ children: [
206
+ { prop: 'goodsName', label: '数值' },
207
+ { prop: 'goodsName', label: '去年数值' },
208
+ { prop: 'goodsName', label: '同比' }
209
+ ]
210
+ },
211
+ {
212
+ label: '营业利润',
213
+ children: [
214
+ { prop: 'goodsName', label: '金额(万元)' },
215
+ { prop: 'goodsName', label: '去年金额' },
216
+ { prop: 'goodsName', label: '同比' }
217
+ ]
218
+ }
219
+ ]
220
+ },
221
+ {
222
+ label: '操作',
223
+ fixed: 'right',
224
+ type: 'btns',
225
+ btns: []
226
+ }
227
+ ],
228
+ queryMap: {},
229
+ toolbar: {
230
+ // 功能按钮列表
231
+ btns: [{ label: '新增商品', type: 'add', on: { click: () => {} } }],
232
+ formConfig: {
233
+ beforeRequest: (data: any) => {
234
+ if (data.goodsKinds) {
235
+ data.goodsKinds = data.goodsKinds[data.goodsKinds.length - 1]
236
+ }
237
+ return data
238
+ },
239
+ formDesc: {
240
+ searchKey: { type: 'input', label: '输入查询', placeholder: '物料编码、商品条码、商品名称、自编码、属性' }
241
+ // enabled: { type: 'select', label: '状态', options: 'enabledList' }
242
+ }
243
+ }
244
+ // 导出信息
245
+ // export: { url: exportUrl, name: '商品信息导出' }
246
+ }
247
+ } as ITableConfig)
248
+
249
+ onMounted(async () => {
250
+ // 初始化部门列表
251
+ })
252
+ </script>
package/example/main.js CHANGED
@@ -1,18 +1,18 @@
1
- import { createApp } from 'vue'
2
- import './style.css'
3
- import App from './App.vue'
4
-
5
- import ElementPlus from 'element-plus'
6
- import 'element-plus/dist/index.css'
7
-
8
- import ElPlusCurd from '@/index'
9
-
10
- const app = createApp(App)
11
-
12
- // import(/* webpackChunkName: "ElPlusCurd" */ '@/index').then((components) => {
13
- // app.use(components.default)
14
- // })
15
-
16
- app.use(ElPlusCurd)
17
-
18
- app.use(ElementPlus).mount('#app')
1
+ import { createApp } from 'vue'
2
+ import './style.css'
3
+ import App from './App.vue'
4
+
5
+ import ElementPlus from 'element-plus'
6
+ import 'element-plus/dist/index.css'
7
+
8
+ import ElPlusCurd from '@/index'
9
+
10
+ const app = createApp(App)
11
+
12
+ // import(/* webpackChunkName: "ElPlusCurd" */ '@/index').then((components) => {
13
+ // app.use(components.default)
14
+ // })
15
+
16
+ app.use(ElPlusCurd)
17
+
18
+ app.use(ElementPlus).mount('#app')
package/example/style.css CHANGED
@@ -1,5 +1,5 @@
1
- html,body,#app {
2
- height: 100%;
3
- width: 100%;
4
- overflow: hidden;
1
+ html,body,#app {
2
+ height: 100%;
3
+ width: 100%;
4
+ overflow: hidden;
5
5
  }
package/index.html CHANGED
@@ -1,13 +1,13 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>Vite + Vue</title>
8
- </head>
9
- <body>
10
- <div id="app"></div>
11
- <script type="module" src="/example/main.js"></script>
12
- </body>
13
- </html>
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Vite + Vue</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/example/main.js"></script>
12
+ </body>
13
+ </html>
@@ -533,13 +533,10 @@ const handelValToForm = (desc: IFormDescItem, field: string, val: any) => {
533
533
  if (val && val.length === 2) {
534
534
  const startTimeKey = desc.startTimeKey ? desc.startTimeKey : desc.propPrefix ? desc.propPrefix + 'StartTime' : 'startTime'
535
535
  const endTimeKey = desc.endTimeKey ? desc.endTimeKey : desc.propPrefix ? desc.propPrefix + 'EndTime' : 'endTime'
536
- result[startTimeKey] = val[0]
537
- if (typeof val[1] === 'string') {
538
- result[endTimeKey] = new Date(val[1]).getTime()
539
- } else {
540
- result[endTimeKey] = val[1]
541
- }
542
- result[endTimeKey] = result[endTimeKey] + (24 * 60 * 60 - 1) * 1000
536
+ // 获取0点数据
537
+ result[startTimeKey] = new Date(new Date(val[0]).setHours(0, 0, 0, 0))
538
+ // 获取每天结束时间
539
+ result[endTimeKey] = new Date(new Date(val[1]).setHours(0, 0, 0, 0) + 24 * 60 * 60 * 1000 - 1)
543
540
  // 再处理一下时间戳
544
541
  result[startTimeKey] = time(result[startTimeKey], desc.valueFormat)
545
542
  result[endTimeKey] = time(result[endTimeKey], desc.valueFormat)