centaline-data-driven-v3 0.1.43 → 0.1.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "centaline-data-driven-v3",
3
- "version": "0.1.43",
3
+ "version": "0.1.44",
4
4
  "private": false,
5
5
  "description": "centaline-data-driven-v3",
6
6
  "main": "dist/centaline-data-driven-v3.umd.js",
@@ -587,6 +587,11 @@ body {
587
587
  background-color: inherit;
588
588
  }
589
589
 
590
+ .ct-table .left-fixation .el-checkbox {
591
+ padding: 0px;
592
+ vertical-align: -2px;
593
+ }
594
+
590
595
  .ct-table .right-fixation {
591
596
  position: sticky;
592
597
  background-color: inherit;
@@ -780,7 +785,8 @@ body {
780
785
  user-select: none;
781
786
  /* 禁止文本选择 */
782
787
  }
783
- .ct-form .btnPadBom .el-checkbox{
788
+
789
+ .ct-form .btnPadBom .el-checkbox {
784
790
  height: 100% !important;
785
791
  padding: 0 !important;
786
792
  }
@@ -29,7 +29,7 @@
29
29
  :rowspan="model.multiRowSpan" class="ct-td left-fixation-th checkbox-td"
30
30
  :class="[model.tdClass]">
31
31
  <el-checkbox v-model="model.selectAll" :indeterminate="model.isIndeterminate"
32
- size="default" @change="selectAll"></el-checkbox>
32
+ size="small" @change="selectAll"></el-checkbox>
33
33
  </th>
34
34
  <template v-for="(column, colIndex) in columns" :key="colIndex">
35
35
  <th v-if="column.show" class="ct-td ct-searchtable-th" :rowspan="column.rowspan"
@@ -70,7 +70,7 @@
70
70
  align="center">
71
71
  <el-checkbox
72
72
  v-if="!model.rightCheckBoxColumn || common.getDataOfUpperLower(row, model.rightCheckBoxColumn) == 1"
73
- v-model="row.$select" @change="selectRow()" size="default" />
73
+ v-model="row.$select" @change="selectRow()" size="small" />
74
74
 
75
75
  </td>
76
76
  <template v-for="(column, colIndex) in model.dataFieldcolumns" :key="colIndex">
@@ -946,82 +946,66 @@ function buildDeptTreeByField(flatList, opt = {}) {
946
946
 
947
947
  // 检查第一行是否有 sort 字段
948
948
  const firstItem = flatList.length > 0 ? flatList[0] : null;
949
- const actualSortKey = firstItem && firstItem.hasOwnProperty(sortKey) ? sortKey : 'path';
950
-
951
- const createNode = (tplItem, path) => {
952
- const node = { children: [] };
953
-
954
- for (const key in tplItem) {
955
- if (key !== 'children') {
956
- node[key] = tplItem[key];
957
- }
958
- }
949
+ const actualSortKey = firstItem && firstItem.hasOwnProperty(sortKey) ? sortKey : pathKey;
959
950
 
960
- node[pathKey] = path;
961
- return node;
962
- };
951
+ // 按路径排序,确保父节点在前
952
+ const sortedList = [...flatList].sort((a, b) => {
953
+ const aPath = a[pathKey] || '';
954
+ const bPath = b[pathKey] || '';
955
+ return aPath.length - bPath.length || aPath.localeCompare(bPath);
956
+ });
963
957
 
958
+ const pathMap = new Map(); // path -> node
964
959
  const root = [];
965
- const nodeMap = new Map();
966
960
 
967
- for (const item of flatList) {
968
- if (!item[pathKey]) {
969
- break;
970
- }
961
+ for (const item of sortedList) {
971
962
  const path = item[pathKey];
972
- const levels = path.split(separator);
963
+ if (!path) continue;
973
964
 
974
- let curPath = '';
975
- let parentPath = '';
965
+ const node = {
966
+ ...item,
967
+ children: [],
968
+ isLeaf: true // 默认为叶子节点,后续会更新
969
+ };
976
970
 
977
- levels.forEach((lvl, idx) => {
978
- curPath = idx === 0 ? lvl : `${parentPath}${separator}${lvl}`;
979
- let curNode = nodeMap.get(curPath);
971
+ // 添加到路径映射
972
+ pathMap.set(path, node);
973
+
974
+ // 查找父节点
975
+ const lastDotIndex = path.lastIndexOf(separator);
976
+ if (lastDotIndex > -1) {
977
+ const parentPath = path.substring(0, lastDotIndex);
978
+ const parentNode = pathMap.get(parentPath);
979
+
980
+ if (parentNode) {
981
+ parentNode.children.push(node);
982
+ parentNode.isLeaf = false; // 有子节点,所以不是叶子
983
+ continue;
984
+ }
985
+ }
980
986
 
981
- if (!curNode) {
982
- curNode = createNode(item, curPath);
983
- nodeMap.set(curPath, curNode);
987
+ // 没有找到父节点,或者没有父路径,则作为根节点
988
+ root.push(node);
989
+ }
984
990
 
985
- if (idx === 0) {
986
- root.push(curNode);
987
- } else {
988
- const pNode = nodeMap.get(parentPath);
989
- if (pNode) {
990
- pNode.children.push(curNode);
991
- }
992
- }
993
- }
994
- parentPath = curPath;
991
+ // 排序:按 sortKey path 排序
992
+ const sortTree = (nodes) => {
993
+ nodes.sort((a, b) => {
994
+ const aVal = a[actualSortKey] || a[pathKey] || '';
995
+ const bVal = b[actualSortKey] || b[pathKey] || '';
996
+ return String(aVal).localeCompare(String(bVal));
995
997
  });
996
998
 
997
- const lastNode = nodeMap.get(path);
998
- for (const key in item) {
999
- if (key !== 'children') {
1000
- lastNode[key] = item[key];
999
+ nodes.forEach(node => {
1000
+ if (node.children && node.children.length > 0) {
1001
+ sortTree(node.children);
1001
1002
  }
1002
- }
1003
- }
1004
-
1005
- // 按实际排序键排序子节点
1006
- for (const node of nodeMap.values()) {
1007
- if (node.children && node.children.length > 0) {
1008
- node.children.sort((a, b) => {
1009
- const aVal = a[actualSortKey] || '';
1010
- const bVal = b[actualSortKey] || '';
1011
- return String(aVal).localeCompare(String(bVal));
1012
- });
1013
- }
1014
- node.isLeaf = node.children.length === 0;
1015
- }
1003
+ });
1004
+ };
1016
1005
 
1017
- // 按实际排序键排序根节点
1018
- root.sort((a, b) => {
1019
- const aVal = a[actualSortKey] || '';
1020
- const bVal = b[actualSortKey] || '';
1021
- return String(aVal).localeCompare(String(bVal));
1022
- });
1006
+ sortTree(root);
1023
1007
 
1024
- const hasAnyLeaf = [...nodeMap.values()].some(n => n.isLeaf == false);
1008
+ const hasAnyLeaf = root.some(n => !n.isLeaf);
1025
1009
  return { tree: root, hasAnyLeaf };
1026
1010
  }
1027
1011
 
package/src/main.js CHANGED
@@ -21,8 +21,8 @@ for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
21
21
  }
22
22
 
23
23
  app.use(centaline, {
24
- baseUrl: "https://kq-api.centaline.com.cn/onecard-api/",
25
- //baseUrl:"http://10.88.22.66/IBS.Mvc/api/",
24
+ //baseUrl: "http://10.88.22.13:7080/ibs-api/",
25
+ baseUrl:"http://hkibswcfha01.centaline.com/mvc/api/",
26
26
  //baseUrl: "https://kq-api.centaline.com.cn/onecard-api/",
27
27
  //baseUrl: "http://10.88.22.13:6060/onecard-api/",
28
28
  //baseUrl: "http://10.88.22.66/IBS.Mvc/api/",
@@ -66,8 +66,8 @@ app.use(centaline, {
66
66
  getRequestHeaders: function () {
67
67
  return {
68
68
 
69
- //AuthorizationCode:'Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImIzMjNmYjZjLTU5MWEtNGU5Mi1iODNmLWUzZDBhNThmMDMzMSJ9.P32j9z5ujG9bg76InDMrs89NgLhjly6ESp9MIipYVmCoiYQD0kgscqdk_7E6NKsi_FKosZVliKEeZFlPwqsBZQ',
70
- authobject: '{token:"16-2005889170303787008",platform:"WEB"}',
69
+ //AuthorizationCode:'Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjQxZTM1MGE1LWFiMGMtNDY2Mi05MTQ5LTAwYTQ4NTljMDkyYSJ9.3ci0CpgcmIqm-ORf9efFnvB6sgAWVSGv6ptrWMe3ZSs3fQ8PvlZv3BizhcBJjk0l7csA2Ihw9oodq2N81ELUoQ',
70
+ authobject: '{EmpID:"Token_fce238af-47db-4fd9-9b14-f3ffb4767b55",MachineCode:"503aad67-3233-4256-8907-3e7d520245dc",SSO_Token:"SSOToken_fce238af-47db-4fd9-9b14-f3ffb4767b55",Platform:"WEB"}',
71
71
  //authobject: '{EmpID:"Token_946d56e1-7972-4382-9d10-4a72496aab39",MachineCode:"ae184643-f8e2-453c-a752-ba82612b592f",SSO_Token:"SSOToken_946d56e1-7972-4382-9d10-4a72496aab39",Platform:"WEB"}',
72
72
  //oldToken: 'd92d4a3b-2274-42e8-96f0-100ffb579b6e',
73
73
  //authObject: '{token:"jiangzf-1958445358178844672",platform:"WEB"}',