@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,107 @@
|
|
|
1
|
+
import { FieldNamesProps } from '../JztQueryTable/interface/index'
|
|
2
|
+
import { isEmpty, formatMoneyPrecision, formatNumPrecision, isNumber } from '@jzt-spd/utils'
|
|
3
|
+
/**
|
|
4
|
+
* @description 生成唯一 uuid
|
|
5
|
+
* @returns {String}
|
|
6
|
+
*/
|
|
7
|
+
export function generateUUID() {
|
|
8
|
+
let uuid = ''
|
|
9
|
+
for (let i = 0; i < 32; i++) {
|
|
10
|
+
let random = (Math.random() * 16) | 0
|
|
11
|
+
if (i === 8 || i === 12 || i === 16 || i === 20) uuid += '-'
|
|
12
|
+
uuid += (i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16)
|
|
13
|
+
}
|
|
14
|
+
return uuid
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @description 处理 prop,当 prop 为多级嵌套时 ==> 返回最后一级 prop
|
|
19
|
+
* @param {String} prop 当前 prop
|
|
20
|
+
* @returns {String}
|
|
21
|
+
* */
|
|
22
|
+
export function handleProp(prop: string) {
|
|
23
|
+
const propArr = prop.split('.')
|
|
24
|
+
if (propArr.length == 1) return prop
|
|
25
|
+
return propArr[propArr.length - 1]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @description 处理 prop 为多级嵌套的情况,返回的数据 (列如: prop: user.name)
|
|
30
|
+
* @param {Object} row 当前行数据
|
|
31
|
+
* @param {String} prop 当前 prop
|
|
32
|
+
* @returns {*}
|
|
33
|
+
* */
|
|
34
|
+
export function handleRowAccordingToProp(row: { [key: string]: any }, prop: string) {
|
|
35
|
+
if (!prop.includes('.')) return row[prop] ?? '-'
|
|
36
|
+
prop.split('.').forEach(item => (row = row[item] ?? '-'))
|
|
37
|
+
return row
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @description 处理 ProTable 值为数组 || 无数据
|
|
42
|
+
* @param {*} callValue 需要处理的值
|
|
43
|
+
* @returns {String}
|
|
44
|
+
* */
|
|
45
|
+
export function formatCellValue(callValue: any) {
|
|
46
|
+
// 如果当前值为数组,使用 / 拼接(根据需求自定义)
|
|
47
|
+
if (Array.isArray(callValue)) return callValue.length ? callValue.join(' / ') : '-'
|
|
48
|
+
return callValue
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @description 根据枚举列表查询当需要的数据(如果指定了 label 和 value 的 key值,会自动识别格式化)
|
|
52
|
+
* @param {String} callValue 当前单元格值
|
|
53
|
+
* @param {Array} enumData 字典列表
|
|
54
|
+
* @param {Array} fieldNames label && value && children 的 key 值
|
|
55
|
+
* @param {String} type 过滤类型(目前只有 tag)
|
|
56
|
+
* @returns {String}
|
|
57
|
+
* */
|
|
58
|
+
export function filterEnum(callValue: any, enumData?: any, fieldNames?: FieldNamesProps, type?: 'tag') {
|
|
59
|
+
const value = fieldNames?.value ?? 'value'
|
|
60
|
+
const label = fieldNames?.label ?? 'label'
|
|
61
|
+
const children = fieldNames?.children ?? 'children'
|
|
62
|
+
let filterData: { [key: string]: any } = {}
|
|
63
|
+
// 判断 enumData 是否为数组
|
|
64
|
+
if (Array.isArray(enumData)) filterData = findItemNested(enumData, callValue, value, children)
|
|
65
|
+
// 判断是否输出的结果为 tag 类型
|
|
66
|
+
if (type == 'tag') {
|
|
67
|
+
return filterData?.tagType ? filterData.tagType : ''
|
|
68
|
+
} else {
|
|
69
|
+
return filterData ? filterData[label] : '-'
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @description 递归查找 callValue 对应的 enum 值
|
|
75
|
+
* */
|
|
76
|
+
export function findItemNested(enumData: any, callValue: any, value: string, children: string) {
|
|
77
|
+
return enumData.reduce((accumulator: any, current: any) => {
|
|
78
|
+
if (accumulator) return accumulator
|
|
79
|
+
if (current[value] === callValue) return current
|
|
80
|
+
if (current[children]) return findItemNested(current[children], callValue, value, children)
|
|
81
|
+
}, null)
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @description 处理 数字小数点
|
|
85
|
+
* @param {*} callValue 需要处理的值
|
|
86
|
+
* @param {Object} options 配置项
|
|
87
|
+
* @param {number | 'moneyDecimal' | 'countDecimal'} options.decimal 小数位配置:
|
|
88
|
+
* - 数字:直接按指定位数格式化
|
|
89
|
+
* - 'moneyDecimal':按金额精度格式化
|
|
90
|
+
* - 'countDecimal':按数量精度格式化
|
|
91
|
+
* @returns {String}
|
|
92
|
+
* */
|
|
93
|
+
export function formatNumberValue(
|
|
94
|
+
callValue: any,
|
|
95
|
+
{ decimal = 4 }: { decimal?: number | 'moneyDecimal' | 'countDecimal' } = {}
|
|
96
|
+
) {
|
|
97
|
+
try {
|
|
98
|
+
if (isEmpty(callValue)) return '-'
|
|
99
|
+
if (callValue == '0') return 0
|
|
100
|
+
if (isNumber(decimal)) return Number(callValue).toFixed(decimal)
|
|
101
|
+
if (decimal === 'moneyDecimal') return formatMoneyPrecision(callValue)
|
|
102
|
+
if (decimal === 'countDecimal') return formatNumPrecision(callValue)
|
|
103
|
+
return callValue
|
|
104
|
+
} catch {
|
|
105
|
+
return callValue
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// 非固定长度的树形结构禁用节点,
|
|
2
|
+
// 场景: 医疗机构->仓库->科室,只允许选择科室,但是没有科室的医疗机构仓库 会正常返回,此时就不允许选择 第一层,第二层
|
|
3
|
+
export function disableRootNodesByDepth(treeData, targetDepth) {
|
|
4
|
+
// 计算单个节点的深度(从该节点到最深子节点的层级数)
|
|
5
|
+
function getNodeDepth(node) {
|
|
6
|
+
if (!node.children || node.children.length === 0) {
|
|
7
|
+
return 1 // 没有子节点,深度为1
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let maxChildDepth = 0
|
|
11
|
+
for (const child of node.children) {
|
|
12
|
+
const childDepth = getNodeDepth(child)
|
|
13
|
+
maxChildDepth = Math.max(maxChildDepth, childDepth)
|
|
14
|
+
}
|
|
15
|
+
return maxChildDepth + 1
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// 递归禁用节点及其所有子节点
|
|
19
|
+
function disableNodeAndChildren(node) {
|
|
20
|
+
node.disabled = true
|
|
21
|
+
if (node.children && node.children.length > 0) {
|
|
22
|
+
for (const child of node.children) {
|
|
23
|
+
disableNodeAndChildren(child)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// 遍历所有根节点
|
|
29
|
+
for (const node of treeData) {
|
|
30
|
+
const nodeDepth = getNodeDepth(node)
|
|
31
|
+
// 如果根节点的深度小于目标深度,递归禁用该节点及其所有子节点
|
|
32
|
+
if (nodeDepth < targetDepth) {
|
|
33
|
+
disableNodeAndChildren(node)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return treeData
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// 获取能够选择的节点集合(仅子节点)
|
|
40
|
+
export function getEnabledChildValues(treeData: any[], valueKey: string): any[] {
|
|
41
|
+
const result: any[] = []
|
|
42
|
+
// const valueKey = fieldNames.value.value as string
|
|
43
|
+
function traverse(nodes: any[], isRootLevel = true) {
|
|
44
|
+
for (const node of nodes) {
|
|
45
|
+
// 如果不是根层级、不是禁用状态,且没有children属性或children为空,则收集
|
|
46
|
+
if (!isRootLevel && !node.disabled && !node.children) {
|
|
47
|
+
result.push(node[valueKey])
|
|
48
|
+
}
|
|
49
|
+
// 如果有子节点,递归遍历
|
|
50
|
+
if (node.children && node.children.length > 0) {
|
|
51
|
+
traverse(node.children, false)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
traverse(treeData, true)
|
|
56
|
+
return result
|
|
57
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "Node",
|
|
7
|
+
"types": ["vite/client", "element-plus/global"],
|
|
8
|
+
|
|
9
|
+
/* Strict Type-Checking Options */
|
|
10
|
+
"strict": true /* Enable all strict type-checking options. */,
|
|
11
|
+
"noImplicitAny": false /* Raise error on expressions and declarations with an implied 'any' type. */,
|
|
12
|
+
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
13
|
+
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
14
|
+
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
|
15
|
+
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
16
|
+
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
17
|
+
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
18
|
+
|
|
19
|
+
"jsx": "preserve",
|
|
20
|
+
"resolveJsonModule": true,
|
|
21
|
+
"isolatedModules": true,
|
|
22
|
+
"esModuleInterop": true,
|
|
23
|
+
"lib": ["ESNext", "DOM"],
|
|
24
|
+
"skipLibCheck": true,
|
|
25
|
+
"noEmit": true,
|
|
26
|
+
"baseUrl": "./",
|
|
27
|
+
"paths": {
|
|
28
|
+
"@": ["src"],
|
|
29
|
+
"@/*": ["src/*"],
|
|
30
|
+
"@c": ["src/components"],
|
|
31
|
+
"@c/*": ["src/components/*"]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"include": [
|
|
35
|
+
"src/**/*.ts",
|
|
36
|
+
"src/**/*.d.ts",
|
|
37
|
+
"src/**/*.tsx",
|
|
38
|
+
"src/**/*.vue",
|
|
39
|
+
"build/**/*.ts",
|
|
40
|
+
"build/**/*.d.ts",
|
|
41
|
+
"vite.config.ts",
|
|
42
|
+
"auto-imports.d.ts"
|
|
43
|
+
],
|
|
44
|
+
"exclude": ["node_modules", "dist", "**/*.js"]
|
|
45
|
+
}
|