three-trees-ui 1.0.61 → 1.0.62

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,6 +10,7 @@ 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'
13
14
 
14
15
  const req = function(url, data = {}, option = {}) {
15
16
  const requestData = {
@@ -41,6 +42,7 @@ export default {
41
42
  },
42
43
  data() {
43
44
  return {
45
+ defaultQuerys: [],
44
46
  treeQuerys: [],
45
47
  alias_new: 'statement',
46
48
  loading: false,
@@ -59,6 +61,8 @@ export default {
59
61
  displayFields: [],
60
62
  exportSellection: [],
61
63
  searchForm: {},
64
+ bindKey: {},
65
+ bindValue: {},
62
66
  queryForm: {
63
67
  queryData: '',
64
68
  },
@@ -113,6 +117,7 @@ export default {
113
117
  total: 1,
114
118
  },
115
119
  paginationLayout: 'total, sizes, prev, pager, next, jumper',
120
+ paginationLayoutWithoutTotal: 'sizes, prev, pager, next, jumper',
116
121
  total: 0,
117
122
  permission: {
118
123
  print: true,
@@ -222,6 +227,7 @@ export default {
222
227
  : 0.85 * window.innerHeight,
223
228
  needRequestTotal: false, // 需不需要后端统计列表全部数据
224
229
  tableDataTotal: {},
230
+ loadingTotal: false, // 统计按钮加载中
225
231
  }
226
232
  },
227
233
  watch: {
@@ -262,7 +268,7 @@ export default {
262
268
  immediate: true,
263
269
  },
264
270
  templateInfo: {
265
- handler: function(newVal) {
271
+ handler: async function(newVal) {
266
272
  if (newVal && newVal.id) {
267
273
  let _me = this
268
274
  _me.templateInfo = newVal
@@ -335,7 +341,7 @@ export default {
335
341
  )
336
342
  params.pagination.querys = querys
337
343
  }
338
- let defaultQuery = this.buildDefaultQuerys()
344
+ let defaultQuery = await this.newBuildDefaultQuerys()
339
345
  if (defaultQuery.length > 0) {
340
346
  if (params.pagination.querys) {
341
347
  params.pagination.querys.concat(defaultQuery)
@@ -486,11 +492,31 @@ export default {
486
492
  this_.calcScriptBtnPermission()
487
493
  })
488
494
  this.$emit('afterMounted')
495
+ if (this.templateInfo.jsScript) {
496
+ // 执行js脚本
497
+ this.handleDiyScript(this.templateInfo.jsScript)
498
+ }
489
499
  // setTimeout(() => {
490
500
  // this.$refs.multipleTemplateTable.handleFilterChange(this.filterMap)
491
501
  // }, 100)
492
502
  },
493
503
  methods: {
504
+ handleDiyScript(scriptValue) {
505
+ //执行前置脚本内容
506
+ const _this = this
507
+ // 用户信息
508
+ const account = this.$requestConfig.getAccount()
509
+ const userId = this.$requestConfig.getUserId()
510
+ const userName = this.$requestConfig.getUsername()
511
+ const preScript = `const scriptFunction = function(_this, account, userId, userName){
512
+ ${scriptValue}
513
+ };`
514
+ try {
515
+ eval(`${preScript}scriptFunction(_this, account, userId, userName);`)
516
+ } catch (err) {
517
+ this.$message.error(`脚本事件执行错误:${err}`)
518
+ }
519
+ },
494
520
  //因为row.id_ 或row.id可能会有重复,所以加随机值使其唯一
495
521
  getRowKey(row) {
496
522
  /** 检查row.id是否有重复的缓存对象 */
@@ -1408,7 +1434,7 @@ export default {
1408
1434
  return params
1409
1435
  },
1410
1436
  //列表数据查询入口
1411
- search(param, cb, isSearchBtn, needRequestTotal = false) {
1437
+ async search(param, cb, isSearchBtn, needRequestTotal = false) {
1412
1438
  // 不需要请求后端接口统计列表数据
1413
1439
  this.needRequestTotal = needRequestTotal
1414
1440
  // 如果是高级查询,页码重置为首页
@@ -1521,8 +1547,7 @@ export default {
1521
1547
  }
1522
1548
  //初始化时,把查询字段和筛选字段的默认值也加进去
1523
1549
  if (this.isInit) {
1524
- this.isInit = false
1525
- this.handleInitQuery(params)
1550
+ await this.handleInitQuery(params)
1526
1551
  }
1527
1552
  //数据视图控件
1528
1553
  if (this.dataView) {
@@ -1539,12 +1564,177 @@ export default {
1539
1564
  params.taskType = this_.taskType
1540
1565
  params.defKey = this_.defKey
1541
1566
  }
1567
+ // 查询字段 校验是否必填,如果是必填没数据,需返回提示
1568
+ let errorMsg = this.validateSearchRequired(params.pagination.querys)
1569
+ if (errorMsg) {
1570
+ !this.isInit && this.$message.warning(errorMsg)
1571
+ cb && cb()
1572
+ this.isInit = false
1573
+ return
1574
+ }
1575
+ this.isInit = false
1542
1576
  if ($.isEmptyObject(this.searchForm)) {
1543
1577
  this.getBpmTemplateByPagination(params, cb)
1544
1578
  } else {
1545
1579
  this.getBpmTemplateByPagination(params, cb)
1546
1580
  }
1547
1581
  },
1582
+ // 校验查询字段必填
1583
+ validateSearchRequired(querys) {
1584
+ let errorMsg = ''
1585
+ let conditions = JSON.parse(this.templateInfo.conditionField)
1586
+ if (conditions) {
1587
+ conditions.forEach((item) => {
1588
+ if (item.isRequired) {
1589
+ let queryPre = this.getQueryPre(conditions, item.name)
1590
+ let index = querys.findIndex((k) => {
1591
+ return k.property == queryPre + item.name
1592
+ })
1593
+ if (index == -1) {
1594
+ errorMsg = `字段【${item.cm}】为必填查询字段,不能为空!`
1595
+ }
1596
+ }
1597
+ })
1598
+ }
1599
+ return errorMsg
1600
+ },
1601
+ searchCountTotal(param, cb, isSearchBtn, needRequestTotal = false) {
1602
+ // 不需要请求后端接口统计列表数据
1603
+ this.needRequestTotal = needRequestTotal
1604
+ // 如果是高级查询,页码重置为首页
1605
+ if (isSearchBtn) {
1606
+ this.pagination.page = 1
1607
+ }
1608
+ let params = {}
1609
+ //判断为合并查询还是高级查询
1610
+ let showAdvancedSearch = this.$refs.multipleTemplateTable
1611
+ ? this.$refs.multipleTemplateTable.showAdvancedSearch
1612
+ : false
1613
+ //高级查询
1614
+ if (showAdvancedSearch) {
1615
+ params = this.getQueryFilter()
1616
+ } else {
1617
+ //合并查询
1618
+ // 快速查询时,需处理添加快速查询字段前缀
1619
+ param = this.handleQuickParams(param)
1620
+ params = this.getConditionQuery(param)
1621
+ }
1622
+ this.templateSearchQuery =
1623
+ (params.pagination && params.pagination.querys) || []
1624
+ if (!params.pagination) {
1625
+ params.pagination = {}
1626
+ }
1627
+ if (!params.pagination.querys) {
1628
+ params.pagination.querys = []
1629
+ }
1630
+ //处理排序字段
1631
+ if (param && param.sorter && param.sorter.length > 0) {
1632
+ let sortField = JSON.parse(this.templateInfo.sortField)
1633
+ params.pagination = params.pagination || {}
1634
+ params.pagination.sorter = []
1635
+ param.sorter.forEach((s) => {
1636
+ let prefix = this.getColPreFix(sortField, s.property)
1637
+ let queryPre = this.getQueryPre(sortField, s.property)
1638
+ // 关联表时需特殊处理
1639
+ let relevancyProperty = this.getRelevancyProperty(
1640
+ sortField,
1641
+ s.property
1642
+ )
1643
+ if (relevancyProperty) {
1644
+ s.property = relevancyProperty
1645
+ }
1646
+ params.pagination.sorter.push({
1647
+ property: queryPre + prefix + s.property,
1648
+ direction: s.direction,
1649
+ })
1650
+ })
1651
+ } else if (this.templateInfo.sortField) {
1652
+ let sortField = JSON.parse(this.templateInfo.sortField)
1653
+ let sorter = []
1654
+ for (let x = 0; x < sortField.length; x++) {
1655
+ const s = sortField[x]
1656
+ // 默认排序字段的排序方向为空或者不为指定值时放弃
1657
+ if (!s.sort || (s.sort != 'ASC' && s.sort != 'DESC')) {
1658
+ continue
1659
+ }
1660
+ let prefix = this.getColPreFix(sortField, s.name)
1661
+ let queryPre = this.getQueryPre(sortField, s.name)
1662
+ if (!queryPre) {
1663
+ if (s.joinTableField && s.tableName) {
1664
+ prefix = `${s.tableName}.${prefix}`
1665
+ } else {
1666
+ prefix = `t.${prefix}`
1667
+ }
1668
+ }
1669
+ sorter.push({
1670
+ property: queryPre + prefix + s.name,
1671
+ direction: s.sort,
1672
+ })
1673
+ }
1674
+ params.pagination.sorter = sorter
1675
+ } else if (param.querys && param.querys.length > 0) {
1676
+ params.pagination.querys.concat(param.querys)
1677
+ }
1678
+
1679
+ if (params.pagination && params.pagination.querys) {
1680
+ let tempQueryS = []
1681
+ let betweenConditions = {}
1682
+ params.pagination.querys.forEach((q) => {
1683
+ if (
1684
+ q.value != undefined &&
1685
+ (q.operation != 'BETWEEN' || q.value.constructor == Array)
1686
+ ) {
1687
+ tempQueryS.push(q)
1688
+ } else if (q.value) {
1689
+ let conditions = q
1690
+ if (betweenConditions[q.property]) {
1691
+ conditions = betweenConditions[q.property]
1692
+ conditions.value = [conditions.value]
1693
+ conditions.value.push(q.value)
1694
+ }
1695
+ betweenConditions[q.property] = conditions
1696
+ }
1697
+ })
1698
+ for (const key in betweenConditions) {
1699
+ tempQueryS.push(betweenConditions[key])
1700
+ }
1701
+ params.pagination.querys = tempQueryS
1702
+ params.pagination.querys = params.pagination.querys
1703
+ ? params.pagination.querys.concat(this.treeQuerys)
1704
+ : this.treeQuerys
1705
+ }
1706
+ //把过滤树的条件也拼接进去
1707
+ if (this.treeQuerys && this.treeQuerys.length > 0) {
1708
+ params.pagination.querys = params.pagination.querys
1709
+ ? params.pagination.querys.concat(this.treeQuerys)
1710
+ : this.treeQuerys
1711
+ }
1712
+ //初始化时,把查询字段和筛选字段的默认值也加进去
1713
+ if (this.isInit) {
1714
+ this.isInit = false
1715
+ this.handleInitQuery(params)
1716
+ }
1717
+ //数据视图控件
1718
+ if (this.dataView) {
1719
+ this.handelBindFiledValua()
1720
+ params.refIdValue = this.dataView.refIdValue
1721
+ //关联查询字段
1722
+ if (this.dataView.selectList && this.dataView.selectList.length > 0) {
1723
+ params.selectList = this.dataView.selectList
1724
+ }
1725
+ }
1726
+ const this_ = this
1727
+ if (this_.isJoinFlow) {
1728
+ params.isJoinFlow = true
1729
+ params.taskType = this_.taskType
1730
+ params.defKey = this_.defKey
1731
+ }
1732
+ if ($.isEmptyObject(this.searchForm)) {
1733
+ this.getBpmTemplateByPaginationTotal(params, cb)
1734
+ } else {
1735
+ this.getBpmTemplateByPaginationTotal(params, cb)
1736
+ }
1737
+ },
1548
1738
  // 处理快速查询参数
1549
1739
  handleQuickParams(param) {
1550
1740
  if (param && param.querys && param.querys.length) {
@@ -1563,20 +1753,24 @@ export default {
1563
1753
  }
1564
1754
  return param
1565
1755
  },
1566
- handleInitQuery(params) {
1756
+ async handleInitQuery(params) {
1567
1757
  const conditionFields = JSON.parse(this.templateInfo.conditionField) || []
1568
1758
  const querys = []
1569
- conditionFields.forEach((item) => {
1759
+ for (let i = 0; i < conditionFields.length; i++) {
1760
+ let item = conditionFields[i]
1570
1761
  if (item.defaultValue) {
1762
+ let defaultValue = item.isScriptDefault
1763
+ ? await this.getScriptDefaultValue(item.defaultValue)
1764
+ : item.defaultValue
1571
1765
  querys.push({
1572
1766
  property: `${item.queryPre || ''}${item.colPrefix}${item.name}`,
1573
- value: item.defaultValue,
1767
+ value: defaultValue,
1574
1768
  operation: item.qt.toUpperCase(),
1575
1769
  relation: 'AND',
1576
1770
  group: 'defaultQuery',
1577
1771
  })
1578
1772
  }
1579
- })
1773
+ }
1580
1774
  const filteringFields = JSON.parse(this.templateInfo.filteringField) || []
1581
1775
  filteringFields.forEach((item) => {
1582
1776
  if (item.defaultValue && item.defaultValue.length) {
@@ -1629,13 +1823,15 @@ export default {
1629
1823
  })
1630
1824
  }
1631
1825
  this.$requestConfig
1632
- .getDataTemplateDataList(dataTemplateQueryVo)
1826
+ .getDataTemplateDataListWithoutTotal(dataTemplateQueryVo)
1633
1827
  .then((response) => {
1634
1828
  this.rows = response.rows
1635
- this.total = response.total
1636
1829
  this.$set(this.pagination, 'page', response.page)
1637
1830
  this.$set(this.pagination, 'pageSize', response.pageSize)
1638
- this.$set(this.pagination, 'total', response.total)
1831
+ //每次请求后不再统计总数,而是在统计按钮中去统计,当数量统计过一次后,再重新设置到当前页
1832
+ if (this.total) {
1833
+ this.$set(this.pagination, 'total', this.total)
1834
+ }
1639
1835
  this.$set(this, 'flowBtnPermission', {})
1640
1836
  this.$emit('data-reload-success')
1641
1837
  if (response.summary && response.summary.length) {
@@ -1659,6 +1855,46 @@ export default {
1659
1855
  cb2 && cb2()
1660
1856
  })
1661
1857
  },
1858
+ getBpmTemplateByPaginationTotal(params, cb1, cb2) {
1859
+ const dataTemplateQueryVo = {
1860
+ templateId: params.templateId,
1861
+ queryFilter: params.pagination,
1862
+ }
1863
+ if (params.isJoinFlow && params.taskType && params.defKey) {
1864
+ dataTemplateQueryVo.isJoinFlow = params.isJoinFlow
1865
+ dataTemplateQueryVo.taskType = params.taskType
1866
+ dataTemplateQueryVo.defKey = params.defKey
1867
+ }
1868
+ if (params.selectField) {
1869
+ dataTemplateQueryVo.selectField = params.selectField
1870
+ dataTemplateQueryVo.selectValue = params.selectValue
1871
+ }
1872
+ if (params.selectList) {
1873
+ dataTemplateQueryVo.selectList = params.selectList
1874
+ }
1875
+ dataTemplateQueryVo.refIdValue = params.refIdValue
1876
+ this.curSelectParams = dataTemplateQueryVo
1877
+ //加载按钮
1878
+ this.loadingTotal = true
1879
+ this.$requestConfig
1880
+ .getDataTemplateDataListWithTotal(dataTemplateQueryVo)
1881
+ .then((response) => {
1882
+ //设置总数
1883
+ this.total = response.value
1884
+ this.$set(this.pagination, 'total', response.value)
1885
+ this.loadingTotal = false
1886
+ this.$emit('data-reload-success')
1887
+ this.$nextTick(() => {
1888
+ this.$refs.multipleTemplateTable &&
1889
+ this.$refs.multipleTemplateTable.doLayout()
1890
+ })
1891
+ })
1892
+ .finally(() => {
1893
+ this.loadingTotal = false
1894
+ cb1 && cb1()
1895
+ cb2 && cb2()
1896
+ })
1897
+ },
1662
1898
  getQueryFilter() {
1663
1899
  let operationMap = this.getSearchItems()
1664
1900
  let fieldTypeMap = this.getFieldType()
@@ -1675,6 +1911,12 @@ export default {
1675
1911
  params.pagination = pageBean
1676
1912
  if (!$.isEmptyObject(this.searchForm)) {
1677
1913
  let conditionField = utils.parseToJson(this.templateInfo.conditionField)
1914
+ //处理绑定字段
1915
+ this.bindValue = this.searchForm.bindValue || this.bindValue
1916
+ this.bindKey = this.searchForm.bindKey || this.bindKey
1917
+ //记录后再删除
1918
+ delete this.searchForm.bindValue
1919
+ delete this.searchForm.bindKey
1678
1920
  for (let key in this.searchForm) {
1679
1921
  if (
1680
1922
  typeof this.searchForm[key] != 'undefined' &&
@@ -1712,6 +1954,16 @@ export default {
1712
1954
  if (fieldTypeMap[key] && fieldTypeMap[key] == 'number') {
1713
1955
  value = parseFloat(this.searchForm[key])
1714
1956
  }
1957
+ //在表单列表的查询字段中添加的对话框控件 此处逻辑对应 packages/CustomDialog/src/customDialog.vue:1920行
1958
+ if (
1959
+ this.bindValue &&
1960
+ Object.keys(this.bindValue).length &&
1961
+ this.bindValue[key] &&
1962
+ Object.keys(this.bindKey).length
1963
+ ) {
1964
+ //获得绑定字段的值
1965
+ value = this.bindValue[key][this.bindKey[key]]
1966
+ }
1715
1967
  let queryPre = this.getQueryPre(conditionField, key)
1716
1968
  querys.push({
1717
1969
  property: queryPre + key,
@@ -1724,7 +1976,14 @@ export default {
1724
1976
  }
1725
1977
  }
1726
1978
  this.clearQueryByGroupName(querys, 'filter')
1727
- // 将过滤条件添加查询参数数组中
1979
+ // 将过滤条件添加查询参数数组中,不是高级查询时使用
1980
+ if (
1981
+ this.$refs.multipleTemplateTable &&
1982
+ this.$refs.multipleTemplateTable.querys &&
1983
+ !this.$refs.multipleTemplateTable.showAdvancedSearch
1984
+ ) {
1985
+ querys.push(...this.$refs.multipleTemplateTable.querys)
1986
+ }
1728
1987
  this.buildFilterParams(querys)
1729
1988
  }
1730
1989
  // 判断table中是否含有filter查询
@@ -2333,7 +2592,7 @@ export default {
2333
2592
  handledUrlParams(url, row, fieldName) {
2334
2593
  if (this.templateInfo.displayField) {
2335
2594
  let displayFields = JSON.parse(this.templateInfo.displayField)
2336
- let params = this.getParentId(displayFields, fieldName, 'name')
2595
+ let params = this.getParentId(displayFields, fieldName, 'name') || this.getParentId(displayFields, fieldName, 'fieldsAlias')
2337
2596
  if (params && params.urlParams && params.urlParams.length > 0) {
2338
2597
  let urlParams = params.urlParams
2339
2598
  let suffix = ''
@@ -2500,24 +2759,30 @@ export default {
2500
2759
  id: this.templateInfo.id,
2501
2760
  params: this.curSelectParams,
2502
2761
  })
2503
- .then(
2504
- ({ data, headers }) => {
2505
- const fileName = decodeURIComponent(
2506
- headers['content-disposition'].split(';')[1].split('filename=')[1]
2507
- )
2508
- const blob = new Blob([data])
2509
- saveAs(blob, fileName)
2510
- loadingInstance.close() // 结束
2511
- },
2512
- (e) => {
2513
- loadingInstance.close() // 结束
2514
- let enc = new TextDecoder('utf-8')
2515
- let uint8_msg = JSON.parse(
2516
- enc.decode(new Uint8Array(e.response.data))
2517
- )
2518
- this.$message.error(uint8_msg.message)
2519
- }
2520
- )
2762
+ // .then(
2763
+ // ({ data, headers }) => {
2764
+ // const fileName = decodeURIComponent(
2765
+ // headers['content-disposition'].split(';')[1].split('filename=')[1]
2766
+ // )
2767
+ // const blob = new Blob([data])
2768
+ // saveAs(blob, fileName)
2769
+ // loadingInstance.close() // 结束
2770
+ // },
2771
+ // (e) => {
2772
+ // loadingInstance.close() // 结束
2773
+ // let enc = new TextDecoder('utf-8')
2774
+ // let uint8_msg = JSON.parse(
2775
+ // enc.decode(new Uint8Array(e.response.data))
2776
+ // )
2777
+ // this.$message.error(uint8_msg.message)
2778
+ // }
2779
+ // )
2780
+ .then(() => {
2781
+ this.$message.success('正在导出,请稍后前往报表附件管理查看')
2782
+ })
2783
+ .finally(() => {
2784
+ loadingInstance.close()
2785
+ })
2521
2786
  },
2522
2787
  importCommand(params) {
2523
2788
  switch (params.command) {
@@ -3124,7 +3389,7 @@ export default {
3124
3389
  }
3125
3390
  this.dialogSubVisible = true
3126
3391
  },
3127
- nodeClick(node) {
3392
+ async nodeClick(node) {
3128
3393
  this.pagination.page = 1
3129
3394
  //每次点击过滤树,应该把右边的table 与分页全部重置为初始
3130
3395
 
@@ -3159,7 +3424,9 @@ export default {
3159
3424
  pageBean.querys.push({
3160
3425
  property: item.isMain
3161
3426
  ? `t.${item.key_.oldTableField}`
3162
- : `${item.key_.tableName}.${item.key_.oldTableField}`,
3427
+ : `${item.key_.alias ? item.key_.alias : item.key_.tableName}.${
3428
+ item.key_.oldTableField
3429
+ }`,
3163
3430
  value,
3164
3431
  group: 'main',
3165
3432
  operation,
@@ -3188,7 +3455,7 @@ export default {
3188
3455
  params.taskType = this_.taskType
3189
3456
  params.defKey = this_.defKey
3190
3457
  }
3191
- this.handleInitQuery(params)
3458
+ await this.handleInitQuery(params)
3192
3459
  this.getBpmTemplateByPagination(params)
3193
3460
  },
3194
3461
  filterChange(filters) {
@@ -3844,7 +4111,7 @@ export default {
3844
4111
  }
3845
4112
  this.$requestConfig
3846
4113
  .batchUpdateTemplateData(data)
3847
- .then((data) => {
4114
+ .then(async (data) => {
3848
4115
  if (data.state) {
3849
4116
  this.$message({
3850
4117
  type: 'success',
@@ -3854,8 +4121,9 @@ export default {
3854
4121
  // 以服务的方式调用的 Loading 需要异步关闭
3855
4122
  loadingInstance.close()
3856
4123
  })
4124
+ let defaultValue = await this.newBuildDefaultQuerys()
3857
4125
  this.search({
3858
- querys: this.buildDefaultQuerys() || [],
4126
+ querys: defaultValue || [],
3859
4127
  })
3860
4128
  // 更新成功后需执行后置js
3861
4129
  if (afterScriptValue) {
@@ -3969,6 +4237,120 @@ export default {
3969
4237
  })
3970
4238
  return querys
3971
4239
  },
4240
+ async newBuildDefaultQuerys(isSetSearchForm = true) {
4241
+ let this_ = this
4242
+ let querys = []
4243
+ let conditions = JSON.parse(this_.templateInfo.conditionField)
4244
+ //条件字段默认值判断
4245
+ for (let i = 0; i < conditions.length; i++) {
4246
+ let condition = conditions[i]
4247
+ if (condition.defaultValue) {
4248
+ let field = condition.colPrefix + condition.na
4249
+ let defaultValue = condition.isScriptDefault
4250
+ ? await this.getScriptDefaultValue(condition.defaultValue)
4251
+ : condition.defaultValue
4252
+ if (isSetSearchForm) {
4253
+ this_.$set(this_.searchForm, field, defaultValue)
4254
+ }
4255
+ let value = defaultValue
4256
+ if (condition.ty == 'number') {
4257
+ value = parseFloat(value)
4258
+ }
4259
+ querys.push({
4260
+ property: condition.queryPre ? condition.queryPre + field : field,
4261
+ value: value,
4262
+ group: 'main',
4263
+ operation: condition.qt.toUpperCase(),
4264
+ relation: 'AND',
4265
+ })
4266
+ }
4267
+ }
4268
+ //筛选字段默认值判断
4269
+
4270
+ if (this.parameterqQuerys) {
4271
+ let parameterQuerys = JSON.parse(Base64.decode(this.parameterqQuerys))
4272
+ if (parameterQuerys && parameterQuerys.length > 0) {
4273
+ parameterQuerys.forEach((query) => {
4274
+ let prefix = this.templateInfo.isExternal === 1 ? '' : 'F_'
4275
+ query.property = prefix + query.property
4276
+ if (isSetSearchForm) {
4277
+ this_.$set(this_.searchForm, query.property, query.value)
4278
+ }
4279
+ querys.push(query)
4280
+ })
4281
+ }
4282
+ }
4283
+ let filters = JSON.parse(this_.templateInfo.filteringField)
4284
+ filters.forEach((filter) => {
4285
+ if (filter.defaultValue && filter.defaultValue.length > 0) {
4286
+ this_.filterMap[filter.name] = filter.defaultValue
4287
+ filter.defaultValue.forEach((val) => {
4288
+ querys.push({
4289
+ property: `${filter.queryPre || ''}${filter.colPrefix}${
4290
+ filter.name
4291
+ }`,
4292
+ value: val,
4293
+ group: 'defVal_' + filter.name,
4294
+ operation: 'EQUAL',
4295
+ relation: 'OR',
4296
+ })
4297
+ })
4298
+ }
4299
+ })
4300
+ this_.$on('afterMounted', () => {
4301
+ const tab = document.getElementById(this_.templateInfo.alias)
4302
+ if (tab && tab.__vue__) {
4303
+ let headerColumns = tab.__vue__.$refs.tableHeader
4304
+ ? tab.__vue__.$refs.tableHeader.columns
4305
+ : []
4306
+ headerColumns.forEach((column) => {
4307
+ if (this_.filterMap.hasOwnProperty(column.property)) {
4308
+ this_.filterMap[column.property].forEach((val) => {
4309
+ column.filteredValue.push(val)
4310
+ })
4311
+ }
4312
+ })
4313
+ }
4314
+ })
4315
+ this.defaultQuerys = querys
4316
+ return querys
4317
+ },
4318
+ getScriptDefaultValue(scriptValue) {
4319
+ return new Promise((resolve) => {
4320
+ //执行前置脚本内容
4321
+ const _this = this
4322
+ // 用户信息
4323
+ const account = this.$requestConfig.getAccount()
4324
+ const userId = this.$requestConfig.getUserId()
4325
+ const userName = this.$requestConfig.getUsername()
4326
+ const _moment = moment
4327
+ const preScript = `const scriptFunction = function(_this, account, userId, userName, _moment){
4328
+ ${scriptValue}
4329
+ };`
4330
+ let result = ''
4331
+ try {
4332
+ result = eval(
4333
+ `${preScript}scriptFunction(_this, account, userId, userName, _moment);`
4334
+ )
4335
+ if (result && result.then && typeof result.then === 'function') {
4336
+ result.then(
4337
+ (t) => {
4338
+ resolve(t)
4339
+ },
4340
+ (fail) => {
4341
+ //接口返回失败则终止按钮操作,并输出错误信息
4342
+ resolve('')
4343
+ }
4344
+ )
4345
+ } else {
4346
+ resolve(result)
4347
+ }
4348
+ } catch (err) {
4349
+ resolve('')
4350
+ this.$message.error(`查询值默认脚本事件执行错误:${err}`)
4351
+ }
4352
+ })
4353
+ },
3972
4354
  handleClose() {
3973
4355
  this.dataViewDialogVisible = false
3974
4356
  },
@@ -4103,7 +4485,8 @@ export default {
4103
4485
  this.printDetail(parameter.templateId, parameter.id, parameter.action)
4104
4486
  } else if (btnAlias == 'sub' && this.checkSelect()) {
4105
4487
  this.showSubList(this.tableData.selectRows[0].id_, parameter)
4106
- } else if (btnAlias == 'js' && this.checkSelect()) {
4488
+ } else if (btnAlias == 'js') {
4489
+ if (parameter.needValidateSelect && !this.checkSelect()) return
4107
4490
  this.customEvilJS(this.tableData.selectRows[0], parameter.jsValue)
4108
4491
  } else if (
4109
4492
  btnAlias == 'startFlow' &&
@@ -4655,6 +5038,21 @@ export default {
4655
5038
  )
4656
5039
  : customColumns
4657
5040
  },
5041
+ countPageTotal() {
5042
+ this.searchCountTotal(this.getParam())
5043
+ },
5044
+ sizeChange() {
5045
+ this.$refs.multipleTemplateTable.handleFilterChange()
5046
+ },
5047
+ currentPageChange() {
5048
+ this.isResetPage = false
5049
+ this.$refs.multipleTemplateTable.handleFilterChange()
5050
+ },
5051
+ switchPage(type) {
5052
+ if (type == 'prev') this.pagination.page--
5053
+ if (type == 'next') this.pagination.page++
5054
+ this.currentPageChange()
5055
+ },
4658
5056
  },
4659
5057
  // asyncComputed: {
4660
5058
  // showDraftList() {