@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,216 @@
|
|
|
1
|
+
import dayjs from 'dayjs'
|
|
2
|
+
import { DateType, DateTypeProps, IDateOptions, ToolTypeProps } from './interface/index'
|
|
3
|
+
|
|
4
|
+
export const dateOptions: IDateOptions<DateTypeProps>[] = [
|
|
5
|
+
{
|
|
6
|
+
name: '年',
|
|
7
|
+
value: 'year',
|
|
8
|
+
type: 'yearrange',
|
|
9
|
+
disableInfo: {
|
|
10
|
+
unit: 'month',
|
|
11
|
+
maxValue: 4 * 12 //(5年) 需要-1
|
|
12
|
+
// accountUnit: 'year' // 以年为单位展示,
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: '季度',
|
|
17
|
+
value: 'quarter',
|
|
18
|
+
type: 'yearrange',
|
|
19
|
+
disableInfo: {
|
|
20
|
+
unit: 'month',
|
|
21
|
+
maxValue: 1 * 12 // (2年) 需要-1
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: '月',
|
|
26
|
+
value: 'month',
|
|
27
|
+
type: 'monthrange',
|
|
28
|
+
disableInfo: {
|
|
29
|
+
unit: 'month',
|
|
30
|
+
maxValue: 12
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: '日',
|
|
35
|
+
value: 'custom',
|
|
36
|
+
type: 'daterange',
|
|
37
|
+
disableInfo: {
|
|
38
|
+
unit: 'month',
|
|
39
|
+
maxValue: 2
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
export const monthShortcuts = [
|
|
44
|
+
{
|
|
45
|
+
text: '本月',
|
|
46
|
+
value: () => {
|
|
47
|
+
const start = dayjs().subtract(1, 'day').startOf('month')
|
|
48
|
+
const end = dayjs().subtract(1, 'day').endOf('day')
|
|
49
|
+
return [start.toDate(), end.toDate()]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
text: '今年至今',
|
|
54
|
+
value: () => {
|
|
55
|
+
const start = dayjs().subtract(1, 'day').startOf('year')
|
|
56
|
+
const end = dayjs().subtract(1, 'day').endOf('day')
|
|
57
|
+
return [start.toDate(), end.toDate()]
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
text: '最近六个月',
|
|
62
|
+
value: () => {
|
|
63
|
+
const end = dayjs().subtract(1, 'day').endOf('day')
|
|
64
|
+
const start = dayjs().subtract(5, 'month').startOf('day')
|
|
65
|
+
return [start.toDate(), end.toDate()]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
export const dayShortcuts = [
|
|
70
|
+
{
|
|
71
|
+
text: '最近一周',
|
|
72
|
+
value: () => {
|
|
73
|
+
const end = dayjs().subtract(1, 'day').endOf('day')
|
|
74
|
+
const start = dayjs().subtract(7, 'day').startOf('day')
|
|
75
|
+
return [start.toDate(), end.toDate()]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
text: '最近一个月',
|
|
80
|
+
value: () => {
|
|
81
|
+
const end = dayjs().subtract(1, 'day').endOf('day')
|
|
82
|
+
const start = dayjs().subtract(1, 'month').startOf('day')
|
|
83
|
+
return [start.toDate(), end.toDate()]
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
text: '最近二个月',
|
|
88
|
+
value: () => {
|
|
89
|
+
const end = dayjs().subtract(1, 'day').endOf('day') // 昨天结束时间
|
|
90
|
+
const start = dayjs().subtract(2, 'month').startOf('day') // 两个月前开始
|
|
91
|
+
return [start.toDate(), end.toDate()]
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
// 返回对应日期配置
|
|
96
|
+
export function getDateConfig(dateType) {
|
|
97
|
+
let format = 'YYYY-MM-DD' //时间格式
|
|
98
|
+
let type: DateType = 'month' // 时间类型
|
|
99
|
+
let isScopeType = true // 是否范围选择
|
|
100
|
+
|
|
101
|
+
if (['year', 'month', 'date'].includes(dateType)) {
|
|
102
|
+
isScopeType = false
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (['year', 'yearrange'].includes(dateType)) {
|
|
106
|
+
format = 'YYYY'
|
|
107
|
+
type = 'year'
|
|
108
|
+
} else if (['month', 'monthrange'].includes(dateType)) {
|
|
109
|
+
format = 'YYYY-MM'
|
|
110
|
+
type = 'month'
|
|
111
|
+
} else {
|
|
112
|
+
format = 'YYYY-MM-DD'
|
|
113
|
+
type = 'custom'
|
|
114
|
+
}
|
|
115
|
+
return { format, type, isScopeType }
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// 返回对应的默认时间范围 -- 目前是只有默认月份
|
|
119
|
+
export function getDefaultDateRange(type: DateType, isBefore = false) {
|
|
120
|
+
let dateRange = ['', '']
|
|
121
|
+
switch (type) {
|
|
122
|
+
case 'month':
|
|
123
|
+
let nowDay = ''
|
|
124
|
+
// if (isBefore) {
|
|
125
|
+
// // 只能选择到昨天
|
|
126
|
+
// nowDay = dayjs().subtract(1, 'day').format('YYYY-MM')
|
|
127
|
+
// } else {
|
|
128
|
+
nowDay = dayjs().format('YYYY-MM')
|
|
129
|
+
// }
|
|
130
|
+
// 默认12个月
|
|
131
|
+
dateRange = [dayjs(nowDay).subtract(11, 'month').format('YYYY-MM'), dayjs(nowDay).format('YYYY-MM')]
|
|
132
|
+
break
|
|
133
|
+
case 'year':
|
|
134
|
+
case 'custom':
|
|
135
|
+
case 'quarter':
|
|
136
|
+
dateRange = ['', '']
|
|
137
|
+
break
|
|
138
|
+
default:
|
|
139
|
+
break
|
|
140
|
+
}
|
|
141
|
+
return dateRange
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// 工具展示
|
|
145
|
+
export const showTool = (showToolType, key: ToolTypeProps) => {
|
|
146
|
+
return Array.isArray(showToolType) ? showToolType.includes(key) : showToolType
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// 获取enum值
|
|
150
|
+
export const getTypeEnum = (typeName: string, negationStr: string = '非') => {
|
|
151
|
+
return [
|
|
152
|
+
{
|
|
153
|
+
label: '全部',
|
|
154
|
+
value: ''
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
label: typeName,
|
|
158
|
+
value: 1
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
label: negationStr + `${typeName}`,
|
|
162
|
+
value: 0
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// 判断两个数组相等,不考虑顺序 比如需要[1,2]=[1,2]=[2,1]=true
|
|
168
|
+
const isSameArray = (a?: number[], b?: number[]) => {
|
|
169
|
+
if (!a || !b) return false
|
|
170
|
+
if (a.length !== b.length) return false
|
|
171
|
+
const aa = [...a].sort()
|
|
172
|
+
const bb = [...b].sort()
|
|
173
|
+
return aa.every((v, i) => v === bb[i])
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// 仓库级别
|
|
177
|
+
const allWarehouseLevels = [
|
|
178
|
+
{ label: '全部', value: 0 },
|
|
179
|
+
{ label: '一级库', value: 1 },
|
|
180
|
+
{ label: '二级库', value: 2 },
|
|
181
|
+
{ label: '三级库', value: 3 }
|
|
182
|
+
]
|
|
183
|
+
export const getWarehouseLevelOptions = (warehouseLevels?: number[]) => {
|
|
184
|
+
if (isSameArray(warehouseLevels, [2, 3])) {
|
|
185
|
+
return {
|
|
186
|
+
options: [
|
|
187
|
+
{ label: '全部', value: 5 },
|
|
188
|
+
{ label: '二级库', value: 2 },
|
|
189
|
+
{ label: '三级库', value: 3 }
|
|
190
|
+
],
|
|
191
|
+
defaultValue: 5
|
|
192
|
+
}
|
|
193
|
+
} else if (isSameArray(warehouseLevels, [2])) {
|
|
194
|
+
return {
|
|
195
|
+
options: [
|
|
196
|
+
// { label: '全部', value: 2 },
|
|
197
|
+
{ label: '二级库', value: 2 }
|
|
198
|
+
],
|
|
199
|
+
defaultValue: 6
|
|
200
|
+
}
|
|
201
|
+
} else if (isSameArray(warehouseLevels, [1, 2])) {
|
|
202
|
+
return {
|
|
203
|
+
options: [
|
|
204
|
+
{ label: '全部', value: 6 },
|
|
205
|
+
{ label: '一级库', value: 1 },
|
|
206
|
+
{ label: '二级库', value: 2 }
|
|
207
|
+
],
|
|
208
|
+
defaultValue: 6
|
|
209
|
+
}
|
|
210
|
+
} else {
|
|
211
|
+
return {
|
|
212
|
+
options: allWarehouseLevels,
|
|
213
|
+
defaultValue: 0
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="jztTime" ref="jztTimContainerRef">
|
|
3
|
+
<slot name="topSlot"></slot>
|
|
4
|
+
<!-- <div class="jztTime-left flx-left-center"> -->
|
|
5
|
+
<AutoCollapseRow>
|
|
6
|
+
<slot name="leftSlot"></slot>
|
|
7
|
+
<DeptSelect
|
|
8
|
+
v-if="showTool(showToolType, 'show-warehouseLevel') || showTool(showToolType, 'show-dept')"
|
|
9
|
+
style="flex-shrink: 0"
|
|
10
|
+
ref="agencySelectRef"
|
|
11
|
+
:agency-id="selectFrom.agencyId"
|
|
12
|
+
v-bind="{
|
|
13
|
+
...deptSelectProps,
|
|
14
|
+
width
|
|
15
|
+
}"
|
|
16
|
+
v-model:selectValue="selectFrom.deptId"
|
|
17
|
+
v-model:WarehouseLevel="selectFrom.WarehouseLevel"
|
|
18
|
+
:warehouseLevels="warehouseLevels"
|
|
19
|
+
:show-tool-type="showToolType"
|
|
20
|
+
@dept-change="deptChange"
|
|
21
|
+
/>
|
|
22
|
+
<slot name="leftCenter"></slot>
|
|
23
|
+
<!-- 时间选择框 -->
|
|
24
|
+
<DateSelect
|
|
25
|
+
style="flex-shrink: 0"
|
|
26
|
+
v-if="showTool(showToolType, 'show-dateSelect') || showTool(showToolType, 'show-date')"
|
|
27
|
+
:default-time-date="timeData"
|
|
28
|
+
:default-time-type="selectFrom.timeMode"
|
|
29
|
+
@update:defaultTimeDate="emit('update:timeData', $event)"
|
|
30
|
+
:showTimeType="showTimeType"
|
|
31
|
+
v-bind="{
|
|
32
|
+
...$attrs,
|
|
33
|
+
...dateSelectProps,
|
|
34
|
+
width,
|
|
35
|
+
showToolType
|
|
36
|
+
}"
|
|
37
|
+
@dateSelectChange="dateSelectChange"
|
|
38
|
+
/>
|
|
39
|
+
<slot name="rightCenter"></slot>
|
|
40
|
+
<!-- 集采/临采/计费选择框 -->
|
|
41
|
+
<TypeSelect
|
|
42
|
+
style="flex-shrink: 0"
|
|
43
|
+
v-if="
|
|
44
|
+
showTool(showToolType, 'show-isTempPurch') ||
|
|
45
|
+
showTool(showToolType, 'show-isCollect') ||
|
|
46
|
+
showTool(showToolType, 'show-isCharging')
|
|
47
|
+
"
|
|
48
|
+
:show-tool-type="showToolType"
|
|
49
|
+
:isCollect="selectFrom.isCollect"
|
|
50
|
+
:isTempPurch="selectFrom.isTempPurch"
|
|
51
|
+
@type-change="typeChange"
|
|
52
|
+
/>
|
|
53
|
+
<slot name="rightSlot"></slot>
|
|
54
|
+
</AutoCollapseRow>
|
|
55
|
+
<!-- </div> -->
|
|
56
|
+
<slot name="bottomSlot"></slot>
|
|
57
|
+
</div>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script setup lang="ts" name="JztTime">
|
|
61
|
+
import { intersection } from 'lodash-es'
|
|
62
|
+
import { ref, computed, onMounted } from 'vue'
|
|
63
|
+
import { localGetAgencyId, isEmpty } from '@jzt-spd/utils'
|
|
64
|
+
import DateSelect from './comm/dateSelect.vue'
|
|
65
|
+
// import AgencySelect from './comm/agencySelect.vue'
|
|
66
|
+
import DeptSelect from './comm/deptSelect.vue'
|
|
67
|
+
import TypeSelect from './comm/typeSelect.vue'
|
|
68
|
+
import { TimeTypeProps, ToolTypeProps, DateType } from './interface/index'
|
|
69
|
+
import { showTool, getWarehouseLevelOptions, getDateConfig } from './index'
|
|
70
|
+
import { AgencySelectProps } from './comm/agencySelect.vue'
|
|
71
|
+
import { DateSelectProps } from './comm/dateSelect.vue'
|
|
72
|
+
import AutoCollapseRow from './comm/collapseRow.vue'
|
|
73
|
+
import { useRoute } from 'vue-router'
|
|
74
|
+
import dayjs from 'dayjs'
|
|
75
|
+
|
|
76
|
+
interface ProTableProps {
|
|
77
|
+
width?: string // 宽度
|
|
78
|
+
showToolType?: ToolTypeProps[] | boolean // 需要展示的工具类型
|
|
79
|
+
dateSelectProps?: DateSelectProps // 时间选择器参数
|
|
80
|
+
agencySelectProps?: AgencySelectProps // 机构选择框参数
|
|
81
|
+
deptSelectProps?: AgencySelectProps // 机构选择框参数
|
|
82
|
+
// 所选信息
|
|
83
|
+
timeData?: TimeTypeProps // 时间选择器数据
|
|
84
|
+
modelValue?: {
|
|
85
|
+
timeData?: TimeTypeProps // 时间选择器数据
|
|
86
|
+
agencyId?: string // 选择框默认值
|
|
87
|
+
deptId?: string // 科室选择框默认值
|
|
88
|
+
isCharging?: number | string // 计费类型
|
|
89
|
+
isCollect?: number | string //集采类型
|
|
90
|
+
isTempPurch?: number | string //临采类型
|
|
91
|
+
startTime?: string // 开始时间
|
|
92
|
+
endTime?: string // 结束时间
|
|
93
|
+
timeMode?: DateType //'year' | 'quarter' | 'month' | 'custom' | undefined // 结束时间
|
|
94
|
+
WarehouseLevel?: number
|
|
95
|
+
}
|
|
96
|
+
warehouseLevels?: number[] // 仓库等级
|
|
97
|
+
showTimeType?: DateType[] // 允许的日期类型
|
|
98
|
+
}
|
|
99
|
+
const sameChange0 = ['show-warehouseLevel', 'show-dept']
|
|
100
|
+
const sameChange1 = ['show-dateSelect', 'show-date']
|
|
101
|
+
const sameChange2 = ['show-isCharging', 'show-isTempPurch', 'show-isCollect']
|
|
102
|
+
|
|
103
|
+
const lenCount = computed(() => {
|
|
104
|
+
const showToolType = props.showToolType
|
|
105
|
+
if (Array.isArray(showToolType)) {
|
|
106
|
+
let length = showToolType?.length || 0
|
|
107
|
+
const sameLen0 = intersection(sameChange0, showToolType).length || 0
|
|
108
|
+
if (sameLen0 > 1) {
|
|
109
|
+
length -= sameLen0 - 1
|
|
110
|
+
}
|
|
111
|
+
const sameLen1 = intersection(sameChange1, showToolType).length || 0
|
|
112
|
+
if (sameLen1 > 1) {
|
|
113
|
+
length -= sameLen1 - 1
|
|
114
|
+
}
|
|
115
|
+
const sameLen2 = intersection(sameChange2, showToolType).length || 0
|
|
116
|
+
if (sameLen2 > 1) {
|
|
117
|
+
length -= sameLen2 - 1
|
|
118
|
+
}
|
|
119
|
+
return length
|
|
120
|
+
} else {
|
|
121
|
+
return 0
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
// 默认值
|
|
125
|
+
const props = withDefaults(defineProps<ProTableProps>(), {
|
|
126
|
+
width: '297px',
|
|
127
|
+
showToolType: () => [
|
|
128
|
+
'show-date',
|
|
129
|
+
// 'show-agency',
|
|
130
|
+
'show-dateSelect',
|
|
131
|
+
'show-isCharging',
|
|
132
|
+
'show-isCollect',
|
|
133
|
+
'show-isTempPurch',
|
|
134
|
+
'show-dept'
|
|
135
|
+
],
|
|
136
|
+
timeData: () => [],
|
|
137
|
+
modelValue: () => ({
|
|
138
|
+
// timeData: undefined,
|
|
139
|
+
agencyId: localGetAgencyId() || ''
|
|
140
|
+
// deptId: '',
|
|
141
|
+
// isCharging: '',
|
|
142
|
+
// isCollect: 0,
|
|
143
|
+
// isTempPurch: 0,
|
|
144
|
+
// startTime: '',
|
|
145
|
+
// endTime: ''
|
|
146
|
+
}),
|
|
147
|
+
agencySelectProps: () => ({
|
|
148
|
+
selectPla: '请选择机构',
|
|
149
|
+
selectDisabled: true,
|
|
150
|
+
selectParams: {},
|
|
151
|
+
dateSelectProps: () => ({})
|
|
152
|
+
}),
|
|
153
|
+
showTimeType: () => [] // 允许的日期类型
|
|
154
|
+
})
|
|
155
|
+
const emit = defineEmits([
|
|
156
|
+
'update:timeData',
|
|
157
|
+
'update:modelValue',
|
|
158
|
+
'update:selectValue',
|
|
159
|
+
'selectChange',
|
|
160
|
+
'dateSelectChange',
|
|
161
|
+
'agencySelectChange',
|
|
162
|
+
'typeChange',
|
|
163
|
+
'deptSelectChange'
|
|
164
|
+
])
|
|
165
|
+
|
|
166
|
+
// 仓库等级
|
|
167
|
+
const WarehouseLevel = computed(() => {
|
|
168
|
+
if (!isEmpty(props.modelValue.WarehouseLevel)) {
|
|
169
|
+
return props.modelValue.WarehouseLevel
|
|
170
|
+
}
|
|
171
|
+
const { defaultValue } = getWarehouseLevelOptions(props.warehouseLevels)
|
|
172
|
+
return defaultValue
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
// 所选信息集
|
|
176
|
+
const selectFrom = computed({
|
|
177
|
+
get() {
|
|
178
|
+
return {
|
|
179
|
+
...props.modelValue,
|
|
180
|
+
WarehouseLevel: WarehouseLevel.value
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
set(val) {
|
|
184
|
+
// 确保时间数据正确传递
|
|
185
|
+
const timeData = val.timeData || []
|
|
186
|
+
emit('update:modelValue', {
|
|
187
|
+
...val,
|
|
188
|
+
WarehouseLevel: WarehouseLevel.value,
|
|
189
|
+
timeData
|
|
190
|
+
})
|
|
191
|
+
}
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
// 日期选择框改变
|
|
195
|
+
const dateSelectChange = val => {
|
|
196
|
+
if (val.timeMode && showTool(props.showToolType, 'show-dateSelect')) {
|
|
197
|
+
// 日的时候,接口叫:custom
|
|
198
|
+
// const timeMode = val.timeMode == 'custom' ? 'day' : val.timeMode
|
|
199
|
+
// const timeMode = val.timeMode == 'day' ? 'custom' : val.timeMode
|
|
200
|
+
selectFrom.value.timeMode = val.timeMode
|
|
201
|
+
} else {
|
|
202
|
+
delete selectFrom.value.timeMode
|
|
203
|
+
}
|
|
204
|
+
selectFrom.value.startTime = val.startTime
|
|
205
|
+
selectFrom.value.endTime = val.endTime
|
|
206
|
+
selectFrom.value.timeData = [val.startTime, val.endTime]
|
|
207
|
+
selectChange(val)
|
|
208
|
+
}
|
|
209
|
+
// const allDeptIds = ref('') // 全部部门id
|
|
210
|
+
// 日期选择框改变
|
|
211
|
+
const deptChange = val => {
|
|
212
|
+
// allDeptIds.value = val.deptIds || ''
|
|
213
|
+
selectChange(val)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// 集采/临采选择框改变
|
|
217
|
+
const typeChange = typeVal => {
|
|
218
|
+
if (showTool(props.showToolType, 'show-isCharging')) {
|
|
219
|
+
selectFrom.value.isCharging = typeVal.isCharging
|
|
220
|
+
}
|
|
221
|
+
if (showTool(props.showToolType, 'show-isCollect')) {
|
|
222
|
+
selectFrom.value.isCollect = typeVal.isCollect
|
|
223
|
+
}
|
|
224
|
+
if (showTool(props.showToolType, 'show-isTempPurch')) {
|
|
225
|
+
selectFrom.value.isTempPurch = typeVal.isTempPurch
|
|
226
|
+
}
|
|
227
|
+
selectChange(typeVal)
|
|
228
|
+
}
|
|
229
|
+
const initCount = ref(0)
|
|
230
|
+
const selectChange = val => {
|
|
231
|
+
initCount.value++
|
|
232
|
+
|
|
233
|
+
if (initCount.value >= lenCount.value) {
|
|
234
|
+
// const { timeData, ...form } = selectFrom.value
|
|
235
|
+
emit('selectChange', selectFrom.value)
|
|
236
|
+
|
|
237
|
+
// emit('selectChange', form, {
|
|
238
|
+
// allDeptIds: allDeptIds.value
|
|
239
|
+
// })
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
const route = useRoute()
|
|
243
|
+
interface RouteQuery {
|
|
244
|
+
startTime?: string
|
|
245
|
+
endTime?: string
|
|
246
|
+
timeMode?: DateType | 'custom'
|
|
247
|
+
}
|
|
248
|
+
import { formatDateRange } from '@jzt-spd/utils'
|
|
249
|
+
onMounted(() => {
|
|
250
|
+
selectFrom.value.agencyId = props.modelValue?.agencyId || localGetAgencyId()
|
|
251
|
+
if (route.query) {
|
|
252
|
+
const { startTime, endTime, timeMode } = route.query as RouteQuery
|
|
253
|
+
if (startTime && endTime && timeMode) {
|
|
254
|
+
console.log(startTime && endTime && timeMode)
|
|
255
|
+
|
|
256
|
+
if (props.showTimeType.includes(timeMode)) {
|
|
257
|
+
emit('update:timeData', [startTime, endTime])
|
|
258
|
+
selectFrom.value.startTime = startTime ? startTime : selectFrom.value.startTime
|
|
259
|
+
selectFrom.value.endTime = endTime ? endTime : selectFrom.value.endTime
|
|
260
|
+
selectFrom.value.timeMode = timeMode
|
|
261
|
+
} else {
|
|
262
|
+
const defaultStart = startTime ? startTime : selectFrom.value.startTime
|
|
263
|
+
const defaultEnd = endTime ? endTime : selectFrom.value.endTime
|
|
264
|
+
// console.log(getDateConfig(timeMode))
|
|
265
|
+
|
|
266
|
+
const { format, type } = getDateConfig(timeMode)
|
|
267
|
+
// const startTime1 = dayjs(defaultStart).format(format)//defaultStart?.format(formatStr) || ''
|
|
268
|
+
// const endTime1 = dayjs(defaultEnd).format(format)
|
|
269
|
+
|
|
270
|
+
emit('update:timeData', [startTime, endTime])
|
|
271
|
+
selectFrom.value.startTime = defaultStart
|
|
272
|
+
selectFrom.value.endTime = defaultEnd
|
|
273
|
+
selectFrom.value.timeMode = 'month'
|
|
274
|
+
console.log(defaultStart, defaultEnd)
|
|
275
|
+
// const type: DateType = timeDataConfig.value.type
|
|
276
|
+
const res = formatDateRange({
|
|
277
|
+
formatStr: format,
|
|
278
|
+
startTime: defaultStart,
|
|
279
|
+
endTime: defaultEnd,
|
|
280
|
+
type,
|
|
281
|
+
isCurrent: true
|
|
282
|
+
})
|
|
283
|
+
console.log(res)
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
})
|
|
288
|
+
</script>
|
|
289
|
+
|
|
290
|
+
<style lang="scss" scoped>
|
|
291
|
+
.jztTime {
|
|
292
|
+
display: flex;
|
|
293
|
+
flex-wrap: wrap;
|
|
294
|
+
// min-width: 1320px;
|
|
295
|
+
font-size: 14px;
|
|
296
|
+
border-radius: 8px;
|
|
297
|
+
color: #00000066;
|
|
298
|
+
border-radius: 8px;
|
|
299
|
+
padding-top: 8px;
|
|
300
|
+
// background: #f3f7fa;
|
|
301
|
+
padding-left: 0 !important; // 不能设置左边距
|
|
302
|
+
}
|
|
303
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type DateType = 'year' | 'month' | 'day' | 'quarter' | 'custom' | undefined
|
|
2
|
+
export type DateTypeProps = 'year' | 'month' | 'date' | 'yearrange' | 'monthrange' | 'daterange'
|
|
3
|
+
export type TimeTypeProps = number | string | Date | Array<any>
|
|
4
|
+
export type ToolTypeProps =
|
|
5
|
+
| 'show-warehouseLevel'
|
|
6
|
+
| 'show-date'
|
|
7
|
+
| 'show-agency'
|
|
8
|
+
| 'show-dept'
|
|
9
|
+
| 'show-dateSelect'
|
|
10
|
+
| 'show-isCharging'
|
|
11
|
+
| 'show-isCollect'
|
|
12
|
+
| 'show-isTempPurch'
|
|
13
|
+
import { UnitType } from '@jzt-spd/utils'
|
|
14
|
+
export interface IDateOptions<T = any> {
|
|
15
|
+
name: string
|
|
16
|
+
value: string
|
|
17
|
+
type: T
|
|
18
|
+
disableInfo: {
|
|
19
|
+
// 禁用信息
|
|
20
|
+
unit: UnitType // 时间单位
|
|
21
|
+
maxValue: number // 最大值
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
.filter {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
width: 220px;
|
|
4
|
+
height: 100%;
|
|
5
|
+
padding: 18px;
|
|
6
|
+
margin-right: 10px;
|
|
7
|
+
.title {
|
|
8
|
+
margin: 0 0 15px;
|
|
9
|
+
font-size: 18px;
|
|
10
|
+
font-weight: bold;
|
|
11
|
+
color: var(--el-color-info-dark-2);
|
|
12
|
+
letter-spacing: 0.5px;
|
|
13
|
+
}
|
|
14
|
+
.search {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
margin: 0 0 15px;
|
|
18
|
+
.el-icon {
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
transform: rotate(90deg) translateY(-8px);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
.el-scrollbar {
|
|
24
|
+
:deep(.el-tree) {
|
|
25
|
+
height: 80%;
|
|
26
|
+
overflow: auto;
|
|
27
|
+
.el-tree-node__content {
|
|
28
|
+
height: 33px;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
:deep(.el-tree--highlight-current) {
|
|
32
|
+
.el-tree-node.is-current > .el-tree-node__content {
|
|
33
|
+
background-color: var(--el-color-primary);
|
|
34
|
+
.el-tree-node__label,
|
|
35
|
+
.el-tree-node__expand-icon {
|
|
36
|
+
color: white;
|
|
37
|
+
}
|
|
38
|
+
.is-leaf {
|
|
39
|
+
color: transparent;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|