sun-biz 0.0.1-beta.4 → 0.0.1-beta.6
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/dist/components/index.js +1367 -0
- package/dist/components/pro-table/index.d.ts +3 -2
- package/dist/hooks/index.js +469 -0
- package/dist/hooks/use-column&form-config/index.d.ts +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.js +366 -575
- package/package.json +1 -1
|
@@ -0,0 +1,1367 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_vue__ from "vue";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__ from "@sun-toolkit/enums";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__ from "@sun-toolkit/request";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_element_sun__ from "element-sun";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE_sortablejs__ from "sortablejs";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE__element_sun_icons_vue__ from "@element-sun/icons-vue";
|
|
7
|
+
import "i18next-vue";
|
|
8
|
+
const _hoisted_1 = {
|
|
9
|
+
class: "relative pl-4 before:absolute before:left-0 before:top-[20%] before:h-2/3 before:w-1 before:bg-primary"
|
|
10
|
+
};
|
|
11
|
+
/* ESM default export */ const Titlevue_type_script_setup_true_lang_ts_name_sunTitle = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
|
|
12
|
+
__name: 'Title',
|
|
13
|
+
props: {
|
|
14
|
+
title: {
|
|
15
|
+
default: ''
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
setup (__props) {
|
|
19
|
+
const props = __props;
|
|
20
|
+
return (_ctx, _cache)=>((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("h3", (0, __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps)(_ctx.$attrs, {
|
|
21
|
+
class: "flex items-center justify-between"
|
|
22
|
+
}), [
|
|
23
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("span", _hoisted_1, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(props.title), 1),
|
|
24
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.renderSlot)(_ctx.$slots, "default")
|
|
25
|
+
], 16));
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const __exports__ = Titlevue_type_script_setup_true_lang_ts_name_sunTitle;
|
|
29
|
+
/* ESM default export */ const Title = __exports__;
|
|
30
|
+
/**
|
|
31
|
+
* 1-10115-1 根据条件查询菜单的检索方式列表(业务态)
|
|
32
|
+
* @param params
|
|
33
|
+
* @returns
|
|
34
|
+
*/ const queryPatientAccessConfig = (params)=>(0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.dictRequest)('/searchcomponent/queryMenuXSearchTypeByExample', params);
|
|
35
|
+
const queryBizDataList = (params)=>(0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.basicRequest)('/bizsearch/queryBizDataListByExample', {
|
|
36
|
+
...params,
|
|
37
|
+
pageSize: 100,
|
|
38
|
+
pageNum: 1
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* @description: 是否为数组
|
|
42
|
+
*/ function isArray(val) {
|
|
43
|
+
return val && Array.isArray(val);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @description 处理 ProTable 值为数组 || 无数据
|
|
47
|
+
* @param {*} callValue 需要处理的值
|
|
48
|
+
* @returns {String}
|
|
49
|
+
* */ function formatValue(callValue) {
|
|
50
|
+
// 如果当前值为数组,使用 / 拼接(根据需求自定义)
|
|
51
|
+
if (isArray(callValue)) return callValue.length ? callValue.join(' / ') : '--';
|
|
52
|
+
return callValue ?? '--';
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* @description 处理 prop 为多级嵌套的情况,返回的数据 (列如: prop: user.name)
|
|
56
|
+
* @param {Object} row 当前行数据
|
|
57
|
+
* @param {String} prop 当前 prop
|
|
58
|
+
* @returns {*}
|
|
59
|
+
* */ function handleRowAccordingToProp(row, prop) {
|
|
60
|
+
if (!prop?.includes('.')) return row[prop] ?? '--';
|
|
61
|
+
prop.split('.').forEach((item)=>row = row[item] ?? '--');
|
|
62
|
+
return row;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @description 处理 prop,当 prop 为多级嵌套时 ==> 返回最后一级 prop
|
|
66
|
+
* @param {String} prop 当前 prop
|
|
67
|
+
* @returns {String}
|
|
68
|
+
* */ function handleProp(prop) {
|
|
69
|
+
const propArr = prop.split('.');
|
|
70
|
+
if (1 == propArr.length) return prop;
|
|
71
|
+
return propArr[propArr.length - 1];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* @description 递归查找 callValue 对应的 enum 值
|
|
75
|
+
* */ function findItemNested(enumData, callValue, value, children) {
|
|
76
|
+
return enumData.reduce((accumulator, current)=>{
|
|
77
|
+
if (accumulator) return accumulator;
|
|
78
|
+
if (current[value] === callValue) return current;
|
|
79
|
+
if (current[children]) return findItemNested(current[children], callValue, value, children);
|
|
80
|
+
}, null);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* @description 根据枚举列表查询当需要的数据(如果指定了 label 和 value 的 key值,会自动识别格式化)
|
|
84
|
+
* @param {String} callValue 当前单元格值
|
|
85
|
+
* @param {Array} enumData 字典列表
|
|
86
|
+
* @param {Array} fieldNames label && value && children 的 key 值
|
|
87
|
+
* @param {String} type 过滤类型(目前只有 tag)
|
|
88
|
+
* @returns {String}
|
|
89
|
+
* */ function filterEnum(callValue, enumData, fieldNames, type) {
|
|
90
|
+
const value = fieldNames?.value ?? 'value';
|
|
91
|
+
const label = fieldNames?.label ?? 'label';
|
|
92
|
+
const children = fieldNames?.children ?? 'children';
|
|
93
|
+
let filterData = {};
|
|
94
|
+
// 判断 enumData 是否为数组
|
|
95
|
+
if (Array.isArray(enumData)) filterData = findItemNested(enumData, callValue, value, children);
|
|
96
|
+
// 判断是否输出的结果为 tag 类型
|
|
97
|
+
if ('tag' == type) return filterData?.tagType ? filterData.tagType : '';
|
|
98
|
+
return filterData ? filterData[label] : '--';
|
|
99
|
+
}
|
|
100
|
+
// import CopyTextWithTooltip from '@/components/CopyTextWithTooltip/index.vue';
|
|
101
|
+
function _isSlot(s) {
|
|
102
|
+
return 'function' == typeof s || '[object Object]' === Object.prototype.toString.call(s) && !(0, __WEBPACK_EXTERNAL_MODULE_vue__.isVNode)(s);
|
|
103
|
+
}
|
|
104
|
+
const TableColumn = (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
|
|
105
|
+
name: 'TableColumn',
|
|
106
|
+
props: {
|
|
107
|
+
column: {
|
|
108
|
+
required: true,
|
|
109
|
+
type: Object
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
setup (props, { slots }) {
|
|
113
|
+
const enumMap = (0, __WEBPACK_EXTERNAL_MODULE_vue__.inject)('enumMap', (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(new Map())); // 渲染表格数据
|
|
114
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
115
|
+
const renderCellData = (item, scope)=>{
|
|
116
|
+
let result = enumMap.value.get(item.prop) && item.isFilterEnum ? filterEnum(handleRowAccordingToProp(scope.row, item.prop), enumMap.value.get(item.prop), item.fieldNames) : formatValue(handleRowAccordingToProp(scope.row, item.prop));
|
|
117
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)("span", null, [
|
|
118
|
+
item?.supportCopyAndTips ? result // <CopyTextWithTooltip
|
|
119
|
+
: result
|
|
120
|
+
]);
|
|
121
|
+
}; // 获取 tag 类型
|
|
122
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
123
|
+
const getTagType = (item, scope)=>filterEnum(handleRowAccordingToProp(scope.row, item.prop), enumMap.value.get(item.prop), item.fieldNames, 'tag') || 'primary';
|
|
124
|
+
return ()=>{
|
|
125
|
+
const { column } = props;
|
|
126
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(__WEBPACK_EXTERNAL_MODULE_vue__.Fragment, null, [
|
|
127
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("el-table-column"), (0, __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps)(column, {
|
|
128
|
+
align: column.align ?? 'center',
|
|
129
|
+
fixed: !!column.fixed && column.fixed,
|
|
130
|
+
showOverflowTooltip: column.showOverflowTooltip ?? 'operation' !== column.prop
|
|
131
|
+
}), {
|
|
132
|
+
default: (scope)=>{
|
|
133
|
+
let _slot2; // if (column._children)
|
|
134
|
+
// return column._children.map((child) =>
|
|
135
|
+
// RenderTableColumn(child),
|
|
136
|
+
// );
|
|
137
|
+
if (column.render) {
|
|
138
|
+
if (column.editable) {
|
|
139
|
+
let _slot;
|
|
140
|
+
return scope.row.editable ? (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("el-form-item"), {
|
|
141
|
+
style: {
|
|
142
|
+
marginBottom: '0'
|
|
143
|
+
},
|
|
144
|
+
prop: `tableData.${scope.$index}.${column.prop}`,
|
|
145
|
+
rules: column.rules ? column.rules : []
|
|
146
|
+
}, _isSlot(_slot = column.render(scope.row, scope.$index)) ? _slot : {
|
|
147
|
+
default: ()=>[
|
|
148
|
+
_slot
|
|
149
|
+
],
|
|
150
|
+
_: 1
|
|
151
|
+
}, 8, [
|
|
152
|
+
"rules"
|
|
153
|
+
]) : column.render(scope.row, scope.$index);
|
|
154
|
+
}
|
|
155
|
+
return column.render(scope.row, scope.$index);
|
|
156
|
+
}
|
|
157
|
+
if (column.prop && slots[handleProp(column.prop)]) return slots[handleProp(column.prop)](scope);
|
|
158
|
+
if (column.tag) return (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("el-tag"), {
|
|
159
|
+
type: getTagType(column, scope)
|
|
160
|
+
}, _isSlot(_slot2 = renderCellData(column, scope)) ? _slot2 : {
|
|
161
|
+
default: ()=>[
|
|
162
|
+
_slot2
|
|
163
|
+
],
|
|
164
|
+
_: 1
|
|
165
|
+
}, 8, [
|
|
166
|
+
"type"
|
|
167
|
+
]);
|
|
168
|
+
return [
|
|
169
|
+
renderCellData(column, scope)
|
|
170
|
+
];
|
|
171
|
+
},
|
|
172
|
+
header: (scope)=>{
|
|
173
|
+
if (column.headerRender) return column.headerRender(scope);
|
|
174
|
+
if (column.prop && slots[`${handleProp(column.prop)}Header`]) return slots[`${handleProp(column.prop)}Header`](scope);
|
|
175
|
+
return [
|
|
176
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)("span", {
|
|
177
|
+
class: column.columnClass
|
|
178
|
+
}, [
|
|
179
|
+
column.label
|
|
180
|
+
], 2)
|
|
181
|
+
];
|
|
182
|
+
},
|
|
183
|
+
_: 1
|
|
184
|
+
}, 16, [
|
|
185
|
+
"align",
|
|
186
|
+
"fixed",
|
|
187
|
+
"showOverflowTooltip"
|
|
188
|
+
])
|
|
189
|
+
]);
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
/* ESM default export */ const composables_TableColumn = TableColumn;
|
|
194
|
+
// 接受父组件参数,配置默认值
|
|
195
|
+
/* ESM default export */ const TableContainervue_type_script_lang_ts_setup_true_name_ProTableContainer = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
|
|
196
|
+
__name: 'TableContainer',
|
|
197
|
+
props: {
|
|
198
|
+
model: {
|
|
199
|
+
default: ()=>({})
|
|
200
|
+
},
|
|
201
|
+
draggable: {
|
|
202
|
+
type: Boolean
|
|
203
|
+
},
|
|
204
|
+
editable: {
|
|
205
|
+
type: Boolean
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
setup (__props, { expose: __expose }) {
|
|
209
|
+
const props = __props;
|
|
210
|
+
const formRef = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
|
|
211
|
+
__expose(new Proxy({}, {
|
|
212
|
+
get (_target, prop) {
|
|
213
|
+
if (formRef.value) return formRef.value[prop];
|
|
214
|
+
},
|
|
215
|
+
has (_target, prop) {
|
|
216
|
+
if (formRef?.value) return prop in formRef.value;
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
}));
|
|
220
|
+
return (_ctx, _cache)=>_ctx.editable ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElForm), (0, __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps)({
|
|
221
|
+
key: 0,
|
|
222
|
+
model: props.model,
|
|
223
|
+
ref_key: "formRef",
|
|
224
|
+
ref: formRef
|
|
225
|
+
}, _ctx.$attrs), {
|
|
226
|
+
default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
|
|
227
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.renderSlot)(_ctx.$slots, "default")
|
|
228
|
+
]),
|
|
229
|
+
_: 3
|
|
230
|
+
}, 16, [
|
|
231
|
+
"model"
|
|
232
|
+
])) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.renderSlot)(_ctx.$slots, "default", {
|
|
233
|
+
key: 1
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
const TableContainer_exports_ = TableContainervue_type_script_lang_ts_setup_true_name_ProTableContainer;
|
|
238
|
+
/* ESM default export */ const TableContainer = TableContainer_exports_;
|
|
239
|
+
/* ESM default export */ const Paginationvue_type_script_setup_true_lang_ts_name_Pagination = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
|
|
240
|
+
__name: 'Pagination',
|
|
241
|
+
props: {
|
|
242
|
+
pageInfo: {},
|
|
243
|
+
pageSizes: {},
|
|
244
|
+
handleSizeChange: {
|
|
245
|
+
type: Function
|
|
246
|
+
},
|
|
247
|
+
handleCurrentChange: {
|
|
248
|
+
type: Function
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
setup (__props) {
|
|
252
|
+
return (_ctx, _cache)=>((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElPagination), (0, __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps)({
|
|
253
|
+
"current-page": _ctx.pageInfo.pageNumber,
|
|
254
|
+
"page-size": _ctx.pageInfo.pageSize,
|
|
255
|
+
total: _ctx.pageInfo.total,
|
|
256
|
+
"page-sizes": _ctx.pageSizes,
|
|
257
|
+
layout: "total, sizes, prev, pager, next",
|
|
258
|
+
onSizeChange: _ctx.handleSizeChange,
|
|
259
|
+
onCurrentChange: _ctx.handleCurrentChange,
|
|
260
|
+
"set-scroll-top": 500,
|
|
261
|
+
background: ""
|
|
262
|
+
}, _ctx.$attrs), null, 16, [
|
|
263
|
+
"current-page",
|
|
264
|
+
"page-size",
|
|
265
|
+
"total",
|
|
266
|
+
"page-sizes",
|
|
267
|
+
"onSizeChange",
|
|
268
|
+
"onCurrentChange"
|
|
269
|
+
]));
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
const Pagination_exports_ = Paginationvue_type_script_setup_true_lang_ts_name_Pagination;
|
|
273
|
+
/* ESM default export */ const Pagination = Pagination_exports_;
|
|
274
|
+
const pro_tablevue_type_script_lang_ts_setup_true_name_ProTable_hoisted_1 = {
|
|
275
|
+
class: "relative flex flex-1 flex-col overflow-hidden"
|
|
276
|
+
};
|
|
277
|
+
// import DbgridComponentSetting from '../DbgridComponentSetting/index.vue';
|
|
278
|
+
// 接受父组件参数,配置默认值
|
|
279
|
+
/* ESM default export */ const pro_tablevue_type_script_lang_ts_setup_true_name_ProTable = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
|
|
280
|
+
__name: 'index',
|
|
281
|
+
props: {
|
|
282
|
+
columns: {
|
|
283
|
+
default: ()=>[]
|
|
284
|
+
},
|
|
285
|
+
data: {
|
|
286
|
+
default: ()=>[]
|
|
287
|
+
},
|
|
288
|
+
pagination: {
|
|
289
|
+
type: Boolean,
|
|
290
|
+
default: false
|
|
291
|
+
},
|
|
292
|
+
pageInfo: {
|
|
293
|
+
default: void 0
|
|
294
|
+
},
|
|
295
|
+
componentNo: {
|
|
296
|
+
default: ''
|
|
297
|
+
},
|
|
298
|
+
fetchData: {
|
|
299
|
+
type: Function,
|
|
300
|
+
default: void 0
|
|
301
|
+
},
|
|
302
|
+
draggable: {
|
|
303
|
+
type: Boolean,
|
|
304
|
+
default: false
|
|
305
|
+
},
|
|
306
|
+
editable: {
|
|
307
|
+
type: Boolean,
|
|
308
|
+
default: false
|
|
309
|
+
},
|
|
310
|
+
rowKey: {
|
|
311
|
+
default: 'id'
|
|
312
|
+
},
|
|
313
|
+
loading: {
|
|
314
|
+
type: Boolean,
|
|
315
|
+
default: false
|
|
316
|
+
},
|
|
317
|
+
pageSizes: {
|
|
318
|
+
default: ()=>[
|
|
319
|
+
10,
|
|
320
|
+
25,
|
|
321
|
+
50,
|
|
322
|
+
100
|
|
323
|
+
]
|
|
324
|
+
},
|
|
325
|
+
filterObj: {
|
|
326
|
+
default: ()=>({})
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
emits: [
|
|
330
|
+
"drag-end",
|
|
331
|
+
"size-page-change",
|
|
332
|
+
"current-page-change"
|
|
333
|
+
],
|
|
334
|
+
setup (__props, { expose: __expose, emit: __emit }) {
|
|
335
|
+
const props = __props;
|
|
336
|
+
let state = (0, __WEBPACK_EXTERNAL_MODULE_vue__.reactive)({
|
|
337
|
+
// 表格数据
|
|
338
|
+
tableData: props.data,
|
|
339
|
+
loading: false,
|
|
340
|
+
// 分页数据
|
|
341
|
+
pageInfo: {
|
|
342
|
+
// 当前页数
|
|
343
|
+
pageNumber: 1,
|
|
344
|
+
// 每页显示条数
|
|
345
|
+
pageSize: 10,
|
|
346
|
+
// 总条数
|
|
347
|
+
total: 0
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
const serveColumn = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)([]);
|
|
351
|
+
const columnTypes = [
|
|
352
|
+
'selection',
|
|
353
|
+
'radio',
|
|
354
|
+
'index',
|
|
355
|
+
'expand',
|
|
356
|
+
'sort'
|
|
357
|
+
];
|
|
358
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
|
|
359
|
+
const formRef = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
|
|
360
|
+
// 生成组件唯一id
|
|
361
|
+
const uuid = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)((0, __WEBPACK_EXTERNAL_MODULE_vue__.useId)());
|
|
362
|
+
// 定义 emit 事件
|
|
363
|
+
const emit = __emit;
|
|
364
|
+
/***
|
|
365
|
+
* 表格拖拽排序
|
|
366
|
+
**/ const initDragSort = ()=>{
|
|
367
|
+
const tbody = document.querySelector(`#${uuid.value} tbody`);
|
|
368
|
+
if (tbody) __WEBPACK_EXTERNAL_MODULE_sortablejs__["default"].create(tbody, {
|
|
369
|
+
handle: '.cursor-move',
|
|
370
|
+
animation: 300,
|
|
371
|
+
onEnd (evt) {
|
|
372
|
+
const { newIndex, oldIndex } = evt;
|
|
373
|
+
if (newIndex === oldIndex || void 0 === newIndex || void 0 === oldIndex) return;
|
|
374
|
+
//获取拖动后的排序
|
|
375
|
+
const data = [
|
|
376
|
+
...state.tableData
|
|
377
|
+
];
|
|
378
|
+
const [removedItem] = data.splice(oldIndex, 1);
|
|
379
|
+
data.splice(newIndex, 0, removedItem);
|
|
380
|
+
emit('drag-end', data);
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
};
|
|
384
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>props.data, (newValue)=>{
|
|
385
|
+
state.tableData = newValue;
|
|
386
|
+
state.pageInfo.total = (newValue || []).length;
|
|
387
|
+
});
|
|
388
|
+
// async function fetchDbgridComponent() {
|
|
389
|
+
// let [, result] = await queryDbgridComponentByExample({
|
|
390
|
+
// componentNo: props.componentNo || '',
|
|
391
|
+
// });
|
|
392
|
+
// if (result?.success) {
|
|
393
|
+
// try {
|
|
394
|
+
// let column =
|
|
395
|
+
// (result.data.dbgridSettingValue &&
|
|
396
|
+
// JSON.parse(result.data.dbgridSettingValue)) ||
|
|
397
|
+
// [];
|
|
398
|
+
// serveColumn.value = column;
|
|
399
|
+
// } catch (error) {
|
|
400
|
+
// console.log(error);
|
|
401
|
+
// }
|
|
402
|
+
// }
|
|
403
|
+
// }
|
|
404
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.onMounted)(()=>{
|
|
405
|
+
// 支持拖拽排序
|
|
406
|
+
if (props.draggable) (0, __WEBPACK_EXTERNAL_MODULE_vue__.nextTick)(()=>{
|
|
407
|
+
initDragSort();
|
|
408
|
+
});
|
|
409
|
+
// if (props.componentNo) {
|
|
410
|
+
// fetchDbgridComponent();
|
|
411
|
+
// }
|
|
412
|
+
if (props.pagination && props?.fetchData) fetchList();
|
|
413
|
+
});
|
|
414
|
+
/**
|
|
415
|
+
* 获取列表
|
|
416
|
+
*/ async function fetchList() {
|
|
417
|
+
state.loading = true;
|
|
418
|
+
let { total = 0, data = [] } = await (props.fetchData && props.fetchData(state.pageInfo)) || {};
|
|
419
|
+
state.pageInfo.total = Number(total);
|
|
420
|
+
state.tableData = data;
|
|
421
|
+
state.loading = false;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* 分页组件改变 pageNumber 事件
|
|
425
|
+
*/ const handleSizeChange = (val)=>{
|
|
426
|
+
if (props.fetchData) {
|
|
427
|
+
state.pageInfo.pageNumber = 1;
|
|
428
|
+
state.pageInfo.pageSize = val;
|
|
429
|
+
fetchList();
|
|
430
|
+
} else emit('size-page-change', val);
|
|
431
|
+
};
|
|
432
|
+
/**
|
|
433
|
+
* 分页组件改变 当前页数 事件
|
|
434
|
+
*/ function changeCurrentPage(val) {
|
|
435
|
+
if (props.fetchData) {
|
|
436
|
+
state.pageInfo.pageNumber = val;
|
|
437
|
+
fetchList();
|
|
438
|
+
} else emit('current-page-change', val);
|
|
439
|
+
}
|
|
440
|
+
// 超级表格 ref
|
|
441
|
+
const proTableRef = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
|
|
442
|
+
const selections = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
|
|
443
|
+
// 设置当前行激活态
|
|
444
|
+
const setCurrentRow = (row)=>{
|
|
445
|
+
if (proTableRef.value) proTableRef.value.setCurrentRow(row);
|
|
446
|
+
};
|
|
447
|
+
// 分页配置信息
|
|
448
|
+
const paginationInfo = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>props.pageInfo ?? state.pageInfo);
|
|
449
|
+
/**
|
|
450
|
+
* 支持根据传递的filterObj完成过滤
|
|
451
|
+
*/ const tableData = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>{
|
|
452
|
+
if (Object.keys(props.filterObj).length) return [
|
|
453
|
+
...state.tableData
|
|
454
|
+
].filter((item)=>Object.keys(props.filterObj).every((cur)=>!props.filterObj[cur] && [
|
|
455
|
+
'',
|
|
456
|
+
void 0,
|
|
457
|
+
null
|
|
458
|
+
].includes(props.filterObj[cur]) || item[cur] === props.filterObj[cur]));
|
|
459
|
+
return state.tableData;
|
|
460
|
+
});
|
|
461
|
+
__expose({
|
|
462
|
+
selections,
|
|
463
|
+
tableData,
|
|
464
|
+
setCurrentRow,
|
|
465
|
+
proTableRef,
|
|
466
|
+
eleTable: new Proxy({}, {
|
|
467
|
+
get (_target, prop) {
|
|
468
|
+
return proTableRef.value?.[prop];
|
|
469
|
+
}
|
|
470
|
+
}),
|
|
471
|
+
formRef: new Proxy({}, {
|
|
472
|
+
get (_target, prop) {
|
|
473
|
+
return formRef.value?.[prop];
|
|
474
|
+
},
|
|
475
|
+
has (_target, prop) {
|
|
476
|
+
return prop in formRef.value;
|
|
477
|
+
}
|
|
478
|
+
}),
|
|
479
|
+
validateRow: (index, callback)=>{
|
|
480
|
+
const validateProps = props.columns.filter((item)=>item.rules).map((item)=>`tableData.${index}.${item.prop}`);
|
|
481
|
+
return formRef.value.validateField(validateProps, callback);
|
|
482
|
+
},
|
|
483
|
+
fetchList: (init = true, initPageInfo = {
|
|
484
|
+
pageNumber: 1
|
|
485
|
+
})=>{
|
|
486
|
+
if (init) state.pageInfo = {
|
|
487
|
+
...state.pageInfo,
|
|
488
|
+
...initPageInfo
|
|
489
|
+
};
|
|
490
|
+
fetchList();
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
/**
|
|
494
|
+
* 处理接口和本地的columns
|
|
495
|
+
*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>{
|
|
496
|
+
if (!serveColumn.value?.length) return props.columns;
|
|
497
|
+
let curColums = [
|
|
498
|
+
...props.columns
|
|
499
|
+
];
|
|
500
|
+
curColums = curColums.map((item, index)=>{
|
|
501
|
+
let findObj = serveColumn.value.find((cur)=>cur.prop === item.prop);
|
|
502
|
+
return {
|
|
503
|
+
...item,
|
|
504
|
+
sort: index + 1,
|
|
505
|
+
...findObj
|
|
506
|
+
};
|
|
507
|
+
}).filter((item)=>item.displayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.YES);
|
|
508
|
+
curColums.sort((a, b)=>Number(a.sort) - Number(b.sort));
|
|
509
|
+
return curColums;
|
|
510
|
+
});
|
|
511
|
+
return (_ctx, _cache)=>{
|
|
512
|
+
const _directive_loading = (0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveDirective)("loading");
|
|
513
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("div", pro_tablevue_type_script_lang_ts_setup_true_name_ProTable_hoisted_1, [
|
|
514
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(TableContainer, {
|
|
515
|
+
ref_key: "formRef",
|
|
516
|
+
ref: formRef,
|
|
517
|
+
editable: _ctx.editable,
|
|
518
|
+
model: (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(state),
|
|
519
|
+
class: "flex flex-1 flex-col overflow-hidden"
|
|
520
|
+
}, {
|
|
521
|
+
default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
|
|
522
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.withDirectives)(((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElTable), (0, __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps)({
|
|
523
|
+
id: uuid.value,
|
|
524
|
+
ref_key: "proTableRef",
|
|
525
|
+
ref: proTableRef,
|
|
526
|
+
data: tableData.value,
|
|
527
|
+
style: {
|
|
528
|
+
width: "100%"
|
|
529
|
+
},
|
|
530
|
+
class: "min-h-0 flex-1 overflow-auto",
|
|
531
|
+
"row-key": props.rowKey,
|
|
532
|
+
"cell-class-name": ({ column })=>_ctx.draggable && 'operation' !== column.property ? 'cursor-move' : '',
|
|
533
|
+
border: ""
|
|
534
|
+
}, _ctx.$attrs), {
|
|
535
|
+
default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
|
|
536
|
+
((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(true), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)(__WEBPACK_EXTERNAL_MODULE_vue__.Fragment, null, (0, __WEBPACK_EXTERNAL_MODULE_vue__.renderList)(_ctx.columns.filter((item)=>!item.isHidden), (item, index)=>((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)(__WEBPACK_EXTERNAL_MODULE_vue__.Fragment, null, [
|
|
537
|
+
item.type && columnTypes.includes(item.type) ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElTableColumn), (0, __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps)({
|
|
538
|
+
key: 0,
|
|
539
|
+
ref_for: true
|
|
540
|
+
}, item, {
|
|
541
|
+
key: item.prop ?? index,
|
|
542
|
+
align: item.align ?? 'center',
|
|
543
|
+
"reserve-selection": 'selection' == item.type
|
|
544
|
+
}), {
|
|
545
|
+
default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)((scope)=>[
|
|
546
|
+
'expand' == item.type ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)(__WEBPACK_EXTERNAL_MODULE_vue__.Fragment, {
|
|
547
|
+
key: 0
|
|
548
|
+
}, [
|
|
549
|
+
item.render ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)((0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveDynamicComponent)(item.render), (0, __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps)({
|
|
550
|
+
key: 0,
|
|
551
|
+
ref_for: true
|
|
552
|
+
}, scope), null, 16)) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.renderSlot)(_ctx.$slots, item.type, (0, __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps)({
|
|
553
|
+
key: 1,
|
|
554
|
+
ref_for: true
|
|
555
|
+
}, scope))
|
|
556
|
+
], 64)) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true),
|
|
557
|
+
'sort' == item.type ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElTag), {
|
|
558
|
+
key: 1,
|
|
559
|
+
class: "move"
|
|
560
|
+
}, {
|
|
561
|
+
default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
|
|
562
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElIcon), null, {
|
|
563
|
+
default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
|
|
564
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE__element_sun_icons_vue__.DCaret))
|
|
565
|
+
]),
|
|
566
|
+
_: 1
|
|
567
|
+
})
|
|
568
|
+
]),
|
|
569
|
+
_: 1
|
|
570
|
+
})) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true)
|
|
571
|
+
]),
|
|
572
|
+
_: 2
|
|
573
|
+
}, 1040, [
|
|
574
|
+
"align",
|
|
575
|
+
"reserve-selection"
|
|
576
|
+
])) : ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(composables_TableColumn), {
|
|
577
|
+
key: 1,
|
|
578
|
+
column: item
|
|
579
|
+
}, (0, __WEBPACK_EXTERNAL_MODULE_vue__.createSlots)({
|
|
580
|
+
_: 2
|
|
581
|
+
}, [
|
|
582
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.renderList)(Object.keys(_ctx.$slots), (slot)=>({
|
|
583
|
+
name: slot,
|
|
584
|
+
fn: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)((scope)=>[
|
|
585
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.renderSlot)(_ctx.$slots, slot, (0, __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps)({
|
|
586
|
+
ref_for: true
|
|
587
|
+
}, scope))
|
|
588
|
+
])
|
|
589
|
+
}))
|
|
590
|
+
]), 1032, [
|
|
591
|
+
"column"
|
|
592
|
+
]))
|
|
593
|
+
], 64))), 256))
|
|
594
|
+
]),
|
|
595
|
+
_: 3
|
|
596
|
+
}, 16, [
|
|
597
|
+
"id",
|
|
598
|
+
"data",
|
|
599
|
+
"row-key",
|
|
600
|
+
"cell-class-name"
|
|
601
|
+
])), [
|
|
602
|
+
[
|
|
603
|
+
_directive_loading,
|
|
604
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(state).loading || props.loading
|
|
605
|
+
]
|
|
606
|
+
])
|
|
607
|
+
]),
|
|
608
|
+
_: 3
|
|
609
|
+
}, 8, [
|
|
610
|
+
"editable",
|
|
611
|
+
"model"
|
|
612
|
+
]),
|
|
613
|
+
props.pagination ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)(Pagination, {
|
|
614
|
+
key: 0,
|
|
615
|
+
class: "mt-5 flex justify-end",
|
|
616
|
+
"page-info": paginationInfo.value,
|
|
617
|
+
"page-sizes": props.pageSizes,
|
|
618
|
+
"handle-size-change": handleSizeChange,
|
|
619
|
+
"handle-current-change": changeCurrentPage
|
|
620
|
+
}, null, 8, [
|
|
621
|
+
"page-info",
|
|
622
|
+
"page-sizes"
|
|
623
|
+
])) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true)
|
|
624
|
+
]);
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
const pro_table_exports_ = pro_tablevue_type_script_lang_ts_setup_true_name_ProTable;
|
|
629
|
+
/* ESM default export */ const pro_table = pro_table_exports_;
|
|
630
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */ // support refreshDeps & ready
|
|
631
|
+
const useAutoRunPlugin_useAutoRunPlugin = (fetchInstance, { manual, ready = true, refreshDeps = [], refreshDepsAction })=>{
|
|
632
|
+
const hasAutoRun = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
|
|
633
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.watchEffect)(()=>{
|
|
634
|
+
if (!manual && true !== fetchInstance.options.refreshDeps) hasAutoRun.value = (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(ready);
|
|
635
|
+
});
|
|
636
|
+
if (refreshDeps instanceof Array) (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)([
|
|
637
|
+
hasAutoRun,
|
|
638
|
+
...refreshDeps
|
|
639
|
+
], ([autoRun])=>{
|
|
640
|
+
if (!autoRun) return;
|
|
641
|
+
if (!manual && autoRun) {
|
|
642
|
+
if (refreshDepsAction) refreshDepsAction();
|
|
643
|
+
else fetchInstance.refresh();
|
|
644
|
+
}
|
|
645
|
+
}, {
|
|
646
|
+
deep: true,
|
|
647
|
+
immediate: false
|
|
648
|
+
});
|
|
649
|
+
else (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(hasAutoRun, (h)=>{
|
|
650
|
+
if (!manual && h) {
|
|
651
|
+
if (refreshDepsAction) refreshDepsAction();
|
|
652
|
+
else fetchInstance.refresh();
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
return {
|
|
656
|
+
name: 'autoRunPlugin',
|
|
657
|
+
onBefore: ()=>{
|
|
658
|
+
if (!(0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(ready)) return {
|
|
659
|
+
stopNow: true
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
};
|
|
664
|
+
useAutoRunPlugin_useAutoRunPlugin.onInit = ({ ready = true, manual })=>({
|
|
665
|
+
loading: !manual && (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(ready)
|
|
666
|
+
});
|
|
667
|
+
Symbol('USEREQUEST_GLOBAL_OPTIONS_PROVIDE_KEY');
|
|
668
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */ new Map();
|
|
669
|
+
function unrefElement(elRef) {
|
|
670
|
+
const plain = (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(elRef);
|
|
671
|
+
return plain?.$el ?? plain;
|
|
672
|
+
}
|
|
673
|
+
function findActiveIndexByDirection(options) {
|
|
674
|
+
const { data, direction, column, activeItem, rowKey, scrollTo } = options;
|
|
675
|
+
let currentIndex = data.findIndex((item)=>item[rowKey] === activeItem?.[rowKey]);
|
|
676
|
+
const isYDirection = "ArrowUp" === direction || "ArrowDown" === direction;
|
|
677
|
+
if (column) {
|
|
678
|
+
if ("ArrowUp" === direction) currentIndex = Math.max(0, currentIndex - column);
|
|
679
|
+
else if ("ArrowDown" === direction) currentIndex = Math.min(data.length - 1, currentIndex + column);
|
|
680
|
+
if ("ArrowLeft" === direction) currentIndex = (currentIndex - 1 + data.length) % data.length;
|
|
681
|
+
else if ("ArrowRight" === direction) currentIndex = (currentIndex + 1) % data.length;
|
|
682
|
+
} else if ("ArrowUp" === direction) currentIndex = (currentIndex - 1 + data.length) % data.length;
|
|
683
|
+
else if ("ArrowDown" === direction) currentIndex = (currentIndex + 1) % data.length;
|
|
684
|
+
if (scrollTo && -1 !== currentIndex && isYDirection) scrollTo(Math.floor(currentIndex / (column || 1)));
|
|
685
|
+
return currentIndex;
|
|
686
|
+
}
|
|
687
|
+
function useSelectByDirectionEvent(options) {
|
|
688
|
+
const { triggerRef, scrollTo, data, activeItem, rowKey, column, rowHeight = 36, setCurrentItem, enter } = options;
|
|
689
|
+
const handleKeydown = (event)=>{
|
|
690
|
+
const { code } = event;
|
|
691
|
+
if (enter && "Enter" === code) {
|
|
692
|
+
enter(event);
|
|
693
|
+
return;
|
|
694
|
+
}
|
|
695
|
+
const directionData = (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(data);
|
|
696
|
+
const currentIndex = findActiveIndexByDirection({
|
|
697
|
+
data: directionData || [],
|
|
698
|
+
activeItem: (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(activeItem) ?? directionData?.[0],
|
|
699
|
+
rowKey,
|
|
700
|
+
direction: code,
|
|
701
|
+
column,
|
|
702
|
+
scrollTo: (index)=>{
|
|
703
|
+
scrollTo({
|
|
704
|
+
top: rowHeight * index,
|
|
705
|
+
left: 0,
|
|
706
|
+
behavior: 'smooth'
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
if (-1 !== currentIndex && directionData?.[currentIndex]) {
|
|
711
|
+
if (setCurrentItem) setCurrentItem(directionData[currentIndex]);
|
|
712
|
+
}
|
|
713
|
+
};
|
|
714
|
+
const cleanups = [];
|
|
715
|
+
const cleanup = ()=>{
|
|
716
|
+
cleanups.forEach((fn)=>fn());
|
|
717
|
+
cleanups.length = 0;
|
|
718
|
+
};
|
|
719
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>unrefElement(triggerRef), (target)=>{
|
|
720
|
+
if (target) {
|
|
721
|
+
cleanup();
|
|
722
|
+
target.addEventListener('keydown', handleKeydown);
|
|
723
|
+
cleanups.push(()=>{
|
|
724
|
+
target.removeEventListener('keydown', handleKeydown);
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
}, {
|
|
728
|
+
immediate: true,
|
|
729
|
+
flush: 'post'
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
/* ESM default export */ const use_direction_select = useSelectByDirectionEvent;
|
|
733
|
+
/* ESM default export */ const AccessInputvue_type_script_setup_true_lang_ts = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
|
|
734
|
+
__name: 'AccessInput',
|
|
735
|
+
props: /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.mergeModels)({
|
|
736
|
+
activeAccessWay: {},
|
|
737
|
+
accessResult: {},
|
|
738
|
+
searchLoading: {
|
|
739
|
+
type: Boolean
|
|
740
|
+
}
|
|
741
|
+
}, {
|
|
742
|
+
modelValue: {},
|
|
743
|
+
modelModifiers: {}
|
|
744
|
+
}),
|
|
745
|
+
emits: /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.mergeModels)([
|
|
746
|
+
"enter",
|
|
747
|
+
"select"
|
|
748
|
+
], [
|
|
749
|
+
"update:modelValue"
|
|
750
|
+
]),
|
|
751
|
+
setup (__props, { expose: __expose, emit: __emit }) {
|
|
752
|
+
const model = (0, __WEBPACK_EXTERNAL_MODULE_vue__.useModel)(__props, "modelValue");
|
|
753
|
+
const emits = __emit;
|
|
754
|
+
const inputRef = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
|
|
755
|
+
const visible = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
|
|
756
|
+
const tableRef = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
|
|
757
|
+
const currentRow = (0, __WEBPACK_EXTERNAL_MODULE_vue__.shallowRef)();
|
|
758
|
+
const columns = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>__props.accessResult.columns.filter((item)=>item.display === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG_STR.YES).map((item)=>({
|
|
759
|
+
...item,
|
|
760
|
+
label: item.title,
|
|
761
|
+
prop: item.dataIndex
|
|
762
|
+
})));
|
|
763
|
+
const patientList = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>__props.accessResult.data);
|
|
764
|
+
const setCurrentRow = (row)=>{
|
|
765
|
+
currentRow.value = row;
|
|
766
|
+
tableRef.value?.setCurrentRow(row);
|
|
767
|
+
};
|
|
768
|
+
/** 监听键盘方向事件 支持方向盘上下切换table 目标行 */ use_direction_select({
|
|
769
|
+
triggerRef: inputRef,
|
|
770
|
+
rowKey: 'patientId',
|
|
771
|
+
data: patientList,
|
|
772
|
+
activeItem: currentRow,
|
|
773
|
+
setCurrentItem: setCurrentRow,
|
|
774
|
+
scrollTo: (params)=>{
|
|
775
|
+
tableRef?.value.eleTable.scrollTo(params);
|
|
776
|
+
},
|
|
777
|
+
enter: (e)=>{
|
|
778
|
+
console.log(e);
|
|
779
|
+
const { code } = e;
|
|
780
|
+
/** 当没有检索结果数据或者正在检索中时 触发 enter 检索事件 */ if (!visible.value || __props.searchLoading || !__props.accessResult.data || !__props.accessResult.data.length) {
|
|
781
|
+
if (code === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.KEY_CODE.ENTER) emits('enter', e);
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
const primaryKey = __props.accessResult.primaryKey;
|
|
785
|
+
const rowList = __props.accessResult.data;
|
|
786
|
+
const currentRowId = currentRow?.value?.[primaryKey];
|
|
787
|
+
/** 当有检索结果数据时,通过 enter 事件触发 select */ if (code === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.KEY_CODE.ENTER && currentRowId) {
|
|
788
|
+
const selectData = rowList?.find((item)=>item?.[primaryKey] === currentRowId);
|
|
789
|
+
if (selectData) handleSelectRow(selectData);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
const show = ()=>{
|
|
794
|
+
visible.value = true;
|
|
795
|
+
};
|
|
796
|
+
const hide = ()=>{
|
|
797
|
+
visible.value = false;
|
|
798
|
+
};
|
|
799
|
+
const handleReferenceClick = ()=>{
|
|
800
|
+
if (__props.accessResult.data?.length > 1 && !visible.value && !__props.searchLoading) show();
|
|
801
|
+
};
|
|
802
|
+
const handleSelectRow = (row)=>{
|
|
803
|
+
emits('select', row);
|
|
804
|
+
};
|
|
805
|
+
const handleCurrentChange = (rowData)=>{
|
|
806
|
+
setCurrentRow(rowData);
|
|
807
|
+
};
|
|
808
|
+
__expose({
|
|
809
|
+
focus: ()=>{
|
|
810
|
+
inputRef.value?.focus();
|
|
811
|
+
},
|
|
812
|
+
setCurrentRow,
|
|
813
|
+
show,
|
|
814
|
+
hide
|
|
815
|
+
});
|
|
816
|
+
return (_ctx, _cache)=>((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElPopover), {
|
|
817
|
+
visible: visible.value,
|
|
818
|
+
width: "70vw",
|
|
819
|
+
trigger: "hover",
|
|
820
|
+
placement: "bottom",
|
|
821
|
+
"show-arrow": false
|
|
822
|
+
}, {
|
|
823
|
+
reference: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
|
|
824
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElInput), {
|
|
825
|
+
ref_key: "inputRef",
|
|
826
|
+
ref: inputRef,
|
|
827
|
+
placeholder: _ctx.activeAccessWay?.inputHintContent || _ctx.activeAccessWay?.bizSearchTypeNameDisplay,
|
|
828
|
+
modelValue: model.value,
|
|
829
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event)=>model.value = $event),
|
|
830
|
+
autofocus: true,
|
|
831
|
+
onClick: handleReferenceClick,
|
|
832
|
+
class: "w-[284px] flex-shrink-0 flex-grow-0"
|
|
833
|
+
}, (0, __WEBPACK_EXTERNAL_MODULE_vue__.createSlots)({
|
|
834
|
+
_: 2
|
|
835
|
+
}, [
|
|
836
|
+
_ctx.searchLoading ? {
|
|
837
|
+
name: "suffix",
|
|
838
|
+
fn: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
|
|
839
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElIcon), {
|
|
840
|
+
class: "is-loading"
|
|
841
|
+
}, {
|
|
842
|
+
default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
|
|
843
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE__element_sun_icons_vue__.Loading))
|
|
844
|
+
]),
|
|
845
|
+
_: 1
|
|
846
|
+
})
|
|
847
|
+
]),
|
|
848
|
+
key: "0"
|
|
849
|
+
} : void 0
|
|
850
|
+
]), 1032, [
|
|
851
|
+
"placeholder",
|
|
852
|
+
"modelValue"
|
|
853
|
+
])
|
|
854
|
+
]),
|
|
855
|
+
default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
|
|
856
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.withDirectives)((0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(pro_table), {
|
|
857
|
+
ref_key: "tableRef",
|
|
858
|
+
ref: tableRef,
|
|
859
|
+
columns: columns.value,
|
|
860
|
+
data: patientList.value,
|
|
861
|
+
"row-key": _ctx.accessResult.primaryKey,
|
|
862
|
+
"highlight-current-row": "",
|
|
863
|
+
"max-height": "480px",
|
|
864
|
+
onCurrentChange: handleCurrentChange,
|
|
865
|
+
onRowClick: handleSelectRow
|
|
866
|
+
}, null, 8, [
|
|
867
|
+
"columns",
|
|
868
|
+
"data",
|
|
869
|
+
"row-key"
|
|
870
|
+
]), [
|
|
871
|
+
[
|
|
872
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ClickOutside),
|
|
873
|
+
hide
|
|
874
|
+
]
|
|
875
|
+
])
|
|
876
|
+
]),
|
|
877
|
+
_: 1
|
|
878
|
+
}, 8, [
|
|
879
|
+
"visible"
|
|
880
|
+
]));
|
|
881
|
+
}
|
|
882
|
+
});
|
|
883
|
+
const AccessInput_exports_ = AccessInputvue_type_script_setup_true_lang_ts;
|
|
884
|
+
/* ESM default export */ const AccessInput = AccessInput_exports_;
|
|
885
|
+
const Iconvue_type_script_setup_true_lang_ts_hoisted_1 = {
|
|
886
|
+
width: "1.2em",
|
|
887
|
+
height: "1.2em",
|
|
888
|
+
fill: "currentColor",
|
|
889
|
+
viewBox: "0 0 1024 1024",
|
|
890
|
+
style: {
|
|
891
|
+
"margin-left": "2px"
|
|
892
|
+
}
|
|
893
|
+
};
|
|
894
|
+
const _hoisted_2 = {
|
|
895
|
+
key: 0,
|
|
896
|
+
d: "M871.34208 260.46976l-106.93632-106.96704c-24.41728-24.40192-64.11776-24.40192-88.53504 0l-449.95072 449.95072c-10.78784 10.80832-16.53248 24.63744-17.78688 38.79936l-62.83264 198.17472c-3.42016 11.09504-0.4608 23.15776 7.76192 31.3856 8.22272 8.20736 20.29056 11.20256 31.3856 7.76704l198.15424-62.86336c14.1568-1.23392 27.99616-6.98368 38.784-17.78688l449.95584-449.95584C895.75424 324.57216 895.75424 284.87168 871.34208 260.46976zM356.01408 760.94464l-133.39648 41.2928 41.3184-133.41696c0.42496-1.44896 0.64-2.89792 0.85504-4.36736l95.5904 95.59552C358.94784 760.27904 357.48352 760.47872 356.01408 760.94464zM388.19328 743.60832l-106.96192-106.96704 438.89152-438.8864 106.9568 106.96704L388.19328 743.60832z",
|
|
897
|
+
"p-id": "4215"
|
|
898
|
+
};
|
|
899
|
+
const _hoisted_3 = {
|
|
900
|
+
key: 2,
|
|
901
|
+
d: "M832 256v384H269.248l105.408-105.344-45.248-45.312-160 160a32 32 0 0 0 0 45.312l160 160 45.248-45.312L269.248 704H832a64 64 0 0 0 64-64V256h-64z",
|
|
902
|
+
"p-id": "4271"
|
|
903
|
+
};
|
|
904
|
+
/* ESM default export */ const Iconvue_type_script_setup_true_lang_ts = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
|
|
905
|
+
__name: 'Icon',
|
|
906
|
+
props: {
|
|
907
|
+
type: {}
|
|
908
|
+
},
|
|
909
|
+
setup (__props) {
|
|
910
|
+
return (_ctx, _cache)=>((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("svg", Iconvue_type_script_setup_true_lang_ts_hoisted_1, [
|
|
911
|
+
_ctx.type === (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.TRIGGER_TYPE_CODE).INPUT ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("path", _hoisted_2)) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true),
|
|
912
|
+
_ctx.type === (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.TRIGGER_TYPE_CODE).CLICK ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)(__WEBPACK_EXTERNAL_MODULE_vue__.Fragment, {
|
|
913
|
+
key: 1
|
|
914
|
+
}, [
|
|
915
|
+
_cache[0] || (_cache[0] = (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("path", {
|
|
916
|
+
d: "M775.68 988.16H508.587a149.333 149.333 0 0 1-96.64-42.667L181.76 715.733a101.76 101.76 0 0 1 143.573-144v-266.24a101.76 101.76 0 1 1 203.307 0v147.414l218.027 51.626A170.667 170.667 0 0 1 878.293 671.36V886.4A101.76 101.76 0 0 1 775.68 988.16zM253.653 606.293a37.76 37.76 0 0 0-26.666 64L456.96 900.48a85.333 85.333 0 0 0 51.413 23.467H775.68a37.76 37.76 0 0 0 37.76-37.76v-215.04a106.667 106.667 0 0 0-82.56-104.534l-241.493-57.386a32 32 0 0 1-24.534-31.147V305.493a37.76 37.76 0 1 0-75.306 0V648.96a32 32 0 0 1-54.614 22.613l-54.4-54.4a37.547 37.547 0 0 0-26.88-10.88z",
|
|
917
|
+
"p-id": "5220"
|
|
918
|
+
}, null, -1)),
|
|
919
|
+
_cache[1] || (_cache[1] = (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("path", {
|
|
920
|
+
d: "M616.96 411.947A32 32 0 0 1 588.8 364.8a181.333 181.333 0 1 0-320 0 32 32 0 1 1-55.467 30.507 245.333 245.333 0 1 1 431.787 0 32 32 0 0 1-28.16 16.64z",
|
|
921
|
+
"p-id": "5221"
|
|
922
|
+
}, null, -1))
|
|
923
|
+
], 64)) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true),
|
|
924
|
+
_ctx.type === (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.TRIGGER_TYPE_CODE).ENTER ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("path", _hoisted_3)) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true)
|
|
925
|
+
]));
|
|
926
|
+
}
|
|
927
|
+
});
|
|
928
|
+
const Icon_exports_ = Iconvue_type_script_setup_true_lang_ts;
|
|
929
|
+
/* ESM default export */ const Icon = Icon_exports_;
|
|
930
|
+
/* ESM default export */ const AccessButtonvue_type_script_setup_true_lang_ts = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
|
|
931
|
+
__name: 'AccessButton',
|
|
932
|
+
props: {
|
|
933
|
+
way: {},
|
|
934
|
+
activeId: {}
|
|
935
|
+
},
|
|
936
|
+
emits: [
|
|
937
|
+
"click"
|
|
938
|
+
],
|
|
939
|
+
setup (__props, { emit: __emit }) {
|
|
940
|
+
const emits = __emit;
|
|
941
|
+
return (_ctx, _cache)=>((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElButton), {
|
|
942
|
+
type: _ctx.activeId === _ctx.way.searchTypeId ? 'primary' : 'default',
|
|
943
|
+
onClick: _cache[0] || (_cache[0] = ()=>{
|
|
944
|
+
emits('click', _ctx.way);
|
|
945
|
+
})
|
|
946
|
+
}, {
|
|
947
|
+
default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
|
|
948
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(_ctx.way.bizSearchTypeName ?? _ctx.way.bizSearchTypeNameDisplay) + " ", 1),
|
|
949
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(Icon, {
|
|
950
|
+
type: _ctx.way.triggerTypeCode
|
|
951
|
+
}, null, 8, [
|
|
952
|
+
"type"
|
|
953
|
+
])
|
|
954
|
+
]),
|
|
955
|
+
_: 1
|
|
956
|
+
}, 8, [
|
|
957
|
+
"type"
|
|
958
|
+
]));
|
|
959
|
+
}
|
|
960
|
+
});
|
|
961
|
+
const AccessButton_exports_ = AccessButtonvue_type_script_setup_true_lang_ts;
|
|
962
|
+
/* ESM default export */ const AccessButton = AccessButton_exports_;
|
|
963
|
+
/* ESM default export */ const AccessWayListvue_type_script_setup_true_lang_ts = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
|
|
964
|
+
__name: 'AccessWayList',
|
|
965
|
+
props: {
|
|
966
|
+
maxShowNum: {},
|
|
967
|
+
activeAccessWay: {},
|
|
968
|
+
wayList: {},
|
|
969
|
+
searchLoading: {
|
|
970
|
+
type: Boolean
|
|
971
|
+
}
|
|
972
|
+
},
|
|
973
|
+
emits: [
|
|
974
|
+
"way-change"
|
|
975
|
+
],
|
|
976
|
+
setup (__props, { emit: __emit }) {
|
|
977
|
+
const emits = __emit;
|
|
978
|
+
const wrapperRef = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
|
|
979
|
+
const realMaxNum = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(0);
|
|
980
|
+
const setRealMaxNum = (val)=>{
|
|
981
|
+
realMaxNum.value = val;
|
|
982
|
+
};
|
|
983
|
+
const calcMaxNum = (wrapperNode)=>{
|
|
984
|
+
let wrapWidth = wrapperNode?.clientWidth;
|
|
985
|
+
let itemWidth = 80;
|
|
986
|
+
const nodes = Array.prototype.filter.call(wrapperNode.childNodes, (item)=>1 === item.nodeType);
|
|
987
|
+
nodes.forEach((node, index)=>{
|
|
988
|
+
if (itemWidth > wrapWidth || 1 !== node.nodeType) return;
|
|
989
|
+
const nodeWidth = Number(node.offsetWidth) + 10;
|
|
990
|
+
itemWidth += nodeWidth;
|
|
991
|
+
if (itemWidth > wrapWidth) setRealMaxNum(index);
|
|
992
|
+
// console.log(itemWidth, wrapWidth);
|
|
993
|
+
});
|
|
994
|
+
};
|
|
995
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.watchEffect)(()=>{
|
|
996
|
+
if (__props.wayList?.length && wrapperRef?.value) (0, __WEBPACK_EXTERNAL_MODULE_vue__.nextTick)(()=>{
|
|
997
|
+
if (wrapperRef?.value) calcMaxNum(wrapperRef.value);
|
|
998
|
+
});
|
|
999
|
+
});
|
|
1000
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.watchEffect)(()=>{
|
|
1001
|
+
if (__props.maxShowNum) setRealMaxNum(__props.maxShowNum);
|
|
1002
|
+
});
|
|
1003
|
+
return (_ctx, _cache)=>_ctx.wayList?.length ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("div", {
|
|
1004
|
+
key: 0,
|
|
1005
|
+
class: "flex-auto",
|
|
1006
|
+
ref_key: "wrapperRef",
|
|
1007
|
+
ref: wrapperRef
|
|
1008
|
+
}, [
|
|
1009
|
+
((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(true), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)(__WEBPACK_EXTERNAL_MODULE_vue__.Fragment, null, (0, __WEBPACK_EXTERNAL_MODULE_vue__.renderList)(_ctx.wayList.slice(0, realMaxNum.value), (item)=>((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)(AccessButton, {
|
|
1010
|
+
key: item.searchTypeId,
|
|
1011
|
+
"active-id": _ctx.activeAccessWay.searchTypeId,
|
|
1012
|
+
way: item,
|
|
1013
|
+
disabled: _ctx.searchLoading,
|
|
1014
|
+
onClick: ()=>emits('way-change', item),
|
|
1015
|
+
style: {
|
|
1016
|
+
"margin-left": "10px"
|
|
1017
|
+
}
|
|
1018
|
+
}, null, 8, [
|
|
1019
|
+
"active-id",
|
|
1020
|
+
"way",
|
|
1021
|
+
"disabled",
|
|
1022
|
+
"onClick"
|
|
1023
|
+
]))), 128)),
|
|
1024
|
+
_ctx.wayList.length > realMaxNum.value ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElPopover), {
|
|
1025
|
+
key: 0,
|
|
1026
|
+
width: "120"
|
|
1027
|
+
}, {
|
|
1028
|
+
reference: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
|
|
1029
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElButton), {
|
|
1030
|
+
style: {
|
|
1031
|
+
"margin-left": "10px"
|
|
1032
|
+
}
|
|
1033
|
+
}, {
|
|
1034
|
+
default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>_cache[0] || (_cache[0] = [
|
|
1035
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode)("更多 ⋮ ")
|
|
1036
|
+
])),
|
|
1037
|
+
_: 1
|
|
1038
|
+
})
|
|
1039
|
+
]),
|
|
1040
|
+
default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
|
|
1041
|
+
((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(true), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)(__WEBPACK_EXTERNAL_MODULE_vue__.Fragment, null, (0, __WEBPACK_EXTERNAL_MODULE_vue__.renderList)(_ctx.wayList.slice(realMaxNum.value), (item)=>((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)(AccessButton, {
|
|
1042
|
+
key: item.searchTypeId,
|
|
1043
|
+
"active-id": _ctx.activeAccessWay.searchTypeId,
|
|
1044
|
+
way: item,
|
|
1045
|
+
style: {
|
|
1046
|
+
"margin-left": "0"
|
|
1047
|
+
},
|
|
1048
|
+
disabled: _ctx.searchLoading,
|
|
1049
|
+
onClick: ()=>emits('way-change', item),
|
|
1050
|
+
class: "my-2 block w-full"
|
|
1051
|
+
}, null, 8, [
|
|
1052
|
+
"active-id",
|
|
1053
|
+
"way",
|
|
1054
|
+
"disabled",
|
|
1055
|
+
"onClick"
|
|
1056
|
+
]))), 128))
|
|
1057
|
+
]),
|
|
1058
|
+
_: 1
|
|
1059
|
+
})) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true)
|
|
1060
|
+
], 512)) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true);
|
|
1061
|
+
}
|
|
1062
|
+
});
|
|
1063
|
+
const AccessWayList_exports_ = AccessWayListvue_type_script_setup_true_lang_ts;
|
|
1064
|
+
/* ESM default export */ const AccessWayList = AccessWayList_exports_;
|
|
1065
|
+
const patient_accessvue_type_script_setup_true_lang_ts_hoisted_1 = {
|
|
1066
|
+
class: "flex w-full"
|
|
1067
|
+
};
|
|
1068
|
+
// 加载组织配置 loading
|
|
1069
|
+
/* ESM default export */ const patient_accessvue_type_script_setup_true_lang_ts = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
|
|
1070
|
+
__name: 'index',
|
|
1071
|
+
props: {
|
|
1072
|
+
menuId: {},
|
|
1073
|
+
code: {}
|
|
1074
|
+
},
|
|
1075
|
+
emits: [
|
|
1076
|
+
"change"
|
|
1077
|
+
],
|
|
1078
|
+
setup (__props, { expose: __expose, emit: __emit }) {
|
|
1079
|
+
const emits = __emit;
|
|
1080
|
+
const loading = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
|
|
1081
|
+
// 检索 loading
|
|
1082
|
+
const searchLoading = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
|
|
1083
|
+
// input 框输入值
|
|
1084
|
+
const inputValue = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)('');
|
|
1085
|
+
/** 组件配置信息 */ const configData = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
|
|
1086
|
+
// 当前激活进入方式
|
|
1087
|
+
const activeAccessWay = (0, __WEBPACK_EXTERNAL_MODULE_vue__.shallowRef)();
|
|
1088
|
+
const defaultResult = {
|
|
1089
|
+
primaryKey: '',
|
|
1090
|
+
columns: [],
|
|
1091
|
+
data: []
|
|
1092
|
+
};
|
|
1093
|
+
const accessResult = (0, __WEBPACK_EXTERNAL_MODULE_vue__.shallowRef)({
|
|
1094
|
+
...defaultResult
|
|
1095
|
+
});
|
|
1096
|
+
const accessInputRef = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
|
|
1097
|
+
/**
|
|
1098
|
+
* 获取组件配置
|
|
1099
|
+
*/ const getComponentConfig = async ()=>{
|
|
1100
|
+
loading.value = true;
|
|
1101
|
+
const [, res] = await queryPatientAccessConfig({
|
|
1102
|
+
sysMenuId: __props.menuId,
|
|
1103
|
+
componentCode: __props.code,
|
|
1104
|
+
enabledFlag: __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES
|
|
1105
|
+
});
|
|
1106
|
+
loading.value = false;
|
|
1107
|
+
if (res?.data) {
|
|
1108
|
+
configData.value = res.data;
|
|
1109
|
+
// 设置默认进入方式
|
|
1110
|
+
resetAccessWay();
|
|
1111
|
+
}
|
|
1112
|
+
};
|
|
1113
|
+
/**
|
|
1114
|
+
* emit change事件,患者切换
|
|
1115
|
+
*/ const handleChange = (data)=>{
|
|
1116
|
+
emits('change', {
|
|
1117
|
+
inputInfo: {
|
|
1118
|
+
value: inputValue.value,
|
|
1119
|
+
searchTypeCode: activeAccessWay.value.searchTypeCode,
|
|
1120
|
+
indexTypeCode: activeAccessWay.value.indexTypeCode,
|
|
1121
|
+
triggerTypeCode: activeAccessWay.value.triggerTypeCode
|
|
1122
|
+
},
|
|
1123
|
+
...data
|
|
1124
|
+
});
|
|
1125
|
+
};
|
|
1126
|
+
/** 触发读卡 */ const triggerCardAccess = async (data)=>{
|
|
1127
|
+
if (!data.interfaceId) return;
|
|
1128
|
+
const [, res] = await (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.interfaceInvoke)({
|
|
1129
|
+
interfaceId: data.interfaceId,
|
|
1130
|
+
tradeCode: '001',
|
|
1131
|
+
menuId: __props.menuId,
|
|
1132
|
+
params: {
|
|
1133
|
+
searchTypeCode: data.searchTypeCode,
|
|
1134
|
+
searchValue: '',
|
|
1135
|
+
indexTypeCode: data.indexTypeCode
|
|
1136
|
+
}
|
|
1137
|
+
});
|
|
1138
|
+
return res?.data;
|
|
1139
|
+
};
|
|
1140
|
+
/** 处理检索结果 */ const handleSearchResult = (res, cardInfo)=>{
|
|
1141
|
+
// 查询的结果 超过一条 则需要 弹出弹窗让用户选择
|
|
1142
|
+
if (res.data?.length > 1) {
|
|
1143
|
+
accessInputRef.value.setCurrentRow(res.data[0]);
|
|
1144
|
+
accessInputRef.value.show();
|
|
1145
|
+
} else if (1 === res.data.length) handleChange({
|
|
1146
|
+
cardInfo,
|
|
1147
|
+
patientInfo: res.data[0]
|
|
1148
|
+
});
|
|
1149
|
+
};
|
|
1150
|
+
/** 触发患者检索 */ const triggerSearchAccess = async (data, cardInfo)=>{
|
|
1151
|
+
searchLoading.value = true;
|
|
1152
|
+
const [, res] = await queryBizDataList({
|
|
1153
|
+
componentCode: __props.code,
|
|
1154
|
+
searchTypeCode: data.searchTypeCode,
|
|
1155
|
+
searchValue: inputValue.value,
|
|
1156
|
+
indexTypeCode: cardInfo?.indexTypeCode ?? data.indexTypeCode,
|
|
1157
|
+
indexNo: cardInfo?.indexNo
|
|
1158
|
+
});
|
|
1159
|
+
searchLoading.value = false;
|
|
1160
|
+
if (res?.data) {
|
|
1161
|
+
accessResult.value = {
|
|
1162
|
+
primaryKey: res.data.primaryKey,
|
|
1163
|
+
columns: res.data.titleAndAttribute,
|
|
1164
|
+
data: res.data.data.data ?? []
|
|
1165
|
+
};
|
|
1166
|
+
handleSearchResult(accessResult.value);
|
|
1167
|
+
}
|
|
1168
|
+
};
|
|
1169
|
+
/**
|
|
1170
|
+
* 处理患者 access
|
|
1171
|
+
* @param data 检索项配置
|
|
1172
|
+
*/ const handleAccess = async (data)=>{
|
|
1173
|
+
if (data?.interfaceId) {
|
|
1174
|
+
const cardInfo = await triggerCardAccess(data);
|
|
1175
|
+
if (cardInfo && __props.code === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.COMPONENT_CODE.READ_CARD) handleChange({
|
|
1176
|
+
cardInfo
|
|
1177
|
+
});
|
|
1178
|
+
else triggerSearchAccess(data, cardInfo);
|
|
1179
|
+
} else triggerSearchAccess(data);
|
|
1180
|
+
};
|
|
1181
|
+
// 重置进入方式
|
|
1182
|
+
const resetAccessWay = (data)=>{
|
|
1183
|
+
const currentAccessWay = data ? data : configData.value?.bizSearchTypeList?.find((item)=>item.defaultFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES) ?? configData.value?.bizSearchTypeList?.[0];
|
|
1184
|
+
if (currentAccessWay && (!activeAccessWay?.value?.searchTypeId || activeAccessWay?.value?.searchTypeId !== currentAccessWay.searchTypeId)) {
|
|
1185
|
+
inputValue.value = '';
|
|
1186
|
+
activeAccessWay.value = currentAccessWay;
|
|
1187
|
+
accessResult.value = {
|
|
1188
|
+
...defaultResult
|
|
1189
|
+
};
|
|
1190
|
+
}
|
|
1191
|
+
accessInputRef.value?.hide();
|
|
1192
|
+
setTimeout(()=>{
|
|
1193
|
+
accessInputRef.value.focus();
|
|
1194
|
+
});
|
|
1195
|
+
};
|
|
1196
|
+
/**
|
|
1197
|
+
* 处理检索方式切换
|
|
1198
|
+
* @param data 检索项配置
|
|
1199
|
+
*/ const handleAccessWayChange = (data)=>{
|
|
1200
|
+
resetAccessWay(data);
|
|
1201
|
+
if (data.triggerTypeCode === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.TRIGGER_TYPE_CODE.CLICK) handleAccess(data);
|
|
1202
|
+
};
|
|
1203
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>[
|
|
1204
|
+
__props.menuId,
|
|
1205
|
+
__props.code
|
|
1206
|
+
], ([, val])=>{
|
|
1207
|
+
if (val) getComponentConfig();
|
|
1208
|
+
}, {
|
|
1209
|
+
immediate: true
|
|
1210
|
+
});
|
|
1211
|
+
__expose({
|
|
1212
|
+
focus: ()=>{
|
|
1213
|
+
accessInputRef.value?.focus();
|
|
1214
|
+
},
|
|
1215
|
+
reset: ()=>{
|
|
1216
|
+
resetAccessWay();
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
return (_ctx, _cache)=>((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("div", patient_accessvue_type_script_setup_true_lang_ts_hoisted_1, [
|
|
1220
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(AccessInput, {
|
|
1221
|
+
ref_key: "accessInputRef",
|
|
1222
|
+
ref: accessInputRef,
|
|
1223
|
+
modelValue: inputValue.value,
|
|
1224
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event)=>inputValue.value = $event),
|
|
1225
|
+
"access-result": accessResult.value,
|
|
1226
|
+
"active-access-way": activeAccessWay.value,
|
|
1227
|
+
"search-loading": searchLoading.value,
|
|
1228
|
+
onEnter: _cache[1] || (_cache[1] = ()=>{
|
|
1229
|
+
handleAccess(activeAccessWay.value);
|
|
1230
|
+
}),
|
|
1231
|
+
onSelect: _cache[2] || (_cache[2] = (rowData)=>{
|
|
1232
|
+
handleChange({
|
|
1233
|
+
patientInfo: rowData
|
|
1234
|
+
});
|
|
1235
|
+
accessInputRef.value.hide();
|
|
1236
|
+
})
|
|
1237
|
+
}, null, 8, [
|
|
1238
|
+
"modelValue",
|
|
1239
|
+
"access-result",
|
|
1240
|
+
"active-access-way",
|
|
1241
|
+
"search-loading"
|
|
1242
|
+
]),
|
|
1243
|
+
activeAccessWay.value ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)(AccessWayList, {
|
|
1244
|
+
key: 0,
|
|
1245
|
+
"search-loading": searchLoading.value,
|
|
1246
|
+
"way-list": configData.value?.bizSearchTypeList,
|
|
1247
|
+
"active-access-way": activeAccessWay.value,
|
|
1248
|
+
"max-show-num": configData.value?.maxShowItemNum || 6,
|
|
1249
|
+
onWayChange: handleAccessWayChange
|
|
1250
|
+
}, null, 8, [
|
|
1251
|
+
"search-loading",
|
|
1252
|
+
"way-list",
|
|
1253
|
+
"active-access-way",
|
|
1254
|
+
"max-show-num"
|
|
1255
|
+
])) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true)
|
|
1256
|
+
]));
|
|
1257
|
+
}
|
|
1258
|
+
});
|
|
1259
|
+
const patient_access_exports_ = patient_accessvue_type_script_setup_true_lang_ts;
|
|
1260
|
+
/* ESM default export */ const patient_access = patient_access_exports_;
|
|
1261
|
+
const PatientInfovue_type_script_setup_true_lang_ts_hoisted_1 = {
|
|
1262
|
+
class: "ml-3 align-middle text-lg"
|
|
1263
|
+
};
|
|
1264
|
+
const PatientInfovue_type_script_setup_true_lang_ts_hoisted_2 = {
|
|
1265
|
+
style: {
|
|
1266
|
+
"padding-bottom": "3px"
|
|
1267
|
+
},
|
|
1268
|
+
class: "mx-3 inline-block align-bottom"
|
|
1269
|
+
};
|
|
1270
|
+
const PatientInfovue_type_script_setup_true_lang_ts_hoisted_3 = {
|
|
1271
|
+
style: {
|
|
1272
|
+
"padding-bottom": "3px"
|
|
1273
|
+
},
|
|
1274
|
+
class: "inline-block align-bottom"
|
|
1275
|
+
};
|
|
1276
|
+
const _hoisted_4 = {
|
|
1277
|
+
class: "text-slate-600"
|
|
1278
|
+
};
|
|
1279
|
+
const _hoisted_5 = {
|
|
1280
|
+
class: "mx-2 max-w-16"
|
|
1281
|
+
};
|
|
1282
|
+
/* ESM default export */ const PatientInfovue_type_script_setup_true_lang_ts = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
|
|
1283
|
+
__name: 'PatientInfo',
|
|
1284
|
+
props: {
|
|
1285
|
+
data: {
|
|
1286
|
+
default: ()=>void 0
|
|
1287
|
+
}
|
|
1288
|
+
},
|
|
1289
|
+
setup (__props) {
|
|
1290
|
+
const displayList = [
|
|
1291
|
+
{
|
|
1292
|
+
label: '门诊号',
|
|
1293
|
+
prop: 'omrn'
|
|
1294
|
+
},
|
|
1295
|
+
{
|
|
1296
|
+
label: '医保费别',
|
|
1297
|
+
prop: 'medInsuranceName'
|
|
1298
|
+
},
|
|
1299
|
+
{
|
|
1300
|
+
label: '证件类型',
|
|
1301
|
+
prop: 'certificateTypeDesc'
|
|
1302
|
+
},
|
|
1303
|
+
{
|
|
1304
|
+
label: '证件号码',
|
|
1305
|
+
prop: 'certificateNo'
|
|
1306
|
+
},
|
|
1307
|
+
{
|
|
1308
|
+
label: '出生日期',
|
|
1309
|
+
prop: 'birthDate'
|
|
1310
|
+
}
|
|
1311
|
+
];
|
|
1312
|
+
/**
|
|
1313
|
+
*
|
|
1314
|
+
* @param birthDay 出生日期
|
|
1315
|
+
* @param curDate 当前日期
|
|
1316
|
+
* @returns
|
|
1317
|
+
*/ const birthToAgeDiff = (birthDay, curDate)=>{
|
|
1318
|
+
const birth = (0, __WEBPACK_EXTERNAL_MODULE_element_sun__.dayjs)(birthDay);
|
|
1319
|
+
const now = (0, __WEBPACK_EXTERNAL_MODULE_element_sun__.dayjs)(curDate);
|
|
1320
|
+
if (birth.valueOf() > now.valueOf()) return '未出生~';
|
|
1321
|
+
let years = now.year() - birth.year();
|
|
1322
|
+
let months = now.month() - birth.month();
|
|
1323
|
+
let days = now.date() - birth.date();
|
|
1324
|
+
if (days < 0) {
|
|
1325
|
+
months -= 1;
|
|
1326
|
+
days += (0, __WEBPACK_EXTERNAL_MODULE_element_sun__.dayjs)(now).subtract(1, 'month').daysInMonth();
|
|
1327
|
+
}
|
|
1328
|
+
if (months < 0) {
|
|
1329
|
+
years -= 1;
|
|
1330
|
+
months += 12;
|
|
1331
|
+
}
|
|
1332
|
+
return ` ${years}岁${months}月${days}天`;
|
|
1333
|
+
};
|
|
1334
|
+
const age = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>{
|
|
1335
|
+
if (__props.data?.birthDate) return birthToAgeDiff(__props.data.birthDate);
|
|
1336
|
+
return '--';
|
|
1337
|
+
});
|
|
1338
|
+
return (_ctx, _cache)=>((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("ul", (0, __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps)({
|
|
1339
|
+
class: "flex items-center bg-table-header py-1",
|
|
1340
|
+
style: {
|
|
1341
|
+
padding: "4px 10px"
|
|
1342
|
+
}
|
|
1343
|
+
}, _ctx.$attrs), [
|
|
1344
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("li", null, [
|
|
1345
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElAvatar), {
|
|
1346
|
+
class: "align-middle",
|
|
1347
|
+
icon: "User",
|
|
1348
|
+
size: 28
|
|
1349
|
+
}),
|
|
1350
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("span", PatientInfovue_type_script_setup_true_lang_ts_hoisted_1, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(_ctx.data?.patientName || '--'), 1),
|
|
1351
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("small", PatientInfovue_type_script_setup_true_lang_ts_hoisted_2, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(_ctx.data?.genderDesc || '--'), 1),
|
|
1352
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("small", PatientInfovue_type_script_setup_true_lang_ts_hoisted_3, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(age.value), 1)
|
|
1353
|
+
]),
|
|
1354
|
+
((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)(__WEBPACK_EXTERNAL_MODULE_vue__.Fragment, null, (0, __WEBPACK_EXTERNAL_MODULE_vue__.renderList)(displayList, (item)=>(0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("li", {
|
|
1355
|
+
key: item.prop,
|
|
1356
|
+
class: "ml-3 text-base"
|
|
1357
|
+
}, [
|
|
1358
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("span", _hoisted_4, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(item.label), 1),
|
|
1359
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("span", _hoisted_5, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(_ctx.data?.[item.prop] || '--'), 1)
|
|
1360
|
+
])), 64))
|
|
1361
|
+
], 16));
|
|
1362
|
+
}
|
|
1363
|
+
});
|
|
1364
|
+
const PatientInfo_exports_ = PatientInfovue_type_script_setup_true_lang_ts;
|
|
1365
|
+
/* ESM default export */ const PatientInfo = PatientInfo_exports_;
|
|
1366
|
+
var __webpack_exports__COMPONENT_CODE = __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.COMPONENT_CODE;
|
|
1367
|
+
export { patient_access as PatientAccess, PatientInfo, pro_table as ProTable, Title, __webpack_exports__COMPONENT_CODE as COMPONENT_CODE };
|