@jzt-packages/components 1.0.0

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 (145) hide show
  1. package/package.json +68 -0
  2. package/src/JztBackTop/index.vue +255 -0
  3. package/src/JztButtonList/index.vue +88 -0
  4. package/src/JztChart/index.vue +95 -0
  5. package/src/JztCharts/index.vue +317 -0
  6. package/src/JztClassTabs/index.vue +156 -0
  7. package/src/JztDateSelect/dateSelect.vue +186 -0
  8. package/src/JztDateSelect/dateType.vue +54 -0
  9. package/src/JztDateSelect/index.ts +135 -0
  10. package/src/JztDateSelect/interface/index.ts +13 -0
  11. package/src/JztDialog/index.vue +249 -0
  12. package/src/JztEllipsisTooltip/index.vue +61 -0
  13. package/src/JztEmpty/index.vue +45 -0
  14. package/src/JztErrorPage/403.vue +30 -0
  15. package/src/JztErrorPage/404.vue +19 -0
  16. package/src/JztErrorPage/500.vue +18 -0
  17. package/src/JztErrorPage/assets/401.png +0 -0
  18. package/src/JztErrorPage/assets/403.png +0 -0
  19. package/src/JztErrorPage/assets/404.png +0 -0
  20. package/src/JztErrorPage/assets/500.png +0 -0
  21. package/src/JztErrorPage/index.scss +35 -0
  22. package/src/JztErrorPage/index.vue +35 -0
  23. package/src/JztFilePreview/components/pdfViewer.vue +221 -0
  24. package/src/JztFilePreview/hooks/useImageMethod.ts +256 -0
  25. package/src/JztFilePreview/index.scss +171 -0
  26. package/src/JztFilePreview/index.vue +68 -0
  27. package/src/JztFilePreview/interface/index.ts +18 -0
  28. package/src/JztFilePreview/previewFile.vue +371 -0
  29. package/src/JztFormGrid/README.md +520 -0
  30. package/src/JztFormGrid/components/formItem.vue +209 -0
  31. package/src/JztFormGrid/components/formItemValue.vue +384 -0
  32. package/src/JztFormGrid/components/showDetailForm.vue +172 -0
  33. package/src/JztFormGrid/index.scss +60 -0
  34. package/src/JztFormGrid/index.vue +513 -0
  35. package/src/JztFormGrid/interface/index.ts +106 -0
  36. package/src/JztGrid/components/GridItem.vue +68 -0
  37. package/src/JztGrid/index.vue +179 -0
  38. package/src/JztGrid/interface/index.ts +6 -0
  39. package/src/JztImportExcel/assets/delete.png +0 -0
  40. package/src/JztImportExcel/index.scss +46 -0
  41. package/src/JztImportExcel/index.vue +430 -0
  42. package/src/JztImportExcel/interface/index.ts +25 -0
  43. package/src/JztLabelTitle/index.vue +65 -0
  44. package/src/JztLeftRightMode/components/CollapseButton.vue +80 -0
  45. package/src/JztLeftRightMode/components/LeftCard.vue +203 -0
  46. package/src/JztLeftRightMode/components/LeftLayout.vue +173 -0
  47. package/src/JztLeftRightMode/components/RightHeader.vue +186 -0
  48. package/src/JztLeftRightMode/components/RightLayout.vue +235 -0
  49. package/src/JztLeftRightMode/components/RightTableHeader.vue +43 -0
  50. package/src/JztLeftRightMode/hooks/useCollapse.ts +17 -0
  51. package/src/JztLeftRightMode/hooks/useDefaultProps.ts +19 -0
  52. package/src/JztLeftRightMode/hooks/useLeftLayout.ts +201 -0
  53. package/src/JztLeftRightMode/hooks/useMode.ts +20 -0
  54. package/src/JztLeftRightMode/hooks/usePrevNext.ts +60 -0
  55. package/src/JztLeftRightMode/hooks/useRightLayout.ts +215 -0
  56. package/src/JztLeftRightMode/hooks/useSlots.ts +15 -0
  57. package/src/JztLeftRightMode/index.ts +3 -0
  58. package/src/JztLeftRightMode/index.vue +494 -0
  59. package/src/JztLeftRightMode/types/index.ts +457 -0
  60. package/src/JztLoading/fullScreen.ts +45 -0
  61. package/src/JztLoading/index.scss +67 -0
  62. package/src/JztLoading/index.vue +18 -0
  63. package/src/JztLogin/components/LoginFooter.vue +17 -0
  64. package/src/JztLogin/components/LoginForm.vue +99 -0
  65. package/src/JztLogin/hooks/useLogin.ts +186 -0
  66. package/src/JztLogin/index.scss +142 -0
  67. package/src/JztLogin/index.vue +31 -0
  68. package/src/JztLogin/interface/index.ts +47 -0
  69. package/src/JztNumericalRange/index.vue +81 -0
  70. package/src/JztPageCard/comm/datePicker.vue +151 -0
  71. package/src/JztPageCard/comm/details.vue +60 -0
  72. package/src/JztPageCard/comm/export.vue +24 -0
  73. package/src/JztPageCard/comm/tabs.vue +94 -0
  74. package/src/JztPageCard/comm/tooltip.vue +31 -0
  75. package/src/JztPageCard/index.vue +287 -0
  76. package/src/JztPagination/index.vue +70 -0
  77. package/src/JztProductInfo/components/imagePreview.vue +275 -0
  78. package/src/JztProductInfo/components/qxUnique.vue +101 -0
  79. package/src/JztProductInfo/components/records.vue +265 -0
  80. package/src/JztProductInfo/hooks/useParams.ts +143 -0
  81. package/src/JztProductInfo/hooks/useQxUnique.tsx +466 -0
  82. package/src/JztProductInfo/images/defaultProduct.png +0 -0
  83. package/src/JztProductInfo/index.ts +116 -0
  84. package/src/JztProductInfo/index.vue +108 -0
  85. package/src/JztProductInfo/interface/index.ts +15 -0
  86. package/src/JztQueryDetailTable/index.scss +100 -0
  87. package/src/JztQueryDetailTable/index.vue +400 -0
  88. package/src/JztQueryDetailTable/interface/index.ts +10 -0
  89. package/src/JztQueryTable/QueryTable /345/212/237/350/203/275.md" +1580 -0
  90. package/src/JztQueryTable/README.md +567 -0
  91. package/src/JztQueryTable/components/ColSetting.vue +67 -0
  92. package/src/JztQueryTable/components/ColumnsSetting.vue +404 -0
  93. package/src/JztQueryTable/components/ColumnsSetting1.vue +220 -0
  94. package/src/JztQueryTable/components/DeployToAccountLevelSetting.vue +351 -0
  95. package/src/JztQueryTable/components/Pagination.vue +54 -0
  96. package/src/JztQueryTable/components/TableColumn.vue +109 -0
  97. package/src/JztQueryTable/const.ts +1 -0
  98. package/src/JztQueryTable/hooks/useQueryTable.ts +194 -0
  99. package/src/JztQueryTable/hooks/useSelection.ts +47 -0
  100. package/src/JztQueryTable/hooks/useTableSetting.ts +197 -0
  101. package/src/JztQueryTable/hooks/useTemplate.ts +127 -0
  102. package/src/JztQueryTable/index.scss +91 -0
  103. package/src/JztQueryTable/index.vue +1445 -0
  104. package/src/JztQueryTable/interface/index.ts +185 -0
  105. package/src/JztRegionSelect/index.vue +134 -0
  106. package/src/JztSearchForm/components/SearchFormItem.vue +473 -0
  107. package/src/JztSearchForm/index.vue +530 -0
  108. package/src/JztSearchForm/interface/index.ts +100 -0
  109. package/src/JztSelectFilter/index.scss +63 -0
  110. package/src/JztSelectFilter/index.vue +110 -0
  111. package/src/JztSelectTable/index.vue +257 -0
  112. package/src/JztTable/index.scss +72 -0
  113. package/src/JztTable/index.vue +353 -0
  114. package/src/JztTable/interface/index.ts +1 -0
  115. package/src/JztTime/comm/agencySelect.vue +112 -0
  116. package/src/JztTime/comm/collapseRow.vue +132 -0
  117. package/src/JztTime/comm/dateSelect.vue +292 -0
  118. package/src/JztTime/comm/deptSelect.vue +193 -0
  119. package/src/JztTime/comm/typeSelect.vue +97 -0
  120. package/src/JztTime/index.ts +216 -0
  121. package/src/JztTime/index.vue +303 -0
  122. package/src/JztTime/interface/index.ts +23 -0
  123. package/src/JztTreeFilter/index.scss +44 -0
  124. package/src/JztTreeFilter/index.vue +177 -0
  125. package/src/JztUploadFile/interface/index.ts +21 -0
  126. package/src/JztUploadFile/multiple.scss +215 -0
  127. package/src/JztUploadFile/multiple.vue +318 -0
  128. package/src/JztUploadFile/single.scss +226 -0
  129. package/src/JztUploadFile/single.vue +274 -0
  130. package/src/JztUploadImg/Img.vue +294 -0
  131. package/src/JztUploadImg/Imgs.vue +411 -0
  132. package/src/JztUploadImg/index.scss +138 -0
  133. package/src/JztUploadImg/interface/index.ts +22 -0
  134. package/src/SelectIcon/index.scss +39 -0
  135. package/src/SelectIcon/index.vue +106 -0
  136. package/src/SvgIcon/index.vue +22 -0
  137. package/src/hooks/useAuthButtons.ts +58 -0
  138. package/src/hooks/useFormByUserType.ts +90 -0
  139. package/src/hooks/useTableEvents.ts +30 -0
  140. package/src/hooks/useUploadFileHook.ts +262 -0
  141. package/src/index.ts +91 -0
  142. package/src/typings/global.d.ts +101 -0
  143. package/src/utils/index.ts +107 -0
  144. package/src/utils/tree.ts +57 -0
  145. package/tsconfig.json +45 -0
@@ -0,0 +1,351 @@
1
+ <script lang="tsx" setup name="DeployToAccountLevelSetting">
2
+ import { Minus, Plus, WarningFilled } from '@element-plus/icons-vue'
3
+ import { localGetAgencyId } from '@jzt-spd/utils'
4
+ import {
5
+ createGridConfigTemplate,
6
+ getAgencyUserPageList,
7
+ getUserRole,
8
+ updateGridConfigTemplate
9
+ } from '@jzt-spd/utils/commonApi'
10
+ import { computedAsync, reactivePick, useVModel } from '@vueuse/core'
11
+ import { ElMessage, ElMessageBox, type FormInstance } from 'element-plus'
12
+ import { computed, nextTick, reactive, ref } from 'vue'
13
+ import JztDialog from '../../JztDialog/index.vue'
14
+ import JztLabelTitle from '../../JztLabelTitle/index.vue'
15
+ import Pagination from '../components/Pagination.vue'
16
+
17
+ const props = withDefaults(
18
+ defineProps<{
19
+ modelValue?: boolean
20
+ mode: 'add' | 'edit' | 'view'
21
+ gridParams: any
22
+ configValue: any
23
+ pageSize: number
24
+ templateInfo: any
25
+ }>(),
26
+ {
27
+ modelValue: false
28
+ }
29
+ )
30
+
31
+ const emits = defineEmits(['update:modelValue', 'success'])
32
+ const maxCollapseCount = 6
33
+ const tableRef = ref<any>()
34
+ const formRef = ref<FormInstance>()
35
+ const visible = useVModel(props, 'modelValue', emits)
36
+ const loading = ref<boolean>(false)
37
+ const formData = reactive({
38
+ configName: '',
39
+ userRole: '',
40
+ userName: '',
41
+ realName: ''
42
+ })
43
+ const formRules = reactive({
44
+ configName: [{ required: true, message: '请输入配置名称', trigger: 'change' }]
45
+ })
46
+ const data = ref<any[]>([])
47
+ const originUserIds = ref<string[]>([])
48
+ const addUserIds = ref<string[]>([])
49
+ const removeUserIds = ref<string[]>([])
50
+ const pageable = reactive({
51
+ pageIndex: 0,
52
+ pageSize: 10,
53
+ total: 0,
54
+ pagerCount: 5
55
+ })
56
+ const isView = computed(() => props.mode === 'view')
57
+ const dialogTitle = computed(() => {
58
+ switch (props.mode) {
59
+ case 'add':
60
+ return '下发至用户'
61
+ case 'edit':
62
+ return '编辑模版'
63
+ case 'view':
64
+ return '查看生效账号'
65
+ }
66
+ })
67
+ const labelTitle = computed(() => {
68
+ switch (props.mode) {
69
+ case 'add':
70
+ return '请选择列配置生效的账号'
71
+ case 'edit':
72
+ return '请选择列配置生效的账号'
73
+ case 'view':
74
+ return '列配置生效的账号'
75
+ }
76
+ })
77
+ const configValue = computed(() => {
78
+ return props.configValue?.map((item: any) => {
79
+ return {
80
+ columnId: item.prop,
81
+ field: item.prop,
82
+ hidden: !item.isSetShow,
83
+ width: item.width || item.minWidth || 60,
84
+ text: item.label
85
+ }
86
+ })
87
+ })
88
+ const userRoleEnum = computedAsync(async () => {
89
+ const { result } = await getUserRole({ pageSize: 99999, pageIndex: 0, name: '', normalizedName: '' })
90
+ return result
91
+ })
92
+
93
+ const onSelect = (selection: any[], row: any) => {
94
+ const isSelected = selection.includes(row)
95
+ const { userId } = row
96
+ if (isSelected) {
97
+ if (removeUserIds.value.includes(userId)) {
98
+ removeUserIds.value = removeUserIds.value.filter(item => item !== userId)
99
+ } else if (!originUserIds.value.includes(userId) && !addUserIds.value.includes(userId)) {
100
+ addUserIds.value.push(userId)
101
+ addUserIds.value = [...new Set(addUserIds.value)]
102
+ }
103
+ } else {
104
+ if (addUserIds.value.includes(userId)) {
105
+ addUserIds.value = addUserIds.value.filter(item => item !== userId)
106
+ } else if (originUserIds.value.includes(userId) && !removeUserIds.value.includes(userId)) {
107
+ removeUserIds.value.push(userId)
108
+ removeUserIds.value = [...new Set(removeUserIds.value)]
109
+ }
110
+ }
111
+ }
112
+ const onSelectAll = (selection: any[]) => {
113
+ data.value.forEach(row => onSelect(selection, row))
114
+ }
115
+ const onQuery = async () => {
116
+ try {
117
+ loading.value = true
118
+ const { result, totalCount, pagerCount } = await getAgencyUserPageList({
119
+ agencyId: localGetAgencyId(),
120
+ onlyBound: props.mode === 'view',
121
+ ...reactivePick(props.templateInfo, ['templateId']),
122
+ ...reactivePick(pageable, ['pageIndex', 'pageSize']),
123
+ ...reactivePick(formData, ['userRole', 'userName', 'realName'])
124
+ })
125
+ data.value = result.map(item => {
126
+ const { userId, isBound, creationTime, userRoles } = item
127
+ const userRoleList = userRoles.split(',')
128
+ if (isBound) {
129
+ originUserIds.value.push(userId)
130
+ originUserIds.value = [...new Set(originUserIds.value)]
131
+ }
132
+ return {
133
+ ...item,
134
+ userRoles: userRoleList,
135
+ creationTime: creationTime.slice(0, 10),
136
+ isCollapse: userRoleList.length > maxCollapseCount,
137
+ computedUserRoles: (row: any) => (row.isCollapse ? row.userRoles.slice(0, maxCollapseCount) : userRoleList)
138
+ }
139
+ })
140
+ pageable.total = totalCount
141
+ pageable.pagerCount = pagerCount
142
+ if (props.mode === 'edit') {
143
+ await nextTick()
144
+ data.value.forEach((item: any) => {
145
+ const { userId, isBound } = item
146
+ if (addUserIds.value.includes(userId)) {
147
+ tableRef.value?.toggleRowSelection(item, true)
148
+ } else if (removeUserIds.value.includes(userId)) {
149
+ tableRef.value?.toggleRowSelection(item, false)
150
+ } else {
151
+ tableRef.value?.toggleRowSelection(item, isBound)
152
+ }
153
+ })
154
+ }
155
+ } finally {
156
+ loading.value = false
157
+ }
158
+ }
159
+ const onSearch = () => {
160
+ pageable.pageIndex = 0
161
+ onQuery()
162
+ }
163
+ const onReset = () => {
164
+ formRef.value?.resetFields()
165
+ onSearch()
166
+ }
167
+ const onDeploy = async () => {
168
+ try {
169
+ const userIds = tableRef.value?.getSelectionRows().map(item => item.userId)
170
+ if (!formData.configName) {
171
+ ElMessage.error('请输入配置名称')
172
+ return
173
+ }
174
+ if (userIds.length === 0 && !props.templateInfo.id) {
175
+ ElMessage.error('请至少勾选一个账号')
176
+ return
177
+ }
178
+ await ElMessageBox.confirm('列配置保存并下发后,会对配置下的账号实时生效!', '提示', {
179
+ confirmButtonText: '确定',
180
+ cancelButtonText: '取消',
181
+ type: 'warning'
182
+ })
183
+ loading.value = true
184
+ const api = { add: createGridConfigTemplate, edit: updateGridConfigTemplate }
185
+ const params = {
186
+ add: {
187
+ userIds,
188
+ configValue: JSON.stringify(configValue.value),
189
+ ...props.gridParams
190
+ },
191
+ edit: {
192
+ addUserIds: addUserIds.value,
193
+ removeUserIds: removeUserIds.value,
194
+ ...reactivePick(props.templateInfo, ['id', 'concurrencyStamp'])
195
+ }
196
+ }
197
+ const { result, message } = await api[props.mode]({
198
+ ...params[props.mode],
199
+ ...reactivePick(formData, ['configName']),
200
+ pageSize: props.pageSize
201
+ })
202
+ ElMessage.success(message)
203
+ visible.value = false
204
+ emits('success', result)
205
+ } finally {
206
+ loading.value = false
207
+ }
208
+ }
209
+ const onSizeChange = (size: number) => {
210
+ pageable.pageSize = size
211
+ onQuery()
212
+ }
213
+ const onCurrentChange = (currentPage: number) => {
214
+ pageable.pageIndex = currentPage - 1
215
+ onQuery()
216
+ }
217
+ const onOpen = () => {
218
+ if (props.mode === 'add') {
219
+ formData.configName = ''
220
+ } else {
221
+ formData.configName = props.templateInfo.configName
222
+ }
223
+ onQuery()
224
+ }
225
+ const onClose = () => {
226
+ addUserIds.value = []
227
+ removeUserIds.value = []
228
+ originUserIds.value = []
229
+ formData.configName = ''
230
+ pageable.pageIndex = 0
231
+ pageable.pageSize = 10
232
+ formRef.value?.resetFields()
233
+ visible.value = false
234
+ }
235
+ </script>
236
+
237
+ <template>
238
+ <jzt-dialog
239
+ v-model="visible"
240
+ width="1018"
241
+ full-content
242
+ :title="dialogTitle"
243
+ :cancel-text="false"
244
+ :show-footer="false"
245
+ @open="onOpen"
246
+ @close="onClose"
247
+ >
248
+ <div v-loading="loading" class="table-box">
249
+ <div v-if="mode === 'add'" class="tips-box warning-bg flx-left-center">
250
+ <el-icon color="#FFA00C" class="mr4"><WarningFilled /></el-icon>
251
+ 是否对当前列显示/隐藏/排序/列宽规则按照账号进行下发?下发后的账号将统一更新为当前配置。
252
+ </div>
253
+
254
+ <el-form v-if="!isView" ref="formRuleRef" :model="formData" :rules="formRules" inline label-width="fit-content">
255
+ <el-form-item label="当前列配置模版名称" prop="configName">
256
+ <el-input
257
+ v-model="formData.configName"
258
+ placeholder="请输入当前列配置模版名称"
259
+ maxlength="40"
260
+ show-word-limit
261
+ style="width: 456px"
262
+ />
263
+ </el-form-item>
264
+ </el-form>
265
+ <div v-else style="margin-bottom: 12px">
266
+ <el-text style="color: #999999">当前列配置模版名称:</el-text>
267
+ <el-text style="color: #333333">{{ formData.configName }}</el-text>
268
+ </div>
269
+ <jzt-label-title :title="labelTitle" font-size="14px" style="padding: 0 0 12px 0" />
270
+ <el-form ref="formRef" :model="formData" inline label-width="fit-content">
271
+ <el-form-item label="用户角色" prop="userRole" style="margin-right: 12px">
272
+ <el-select-v2
273
+ v-model="formData.userRole"
274
+ filterable
275
+ placeholder="请选择用户角色"
276
+ :options="userRoleEnum"
277
+ :props="{
278
+ label: 'name',
279
+ value: 'id'
280
+ }"
281
+ style="width: 210px"
282
+ />
283
+ </el-form-item>
284
+ <el-form-item label="用户名" prop="userName" style="margin-right: 12px">
285
+ <el-input v-model="formData.userName" placeholder="请输入用户名" style="width: 210px" />
286
+ </el-form-item>
287
+ <el-form-item label="真实姓名" prop="realName" style="margin-right: 12px">
288
+ <el-input v-model="formData.realName" placeholder="请输入真实姓名" style="width: 210px" />
289
+ </el-form-item>
290
+ <el-form-item style="margin-right: 12px">
291
+ <el-button type="primary" @click="onSearch">查询</el-button>
292
+ <el-button type="primary" plain @click="onReset">重置</el-button>
293
+ </el-form-item>
294
+ </el-form>
295
+ <el-table
296
+ ref="tableRef"
297
+ row-key="userId"
298
+ style="width: 100%"
299
+ :data="data"
300
+ @select="onSelect"
301
+ @select-all="onSelectAll"
302
+ >
303
+ <el-table-column v-if="!isView" type="selection" width="60" fixed="left" reserve-selection />
304
+ />
305
+ <el-table-column type="index" width="60" label="序号" fixed="left" />
306
+ <el-table-column prop="userName" label="用户名" width="160" />
307
+ <el-table-column prop="realName" label="真实姓名" width="160" />
308
+ <el-table-column prop="userRoles" label="用户角色" minWidth="120">
309
+ <template #default="{ row, row: { userRoles } }">
310
+ <el-space wrap>
311
+ <el-tag
312
+ v-for="(role, index) in row.computedUserRoles(row)"
313
+ :key="index"
314
+ type="primary"
315
+ size="small"
316
+ style="cursor: pointer"
317
+ >
318
+ {{ role }}
319
+ </el-tag>
320
+ <el-button
321
+ v-if="userRoles.length > maxCollapseCount"
322
+ text
323
+ size="small"
324
+ :icon="row.isCollapse ? Plus : Minus"
325
+ @click="row.isCollapse = !row.isCollapse"
326
+ >
327
+ {{ row.isCollapse ? '展开' : '收起' }} {{ row.isCollapse ? userRoles.length : '' }}
328
+ </el-button>
329
+ </el-space>
330
+ </template>
331
+ </el-table-column>
332
+ <el-table-column prop="creationTime" label="创建日期" width="120"></el-table-column>
333
+ </el-table>
334
+ <pagination
335
+ :show-check-total="!isView"
336
+ :check-total="pageable.total || 0"
337
+ :pageable="{ ...pageable, pageIndex: pageable.pageIndex + 1 }"
338
+ :handle-size-change="onSizeChange"
339
+ :handle-current-change="onCurrentChange"
340
+ />
341
+ </div>
342
+ <template v-if="!isView" #footer>
343
+ <div class="flx-center">
344
+ <el-button @click="onClose">取消</el-button>
345
+ <el-button type="primary" :loading="loading" @click="onDeploy">确认下发</el-button>
346
+ </div>
347
+ </template>
348
+ </jzt-dialog>
349
+ </template>
350
+
351
+ <style lang="scss" scoped></style>
@@ -0,0 +1,54 @@
1
+ <template>
2
+ <!-- 分页组件 -->
3
+ <div class="flx-between-center">
4
+ <div class="check-total">
5
+ <div v-if="showCheckTotal">
6
+ 已勾选
7
+ <span class="check-total-num">{{ checkTotal || 0 }}</span>
8
+
9
+ </div>
10
+ </div>
11
+ <el-pagination
12
+ :background="true"
13
+ :teleported="false"
14
+ v-model:current-page="pageable.pageIndex"
15
+ v-model:page-size="pageable.pageSize"
16
+ :page-sizes="pageSizes"
17
+ :pager-count="pageable.pagerCount || 5"
18
+ :total="pageable.total || 0"
19
+ layout="total, sizes, prev, pager, next, jumper"
20
+ @size-change="handleSizeChange"
21
+ @current-change="handleCurrentChange"
22
+ />
23
+ </div>
24
+ </template>
25
+
26
+ <script setup lang="ts" name="Pagination">
27
+ import { pageSizes } from '../const'
28
+ interface PageableProps {
29
+ pageIndex: number
30
+ pageSize: number
31
+ total: number
32
+ pagerCount?: number
33
+ }
34
+
35
+ interface PaginationProps {
36
+ checkTotal?: number
37
+ pageable: PageableProps
38
+ handleSizeChange: (size: number) => void
39
+ handleCurrentChange: (currentPage: number) => void
40
+ showCheckTotal?: boolean
41
+ }
42
+
43
+ defineProps<PaginationProps>()
44
+ </script>
45
+ <style lang="scss" scoped>
46
+ .check-total {
47
+ color: var(--el-text-color-regular);
48
+ font-size: 14px;
49
+ padding-top: 6px;
50
+ }
51
+ .check-total-num {
52
+ color: var(--el-color-primary);
53
+ }
54
+ </style>
@@ -0,0 +1,109 @@
1
+ <template>
2
+ <RenderTableColumn v-bind="column" />
3
+ </template>
4
+
5
+ <script setup lang="tsx" name="TableColumn">
6
+ import { inject, ref, useSlots } from 'vue'
7
+ import { ColumnProps, RenderScope, HeaderRenderScope } from '../interface'
8
+ import {
9
+ filterEnum,
10
+ formatCellValue,
11
+ handleProp,
12
+ handleRowAccordingToProp,
13
+ formatNumberValue,
14
+ } from '../../utils/index'
15
+ import { formatValue, formatAmount } from '@jzt-spd/utils'
16
+
17
+ defineProps<{ column: ColumnProps }>()
18
+
19
+ const slots = useSlots()
20
+
21
+ const enumMap = inject('enumColumnMap', ref(new Map()))
22
+
23
+ // 渲染表格数据
24
+ const renderCellData = (item: ColumnProps, scope: RenderScope<any>) => {
25
+ let amount = '' as any
26
+ if (!item.prop) return ''
27
+ if (item.isFilterEnum && enumMap.value.get(item.prop)) {
28
+ // 字典
29
+ amount = filterEnum(handleRowAccordingToProp(scope.row, item.prop!), enumMap.value.get(item.prop)!, item.fieldNames)
30
+ } else if (item.formatter) {
31
+ // 格式化方法
32
+ amount = item.formatter({
33
+ cellValue: scope.row[item.prop],
34
+ ...scope
35
+ })
36
+ } else if (item.decimal) {
37
+ // 格式化数字-几位小数
38
+ amount = formatNumberValue(scope.row[item.prop], item)
39
+ } else {
40
+ amount = formatCellValue(handleRowAccordingToProp(scope.row, item.prop!))
41
+ }
42
+ // 格式化数字-是否千分号处理
43
+ if (item.isPerMille) {
44
+ amount = formatAmount(amount)
45
+ }
46
+
47
+ return amount
48
+ }
49
+ // // 获取 tag 类型
50
+ // const getTagType = (item: ColumnProps, scope: RenderScope<any>) => {
51
+ // return (
52
+ // filterEnum(handleRowAccordingToProp(scope.row, item.prop!), enumMap.value.get(item.prop), item.fieldNames, 'tag') ||
53
+ // 'primary'
54
+ // )
55
+ // }
56
+ const RenderTableColumn = (item: ColumnProps) => {
57
+ return (
58
+ <>
59
+ {item.isShow && (
60
+ <el-table-column
61
+ {...item}
62
+ align={item.align ?? 'left'}
63
+ showOverflowTooltip={item.showOverflowTooltip ?? item.prop !== 'operation'}
64
+ >
65
+ {{
66
+ default: (scope: RenderScope<any>) => {
67
+ const renderCellValue = renderCellData(item, scope)
68
+ if (item._children) return item._children.map(child => RenderTableColumn(child))
69
+ if (item.render) return item.render(scope)
70
+ if (item.prop && slots[handleProp(item.prop)]) return slots[handleProp(item.prop)]!(scope)
71
+ if (item.isUnderline && !['', '-', '/'].includes(renderCellValue))
72
+ return (
73
+ <div
74
+ class="text-underline sle el-tooltip"
75
+ style="padding: 0px; white-space: nowrap;"
76
+ onClick={e => {
77
+ e.stopPropagation() // ⛔ 阻止冒泡到父级
78
+ item.fun &&
79
+ item.prop &&
80
+ item.fun({
81
+ ...scope,
82
+ cellValue: scope.row[item.prop]
83
+ })
84
+ }}
85
+ >
86
+ {formatValue(renderCellValue)}
87
+ </div>
88
+ )
89
+
90
+ {
91
+ /* {
92
+ if (item.tag) return <el-tag type={getTagType(item, scope)}>renderCellValue</el-tag>
93
+ } */
94
+ }
95
+ return renderCellValue
96
+ },
97
+ header: (scope: HeaderRenderScope<any>) => {
98
+ if (item.headerRender) return item.headerRender(scope)
99
+ if (item.prop && slots[`${handleProp(item.prop)}Header`])
100
+ return slots[`${handleProp(item.prop)}Header`]!(scope)
101
+ return item.label
102
+ }
103
+ }}
104
+ </el-table-column>
105
+ )}
106
+ </>
107
+ )
108
+ }
109
+ </script>
@@ -0,0 +1 @@
1
+ export const pageSizes = [10, 20, 50, 100]