sun-biz 0.0.3-beta.5 → 0.0.3-beta.7

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.
@@ -269,8 +269,8 @@ const copy_text_with_tooltip_exports_ = /*#__PURE__*/ (0, exportHelper["default"
269
269
  * @returns {String}
270
270
  * */ function formatValue(callValue) {
271
271
  // 如果当前值为数组,使用 / 拼接(根据需求自定义)
272
- if (isArray(callValue)) return callValue.length ? callValue.join(' / ') : '--';
273
- return callValue ?? '--';
272
+ if (isArray(callValue)) return callValue.length ? callValue.join(" / ") : "--";
273
+ return callValue ?? "--";
274
274
  }
275
275
  /**
276
276
  * @description 处理 prop 为多级嵌套的情况,返回的数据 (列如: prop: user.name)
@@ -278,8 +278,8 @@ const copy_text_with_tooltip_exports_ = /*#__PURE__*/ (0, exportHelper["default"
278
278
  * @param {String} prop 当前 prop
279
279
  * @returns {*}
280
280
  * */ function handleRowAccordingToProp(row, prop) {
281
- if (!prop?.includes('.')) return row[prop] ?? '--';
282
- prop.split('.').forEach((item)=>row = row[item] ?? '--');
281
+ if (!prop?.includes(".")) return row[prop] ?? "--";
282
+ prop.split(".").forEach((item)=>row = row[item] ?? "--");
283
283
  return row;
284
284
  }
285
285
  /**
@@ -287,7 +287,7 @@ const copy_text_with_tooltip_exports_ = /*#__PURE__*/ (0, exportHelper["default"
287
287
  * @param {String} prop 当前 prop
288
288
  * @returns {String}
289
289
  * */ function handleProp(prop) {
290
- const propArr = prop.split('.');
290
+ const propArr = prop.split(".");
291
291
  if (1 == propArr.length) return prop;
292
292
  return propArr[propArr.length - 1];
293
293
  }
@@ -308,15 +308,15 @@ const copy_text_with_tooltip_exports_ = /*#__PURE__*/ (0, exportHelper["default"
308
308
  * @param {String} type 过滤类型(目前只有 tag)
309
309
  * @returns {String}
310
310
  * */ function filterEnum(callValue, enumData, fieldNames, type) {
311
- const value = fieldNames?.value ?? 'value';
312
- const label = fieldNames?.label ?? 'label';
313
- const children = fieldNames?.children ?? 'children';
311
+ const value = fieldNames?.value ?? "value";
312
+ const label = fieldNames?.label ?? "label";
313
+ const children = fieldNames?.children ?? "children";
314
314
  let filterData = {};
315
315
  // 判断 enumData 是否为数组
316
316
  if (Array.isArray(enumData)) filterData = findItemNested(enumData, callValue, value, children);
317
317
  // 判断是否输出的结果为 tag 类型
318
- if ('tag' == type) return filterData?.tagType ? filterData.tagType : '';
319
- return filterData ? filterData[label] : '--';
318
+ if ("tag" == type) return filterData?.tagType ? filterData.tagType : "";
319
+ return filterData ? filterData[label] : "--";
320
320
  }
321
321
  function _isSlot(s) {
322
322
  return 'function' == typeof s || '[object Object]' === Object.prototype.toString.call(s) && !(0, __WEBPACK_EXTERNAL_MODULE_vue__.isVNode)(s);
@@ -1415,7 +1415,7 @@ const pro_tablevue_type_script_lang_ts_setup_true_name_ProTable_hoisted_1 = {
1415
1415
  class: "relative flex flex-1 flex-col overflow-hidden"
1416
1416
  };
1417
1417
  const pro_tablevue_type_script_lang_ts_setup_true_name_ProTable_hoisted_2 = {
1418
- key: 0,
1418
+ key: 1,
1419
1419
  class: "mt-5 flex justify-between items-center"
1420
1420
  };
1421
1421
  // 接受父组件参数,配置默认值
@@ -1474,7 +1474,20 @@ const pro_tablevue_type_script_lang_ts_setup_true_name_ProTable_hoisted_2 = {
1474
1474
  default: ()=>({})
1475
1475
  },
1476
1476
  layout: {
1477
- default: 'total, sizes, prev, pager, next'
1477
+ default: "total, sizes, prev, pager, next"
1478
+ },
1479
+ dragTips: {
1480
+ default: "温馨提示:您可通过拖动进行排序"
1481
+ },
1482
+ isShowDragTips: {
1483
+ type: Boolean,
1484
+ default: false
1485
+ },
1486
+ dragTipsCustomStyle: {
1487
+ default: {}
1488
+ },
1489
+ dragTipsClassName: {
1490
+ default: ""
1478
1491
  }
1479
1492
  },
1480
1493
  emits: [
@@ -1719,6 +1732,18 @@ const pro_tablevue_type_script_lang_ts_setup_true_name_ProTable_hoisted_2 = {
1719
1732
  return (_ctx, _cache)=>{
1720
1733
  const _directive_loading = (0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveDirective)("loading");
1721
1734
  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, [
1735
+ props?.draggable || props?.isShowDragTips ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("div", {
1736
+ key: 0,
1737
+ style: (0, __WEBPACK_EXTERNAL_MODULE_vue__.normalizeStyle)({
1738
+ color: '#f7ba2a',
1739
+ ...props.dragTipsCustomStyle
1740
+ }),
1741
+ class: (0, __WEBPACK_EXTERNAL_MODULE_vue__.normalizeClass)([
1742
+ 'text-base',
1743
+ 'mb-2',
1744
+ props.dragTipsClassName
1745
+ ])
1746
+ }, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(props.dragTips), 7)) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true),
1722
1747
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(TableContainer, {
1723
1748
  ref_key: "formRef",
1724
1749
  ref: formRef,
@@ -2003,7 +2028,8 @@ function useColumnConfig(options) {
2003
2028
  emits: /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.mergeModels)([
2004
2029
  "enter",
2005
2030
  "input",
2006
- "select"
2031
+ "select",
2032
+ "clear"
2007
2033
  ], [
2008
2034
  "update:modelValue"
2009
2035
  ]),
@@ -2091,8 +2117,12 @@ function useColumnConfig(options) {
2091
2117
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event)=>model.value = $event),
2092
2118
  autofocus: true,
2093
2119
  onClick: handleReferenceClick,
2094
- onInput: _cache[1] || (_cache[1] = (e)=>emits('input', e)),
2095
- class: "w-[284px] flex-shrink-0 flex-grow-0",
2120
+ onInput: _cache[1] || (_cache[1] = (value)=>emits('input', value)),
2121
+ onClear: _cache[2] || (_cache[2] = ()=>emits('clear')),
2122
+ class: "flex-shrink-0 flex-grow-0",
2123
+ style: {
2124
+ width: "284px"
2125
+ },
2096
2126
  clearable: ""
2097
2127
  }, (0, __WEBPACK_EXTERNAL_MODULE_vue__.createSlots)({
2098
2128
  _: 2
@@ -2336,10 +2366,15 @@ const patient_accessvue_type_script_setup_true_lang_ts_hoisted_1 = {
2336
2366
  __name: 'index',
2337
2367
  props: {
2338
2368
  menuId: {},
2339
- code: {}
2369
+ code: {},
2370
+ showName: {
2371
+ type: Boolean,
2372
+ default: false
2373
+ }
2340
2374
  },
2341
2375
  emits: [
2342
- "change"
2376
+ "change",
2377
+ "clear"
2343
2378
  ],
2344
2379
  setup (__props, { expose: __expose, emit: __emit }) {
2345
2380
  const emits = __emit;
@@ -2380,6 +2415,8 @@ const patient_accessvue_type_script_setup_true_lang_ts_hoisted_1 = {
2380
2415
  /**
2381
2416
  * emit change事件,患者切换
2382
2417
  */ const handleChange = (data)=>{
2418
+ // 患者检索组件将患者姓名放在input框中
2419
+ if (__props.showName && data?.patientInfo?.patientName) inputValue.value = data.patientInfo.patientName;
2383
2420
  emits("change", {
2384
2421
  inputInfo: {
2385
2422
  value: inputValue.value,
@@ -2503,10 +2540,11 @@ const patient_accessvue_type_script_setup_true_lang_ts_hoisted_1 = {
2503
2540
  "search-loading": searchLoading.value,
2504
2541
  "input-change": inputChange.value,
2505
2542
  onInput: _cache[1] || (_cache[1] = ()=>inputChange.value = true),
2506
- onEnter: _cache[2] || (_cache[2] = ()=>{
2543
+ onClear: _cache[2] || (_cache[2] = ()=>emits('clear')),
2544
+ onEnter: _cache[3] || (_cache[3] = ()=>{
2507
2545
  handleAccess(activeAccessWay.value);
2508
2546
  }),
2509
- onSelect: _cache[3] || (_cache[3] = (rowData)=>{
2547
+ onSelect: _cache[4] || (_cache[4] = (rowData)=>{
2510
2548
  handleChange({
2511
2549
  patientInfo: rowData
2512
2550
  });
@@ -2829,16 +2867,6 @@ const _hoisted_12 = {
2829
2867
  };
2830
2868
  // 计算实际布局列数
2831
2869
  const layoutColumns = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>parseLayoutColumns(bannerInfo.value?.layoutTypeCode));
2832
- /** 如果是住院就诊,返回就诊状态和天数 */ const encounterInfo = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>{
2833
- if (BANNER_COMPONENT_CONFIG[__props.code].bizIdTypeCode !== __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.BIZ_ID_TYPE_CODE.IENC_ENCOUNTER) return null;
2834
- const bannerItems = bannerInfo.value?.bannerItemList ?? [];
2835
- const statusItem = bannerItems.find((item)=>"inEncStatusDesc" === item.bindingFieldNo);
2836
- const daysItem = bannerItems.find((item)=>"inpatientDays" === item.bindingFieldNo);
2837
- return {
2838
- inEncStatusDesc: statusItem?.dataValue ?? "--",
2839
- inpatientDays: daysItem?.dataValue ? `(${daysItem.dataValue})` : "--"
2840
- };
2841
- });
2842
2870
  /** 获取banner配置 */ const queryBannerConfig = async ()=>{
2843
2871
  loading.value = true;
2844
2872
  if (!__props.bizId && initBannerInfo.value) {
@@ -2853,7 +2881,7 @@ const _hoisted_12 = {
2853
2881
  });
2854
2882
  loading.value = false;
2855
2883
  if (res?.success) {
2856
- res.data.bannerItemList = (res?.data?.bannerItemList ?? [])?.filter((item)=>item.displayFlag);
2884
+ res.data.bannerItemList = (res?.data?.bannerItemList ?? [])?.filter((item)=>item?.displayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES);
2857
2885
  if (!__props.bizId) initBannerInfo.value = res?.data;
2858
2886
  bannerInfo.value = res?.data;
2859
2887
  }
@@ -2931,8 +2959,8 @@ const _hoisted_12 = {
2931
2959
  ]),
2932
2960
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("div", _hoisted_8, [
2933
2961
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(BANNER_COMPONENT_CONFIG)[_ctx.code].bizIdTypeCode === (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.BIZ_ID_TYPE_CODE).IENC_ENCOUNTER ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("div", _hoisted_9, [
2934
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("span", _hoisted_10, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(encounterInfo.value?.inEncStatusDesc), 1),
2935
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("span", null, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(encounterInfo.value?.inpatientDays), 1)
2962
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("span", _hoisted_10, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(bannerInfo.value?.inpatientStatusDesc ?? "--"), 1),
2963
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("span", null, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(bannerInfo.value?.inpatientDays ?? "--"), 1)
2936
2964
  ])) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true)
2937
2965
  ])
2938
2966
  ]),
@@ -2954,7 +2982,7 @@ const _hoisted_12 = {
2954
2982
  class: "w-full overflow-hidden text-ellipsis whitespace-nowrap",
2955
2983
  onMouseenter: checkTextOverflow
2956
2984
  }, [
2957
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("span", _hoisted_11, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(item.labelNameDisplay) + ":", 1),
2985
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("span", _hoisted_11, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(item.labelNameDisplay) + "", 1),
2958
2986
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(_component_el_tooltip, {
2959
2987
  disabled: !isTextOverflowing.value,
2960
2988
  content: item.dataValue
@@ -3220,6 +3248,11 @@ const pluginMainRequest = async (methodName, params)=>{
3220
3248
  * @param params
3221
3249
  * @returns
3222
3250
  */ const designPreviewPrintReceipt = (params)=>pluginMainRequest("designPreviewPrintReceipt", params);
3251
+ /**
3252
+ * [97-10005-1]web单据打印
3253
+ * @param params
3254
+ * @returns
3255
+ */ const designPreviewPrintReceiptWeb = (params)=>(0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.baseRequest)("/report/designPreviewPrintReceipt", params);
3223
3256
  /**
3224
3257
  * 分单方式代码
3225
3258
  */ var constant_RECEIPT_SPLIT_TYPE_CODE = /*#__PURE__*/ function(RECEIPT_SPLIT_TYPE_CODE) {
@@ -3326,6 +3359,129 @@ var constant_DATA_SOURCE_CONTENT_TYPE_CODE = /*#__PURE__*/ function(DATA_SOURCE_
3326
3359
  */ DATA_SOURCE_CONTENT_TYPE_CODE["BASE64"] = "BASE64";
3327
3360
  return DATA_SOURCE_CONTENT_TYPE_CODE;
3328
3361
  }({});
3362
+ /** 用于获取单据 */ const usePrintReceipt = (params, isInit = true)=>{
3363
+ const menuXReceiptList = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)([]);
3364
+ const loading = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
3365
+ const getMenuXReceiptList = async (params)=>{
3366
+ loading.value = true;
3367
+ const [, res] = await queryMenuXReceiptBySysMenuId(params);
3368
+ loading.value = false;
3369
+ if (res?.success) menuXReceiptList.value = res.data?.menuXReceiptList || [];
3370
+ };
3371
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.onMounted)(()=>{
3372
+ if (isInit) getMenuXReceiptList(params);
3373
+ });
3374
+ return {
3375
+ menuXReceiptList,
3376
+ loading,
3377
+ getMenuXReceiptList
3378
+ };
3379
+ };
3380
+ /** web打印弹出打印框 类型默认是BASE64的格式
3381
+ * type 数据源格式类型代码
3382
+ * @param [type='BASE64']
3383
+ */ function useWebPrint(content, type = constant_DATA_SOURCE_CONTENT_TYPE_CODE.BASE64) {
3384
+ // 创建隐藏的iframe
3385
+ const iframe = document.createElement("iframe");
3386
+ iframe.style.position = "fixed";
3387
+ iframe.style.right = "0";
3388
+ iframe.style.bottom = "0";
3389
+ iframe.style.width = "0";
3390
+ iframe.style.height = "0";
3391
+ iframe.style.border = "0";
3392
+ iframe.style.visibility = "hidden"; // 添加这行确保iframe完全隐藏
3393
+ document.body.appendChild(iframe);
3394
+ // 等待iframe加载完成
3395
+ iframe.onload = async ()=>{
3396
+ const iframeDoc = iframe.contentDocument || iframe.contentWindow?.document;
3397
+ // 根据类型处理内容
3398
+ if (type === constant_DATA_SOURCE_CONTENT_TYPE_CODE.H5 || type === constant_DATA_SOURCE_CONTENT_TYPE_CODE.JSON) {
3399
+ iframeDoc.body.innerHTML = content;
3400
+ return; // 不再执行打印操作
3401
+ }
3402
+ if (type === constant_DATA_SOURCE_CONTENT_TYPE_CODE.BASE64) {
3403
+ const img = new Image();
3404
+ // 处理Base64图片
3405
+ if (content.startsWith("data:image")) img.src = content;
3406
+ else // 如果不是完整的data URL,添加前缀
3407
+ img.src = `data:image/png;base64,${content}`;
3408
+ iframeDoc.body.appendChild(img);
3409
+ img.onerror = (error)=>{
3410
+ console.error("加载失败:", error);
3411
+ iframeDoc.body.innerHTML = "<p>加载失败,请检查数据</p>";
3412
+ };
3413
+ }
3414
+ /** 返回二进制文件时候的解析 */ // else if (type === "FILE") {
3415
+ // const blob = new Blob([content], { type: "application/pdf" });
3416
+ // const url = URL.createObjectURL(blob);
3417
+ // iframeDoc.body.innerHTML = `<embed src="${url}" type="application/pdf" width="100%" height="100%">`;
3418
+ // }
3419
+ await iframe.contentWindow?.focus();
3420
+ await iframe.contentWindow?.print();
3421
+ // 打印完成后移除iframe
3422
+ await document.body.removeChild(iframe);
3423
+ };
3424
+ // 最后添加到DOM
3425
+ document.body.appendChild(iframe);
3426
+ // 强制触发加载
3427
+ iframe.src = "about:blank";
3428
+ }
3429
+ /** 设计或预览 */ function useDesignAndPreview(htmlContent, title = "设计", options = {}) {
3430
+ // 创建一个容器元素
3431
+ const container = document.createElement("div");
3432
+ // 关闭弹窗的函数
3433
+ const closeDialog = ()=>{
3434
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.render)(null, container); // 卸载组件
3435
+ document.body.removeChild(container); // 移除容器
3436
+ document.head.removeChild(style); // 移除样式
3437
+ };
3438
+ // 在渲染前动态创建并插入样式
3439
+ const style = document.createElement("style");
3440
+ style.innerHTML = `
3441
+ .custom-dialog .el-dialog__headerbtn .el-icon {
3442
+ width: 48px; /* 设置图标的宽度 */
3443
+ height: 48px; /* 设置图标的高度 */
3444
+ }
3445
+ `;
3446
+ document.head.appendChild(style);
3447
+ // 使用 h 函数创建弹窗组件
3448
+ const dialog = (0, __WEBPACK_EXTERNAL_MODULE_vue__.h)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElDialog, {
3449
+ modelValue: true,
3450
+ title: title,
3451
+ width: "50%",
3452
+ onClose: ()=>{
3453
+ options.onCancel?.(); // 触发取消回调
3454
+ closeDialog();
3455
+ },
3456
+ class: "custom-dialog"
3457
+ }, {
3458
+ default: ()=>(0, __WEBPACK_EXTERNAL_MODULE_vue__.h)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElScrollbar, {
3459
+ style: {
3460
+ height: "400px",
3461
+ paddingRight: "10px"
3462
+ }
3463
+ }, ()=>(0, __WEBPACK_EXTERNAL_MODULE_vue__.h)("div", {
3464
+ style: {
3465
+ padding: "10px"
3466
+ },
3467
+ innerHTML: htmlContent
3468
+ })),
3469
+ footer: options.footer ? options.footer : ()=>(0, __WEBPACK_EXTERNAL_MODULE_vue__.h)("div", {
3470
+ class: "dialog-footer"
3471
+ }, [
3472
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.h)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElButton, {
3473
+ onClick: ()=>{
3474
+ options.onCancel?.(); // 触发取消回调
3475
+ closeDialog();
3476
+ }
3477
+ }, ()=>"取消")
3478
+ ])
3479
+ });
3480
+ // 将弹窗渲染到容器中
3481
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.render)(dialog, container);
3482
+ // 将容器添加到 body
3483
+ document.body.appendChild(container);
3484
+ }
3329
3485
  let defaultContext = {
3330
3486
  printParams: void 0,
3331
3487
  receiptInfo: void 0,
@@ -3621,7 +3777,7 @@ const printStart = async (params)=>{
3621
3777
  throw new Error("暂不支持该方式打印");
3622
3778
  }
3623
3779
  if (defaultContext?.dataSourceContentTypeCodeItem === constant_DATA_SOURCE_CONTENT_TYPE_CODE.JSON) {
3624
- const [, res] = await designPreviewPrintReceipt({
3780
+ const params = {
3625
3781
  formOperationType: defaultContext?.printParams?.formOperationType,
3626
3782
  printType: defaultContext?.printParams?.printType,
3627
3783
  receiptId: defaultContext?.printParams?.receiptId,
@@ -3630,31 +3786,25 @@ const printStart = async (params)=>{
3630
3786
  dataSourceContentTypeCode: defaultContext?.dataSourceContentTypeCodeItem,
3631
3787
  dataSourceContent: defaultContext?.dataSourceContentItem,
3632
3788
  printQty: defaultContext?.receiptInfo?.printQty
3633
- });
3634
- if (res?.success) return res.data ?? [];
3789
+ };
3790
+ /** 判断是否客户端打印 */ const { isLocalPrint } = use_app_config([
3791
+ use_app_config_MAIN_APP_CONFIG.IS_LOCAL_PRINT
3792
+ ]);
3793
+ if (isLocalPrint) {
3794
+ const [, res] = await designPreviewPrintReceipt(params);
3795
+ if (res?.success) return res.data ?? [];
3796
+ } else {
3797
+ /** 调用接口 */ const [, res] = await designPreviewPrintReceiptWeb(params);
3798
+ if (res?.success) {
3799
+ if (defaultContext?.printParams?.formOperationType === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FORM_OPERATION_TYPE.PRINT) useWebPrint(res?.data);
3800
+ else useDesignAndPreview(res?.data, defaultContext?.printParams?.formOperationType === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FORM_OPERATION_TYPE.DESIGN ? "设计" : "预览");
3801
+ }
3802
+ }
3635
3803
  }
3636
3804
  };
3637
3805
  const print = async (params)=>{
3638
3806
  await printStart(params);
3639
3807
  };
3640
- const usePrintReceipt = (params, isInit = true)=>{
3641
- const menuXReceiptList = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)([]);
3642
- const loading = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
3643
- const getMenuXReceiptList = async (params)=>{
3644
- loading.value = true;
3645
- const [, res] = await queryMenuXReceiptBySysMenuId(params);
3646
- loading.value = false;
3647
- if (res?.success) menuXReceiptList.value = res.data?.menuXReceiptList || [];
3648
- };
3649
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.onMounted)(()=>{
3650
- if (isInit) getMenuXReceiptList(params);
3651
- });
3652
- return {
3653
- menuXReceiptList,
3654
- loading,
3655
- getMenuXReceiptList
3656
- };
3657
- };
3658
3808
  /* ESM default export */ const printReceiptBtnvue_type_script_setup_true_lang_ts_name_printReceipt = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
3659
3809
  __name: 'printReceiptBtn',
3660
3810
  props: {
@@ -4134,6 +4284,8 @@ const DICT_SELECT = 'dictSelect';
4134
4284
  const _component_el_option = (0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("el-option");
4135
4285
  return 'select' === (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(attrs).component ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)((0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveDynamicComponent)(`el-${(0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(attrs).component}`), (0, __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps)({
4136
4286
  key: 0,
4287
+ ref_key: "componentRef",
4288
+ ref: componentRef,
4137
4289
  filterable: !!(__WEBPACK_EXTERNAL_MODULE_vue__.unref(attrs)?.filterable || __WEBPACK_EXTERNAL_MODULE_vue__.unref(attrs)?.options?.length && __WEBPACK_EXTERNAL_MODULE_vue__.unref(attrs)?.options?.length > 5) || false,
4138
4290
  clearable: true
4139
4291
  }, {
@@ -5356,6 +5508,9 @@ const access_infovue_type_script_setup_true_lang_ts_name_accessInfo_hoisted_3 =
5356
5508
  /* ESM default export */ const access_infovue_type_script_setup_true_lang_ts_name_accessInfo = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
5357
5509
  __name: 'index',
5358
5510
  props: {
5511
+ btnTitle: {
5512
+ default: "新患者"
5513
+ },
5359
5514
  code: {},
5360
5515
  menuId: {},
5361
5516
  clearBtn: {
@@ -5442,9 +5597,9 @@ const access_infovue_type_script_setup_true_lang_ts_name_accessInfo_hoisted_3 =
5442
5597
  plain: "",
5443
5598
  onClick: clearFn
5444
5599
  }, {
5445
- default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>_cache[0] || (_cache[0] = [
5446
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode)("新患者")
5447
- ])),
5600
+ default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
5601
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(_ctx.btnTitle), 1)
5602
+ ]),
5448
5603
  _: 1
5449
5604
  })) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true)
5450
5605
  ])
@@ -35,3 +35,9 @@ export declare const splitReceipt: (params: SplitReceiptReqParams) => Promise<[i
35
35
  * @returns
36
36
  */
37
37
  export declare const designPreviewPrintReceipt: (params: DesignPreviewPrintReceiptResParams) => Promise<any[]>;
38
+ /**
39
+ * [97-10005-1]web单据打印
40
+ * @param params
41
+ * @returns
42
+ */
43
+ export declare const designPreviewPrintReceiptWeb: (params: DesignPreviewPrintReceiptResParams) => Promise<[import("@sun-toolkit/request").SunApiResultData<null> | undefined, import("@sun-toolkit/request").SunApiResultData<unknown> | undefined]>;
@@ -1,4 +1,7 @@
1
+ import { VNode } from "vue";
2
+ import { DATA_SOURCE_CONTENT_TYPE_CODE } from "../constant";
1
3
  import type { MenuXReceiptReqParams, MenuXReceiptListReqItem } from "../types";
4
+ /** 用于获取单据 */
2
5
  export declare const usePrintReceipt: (params: MenuXReceiptReqParams, isInit?: boolean) => {
3
6
  menuXReceiptList: import("vue").Ref<{
4
7
  menuXReceiptId: string;
@@ -20,3 +23,14 @@ export declare const usePrintReceipt: (params: MenuXReceiptReqParams, isInit?: b
20
23
  loading: import("vue").Ref<boolean, boolean>;
21
24
  getMenuXReceiptList: (params: MenuXReceiptReqParams) => Promise<void>;
22
25
  };
26
+ /** web打印弹出打印框 类型默认是BASE64的格式
27
+ * type 数据源格式类型代码
28
+ * @param [type='BASE64']
29
+ */
30
+ export declare function useWebPrint(content: string, type?: DATA_SOURCE_CONTENT_TYPE_CODE): void;
31
+ /** 设计或预览 */
32
+ export declare function useDesignAndPreview(htmlContent: string | undefined, title?: string, options?: {
33
+ footer?: () => VNode;
34
+ onConfirm?: () => void;
35
+ onCancel?: () => void;
36
+ }): void;
@@ -1,8 +1,23 @@
1
- import { FieldNamesProps } from './interface';
1
+ import { FieldNamesProps } from "./interface";
2
2
  /**
3
3
  * @description: 是否为数组
4
4
  */
5
5
  export declare function isArray(val: any): val is Array<any>;
6
+ /**
7
+ * @description 生成随机数
8
+ * @param {Number} min 最小值
9
+ * @param {Number} max 最大值
10
+ * @returns {Number}
11
+ */
12
+ export declare function randomNum(min: number, max: number): number;
13
+ /**
14
+ * @description 格式化表格单元格默认值 (el-table-column)
15
+ * @param {Number} row 行
16
+ * @param {Number} col 列
17
+ * @param {*} callValue 当前单元格值
18
+ * @returns {String}
19
+ * */
20
+ export declare function formatTableColumn(row: number, col: number, callValue: unknown): {};
6
21
  /**
7
22
  * @description 处理 ProTable 值为数组 || 无数据
8
23
  * @param {*} callValue 需要处理的值
@@ -36,4 +51,4 @@ export declare function findItemNested(enumData: any, callValue: any, value: str
36
51
  * @param {String} type 过滤类型(目前只有 tag)
37
52
  * @returns {String}
38
53
  * */
39
- export declare function filterEnum(callValue: unknown, enumData?: unknown, fieldNames?: FieldNamesProps, type?: 'tag'): any;
54
+ export declare function filterEnum(callValue: unknown, enumData?: unknown, fieldNames?: FieldNamesProps, type?: "tag"): any;
package/dist/index.js CHANGED
@@ -269,8 +269,8 @@ const copy_text_with_tooltip_exports_ = /*#__PURE__*/ (0, exportHelper["default"
269
269
  * @returns {String}
270
270
  * */ function formatValue(callValue) {
271
271
  // 如果当前值为数组,使用 / 拼接(根据需求自定义)
272
- if (isArray(callValue)) return callValue.length ? callValue.join(' / ') : '--';
273
- return callValue ?? '--';
272
+ if (isArray(callValue)) return callValue.length ? callValue.join(" / ") : "--";
273
+ return callValue ?? "--";
274
274
  }
275
275
  /**
276
276
  * @description 处理 prop 为多级嵌套的情况,返回的数据 (列如: prop: user.name)
@@ -278,8 +278,8 @@ const copy_text_with_tooltip_exports_ = /*#__PURE__*/ (0, exportHelper["default"
278
278
  * @param {String} prop 当前 prop
279
279
  * @returns {*}
280
280
  * */ function handleRowAccordingToProp(row, prop) {
281
- if (!prop?.includes('.')) return row[prop] ?? '--';
282
- prop.split('.').forEach((item)=>row = row[item] ?? '--');
281
+ if (!prop?.includes(".")) return row[prop] ?? "--";
282
+ prop.split(".").forEach((item)=>row = row[item] ?? "--");
283
283
  return row;
284
284
  }
285
285
  /**
@@ -287,7 +287,7 @@ const copy_text_with_tooltip_exports_ = /*#__PURE__*/ (0, exportHelper["default"
287
287
  * @param {String} prop 当前 prop
288
288
  * @returns {String}
289
289
  * */ function handleProp(prop) {
290
- const propArr = prop.split('.');
290
+ const propArr = prop.split(".");
291
291
  if (1 == propArr.length) return prop;
292
292
  return propArr[propArr.length - 1];
293
293
  }
@@ -308,15 +308,15 @@ const copy_text_with_tooltip_exports_ = /*#__PURE__*/ (0, exportHelper["default"
308
308
  * @param {String} type 过滤类型(目前只有 tag)
309
309
  * @returns {String}
310
310
  * */ function filterEnum(callValue, enumData, fieldNames, type) {
311
- const value = fieldNames?.value ?? 'value';
312
- const label = fieldNames?.label ?? 'label';
313
- const children = fieldNames?.children ?? 'children';
311
+ const value = fieldNames?.value ?? "value";
312
+ const label = fieldNames?.label ?? "label";
313
+ const children = fieldNames?.children ?? "children";
314
314
  let filterData = {};
315
315
  // 判断 enumData 是否为数组
316
316
  if (Array.isArray(enumData)) filterData = findItemNested(enumData, callValue, value, children);
317
317
  // 判断是否输出的结果为 tag 类型
318
- if ('tag' == type) return filterData?.tagType ? filterData.tagType : '';
319
- return filterData ? filterData[label] : '--';
318
+ if ("tag" == type) return filterData?.tagType ? filterData.tagType : "";
319
+ return filterData ? filterData[label] : "--";
320
320
  }
321
321
  function _isSlot(s) {
322
322
  return 'function' == typeof s || '[object Object]' === Object.prototype.toString.call(s) && !(0, __WEBPACK_EXTERNAL_MODULE_vue__.isVNode)(s);
@@ -1416,7 +1416,7 @@ const pro_tablevue_type_script_lang_ts_setup_true_name_ProTable_hoisted_1 = {
1416
1416
  class: "relative flex flex-1 flex-col overflow-hidden"
1417
1417
  };
1418
1418
  const pro_tablevue_type_script_lang_ts_setup_true_name_ProTable_hoisted_2 = {
1419
- key: 0,
1419
+ key: 1,
1420
1420
  class: "mt-5 flex justify-between items-center"
1421
1421
  };
1422
1422
  // 接受父组件参数,配置默认值
@@ -1475,7 +1475,20 @@ const pro_tablevue_type_script_lang_ts_setup_true_name_ProTable_hoisted_2 = {
1475
1475
  default: ()=>({})
1476
1476
  },
1477
1477
  layout: {
1478
- default: 'total, sizes, prev, pager, next'
1478
+ default: "total, sizes, prev, pager, next"
1479
+ },
1480
+ dragTips: {
1481
+ default: "温馨提示:您可通过拖动进行排序"
1482
+ },
1483
+ isShowDragTips: {
1484
+ type: Boolean,
1485
+ default: false
1486
+ },
1487
+ dragTipsCustomStyle: {
1488
+ default: {}
1489
+ },
1490
+ dragTipsClassName: {
1491
+ default: ""
1479
1492
  }
1480
1493
  },
1481
1494
  emits: [
@@ -1720,6 +1733,18 @@ const pro_tablevue_type_script_lang_ts_setup_true_name_ProTable_hoisted_2 = {
1720
1733
  return (_ctx, _cache)=>{
1721
1734
  const _directive_loading = (0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveDirective)("loading");
1722
1735
  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, [
1736
+ props?.draggable || props?.isShowDragTips ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("div", {
1737
+ key: 0,
1738
+ style: (0, __WEBPACK_EXTERNAL_MODULE_vue__.normalizeStyle)({
1739
+ color: '#f7ba2a',
1740
+ ...props.dragTipsCustomStyle
1741
+ }),
1742
+ class: (0, __WEBPACK_EXTERNAL_MODULE_vue__.normalizeClass)([
1743
+ 'text-base',
1744
+ 'mb-2',
1745
+ props.dragTipsClassName
1746
+ ])
1747
+ }, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(props.dragTips), 7)) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true),
1723
1748
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(TableContainer, {
1724
1749
  ref_key: "formRef",
1725
1750
  ref: formRef,
@@ -2401,7 +2426,8 @@ function useColumnConfig(options) {
2401
2426
  emits: /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.mergeModels)([
2402
2427
  "enter",
2403
2428
  "input",
2404
- "select"
2429
+ "select",
2430
+ "clear"
2405
2431
  ], [
2406
2432
  "update:modelValue"
2407
2433
  ]),
@@ -2489,8 +2515,12 @@ function useColumnConfig(options) {
2489
2515
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event)=>model.value = $event),
2490
2516
  autofocus: true,
2491
2517
  onClick: handleReferenceClick,
2492
- onInput: _cache[1] || (_cache[1] = (e)=>emits('input', e)),
2493
- class: "w-[284px] flex-shrink-0 flex-grow-0",
2518
+ onInput: _cache[1] || (_cache[1] = (value)=>emits('input', value)),
2519
+ onClear: _cache[2] || (_cache[2] = ()=>emits('clear')),
2520
+ class: "flex-shrink-0 flex-grow-0",
2521
+ style: {
2522
+ width: "284px"
2523
+ },
2494
2524
  clearable: ""
2495
2525
  }, (0, __WEBPACK_EXTERNAL_MODULE_vue__.createSlots)({
2496
2526
  _: 2
@@ -2734,10 +2764,15 @@ const patient_accessvue_type_script_setup_true_lang_ts_hoisted_1 = {
2734
2764
  __name: 'index',
2735
2765
  props: {
2736
2766
  menuId: {},
2737
- code: {}
2767
+ code: {},
2768
+ showName: {
2769
+ type: Boolean,
2770
+ default: false
2771
+ }
2738
2772
  },
2739
2773
  emits: [
2740
- "change"
2774
+ "change",
2775
+ "clear"
2741
2776
  ],
2742
2777
  setup (__props, { expose: __expose, emit: __emit }) {
2743
2778
  const emits = __emit;
@@ -2778,6 +2813,8 @@ const patient_accessvue_type_script_setup_true_lang_ts_hoisted_1 = {
2778
2813
  /**
2779
2814
  * emit change事件,患者切换
2780
2815
  */ const handleChange = (data)=>{
2816
+ // 患者检索组件将患者姓名放在input框中
2817
+ if (__props.showName && data?.patientInfo?.patientName) inputValue.value = data.patientInfo.patientName;
2781
2818
  emits("change", {
2782
2819
  inputInfo: {
2783
2820
  value: inputValue.value,
@@ -2901,10 +2938,11 @@ const patient_accessvue_type_script_setup_true_lang_ts_hoisted_1 = {
2901
2938
  "search-loading": searchLoading.value,
2902
2939
  "input-change": inputChange.value,
2903
2940
  onInput: _cache[1] || (_cache[1] = ()=>inputChange.value = true),
2904
- onEnter: _cache[2] || (_cache[2] = ()=>{
2941
+ onClear: _cache[2] || (_cache[2] = ()=>emits('clear')),
2942
+ onEnter: _cache[3] || (_cache[3] = ()=>{
2905
2943
  handleAccess(activeAccessWay.value);
2906
2944
  }),
2907
- onSelect: _cache[3] || (_cache[3] = (rowData)=>{
2945
+ onSelect: _cache[4] || (_cache[4] = (rowData)=>{
2908
2946
  handleChange({
2909
2947
  patientInfo: rowData
2910
2948
  });
@@ -3227,16 +3265,6 @@ const _hoisted_12 = {
3227
3265
  };
3228
3266
  // 计算实际布局列数
3229
3267
  const layoutColumns = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>parseLayoutColumns(bannerInfo.value?.layoutTypeCode));
3230
- /** 如果是住院就诊,返回就诊状态和天数 */ const encounterInfo = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>{
3231
- if (BANNER_COMPONENT_CONFIG[__props.code].bizIdTypeCode !== __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.BIZ_ID_TYPE_CODE.IENC_ENCOUNTER) return null;
3232
- const bannerItems = bannerInfo.value?.bannerItemList ?? [];
3233
- const statusItem = bannerItems.find((item)=>"inEncStatusDesc" === item.bindingFieldNo);
3234
- const daysItem = bannerItems.find((item)=>"inpatientDays" === item.bindingFieldNo);
3235
- return {
3236
- inEncStatusDesc: statusItem?.dataValue ?? "--",
3237
- inpatientDays: daysItem?.dataValue ? `(${daysItem.dataValue})` : "--"
3238
- };
3239
- });
3240
3268
  /** 获取banner配置 */ const queryBannerConfig = async ()=>{
3241
3269
  loading.value = true;
3242
3270
  if (!__props.bizId && initBannerInfo.value) {
@@ -3251,7 +3279,7 @@ const _hoisted_12 = {
3251
3279
  });
3252
3280
  loading.value = false;
3253
3281
  if (res?.success) {
3254
- res.data.bannerItemList = (res?.data?.bannerItemList ?? [])?.filter((item)=>item.displayFlag);
3282
+ res.data.bannerItemList = (res?.data?.bannerItemList ?? [])?.filter((item)=>item?.displayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES);
3255
3283
  if (!__props.bizId) initBannerInfo.value = res?.data;
3256
3284
  bannerInfo.value = res?.data;
3257
3285
  }
@@ -3329,8 +3357,8 @@ const _hoisted_12 = {
3329
3357
  ]),
3330
3358
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("div", _hoisted_8, [
3331
3359
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(BANNER_COMPONENT_CONFIG)[_ctx.code].bizIdTypeCode === (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.BIZ_ID_TYPE_CODE).IENC_ENCOUNTER ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("div", _hoisted_9, [
3332
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("span", _hoisted_10, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(encounterInfo.value?.inEncStatusDesc), 1),
3333
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("span", null, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(encounterInfo.value?.inpatientDays), 1)
3360
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("span", _hoisted_10, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(bannerInfo.value?.inpatientStatusDesc ?? "--"), 1),
3361
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("span", null, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(bannerInfo.value?.inpatientDays ?? "--"), 1)
3334
3362
  ])) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true)
3335
3363
  ])
3336
3364
  ]),
@@ -3352,7 +3380,7 @@ const _hoisted_12 = {
3352
3380
  class: "w-full overflow-hidden text-ellipsis whitespace-nowrap",
3353
3381
  onMouseenter: checkTextOverflow
3354
3382
  }, [
3355
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("span", _hoisted_11, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(item.labelNameDisplay) + ":", 1),
3383
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("span", _hoisted_11, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(item.labelNameDisplay) + "", 1),
3356
3384
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(_component_el_tooltip, {
3357
3385
  disabled: !isTextOverflowing.value,
3358
3386
  content: item.dataValue
@@ -3618,6 +3646,11 @@ const pluginMainRequest = async (methodName, params)=>{
3618
3646
  * @param params
3619
3647
  * @returns
3620
3648
  */ const designPreviewPrintReceipt = (params)=>pluginMainRequest("designPreviewPrintReceipt", params);
3649
+ /**
3650
+ * [97-10005-1]web单据打印
3651
+ * @param params
3652
+ * @returns
3653
+ */ const designPreviewPrintReceiptWeb = (params)=>(0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.baseRequest)("/report/designPreviewPrintReceipt", params);
3621
3654
  /**
3622
3655
  * 分单方式代码
3623
3656
  */ var constant_RECEIPT_SPLIT_TYPE_CODE = /*#__PURE__*/ function(RECEIPT_SPLIT_TYPE_CODE) {
@@ -3724,6 +3757,129 @@ var constant_DATA_SOURCE_CONTENT_TYPE_CODE = /*#__PURE__*/ function(DATA_SOURCE_
3724
3757
  */ DATA_SOURCE_CONTENT_TYPE_CODE["BASE64"] = "BASE64";
3725
3758
  return DATA_SOURCE_CONTENT_TYPE_CODE;
3726
3759
  }({});
3760
+ /** 用于获取单据 */ const usePrintReceipt = (params, isInit = true)=>{
3761
+ const menuXReceiptList = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)([]);
3762
+ const loading = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
3763
+ const getMenuXReceiptList = async (params)=>{
3764
+ loading.value = true;
3765
+ const [, res] = await queryMenuXReceiptBySysMenuId(params);
3766
+ loading.value = false;
3767
+ if (res?.success) menuXReceiptList.value = res.data?.menuXReceiptList || [];
3768
+ };
3769
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.onMounted)(()=>{
3770
+ if (isInit) getMenuXReceiptList(params);
3771
+ });
3772
+ return {
3773
+ menuXReceiptList,
3774
+ loading,
3775
+ getMenuXReceiptList
3776
+ };
3777
+ };
3778
+ /** web打印弹出打印框 类型默认是BASE64的格式
3779
+ * type 数据源格式类型代码
3780
+ * @param [type='BASE64']
3781
+ */ function useWebPrint(content, type = constant_DATA_SOURCE_CONTENT_TYPE_CODE.BASE64) {
3782
+ // 创建隐藏的iframe
3783
+ const iframe = document.createElement("iframe");
3784
+ iframe.style.position = "fixed";
3785
+ iframe.style.right = "0";
3786
+ iframe.style.bottom = "0";
3787
+ iframe.style.width = "0";
3788
+ iframe.style.height = "0";
3789
+ iframe.style.border = "0";
3790
+ iframe.style.visibility = "hidden"; // 添加这行确保iframe完全隐藏
3791
+ document.body.appendChild(iframe);
3792
+ // 等待iframe加载完成
3793
+ iframe.onload = async ()=>{
3794
+ const iframeDoc = iframe.contentDocument || iframe.contentWindow?.document;
3795
+ // 根据类型处理内容
3796
+ if (type === constant_DATA_SOURCE_CONTENT_TYPE_CODE.H5 || type === constant_DATA_SOURCE_CONTENT_TYPE_CODE.JSON) {
3797
+ iframeDoc.body.innerHTML = content;
3798
+ return; // 不再执行打印操作
3799
+ }
3800
+ if (type === constant_DATA_SOURCE_CONTENT_TYPE_CODE.BASE64) {
3801
+ const img = new Image();
3802
+ // 处理Base64图片
3803
+ if (content.startsWith("data:image")) img.src = content;
3804
+ else // 如果不是完整的data URL,添加前缀
3805
+ img.src = `data:image/png;base64,${content}`;
3806
+ iframeDoc.body.appendChild(img);
3807
+ img.onerror = (error)=>{
3808
+ console.error("加载失败:", error);
3809
+ iframeDoc.body.innerHTML = "<p>加载失败,请检查数据</p>";
3810
+ };
3811
+ }
3812
+ /** 返回二进制文件时候的解析 */ // else if (type === "FILE") {
3813
+ // const blob = new Blob([content], { type: "application/pdf" });
3814
+ // const url = URL.createObjectURL(blob);
3815
+ // iframeDoc.body.innerHTML = `<embed src="${url}" type="application/pdf" width="100%" height="100%">`;
3816
+ // }
3817
+ await iframe.contentWindow?.focus();
3818
+ await iframe.contentWindow?.print();
3819
+ // 打印完成后移除iframe
3820
+ await document.body.removeChild(iframe);
3821
+ };
3822
+ // 最后添加到DOM
3823
+ document.body.appendChild(iframe);
3824
+ // 强制触发加载
3825
+ iframe.src = "about:blank";
3826
+ }
3827
+ /** 设计或预览 */ function useDesignAndPreview(htmlContent, title = "设计", options = {}) {
3828
+ // 创建一个容器元素
3829
+ const container = document.createElement("div");
3830
+ // 关闭弹窗的函数
3831
+ const closeDialog = ()=>{
3832
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.render)(null, container); // 卸载组件
3833
+ document.body.removeChild(container); // 移除容器
3834
+ document.head.removeChild(style); // 移除样式
3835
+ };
3836
+ // 在渲染前动态创建并插入样式
3837
+ const style = document.createElement("style");
3838
+ style.innerHTML = `
3839
+ .custom-dialog .el-dialog__headerbtn .el-icon {
3840
+ width: 48px; /* 设置图标的宽度 */
3841
+ height: 48px; /* 设置图标的高度 */
3842
+ }
3843
+ `;
3844
+ document.head.appendChild(style);
3845
+ // 使用 h 函数创建弹窗组件
3846
+ const dialog = (0, __WEBPACK_EXTERNAL_MODULE_vue__.h)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElDialog, {
3847
+ modelValue: true,
3848
+ title: title,
3849
+ width: "50%",
3850
+ onClose: ()=>{
3851
+ options.onCancel?.(); // 触发取消回调
3852
+ closeDialog();
3853
+ },
3854
+ class: "custom-dialog"
3855
+ }, {
3856
+ default: ()=>(0, __WEBPACK_EXTERNAL_MODULE_vue__.h)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElScrollbar, {
3857
+ style: {
3858
+ height: "400px",
3859
+ paddingRight: "10px"
3860
+ }
3861
+ }, ()=>(0, __WEBPACK_EXTERNAL_MODULE_vue__.h)("div", {
3862
+ style: {
3863
+ padding: "10px"
3864
+ },
3865
+ innerHTML: htmlContent
3866
+ })),
3867
+ footer: options.footer ? options.footer : ()=>(0, __WEBPACK_EXTERNAL_MODULE_vue__.h)("div", {
3868
+ class: "dialog-footer"
3869
+ }, [
3870
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.h)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElButton, {
3871
+ onClick: ()=>{
3872
+ options.onCancel?.(); // 触发取消回调
3873
+ closeDialog();
3874
+ }
3875
+ }, ()=>"取消")
3876
+ ])
3877
+ });
3878
+ // 将弹窗渲染到容器中
3879
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.render)(dialog, container);
3880
+ // 将容器添加到 body
3881
+ document.body.appendChild(container);
3882
+ }
3727
3883
  let defaultContext = {
3728
3884
  printParams: void 0,
3729
3885
  receiptInfo: void 0,
@@ -4019,7 +4175,7 @@ const printStart = async (params)=>{
4019
4175
  throw new Error("暂不支持该方式打印");
4020
4176
  }
4021
4177
  if (defaultContext?.dataSourceContentTypeCodeItem === constant_DATA_SOURCE_CONTENT_TYPE_CODE.JSON) {
4022
- const [, res] = await designPreviewPrintReceipt({
4178
+ const params = {
4023
4179
  formOperationType: defaultContext?.printParams?.formOperationType,
4024
4180
  printType: defaultContext?.printParams?.printType,
4025
4181
  receiptId: defaultContext?.printParams?.receiptId,
@@ -4028,31 +4184,25 @@ const printStart = async (params)=>{
4028
4184
  dataSourceContentTypeCode: defaultContext?.dataSourceContentTypeCodeItem,
4029
4185
  dataSourceContent: defaultContext?.dataSourceContentItem,
4030
4186
  printQty: defaultContext?.receiptInfo?.printQty
4031
- });
4032
- if (res?.success) return res.data ?? [];
4187
+ };
4188
+ /** 判断是否客户端打印 */ const { isLocalPrint } = use_app_config([
4189
+ use_app_config_MAIN_APP_CONFIG.IS_LOCAL_PRINT
4190
+ ]);
4191
+ if (isLocalPrint) {
4192
+ const [, res] = await designPreviewPrintReceipt(params);
4193
+ if (res?.success) return res.data ?? [];
4194
+ } else {
4195
+ /** 调用接口 */ const [, res] = await designPreviewPrintReceiptWeb(params);
4196
+ if (res?.success) {
4197
+ if (defaultContext?.printParams?.formOperationType === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FORM_OPERATION_TYPE.PRINT) useWebPrint(res?.data);
4198
+ else useDesignAndPreview(res?.data, defaultContext?.printParams?.formOperationType === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FORM_OPERATION_TYPE.DESIGN ? "设计" : "预览");
4199
+ }
4200
+ }
4033
4201
  }
4034
4202
  };
4035
4203
  const print = async (params)=>{
4036
4204
  await printStart(params);
4037
4205
  };
4038
- const usePrintReceipt = (params, isInit = true)=>{
4039
- const menuXReceiptList = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)([]);
4040
- const loading = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
4041
- const getMenuXReceiptList = async (params)=>{
4042
- loading.value = true;
4043
- const [, res] = await queryMenuXReceiptBySysMenuId(params);
4044
- loading.value = false;
4045
- if (res?.success) menuXReceiptList.value = res.data?.menuXReceiptList || [];
4046
- };
4047
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.onMounted)(()=>{
4048
- if (isInit) getMenuXReceiptList(params);
4049
- });
4050
- return {
4051
- menuXReceiptList,
4052
- loading,
4053
- getMenuXReceiptList
4054
- };
4055
- };
4056
4206
  /* ESM default export */ const printReceiptBtnvue_type_script_setup_true_lang_ts_name_printReceipt = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
4057
4207
  __name: 'printReceiptBtn',
4058
4208
  props: {
@@ -4748,6 +4898,8 @@ const DICT_SELECT = 'dictSelect';
4748
4898
  const _component_el_option = (0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("el-option");
4749
4899
  return 'select' === (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(attrs).component ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)((0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveDynamicComponent)(`el-${(0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(attrs).component}`), (0, __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps)({
4750
4900
  key: 0,
4901
+ ref_key: "componentRef",
4902
+ ref: componentRef,
4751
4903
  filterable: !!(__WEBPACK_EXTERNAL_MODULE_vue__.unref(attrs)?.filterable || __WEBPACK_EXTERNAL_MODULE_vue__.unref(attrs)?.options?.length && __WEBPACK_EXTERNAL_MODULE_vue__.unref(attrs)?.options?.length > 5) || false,
4752
4904
  clearable: true
4753
4905
  }, {
@@ -5234,6 +5386,9 @@ const access_infovue_type_script_setup_true_lang_ts_name_accessInfo_hoisted_3 =
5234
5386
  /* ESM default export */ const access_infovue_type_script_setup_true_lang_ts_name_accessInfo = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
5235
5387
  __name: 'index',
5236
5388
  props: {
5389
+ btnTitle: {
5390
+ default: "新患者"
5391
+ },
5237
5392
  code: {},
5238
5393
  menuId: {},
5239
5394
  clearBtn: {
@@ -5320,9 +5475,9 @@ const access_infovue_type_script_setup_true_lang_ts_name_accessInfo_hoisted_3 =
5320
5475
  plain: "",
5321
5476
  onClick: clearFn
5322
5477
  }, {
5323
- default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>_cache[0] || (_cache[0] = [
5324
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode)("新患者")
5325
- ])),
5478
+ default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
5479
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(_ctx.btnTitle), 1)
5480
+ ]),
5326
5481
  _: 1
5327
5482
  })) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true)
5328
5483
  ])
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "sun-biz",
3
- "version": "0.0.3-beta.5",
3
+ "version": "0.0.3-beta.7",
4
4
  "type": "module",
5
+ "workspaces": [
6
+ "src/*",
7
+ "docs"
8
+ ],
5
9
  "exports": {
6
10
  ".": {
7
11
  "types": "./dist/index.d.ts",
@@ -25,6 +29,9 @@
25
29
  "build": "rslib build",
26
30
  "build:storybook": "storybook build",
27
31
  "dev": "rslib build --watch",
32
+ "docs:dev": "pnpm run -C docs docs:dev",
33
+ "docs:build": "pnpm run -C docs docs:build",
34
+ "docs:serve": "pnpm run -C docs docs:serve",
28
35
  "storybook": "storybook dev -p 6007"
29
36
  },
30
37
  "devDependencies": {
@@ -56,12 +63,12 @@
56
63
  "vue": "^3.2.0"
57
64
  },
58
65
  "dependencies": {
59
- "@element-sun/icons-vue": "^1.0.5",
60
- "@sun-toolkit/enums": "1.0.0-beta.10",
61
- "@sun-toolkit/request": "1.0.0-beta.5",
62
- "@sun-toolkit/shared": "0.0.1-beta.3",
66
+ "@element-sun/icons-vue": "^1.0.6",
67
+ "@sun-toolkit/enums": "1.0.0-beta.12",
68
+ "@sun-toolkit/request": "1.0.0-beta.10",
69
+ "@sun-toolkit/shared": "0.0.1-beta.4",
63
70
  "axios": "^1.8.1",
64
- "element-sun": "0.0.0-dev.2",
71
+ "element-sun": "0.0.0-dev.4",
65
72
  "i18next": "^23.16.8",
66
73
  "i18next-vue": "^5.2.0",
67
74
  "js-pinyin": "^0.2.7",