sun-biz 0.0.4-beta.50 → 0.0.4-beta.51

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/index.js CHANGED
@@ -9,8 +9,8 @@ import * as __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__ from "@sun-toolkit/s
9
9
  import * as __WEBPACK_EXTERNAL_MODULE__sun_toolkit_micro_app__ from "@sun-toolkit/micro-app";
10
10
  import * as __WEBPACK_EXTERNAL_MODULE_vue_router__ from "vue-router";
11
11
  import * as __WEBPACK_EXTERNAL_MODULE_js_pinyin__ from "js-pinyin";
12
- import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
13
12
  import * as __WEBPACK_EXTERNAL_MODULE_i18next_vue__ from "i18next-vue";
13
+ import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
14
14
  var __webpack_modules__ = {
15
15
  "./node_modules/.pnpm/vue-loader@17.4.2_vue@3.5.18_typescript@5.9.2__webpack@5.101.0_esbuild@0.24.2_/node_modules/vue-loader/dist/exportHelper.js": function(__unused_webpack_module, exports) {
16
16
  // runtime helper for setting properties on components
@@ -1397,8 +1397,11 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1397
1397
  columns: {
1398
1398
  default: ()=>[]
1399
1399
  },
1400
+ defaultColumns: {
1401
+ default: ()=>[]
1402
+ },
1400
1403
  componentNo: {
1401
- default: ""
1404
+ default: ''
1402
1405
  },
1403
1406
  columnsSetting: {
1404
1407
  default: ()=>({
@@ -1417,7 +1420,7 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1417
1420
  use_app_config_MAIN_APP_CONFIG.USER_INFO
1418
1421
  ]);
1419
1422
  const isAdmin = userInfo?.adminFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES || userInfo?.userJobCode === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG_STR.NO;
1420
- const componentId = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)("");
1423
+ const componentId = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)('');
1421
1424
  const fullscreen = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(true);
1422
1425
  const confirmLoading = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
1423
1426
  const applicationLoading = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
@@ -1425,14 +1428,14 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1425
1428
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.onMounted)(()=>{
1426
1429
  dialogRef.value.open();
1427
1430
  });
1428
- const scrollKeyWord = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)("");
1431
+ const scrollKeyWord = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)('');
1429
1432
  const dataSetList = use_fetch_dataset([
1430
1433
  __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INFLUENCE_SCOPE_CODE_NAME
1431
1434
  ]);
1432
1435
  const renderDialog = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(true); //控制prodialog 是否销毁
1433
1436
  const dbgridTableConfigRef = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
1434
1437
  const influenceScopeList = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>dataSetList?.value?.[__WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INFLUENCE_SCOPE_CODE_NAME] || []);
1435
- const bizId = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)("");
1438
+ const bizId = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)('');
1436
1439
  const tableRef = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
1437
1440
  const serveDbgridComponentSettingList = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
1438
1441
  const loading = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(true);
@@ -1441,14 +1444,14 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1441
1444
  const userList = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)([]);
1442
1445
  const sourceData = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)([]);
1443
1446
  const disabledDraggable = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>!props.columnsSetting?.draggable);
1444
- function initColumns() {
1445
- sourceData.value = props.columns.map((item, index)=>({
1447
+ function setColumns(isDefault = false) {
1448
+ sourceData.value = (isDefault ? props.defaultColumns : props.columns).map((item, index)=>({
1446
1449
  ...item,
1447
1450
  minWidth: item.minWidth || item.width,
1448
1451
  sort: index + 1,
1449
- columnClass: "truncate",
1452
+ columnClass: 'truncate',
1450
1453
  render: (row, index)=>{
1451
- if (!item.render) return "我是示例的文案";
1454
+ if (!item.render) return '我是示例的文案';
1452
1455
  {
1453
1456
  let _slot;
1454
1457
  return (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElButton, {
@@ -1469,7 +1472,7 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1469
1472
  }));
1470
1473
  }
1471
1474
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>props.columns, ()=>{
1472
- initColumns();
1475
+ setColumns();
1473
1476
  }, {
1474
1477
  immediate: true
1475
1478
  });
@@ -1483,16 +1486,16 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1483
1486
  });
1484
1487
  if (result?.success) {
1485
1488
  if (result?.data?.length) {
1486
- componentId.value = result.data[0].componentId || "";
1489
+ componentId.value = result.data[0].componentId || '';
1487
1490
  serveDbgridComponentSettingList.value = result.data[0].dbgridComponentSettingList || [];
1488
1491
  if (isAdmin && userInfo?.userJobCode !== __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG_STR.NO) influenceScopeCode.value = __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INFLUENCE_SCOPE_CODE.PUBLIC;
1489
1492
  else {
1490
1493
  influenceScopeCode.value = __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INFLUENCE_SCOPE_CODE.PRiVATE;
1491
- bizId.value = userInfo?.userId || "";
1494
+ bizId.value = userInfo?.userId || '';
1492
1495
  userList.value = [
1493
1496
  {
1494
- userId: userInfo?.userId || "",
1495
- userName: userInfo?.userName || ""
1497
+ userId: userInfo?.userId || '',
1498
+ userName: userInfo?.userName || ''
1496
1499
  }
1497
1500
  ];
1498
1501
  }
@@ -1503,7 +1506,7 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1503
1506
  async function fetchUserList(value) {
1504
1507
  const [, res] = await queryUserList({
1505
1508
  enabledFlag: 1,
1506
- hospitalId: currentOrg?.orgId || "",
1509
+ hospitalId: currentOrg?.orgId || '',
1507
1510
  keyWord: value
1508
1511
  });
1509
1512
  if (res?.success) userList.value = res.data || [];
@@ -1520,10 +1523,21 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1520
1523
  let serverColum = [];
1521
1524
  if (serveDbgridComponentSettingList.value?.length) {
1522
1525
  let findObj = serveDbgridComponentSettingList.value.find((item)=>item.influenceScopeCode === newValues[0] && (item.bizId === newValues[1] || !item.bizId && !newValues[1]));
1523
- serverColum = findObj ? findObj.dbgridSettingValue : serveDbgridComponentSettingList.value.find((item)=>item.influenceScopeCode === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INFLUENCE_SCOPE_CODE.PUBLIC)?.dbgridSettingValue || serveDbgridComponentSettingList.value[0].dbgridSettingValue;
1526
+ if (findObj) serverColum = findObj.dbgridSettingValue;
1527
+ else {
1528
+ let publicValue = serveDbgridComponentSettingList.value.find((item)=>item.influenceScopeCode === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INFLUENCE_SCOPE_CODE.PUBLIC && !item.bizId);
1529
+ if (publicValue) serverColum = publicValue.dbgridSettingValue;
1530
+ else {
1531
+ setColumns(true);
1532
+ return;
1533
+ }
1534
+ }
1535
+ } else {
1536
+ setColumns(true); //执行默认值配置
1537
+ return;
1524
1538
  }
1525
1539
  try {
1526
- serverColum = JSON.parse(serverColum);
1540
+ serverColum = JSON.parse(serverColum) || [];
1527
1541
  } catch (err) {
1528
1542
  serverColum = [];
1529
1543
  console.log(err);
@@ -1559,13 +1573,13 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1559
1573
  return item;
1560
1574
  });
1561
1575
  }
1562
- function submit(isSave) {
1576
+ function submit(isSave, resetDefault = false) {
1563
1577
  return new Promise((resolve, reject)=>{
1564
1578
  if (influenceScopeCode.value === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INFLUENCE_SCOPE_CODE.PRiVATE && !bizId.value) {
1565
- __WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.warning("请选择操作员");
1579
+ __WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.warning('请选择操作员');
1566
1580
  return reject([
1567
- "",
1568
- new Error("参数错误")
1581
+ '',
1582
+ new Error('参数错误')
1569
1583
  ]);
1570
1584
  }
1571
1585
  let dbgridComponentSettingList = [];
@@ -1605,22 +1619,26 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1605
1619
  bizId: influenceScopeCode.value === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INFLUENCE_SCOPE_CODE.PRiVATE ? bizId.value : void 0
1606
1620
  }
1607
1621
  ];
1622
+ if (resetDefault) dbgridComponentSettingList = dbgridComponentSettingList.filter((item)=>{
1623
+ if (bizId.value) return !(item.bizId === bizId.value && item.influenceScopeCode === influenceScopeCode.value);
1624
+ return item.influenceScopeCode !== influenceScopeCode.value;
1625
+ });
1608
1626
  saveDbgridComponentSetting({
1609
1627
  componentId: componentId.value,
1610
1628
  dbgridComponentSettingList
1611
1629
  }).then((result)=>{
1612
1630
  let [, data] = result;
1613
1631
  if (data?.success) {
1614
- __WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.success(isSave ? "保存成功" : "应用成功");
1632
+ __WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.success(isSave ? '保存成功' : '应用成功');
1615
1633
  resolve([]);
1616
1634
  } else reject([
1617
- "",
1618
- new Error("接口错误")
1635
+ '',
1636
+ new Error('接口错误')
1619
1637
  ]);
1620
1638
  }, ()=>{
1621
1639
  reject([
1622
- "",
1623
- new Error("未知错误")
1640
+ '',
1641
+ new Error('未知错误')
1624
1642
  ]);
1625
1643
  });
1626
1644
  });
@@ -1635,11 +1653,11 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1635
1653
  let columnIndex = tableColumn.value.findIndex((item)=>item.prop === columnName);
1636
1654
  if (-1 !== columnIndex) {
1637
1655
  const tableEl = tableRef?.value?.proTableRef?.$el;
1638
- const columns = Array.from(tableEl.querySelectorAll(".el-table__body-wrapper colgroup col"));
1639
- const targetColumnStart = columns.slice(0, columnIndex).reduce((acc, col)=>acc + parseInt(col?.getAttribute("width") || "0"), 0); // 计算将目标列滚动到中间的位置
1656
+ const columns = Array.from(tableEl.querySelectorAll('.el-table__body-wrapper colgroup col'));
1657
+ const targetColumnStart = columns.slice(0, columnIndex).reduce((acc, col)=>acc + parseInt(col?.getAttribute('width') || '0'), 0); // 计算将目标列滚动到中间的位置
1640
1658
  const wrapperWidth = tableRef?.value?.proTableRef?.$el.clientWidth; // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1641
1659
  //@ts-expect-error
1642
- const columnWidth = parseInt(columns[columnIndex]?.getAttribute("width"));
1660
+ const columnWidth = parseInt(columns[columnIndex]?.getAttribute('width'));
1643
1661
  const scrollPosition = targetColumnStart - wrapperWidth / 2 + columnWidth / 2;
1644
1662
  tableRef?.value?.proTableRef.setScrollLeft(scrollPosition);
1645
1663
  }
@@ -1648,8 +1666,8 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1648
1666
  let findIndex = sourceData.value.findIndex((item)=>item.prop === columnName);
1649
1667
  const row = dbgridTableConfigRef?.value?.tableRef?.proTableRef?.$el?.querySelector(`.el-table__body-wrapper tbody tr:nth-child(${findIndex + 1})`);
1650
1668
  row?.scrollIntoView({
1651
- behavior: "smooth",
1652
- block: "center"
1669
+ behavior: 'smooth',
1670
+ block: 'center'
1653
1671
  });
1654
1672
  dbgridTableConfigRef?.value?.tableRef?.setCurrentRow(sourceData.value[findIndex]);
1655
1673
  };
@@ -1664,11 +1682,11 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1664
1682
  function handleCancel() {
1665
1683
  dialogRef.value.close();
1666
1684
  }
1667
- async function handleConfirm(isSave = true) {
1685
+ async function handleConfirm(isSave = true, resetDefault = false) {
1668
1686
  const loadingRef = isSave ? confirmLoading : applicationLoading;
1669
1687
  loadingRef.value = true;
1670
1688
  try {
1671
- const [err] = await submit(isSave);
1689
+ const [err] = await submit(isSave, resetDefault);
1672
1690
  loadingRef.value = false;
1673
1691
  if (!err) {
1674
1692
  if (isSave) handleCancel();
@@ -1694,12 +1712,27 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1694
1712
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElButton), {
1695
1713
  onClick: handleCancel
1696
1714
  }, {
1697
- default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>_cache[7] || (_cache[7] = [
1715
+ default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>_cache[8] || (_cache[8] = [
1698
1716
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode)("取消", -1)
1699
1717
  ])),
1700
1718
  _: 1,
1701
1719
  __: [
1702
- 7
1720
+ 8
1721
+ ]
1722
+ }),
1723
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElButton), {
1724
+ type: "primary",
1725
+ plain: "",
1726
+ onClick: _cache[4] || (_cache[4] = ()=>{
1727
+ handleConfirm(true, true);
1728
+ })
1729
+ }, {
1730
+ default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>_cache[9] || (_cache[9] = [
1731
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode)("恢复默认", -1)
1732
+ ])),
1733
+ _: 1,
1734
+ __: [
1735
+ 9
1703
1736
  ]
1704
1737
  }),
1705
1738
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElButton), {
@@ -1707,16 +1740,16 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1707
1740
  loading: applicationLoading.value,
1708
1741
  disabled: applicationLoading.value,
1709
1742
  plain: "",
1710
- onClick: _cache[4] || (_cache[4] = ()=>{
1743
+ onClick: _cache[5] || (_cache[5] = ()=>{
1711
1744
  handleConfirm(false);
1712
1745
  })
1713
1746
  }, {
1714
- default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>_cache[8] || (_cache[8] = [
1747
+ default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>_cache[10] || (_cache[10] = [
1715
1748
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode)("应用", -1)
1716
1749
  ])),
1717
1750
  _: 1,
1718
1751
  __: [
1719
- 8
1752
+ 10
1720
1753
  ]
1721
1754
  }, 8, [
1722
1755
  "loading",
@@ -1726,16 +1759,16 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1726
1759
  loading: confirmLoading.value,
1727
1760
  type: "primary",
1728
1761
  disabled: confirmLoading.value,
1729
- onClick: _cache[5] || (_cache[5] = ()=>{
1762
+ onClick: _cache[6] || (_cache[6] = ()=>{
1730
1763
  handleConfirm(true);
1731
1764
  })
1732
1765
  }, {
1733
- default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>_cache[9] || (_cache[9] = [
1766
+ default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>_cache[11] || (_cache[11] = [
1734
1767
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode)(" 确认 ", -1)
1735
1768
  ])),
1736
1769
  _: 1,
1737
1770
  __: [
1738
- 9
1771
+ 11
1739
1772
  ]
1740
1773
  }, 8, [
1741
1774
  "loading",
@@ -1777,7 +1810,7 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1777
1810
  ]),
1778
1811
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("div", dbgrid_component_settingvue_type_script_setup_true_lang_tsx_hoisted_2, [
1779
1812
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("div", null, [
1780
- _cache[6] || (_cache[6] = (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("span", null, "影响范围", -1)),
1813
+ _cache[7] || (_cache[7] = (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("span", null, "影响范围", -1)),
1781
1814
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElSelect), {
1782
1815
  disabled: !(0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(isAdmin),
1783
1816
  class: "ml-6 mr-4 w-52",
@@ -1897,7 +1930,7 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1897
1930
  const dbgrid_component_setting_exports_ = /*#__PURE__*/ (0, exportHelper["default"])(dbgrid_component_settingvue_type_script_setup_true_lang_tsx, [
1898
1931
  [
1899
1932
  '__scopeId',
1900
- "data-v-a780c5b2"
1933
+ "data-v-c6055652"
1901
1934
  ]
1902
1935
  ]);
1903
1936
  /* ESM default export */ const dbgrid_component_setting = dbgrid_component_setting_exports_;
@@ -1932,21 +1965,22 @@ const tableColumnSetting = (options)=>{
1932
1965
  const TableSettingButtonvue_type_script_setup_true_lang_tsx_hoisted_1 = {
1933
1966
  class: "el-dropdown-link absolute left-1 top-2 z-50 cursor-pointer text-primary"
1934
1967
  };
1935
- const FILE_TYPE_CODE = "FILE_TYPE_CODE";
1936
- const COLUMN_SETTING = "column-setting";
1937
- const EXPORT_FILE = "export-file";
1968
+ const FILE_TYPE_CODE = 'FILE_TYPE_CODE';
1969
+ const COLUMN_SETTING = 'column-setting';
1970
+ const EXPORT_FILE = 'export-file';
1938
1971
  /* ESM default export */ const TableSettingButtonvue_type_script_setup_true_lang_tsx = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
1939
1972
  __name: 'TableSettingButton',
1940
1973
  props: {
1941
1974
  tableData: {},
1942
1975
  columns: {},
1976
+ defaultColumns: {},
1943
1977
  componentNo: {},
1944
1978
  columnsSetting: {},
1945
1979
  exportFileFlag: {},
1946
1980
  componentDesc: {}
1947
1981
  },
1948
1982
  emits: [
1949
- "success"
1983
+ 'success'
1950
1984
  ],
1951
1985
  setup (__props, { emit: __emit }) {
1952
1986
  const dataSetList = use_fetch_dataset([
@@ -1959,7 +1993,7 @@ const EXPORT_FILE = "export-file";
1959
1993
  let result = [
1960
1994
  {
1961
1995
  value: COLUMN_SETTING,
1962
- label: "表格设置",
1996
+ label: '表格设置',
1963
1997
  children: []
1964
1998
  }
1965
1999
  ];
@@ -1967,13 +2001,13 @@ const EXPORT_FILE = "export-file";
1967
2001
  let list = dataSetList.value?.[FILE_TYPE_CODE] || [];
1968
2002
  if (1 === list.length) result.push({
1969
2003
  value: list[0]?.dataValueNo,
1970
- label: "导出文件",
2004
+ label: '导出文件',
1971
2005
  disabled: !props.tableData.length,
1972
2006
  children: []
1973
2007
  });
1974
2008
  if (list.length > 1) result.push({
1975
2009
  value: EXPORT_FILE,
1976
- label: "导出文件",
2010
+ label: '导出文件',
1977
2011
  disabled: !props.tableData.length,
1978
2012
  children: list.map((item)=>({
1979
2013
  value: item?.dataValueNo,
@@ -1984,15 +2018,15 @@ const EXPORT_FILE = "export-file";
1984
2018
  return result;
1985
2019
  });
1986
2020
  const getRenderedContent = (render, row, index)=>{
1987
- const tempDiv = document.createElement("div");
2021
+ const tempDiv = document.createElement('div');
1988
2022
  const app = (0, __WEBPACK_EXTERNAL_MODULE_vue__.createApp)({
1989
2023
  render () {
1990
- return (0, __WEBPACK_EXTERNAL_MODULE_vue__.h)("div", {}, render(row, index));
2024
+ return (0, __WEBPACK_EXTERNAL_MODULE_vue__.h)('div', {}, render(row, index));
1991
2025
  }
1992
2026
  });
1993
2027
  app.use(__WEBPACK_EXTERNAL_MODULE_element_sun__["default"]);
1994
2028
  app.mount(tempDiv);
1995
- const content = tempDiv.textContent || "";
2029
+ const content = tempDiv.textContent || '';
1996
2030
  app.unmount();
1997
2031
  return content;
1998
2032
  };
@@ -2008,7 +2042,7 @@ const EXPORT_FILE = "export-file";
2008
2042
  rowSequenceNo: index,
2009
2043
  rowRecordList: props.columns.filter((col)=>col.prop && col.displayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.YES && col.prop !== OPERATION).map((col)=>{
2010
2044
  let value = item[col.prop];
2011
- if ("function" == typeof col.render) try {
2045
+ if ('function' == typeof col.render) try {
2012
2046
  value = getRenderedContent(col.render, item, index) || value;
2013
2047
  } catch (error) {
2014
2048
  console.warn(`Render function error for column ${col.prop}:`, error);
@@ -2026,7 +2060,7 @@ const EXPORT_FILE = "export-file";
2026
2060
  fileName: `${props.componentDesc}.xlsx`,
2027
2061
  data: res?.data?.fileString
2028
2062
  });
2029
- __WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.success("导出成功");
2063
+ __WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.success('导出成功');
2030
2064
  }
2031
2065
  }
2032
2066
  function hide() {
@@ -2036,10 +2070,11 @@ const EXPORT_FILE = "export-file";
2036
2070
  if (props.columnsSetting?.disabled) return;
2037
2071
  tableColumnSetting({
2038
2072
  columns: props.columns,
2073
+ defaultColumns: props.defaultColumns,
2039
2074
  componentNo: props.componentNo,
2040
2075
  columnsSetting: props.columnsSetting,
2041
2076
  success: ()=>{
2042
- emit("success");
2077
+ emit('success');
2043
2078
  }
2044
2079
  });
2045
2080
  }
@@ -2139,7 +2174,7 @@ const EXPORT_FILE = "export-file";
2139
2174
  const TableSettingButton_exports_ = /*#__PURE__*/ (0, exportHelper["default"])(TableSettingButtonvue_type_script_setup_true_lang_tsx, [
2140
2175
  [
2141
2176
  '__scopeId',
2142
- "data-v-0aa25cee"
2177
+ "data-v-a526e56a"
2143
2178
  ]
2144
2179
  ]);
2145
2180
  /* ESM default export */ const TableSettingButton = TableSettingButton_exports_;
@@ -2167,6 +2202,7 @@ const Tablevue_type_script_setup_true_lang_tsx_name_Table_hoisted_1 = {
2167
2202
  rowKey: {},
2168
2203
  tableColumns: {},
2169
2204
  commonColumns: {},
2205
+ defaultColumns: {},
2170
2206
  columnsSetting: {},
2171
2207
  rowClassName: {
2172
2208
  type: [
@@ -2211,6 +2247,7 @@ const Tablevue_type_script_setup_true_lang_tsx_name_Table_hoisted_1 = {
2211
2247
  "component-no": props.componentNo,
2212
2248
  "columns-setting": props.columnsSetting,
2213
2249
  columns: _ctx.commonColumns,
2250
+ defaultColumns: _ctx.defaultColumns,
2214
2251
  ref: "tableSettingButtonRef",
2215
2252
  onSuccess: _cache[0] || (_cache[0] = ($event)=>emits('success'))
2216
2253
  }, null, 8, [
@@ -2219,7 +2256,8 @@ const Tablevue_type_script_setup_true_lang_tsx_name_Table_hoisted_1 = {
2219
2256
  "export-file-flag",
2220
2257
  "component-no",
2221
2258
  "columns-setting",
2222
- "columns"
2259
+ "columns",
2260
+ "defaultColumns"
2223
2261
  ])) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true),
2224
2262
  (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)({
2225
2263
  id: props.id,
@@ -2371,7 +2409,7 @@ const pro_tablevue_type_script_lang_ts_setup_true_name_ProTable_hoisted_2 = {
2371
2409
  key: 1,
2372
2410
  class: "mt-5 flex items-center justify-between"
2373
2411
  };
2374
- const SELECTION = "selection";
2412
+ const SELECTION = 'selection';
2375
2413
  /**
2376
2414
  *获取参与排序的列表 索引 是否可以拖拽
2377
2415
  */ /* ESM default export */ const pro_tablevue_type_script_lang_ts_setup_true_name_ProTable = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
@@ -2397,7 +2435,7 @@ const SELECTION = "selection";
2397
2435
  default: 80
2398
2436
  },
2399
2437
  componentNo: {
2400
- default: ""
2438
+ default: ''
2401
2439
  },
2402
2440
  hiddenDefaultText: {
2403
2441
  type: Boolean,
@@ -2429,7 +2467,7 @@ const SELECTION = "selection";
2429
2467
  default: true
2430
2468
  },
2431
2469
  rowKey: {
2432
- default: "id"
2470
+ default: 'id'
2433
2471
  },
2434
2472
  stripe: {
2435
2473
  type: Boolean,
@@ -2451,13 +2489,13 @@ const SELECTION = "selection";
2451
2489
  default: ()=>({})
2452
2490
  },
2453
2491
  layout: {
2454
- default: "total, sizes, prev, pager, next"
2492
+ default: 'total, sizes, prev, pager, next'
2455
2493
  },
2456
2494
  formDisabled: {
2457
2495
  type: Boolean
2458
2496
  },
2459
2497
  dragTips: {
2460
- default: "温馨提示:您可通过拖动进行排序"
2498
+ default: '温馨提示:您可通过拖动进行排序'
2461
2499
  },
2462
2500
  isShowDragTips: {
2463
2501
  type: Boolean,
@@ -2467,7 +2505,7 @@ const SELECTION = "selection";
2467
2505
  default: {}
2468
2506
  },
2469
2507
  dragTipsClassName: {
2470
- default: ""
2508
+ default: ''
2471
2509
  },
2472
2510
  settingIconWidth: {
2473
2511
  default: 36
@@ -2493,7 +2531,7 @@ const SELECTION = "selection";
2493
2531
  const sortFieldList = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(void 0);
2494
2532
  const exportFileFlag = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(__WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO);
2495
2533
  const showSetting = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
2496
- const componentDesc = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)("文件");
2534
+ const componentDesc = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)('文件');
2497
2535
  let state = (0, __WEBPACK_EXTERNAL_MODULE_vue__.reactive)({
2498
2536
  // 表格数据
2499
2537
  tableData: props.data,
@@ -2520,7 +2558,7 @@ const SELECTION = "selection";
2520
2558
  const emit = __emit;
2521
2559
  const attrs = (0, __WEBPACK_EXTERNAL_MODULE_vue__.useAttrs)();
2522
2560
  // 提供静态数据
2523
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.provide)("hiddenDefaultText", props.hiddenDefaultText);
2561
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.provide)('hiddenDefaultText', props.hiddenDefaultText);
2524
2562
  const tableRef = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
2525
2563
  const proTableRef = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>tableRef.value?.proTableRef);
2526
2564
  function getDragSortData(newIndex, data, startIndexObj, sortData, childrenKey) {
@@ -2569,7 +2607,7 @@ const SELECTION = "selection";
2569
2607
  return data;
2570
2608
  }
2571
2609
  // 生成每一行的唯一 path
2572
- function getRowPath(row, data, rowKey, parentPath = "", childrenKey) {
2610
+ function getRowPath(row, data, rowKey, parentPath = '', childrenKey) {
2573
2611
  for(let i = 0; i < data.length; i++){
2574
2612
  if (data[i][rowKey] === row[rowKey]) {
2575
2613
  const currentPath = parentPath ? `${parentPath}-${i}` : `${i}`;
@@ -2577,49 +2615,49 @@ const SELECTION = "selection";
2577
2615
  }
2578
2616
  if (childrenKey && Array.isArray(data[i][childrenKey])) {
2579
2617
  const childPath = getRowPath(row, data[i][childrenKey], rowKey, parentPath ? `${parentPath}-${i}` : `${i}`, childrenKey);
2580
- if ("" !== childPath) return childPath;
2618
+ if ('' !== childPath) return childPath;
2581
2619
  }
2582
2620
  }
2583
- return "";
2621
+ return '';
2584
2622
  }
2585
2623
  // 获取childrenKey的安全写法
2586
2624
  function getSafeChildrenKeyFromAttrs(attrs) {
2587
- const treePropsRaw = attrs["tree-props"];
2588
- const treeProps = "object" == typeof treePropsRaw && null !== treePropsRaw ? treePropsRaw : void 0;
2589
- if (treeProps && "children" in treeProps) return treeProps.children;
2625
+ const treePropsRaw = attrs['tree-props'];
2626
+ const treeProps = 'object' == typeof treePropsRaw && null !== treePropsRaw ? treePropsRaw : void 0;
2627
+ if (treeProps && 'children' in treeProps) return treeProps.children;
2590
2628
  }
2591
2629
  // 兼容外部 row-class-name,自动适配参数类型
2592
2630
  function rowClassNameWrapper(rowOrParams, rowIndexArg) {
2593
2631
  let row, rowIndex;
2594
- if (rowOrParams && "object" == typeof rowOrParams && "row" in rowOrParams && "rowIndex" in rowOrParams) {
2632
+ if (rowOrParams && 'object' == typeof rowOrParams && 'row' in rowOrParams && 'rowIndex' in rowOrParams) {
2595
2633
  row = rowOrParams.row;
2596
2634
  rowIndex = rowOrParams.rowIndex;
2597
2635
  } else {
2598
2636
  row = rowOrParams;
2599
2637
  rowIndex = rowIndexArg;
2600
2638
  }
2601
- let externalClass = "";
2602
- const external = attrs["row-class-name"];
2603
- if ("function" == typeof external) externalClass = external({
2639
+ let externalClass = '';
2640
+ const external = attrs['row-class-name'];
2641
+ if ('function' == typeof external) externalClass = external({
2604
2642
  row,
2605
2643
  rowIndex
2606
2644
  });
2607
- else if ("string" == typeof external) externalClass = external;
2608
- let pathClass = "";
2645
+ else if ('string' == typeof external) externalClass = external;
2646
+ let pathClass = '';
2609
2647
  let childrenKey = getSafeChildrenKeyFromAttrs(attrs);
2610
- let path = getRowPath(row, state.tableData, props.rowKey, "", childrenKey);
2648
+ let path = getRowPath(row, state.tableData, props.rowKey, '', childrenKey);
2611
2649
  pathClass = `row-path-${path}`;
2612
2650
  return [
2613
2651
  externalClass,
2614
2652
  pathClass
2615
- ].filter(Boolean).join(" ");
2653
+ ].filter(Boolean).join(' ');
2616
2654
  }
2617
2655
  /***
2618
2656
  * 表格拖拽排序
2619
2657
  **/ const initDragSort = ()=>{
2620
2658
  const tbodyList = document.querySelectorAll(`#${uuid.value} tbody`);
2621
2659
  const tbody = tbodyList[tbodyList.length - 1];
2622
- let initialHTML = "";
2660
+ let initialHTML = '';
2623
2661
  let crossLevelWarned = false;
2624
2662
  // 新增:销毁旧的Sortable实例
2625
2663
  // 新增:销毁旧的Sortable实例
@@ -2628,19 +2666,19 @@ const SELECTION = "selection";
2628
2666
  sortableInstance = null;
2629
2667
  }
2630
2668
  if (tbody) sortableInstance = __WEBPACK_EXTERNAL_MODULE_sortablejs__["default"].create(tbody, {
2631
- handle: ".cursor-move",
2669
+ handle: '.cursor-move',
2632
2670
  group: props.dragGroupName,
2633
2671
  animation: 300,
2634
2672
  scroll: true,
2635
2673
  scrollSensitivity: 80,
2636
2674
  scrollSpeed: 10,
2637
2675
  onMove (evt) {
2638
- const draggedPath = evt.dragged?.className.match(/row-path-([\d-]+)/)?.[1] || "";
2639
- const relatedPath = evt.related?.className.match(/row-path-([\d-]+)/)?.[1] || "";
2640
- const getParent = (p)=>p.split("-").slice(0, -1).join("-");
2676
+ const draggedPath = evt.dragged?.className.match(/row-path-([\d-]+)/)?.[1] || '';
2677
+ const relatedPath = evt.related?.className.match(/row-path-([\d-]+)/)?.[1] || '';
2678
+ const getParent = (p)=>p.split('-').slice(0, -1).join('-');
2641
2679
  if (draggedPath && relatedPath && getParent(draggedPath) !== getParent(relatedPath)) {
2642
2680
  if (!crossLevelWarned) {
2643
- __WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.warning("暂不支持跨层级拖拽配置");
2681
+ __WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.warning('暂不支持跨层级拖拽配置');
2644
2682
  crossLevelWarned = true;
2645
2683
  }
2646
2684
  return false;
@@ -2650,7 +2688,7 @@ const SELECTION = "selection";
2650
2688
  onEnd (evt) {
2651
2689
  const { newIndex, oldIndex } = evt;
2652
2690
  if (props.dragGroupName) {
2653
- emit("drag-end", {
2691
+ emit('drag-end', {
2654
2692
  crossGroup: evt.from !== evt.to,
2655
2693
  oldIndex,
2656
2694
  newIndex
@@ -2658,11 +2696,11 @@ const SELECTION = "selection";
2658
2696
  return;
2659
2697
  }
2660
2698
  const dragTr = evt.item;
2661
- const match = dragTr.className.split(" ").find((cls)=>cls.startsWith("row-path-"));
2662
- const fromPath = match ? match.replace("row-path-", "") : "";
2699
+ const match = dragTr.className.split(' ').find((cls)=>cls.startsWith('row-path-'));
2700
+ const fromPath = match ? match.replace('row-path-', '') : '';
2663
2701
  let childrenKey = getSafeChildrenKeyFromAttrs(attrs);
2664
2702
  const getPathByIndex = (targetIndex)=>{
2665
- let path = "";
2703
+ let path = '';
2666
2704
  let count = -1;
2667
2705
  function dfs(arr, parent) {
2668
2706
  for(let i = 0; i < arr.length; i++){
@@ -2678,13 +2716,13 @@ const SELECTION = "selection";
2678
2716
  }
2679
2717
  return false;
2680
2718
  }
2681
- dfs(state.tableData, "");
2719
+ dfs(state.tableData, '');
2682
2720
  return path;
2683
2721
  };
2684
- if ("number" != typeof newIndex || "number" != typeof oldIndex || newIndex === oldIndex) return;
2722
+ if ('number' != typeof newIndex || 'number' != typeof oldIndex || newIndex === oldIndex) return;
2685
2723
  const newPath = getPathByIndex(newIndex);
2686
2724
  const oldPath = getPathByIndex(oldIndex);
2687
- const getParent = (p)=>p.split("-").slice(0, -1).join("-");
2725
+ const getParent = (p)=>p.split('-').slice(0, -1).join('-');
2688
2726
  if (getParent(newPath) !== getParent(oldPath)) // 这里不再需要回退DOM,onMove已阻止
2689
2727
  return;
2690
2728
  let data = getSortableResult(newIndex, oldIndex);
@@ -2697,7 +2735,7 @@ const SELECTION = "selection";
2697
2735
  initDragSort();
2698
2736
  });
2699
2737
  }
2700
- emit("drag-end", data, {
2738
+ emit('drag-end', data, {
2701
2739
  fromPath,
2702
2740
  oldIndex,
2703
2741
  newIndex
@@ -2716,7 +2754,7 @@ const SELECTION = "selection";
2716
2754
  });
2717
2755
  async function fetchDbgridComponent() {
2718
2756
  let [, result] = await queryDbgridComponentByExample({
2719
- componentNo: props.componentNo || ""
2757
+ componentNo: props.componentNo || ''
2720
2758
  });
2721
2759
  if (result?.success) {
2722
2760
  exportFileFlag.value = result.data.exportFileFlag;
@@ -2731,7 +2769,7 @@ const SELECTION = "selection";
2731
2769
  }));
2732
2770
  proTableRef.value?.clearSort();
2733
2771
  serveColumns.value = column;
2734
- emit("columns-config-change", column);
2772
+ emit('columns-config-change', column);
2735
2773
  } catch (error) {
2736
2774
  console.log(error);
2737
2775
  }
@@ -2765,7 +2803,7 @@ const SELECTION = "selection";
2765
2803
  state.pageInfo.pageNumber = 1;
2766
2804
  state.pageInfo.pageSize = val;
2767
2805
  fetchList();
2768
- } else emit("size-page-change", val);
2806
+ } else emit('size-page-change', val);
2769
2807
  };
2770
2808
  /**
2771
2809
  * 分页组件改变 当前页数 事件
@@ -2773,7 +2811,7 @@ const SELECTION = "selection";
2773
2811
  if (props.fetchData) {
2774
2812
  state.pageInfo.pageNumber = val;
2775
2813
  fetchList();
2776
- } else emit("current-page-change", val);
2814
+ } else emit('current-page-change', val);
2777
2815
  }
2778
2816
  const selections = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
2779
2817
  // 设置当前行激活态
@@ -2796,7 +2834,7 @@ const SELECTION = "selection";
2796
2834
  result = multiFieldSort(result, sortFieldList.value);
2797
2835
  }
2798
2836
  if (Object.keys(props.filterObj).length) return result.filter((item)=>Object.keys(props.filterObj).every((cur)=>!props.filterObj[cur] && [
2799
- "",
2837
+ '',
2800
2838
  void 0,
2801
2839
  null
2802
2840
  ].includes(props.filterObj[cur]) || item[cur] === props.filterObj[cur]));
@@ -2804,7 +2842,7 @@ const SELECTION = "selection";
2804
2842
  });
2805
2843
  // 严格按用户要求递归赋值方法
2806
2844
  function setDataByPath(path, data, childrenKey) {
2807
- const indices = path.split("-").map((i)=>Number(i));
2845
+ const indices = path.split('-').map((i)=>Number(i));
2808
2846
  if (1 === indices.length) {
2809
2847
  state.tableData = data;
2810
2848
  return;
@@ -2851,6 +2889,15 @@ const SELECTION = "selection";
2851
2889
  },
2852
2890
  rowClassName: rowClassNameWrapper
2853
2891
  });
2892
+ const defaultColumns = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>{
2893
+ let result = [
2894
+ ...props.columns
2895
+ ].map((cur)=>({
2896
+ displayFlag: cur.isHidden || cur.defaultDisplayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO ? __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO : __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.YES,
2897
+ ...cur
2898
+ }));
2899
+ return result;
2900
+ });
2854
2901
  /**
2855
2902
  * 处理接口和本地的columns
2856
2903
  */ const commonColumns = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>{
@@ -2860,16 +2907,15 @@ const SELECTION = "selection";
2860
2907
  if (props.couldSortFieldList && props.couldSortFieldList?.length) propsColumns = propsColumns.map((item)=>{
2861
2908
  let supportSort = !!(props.couldSortFieldList || []).find((cur)=>cur.fieldName === item.prop);
2862
2909
  return {
2863
- sortable: !!supportSort && (props.pagination ? "custom" : supportSort),
2910
+ sortable: !!supportSort && (props.pagination ? 'custom' : supportSort),
2864
2911
  ...item
2865
2912
  };
2866
2913
  });
2867
2914
  if (!(props.componentNo || serveColumns.value?.length)) return propsColumns;
2868
2915
  {
2869
- let result = propsColumns.map((cur)=>({
2870
- displayFlag: cur.isHidden || cur.defaultDisplayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO ? __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO : __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.YES,
2871
- ...cur
2872
- }));
2916
+ let result = [
2917
+ ...defaultColumns.value
2918
+ ];
2873
2919
  if (serveColumns.value?.length) {
2874
2920
  result = result.map((item, index)=>{
2875
2921
  let findObj = serveColumns.value.find((cur)=>cur.prop === item.prop) || {
@@ -2901,7 +2947,7 @@ const SELECTION = "selection";
2901
2947
  const bottomOffset = scrollHeight - event.scrollTop - clientHeight;
2902
2948
  if (event.scrollTop < oldScrollTop && 0 === bottomOffset) proTableRef.value.setScrollTop(0);
2903
2949
  if (bottomOffset < threshold && event.scrollTop > oldScrollTop) {
2904
- console.log("触发加载更多数据");
2950
+ console.log('触发加载更多数据');
2905
2951
  props.scrollLoad();
2906
2952
  }
2907
2953
  oldScrollTop = event.scrollTop;
@@ -2923,7 +2969,7 @@ const SELECTION = "selection";
2923
2969
  type: SELECTION,
2924
2970
  prop: SELECTION,
2925
2971
  minWidth: 80,
2926
- label: ""
2972
+ label: ''
2927
2973
  },
2928
2974
  ...result
2929
2975
  ];
@@ -2944,7 +2990,7 @@ const SELECTION = "selection";
2944
2990
  return isTips;
2945
2991
  });
2946
2992
  function sortChange({ column, order, prop }) {
2947
- if (!props.couldSortFieldList?.length) return emit("sort-change", {
2993
+ if (!props.couldSortFieldList?.length) return emit('sort-change', {
2948
2994
  column,
2949
2995
  order,
2950
2996
  prop
@@ -3013,7 +3059,8 @@ const SELECTION = "selection";
3013
3059
  ref: tableRef,
3014
3060
  data: tableData.value,
3015
3061
  "row-key": props.rowKey,
3016
- "table-columns": tableColumns.value
3062
+ "table-columns": tableColumns.value,
3063
+ defaultColumns: defaultColumns.value
3017
3064
  }, _ctx.$attrs, {
3018
3065
  draggable: props.draggable,
3019
3066
  "row-class-name": rowClassNameWrapper
@@ -3040,6 +3087,7 @@ const SELECTION = "selection";
3040
3087
  "data",
3041
3088
  "row-key",
3042
3089
  "table-columns",
3090
+ "defaultColumns",
3043
3091
  "draggable"
3044
3092
  ]))
3045
3093
  ]),
@@ -7854,200 +7902,43 @@ const TAG_MARGIN = 1; // 1rem
7854
7902
  const tag_select_exports_ = tag_selectvue_type_script_lang_ts_setup_true;
7855
7903
  /* ESM default export */ const tag_select = tag_select_exports_;
7856
7904
  /**
7857
- * [1-10013-1]根据条件查询用户列表
7905
+ * [1-10661-1] 根据条件查询用户列表
7858
7906
  * @param params
7859
7907
  * @returns
7860
7908
  */ const api_queryUserList = (params)=>(0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.dictRequest)('/user/queryUserSelectListByExample', params, {
7861
7909
  cancel: false
7862
7910
  });
7863
- /* ESM default export */ const user_selectvue_type_script_setup_true_lang_ts_name_UserSelect = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
7864
- __name: 'index',
7865
- props: {
7866
- keyWord: {},
7867
- hospitalId: {},
7868
- userJobCodes: {},
7869
- bizUnitId: {},
7870
- userTypeCode: {},
7871
- multiSelectFlag: {
7872
- type: Boolean
7873
- },
7874
- defaultValue: {},
7875
- selectProps: {}
7876
- },
7877
- emits: [
7878
- 'change'
7879
- ],
7880
- setup (__props, { expose: __expose, emit: __emit }) {
7881
- const props = __props;
7882
- const attrs = (0, __WEBPACK_EXTERNAL_MODULE_vue__.useAttrs)();
7883
- const emit = __emit;
7884
- const selectRef = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
7885
- const loading = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
7886
- const filterKeyWord = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(''); // 检索值
7887
- const userList = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)([]);
7888
- const defaultValueInserted = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
7889
- const selectProps = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(props.selectProps || {});
7890
- const getUserList = async (data)=>{
7891
- loading.value = true;
7892
- const [, res] = await api_queryUserList({
7893
- ...data,
7894
- enabledFlag: __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES,
7895
- userJobCodes: props.userJobCodes,
7896
- bizUnitId: props.bizUnitId,
7897
- userTypeCode: props.userTypeCode,
7898
- hospitalId: 'all' === props.hospitalId ? void 0 : props.hospitalId,
7899
- pageNumber: 1,
7900
- pageSize: __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ONE_PAGE_SIZE
7901
- });
7902
- loading.value = false;
7903
- if (res?.success) {
7904
- let defaultList = [];
7905
- if (attrs.modelValue && Array.isArray(props.defaultValue) && props.defaultValue.length) // 兼容表单回显时的默认值缺失
7906
- defaultList = props.defaultValue.map((item)=>({
7907
- ...item,
7908
- userId: item.value || item.userId,
7909
- userName: item.label || item.userName
7910
- }));
7911
- let list = (res.data ?? []).map((item)=>({
7912
- ...item,
7913
- label: item.userName,
7914
- value: item.userId
7915
- }));
7916
- if (defaultList.length) list = (0, __WEBPACK_EXTERNAL_MODULE_lodash__.uniqBy)([
7917
- ...list,
7918
- ...defaultList
7919
- ], 'userId');
7920
- defaultValueInserted.value = true;
7921
- userList.value = list.map((item)=>({
7922
- ...item,
7923
- label: item.userNo ? `${item.label || item.userName}|${item.userNo}` : item.label || item.userName
7924
- }));
7925
- }
7926
- };
7927
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>props.defaultValue, ()=>{
7928
- if (attrs.modelValue && Array.isArray(props.defaultValue) && props.defaultValue.length && !defaultValueInserted.value) userList.value = [
7929
- ...props.defaultValue
7930
- ];
7931
- }, {
7932
- deep: true,
7933
- immediate: true
7934
- });
7935
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>props.selectProps, ()=>{
7936
- selectProps.value = props.selectProps || {};
7937
- }, {
7938
- deep: true,
7939
- immediate: true
7940
- });
7941
- const onChange = (value)=>{
7942
- if (attrs['onUpdate:modelValue']) attrs['onUpdate:modelValue'](value);
7943
- if (props.multiSelectFlag) emit('change', value);
7944
- else {
7945
- const user = userList.value.find((item)=>item.value === value || item.userId === value);
7946
- emit('change', value, user);
7947
- }
7948
- };
7949
- const handelRemoteMethod = async (value)=>{
7950
- if (filterKeyWord.value !== value) filterKeyWord.value = value || '';
7951
- else if (!value && userList.value.length) return;
7952
- try {
7953
- loading.value = true;
7954
- await getUserList({
7955
- keyWord: value
7956
- });
7957
- } finally{
7958
- loading.value = false;
7959
- }
7960
- };
7961
- const fetchData = async (data)=>{
7962
- await getUserList(data);
7963
- };
7964
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.onMounted)(()=>{
7965
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.nextTick)(async ()=>{
7966
- if (props.keyWord && selectRef.value) {
7967
- const inputEl = selectRef.value?.$el.querySelector('input');
7968
- if (inputEl) {
7969
- inputEl.value = props.keyWord;
7970
- // 创建 input 事件模拟用户输入
7971
- const event = new Event('input', {
7972
- bubbles: true
7973
- });
7974
- inputEl.dispatchEvent(event);
7975
- }
7976
- }
7977
- await fetchData();
7978
- });
7979
- });
7980
- __expose({
7981
- selectRef,
7982
- defaultValueInserted,
7983
- userList,
7984
- fetchData
7985
- });
7986
- return (_ctx, _cache)=>{
7987
- const _component_el_option = (0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("el-option");
7988
- const _component_el_select = (0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("el-select");
7989
- return (0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)(_component_el_select, (0, __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps)({
7990
- ref_key: "selectRef",
7991
- ref: selectRef,
7992
- remote: "",
7993
- clearable: "",
7994
- filterable: "",
7995
- loading: loading.value,
7996
- multiple: !!props.multiSelectFlag,
7997
- "remote-method": handelRemoteMethod,
7998
- onClear: _cache[0] || (_cache[0] = ($event)=>userList.value = []),
7999
- onChange: onChange
8000
- }, selectProps.value), {
8001
- label: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(({ label })=>[
8002
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("span", null, (0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(label?.split('|')?.[0]), 1)
8003
- ]),
8004
- default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
8005
- ((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)(userList.value, (item)=>((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)(_component_el_option, {
8006
- key: item.value || item.userId,
8007
- label: item.label || item.userName,
8008
- value: item.value || item.userId
8009
- }, null, 8, [
8010
- "label",
8011
- "value"
8012
- ]))), 128))
8013
- ]),
8014
- _: 1
8015
- }, 16, [
8016
- "loading",
8017
- "multiple"
8018
- ]);
8019
- };
7911
+ const user_selectvue_type_script_lang_tsx_name_UserSelect_setup_true_hoisted_1 = {
7912
+ class: "flex flex-col",
7913
+ style: {
7914
+ "min-width": "500px"
8020
7915
  }
8021
- });
8022
- const user_select_exports_ = user_selectvue_type_script_setup_true_lang_ts_name_UserSelect;
8023
- /* ESM default export */ const user_select = user_select_exports_;
8024
- /**
8025
- * [1-10155-1] 根据条件查询业务单元列表
8026
- * 是否分页 Y
8027
- * @param params
8028
- * @returns
8029
- */ const queryBizUnitList = (params)=>(0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.dictRequest)('/organization/queryBizUnitListByExample', params);
7916
+ };
7917
+ const user_selectvue_type_script_lang_tsx_name_UserSelect_setup_true_hoisted_2 = {
7918
+ class: "border-t pt-2 px-2"
7919
+ };
8030
7920
  // 全局事件:用于关闭其他实例的 popover
8031
- const CLOSE_OTHER_POPOVERS_EVENT = 'biz-unit-select:close-others'; /*
8032
- 96-10014-1 业务单元选择组件
8033
- 1、调用“1-10516-1 根据条件查询业务单元列表”传入“启用标志=1、关键字、医院标识=入参:医院标识、科室类型代码集合、就诊类型代码”查询业务单元列表
8034
- 2、展示列包括“组织类型、编码、名称”
7921
+ const CLOSE_OTHER_POPOVERS_EVENT = 'user-select:close-others'; /*
7922
+ 调用"1-10013-1 根据条件查询用户列表"传入"启用标志=1、关键字、医院标识
7923
+ 入参:医院标识、用户岗位代码集合、服务业务单元标识、用户类别代码"查询用户列表
8035
7924
  */
8036
- /* ESM default export */ const biz_unit_selectvue_type_script_lang_tsx_name_BizUnitSelect_setup_true = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
7925
+ /* ESM default export */ const user_selectvue_type_script_lang_tsx_name_UserSelect_setup_true = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
8037
7926
  __name: 'index',
8038
7927
  props: {
8039
7928
  keyWord: {},
8040
7929
  hospitalId: {},
8041
- orgTypeCodes: {},
7930
+ userJobCodes: {},
7931
+ bizUnitId: {},
7932
+ userTypeCode: {},
8042
7933
  multiSelectFlag: {
8043
7934
  type: Boolean
8044
7935
  },
8045
7936
  defaultValue: {},
8046
- encounterTypeCode: {},
8047
7937
  disabledValueIds: {},
8048
- deptId: {},
8049
7938
  tableProps: {},
8050
- selectProps: {}
7939
+ selectProps: {},
7940
+ onlyEnabledFlag: {},
7941
+ allowSelectDisabledFlag: {}
8051
7942
  },
8052
7943
  emits: [
8053
7944
  'change'
@@ -8069,14 +7960,20 @@ const CLOSE_OTHER_POPOVERS_EVENT = 'biz-unit-select:close-others'; /*
8069
7960
  const loading = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
8070
7961
  const popoverVisible = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
8071
7962
  const currentRowIndex = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(0);
8072
- const clearing = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
8073
- const bizUnitList = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)([]); // 业务单元列表
7963
+ const clearing = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false); // 仅查启用:默认为 true
7964
+ const onlyEnabled = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(true); // 根据 onlyEnabledFlag 初始化,只有明确传 FLAG.NO(0) 时才不勾选
7965
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>props.onlyEnabledFlag, (val)=>{
7966
+ onlyEnabled.value = val !== __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.NO;
7967
+ }, {
7968
+ immediate: true
7969
+ });
7970
+ const userList = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)([]); // 用户列表
8074
7971
  const selectedValue = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(); // select组件绑定的选中的值
8075
7972
  const selectedRows = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)([]); // table表格选中的值
8076
7973
  const defaultSetTableSelected = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false); // 传入的默认数据已经绑定到表格中
8077
7974
  const initComponentData = ()=>{
8078
7975
  popoverVisible.value = false;
8079
- bizUnitList.value = [];
7976
+ userList.value = [];
8080
7977
  selectedValue.value = void 0;
8081
7978
  selectedRows.value = [];
8082
7979
  handleChange();
@@ -8084,7 +7981,7 @@ const CLOSE_OTHER_POPOVERS_EVENT = 'biz-unit-select:close-others'; /*
8084
7981
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>attrs?.modelValue, (newVal)=>{
8085
7982
  if (newVal) {
8086
7983
  if (!props.multiSelectFlag) {
8087
- const item = bizUnitList.value.find((item)=>item.value === newVal);
7984
+ const item = userList.value.find((item)=>item.value === newVal);
8088
7985
  if (item?.label && selectedValue.value !== item.label) {
8089
7986
  selectedValue.value = item.label;
8090
7987
  selectedRows.value = [
@@ -8113,12 +8010,12 @@ const CLOSE_OTHER_POPOVERS_EVENT = 'biz-unit-select:close-others'; /*
8113
8010
  if (attrs.modelValue && Array.isArray(props.defaultValue) && props.defaultValue.length && !defaultSetTableSelected.value) {
8114
8011
  const list = props.defaultValue.map((item)=>({
8115
8012
  ...item,
8116
- orgId: item.value || item.orgId,
8117
- orgNameDisplay: item.label || item.orgNameDisplay,
8118
- value: item.value || item.orgId,
8119
- label: item.label || item.orgNameDisplay
8013
+ userId: item.value || item.userId,
8014
+ userName: item.label || item.userName,
8015
+ value: item.value || item.userId,
8016
+ label: item.label || item.userName
8120
8017
  }));
8121
- bizUnitList.value = [
8018
+ userList.value = [
8122
8019
  ...list
8123
8020
  ];
8124
8021
  }
@@ -8126,7 +8023,7 @@ const CLOSE_OTHER_POPOVERS_EVENT = 'biz-unit-select:close-others'; /*
8126
8023
  deep: true,
8127
8024
  immediate: true
8128
8025
  });
8129
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>props.orgTypeCodes, (newVal, oldVal)=>{
8026
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>props.userJobCodes, (newVal, oldVal)=>{
8130
8027
  if (newVal && !(0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__.isEqual)(oldVal, newVal)) initComponentData();
8131
8028
  });
8132
8029
  const tableConfig = useColumnConfig({
@@ -8136,43 +8033,649 @@ const CLOSE_OTHER_POPOVERS_EVENT = 'biz-unit-select:close-others'; /*
8136
8033
  prop: 'indexNo',
8137
8034
  type: 'selection',
8138
8035
  isHidden: !props.multiSelectFlag,
8139
- selectable: (row)=>!(props.disabledValueIds?.length && row.orgId && props.disabledValueIds.includes(row.orgId)) && true
8036
+ selectable: (row)=>{
8037
+ if (props.disabledValueIds?.length && row.userId && props.disabledValueIds.includes(row.userId)) return false;
8038
+ // 检查是否允许选择停用数据(默认不允许)
8039
+ if (props.allowSelectDisabledFlag !== __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES && row.enabledFlag !== __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES) return false;
8040
+ return true;
8041
+ }
8140
8042
  },
8141
8043
  {
8142
- label: t('bizUnitSelect.table.orgNo', '编码'),
8143
- prop: 'orgNo',
8144
- minWidth: 100
8044
+ label: t('userSelect.table.userNo', '用户编码'),
8045
+ prop: 'userNo',
8046
+ minWidth: 120
8145
8047
  },
8146
8048
  {
8147
- label: t('bizUnitSelect.table.orgNameDisplay', '名称'),
8148
- prop: 'orgNameDisplay',
8149
- minWidth: 200
8049
+ label: t('userSelect.table.userName', '用户名称'),
8050
+ prop: 'userName',
8051
+ minWidth: 120
8150
8052
  },
8151
8053
  {
8152
- label: t('bizUnitSelect.table.orgTypeDescDisplay', '组织类型'),
8153
- prop: 'orgTypeDescDisplay',
8154
- minWidth: 100
8054
+ label: t('userSelect.table.userJobDesc', '用户岗位'),
8055
+ prop: 'userJobDesc',
8056
+ minWidth: 120
8057
+ },
8058
+ {
8059
+ label: t('userSelect.table.enabledFlag', '状态'),
8060
+ prop: 'enabledFlag',
8061
+ minWidth: 80,
8062
+ render: (row)=>{
8063
+ const isDisabled = row.enabledFlag !== __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES;
8064
+ const statusText = isDisabled ? t('userSelect.status.disabled', '停用') : t('userSelect.status.enabled', '启用'); // 如果不允许选择停用数据且当前记录为停用,显示红色 tooltip(默认不允许)
8065
+ if (props.allowSelectDisabledFlag !== __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES && isDisabled) return (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("el-tooltip"), {
8066
+ content: t('userSelect.errorTip.disabledUserSelectedTip', '已停用不可选!'),
8067
+ placement: "top",
8068
+ effect: "light",
8069
+ "popper-class": "disabled-user-tooltip"
8070
+ }, {
8071
+ default: ()=>[
8072
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)("span", {
8073
+ style: "color: #f56c6c"
8074
+ }, [
8075
+ statusText
8076
+ ])
8077
+ ]
8078
+ }, 8, [
8079
+ "content"
8080
+ ]);
8081
+ return statusText;
8082
+ }
8155
8083
  }
8156
8084
  ]
8157
8085
  });
8158
8086
  const getRowClassName = (data)=>{
8159
- if (props.disabledValueIds?.length && data.row.orgId && props.disabledValueIds.includes(data.row.orgId)) return 'cursor-not-allowed !bg-gray-100 text-gray-300';
8087
+ if (props.disabledValueIds?.length && data.row.userId && props.disabledValueIds.includes(data.row.userId)) return 'cursor-not-allowed !bg-gray-100 text-gray-300';
8088
+ // 检查是否允许选择停用数据(默认不允许)
8089
+ if (props.allowSelectDisabledFlag !== __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES && data.row.enabledFlag !== __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES) return 'cursor-not-allowed !bg-gray-100 text-gray-300 disabled-row';
8160
8090
  return 'cursor-pointer';
8161
8091
  };
8162
- const getBizUnitList = async (data)=>{
8092
+ const getUserList = async (data)=>{
8163
8093
  loading.value = true;
8164
- const [, res] = await queryBizUnitList({
8094
+ const [, res] = await api_queryUserList({
8165
8095
  ...data,
8166
- hospitalId: props.hospitalId,
8167
- orgTypeCodes: props.orgTypeCodes,
8168
- enabledFlag: __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES,
8169
- encounterTypeCode: props.encounterTypeCode,
8170
- deptId: props.deptId
8171
- });
8172
- loading.value = false;
8173
- if (res?.success) {
8174
- let defaultList = [];
8175
- if (attrs.modelValue && Array.isArray(props.defaultValue) && props.defaultValue.length && !data?.keyWord) defaultList = props.defaultValue.map((item)=>({
8096
+ hospitalId: 'all' === props.hospitalId ? void 0 : props.hospitalId,
8097
+ userJobCodes: props.userJobCodes,
8098
+ bizUnitId: props.bizUnitId,
8099
+ userTypeCode: props.userTypeCode,
8100
+ enabledFlag: onlyEnabled.value ? __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES : void 0,
8101
+ pageNumber: 1,
8102
+ pageSize: __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ONE_PAGE_SIZE
8103
+ });
8104
+ loading.value = false;
8105
+ if (res?.success) {
8106
+ let list = (res.data ?? []).map((item)=>({
8107
+ ...item,
8108
+ label: item.userName,
8109
+ value: item.userId
8110
+ })); // 保留已选中的项,确保选中状态能正确回显
8111
+ if (selectedRows.value?.length) {
8112
+ const selectedList = selectedRows.value.map((item)=>({
8113
+ ...item,
8114
+ userId: item.value || item.userId,
8115
+ userName: item.label || item.userName,
8116
+ value: item.value || item.userId,
8117
+ label: item.label || item.userName
8118
+ }));
8119
+ list = (0, __WEBPACK_EXTERNAL_MODULE_lodash__.uniqBy)([
8120
+ ...list,
8121
+ ...selectedList
8122
+ ], 'userId');
8123
+ } else if (attrs.modelValue && Array.isArray(props.defaultValue) && props.defaultValue.length) {
8124
+ const defaultList = props.defaultValue.map((item)=>({
8125
+ ...item,
8126
+ userId: item.value || item.userId,
8127
+ userName: item.label || item.userName,
8128
+ value: item.value || item.userId,
8129
+ label: item.label || item.userName
8130
+ }));
8131
+ list = (0, __WEBPACK_EXTERNAL_MODULE_lodash__.uniqBy)([
8132
+ ...list,
8133
+ ...defaultList
8134
+ ], 'userId');
8135
+ }
8136
+ userList.value = list;
8137
+ currentRowIndex.value = -1;
8138
+ tableRef.value?.eleTable?.setCurrentRow?.(void 0);
8139
+ if (userList.value.length && props.multiSelectFlag && selectedRows.value?.length && !defaultSetTableSelected.value) {
8140
+ const list = (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__.cloneDeep)(selectedRows.value);
8141
+ tableRef.value?.eleTable?.clearSelection();
8142
+ userList.value.forEach((item)=>{
8143
+ if (list.some((row)=>row.userId === item.value || row.value === item.value)) tableRef.value?.eleTable?.toggleRowSelection(item, true);
8144
+ });
8145
+ }
8146
+ defaultSetTableSelected.value = true;
8147
+ }
8148
+ const tableSelectedRows = tableRef.value?.eleTable?.getSelectionRows();
8149
+ if (props.multiSelectFlag && !selectedRows.value?.length && tableSelectedRows?.length) tableRef.value?.eleTable?.clearSelection();
8150
+ };
8151
+ const handleChange = ()=>{
8152
+ let value = selectedRows.value.map((item)=>item.value || item.userId);
8153
+ if (attrs['onUpdate:modelValue']) attrs['onUpdate:modelValue'](props.multiSelectFlag ? value : value[0]);
8154
+ if (props.multiSelectFlag) emit('change', value, selectedRows.value);
8155
+ else {
8156
+ const data = value[0] ? userList.value.find((item)=>item.value === value[0] || item.userId === value[0]) : void 0;
8157
+ emit('change', value[0], data);
8158
+ }
8159
+ };
8160
+ const handelRemoteMethod = (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__.debounce)(async function(value) {
8161
+ await getUserList({
8162
+ keyWord: value
8163
+ });
8164
+ }, 500); // 滚动到当前选中行
8165
+ const scrollToCurrentRow = ()=>{
8166
+ setTimeout(()=>{
8167
+ if (currentRowIndex.value < 0) return;
8168
+ try {
8169
+ const tableElement = tableRef.value?.eleTable?.$el;
8170
+ if (!tableElement) return; // 查找当前高亮的行
8171
+ const currentRowElement = tableElement.querySelector('.el-table__body tr.current-row');
8172
+ if (!currentRowElement) return; // 使用 scrollIntoView 方法滚动到当前行
8173
+ currentRowElement.scrollIntoView({
8174
+ block: 'nearest',
8175
+ behavior: 'smooth'
8176
+ });
8177
+ } catch (error) {
8178
+ console.error('Error scrolling to current row:', error);
8179
+ }
8180
+ }, 100);
8181
+ }; // 键盘事件
8182
+ const handleKeydown = (e)=>{
8183
+ if (!userList.value.length || !popoverVisible.value) return;
8184
+ if ('ArrowDown' === e.key) {
8185
+ e.preventDefault();
8186
+ if (currentRowIndex.value < userList.value.length - 1) {
8187
+ currentRowIndex.value++;
8188
+ const row = userList.value[currentRowIndex.value];
8189
+ tableRef.value.eleTable?.setCurrentRow(row);
8190
+ scrollToCurrentRow();
8191
+ }
8192
+ } else if ('ArrowUp' === e.key) {
8193
+ e.preventDefault();
8194
+ if (currentRowIndex.value > 0) {
8195
+ currentRowIndex.value--;
8196
+ const row = userList.value[currentRowIndex.value];
8197
+ tableRef.value.eleTable?.setCurrentRow(row);
8198
+ scrollToCurrentRow();
8199
+ }
8200
+ } else if ('Enter' === e.key && currentRowIndex.value >= 0) {
8201
+ const row = userList.value[currentRowIndex.value];
8202
+ if (props.multiSelectFlag) tableRef.value.eleTable?.toggleRowSelection(row);
8203
+ else {
8204
+ setTimeout(()=>{
8205
+ selectRef.value?.blur();
8206
+ }, 30);
8207
+ handleTableRowSelect(row);
8208
+ }
8209
+ }
8210
+ };
8211
+ const handleTagRemove = (tag)=>{
8212
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.nextTick)(()=>{
8213
+ if (!selectedRows.value.length) return;
8214
+ const index = selectedRows.value?.findIndex((item)=>item.label === tag);
8215
+ if (-1 !== index) {
8216
+ selectedRows.value.splice(index, 1);
8217
+ const list = (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__.cloneDeep)(selectedRows.value);
8218
+ tableRef.value?.eleTable?.clearSelection();
8219
+ list.forEach((row)=>tableRef.value?.eleTable?.toggleRowSelection(row, true)); // 修复:显式调用 handleChange 确保更新事件被触发
8220
+ // 特别是在删除最后一个选项时,table 的 selection-change 可能不会触发
8221
+ handleChange();
8222
+ }
8223
+ });
8224
+ };
8225
+ const handleClear = ()=>{
8226
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.nextTick)(()=>{
8227
+ if (!popoverVisible.value) {
8228
+ clearing.value = true;
8229
+ const inputEl = selectRef.value?.$el?.querySelector('input');
8230
+ if (inputEl) inputEl.blur();
8231
+ }
8232
+ handleBlur();
8233
+ selectedRows.value = [];
8234
+ selectedValue.value = props.multiSelectFlag ? [] : '';
8235
+ tableRef.value?.eleTable?.clearSelection?.();
8236
+ tableRef.value?.eleTable?.setCurrentRow?.(void 0);
8237
+ getUserList();
8238
+ handleChange();
8239
+ });
8240
+ };
8241
+ const handleFocus = ()=>{
8242
+ setTimeout(()=>{
8243
+ if (clearing.value) return;
8244
+ // 通知其他实例关闭 popover
8245
+ window.dispatchEvent(new CustomEvent(CLOSE_OTHER_POPOVERS_EVENT, {
8246
+ detail: {
8247
+ componentId
8248
+ }
8249
+ }));
8250
+ popoverVisible.value = true;
8251
+ }, 100);
8252
+ };
8253
+ const handleBlur = ()=>{
8254
+ if (clearing.value) {
8255
+ setTimeout(()=>{
8256
+ clearing.value = false;
8257
+ }, 150);
8258
+ return;
8259
+ }
8260
+ if (!props.multiSelectFlag) popoverVisible.value = false;
8261
+ };
8262
+ const handleClickOutside = (e)=>{
8263
+ const target = e.target;
8264
+ const selectEl = selectRef.value?.$el;
8265
+ const popoverEl = popoverRef.value?.popperRef?.contentRef; // 检查是否点击了当前组件的元素
8266
+ if (selectEl?.contains(target) || popoverEl?.contains(target)) return;
8267
+ // 检查是否点击了其他 el-select 或其下拉框
8268
+ let element = target;
8269
+ while(element){
8270
+ if (element.classList?.contains('el-select') || element.classList?.contains('el-select-dropdown') || element.classList?.contains('el-popper') || element.classList?.contains('el-picker-panel') || element.classList?.contains('el-date-picker') || element.classList?.contains('el-time-picker')) {
8271
+ popoverVisible.value = false;
8272
+ return;
8273
+ }
8274
+ element = element.parentElement;
8275
+ } // 点击了其他地方,关闭 popover
8276
+ popoverVisible.value = false;
8277
+ }; // 监听 el-select 的 focus 事件来关闭当前 popover
8278
+ const handleGlobalFocusin = (e)=>{
8279
+ if (!popoverVisible.value) return;
8280
+ const target = e.target;
8281
+ const selectEl = selectRef.value?.$el;
8282
+ const popoverEl = popoverRef.value?.popperRef?.contentRef; // 如果焦点移到了其他元素(如其他 el-select),则关闭当前 popover
8283
+ if (!selectEl?.contains(target) && !popoverEl?.contains(target)) {
8284
+ let element = target;
8285
+ while(element){
8286
+ if (element.classList?.contains('el-select') || element.classList?.contains('el-input')) {
8287
+ popoverVisible.value = false;
8288
+ return;
8289
+ }
8290
+ element = element.parentElement;
8291
+ }
8292
+ }
8293
+ };
8294
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>popoverVisible.value, (val)=>{
8295
+ if (val) {
8296
+ document.addEventListener('keydown', handleKeydown, true);
8297
+ document.addEventListener('click', handleClickOutside);
8298
+ document.addEventListener('focusin', handleGlobalFocusin, true);
8299
+ } else {
8300
+ document.removeEventListener('keydown', handleKeydown, true);
8301
+ document.removeEventListener('click', handleClickOutside);
8302
+ document.removeEventListener('focusin', handleGlobalFocusin, true);
8303
+ }
8304
+ });
8305
+ const handleTableRowSelect = (data)=>{
8306
+ if (data) {
8307
+ if (props.disabledValueIds?.length && data.userId && props.disabledValueIds.includes(data.userId)) {
8308
+ __WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.warning(t('userSelect.errorTip.disabledRowSelectedTip', '当前数据不可选择!'));
8309
+ return;
8310
+ } // 检查是否允许选择停用数据(默认不允许)
8311
+ if (props.allowSelectDisabledFlag !== __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES && data.enabledFlag !== __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES) {
8312
+ __WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessage.warning(t('userSelect.errorTip.disabledUserSelectedTip', '已停用不可选!'));
8313
+ return;
8314
+ }
8315
+ }
8316
+ if (props.multiSelectFlag) {
8317
+ tableRef.value?.eleTable?.toggleRowSelection(data);
8318
+ return;
8319
+ }
8320
+ selectedValue.value = data?.label || data?.userName;
8321
+ selectedRows.value = data ? [
8322
+ data
8323
+ ] : [];
8324
+ if (data) popoverVisible.value = false;
8325
+ handleChange();
8326
+ };
8327
+ const handleSelectionChange = (items)=>{
8328
+ selectedRows.value = items;
8329
+ selectedValue.value = items.map((row)=>row.label || row.userName);
8330
+ handleChange();
8331
+ };
8332
+ const handlePopoverShow = ()=>{
8333
+ window.dispatchEvent(new CustomEvent(CLOSE_OTHER_POPOVERS_EVENT, {
8334
+ detail: {
8335
+ componentId
8336
+ }
8337
+ }));
8338
+ }; // 监听其他实例的关闭事件
8339
+ const handleCloseOtherPopovers = (event)=>{
8340
+ const customEvent = event;
8341
+ if (customEvent.detail?.componentId !== componentId) popoverVisible.value = false;
8342
+ }; // 处理仅查启用复选框变化
8343
+ const handleOnlyEnabledChange = async ()=>{
8344
+ await getUserList();
8345
+ };
8346
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.onBeforeUnmount)(()=>{
8347
+ document.removeEventListener('keydown', handleKeydown, true);
8348
+ document.removeEventListener('click', handleClickOutside);
8349
+ document.removeEventListener('focusin', handleGlobalFocusin, true);
8350
+ window.removeEventListener(CLOSE_OTHER_POPOVERS_EVENT, handleCloseOtherPopovers);
8351
+ });
8352
+ const fetchData = async (data)=>{
8353
+ await getUserList(data);
8354
+ };
8355
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.onMounted)(()=>{
8356
+ window.addEventListener(CLOSE_OTHER_POPOVERS_EVENT, handleCloseOtherPopovers);
8357
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.nextTick)(async ()=>{
8358
+ if (attrs.modelValue && Array.isArray(props.defaultValue) && props.defaultValue?.length) {
8359
+ if (props.multiSelectFlag) selectedValue.value = props.defaultValue.map((item)=>item.label || item.userName);
8360
+ else {
8361
+ const data = props.defaultValue.find((item)=>item.userId === attrs.modelValue || item.value === attrs.modelValue);
8362
+ selectedValue.value = data?.label || data?.userName;
8363
+ }
8364
+ selectedRows.value = props.defaultValue;
8365
+ defaultSetTableSelected.value = false;
8366
+ } else {
8367
+ selectedValue.value = props.multiSelectFlag ? [] : void 0;
8368
+ selectedRows.value = [];
8369
+ }
8370
+ if (props.keyWord && selectRef.value) {
8371
+ const inputEl = selectRef.value?.$el.querySelector('input');
8372
+ if (inputEl) {
8373
+ inputEl.value = props.keyWord; // 创建 input 事件模拟用户输入
8374
+ const event = new Event('input', {
8375
+ bubbles: true
8376
+ });
8377
+ inputEl.dispatchEvent(event);
8378
+ }
8379
+ }
8380
+ await fetchData();
8381
+ if (attrs?.modelValue && (!props.defaultValue || Array.isArray(props.defaultValue) && !props.defaultValue.length)) {
8382
+ if (props.multiSelectFlag) {
8383
+ const items = userList.value.filter((item)=>attrs.modelValue?.includes(item.value));
8384
+ selectedValue.value = items.map((item)=>item.label || item.userName);
8385
+ selectedRows.value = items;
8386
+ } else {
8387
+ const item = userList.value.find((item)=>item.value === attrs?.modelValue);
8388
+ if (item?.label && selectedValue.value !== item.label) {
8389
+ selectedValue.value = item.label;
8390
+ selectedRows.value = [
8391
+ item
8392
+ ];
8393
+ }
8394
+ }
8395
+ defaultSetTableSelected.value = false;
8396
+ }
8397
+ });
8398
+ });
8399
+ const onClickOutside = ()=>{
8400
+ handleBlur();
8401
+ };
8402
+ const visibleChange = (val)=>{
8403
+ if (val) handleFocus();
8404
+ };
8405
+ __expose({
8406
+ popoverRef,
8407
+ tableRef,
8408
+ selectRef,
8409
+ popoverVisible,
8410
+ defaultSetTableSelected,
8411
+ userList,
8412
+ fetchData
8413
+ });
8414
+ return (_ctx, _cache)=>{
8415
+ const _component_el_checkbox = (0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("el-checkbox");
8416
+ const _component_el_select = (0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("el-select");
8417
+ const _component_el_popover = (0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("el-popover");
8418
+ return (0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("div", {
8419
+ onKeydown: handleKeydown
8420
+ }, [
8421
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(_component_el_popover, {
8422
+ ref_key: "popoverRef",
8423
+ ref: popoverRef,
8424
+ visible: popoverVisible.value,
8425
+ placement: "bottom",
8426
+ trigger: "click",
8427
+ width: 600,
8428
+ onShow: handlePopoverShow
8429
+ }, {
8430
+ reference: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
8431
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(_component_el_select, (0, __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps)({
8432
+ ref_key: "selectRef",
8433
+ ref: selectRef,
8434
+ modelValue: selectedValue.value,
8435
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event)=>selectedValue.value = $event),
8436
+ "collapse-tags": !!props.multiSelectFlag,
8437
+ multiple: !!props.multiSelectFlag,
8438
+ options: [],
8439
+ placeholder: _ctx.$t('userSelect.placeholder', '请选择用户'),
8440
+ "popper-class": popoverVisible.value ? 'hidden' : '',
8441
+ "remote-method": (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(handelRemoteMethod),
8442
+ teleported: !popoverVisible.value,
8443
+ clearable: "",
8444
+ "collapse-tags-tooltip": "",
8445
+ filterable: "",
8446
+ remote: "",
8447
+ "remote-show-suffix": "",
8448
+ loading: loading.value
8449
+ }, selectProps.value, {
8450
+ onVisibleChange: visibleChange,
8451
+ onClear: handleClear,
8452
+ onRemoveTag: handleTagRemove
8453
+ }), null, 16, [
8454
+ "modelValue",
8455
+ "collapse-tags",
8456
+ "multiple",
8457
+ "placeholder",
8458
+ "popper-class",
8459
+ "remote-method",
8460
+ "teleported",
8461
+ "loading"
8462
+ ])
8463
+ ]),
8464
+ default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
8465
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.withDirectives)(((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("div", user_selectvue_type_script_lang_tsx_name_UserSelect_setup_true_hoisted_1, [
8466
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("div", {
8467
+ style: (0, __WEBPACK_EXTERNAL_MODULE_vue__.normalizeStyle)({
8468
+ height: `${tableProps.value.maxHeight || 260}px`
8469
+ }),
8470
+ class: "w-full overflow-hidden"
8471
+ }, [
8472
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(pro_table), (0, __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps)({
8473
+ ref_key: "tableRef",
8474
+ ref: tableRef,
8475
+ columns: (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(tableConfig),
8476
+ data: userList.value,
8477
+ loading: loading.value,
8478
+ pagination: false,
8479
+ "row-class-name": getRowClassName,
8480
+ "highlight-current-row": "",
8481
+ "row-key": "userId",
8482
+ style: {
8483
+ height: "100%"
8484
+ }
8485
+ }, tableProps.value, {
8486
+ onRowClick: handleTableRowSelect,
8487
+ onSelectionChange: handleSelectionChange
8488
+ }), null, 16, [
8489
+ "columns",
8490
+ "data",
8491
+ "loading"
8492
+ ])
8493
+ ], 4),
8494
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("div", user_selectvue_type_script_lang_tsx_name_UserSelect_setup_true_hoisted_2, [
8495
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(_component_el_checkbox, {
8496
+ modelValue: onlyEnabled.value,
8497
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event)=>onlyEnabled.value = $event),
8498
+ disabled: props.onlyEnabledFlag !== (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG).NO,
8499
+ onChange: handleOnlyEnabledChange
8500
+ }, {
8501
+ default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
8502
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(_ctx.$t('userSelect.onlyEnabled', '仅查启用')), 1)
8503
+ ]),
8504
+ _: 1
8505
+ }, 8, [
8506
+ "modelValue",
8507
+ "disabled"
8508
+ ])
8509
+ ])
8510
+ ])), [
8511
+ [
8512
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ClickOutside),
8513
+ onClickOutside
8514
+ ]
8515
+ ])
8516
+ ]),
8517
+ _: 1
8518
+ }, 8, [
8519
+ "visible"
8520
+ ])
8521
+ ], 32);
8522
+ };
8523
+ }
8524
+ });
8525
+ const user_select_exports_ = user_selectvue_type_script_lang_tsx_name_UserSelect_setup_true;
8526
+ /* ESM default export */ const user_select = user_select_exports_;
8527
+ /**
8528
+ * [1-10155-1] 根据条件查询业务单元列表
8529
+ * 是否分页 Y
8530
+ * @param params
8531
+ * @returns
8532
+ */ const queryBizUnitList = (params)=>(0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.dictRequest)('/organization/queryBizUnitListByExample', params);
8533
+ // 全局事件:用于关闭其他实例的 popover
8534
+ const biz_unit_selectvue_type_script_lang_tsx_name_BizUnitSelect_setup_true_CLOSE_OTHER_POPOVERS_EVENT = 'biz-unit-select:close-others'; /*
8535
+ 96-10014-1 业务单元选择组件
8536
+ 1、调用“1-10516-1 根据条件查询业务单元列表”传入“启用标志=1、关键字、医院标识=入参:医院标识、科室类型代码集合、就诊类型代码”查询业务单元列表
8537
+ 2、展示列包括“组织类型、编码、名称”
8538
+ */
8539
+ /* ESM default export */ const biz_unit_selectvue_type_script_lang_tsx_name_BizUnitSelect_setup_true = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
8540
+ __name: 'index',
8541
+ props: {
8542
+ keyWord: {},
8543
+ hospitalId: {},
8544
+ orgTypeCodes: {},
8545
+ multiSelectFlag: {
8546
+ type: Boolean
8547
+ },
8548
+ defaultValue: {},
8549
+ encounterTypeCode: {},
8550
+ disabledValueIds: {},
8551
+ deptId: {},
8552
+ tableProps: {},
8553
+ selectProps: {}
8554
+ },
8555
+ emits: [
8556
+ 'change'
8557
+ ],
8558
+ setup (__props, { expose: __expose, emit: __emit }) {
8559
+ const props = __props;
8560
+ const attrs = (0, __WEBPACK_EXTERNAL_MODULE_vue__.useAttrs)();
8561
+ const emit = __emit;
8562
+ const tableProps = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(props.tableProps || {
8563
+ maxHeight: 260
8564
+ });
8565
+ const selectProps = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(props.selectProps || {});
8566
+ const { t } = (0, __WEBPACK_EXTERNAL_MODULE_i18next_vue__.useTranslation)();
8567
+ const instance = (0, __WEBPACK_EXTERNAL_MODULE_vue__.getCurrentInstance)();
8568
+ const componentId = instance?.uid || Math.random(); // 唯一标识当前组件实例
8569
+ const tableRef = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
8570
+ const selectRef = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
8571
+ const popoverRef = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
8572
+ const loading = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
8573
+ const popoverVisible = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
8574
+ const currentRowIndex = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(0);
8575
+ const clearing = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
8576
+ const bizUnitList = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)([]); // 业务单元列表
8577
+ const selectedValue = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(); // select组件绑定的选中的值
8578
+ const selectedRows = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)([]); // table表格选中的值
8579
+ const defaultSetTableSelected = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false); // 传入的默认数据已经绑定到表格中
8580
+ const initComponentData = ()=>{
8581
+ popoverVisible.value = false;
8582
+ bizUnitList.value = [];
8583
+ selectedValue.value = void 0;
8584
+ selectedRows.value = [];
8585
+ handleChange();
8586
+ };
8587
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>attrs?.modelValue, (newVal)=>{
8588
+ if (newVal) {
8589
+ if (!props.multiSelectFlag) {
8590
+ const item = bizUnitList.value.find((item)=>item.value === newVal);
8591
+ if (item?.label && selectedValue.value !== item.label) {
8592
+ selectedValue.value = item.label;
8593
+ selectedRows.value = [
8594
+ item
8595
+ ];
8596
+ }
8597
+ }
8598
+ } else {
8599
+ selectedValue.value = props.multiSelectFlag ? [] : void 0;
8600
+ selectedRows.value = [];
8601
+ }
8602
+ });
8603
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>[
8604
+ props.tableProps,
8605
+ props.selectProps
8606
+ ], ()=>{
8607
+ tableProps.value = props.tableProps || {
8608
+ maxHeight: 260
8609
+ };
8610
+ selectProps.value = props.selectProps || {};
8611
+ }, {
8612
+ deep: true,
8613
+ immediate: true
8614
+ });
8615
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>props.defaultValue, ()=>{
8616
+ if (attrs.modelValue && Array.isArray(props.defaultValue) && props.defaultValue.length && !defaultSetTableSelected.value) {
8617
+ const list = props.defaultValue.map((item)=>({
8618
+ ...item,
8619
+ orgId: item.value || item.orgId,
8620
+ orgNameDisplay: item.label || item.orgNameDisplay,
8621
+ value: item.value || item.orgId,
8622
+ label: item.label || item.orgNameDisplay
8623
+ }));
8624
+ bizUnitList.value = [
8625
+ ...list
8626
+ ];
8627
+ }
8628
+ }, {
8629
+ deep: true,
8630
+ immediate: true
8631
+ });
8632
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>props.orgTypeCodes, (newVal, oldVal)=>{
8633
+ if (newVal && !(0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__.isEqual)(oldVal, newVal)) initComponentData();
8634
+ });
8635
+ const tableConfig = useColumnConfig({
8636
+ getData: (t)=>[
8637
+ {
8638
+ label: t('global:select'),
8639
+ prop: 'indexNo',
8640
+ type: 'selection',
8641
+ isHidden: !props.multiSelectFlag,
8642
+ selectable: (row)=>!(props.disabledValueIds?.length && row.orgId && props.disabledValueIds.includes(row.orgId)) && true
8643
+ },
8644
+ {
8645
+ label: t('bizUnitSelect.table.orgNo', '编码'),
8646
+ prop: 'orgNo',
8647
+ minWidth: 100
8648
+ },
8649
+ {
8650
+ label: t('bizUnitSelect.table.orgNameDisplay', '名称'),
8651
+ prop: 'orgNameDisplay',
8652
+ minWidth: 200
8653
+ },
8654
+ {
8655
+ label: t('bizUnitSelect.table.orgTypeDescDisplay', '组织类型'),
8656
+ prop: 'orgTypeDescDisplay',
8657
+ minWidth: 100
8658
+ }
8659
+ ]
8660
+ });
8661
+ const getRowClassName = (data)=>{
8662
+ if (props.disabledValueIds?.length && data.row.orgId && props.disabledValueIds.includes(data.row.orgId)) return 'cursor-not-allowed !bg-gray-100 text-gray-300';
8663
+ return 'cursor-pointer';
8664
+ };
8665
+ const getBizUnitList = async (data)=>{
8666
+ loading.value = true;
8667
+ const [, res] = await queryBizUnitList({
8668
+ ...data,
8669
+ hospitalId: props.hospitalId,
8670
+ orgTypeCodes: props.orgTypeCodes,
8671
+ enabledFlag: __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES,
8672
+ encounterTypeCode: props.encounterTypeCode,
8673
+ deptId: props.deptId
8674
+ });
8675
+ loading.value = false;
8676
+ if (res?.success) {
8677
+ let defaultList = [];
8678
+ if (attrs.modelValue && Array.isArray(props.defaultValue) && props.defaultValue.length && !data?.keyWord) defaultList = props.defaultValue.map((item)=>({
8176
8679
  ...item,
8177
8680
  orgId: item.value || item.orgId,
8178
8681
  orgNameDisplay: item.label || item.orgNameDisplay,
@@ -8297,7 +8800,7 @@ const CLOSE_OTHER_POPOVERS_EVENT = 'biz-unit-select:close-others'; /*
8297
8800
  setTimeout(()=>{
8298
8801
  if (clearing.value) return;
8299
8802
  // 通知其他实例关闭 popover
8300
- window.dispatchEvent(new CustomEvent(CLOSE_OTHER_POPOVERS_EVENT, {
8803
+ window.dispatchEvent(new CustomEvent(biz_unit_selectvue_type_script_lang_tsx_name_BizUnitSelect_setup_true_CLOSE_OTHER_POPOVERS_EVENT, {
8301
8804
  detail: {
8302
8805
  componentId
8303
8806
  }
@@ -8381,7 +8884,7 @@ const CLOSE_OTHER_POPOVERS_EVENT = 'biz-unit-select:close-others'; /*
8381
8884
  handleChange();
8382
8885
  };
8383
8886
  const handlePopoverShow = ()=>{
8384
- window.dispatchEvent(new CustomEvent(CLOSE_OTHER_POPOVERS_EVENT, {
8887
+ window.dispatchEvent(new CustomEvent(biz_unit_selectvue_type_script_lang_tsx_name_BizUnitSelect_setup_true_CLOSE_OTHER_POPOVERS_EVENT, {
8385
8888
  detail: {
8386
8889
  componentId
8387
8890
  }
@@ -8395,13 +8898,13 @@ const CLOSE_OTHER_POPOVERS_EVENT = 'biz-unit-select:close-others'; /*
8395
8898
  document.removeEventListener('keydown', handleKeydown, true);
8396
8899
  document.removeEventListener('click', handleClickOutside);
8397
8900
  document.removeEventListener('focusin', handleGlobalFocusin, true);
8398
- window.removeEventListener(CLOSE_OTHER_POPOVERS_EVENT, handleCloseOtherPopovers);
8901
+ window.removeEventListener(biz_unit_selectvue_type_script_lang_tsx_name_BizUnitSelect_setup_true_CLOSE_OTHER_POPOVERS_EVENT, handleCloseOtherPopovers);
8399
8902
  });
8400
8903
  const fetchData = async (data)=>{
8401
8904
  await getBizUnitList(data);
8402
8905
  };
8403
8906
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.onMounted)(()=>{
8404
- window.addEventListener(CLOSE_OTHER_POPOVERS_EVENT, handleCloseOtherPopovers);
8907
+ window.addEventListener(biz_unit_selectvue_type_script_lang_tsx_name_BizUnitSelect_setup_true_CLOSE_OTHER_POPOVERS_EVENT, handleCloseOtherPopovers);
8405
8908
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.nextTick)(async ()=>{
8406
8909
  if (attrs.modelValue && Array.isArray(props.defaultValue) && props.defaultValue?.length) {
8407
8910
  if (props.multiSelectFlag) selectedValue.value = props.defaultValue.map((item)=>item.label || item.orgNameDisplay);
@@ -10672,6 +11175,9 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
10672
11175
  default: ()=>[]
10673
11176
  },
10674
11177
  placeholder: {},
11178
+ disabled: {
11179
+ type: Boolean
11180
+ },
10675
11181
  loading: {
10676
11182
  type: Boolean,
10677
11183
  default: false
@@ -10816,6 +11322,8 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
10816
11322
  */ function reset() {
10817
11323
  inputValue.value = '';
10818
11324
  model.value = void 0;
11325
+ keydownIndex.value = -1;
11326
+ cancelHightLight();
10819
11327
  }
10820
11328
  /**
10821
11329
  * 聚焦事件
@@ -10840,6 +11348,7 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
10840
11348
  if (model.value) {
10841
11349
  if (row[props.rowKey] === model.value[props.rowKey]) {
10842
11350
  model.value = void 0;
11351
+ inputValue.value = '';
10843
11352
  keydownIndex.value = -1;
10844
11353
  cancelHightLight();
10845
11354
  } else {
@@ -10847,7 +11356,6 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
10847
11356
  keydownIndex.value = index;
10848
11357
  }
10849
11358
  } else {
10850
- // debugger;
10851
11359
  model.value = row;
10852
11360
  keydownIndex.value = index;
10853
11361
  }
@@ -10940,6 +11448,11 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
10940
11448
  // }
10941
11449
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.watchEffect)(()=>{
10942
11450
  if (model.value) inputValue.value = (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__.isArray)(model.value) ? '' : model.value[props.labelKey];
11451
+ if (props.data.length > 0 && model.value && !(0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__.isArray)(model.value)) {
11452
+ const index = props.data.findIndex((item)=>item[props.rowKey] === model.value[props.rowKey]);
11453
+ keydownIndex.value = index;
11454
+ setCurrentRow();
11455
+ }
10943
11456
  });
10944
11457
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.onBeforeMount)(()=>{
10945
11458
  if (isSimpleMode.value) document.documentElement.style.setProperty('--simple-column-flex', `0 0 ${Math.floor(100 / simpleColumns.value.length)}%`);
@@ -11132,7 +11645,7 @@ const table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Recor
11132
11645
  const table_select_exports_ = /*#__PURE__*/ (0, exportHelper["default"])(table_selectvue_type_script_lang_ts_setup_true_generic_T_20extends_20Record_3CPropertyKey_2C_20any_3E, [
11133
11646
  [
11134
11647
  '__scopeId',
11135
- "data-v-34ffe8bb"
11648
+ "data-v-6f430336"
11136
11649
  ]
11137
11650
  ]);
11138
11651
  /* ESM default export */ const table_select = table_select_exports_;