@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.
- package/package.json +68 -0
- package/src/JztBackTop/index.vue +255 -0
- package/src/JztButtonList/index.vue +88 -0
- package/src/JztChart/index.vue +95 -0
- package/src/JztCharts/index.vue +317 -0
- package/src/JztClassTabs/index.vue +156 -0
- package/src/JztDateSelect/dateSelect.vue +186 -0
- package/src/JztDateSelect/dateType.vue +54 -0
- package/src/JztDateSelect/index.ts +135 -0
- package/src/JztDateSelect/interface/index.ts +13 -0
- package/src/JztDialog/index.vue +249 -0
- package/src/JztEllipsisTooltip/index.vue +61 -0
- package/src/JztEmpty/index.vue +45 -0
- package/src/JztErrorPage/403.vue +30 -0
- package/src/JztErrorPage/404.vue +19 -0
- package/src/JztErrorPage/500.vue +18 -0
- package/src/JztErrorPage/assets/401.png +0 -0
- package/src/JztErrorPage/assets/403.png +0 -0
- package/src/JztErrorPage/assets/404.png +0 -0
- package/src/JztErrorPage/assets/500.png +0 -0
- package/src/JztErrorPage/index.scss +35 -0
- package/src/JztErrorPage/index.vue +35 -0
- package/src/JztFilePreview/components/pdfViewer.vue +221 -0
- package/src/JztFilePreview/hooks/useImageMethod.ts +256 -0
- package/src/JztFilePreview/index.scss +171 -0
- package/src/JztFilePreview/index.vue +68 -0
- package/src/JztFilePreview/interface/index.ts +18 -0
- package/src/JztFilePreview/previewFile.vue +371 -0
- package/src/JztFormGrid/README.md +520 -0
- package/src/JztFormGrid/components/formItem.vue +209 -0
- package/src/JztFormGrid/components/formItemValue.vue +384 -0
- package/src/JztFormGrid/components/showDetailForm.vue +172 -0
- package/src/JztFormGrid/index.scss +60 -0
- package/src/JztFormGrid/index.vue +513 -0
- package/src/JztFormGrid/interface/index.ts +106 -0
- package/src/JztGrid/components/GridItem.vue +68 -0
- package/src/JztGrid/index.vue +179 -0
- package/src/JztGrid/interface/index.ts +6 -0
- package/src/JztImportExcel/assets/delete.png +0 -0
- package/src/JztImportExcel/index.scss +46 -0
- package/src/JztImportExcel/index.vue +430 -0
- package/src/JztImportExcel/interface/index.ts +25 -0
- package/src/JztLabelTitle/index.vue +65 -0
- package/src/JztLeftRightMode/components/CollapseButton.vue +80 -0
- package/src/JztLeftRightMode/components/LeftCard.vue +203 -0
- package/src/JztLeftRightMode/components/LeftLayout.vue +173 -0
- package/src/JztLeftRightMode/components/RightHeader.vue +186 -0
- package/src/JztLeftRightMode/components/RightLayout.vue +235 -0
- package/src/JztLeftRightMode/components/RightTableHeader.vue +43 -0
- package/src/JztLeftRightMode/hooks/useCollapse.ts +17 -0
- package/src/JztLeftRightMode/hooks/useDefaultProps.ts +19 -0
- package/src/JztLeftRightMode/hooks/useLeftLayout.ts +201 -0
- package/src/JztLeftRightMode/hooks/useMode.ts +20 -0
- package/src/JztLeftRightMode/hooks/usePrevNext.ts +60 -0
- package/src/JztLeftRightMode/hooks/useRightLayout.ts +215 -0
- package/src/JztLeftRightMode/hooks/useSlots.ts +15 -0
- package/src/JztLeftRightMode/index.ts +3 -0
- package/src/JztLeftRightMode/index.vue +494 -0
- package/src/JztLeftRightMode/types/index.ts +457 -0
- package/src/JztLoading/fullScreen.ts +45 -0
- package/src/JztLoading/index.scss +67 -0
- package/src/JztLoading/index.vue +18 -0
- package/src/JztLogin/components/LoginFooter.vue +17 -0
- package/src/JztLogin/components/LoginForm.vue +99 -0
- package/src/JztLogin/hooks/useLogin.ts +186 -0
- package/src/JztLogin/index.scss +142 -0
- package/src/JztLogin/index.vue +31 -0
- package/src/JztLogin/interface/index.ts +47 -0
- package/src/JztNumericalRange/index.vue +81 -0
- package/src/JztPageCard/comm/datePicker.vue +151 -0
- package/src/JztPageCard/comm/details.vue +60 -0
- package/src/JztPageCard/comm/export.vue +24 -0
- package/src/JztPageCard/comm/tabs.vue +94 -0
- package/src/JztPageCard/comm/tooltip.vue +31 -0
- package/src/JztPageCard/index.vue +287 -0
- package/src/JztPagination/index.vue +70 -0
- package/src/JztProductInfo/components/imagePreview.vue +275 -0
- package/src/JztProductInfo/components/qxUnique.vue +101 -0
- package/src/JztProductInfo/components/records.vue +265 -0
- package/src/JztProductInfo/hooks/useParams.ts +143 -0
- package/src/JztProductInfo/hooks/useQxUnique.tsx +466 -0
- package/src/JztProductInfo/images/defaultProduct.png +0 -0
- package/src/JztProductInfo/index.ts +116 -0
- package/src/JztProductInfo/index.vue +108 -0
- package/src/JztProductInfo/interface/index.ts +15 -0
- package/src/JztQueryDetailTable/index.scss +100 -0
- package/src/JztQueryDetailTable/index.vue +400 -0
- package/src/JztQueryDetailTable/interface/index.ts +10 -0
- package/src/JztQueryTable/QueryTable /345/212/237/350/203/275.md" +1580 -0
- package/src/JztQueryTable/README.md +567 -0
- package/src/JztQueryTable/components/ColSetting.vue +67 -0
- package/src/JztQueryTable/components/ColumnsSetting.vue +404 -0
- package/src/JztQueryTable/components/ColumnsSetting1.vue +220 -0
- package/src/JztQueryTable/components/DeployToAccountLevelSetting.vue +351 -0
- package/src/JztQueryTable/components/Pagination.vue +54 -0
- package/src/JztQueryTable/components/TableColumn.vue +109 -0
- package/src/JztQueryTable/const.ts +1 -0
- package/src/JztQueryTable/hooks/useQueryTable.ts +194 -0
- package/src/JztQueryTable/hooks/useSelection.ts +47 -0
- package/src/JztQueryTable/hooks/useTableSetting.ts +197 -0
- package/src/JztQueryTable/hooks/useTemplate.ts +127 -0
- package/src/JztQueryTable/index.scss +91 -0
- package/src/JztQueryTable/index.vue +1445 -0
- package/src/JztQueryTable/interface/index.ts +185 -0
- package/src/JztRegionSelect/index.vue +134 -0
- package/src/JztSearchForm/components/SearchFormItem.vue +473 -0
- package/src/JztSearchForm/index.vue +530 -0
- package/src/JztSearchForm/interface/index.ts +100 -0
- package/src/JztSelectFilter/index.scss +63 -0
- package/src/JztSelectFilter/index.vue +110 -0
- package/src/JztSelectTable/index.vue +257 -0
- package/src/JztTable/index.scss +72 -0
- package/src/JztTable/index.vue +353 -0
- package/src/JztTable/interface/index.ts +1 -0
- package/src/JztTime/comm/agencySelect.vue +112 -0
- package/src/JztTime/comm/collapseRow.vue +132 -0
- package/src/JztTime/comm/dateSelect.vue +292 -0
- package/src/JztTime/comm/deptSelect.vue +193 -0
- package/src/JztTime/comm/typeSelect.vue +97 -0
- package/src/JztTime/index.ts +216 -0
- package/src/JztTime/index.vue +303 -0
- package/src/JztTime/interface/index.ts +23 -0
- package/src/JztTreeFilter/index.scss +44 -0
- package/src/JztTreeFilter/index.vue +177 -0
- package/src/JztUploadFile/interface/index.ts +21 -0
- package/src/JztUploadFile/multiple.scss +215 -0
- package/src/JztUploadFile/multiple.vue +318 -0
- package/src/JztUploadFile/single.scss +226 -0
- package/src/JztUploadFile/single.vue +274 -0
- package/src/JztUploadImg/Img.vue +294 -0
- package/src/JztUploadImg/Imgs.vue +411 -0
- package/src/JztUploadImg/index.scss +138 -0
- package/src/JztUploadImg/interface/index.ts +22 -0
- package/src/SelectIcon/index.scss +39 -0
- package/src/SelectIcon/index.vue +106 -0
- package/src/SvgIcon/index.vue +22 -0
- package/src/hooks/useAuthButtons.ts +58 -0
- package/src/hooks/useFormByUserType.ts +90 -0
- package/src/hooks/useTableEvents.ts +30 -0
- package/src/hooks/useUploadFileHook.ts +262 -0
- package/src/index.ts +91 -0
- package/src/typings/global.d.ts +101 -0
- package/src/utils/index.ts +107 -0
- package/src/utils/tree.ts +57 -0
- 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
|
+
}
|