three-trees-ui 1.0.79 → 1.0.81

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.
@@ -10,9 +10,8 @@ const axios = require('axios')
10
10
  const { saveAs } = require('file-saver')
11
11
  import _ from 'lodash'
12
12
  import { decode } from '@/util/base64'
13
- import moment from 'moment'
14
13
 
15
- const req = function(url, data = {}, option = {}) {
14
+ const req = function (url, data = {}, option = {}) {
16
15
  const requestData = {
17
16
  url: url,
18
17
  data: data,
@@ -42,7 +41,6 @@ export default {
42
41
  },
43
42
  data() {
44
43
  return {
45
- defaultQuerys: [],
46
44
  treeQuerys: [],
47
45
  alias_new: 'statement',
48
46
  loading: false,
@@ -53,7 +51,6 @@ export default {
53
51
  selectRows: [],
54
52
  querys: '',
55
53
  },
56
- exportBtnDisabled: false,
57
54
  dialogExportVisible: false,
58
55
  exportData: {
59
56
  getType: 'all',
@@ -62,8 +59,6 @@ export default {
62
59
  displayFields: [],
63
60
  exportSellection: [],
64
61
  searchForm: {},
65
- bindKey: {},
66
- bindValue: {},
67
62
  queryForm: {
68
63
  queryData: '',
69
64
  },
@@ -117,9 +112,7 @@ export default {
117
112
  pageSize: 10,
118
113
  total: 1,
119
114
  },
120
- lastPage: 1, //上一次输入的分页数、默认为1
121
115
  paginationLayout: 'total, sizes, prev, pager, next, jumper',
122
- paginationLayoutWithoutTotal: 'sizes, prev, pager, next, jumper',
123
116
  total: 0,
124
117
  permission: {
125
118
  print: true,
@@ -229,45 +222,6 @@ export default {
229
222
  : 0.85 * window.innerHeight,
230
223
  needRequestTotal: false, // 需不需要后端统计列表全部数据
231
224
  tableDataTotal: {},
232
- loadingTotal: false, // 统计按钮加载中
233
- pageSizeArray: [
234
- {
235
- label: '10条/页',
236
- value: 10,
237
- },
238
- {
239
- label: '20条/页',
240
- value: 20,
241
- },
242
- {
243
- label: '30条/页',
244
- value: 30,
245
- },
246
- {
247
- label: '40条/页',
248
- value: 40,
249
- },
250
- {
251
- label: '50条/页',
252
- value: 50,
253
- },
254
- {
255
- label: '100条/页',
256
- value: 100,
257
- },
258
- {
259
- label: '200条/页',
260
- value: 200,
261
- },
262
- {
263
- label: '300条/页',
264
- value: 300,
265
- },
266
- {
267
- label: '500条/页',
268
- value: 500,
269
- },
270
- ],
271
225
  }
272
226
  },
273
227
  watch: {
@@ -299,7 +253,7 @@ export default {
299
253
  deep: true,
300
254
  },
301
255
  ents: {
302
- handler: function(newVal, oldValue) {
256
+ handler: function (newVal, oldValue) {
303
257
  if (newVal && newVal.length >= 1 && newVal != oldValue) {
304
258
  this.getSubData(this, this.refId)
305
259
  }
@@ -308,7 +262,7 @@ export default {
308
262
  immediate: true,
309
263
  },
310
264
  templateInfo: {
311
- handler: async function(newVal) {
265
+ handler: function (newVal) {
312
266
  if (newVal && newVal.id) {
313
267
  let _me = this
314
268
  _me.templateInfo = newVal
@@ -381,7 +335,7 @@ export default {
381
335
  )
382
336
  params.pagination.querys = querys
383
337
  }
384
- let defaultQuery = await this.newBuildDefaultQuerys()
338
+ let defaultQuery = this.buildDefaultQuerys()
385
339
  if (defaultQuery.length > 0) {
386
340
  if (params.pagination.querys) {
387
341
  params.pagination.querys.concat(defaultQuery)
@@ -428,13 +382,13 @@ export default {
428
382
  deep: true,
429
383
  immediate: true,
430
384
  },
431
- currentTabName: function(newVal) {
385
+ currentTabName: function (newVal) {
432
386
  if (newVal) {
433
387
  this.querySubValue = ''
434
388
  }
435
389
  },
436
390
  rows: {
437
- handler: function(newVal) {
391
+ handler: function (newVal) {
438
392
  if (this.templateInfo.defId) {
439
393
  let this_ = this
440
394
  let boAlias = this.templateInfo.boDefAlias
@@ -476,9 +430,8 @@ export default {
476
430
  if (val) {
477
431
  this.$nextTick(() => {
478
432
  if (document.getElementById('summaryDiv')) {
479
- this.summaryTableHeight = document.getElementById(
480
- 'summaryDiv'
481
- ).clientHeight
433
+ this.summaryTableHeight =
434
+ document.getElementById('summaryDiv').clientHeight
482
435
  }
483
436
  })
484
437
  }
@@ -489,7 +442,7 @@ export default {
489
442
  //如果当前页面被嵌入iframe里面不显示草稿
490
443
  return !this.isJoinFlow
491
444
  },
492
- navbarCollapseStyle: function() {
445
+ navbarCollapseStyle: function () {
493
446
  if (this.asideShow) {
494
447
  return { left: '200px' }
495
448
  }
@@ -528,35 +481,15 @@ export default {
528
481
  })
529
482
  this.handelBindFiledValua()
530
483
  let this_ = this
531
- this.$on('data-reload-success', function() {
484
+ this.$on('data-reload-success', function () {
532
485
  this_.calcScriptBtnPermission()
533
486
  })
534
487
  this.$emit('afterMounted')
535
- if (this.templateInfo.jsScript) {
536
- // 执行js脚本
537
- this.handleDiyScript(this.templateInfo.jsScript)
538
- }
539
488
  // setTimeout(() => {
540
489
  // this.$refs.multipleTemplateTable.handleFilterChange(this.filterMap)
541
490
  // }, 100)
542
491
  },
543
492
  methods: {
544
- handleDiyScript(scriptValue) {
545
- //执行前置脚本内容
546
- const _this = this
547
- // 用户信息
548
- const account = this.$requestConfig.getAccount()
549
- const userId = this.$requestConfig.getUserId()
550
- const userName = this.$requestConfig.getUsername()
551
- const preScript = `const scriptFunction = function(_this, account, userId, userName){
552
- ${scriptValue}
553
- };`
554
- try {
555
- eval(`${preScript}scriptFunction(_this, account, userId, userName);`)
556
- } catch (err) {
557
- this.$message.error(`脚本事件执行错误:${err}`)
558
- }
559
- },
560
493
  //因为row.id_ 或row.id可能会有重复,所以加随机值使其唯一
561
494
  getRowKey(row) {
562
495
  /** 检查row.id是否有重复的缓存对象 */
@@ -874,7 +807,7 @@ export default {
874
807
  this.listSelectable = false
875
808
  }
876
809
  let _this = this
877
- setTimeout(function() {
810
+ setTimeout(function () {
878
811
  let tdDom = _this.$el.querySelector('td.right_menu')
879
812
  if (
880
813
  !tdDom ||
@@ -979,7 +912,7 @@ export default {
979
912
  selectList[i].selectValue = value
980
913
 
981
914
  //添加监听
982
- pInst.$watch(path, function(newVal, oldVal) {
915
+ pInst.$watch(path, function (newVal, oldVal) {
983
916
  // 监听中使用间隔请求,减少请求次数
984
917
  clearTimeout(this.timeout)
985
918
  this.timeout = setTimeout(() => {
@@ -1002,7 +935,7 @@ export default {
1002
935
  const value = utils.getValueByPath(pInst, path)
1003
936
 
1004
937
  bindList[i].fillValue = value
1005
- pInst.$watch(path, function(newVal, oldVal) {
938
+ pInst.$watch(path, function (newVal, oldVal) {
1006
939
  // 监听中使用间隔请求,减少请求次数
1007
940
  clearTimeout(this.timeout)
1008
941
  this.timeout = setTimeout(() => {
@@ -1260,7 +1193,7 @@ export default {
1260
1193
  }
1261
1194
  let msg = document.createElement('canvas')
1262
1195
 
1263
- this.$qrcode.toCanvas(msg, QRCodeurl, function(error) {
1196
+ this.$qrcode.toCanvas(msg, QRCodeurl, function (error) {
1264
1197
  console.error(error)
1265
1198
  })
1266
1199
  let _canvas = document.createElement('div')
@@ -1300,7 +1233,7 @@ export default {
1300
1233
  .generateAsync({
1301
1234
  type: 'blob',
1302
1235
  })
1303
- .then(function(content) {
1236
+ .then(function (content) {
1304
1237
  let eleLink = document.createElement('a')
1305
1238
  eleLink.download = '二维码.zip'
1306
1239
  eleLink.style.display = 'none'
@@ -1353,7 +1286,7 @@ export default {
1353
1286
  context.scale(2, 2)
1354
1287
  return html2canvas(document.querySelector(classs), {
1355
1288
  canvas: canvas2,
1356
- }).then(function(canvas) {
1289
+ }).then(function (canvas) {
1357
1290
  resolve(canvas)
1358
1291
  })
1359
1292
  })
@@ -1395,7 +1328,7 @@ export default {
1395
1328
  // Base64.encode(this.$store.state.login.currentUser.account);
1396
1329
  let msg = document.getElementById('QRCode')
1397
1330
 
1398
- this.$qrcode.toCanvas(msg, this.QRCodeurl, function(error) {
1331
+ this.$qrcode.toCanvas(msg, this.QRCodeurl, function (error) {
1399
1332
  console.log(error)
1400
1333
  })
1401
1334
  this.QRCodeShow = true
@@ -1408,10 +1341,8 @@ export default {
1408
1341
  }
1409
1342
  for (let x = 0; x < display.length; x++) {
1410
1343
  let item = JSON.parse(display[x])
1411
- if (this.rows[index][item.name] || this.rows[index][item.fieldsAlias]) {
1412
- const qrCode =
1413
- this.rows[index][item.name] || this.rows[index][item.fieldsAlias]
1414
- this.QRCodeDesc.push(`${item.desc}:${qrCode}`)
1344
+ if (this.rows[index][item.name]) {
1345
+ this.QRCodeDesc.push(item.desc + ':' + this.rows[index][item.name])
1415
1346
  }
1416
1347
  }
1417
1348
  this.mobileFormAlias = mobileFormAlias
@@ -1420,15 +1351,15 @@ export default {
1420
1351
  this.rowTemplateId = templateId
1421
1352
  this.rowId = id
1422
1353
  },
1423
- handleSizeChange: function(size) {
1354
+ handleSizeChange: function (size) {
1424
1355
  //每页下拉显示数据
1425
1356
  this.pagination.page = 1
1426
1357
  this.pagination.pageSize = size
1427
1358
  this.$refs.multipleTemplateTable.handleFilterChange()
1428
1359
  },
1429
- handleCurrentChange: function(currentPage) {
1430
- //点击第几页,如果当前页数没有值,则默认用上一次页数
1431
- this.pagination.page = currentPage ? currentPage : this.lastPage
1360
+ handleCurrentChange: function (currentPage) {
1361
+ //点击第几页
1362
+ this.pagination.page = currentPage
1432
1363
  this.$refs.multipleTemplateTable.handleFilterChange()
1433
1364
  },
1434
1365
  getParam(str) {
@@ -1476,190 +1407,7 @@ export default {
1476
1407
  return params
1477
1408
  },
1478
1409
  //列表数据查询入口
1479
- async search(param, cb, isSearchBtn, needRequestTotal = false) {
1480
- // 不需要请求后端接口统计列表数据
1481
- this.needRequestTotal = needRequestTotal
1482
- // 如果是高级查询,页码重置为首页
1483
- if (isSearchBtn) {
1484
- this.pagination.page = 1
1485
- }
1486
- let params = {}
1487
- //判断为合并查询还是高级查询
1488
- let showAdvancedSearch = this.$refs.multipleTemplateTable
1489
- ? this.$refs.multipleTemplateTable.showAdvancedSearch
1490
- : false
1491
- //高级查询
1492
- if (showAdvancedSearch) {
1493
- params = this.getQueryFilter()
1494
- } else {
1495
- //合并查询
1496
- // 快速查询时,需处理添加快速查询字段前缀
1497
- param = this.handleQuickParams(param)
1498
- params = this.getConditionQuery(param)
1499
- }
1500
- this.templateSearchQuery =
1501
- (params.pagination && params.pagination.querys) || []
1502
- if (!params.pagination) {
1503
- params.pagination = {}
1504
- }
1505
- if (!params.pagination.querys) {
1506
- params.pagination.querys = []
1507
- }
1508
- //处理排序字段
1509
- if (param && param.sorter && param.sorter.length > 0) {
1510
- let sortField = JSON.parse(this.templateInfo.sortField)
1511
- params.pagination = params.pagination || {}
1512
- params.pagination.sorter = []
1513
- param.sorter.forEach((s) => {
1514
- let prefix = this.getColPreFix(sortField, s.property)
1515
- let queryPre = this.getQueryPre(sortField, s.property)
1516
- // 关联表时需特殊处理
1517
- let relevancyProperty = this.getRelevancyProperty(
1518
- sortField,
1519
- s.property
1520
- )
1521
- if (relevancyProperty) {
1522
- s.property = relevancyProperty
1523
- }
1524
- params.pagination.sorter.push({
1525
- property: queryPre + prefix + s.property,
1526
- direction: s.direction,
1527
- })
1528
- })
1529
- } else if (this.templateInfo.sortField) {
1530
- let sortField = JSON.parse(this.templateInfo.sortField)
1531
- let sorter = []
1532
- for (let x = 0; x < sortField.length; x++) {
1533
- const s = sortField[x]
1534
- // 默认排序字段的排序方向为空或者不为指定值时放弃
1535
- if (!s.sort || (s.sort != 'ASC' && s.sort != 'DESC')) {
1536
- continue
1537
- }
1538
- let prefix = this.getColPreFix(sortField, s.name)
1539
- let queryPre = this.getQueryPre(sortField, s.name)
1540
- if (!queryPre) {
1541
- if (s.joinTableField && s.tableName) {
1542
- prefix = `${s.tableName}.${prefix}`
1543
- } else {
1544
- prefix = `t.${prefix}`
1545
- }
1546
- }
1547
- sorter.push({
1548
- property: queryPre + prefix + s.name,
1549
- direction: s.sort,
1550
- })
1551
- }
1552
- params.pagination.sorter = sorter
1553
- } else if (param.querys && param.querys.length > 0) {
1554
- params.pagination.querys.concat(param.querys)
1555
- }
1556
-
1557
- if (params.pagination && params.pagination.querys) {
1558
- let tempQueryS = []
1559
- let betweenConditions = {}
1560
- params.pagination.querys.forEach((q) => {
1561
- if (
1562
- q.value != undefined &&
1563
- (q.operation != 'BETWEEN' || q.value.constructor == Array)
1564
- ) {
1565
- tempQueryS.push(q)
1566
- } else if (q.value) {
1567
- let conditions = q
1568
- if (betweenConditions[q.property]) {
1569
- conditions = betweenConditions[q.property]
1570
- conditions.value = [conditions.value]
1571
- conditions.value.push(q.value)
1572
- }
1573
- betweenConditions[q.property] = conditions
1574
- }
1575
- })
1576
- for (const key in betweenConditions) {
1577
- tempQueryS.push(betweenConditions[key])
1578
- }
1579
- params.pagination.querys = tempQueryS
1580
- params.pagination.querys = params.pagination.querys
1581
- ? params.pagination.querys.concat(this.treeQuerys)
1582
- : this.treeQuerys
1583
- }
1584
- //把过滤树的条件也拼接进去
1585
- if (this.treeQuerys && this.treeQuerys.length > 0) {
1586
- params.pagination.querys = params.pagination.querys
1587
- ? params.pagination.querys.concat(this.treeQuerys)
1588
- : this.treeQuerys
1589
- }
1590
- //初始化时,把查询字段和筛选字段的默认值也加进去
1591
- if (this.isInit) {
1592
- await this.handleInitQuery(params)
1593
- }
1594
- //数据视图控件
1595
- if (this.dataView) {
1596
- this.handelBindFiledValua()
1597
- params.refIdValue = this.dataView.refIdValue
1598
- //关联查询字段
1599
- if (this.dataView.selectList && this.dataView.selectList.length > 0) {
1600
- params.selectList = this.dataView.selectList
1601
- }
1602
- }
1603
- const this_ = this
1604
- if (this_.isJoinFlow) {
1605
- params.isJoinFlow = true
1606
- params.taskType = this_.taskType
1607
- params.defKey = this_.defKey
1608
- }
1609
- // 检查是否有必填字段
1610
- if (this.checkHaveRequired() && this.isInit) {
1611
- this.$refs.multipleTemplateTable.showAdvancedSearch = true
1612
- }
1613
- // 查询字段 校验是否必填,如果是必填没数据,需返回提示
1614
- let errorMsg = this.validateSearchRequired(params.pagination.querys)
1615
- if (errorMsg) {
1616
- !this.isInit && this.$message.warning(errorMsg)
1617
- cb && cb()
1618
- this.isInit = false
1619
- this.$emit('data-reload-success')
1620
- return
1621
- }
1622
- this.isInit = false
1623
- if ($.isEmptyObject(this.searchForm)) {
1624
- this.getBpmTemplateByPagination(params, cb)
1625
- } else {
1626
- this.getBpmTemplateByPagination(params, cb)
1627
- }
1628
- },
1629
- // 校验查询字段必填
1630
- validateSearchRequired(querys = []) {
1631
- let errorMsg = ''
1632
- let conditions = JSON.parse(this.templateInfo.conditionField)
1633
- if (conditions) {
1634
- conditions.forEach((item) => {
1635
- if (item.isRequired) {
1636
- let queryPre = this.getQueryPre(conditions, item.name)
1637
- let index = querys.findIndex((k) => {
1638
- return k.property == queryPre + item.name
1639
- })
1640
- if (index == -1) {
1641
- errorMsg = `字段【${item.cm}】为必填查询字段,不能为空!`
1642
- }
1643
- }
1644
- })
1645
- }
1646
- return errorMsg
1647
- },
1648
- checkHaveRequired() {
1649
- let haveRequired = false
1650
- try {
1651
- let conditions = JSON.parse(this.templateInfo.conditionField)
1652
- if (conditions) {
1653
- haveRequired = conditions.some((item) => {
1654
- return item.isRequired
1655
- })
1656
- }
1657
- } catch (e) {
1658
- console.log(e)
1659
- }
1660
- return haveRequired
1661
- },
1662
- searchCountTotal(param, cb, isSearchBtn, needRequestTotal = false) {
1410
+ search(param, cb, isSearchBtn, needRequestTotal = false) {
1663
1411
  // 不需要请求后端接口统计列表数据
1664
1412
  this.needRequestTotal = needRequestTotal
1665
1413
  // 如果是高级查询,页码重置为首页
@@ -1791,9 +1539,9 @@ export default {
1791
1539
  params.defKey = this_.defKey
1792
1540
  }
1793
1541
  if ($.isEmptyObject(this.searchForm)) {
1794
- this.getBpmTemplateByPaginationTotal(params, cb)
1542
+ this.getBpmTemplateByPagination(params, cb)
1795
1543
  } else {
1796
- this.getBpmTemplateByPaginationTotal(params, cb)
1544
+ this.getBpmTemplateByPagination(params, cb)
1797
1545
  }
1798
1546
  },
1799
1547
  // 处理快速查询参数
@@ -1814,24 +1562,20 @@ export default {
1814
1562
  }
1815
1563
  return param
1816
1564
  },
1817
- async handleInitQuery(params) {
1565
+ handleInitQuery(params) {
1818
1566
  const conditionFields = JSON.parse(this.templateInfo.conditionField) || []
1819
1567
  const querys = []
1820
- for (let i = 0; i < conditionFields.length; i++) {
1821
- let item = conditionFields[i]
1568
+ conditionFields.forEach((item) => {
1822
1569
  if (item.defaultValue) {
1823
- let defaultValue = item.isScriptDefault
1824
- ? await this.getScriptDefaultValue(item.defaultValue)
1825
- : item.defaultValue
1826
1570
  querys.push({
1827
1571
  property: `${item.queryPre || ''}${item.colPrefix}${item.name}`,
1828
- value: defaultValue,
1572
+ value: item.defaultValue,
1829
1573
  operation: item.qt.toUpperCase(),
1830
1574
  relation: 'AND',
1831
1575
  group: 'defaultQuery',
1832
1576
  })
1833
1577
  }
1834
- }
1578
+ })
1835
1579
  const filteringFields = JSON.parse(this.templateInfo.filteringField) || []
1836
1580
  filteringFields.forEach((item) => {
1837
1581
  if (item.defaultValue && item.defaultValue.length) {
@@ -1884,15 +1628,13 @@ export default {
1884
1628
  })
1885
1629
  }
1886
1630
  this.$requestConfig
1887
- .getDataTemplateDataListWithoutTotal(dataTemplateQueryVo)
1631
+ .getDataTemplateDataList(dataTemplateQueryVo)
1888
1632
  .then((response) => {
1889
1633
  this.rows = response.rows
1634
+ this.total = response.total
1890
1635
  this.$set(this.pagination, 'page', response.page)
1891
1636
  this.$set(this.pagination, 'pageSize', response.pageSize)
1892
- //每次请求后不再统计总数,而是在统计按钮中去统计,当数量统计过一次后,再重新设置到当前页
1893
- if (this.total) {
1894
- this.$set(this.pagination, 'total', this.total)
1895
- }
1637
+ this.$set(this.pagination, 'total', response.total)
1896
1638
  this.$set(this, 'flowBtnPermission', {})
1897
1639
  this.$emit('data-reload-success')
1898
1640
  if (response.summary && response.summary.length) {
@@ -1916,46 +1658,6 @@ export default {
1916
1658
  cb2 && cb2()
1917
1659
  })
1918
1660
  },
1919
- getBpmTemplateByPaginationTotal(params, cb1, cb2) {
1920
- const dataTemplateQueryVo = {
1921
- templateId: params.templateId,
1922
- queryFilter: params.pagination,
1923
- }
1924
- if (params.isJoinFlow && params.taskType && params.defKey) {
1925
- dataTemplateQueryVo.isJoinFlow = params.isJoinFlow
1926
- dataTemplateQueryVo.taskType = params.taskType
1927
- dataTemplateQueryVo.defKey = params.defKey
1928
- }
1929
- if (params.selectField) {
1930
- dataTemplateQueryVo.selectField = params.selectField
1931
- dataTemplateQueryVo.selectValue = params.selectValue
1932
- }
1933
- if (params.selectList) {
1934
- dataTemplateQueryVo.selectList = params.selectList
1935
- }
1936
- dataTemplateQueryVo.refIdValue = params.refIdValue
1937
- this.curSelectParams = dataTemplateQueryVo
1938
- //加载按钮
1939
- this.loadingTotal = true
1940
- this.$requestConfig
1941
- .getDataTemplateDataListWithTotal(dataTemplateQueryVo)
1942
- .then((response) => {
1943
- //设置总数
1944
- this.total = response.value
1945
- this.$set(this.pagination, 'total', response.value)
1946
- this.loadingTotal = false
1947
- this.$emit('data-reload-success')
1948
- this.$nextTick(() => {
1949
- this.$refs.multipleTemplateTable &&
1950
- this.$refs.multipleTemplateTable.doLayout()
1951
- })
1952
- })
1953
- .finally(() => {
1954
- this.loadingTotal = false
1955
- cb1 && cb1()
1956
- cb2 && cb2()
1957
- })
1958
- },
1959
1661
  getQueryFilter() {
1960
1662
  let operationMap = this.getSearchItems()
1961
1663
  let fieldTypeMap = this.getFieldType()
@@ -1972,12 +1674,6 @@ export default {
1972
1674
  params.pagination = pageBean
1973
1675
  if (!$.isEmptyObject(this.searchForm)) {
1974
1676
  let conditionField = utils.parseToJson(this.templateInfo.conditionField)
1975
- //处理绑定字段
1976
- this.bindValue = this.searchForm.bindValue || this.bindValue
1977
- this.bindKey = this.searchForm.bindKey || this.bindKey
1978
- //记录后再删除
1979
- delete this.searchForm.bindValue
1980
- delete this.searchForm.bindKey
1981
1677
  for (let key in this.searchForm) {
1982
1678
  if (
1983
1679
  typeof this.searchForm[key] != 'undefined' &&
@@ -2015,16 +1711,6 @@ export default {
2015
1711
  if (fieldTypeMap[key] && fieldTypeMap[key] == 'number') {
2016
1712
  value = parseFloat(this.searchForm[key])
2017
1713
  }
2018
- //在表单列表的查询字段中添加的对话框控件 此处逻辑对应 packages/CustomDialog/src/customDialog.vue:1920行
2019
- if (
2020
- this.bindValue &&
2021
- Object.keys(this.bindValue).length &&
2022
- this.bindValue[key] &&
2023
- Object.keys(this.bindKey).length
2024
- ) {
2025
- //获得绑定字段的值
2026
- value = this.bindValue[key][this.bindKey[key]]
2027
- }
2028
1714
  let queryPre = this.getQueryPre(conditionField, key)
2029
1715
  querys.push({
2030
1716
  property: queryPre + key,
@@ -2037,14 +1723,7 @@ export default {
2037
1723
  }
2038
1724
  }
2039
1725
  this.clearQueryByGroupName(querys, 'filter')
2040
- // 将过滤条件添加查询参数数组中,不是高级查询时使用
2041
- if (
2042
- this.$refs.multipleTemplateTable &&
2043
- this.$refs.multipleTemplateTable.querys &&
2044
- !this.$refs.multipleTemplateTable.showAdvancedSearch
2045
- ) {
2046
- querys.push(...this.$refs.multipleTemplateTable.querys)
2047
- }
1726
+ // 将过滤条件添加查询参数数组中
2048
1727
  this.buildFilterParams(querys)
2049
1728
  }
2050
1729
  // 判断table中是否含有filter查询
@@ -2197,18 +1876,10 @@ export default {
2197
1876
  ? operationType[operation]
2198
1877
  : operation
2199
1878
  } else if (
2200
- typeof $(searchItems[i])
2201
- .children()
2202
- .attr('ht-query') != 'undefined'
1879
+ typeof $(searchItems[i]).children().attr('ht-query') != 'undefined'
2203
1880
  ) {
2204
- operation = $(searchItems[i])
2205
- .children()
2206
- .attr('operation')
2207
- operationMap[
2208
- $(searchItems[i])
2209
- .children()
2210
- .attr('ht-query')
2211
- ] =
1881
+ operation = $(searchItems[i]).children().attr('operation')
1882
+ operationMap[$(searchItems[i]).children().attr('ht-query')] =
2212
1883
  typeof operationType[operation] != 'undefined'
2213
1884
  ? operationType[operation]
2214
1885
  : operation
@@ -2234,18 +1905,10 @@ export default {
2234
1905
  ? operationType[operation]
2235
1906
  : operation
2236
1907
  } else if (
2237
- typeof $(searchItems[i])
2238
- .children()
2239
- .attr('ht-query') != 'undefined'
1908
+ typeof $(searchItems[i]).children().attr('ht-query') != 'undefined'
2240
1909
  ) {
2241
- operation = $(searchItems[i])
2242
- .children()
2243
- .attr('type')
2244
- operationMap[
2245
- $(searchItems[i])
2246
- .children()
2247
- .attr('ht-query')
2248
- ] =
1910
+ operation = $(searchItems[i]).children().attr('type')
1911
+ operationMap[$(searchItems[i]).children().attr('ht-query')] =
2249
1912
  typeof operationType[operation] != 'undefined'
2250
1913
  ? operationType[operation]
2251
1914
  : operation
@@ -2268,19 +1931,12 @@ export default {
2268
1931
  ? true
2269
1932
  : false
2270
1933
  } else if (
2271
- typeof $(searchItems[i])
2272
- .children()
2273
- .attr('ht-query') != 'undefined'
1934
+ typeof $(searchItems[i]).children().attr('ht-query') != 'undefined'
2274
1935
  ) {
2275
1936
  //查询条件字段
2276
- fieldQueryMap[
2277
- $(searchItems[i])
2278
- .children()
2279
- .attr('ht-query')
2280
- ] =
2281
- typeof $(searchItems[i])
2282
- .children()
2283
- .attr('special-query') != 'undefined'
1937
+ fieldQueryMap[$(searchItems[i]).children().attr('ht-query')] =
1938
+ typeof $(searchItems[i]).children().attr('special-query') !=
1939
+ 'undefined'
2284
1940
  ? true
2285
1941
  : false
2286
1942
  }
@@ -2348,7 +2004,7 @@ export default {
2348
2004
  }
2349
2005
  },
2350
2006
  //回车查询
2351
- searchEnterFun: function(e) {
2007
+ searchEnterFun: function (e) {
2352
2008
  let keyCode = window.event ? e.keyCode : e.which
2353
2009
  if (keyCode == 13) {
2354
2010
  this.search()
@@ -2653,9 +2309,7 @@ export default {
2653
2309
  handledUrlParams(url, row, fieldName) {
2654
2310
  if (this.templateInfo.displayField) {
2655
2311
  let displayFields = JSON.parse(this.templateInfo.displayField)
2656
- let params =
2657
- this.getParentId(displayFields, fieldName, 'name') ||
2658
- this.getParentId(displayFields, fieldName, 'fieldsAlias')
2312
+ let params = this.getParentId(displayFields, fieldName, 'name')
2659
2313
  if (params && params.urlParams && params.urlParams.length > 0) {
2660
2314
  let urlParams = params.urlParams
2661
2315
  let suffix = ''
@@ -2810,19 +2464,10 @@ export default {
2810
2464
  selectedQuery,
2811
2465
  ]
2812
2466
  }
2813
- // 校验
2814
- let errorMsg = this.validateSearchRequired(
2815
- this.curSelectParams.queryFilter.querys
2816
- )
2817
- if (errorMsg) {
2818
- this.$message.warning(errorMsg)
2819
- return
2820
- }
2821
2467
  //导出全部数据按钮
2822
2468
  if (type == 'all') {
2823
2469
  this.curSelectParams.queryFilter.querys = []
2824
2470
  }
2825
- this.exportBtnDisabled = true
2826
2471
  let loadingInstance = Loading.service({
2827
2472
  fullscreen: true,
2828
2473
  }) //开始
@@ -2831,30 +2476,24 @@ export default {
2831
2476
  id: this.templateInfo.id,
2832
2477
  params: this.curSelectParams,
2833
2478
  })
2834
- // .then(
2835
- // ({ data, headers }) => {
2836
- // const fileName = decodeURIComponent(
2837
- // headers['content-disposition'].split(';')[1].split('filename=')[1]
2838
- // )
2839
- // const blob = new Blob([data])
2840
- // saveAs(blob, fileName)
2841
- // loadingInstance.close() // 结束
2842
- // },
2843
- // (e) => {
2844
- // loadingInstance.close() // 结束
2845
- // let enc = new TextDecoder('utf-8')
2846
- // let uint8_msg = JSON.parse(
2847
- // enc.decode(new Uint8Array(e.response.data))
2848
- // )
2849
- // this.$message.error(uint8_msg.message)
2850
- // }
2851
- // )
2852
- .then(() => {
2853
- this.$message.success('正在导出,请稍后前往报表附件管理查看')
2854
- })
2855
- .finally(() => {
2856
- loadingInstance.close()
2857
- })
2479
+ .then(
2480
+ ({ data, headers }) => {
2481
+ const fileName = decodeURIComponent(
2482
+ headers['content-disposition'].split(';')[1].split('filename=')[1]
2483
+ )
2484
+ const blob = new Blob([data])
2485
+ saveAs(blob, fileName)
2486
+ loadingInstance.close() // 结束
2487
+ },
2488
+ (e) => {
2489
+ loadingInstance.close() // 结束
2490
+ let enc = new TextDecoder('utf-8')
2491
+ let uint8_msg = JSON.parse(
2492
+ enc.decode(new Uint8Array(e.response.data))
2493
+ )
2494
+ this.$message.error(uint8_msg.message)
2495
+ }
2496
+ )
2858
2497
  },
2859
2498
  importCommand(params) {
2860
2499
  switch (params.command) {
@@ -3461,7 +3100,7 @@ export default {
3461
3100
  }
3462
3101
  this.dialogSubVisible = true
3463
3102
  },
3464
- async nodeClick(node) {
3103
+ nodeClick(node) {
3465
3104
  this.pagination.page = 1
3466
3105
  //每次点击过滤树,应该把右边的table 与分页全部重置为初始
3467
3106
 
@@ -3496,9 +3135,7 @@ export default {
3496
3135
  pageBean.querys.push({
3497
3136
  property: item.isMain
3498
3137
  ? `t.${item.key_.oldTableField}`
3499
- : `${item.key_.alias ? item.key_.alias : item.key_.tableName}.${
3500
- item.key_.oldTableField
3501
- }`,
3138
+ : `${item.key_.tableName}.${item.key_.oldTableField}`,
3502
3139
  value,
3503
3140
  group: 'main',
3504
3141
  operation,
@@ -3527,13 +3164,7 @@ export default {
3527
3164
  params.taskType = this_.taskType
3528
3165
  params.defKey = this_.defKey
3529
3166
  }
3530
- await this.handleInitQuery(params)
3531
- // 查询字段 校验是否必填,如果是必填没数据,需返回提示
3532
- let errorMsg = this.validateSearchRequired(params.pagination.querys)
3533
- if (errorMsg) {
3534
- this.$message.warning(errorMsg)
3535
- return
3536
- }
3167
+ this.handleInitQuery(params)
3537
3168
  this.getBpmTemplateByPagination(params)
3538
3169
  },
3539
3170
  filterChange(filters) {
@@ -4040,8 +3671,7 @@ export default {
4040
3671
  if (item.isRequired) {
4041
3672
  isRequired = true
4042
3673
  }
4043
- //item中主表字段没有F_开头
4044
- const descField = item.name.toLowerCase().replace('f_', '')
3674
+ const descField = item.name
4045
3675
  let obj = {
4046
3676
  name: item.name,
4047
3677
  desc: filedsObj[descField],
@@ -4189,7 +3819,7 @@ export default {
4189
3819
  }
4190
3820
  this.$requestConfig
4191
3821
  .batchUpdateTemplateData(data)
4192
- .then(async (data) => {
3822
+ .then((data) => {
4193
3823
  if (data.state) {
4194
3824
  this.$message({
4195
3825
  type: 'success',
@@ -4199,9 +3829,8 @@ export default {
4199
3829
  // 以服务的方式调用的 Loading 需要异步关闭
4200
3830
  loadingInstance.close()
4201
3831
  })
4202
- let defaultValue = await this.newBuildDefaultQuerys()
4203
3832
  this.search({
4204
- querys: defaultValue || [],
3833
+ querys: this.buildDefaultQuerys() || [],
4205
3834
  })
4206
3835
  // 更新成功后需执行后置js
4207
3836
  if (afterScriptValue) {
@@ -4315,120 +3944,6 @@ export default {
4315
3944
  })
4316
3945
  return querys
4317
3946
  },
4318
- async newBuildDefaultQuerys(isSetSearchForm = true) {
4319
- let this_ = this
4320
- let querys = []
4321
- let conditions = JSON.parse(this_.templateInfo.conditionField)
4322
- //条件字段默认值判断
4323
- for (let i = 0; i < conditions.length; i++) {
4324
- let condition = conditions[i]
4325
- if (condition.defaultValue) {
4326
- let field = condition.colPrefix + condition.na
4327
- let defaultValue = condition.isScriptDefault
4328
- ? await this.getScriptDefaultValue(condition.defaultValue)
4329
- : condition.defaultValue
4330
- if (isSetSearchForm) {
4331
- this_.$set(this_.searchForm, field, defaultValue)
4332
- }
4333
- let value = defaultValue
4334
- if (condition.ty == 'number') {
4335
- value = parseFloat(value)
4336
- }
4337
- querys.push({
4338
- property: condition.queryPre ? condition.queryPre + field : field,
4339
- value: value,
4340
- group: 'main',
4341
- operation: condition.qt.toUpperCase(),
4342
- relation: 'AND',
4343
- })
4344
- }
4345
- }
4346
- //筛选字段默认值判断
4347
-
4348
- if (this.parameterqQuerys) {
4349
- let parameterQuerys = JSON.parse(Base64.decode(this.parameterqQuerys))
4350
- if (parameterQuerys && parameterQuerys.length > 0) {
4351
- parameterQuerys.forEach((query) => {
4352
- let prefix = this.templateInfo.isExternal === 1 ? '' : 'F_'
4353
- query.property = prefix + query.property
4354
- if (isSetSearchForm) {
4355
- this_.$set(this_.searchForm, query.property, query.value)
4356
- }
4357
- querys.push(query)
4358
- })
4359
- }
4360
- }
4361
- let filters = JSON.parse(this_.templateInfo.filteringField)
4362
- filters.forEach((filter) => {
4363
- if (filter.defaultValue && filter.defaultValue.length > 0) {
4364
- this_.filterMap[filter.name] = filter.defaultValue
4365
- filter.defaultValue.forEach((val) => {
4366
- querys.push({
4367
- property: `${filter.queryPre || ''}${filter.colPrefix}${
4368
- filter.name
4369
- }`,
4370
- value: val,
4371
- group: 'defVal_' + filter.name,
4372
- operation: 'EQUAL',
4373
- relation: 'OR',
4374
- })
4375
- })
4376
- }
4377
- })
4378
- this_.$on('afterMounted', () => {
4379
- const tab = document.getElementById(this_.templateInfo.alias)
4380
- if (tab && tab.__vue__) {
4381
- let headerColumns = tab.__vue__.$refs.tableHeader
4382
- ? tab.__vue__.$refs.tableHeader.columns
4383
- : []
4384
- headerColumns.forEach((column) => {
4385
- if (this_.filterMap.hasOwnProperty(column.property)) {
4386
- this_.filterMap[column.property].forEach((val) => {
4387
- column.filteredValue.push(val)
4388
- })
4389
- }
4390
- })
4391
- }
4392
- })
4393
- this.defaultQuerys = querys
4394
- return querys
4395
- },
4396
- getScriptDefaultValue(scriptValue) {
4397
- return new Promise((resolve) => {
4398
- //执行前置脚本内容
4399
- const _this = this
4400
- // 用户信息
4401
- const account = this.$requestConfig.getAccount()
4402
- const userId = this.$requestConfig.getUserId()
4403
- const userName = this.$requestConfig.getUsername()
4404
- const _moment = moment
4405
- const preScript = `const scriptFunction = function(_this, account, userId, userName, _moment){
4406
- ${scriptValue}
4407
- };`
4408
- let result = ''
4409
- try {
4410
- result = eval(
4411
- `${preScript}scriptFunction(_this, account, userId, userName, _moment);`
4412
- )
4413
- if (result && result.then && typeof result.then === 'function') {
4414
- result.then(
4415
- (t) => {
4416
- resolve(t)
4417
- },
4418
- (fail) => {
4419
- //接口返回失败则终止按钮操作,并输出错误信息
4420
- resolve('')
4421
- }
4422
- )
4423
- } else {
4424
- resolve(result)
4425
- }
4426
- } catch (err) {
4427
- resolve('')
4428
- this.$message.error(`查询值默认脚本事件执行错误:${err}`)
4429
- }
4430
- })
4431
- },
4432
3947
  handleClose() {
4433
3948
  this.dataViewDialogVisible = false
4434
3949
  },
@@ -5116,30 +4631,6 @@ export default {
5116
4631
  )
5117
4632
  : customColumns
5118
4633
  },
5119
- countPageTotal() {
5120
- this.searchCountTotal(this.getParam())
5121
- },
5122
- switchPage(type) {
5123
- if (type == 'prev') this.pagination.page--
5124
- if (type == 'next') this.pagination.page++
5125
- this.handleCurrentChange(this.pagination.page)
5126
- },
5127
- handleInput(value) {
5128
- if (!value) {
5129
- return
5130
- }
5131
- // 使用正则表达式匹配正整数
5132
- const regex = /^[1-9]\d*$/
5133
-
5134
- // 如果输入的值不符合正整数的模式,则将其重置为1
5135
- if (!regex.test(value)) {
5136
- //如果上一次输入的页数有值,则用上一次输入的页数,否则默认为1
5137
- this.pagination.page = this.lastPage ? this.lastPage : 1
5138
- } else {
5139
- //本次分页数,赋值给上一次分页数
5140
- this.lastPage = this.pagination.page
5141
- }
5142
- },
5143
4634
  },
5144
4635
  // asyncComputed: {
5145
4636
  // showDraftList() {