three-trees-ui 1.0.72 → 1.0.74

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