@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,292 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="timeTypeConfig.className" class="mb8 ml8 mr4">
|
|
3
|
+
<div v-if="timeTypeConfig.isShow && timeDataConfig.isScopeType" class="type flx-left-center">
|
|
4
|
+
<el-select
|
|
5
|
+
class="select"
|
|
6
|
+
v-model="timeType"
|
|
7
|
+
:placeholder="''"
|
|
8
|
+
:style="{ width: '60px' }"
|
|
9
|
+
@change="dateSelectChangeHandle"
|
|
10
|
+
@focus="setActive(true)"
|
|
11
|
+
@blur="setActive(false)"
|
|
12
|
+
>
|
|
13
|
+
<el-option v-for="item in getDateOptions" :key="item.name" :label="item.name" :value="item.value" />
|
|
14
|
+
</el-select>
|
|
15
|
+
<div class="separator"></div>
|
|
16
|
+
</div>
|
|
17
|
+
<el-date-picker
|
|
18
|
+
v-bind="$attrs"
|
|
19
|
+
v-model="timeData"
|
|
20
|
+
:unlink-panels="timeTypeConfig.isShow ? false : true"
|
|
21
|
+
:type="pickerType"
|
|
22
|
+
suffix-icon="Calendar"
|
|
23
|
+
:style="timeTypeConfig.style"
|
|
24
|
+
:value-format="timeDataConfig.format"
|
|
25
|
+
:format="timeDataConfig.format"
|
|
26
|
+
:disabled-date="disableFutureDate"
|
|
27
|
+
range-separator="至"
|
|
28
|
+
:shortcuts="timeTypeConfig.shortcuts"
|
|
29
|
+
:clearable="clearable"
|
|
30
|
+
:editable="false"
|
|
31
|
+
@change="changeTime"
|
|
32
|
+
@focus="setActive(true)"
|
|
33
|
+
@blur="setActive(false)"
|
|
34
|
+
@calendar-change="calendarChange"
|
|
35
|
+
@visible-change="visibleChange"
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script setup lang="ts" name="JztTime">
|
|
41
|
+
/**
|
|
42
|
+
* @component 类型日期选择组件
|
|
43
|
+
*/
|
|
44
|
+
import { computed, onMounted, ref, watch } from 'vue'
|
|
45
|
+
import { isEmpty, formatDateRange } from '@jzt-spd/utils'
|
|
46
|
+
import { dateOptions, monthShortcuts, dayShortcuts, getDateConfig, getDefaultDateRange, showTool } from '../index'
|
|
47
|
+
import { DateTypeProps, DateType, TimeTypeProps, ToolTypeProps } from '../interface/index'
|
|
48
|
+
import dayjs from 'dayjs'
|
|
49
|
+
export interface DateSelectProps {
|
|
50
|
+
showToolType?: ToolTypeProps[] | boolean // 需要展示的工具类型
|
|
51
|
+
width?: string // 宽度
|
|
52
|
+
defaultTimeType?: DateType // 默认日期类型
|
|
53
|
+
defaultTimeDate?: TimeTypeProps // 默认日期
|
|
54
|
+
valueFormat?: string // 日期格式
|
|
55
|
+
disabledDate?: Function //日期禁止函数
|
|
56
|
+
isCurrent?: boolean // 是否取到当前日期
|
|
57
|
+
clearable?: boolean // 是否可清空
|
|
58
|
+
dateType?: DateTypeProps // 日期选择器类型
|
|
59
|
+
showTimeType?: DateType[]
|
|
60
|
+
}
|
|
61
|
+
// 默认值
|
|
62
|
+
const props = withDefaults(defineProps<DateSelectProps>(), {
|
|
63
|
+
defaultTimeType: 'month',
|
|
64
|
+
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
65
|
+
isCurrent: true, // 是否取到当前日期 默认:false
|
|
66
|
+
dateType: 'monthrange',
|
|
67
|
+
clearable: false,
|
|
68
|
+
defaultTimeDate: () => [],
|
|
69
|
+
showTimeType: () => [] // 允许的日期类型
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
// 初始化时间数据
|
|
73
|
+
const initTimeData = () => {
|
|
74
|
+
if (props.defaultTimeDate && Array.isArray(props.defaultTimeDate) && props.defaultTimeDate.length) {
|
|
75
|
+
timeData.value = props.defaultTimeDate
|
|
76
|
+
changeTime(props.defaultTimeDate)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const emit = defineEmits(['update:defaultTimeDate', 'update:dateType', 'dateSelectChange'])
|
|
81
|
+
|
|
82
|
+
// 是否选中-- 用于样式修改
|
|
83
|
+
const isActive = ref(false)
|
|
84
|
+
// 日期类型
|
|
85
|
+
const timeType = ref<DateType>('month')
|
|
86
|
+
// 日期类型配置信息
|
|
87
|
+
const timeTypeConfig = computed(() => {
|
|
88
|
+
const isShow = showTool(props.showToolType, 'show-dateSelect')
|
|
89
|
+
const shortcuts = timeType.value == 'month' ? monthShortcuts : timeType.value == 'custom' ? dayShortcuts : undefined
|
|
90
|
+
return {
|
|
91
|
+
isShow,
|
|
92
|
+
className: isShow ? ['select-date flx-left-center', isActive.value ? 'is-active' : ''] : '',
|
|
93
|
+
shortcuts: isShow ? shortcuts : undefined,
|
|
94
|
+
style: isShow ? { width: `calc(${props.width} - 70.5px)` } : { width: `${props.width}` }
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
// 日期类型选中项信息
|
|
98
|
+
const getDateOptions = computed(() => {
|
|
99
|
+
if (props.showTimeType && props.showTimeType.length) {
|
|
100
|
+
return dateOptions.filter(item => props.showTimeType.includes(item.value))
|
|
101
|
+
} else {
|
|
102
|
+
return dateOptions
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
// 日期类型选中项信息
|
|
106
|
+
const typeSelectedItem = computed(() => {
|
|
107
|
+
return dateOptions.filter(item => item.value == timeType.value)[0]
|
|
108
|
+
})
|
|
109
|
+
// 日期选择器类型
|
|
110
|
+
const pickerType = ref<DateTypeProps>(props.dateType)
|
|
111
|
+
// 日期选择器信息
|
|
112
|
+
const dateInfo = ref({
|
|
113
|
+
startTime: '', // 开始日期
|
|
114
|
+
endTime: '', // 结束日期
|
|
115
|
+
endTimeAdd: '' // 结束日期加1s--第二天00:00:00
|
|
116
|
+
})
|
|
117
|
+
// 日期选择器数据
|
|
118
|
+
const timeData = computed({
|
|
119
|
+
get() {
|
|
120
|
+
return props.defaultTimeDate
|
|
121
|
+
},
|
|
122
|
+
set(val) {
|
|
123
|
+
emit('update:defaultTimeDate', val)
|
|
124
|
+
// changeTime(val)
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
// 日期选择器配置信息
|
|
128
|
+
const timeDataConfig = computed(() => {
|
|
129
|
+
return getDateConfig(pickerType.value)
|
|
130
|
+
})
|
|
131
|
+
// 设置激活状态
|
|
132
|
+
const setActive = (val: boolean) => {
|
|
133
|
+
isActive.value = val
|
|
134
|
+
}
|
|
135
|
+
// 日期类型选择框改变
|
|
136
|
+
const dateSelectChangeHandle = (val: string) => {
|
|
137
|
+
pickerType.value = typeSelectedItem.value?.type
|
|
138
|
+
timeData.value = []
|
|
139
|
+
}
|
|
140
|
+
// 范围选择时所选的开始时间
|
|
141
|
+
const curDate = ref<string | number>('')
|
|
142
|
+
const calendarChange = (val: Date[]) => {
|
|
143
|
+
curDate.value = val[0].getTime()
|
|
144
|
+
if (val[1]) {
|
|
145
|
+
curDate.value = ''
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const visibleChange = (val: boolean) => {
|
|
149
|
+
if (timeTypeConfig.value.isShow && !val) {
|
|
150
|
+
setActive(false)
|
|
151
|
+
curDate.value = ''
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
// 日期禁用函数
|
|
155
|
+
const disableFutureDate = (time: Date) => {
|
|
156
|
+
// 自定义函数
|
|
157
|
+
if (props.disabledDate) {
|
|
158
|
+
return props.disabledDate(time)
|
|
159
|
+
}
|
|
160
|
+
// 禁用今天之后的日期
|
|
161
|
+
// 禁用今天(含)之后的日期
|
|
162
|
+
if (dayjs(time).isSame(dayjs(), 'day') || dayjs(time).isAfter(dayjs(), 'day')) {
|
|
163
|
+
return true
|
|
164
|
+
}
|
|
165
|
+
// 根据类型禁用相关日期
|
|
166
|
+
const { unit, maxValue } = typeSelectedItem.value?.disableInfo || {}
|
|
167
|
+
const { isShow } = timeTypeConfig.value
|
|
168
|
+
if (isShow && curDate.value && !isEmpty(maxValue)) {
|
|
169
|
+
const isDay = timeType.value == 'custom' || timeType.value == 'quarter'
|
|
170
|
+
const dateGap = maxValue - (isDay ? 0 : 1)
|
|
171
|
+
let minDate = dayjs(curDate.value).subtract(dateGap, unit).endOf('day')
|
|
172
|
+
let maxDate = dayjs(curDate.value).add(dateGap, unit).endOf('day')
|
|
173
|
+
// 如果是天,则-1天 特殊处理
|
|
174
|
+
if (isDay) {
|
|
175
|
+
maxDate = maxDate.subtract(1, 'day')
|
|
176
|
+
minDate = minDate.subtract(1, 'day')
|
|
177
|
+
}
|
|
178
|
+
const currentDate = dayjs(time).endOf('day')
|
|
179
|
+
return currentDate < minDate || currentDate > maxDate
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// 日期处理与格式化
|
|
184
|
+
const formatDateInfo = (startDate: string, endDate: string) => {
|
|
185
|
+
const type: DateType = timeDataConfig.value.type
|
|
186
|
+
dateInfo.value = formatDateRange({
|
|
187
|
+
formatStr: props.valueFormat,
|
|
188
|
+
startTime: startDate,
|
|
189
|
+
endTime: endDate,
|
|
190
|
+
type,
|
|
191
|
+
isCurrent: props.isCurrent
|
|
192
|
+
})
|
|
193
|
+
}
|
|
194
|
+
// 日期选择框改变
|
|
195
|
+
const changeTime = (timeList: any) => {
|
|
196
|
+
if (isEmpty(timeList)) {
|
|
197
|
+
dateInfo.value = {
|
|
198
|
+
startTime: '',
|
|
199
|
+
endTime: '',
|
|
200
|
+
endTimeAdd: ''
|
|
201
|
+
}
|
|
202
|
+
} else {
|
|
203
|
+
let startDate: any = ''
|
|
204
|
+
let endDate: any = ''
|
|
205
|
+
if (timeTypeConfig.value.isShow || timeDataConfig.value.isScopeType) {
|
|
206
|
+
startDate = timeList?.[0]
|
|
207
|
+
endDate = timeList?.[1]
|
|
208
|
+
} else if (!timeDataConfig.value.isScopeType) {
|
|
209
|
+
startDate = timeData.value
|
|
210
|
+
endDate = timeData.value
|
|
211
|
+
}
|
|
212
|
+
dateInfo.value.startTime = startDate
|
|
213
|
+
dateInfo.value.endTime = endDate
|
|
214
|
+
formatDateInfo(startDate, endDate)
|
|
215
|
+
emit('dateSelectChange', {
|
|
216
|
+
...dateInfo.value,
|
|
217
|
+
...(timeTypeConfig.value.isShow ? { timeMode: timeType.value } : {})
|
|
218
|
+
})
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
// 初始化
|
|
222
|
+
const initData = () => {
|
|
223
|
+
if (timeTypeConfig.value.isShow && isEmpty(props.defaultTimeDate)) {
|
|
224
|
+
// timeData.value = getDefaultDateRange('month')
|
|
225
|
+
const def = getDefaultDateRange('month', true)
|
|
226
|
+
emit('update:defaultTimeDate', def)
|
|
227
|
+
changeTime(def)
|
|
228
|
+
} else {
|
|
229
|
+
// timeData.value = props.defaultTimeDate
|
|
230
|
+
changeTime(timeData.value)
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// 监听 defaultTimeType 变化
|
|
235
|
+
watch(
|
|
236
|
+
() => props.defaultTimeType,
|
|
237
|
+
val => {
|
|
238
|
+
if (val) {
|
|
239
|
+
timeType.value = val
|
|
240
|
+
pickerType.value = typeSelectedItem.value?.type
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
immediate: true
|
|
245
|
+
}
|
|
246
|
+
)
|
|
247
|
+
onMounted(() => {
|
|
248
|
+
initTimeData()
|
|
249
|
+
initData()
|
|
250
|
+
})
|
|
251
|
+
</script>
|
|
252
|
+
|
|
253
|
+
<style lang="scss" scoped>
|
|
254
|
+
.select-date {
|
|
255
|
+
height: 30px;
|
|
256
|
+
box-shadow: 0 0 0 1px var(--el-border-color) inset;
|
|
257
|
+
border-radius: var(--el-border-radius-base) !important;
|
|
258
|
+
padding: 1.5px;
|
|
259
|
+
background-color: #fff;
|
|
260
|
+
.type {
|
|
261
|
+
height: 100%;
|
|
262
|
+
}
|
|
263
|
+
:deep(.el-select),
|
|
264
|
+
:deep(.el-input--default) {
|
|
265
|
+
height: 27px;
|
|
266
|
+
}
|
|
267
|
+
:deep(.el-select__wrapper) {
|
|
268
|
+
box-shadow: none !important;
|
|
269
|
+
text-align: center;
|
|
270
|
+
padding: 0 0 0 10px;
|
|
271
|
+
height: 27px !important;
|
|
272
|
+
min-height: 27px;
|
|
273
|
+
margin-left: 1px;
|
|
274
|
+
}
|
|
275
|
+
:deep(.el-input__wrapper) {
|
|
276
|
+
height: 27px;
|
|
277
|
+
box-shadow: none !important;
|
|
278
|
+
}
|
|
279
|
+
.separator {
|
|
280
|
+
width: 1.5px;
|
|
281
|
+
height: 50%;
|
|
282
|
+
background-color: var(--el-border-color);
|
|
283
|
+
margin: 0 10px;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
.select-date:hover {
|
|
287
|
+
box-shadow: 0 0 0 1px var(--el-border-color-hover) inset;
|
|
288
|
+
}
|
|
289
|
+
.select-date.is-active {
|
|
290
|
+
box-shadow: 0 0 0 1px var(--el-color-primary) inset;
|
|
291
|
+
}
|
|
292
|
+
</style>
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="mb8 pl8 flx-left-center">
|
|
3
|
+
<span v-if="deptLabelText" class="title">{{ deptLabelText }}</span>
|
|
4
|
+
<el-select
|
|
5
|
+
v-if="showTool(showToolType, 'show-warehouseLevel')"
|
|
6
|
+
class="mr12"
|
|
7
|
+
v-model="WarehouseLevel"
|
|
8
|
+
:style="{ width: width }"
|
|
9
|
+
:placeholder="selectPla"
|
|
10
|
+
:disabled="!selectDisabled"
|
|
11
|
+
:empty-values="[null, undefined]"
|
|
12
|
+
:value-on-clear="''"
|
|
13
|
+
filterable
|
|
14
|
+
style="width: 120px"
|
|
15
|
+
>
|
|
16
|
+
<el-option
|
|
17
|
+
v-for="item in warehouseLevelOptions"
|
|
18
|
+
:key="'warehouseLevel' + item.value"
|
|
19
|
+
:label="item.label"
|
|
20
|
+
:value="item.value"
|
|
21
|
+
/>
|
|
22
|
+
</el-select>
|
|
23
|
+
<el-select
|
|
24
|
+
v-if="showTool(showToolType, 'show-dept')"
|
|
25
|
+
class="mr4"
|
|
26
|
+
v-model="deptSelectId"
|
|
27
|
+
:style="{ width: width }"
|
|
28
|
+
:placeholder="selectPla"
|
|
29
|
+
:disabled="!selectDisabled"
|
|
30
|
+
@change="selectChangeHandle"
|
|
31
|
+
:empty-values="[null, undefined]"
|
|
32
|
+
:value-on-clear="''"
|
|
33
|
+
filterable
|
|
34
|
+
style="width: 200px"
|
|
35
|
+
>
|
|
36
|
+
<el-option label="全部科室" value=""></el-option>
|
|
37
|
+
<el-option
|
|
38
|
+
v-for="item in options"
|
|
39
|
+
:key="item[fieldNames.value]"
|
|
40
|
+
:label="item[fieldNames.label]"
|
|
41
|
+
:value="item[fieldNames.value]"
|
|
42
|
+
/>
|
|
43
|
+
</el-select>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script setup lang="ts" name="JztTime">
|
|
48
|
+
import { computed, ref, watch, nextTick } from 'vue'
|
|
49
|
+
import { isEmpty } from '@jzt-spd/utils'
|
|
50
|
+
import { getDeptList } from '@jzt-spd/utils/commonApi'
|
|
51
|
+
import { ToolTypeProps } from '../interface/index'
|
|
52
|
+
import { showTool, getWarehouseLevelOptions } from '../index'
|
|
53
|
+
|
|
54
|
+
export interface AgencySelectProps {
|
|
55
|
+
agencyId?: string // 机构ID
|
|
56
|
+
width?: string // 宽度
|
|
57
|
+
selectPla?: string // 机构选择框提示语
|
|
58
|
+
selectValue?: string | number // 选择框默认值
|
|
59
|
+
selectNames?: {
|
|
60
|
+
label: string // label字段名称
|
|
61
|
+
value: string // value字段名称
|
|
62
|
+
}
|
|
63
|
+
selectApi?: (params: any) => Promise<any> // 选择框数据接口
|
|
64
|
+
selectParams?: any // 选择框接口参数
|
|
65
|
+
selectDisabled?: boolean //是否置灰
|
|
66
|
+
showToolType?: ToolTypeProps[] | boolean // 需要展示的工具类型
|
|
67
|
+
warehouseLevels?: number[] // 仓库等级下拉选项
|
|
68
|
+
WarehouseLevel?: number // 仓库等级
|
|
69
|
+
deptLabelText?: string // 科室选择框label文本
|
|
70
|
+
}
|
|
71
|
+
// 默认值
|
|
72
|
+
const props = withDefaults(defineProps<AgencySelectProps>(), {
|
|
73
|
+
agencyId: '',
|
|
74
|
+
selectPla: '请选择科室',
|
|
75
|
+
selectDisabled: true,
|
|
76
|
+
selectParams: {},
|
|
77
|
+
dateSelectProps: () => ({}),
|
|
78
|
+
deptLabelText: ''
|
|
79
|
+
})
|
|
80
|
+
// 机构默认传参
|
|
81
|
+
const userParams = ref({
|
|
82
|
+
agencyId: props.agencyId,
|
|
83
|
+
isActive: true
|
|
84
|
+
})
|
|
85
|
+
const emit = defineEmits(['update:selectValue', 'deptChange', 'update:WarehouseLevel'])
|
|
86
|
+
// 获取机构层级
|
|
87
|
+
const warehouseLevelOptions = computed(() => {
|
|
88
|
+
const { options } = getWarehouseLevelOptions(props.warehouseLevels)
|
|
89
|
+
return options
|
|
90
|
+
})
|
|
91
|
+
// 下拉框选项
|
|
92
|
+
const options = ref<any[]>([])
|
|
93
|
+
// 下拉框字段
|
|
94
|
+
const fieldNames = computed(() => {
|
|
95
|
+
return {
|
|
96
|
+
label: props.selectNames?.label ?? 'deptName',
|
|
97
|
+
value: props.selectNames?.value ?? 'id'
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
const selectInfo = ref({})
|
|
102
|
+
// 下拉框值
|
|
103
|
+
const deptSelectId = computed({
|
|
104
|
+
get() {
|
|
105
|
+
return props.selectValue
|
|
106
|
+
},
|
|
107
|
+
set(val) {
|
|
108
|
+
emit('update:selectValue', val)
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
// 下拉框值
|
|
112
|
+
const WarehouseLevel = computed({
|
|
113
|
+
get() {
|
|
114
|
+
return props.WarehouseLevel
|
|
115
|
+
},
|
|
116
|
+
set(val) {
|
|
117
|
+
emit('update:WarehouseLevel', val)
|
|
118
|
+
initDeptData(val)
|
|
119
|
+
}
|
|
120
|
+
})
|
|
121
|
+
const allSelectOption = ref({
|
|
122
|
+
id: '',
|
|
123
|
+
deptName: '全部',
|
|
124
|
+
isAll: true
|
|
125
|
+
})
|
|
126
|
+
// 全部选项包含的id集合
|
|
127
|
+
const allDeptIds = ref<string>()
|
|
128
|
+
|
|
129
|
+
// 下拉框改变
|
|
130
|
+
const selectChangeHandle = (val?: number) => {
|
|
131
|
+
const isAll = isEmpty(val)
|
|
132
|
+
|
|
133
|
+
const selectItem = isAll ? allSelectOption : options.value.find(item => item[fieldNames.value.value] === val)
|
|
134
|
+
deptSelectId.value = isAll ? '' : selectItem?.[fieldNames.value.value]
|
|
135
|
+
selectInfo.value = selectItem
|
|
136
|
+
|
|
137
|
+
emit('deptChange', {
|
|
138
|
+
deptId: deptSelectId.value,
|
|
139
|
+
deptInfo: selectInfo.value,
|
|
140
|
+
deptIds: allDeptIds.value
|
|
141
|
+
})
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// 初始化
|
|
145
|
+
const initDeptData = async (val?: number) => {
|
|
146
|
+
const fn = props.selectApi ?? getDeptList
|
|
147
|
+
const res = await fn({
|
|
148
|
+
WarehouseLevel: val ?? WarehouseLevel.value,
|
|
149
|
+
...userParams.value,
|
|
150
|
+
...props.selectParams
|
|
151
|
+
})
|
|
152
|
+
options.value = res?.result ?? []
|
|
153
|
+
const ids = options.value.map(item => item[fieldNames.value.value])
|
|
154
|
+
allDeptIds.value = ids.join(',')
|
|
155
|
+
const selectId = props.selectValue
|
|
156
|
+
const hasVal = selectId && ids.includes(selectId as any)
|
|
157
|
+
|
|
158
|
+
selectChangeHandle(hasVal ? selectId : '')
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
watch(
|
|
162
|
+
() => props.WarehouseLevel,
|
|
163
|
+
val => {
|
|
164
|
+
initDeptData(val)
|
|
165
|
+
}
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
watch(
|
|
169
|
+
() => props.agencyId,
|
|
170
|
+
newVal => {
|
|
171
|
+
if (newVal) {
|
|
172
|
+
nextTick(() => {
|
|
173
|
+
userParams.value.agencyId = newVal
|
|
174
|
+
initDeptData()
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
immediate: true
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
</script>
|
|
183
|
+
|
|
184
|
+
<style lang="scss" scoped>
|
|
185
|
+
.title {
|
|
186
|
+
display: inline-block;
|
|
187
|
+
// width: 75px;
|
|
188
|
+
color: #333333;
|
|
189
|
+
text-align: right;
|
|
190
|
+
font-size: 14px;
|
|
191
|
+
// padding-left: 4px;
|
|
192
|
+
}
|
|
193
|
+
</style>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- <span> -->
|
|
3
|
+
<!-- <div class="flx-left-center"> -->
|
|
4
|
+
<div class="select-item flx-left-center" v-if="showTool(showToolType, 'show-isCharging')">
|
|
5
|
+
<span class="title">计费类型:</span>
|
|
6
|
+
<el-select
|
|
7
|
+
v-model="typeList.isCharging"
|
|
8
|
+
:style="{ width: '120px' }"
|
|
9
|
+
:empty-values="[null, undefined]"
|
|
10
|
+
:value-on-clear="''"
|
|
11
|
+
@change="selectChangeHandle"
|
|
12
|
+
>
|
|
13
|
+
<el-option v-for="item in getTypeEnum('计费', '不')" :key="item.value" :label="item.label" :value="item.value" />
|
|
14
|
+
</el-select>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="select-item flx-left-center" v-if="showTool(showToolType, 'show-isCollect')">
|
|
17
|
+
<span class="title">集采类型:</span>
|
|
18
|
+
<el-select
|
|
19
|
+
v-model="typeList.isCollect"
|
|
20
|
+
:style="{ width: '120px' }"
|
|
21
|
+
:empty-values="[null, undefined]"
|
|
22
|
+
:value-on-clear="''"
|
|
23
|
+
@change="selectChangeHandle"
|
|
24
|
+
>
|
|
25
|
+
<el-option v-for="item in getTypeEnum('集采')" :key="item.value" :label="item.label" :value="item.value" />
|
|
26
|
+
</el-select>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="select-item flx-left-center" v-if="showTool(showToolType, 'show-isTempPurch')">
|
|
29
|
+
<span class="title">临采类型:</span>
|
|
30
|
+
<el-select
|
|
31
|
+
v-model="typeList.isTempPurch"
|
|
32
|
+
:style="{ width: '120px' }"
|
|
33
|
+
:empty-values="[null, undefined]"
|
|
34
|
+
:value-on-clear="''"
|
|
35
|
+
@change="selectChangeHandle"
|
|
36
|
+
>
|
|
37
|
+
<el-option v-for="item in getTypeEnum('临采')" :key="item.value" :label="item.label" :value="item.value" />
|
|
38
|
+
</el-select>
|
|
39
|
+
</div>
|
|
40
|
+
<!-- </div> -->
|
|
41
|
+
<!---->
|
|
42
|
+
<!-- </span> -->
|
|
43
|
+
</template>
|
|
44
|
+
<script setup lang="ts" name="JztTime">
|
|
45
|
+
import { computed, onMounted, ref } from 'vue'
|
|
46
|
+
import { getTypeEnum } from '../index'
|
|
47
|
+
import { ToolTypeProps } from '../interface/index'
|
|
48
|
+
import { showTool } from '../index'
|
|
49
|
+
export interface AgencySelectProps {
|
|
50
|
+
selectFrom?: any // 选择框默认值
|
|
51
|
+
isCollect?: number | string //集采类型
|
|
52
|
+
isTempPurch?: number | string //临采类型
|
|
53
|
+
showToolType?: ToolTypeProps[] | boolean // 需要展示的工具类型
|
|
54
|
+
}
|
|
55
|
+
// 默认值
|
|
56
|
+
const props = withDefaults(defineProps<AgencySelectProps>(), {
|
|
57
|
+
isCollect: 0,
|
|
58
|
+
isTempPurch: 0,
|
|
59
|
+
showToolType: () => []
|
|
60
|
+
})
|
|
61
|
+
interface TypeListProps {
|
|
62
|
+
isCharging?: number | string
|
|
63
|
+
isCollect?: number | string
|
|
64
|
+
isTempPurch?: number | string
|
|
65
|
+
}
|
|
66
|
+
const typeList = ref<TypeListProps>({
|
|
67
|
+
isCharging: props.isCollect,
|
|
68
|
+
isCollect: props.isCollect,
|
|
69
|
+
isTempPurch: props.isTempPurch
|
|
70
|
+
})
|
|
71
|
+
const emit = defineEmits(['typeChange', 'update:isCollect', 'update:isTempPurch'])
|
|
72
|
+
|
|
73
|
+
const selectChangeHandle = () => {
|
|
74
|
+
emit('typeChange', typeList.value)
|
|
75
|
+
}
|
|
76
|
+
onMounted(() => {
|
|
77
|
+
selectChangeHandle()
|
|
78
|
+
})
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
<style lang="scss" scoped>
|
|
82
|
+
.title {
|
|
83
|
+
display: inline-block;
|
|
84
|
+
// width: 75px;
|
|
85
|
+
color: #333333;
|
|
86
|
+
text-align: right;
|
|
87
|
+
font-size: 14px;
|
|
88
|
+
// padding-left: 4px;
|
|
89
|
+
}
|
|
90
|
+
.flx-left-center {
|
|
91
|
+
flex-wrap: nowrap;
|
|
92
|
+
}
|
|
93
|
+
.select-item {
|
|
94
|
+
margin: 0 4px 8px 8px;
|
|
95
|
+
// padding-left: 8px;
|
|
96
|
+
}
|
|
97
|
+
</style>
|