@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,215 @@
1
+ import { axiosCanceler } from '@jzt-spd/utils'
2
+ import { reactiveComputed, reactiveOmit, useVModel } from '@vueuse/core'
3
+ import { ElMessage } from 'element-plus'
4
+ import { computed, ref, watch } from 'vue'
5
+
6
+ import { type JztFormInstance } from '../../JztFormGrid/interface'
7
+ import { type ProTableInstance } from '../../JztQueryTable/interface'
8
+ import { type RightLayoutEmits, type RightLayoutProps, type TotalData } from '../types/index'
9
+
10
+ const defaultConfigs = [
11
+ {
12
+ type: 'count' as const,
13
+ show: true,
14
+ label: '总数量:',
15
+ valueKey: 'sumCount',
16
+ unit: '',
17
+ color: '#ff6000'
18
+ },
19
+ {
20
+ type: 'amount' as const,
21
+ show: true,
22
+ label: '总金额:',
23
+ valueKey: 'sumPrice',
24
+ unit: '元',
25
+ color: '#ff6000'
26
+ }
27
+ ]
28
+
29
+ export const getSortParams = (sort: any) => {
30
+ let sortParams = {}
31
+ if (sort.order == 'descending') {
32
+ sortParams = {
33
+ sortDirection: 'DESC',
34
+ sortField: sort.prop
35
+ }
36
+ } else if (sort.order == 'ascending') {
37
+ sortParams = {
38
+ sortDirection: 'ASC',
39
+ sortField: sort.prop
40
+ }
41
+ }
42
+ return sortParams
43
+ }
44
+
45
+ export const useRightLayout = (props: RightLayoutProps, emits: RightLayoutEmits) => {
46
+ let currentRequestId = 0
47
+
48
+ const tableRef = ref<ProTableInstance>()
49
+ const formGridRef = ref<JztFormInstance>()
50
+ const rightLayoutRef = ref<HTMLDivElement>()
51
+
52
+ const background = ref('')
53
+ const sortParams = ref<{ sortField?: string; sortDirection?: 'ASC' | 'DESC' }>({})
54
+ const totalData = ref<TotalData>({ count: '0.0000', amount: '0.0000' })
55
+ const currentId = ref<string>('')
56
+
57
+ const loading = useVModel(props, 'loading', emits, { passive: true })
58
+ const headerData = useVModel(props, 'modelValue', emits, { passive: true })
59
+
60
+ const tableInfo = computed(() => tableRef.value)
61
+ const mergedTotalProps = reactiveComputed(() => {
62
+ const { totalProps } = props.tableProps ?? {}
63
+ if (!totalProps || totalProps.length === 0) {
64
+ return defaultConfigs
65
+ }
66
+ return totalProps
67
+ .map(config => {
68
+ const defaultConfig = defaultConfigs.find(d => d.type === config.type)
69
+ return { ...defaultConfig, ...config }
70
+ })
71
+ .filter(config => config.show !== false)
72
+ })
73
+ const descriptionsProps = reactiveComputed(() => ({
74
+ ruleForm: headerData,
75
+ queryItems: props.descriptionsProps?.queryItems ?? [],
76
+ ...reactiveOmit(props.descriptionsProps as any, ['queryItems', 'ruleForm'])
77
+ }))
78
+
79
+ const onSortChange = (sort: any) => {
80
+ const {
81
+ column: { sortMethod }
82
+ } = sort
83
+ sortParams.value = getSortParams(sort)
84
+ !sortMethod && tableRef.value?.searchAndClear()
85
+ }
86
+
87
+ const onQueryOrderDetail = async (id: string) => {
88
+ try {
89
+ const { requestApi } = props.headerProps ?? {}
90
+ if (!requestApi) return headerData.value
91
+ const { result } = await requestApi({ id })
92
+ headerData.value = result
93
+ } catch (err) {
94
+ console.error('单据详情请求失败:', err)
95
+ }
96
+ }
97
+
98
+ const onQueryTableList = async (param: Record<string, unknown>) => {
99
+ try {
100
+ const { requestApi, initParam } = props.tableProps ?? {}
101
+ if (!requestApi) throw new Error('表格列表请求接口未配置')
102
+ return await requestApi({
103
+ ...param,
104
+ ...initParam,
105
+ ...sortParams.value
106
+ })
107
+ } catch (err) {
108
+ console.error('表格列表请求失败:', err)
109
+ }
110
+ }
111
+
112
+ const onGetTableData = async (param: Record<string, unknown>) => {
113
+ loading.value = true
114
+ axiosCanceler?.removeAllPending()
115
+ const requestId = ++currentRequestId
116
+ try {
117
+ await onQueryOrderDetail(currentId.value)
118
+ const tableRes = await onQueryTableList(param)
119
+ mergedTotalProps.forEach(item => {
120
+ if (item.valueKey) {
121
+ totalData.value[item.type] = tableRes?.[item.valueKey] ?? '0.0000'
122
+ }
123
+ })
124
+ return {
125
+ result: tableRes?.result ?? [],
126
+ totalCount: tableRes?.totalCount ?? 0
127
+ }
128
+ } catch (err) {
129
+ return { result: [], totalCount: 0 }
130
+ } finally {
131
+ if (requestId === currentRequestId) loading.value = false
132
+ }
133
+ }
134
+
135
+ const onValidate = (err: any) => {
136
+ Object.keys(err).forEach(key => ElMessage.error(err[key][0]?.message))
137
+ }
138
+
139
+ watch(
140
+ () => headerData.value[props?.rowKey ?? 'id'],
141
+ newVal => newVal && (currentId.value = newVal)
142
+ )
143
+
144
+ const expose = {
145
+ data: headerData,
146
+ tableRef,
147
+ formGridRef,
148
+ search: () => {
149
+ if (currentRequestId === 0 && props.tableProps?.gridParams) {
150
+ return
151
+ }
152
+ tableRef.value?.searchAndClear()
153
+ },
154
+ validate: () => {
155
+ return new Promise((resolve, reject) =>
156
+ formGridRef.value?.formRef?.validate((valid: boolean, errors: any) => {
157
+ if (valid) {
158
+ resolve(valid)
159
+ } else {
160
+ props.showValidate && onValidate(errors)
161
+ reject(errors)
162
+ }
163
+ })
164
+ )
165
+ },
166
+ validateField: (field: string | string[]): Promise<boolean> => {
167
+ return new Promise((resolve, reject) =>
168
+ formGridRef.value?.formRef?.validateField(field, (valid: boolean, errors: any) => {
169
+ if (valid) {
170
+ resolve(valid)
171
+ } else {
172
+ props.showValidate && onValidate(errors)
173
+ reject(errors)
174
+ }
175
+ })
176
+ )
177
+ },
178
+ resetFields: () => {
179
+ formGridRef.value?.formRef?.resetFields()
180
+ },
181
+ clearValidate: () => {
182
+ formGridRef.value?.formRef?.clearValidate()
183
+ },
184
+ setData: (value: any) => {
185
+ headerData.value = value
186
+ },
187
+ setLoading: (value: boolean) => {
188
+ loading.value = value
189
+ },
190
+ selectedList: () => {
191
+ return tableRef.value?.selectedList
192
+ },
193
+ selectedListIds: () => {
194
+ return tableRef.value?.selectedListIds
195
+ }
196
+ }
197
+
198
+ return {
199
+ tableRef,
200
+ rightLayoutRef,
201
+ formGridRef,
202
+ sortParams,
203
+ totalData,
204
+ loading,
205
+ currentId,
206
+ background,
207
+ headerData,
208
+ tableInfo,
209
+ mergedTotalProps,
210
+ expose,
211
+ descriptionsProps,
212
+ onSortChange,
213
+ onGetTableData
214
+ }
215
+ }
@@ -0,0 +1,15 @@
1
+ import { useSlots } from 'vue'
2
+
3
+ export const useFilterSlots = () => {
4
+ const slots = useSlots()
5
+ const onFilterSlots = (prefix: string) => {
6
+ return Object.keys(slots)
7
+ .filter(name => name.startsWith(prefix))
8
+ .map(name => ({ templateName: name.slice(prefix.length), slotName: name }))
9
+ }
10
+
11
+ return {
12
+ slots,
13
+ onFilterSlots
14
+ }
15
+ }
@@ -0,0 +1,3 @@
1
+ export { default as LeftLayout } from './components/LeftLayout.vue'
2
+ export { default as RightLayout } from './components/RightLayout.vue'
3
+ export { default as JztLeftRightMode } from './index.vue'