centaline-data-driven-v3 0.1.5 → 0.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "centaline-data-driven-v3",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "private": false,
5
5
  "description": "centaline-data-driven-v3",
6
6
  "main": "dist/centaline-data-driven-v3.umd.js",
@@ -87,6 +87,7 @@
87
87
  column.width === undefined ? 'ct-table-auto' : null,
88
88
  column.fixed === 'right' ? 'right-fixation' : null,
89
89
  ]" v-bind="column.attrs" :draggable="column.paramName == 'drop' ? true : false"
90
+ @dragstart="onDragStartColumn($event, row, column, 'table')"
90
91
  @drop="drop($event, row, column, 'table')" @dragover.prevent
91
92
  @dragenter="dragenter($event, column, 'table')"
92
93
  @dragleave="dragleave($event, column, 'table')">
@@ -148,6 +149,9 @@
148
149
  </template>
149
150
 
150
151
  </el-popover>
152
+
153
+
154
+
151
155
  </div>
152
156
 
153
157
  <template v-else-if="column.id === 'linksCol'">
@@ -193,6 +197,10 @@
193
197
  :style="column.style ? column.style : ''">
194
198
  {{ common.getDataOfUpperLower(row, column.id) }}
195
199
  </div>
200
+ <el-icon v-if="showDelete(row, column)" class="el-icon-close card__delete"
201
+ @click="deleteColumn(row, column)">
202
+ <CircleClose />
203
+ </el-icon>
196
204
 
197
205
  </td>
198
206
  </template>
@@ -207,7 +215,8 @@
207
215
  <div v-for="(row, rowindex) in model.listData" :key="rowindex">
208
216
  <ct-layout :vmodel="row" :cellLayout="model.cellLayout" :rowindex="rowindex" :key="itemKey"
209
217
  @rolRouterclick="rolRouterCellClickHandler" :actionRouter="model.actionRouter"
210
- :selectIndex="model.selectIndex" :selectedRowBackColor="model.selectedRowBackColor" @rowclick="rowLayoutClickHandle">
218
+ :selectIndex="model.selectIndex" :selectedRowBackColor="model.selectedRowBackColor"
219
+ @rowclick="rowLayoutClickHandle">
211
220
  </ct-layout>
212
221
  </div>
213
222
  </div>
@@ -230,7 +239,7 @@
230
239
  </div>
231
240
  </template>
232
241
  <script setup lang="ts">
233
- import { ref, nextTick, onActivated, onDeactivated, onBeforeUnmount } from 'vue'
242
+ import { ref, nextTick, onActivated, onDeactivated, onBeforeUnmount, computed } from 'vue'
234
243
  import common from '../../../utils/common'
235
244
  import request from '../../../utils/request'
236
245
  import SearchStats from './SearchStats.vue';
@@ -345,18 +354,18 @@ const getRowsRouterRef = (el, index) => {
345
354
  }
346
355
  const refHeadTr = ref()
347
356
  const refTableHead = ref()
348
- onBeforeUnmount(()=>{
349
- if (model.value && typeof model.value.scripts !== 'undefined') {
350
- model.value.scripts.formData.formTable = null;
351
- model.value.scripts.formData = null;
352
- }
353
- window.removeEventListener("resize", setTableHeight)
354
- if(refTableParent.value){
355
- refTableParent.value.removeEventListener("scroll", getScrollAttr);
356
- refTableParent.value=null
357
- }
358
- refSearchTable.value = null;
359
- model.value = null;
357
+ onBeforeUnmount(() => {
358
+ if (model.value && typeof model.value.scripts !== 'undefined') {
359
+ model.value.scripts.formData.formTable = null;
360
+ model.value.scripts.formData = null;
361
+ }
362
+ window.removeEventListener("resize", setTableHeight)
363
+ if (refTableParent.value) {
364
+ refTableParent.value.removeEventListener("scroll", getScrollAttr);
365
+ refTableParent.value = null
366
+ }
367
+ refSearchTable.value = null;
368
+ model.value = null;
360
369
  })
361
370
  onActivated(() => {
362
371
  nextTick(() => {
@@ -413,30 +422,30 @@ function load(data) {
413
422
  fiexdHead()
414
423
  //当表格没有占满表格框时,主动请求下一页
415
424
  var next = function (rtn) {
416
- if (rtn) {
417
- nextTick(() => {
418
- if(!model.value.isLayout){
419
- if(refTableParent.value && refTableParent.value.scrollHeight != 0 && refTableParent.value.offsetHeight != 0
420
- && refTableParent.value.scrollHeight <= refTableParent.value.offsetHeight){
421
- tableLoading.value = true;
422
- SearchTable.nextPage(model.value,next);
423
- }
424
- else {
425
- tableLoading.value = false;
426
- rowColorChange(model.value.selectIndex, true);
427
- resetScroll();
428
- calculatingRowHeight();
429
- getScrollAttr();
430
- }
431
- }
432
- searchEnd.value = Date.now();
433
- });
434
- }
435
- else {
436
- searchEnd.value = Date.now();
437
- tableLoading.value = false;
438
- }
439
- };
425
+ if (rtn) {
426
+ nextTick(() => {
427
+ if (!model.value.isLayout) {
428
+ if (refTableParent.value && refTableParent.value.scrollHeight != 0 && refTableParent.value.offsetHeight != 0
429
+ && refTableParent.value.scrollHeight <= refTableParent.value.offsetHeight) {
430
+ tableLoading.value = true;
431
+ SearchTable.nextPage(model.value, next);
432
+ }
433
+ else {
434
+ tableLoading.value = false;
435
+ rowColorChange(model.value.selectIndex, true);
436
+ resetScroll();
437
+ calculatingRowHeight();
438
+ getScrollAttr();
439
+ }
440
+ }
441
+ searchEnd.value = Date.now();
442
+ });
443
+ }
444
+ else {
445
+ searchEnd.value = Date.now();
446
+ tableLoading.value = false;
447
+ }
448
+ };
440
449
  next(true);
441
450
  nextTick(() => {
442
451
  loadStats()
@@ -491,6 +500,7 @@ function toolbarClickHandler(field) {
491
500
  }
492
501
  //导入
493
502
  function importComplete(res, field) {
503
+ debugger
494
504
  if (res && res.rtnCode && res.rtnCode === 201) {
495
505
  if (res.rtnMsg) {
496
506
  ElMessage({
@@ -509,6 +519,7 @@ function importComplete(res, field) {
509
519
  });
510
520
  }
511
521
  if (field.flagAsync) {
522
+ debugger
512
523
  if (res.rtnCode && res.rtnCode === 202 && res.rtnMsg) {
513
524
  common.confirm(res.rtnMsg, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => {
514
525
  if (res.content && res.content.action) {
@@ -710,7 +721,7 @@ function rowLayoutClickHandle(index) {
710
721
  }
711
722
 
712
723
  //表单列表操作
713
- function rolRouterClickHandler(field, rowData, rowindex, visible, columnName,callBack,flagMouseenter) {
724
+ function rolRouterClickHandler(field, rowData, rowindex, visible, columnName, callBack, flagMouseenter) {
714
725
  field.rowindex = rowindex;
715
726
  if (refRowsPopover.value[rowindex]) {
716
727
  refRowsPopover.value[rowindex].hide();
@@ -742,11 +753,11 @@ function rolRouterClickHandler(field, rowData, rowindex, visible, columnName,cal
742
753
  action = rowData[field.actionField];
743
754
  }
744
755
 
745
- RouterClickHandler(field, submitData, action, model.value, 'table',callBack,flagMouseenter)
756
+ RouterClickHandler(field, submitData, action, model.value, 'table', callBack, flagMouseenter)
746
757
  }
747
758
  //表单列表操作
748
- function rolRouterMouseenterHandler(field, rowData, rowindex, visible, columnName, callBack,flagMouseenter) {
749
- rolRouterClickHandler(field,rowData,rowindex,visible,columnName,callBack,true)
759
+ function rolRouterMouseenterHandler(field, rowData, rowindex, visible, columnName, callBack, flagMouseenter) {
760
+ rolRouterClickHandler(field, rowData, rowindex, visible, columnName, callBack, true)
750
761
  }
751
762
  function popupClickHandler() {
752
763
  var tempListData = model.value.getSelectRowData({ isMulti: model.value.isMulti });
@@ -806,7 +817,7 @@ function setTableHeight() {
806
817
  }
807
818
  var h8 = 0;
808
819
  if (refPopupButton.value) {
809
- h8 = refPopupButton.value.offsetHeight + 21 | 0;
820
+ h8 = refPopupButton.value.offsetHeight + 21 | 0;
810
821
  }
811
822
 
812
823
  let tableHeight = h1 - h2 - h3 - h4 - h5 - h6 - h7 - h8 - 16;
@@ -1341,59 +1352,206 @@ function fiexdHead() {
1341
1352
  }
1342
1353
  });
1343
1354
  }
1355
+
1356
+ // 3. 函数式 computed:调用时传 id,返回布尔
1357
+ const showDelete = computed(() => (row, column) => {
1358
+ let flagDelete = false;
1359
+ if (column.paramName == "drop") {
1360
+
1361
+ let val = null;
1362
+ if (row[column.id] != undefined) {
1363
+ val = row[column.id];
1364
+ } else if (row[common.initialsToUpperCase(column.id)] != undefined) {
1365
+ val = row[common.initialsToUpperCase(column.id)];
1366
+ } else if (row[common.initialsToLowerCase(column.id)] != undefined) {
1367
+ val = row[common.initialsToLowerCase(column.id)];
1368
+ }
1369
+ const routerKey = 'delete';
1370
+ const field = model.value.actionRouter?.find(b => b.key === routerKey);
1371
+ // 只根据 field 是否存在来决定显不显示
1372
+ flagDelete = !!(field && val);
1373
+ }
1374
+
1375
+ return flagDelete;
1376
+ });
1377
+
1344
1378
  // 拖拽开始事件
1379
+ const dragStartColumn = ref(null);
1380
+ const dragStartItem = ref(null);
1381
+ const dragStartName = ref(null);
1382
+
1345
1383
  function onDragStart(event, row, column, name) {
1346
1384
  if (name == "table" && row.flagDrag == "1") {
1347
1385
  emit("drag", row, column, 'drag');
1348
1386
  }
1349
1387
  }
1388
+ function onDragStartColumn(event, row, column, name) {
1389
+ if (name == "table" && column.paramName == "drop") {
1390
+ dragStartItem.value = row;
1391
+ dragStartName.value = name;
1392
+ dragStartColumn.value = column;
1393
+ emit("drag", row, column, 'drag');
1394
+ }
1395
+ }
1396
+
1350
1397
 
1351
1398
  function drop(e, row, column, name) {
1352
- let routerKey = "edit";
1353
- let submitData = {};
1354
- if (props.dragStartName == "top" && name == "table" && column.paramName == "drop") {
1355
- var actionRouter = model.value.actionRouter;
1356
- let field = actionRouter.find((b) => {
1357
- return b.key === routerKey;
1358
- });
1399
+ if (( props.dragStartName == "top" || dragStartName.value == "table") && name == "table" && column.paramName == "drop") {
1359
1400
 
1360
- field.submitListField.forEach((k) => {
1361
- let keyLower = common.initialsToLowerCase(k);
1362
- let keyUpper = common.initialsToUpperCase(k);
1363
- submitData[k] = row[keyLower] || row[keyUpper];
1364
- });
1365
- submitData["columnFieldName"] = column.id;
1366
- submitData["dropObject"] = props.dragStartItem;
1367
-
1368
- request.postHandler(common.globalUri(), {
1369
- action: field.action,
1370
- para: submitData,
1371
- })
1372
- .then(function (response) {
1373
- if (response.rtnCode === 200) {
1374
- nextTick(() => {
1375
- let key = column.id;
1376
- if (row[key] != undefined) {
1377
- row[key] = props.dragStartItem.name;
1378
- } else if (row[common.initialsToUpperCase(key)] != undefined) {
1379
- row[common.initialsToUpperCase(key)] =
1380
- props.dragStartItem.name;
1381
- } else if (row[common.initialsToLowerCase(key)] != undefined) {
1382
- row[common.initialsToLowerCase(key)] =
1383
- props.dragStartItem.name;
1384
- }
1385
- });
1386
- }
1387
- });
1388
1401
 
1402
+ if (dragStartName.value == "table") {
1403
+ exchangeRequest(row, column, dragStartItem.value, dragStartColumn.value);
1404
+ }
1405
+ else if ( props.dragStartName == "top") {
1406
+ dropRequest(row, column, props.dragStartItem);
1407
+ }
1389
1408
  if (name === "table") {
1390
1409
  let el = e.target.nodeName.toLowerCase() == "td" ? e.target : getTDOfParents(e.target);
1391
1410
  removeClass(el, "dragEnterHover");
1392
1411
  }
1412
+
1413
+ dragStartItem.value = null;
1414
+ dragStartName.value = null;
1415
+ dragStartColumn.value = null;
1393
1416
  }
1394
1417
  emit("drag", row, column, 'drop');
1395
1418
  }
1396
1419
 
1420
+ function dropRequest(row, column, obj) {
1421
+ let routerKey = "edit";
1422
+ let submitData = {};
1423
+ var actionRouter = model.value.actionRouter;
1424
+ let field = actionRouter.find((b) => {
1425
+ return b.key === routerKey;
1426
+ });
1427
+
1428
+ field.submitListField.forEach((k) => {
1429
+ let keyLower = common.initialsToLowerCase(k);
1430
+ let keyUpper = common.initialsToUpperCase(k);
1431
+ submitData[k] = row[keyLower] || row[keyUpper];
1432
+ });
1433
+ submitData["columnFieldName"] = column.id;
1434
+ submitData["dropObject"] = obj;
1435
+
1436
+ request.postHandler(common.globalUri(), {
1437
+ action: field.action,
1438
+ para: submitData,
1439
+ })
1440
+ .then(function (response) {
1441
+ if (response.rtnCode === 200) {
1442
+ nextTick(() => {
1443
+ let key = column.id;
1444
+ if (row[key] != undefined) {
1445
+ row[key] = obj.name;
1446
+ } else if (row[common.initialsToUpperCase(key)] != undefined) {
1447
+ row[common.initialsToUpperCase(key)] =
1448
+ obj.name;
1449
+ } else if (row[common.initialsToLowerCase(key)] != undefined) {
1450
+ row[common.initialsToLowerCase(key)] =
1451
+ obj.name;
1452
+ }
1453
+ });
1454
+ }
1455
+ });
1456
+ }
1457
+
1458
+ function exchangeRequest(targetRow, targetColumn, sourceRow, sourceColumn) {
1459
+ let routerKey = "exchange";
1460
+ let submitData = [];
1461
+ let obj = {};
1462
+ let obj1 = {};
1463
+ var actionRouter = model.value.actionRouter;
1464
+ let field = actionRouter.find((b) => {
1465
+ return b.key === routerKey;
1466
+ });
1467
+
1468
+ field.submitListField.forEach((k) => {
1469
+ let key = k;
1470
+ let keyLower = common.initialsToLowerCase(k);
1471
+ let keyUpper = common.initialsToUpperCase(k);
1472
+ obj[k] = targetRow[keyLower] || targetRow[keyUpper];
1473
+ obj["columnFieldName"] = targetColumn.id;
1474
+ submitData.push(obj);
1475
+
1476
+ obj1[k] = sourceRow[keyLower] || sourceRow[keyUpper];
1477
+ obj1["columnFieldName"] = sourceColumn.id;
1478
+ submitData.push(obj1)
1479
+ });
1480
+
1481
+
1482
+ request.postHandler(common.globalUri(), {
1483
+ action: field.action,
1484
+ para: { jsonData: submitData },
1485
+ })
1486
+ .then(function (response) {
1487
+ if (response.rtnCode === 200) {
1488
+ nextTick(() => {
1489
+ exchangeColumn(targetRow, targetColumn, sourceRow, sourceColumn);
1490
+ });
1491
+ }
1492
+ });
1493
+ }
1494
+
1495
+ function exchangeColumn(targetRow, targetColumn, sourceRow, sourceColumn) {
1496
+ // 定义查找有效属性名的函数
1497
+ const getValidKey = (row, key) => {
1498
+ if (row[key] !== undefined) return key;
1499
+ const upperKey = common.initialsToUpperCase(key);
1500
+ if (row[upperKey] !== undefined) return upperKey;
1501
+ const lowerKey = common.initialsToLowerCase(key);
1502
+ if (row[lowerKey] !== undefined) return lowerKey;
1503
+ return null; // 未找到有效属性名
1504
+ };
1505
+ // 获取源列和目标列的实际属性名
1506
+ const targetKey = getValidKey(targetRow, targetColumn.id);
1507
+ const sourceKey = getValidKey(sourceRow, sourceColumn.id);
1508
+
1509
+ // 双属性都存在时才执行交换
1510
+ if (targetKey !== null && sourceKey !== null) {
1511
+ // 使用中间变量交换值
1512
+ const temp = targetRow[targetKey];
1513
+ targetRow[targetKey] = sourceRow[sourceKey];
1514
+ sourceRow[sourceKey] = temp;
1515
+ }
1516
+ }
1517
+
1518
+ function deleteColumn(row, column) {
1519
+ let routerKey = "delete";
1520
+ let submitData = {};
1521
+ var actionRouter = model.value.actionRouter;
1522
+ let field = actionRouter.find((b) => {
1523
+ return b.key === routerKey;
1524
+ });
1525
+
1526
+ field.submitListField.forEach((k) => {
1527
+ let keyLower = common.initialsToLowerCase(k);
1528
+ let keyUpper = common.initialsToUpperCase(k);
1529
+ submitData[k] = row[keyLower] || row[keyUpper];
1530
+ });
1531
+ submitData["columnFieldName"] = column.id;
1532
+
1533
+ request.postHandler(common.globalUri(), {
1534
+ action: field.action,
1535
+ para: submitData,
1536
+ })
1537
+ .then(function (response) {
1538
+ if (response.rtnCode === 200) {
1539
+ nextTick(() => {
1540
+ let key = column.id;
1541
+ if (row[key] != undefined) {
1542
+ row[key] = "";
1543
+ } else if (row[common.initialsToUpperCase(key)] != undefined) {
1544
+ row[common.initialsToUpperCase(key)] = "";
1545
+ } else if (row[common.initialsToLowerCase(key)] != undefined) {
1546
+ row[common.initialsToLowerCase(key)] = "";
1547
+ }
1548
+ });
1549
+ }
1550
+ });
1551
+
1552
+
1553
+ }
1554
+
1397
1555
  function dragenter(e, column, name) {
1398
1556
  let el = e.target.nodeName.toLowerCase() == "td" ? e.target : getTDOfParents(e.target);
1399
1557
  if (name === "table" && column.paramName == "drop") {
@@ -1441,6 +1599,7 @@ function addClass(el, className) {
1441
1599
  newClassName.push(className);
1442
1600
  el.className = newClassName.join(" ");
1443
1601
  }
1602
+
1444
1603
  defineExpose({
1445
1604
  model,
1446
1605
  searchComplate,
@@ -1451,3 +1610,33 @@ defineExpose({
1451
1610
  refreshFromSimple
1452
1611
  })
1453
1612
  </script>
1613
+ <style lang="css" scoped>
1614
+ .ct-td {
1615
+ position: relative;
1616
+ }
1617
+
1618
+ /* 右上角删除图标,默认隐藏 */
1619
+ .card__delete {
1620
+ position: absolute;
1621
+ top: 6px;
1622
+ right: 6px;
1623
+ font-size: 14px;
1624
+ color: #909399;
1625
+ cursor: pointer;
1626
+ opacity: 0;
1627
+ transition: opacity 0.2s;
1628
+ /* 鼠标移到图标本身不会触发 mouseleave */
1629
+ pointer-events: none;
1630
+ }
1631
+
1632
+ /* 鼠标悬停卡片时让图标出现,并恢复点击事件 */
1633
+ .ct-td:hover .card__delete {
1634
+ opacity: 1;
1635
+ pointer-events: auto;
1636
+ }
1637
+
1638
+ .card__delete:hover {
1639
+ color: #f56c6c;
1640
+ /* 悬停图标变红,符合 Element 交互 */
1641
+ }
1642
+ </style>
@@ -853,7 +853,9 @@ const Base = function (source, moreActionRouter) {
853
853
  this.code1 = this.defaultCode1 || '';
854
854
  this.code2 = this.defaultCode2 || '';
855
855
  this.name1 = this.defaultName1 || '';
856
-
856
+ if(this.controlType === Enum.ControlType.SearchListBox && this.defaultCode1 && this.defaultName1){
857
+ this.options=[{ value: this.code1, label: this.name1 }]
858
+ }
857
859
  }
858
860
  else {
859
861
  if (this.controlType === Enum.ControlType.DateRange
package/src/main.js CHANGED
@@ -22,8 +22,8 @@ for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
22
22
 
23
23
  app.use(centaline, {
24
24
  //baseUrl:"https://uplink.centaline.com.cn/xian/",
25
- //baseUrl:"http://10.88.22.66/IBS.Mvc/api/",
26
- baseUrl: "https://kq-api.centaline.com.cn/onecard-api/",
25
+ baseUrl:"http://10.88.22.13:7070/onecard-api/",
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:6060/xian/",
29
29
  //baseUrl: "http://10.1.245.50:38735/max-uplink-api/",
@@ -67,8 +67,8 @@ app.use(centaline, {
67
67
  return {
68
68
  //authObject: '{token:"aplus eyJhbGciOiJIUzI1NiIsInppcCI6IkRFRiJ9.eNrEjjsOwjAQBe-ydVay1xvvOl3sJA2HiPIxElSIJBIIcXdAQEfPFK-YZt4Nlm2EChqtDafOYWqpRG6kxLoTxZhUTSRxHLUPH_DHfOmt5SDWt1gHScieHapNiol94q5pXYoNFJAvJ6isGHWmNMYVcBjWtyCr_iW2JZ93-fqPc8f18MwGIqFRCIO1GXmWGYd9npCZJ6N5JjYZ7g8AAAD__w.HgtNKtHWooj8c9Hy_vB8CfKq-qOeHMp0irnW0DfXtHo"}',
69
69
  //oldToken: 'd92d4a3b-2274-42e8-96f0-100ffb579b6e',
70
- authObject: '{token:"1647-1937695555379662848",platform:"WEB"}',
71
- //authObject: '{EmpID:"Token_256e18aa-5aeb-4033-9d75-80bbc3dec2c3",MachineCode:"ae184643-f8e2-453c-a752-ba82612b592f",SSO_Token:"SSOToken_256e18aa-5aeb-4033-9d75-80bbc3dec2c3",Platform:"WEB"}',
70
+ authObject: '{token:"wufw-1953248614457528320",platform:"WEB"}',
71
+ //authObject: '{token:"1-90f7df2c-fba7-4ea0-8874-aa7202034f06"}',
72
72
  };
73
73
  },
74
74
  getToken() {
@@ -546,15 +546,22 @@ export function RouterClickHandler(field, submitData, action, model, source, cal
546
546
  onFinished: (data) => {
547
547
  common.closeDialog(dialogOption);
548
548
  if (field.isExport) {
549
- if (data.content.indexOf(".zip") > -1) {
550
- window.location.href = encodeURI(data.content);
549
+ if (data.content.toLowerCase().indexOf('downloadFileName'.toLowerCase()) > -1) {
550
+ getBlob(data.content).then(blob => {
551
+ downloadFile(blob, getUrlParameter(data.content, 'downloadFileName') + '.' + getExtensionFromUrl(data.content))
552
+ })
551
553
  }
552
554
  else {
553
- if (data.content.indexOf("?") > -1) {
554
- model.$vue.downloadUrl = data.content + "&" + Math.random();
555
+ if (data.content.indexOf(".zip") > -1) {
556
+ window.location.href = encodeURI(data.content);
555
557
  }
556
558
  else {
557
- model.$vue.downloadUrl = data.content + "?" + Math.random();
559
+ if (data.content.indexOf("?") > -1) {
560
+ model.$vue.downloadUrl = data.content + "&" + Math.random();
561
+ }
562
+ else {
563
+ model.$vue.downloadUrl = data.content + "?" + Math.random();
564
+ }
558
565
  }
559
566
  }
560
567
  }
@@ -606,15 +613,22 @@ export function RouterClickHandler(field, submitData, action, model, source, cal
606
613
  onFinished: (data) => {
607
614
  common.closeDialog(dialogOption);
608
615
  if (field.isExport) {
609
- if (data.content.indexOf(".zip") > -1) {
610
- window.location.href = encodeURI(data.content);
616
+ if (data.content.toLowerCase().indexOf('downloadFileName'.toLowerCase()) > -1) {
617
+ getBlob(data.content).then(blob => {
618
+ downloadFile(blob, getUrlParameter(data.content, 'downloadFileName') + '.' + getExtensionFromUrl(data.content))
619
+ })
611
620
  }
612
621
  else {
613
- if (data.content.indexOf("?") > -1) {
614
- model.$vue.downloadUrl = data.content + "&" + Math.random();
622
+ if (data.content.indexOf(".zip") > -1) {
623
+ window.location.href = encodeURI(data.content);
615
624
  }
616
625
  else {
617
- model.$vue.downloadUrl = data.content + "?" + Math.random();
626
+ if (data.content.indexOf("?") > -1) {
627
+ model.$vue.downloadUrl = data.content + "&" + Math.random();
628
+ }
629
+ else {
630
+ model.$vue.downloadUrl = data.content + "?" + Math.random();
631
+ }
618
632
  }
619
633
  }
620
634
  }
@@ -794,10 +808,10 @@ export function RouterClickHandler(field, submitData, action, model, source, cal
794
808
  onSubmit: () => {
795
809
  common.closeDialog(dialogOption.dialog);
796
810
  },
797
- onCloseDialog:()=>{
798
- if (source == 'table') {
799
- model.$vue.updateCurrentRow(field);
800
- }
811
+ onCloseDialog: () => {
812
+ if (source == 'table') {
813
+ model.$vue.updateCurrentRow(field);
814
+ }
801
815
  },
802
816
  isIframe: model.isIframe,
803
817
  },
@@ -992,6 +1006,35 @@ export function RouterClickHandler(field, submitData, action, model, source, cal
992
1006
  }
993
1007
 
994
1008
  }
1009
+ //通过文件下载url拿到对应的blob对象
1010
+ function getBlob(url) {
1011
+ return new Promise(resolve => {
1012
+ const xhr = new XMLHttpRequest()
1013
+ xhr.open('GET', url, true)
1014
+ xhr.responseType = 'blob'
1015
+ xhr.onload = () => {
1016
+ if (xhr.status === 200) {
1017
+ resolve(xhr.response)
1018
+ }
1019
+ }
1020
+
1021
+ xhr.send()
1022
+ })
1023
+ }
1024
+ //下载文件
1025
+ function downloadFile(blob, filename) {
1026
+ var link = document.createElement('a')
1027
+ link.href = window.URL.createObjectURL(blob)
1028
+ link.download = filename
1029
+ link.click()
1030
+ }
1031
+ function getExtensionFromUrl(url) {
1032
+ return url.split('.').pop().split(/#|\?/)[0];
1033
+ }
1034
+ function getUrlParameter(href, name) {
1035
+ const url = new URL(href); // 创建URL对象
1036
+ return url.searchParams.get(name); // 返回查询参数的值,例如 /user?userId=123 中的 userId
1037
+ }
995
1038
 
996
1039
 
997
1040