three-trees-ui 1.0.70 → 1.0.71

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,7 +10,6 @@ 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
14
  const req = function(url, data = {}, option = {}) {
16
15
  const requestData = {
@@ -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: {
@@ -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)
@@ -531,31 +486,11 @@ export default {
531
486
  this_.calcScriptBtnPermission()
532
487
  })
533
488
  this.$emit('afterMounted')
534
- if (this.templateInfo.jsScript) {
535
- // 执行js脚本
536
- this.handleDiyScript(this.templateInfo.jsScript)
537
- }
538
489
  // setTimeout(() => {
539
490
  // this.$refs.multipleTemplateTable.handleFilterChange(this.filterMap)
540
491
  // }, 100)
541
492
  },
542
493
  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
494
  //因为row.id_ 或row.id可能会有重复,所以加随机值使其唯一
560
495
  getRowKey(row) {
561
496
  /** 检查row.id是否有重复的缓存对象 */
@@ -1407,9 +1342,8 @@ export default {
1407
1342
  }
1408
1343
  for (let x = 0; x < display.length; x++) {
1409
1344
  let item = JSON.parse(display[x])
1410
- if (this.rows[index][item.name] || this.rows[index][item.fieldsAlias]) {
1411
- const qrCode = this.rows[index][item.name] || this.rows[index][item.fieldsAlias]
1412
- this.QRCodeDesc.push(`${item.desc}:${qrCode}`)
1345
+ if (this.rows[index][item.name]) {
1346
+ this.QRCodeDesc.push(item.desc + ':' + this.rows[index][item.name])
1413
1347
  }
1414
1348
  }
1415
1349
  this.mobileFormAlias = mobileFormAlias
@@ -1425,8 +1359,8 @@ export default {
1425
1359
  this.$refs.multipleTemplateTable.handleFilterChange()
1426
1360
  },
1427
1361
  handleCurrentChange: function(currentPage) {
1428
- //点击第几页,如果当前页数没有值,则默认用上一次页数
1429
- this.pagination.page = currentPage ? currentPage : this.lastPage
1362
+ //点击第几页
1363
+ this.pagination.page = currentPage
1430
1364
  this.$refs.multipleTemplateTable.handleFilterChange()
1431
1365
  },
1432
1366
  getParam(str) {
@@ -1474,190 +1408,7 @@ export default {
1474
1408
  return params
1475
1409
  },
1476
1410
  //列表数据查询入口
1477
- async search(param, cb, isSearchBtn, needRequestTotal = false) {
1478
- // 不需要请求后端接口统计列表数据
1479
- this.needRequestTotal = needRequestTotal
1480
- // 如果是高级查询,页码重置为首页
1481
- if (isSearchBtn) {
1482
- this.pagination.page = 1
1483
- }
1484
- let params = {}
1485
- //判断为合并查询还是高级查询
1486
- let showAdvancedSearch = this.$refs.multipleTemplateTable
1487
- ? this.$refs.multipleTemplateTable.showAdvancedSearch
1488
- : false
1489
- //高级查询
1490
- if (showAdvancedSearch) {
1491
- params = this.getQueryFilter()
1492
- } else {
1493
- //合并查询
1494
- // 快速查询时,需处理添加快速查询字段前缀
1495
- param = this.handleQuickParams(param)
1496
- params = this.getConditionQuery(param)
1497
- }
1498
- this.templateSearchQuery =
1499
- (params.pagination && params.pagination.querys) || []
1500
- if (!params.pagination) {
1501
- params.pagination = {}
1502
- }
1503
- if (!params.pagination.querys) {
1504
- params.pagination.querys = []
1505
- }
1506
- //处理排序字段
1507
- if (param && param.sorter && param.sorter.length > 0) {
1508
- let sortField = JSON.parse(this.templateInfo.sortField)
1509
- params.pagination = params.pagination || {}
1510
- params.pagination.sorter = []
1511
- param.sorter.forEach((s) => {
1512
- let prefix = this.getColPreFix(sortField, s.property)
1513
- let queryPre = this.getQueryPre(sortField, s.property)
1514
- // 关联表时需特殊处理
1515
- let relevancyProperty = this.getRelevancyProperty(
1516
- sortField,
1517
- s.property
1518
- )
1519
- if (relevancyProperty) {
1520
- s.property = relevancyProperty
1521
- }
1522
- params.pagination.sorter.push({
1523
- property: queryPre + prefix + s.property,
1524
- direction: s.direction,
1525
- })
1526
- })
1527
- } else if (this.templateInfo.sortField) {
1528
- let sortField = JSON.parse(this.templateInfo.sortField)
1529
- let sorter = []
1530
- for (let x = 0; x < sortField.length; x++) {
1531
- const s = sortField[x]
1532
- // 默认排序字段的排序方向为空或者不为指定值时放弃
1533
- if (!s.sort || (s.sort != 'ASC' && s.sort != 'DESC')) {
1534
- continue
1535
- }
1536
- let prefix = this.getColPreFix(sortField, s.name)
1537
- let queryPre = this.getQueryPre(sortField, s.name)
1538
- if (!queryPre) {
1539
- if (s.joinTableField && s.tableName) {
1540
- prefix = `${s.tableName}.${prefix}`
1541
- } else {
1542
- prefix = `t.${prefix}`
1543
- }
1544
- }
1545
- sorter.push({
1546
- property: queryPre + prefix + s.name,
1547
- direction: s.sort,
1548
- })
1549
- }
1550
- params.pagination.sorter = sorter
1551
- } else if (param.querys && param.querys.length > 0) {
1552
- params.pagination.querys.concat(param.querys)
1553
- }
1554
-
1555
- if (params.pagination && params.pagination.querys) {
1556
- let tempQueryS = []
1557
- let betweenConditions = {}
1558
- params.pagination.querys.forEach((q) => {
1559
- if (
1560
- q.value != undefined &&
1561
- (q.operation != 'BETWEEN' || q.value.constructor == Array)
1562
- ) {
1563
- tempQueryS.push(q)
1564
- } else if (q.value) {
1565
- let conditions = q
1566
- if (betweenConditions[q.property]) {
1567
- conditions = betweenConditions[q.property]
1568
- conditions.value = [conditions.value]
1569
- conditions.value.push(q.value)
1570
- }
1571
- betweenConditions[q.property] = conditions
1572
- }
1573
- })
1574
- for (const key in betweenConditions) {
1575
- tempQueryS.push(betweenConditions[key])
1576
- }
1577
- params.pagination.querys = tempQueryS
1578
- params.pagination.querys = params.pagination.querys
1579
- ? params.pagination.querys.concat(this.treeQuerys)
1580
- : this.treeQuerys
1581
- }
1582
- //把过滤树的条件也拼接进去
1583
- if (this.treeQuerys && this.treeQuerys.length > 0) {
1584
- params.pagination.querys = params.pagination.querys
1585
- ? params.pagination.querys.concat(this.treeQuerys)
1586
- : this.treeQuerys
1587
- }
1588
- //初始化时,把查询字段和筛选字段的默认值也加进去
1589
- if (this.isInit) {
1590
- await this.handleInitQuery(params)
1591
- }
1592
- //数据视图控件
1593
- if (this.dataView) {
1594
- this.handelBindFiledValua()
1595
- params.refIdValue = this.dataView.refIdValue
1596
- //关联查询字段
1597
- if (this.dataView.selectList && this.dataView.selectList.length > 0) {
1598
- params.selectList = this.dataView.selectList
1599
- }
1600
- }
1601
- const this_ = this
1602
- if (this_.isJoinFlow) {
1603
- params.isJoinFlow = true
1604
- params.taskType = this_.taskType
1605
- params.defKey = this_.defKey
1606
- }
1607
- // 检查是否有必填字段
1608
- if (this.checkHaveRequired && this.isInit) {
1609
- this.$refs.multipleTemplateTable.showAdvancedSearch = true
1610
- }
1611
- // 查询字段 校验是否必填,如果是必填没数据,需返回提示
1612
- let errorMsg = this.validateSearchRequired(params.pagination.querys)
1613
- if (errorMsg) {
1614
- !this.isInit && this.$message.warning(errorMsg)
1615
- cb && cb()
1616
- this.isInit = false
1617
- this.$emit('data-reload-success')
1618
- return
1619
- }
1620
- this.isInit = false
1621
- if ($.isEmptyObject(this.searchForm)) {
1622
- this.getBpmTemplateByPagination(params, cb)
1623
- } else {
1624
- this.getBpmTemplateByPagination(params, cb)
1625
- }
1626
- },
1627
- // 校验查询字段必填
1628
- validateSearchRequired(querys) {
1629
- let errorMsg = ''
1630
- let conditions = JSON.parse(this.templateInfo.conditionField)
1631
- if (conditions) {
1632
- conditions.forEach((item) => {
1633
- if (item.isRequired) {
1634
- let queryPre = this.getQueryPre(conditions, item.name)
1635
- let index = querys.findIndex((k) => {
1636
- return k.property == queryPre + item.name
1637
- })
1638
- if (index == -1) {
1639
- errorMsg = `字段【${item.cm}】为必填查询字段,不能为空!`
1640
- }
1641
- }
1642
- })
1643
- }
1644
- return errorMsg
1645
- },
1646
- checkHaveRequired() {
1647
- let haveRequired = false
1648
- try {
1649
- let conditions = JSON.parse(this.templateInfo.conditionField)
1650
- if (conditions) {
1651
- haveRequired = conditions.some((item) => {
1652
- return item.isRequired
1653
- })
1654
- }
1655
- } catch (e) {
1656
- console.log(e)
1657
- }
1658
- return haveRequired
1659
- },
1660
- searchCountTotal(param, cb, isSearchBtn, needRequestTotal = false) {
1411
+ search(param, cb, isSearchBtn, needRequestTotal = false) {
1661
1412
  // 不需要请求后端接口统计列表数据
1662
1413
  this.needRequestTotal = needRequestTotal
1663
1414
  // 如果是高级查询,页码重置为首页
@@ -1789,9 +1540,9 @@ export default {
1789
1540
  params.defKey = this_.defKey
1790
1541
  }
1791
1542
  if ($.isEmptyObject(this.searchForm)) {
1792
- this.getBpmTemplateByPaginationTotal(params, cb)
1543
+ this.getBpmTemplateByPagination(params, cb)
1793
1544
  } else {
1794
- this.getBpmTemplateByPaginationTotal(params, cb)
1545
+ this.getBpmTemplateByPagination(params, cb)
1795
1546
  }
1796
1547
  },
1797
1548
  // 处理快速查询参数
@@ -1812,24 +1563,20 @@ export default {
1812
1563
  }
1813
1564
  return param
1814
1565
  },
1815
- async handleInitQuery(params) {
1566
+ handleInitQuery(params) {
1816
1567
  const conditionFields = JSON.parse(this.templateInfo.conditionField) || []
1817
1568
  const querys = []
1818
- for (let i = 0; i < conditionFields.length; i++) {
1819
- let item = conditionFields[i]
1569
+ conditionFields.forEach((item) => {
1820
1570
  if (item.defaultValue) {
1821
- let defaultValue = item.isScriptDefault
1822
- ? await this.getScriptDefaultValue(item.defaultValue)
1823
- : item.defaultValue
1824
1571
  querys.push({
1825
1572
  property: `${item.queryPre || ''}${item.colPrefix}${item.name}`,
1826
- value: defaultValue,
1573
+ value: item.defaultValue,
1827
1574
  operation: item.qt.toUpperCase(),
1828
1575
  relation: 'AND',
1829
1576
  group: 'defaultQuery',
1830
1577
  })
1831
1578
  }
1832
- }
1579
+ })
1833
1580
  const filteringFields = JSON.parse(this.templateInfo.filteringField) || []
1834
1581
  filteringFields.forEach((item) => {
1835
1582
  if (item.defaultValue && item.defaultValue.length) {
@@ -1882,15 +1629,13 @@ export default {
1882
1629
  })
1883
1630
  }
1884
1631
  this.$requestConfig
1885
- .getDataTemplateDataListWithoutTotal(dataTemplateQueryVo)
1632
+ .getDataTemplateDataList(dataTemplateQueryVo)
1886
1633
  .then((response) => {
1887
1634
  this.rows = response.rows
1635
+ this.total = response.total
1888
1636
  this.$set(this.pagination, 'page', response.page)
1889
1637
  this.$set(this.pagination, 'pageSize', response.pageSize)
1890
- //每次请求后不再统计总数,而是在统计按钮中去统计,当数量统计过一次后,再重新设置到当前页
1891
- if (this.total) {
1892
- this.$set(this.pagination, 'total', this.total)
1893
- }
1638
+ this.$set(this.pagination, 'total', response.total)
1894
1639
  this.$set(this, 'flowBtnPermission', {})
1895
1640
  this.$emit('data-reload-success')
1896
1641
  if (response.summary && response.summary.length) {
@@ -1914,46 +1659,6 @@ export default {
1914
1659
  cb2 && cb2()
1915
1660
  })
1916
1661
  },
1917
- getBpmTemplateByPaginationTotal(params, cb1, cb2) {
1918
- const dataTemplateQueryVo = {
1919
- templateId: params.templateId,
1920
- queryFilter: params.pagination,
1921
- }
1922
- if (params.isJoinFlow && params.taskType && params.defKey) {
1923
- dataTemplateQueryVo.isJoinFlow = params.isJoinFlow
1924
- dataTemplateQueryVo.taskType = params.taskType
1925
- dataTemplateQueryVo.defKey = params.defKey
1926
- }
1927
- if (params.selectField) {
1928
- dataTemplateQueryVo.selectField = params.selectField
1929
- dataTemplateQueryVo.selectValue = params.selectValue
1930
- }
1931
- if (params.selectList) {
1932
- dataTemplateQueryVo.selectList = params.selectList
1933
- }
1934
- dataTemplateQueryVo.refIdValue = params.refIdValue
1935
- this.curSelectParams = dataTemplateQueryVo
1936
- //加载按钮
1937
- this.loadingTotal = true
1938
- this.$requestConfig
1939
- .getDataTemplateDataListWithTotal(dataTemplateQueryVo)
1940
- .then((response) => {
1941
- //设置总数
1942
- this.total = response.value
1943
- this.$set(this.pagination, 'total', response.value)
1944
- this.loadingTotal = false
1945
- this.$emit('data-reload-success')
1946
- this.$nextTick(() => {
1947
- this.$refs.multipleTemplateTable &&
1948
- this.$refs.multipleTemplateTable.doLayout()
1949
- })
1950
- })
1951
- .finally(() => {
1952
- this.loadingTotal = false
1953
- cb1 && cb1()
1954
- cb2 && cb2()
1955
- })
1956
- },
1957
1662
  getQueryFilter() {
1958
1663
  let operationMap = this.getSearchItems()
1959
1664
  let fieldTypeMap = this.getFieldType()
@@ -1970,12 +1675,6 @@ export default {
1970
1675
  params.pagination = pageBean
1971
1676
  if (!$.isEmptyObject(this.searchForm)) {
1972
1677
  let conditionField = utils.parseToJson(this.templateInfo.conditionField)
1973
- //处理绑定字段
1974
- this.bindValue = this.searchForm.bindValue || this.bindValue
1975
- this.bindKey = this.searchForm.bindKey || this.bindKey
1976
- //记录后再删除
1977
- delete this.searchForm.bindValue
1978
- delete this.searchForm.bindKey
1979
1678
  for (let key in this.searchForm) {
1980
1679
  if (
1981
1680
  typeof this.searchForm[key] != 'undefined' &&
@@ -2013,16 +1712,6 @@ export default {
2013
1712
  if (fieldTypeMap[key] && fieldTypeMap[key] == 'number') {
2014
1713
  value = parseFloat(this.searchForm[key])
2015
1714
  }
2016
- //在表单列表的查询字段中添加的对话框控件 此处逻辑对应 packages/CustomDialog/src/customDialog.vue:1920行
2017
- if (
2018
- this.bindValue &&
2019
- Object.keys(this.bindValue).length &&
2020
- this.bindValue[key] &&
2021
- Object.keys(this.bindKey).length
2022
- ) {
2023
- //获得绑定字段的值
2024
- value = this.bindValue[key][this.bindKey[key]]
2025
- }
2026
1715
  let queryPre = this.getQueryPre(conditionField, key)
2027
1716
  querys.push({
2028
1717
  property: queryPre + key,
@@ -2035,14 +1724,7 @@ export default {
2035
1724
  }
2036
1725
  }
2037
1726
  this.clearQueryByGroupName(querys, 'filter')
2038
- // 将过滤条件添加查询参数数组中,不是高级查询时使用
2039
- if (
2040
- this.$refs.multipleTemplateTable &&
2041
- this.$refs.multipleTemplateTable.querys &&
2042
- !this.$refs.multipleTemplateTable.showAdvancedSearch
2043
- ) {
2044
- querys.push(...this.$refs.multipleTemplateTable.querys)
2045
- }
1727
+ // 将过滤条件添加查询参数数组中
2046
1728
  this.buildFilterParams(querys)
2047
1729
  }
2048
1730
  // 判断table中是否含有filter查询
@@ -2651,9 +2333,7 @@ export default {
2651
2333
  handledUrlParams(url, row, fieldName) {
2652
2334
  if (this.templateInfo.displayField) {
2653
2335
  let displayFields = JSON.parse(this.templateInfo.displayField)
2654
- let params =
2655
- this.getParentId(displayFields, fieldName, 'name') ||
2656
- this.getParentId(displayFields, fieldName, 'fieldsAlias')
2336
+ let params = this.getParentId(displayFields, fieldName, 'name')
2657
2337
  if (params && params.urlParams && params.urlParams.length > 0) {
2658
2338
  let urlParams = params.urlParams
2659
2339
  let suffix = ''
@@ -2808,14 +2488,6 @@ export default {
2808
2488
  selectedQuery,
2809
2489
  ]
2810
2490
  }
2811
- // 校验
2812
- let errorMsg = this.validateSearchRequired(
2813
- this.curSelectParams.queryFilter.querys
2814
- )
2815
- if (errorMsg) {
2816
- this.$message.warning(errorMsg)
2817
- return
2818
- }
2819
2491
  //导出全部数据按钮
2820
2492
  if (type == 'all') {
2821
2493
  this.curSelectParams.queryFilter.querys = []
@@ -2828,30 +2500,24 @@ export default {
2828
2500
  id: this.templateInfo.id,
2829
2501
  params: this.curSelectParams,
2830
2502
  })
2831
- // .then(
2832
- // ({ data, headers }) => {
2833
- // const fileName = decodeURIComponent(
2834
- // headers['content-disposition'].split(';')[1].split('filename=')[1]
2835
- // )
2836
- // const blob = new Blob([data])
2837
- // saveAs(blob, fileName)
2838
- // loadingInstance.close() // 结束
2839
- // },
2840
- // (e) => {
2841
- // loadingInstance.close() // 结束
2842
- // let enc = new TextDecoder('utf-8')
2843
- // let uint8_msg = JSON.parse(
2844
- // enc.decode(new Uint8Array(e.response.data))
2845
- // )
2846
- // this.$message.error(uint8_msg.message)
2847
- // }
2848
- // )
2849
- .then(() => {
2850
- this.$message.success('正在导出,请稍后前往报表附件管理查看')
2851
- })
2852
- .finally(() => {
2853
- loadingInstance.close()
2854
- })
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
+ )
2855
2521
  },
2856
2522
  importCommand(params) {
2857
2523
  switch (params.command) {
@@ -3458,7 +3124,7 @@ export default {
3458
3124
  }
3459
3125
  this.dialogSubVisible = true
3460
3126
  },
3461
- async nodeClick(node) {
3127
+ nodeClick(node) {
3462
3128
  this.pagination.page = 1
3463
3129
  //每次点击过滤树,应该把右边的table 与分页全部重置为初始
3464
3130
 
@@ -3493,9 +3159,7 @@ export default {
3493
3159
  pageBean.querys.push({
3494
3160
  property: item.isMain
3495
3161
  ? `t.${item.key_.oldTableField}`
3496
- : `${item.key_.alias ? item.key_.alias : item.key_.tableName}.${
3497
- item.key_.oldTableField
3498
- }`,
3162
+ : `${item.key_.tableName}.${item.key_.oldTableField}`,
3499
3163
  value,
3500
3164
  group: 'main',
3501
3165
  operation,
@@ -3524,7 +3188,7 @@ export default {
3524
3188
  params.taskType = this_.taskType
3525
3189
  params.defKey = this_.defKey
3526
3190
  }
3527
- await this.handleInitQuery(params)
3191
+ this.handleInitQuery(params)
3528
3192
  this.getBpmTemplateByPagination(params)
3529
3193
  },
3530
3194
  filterChange(filters) {
@@ -4180,7 +3844,7 @@ export default {
4180
3844
  }
4181
3845
  this.$requestConfig
4182
3846
  .batchUpdateTemplateData(data)
4183
- .then(async (data) => {
3847
+ .then((data) => {
4184
3848
  if (data.state) {
4185
3849
  this.$message({
4186
3850
  type: 'success',
@@ -4190,9 +3854,8 @@ export default {
4190
3854
  // 以服务的方式调用的 Loading 需要异步关闭
4191
3855
  loadingInstance.close()
4192
3856
  })
4193
- let defaultValue = await this.newBuildDefaultQuerys()
4194
3857
  this.search({
4195
- querys: defaultValue || [],
3858
+ querys: this.buildDefaultQuerys() || [],
4196
3859
  })
4197
3860
  // 更新成功后需执行后置js
4198
3861
  if (afterScriptValue) {
@@ -4306,120 +3969,6 @@ export default {
4306
3969
  })
4307
3970
  return querys
4308
3971
  },
4309
- async newBuildDefaultQuerys(isSetSearchForm = true) {
4310
- let this_ = this
4311
- let querys = []
4312
- let conditions = JSON.parse(this_.templateInfo.conditionField)
4313
- //条件字段默认值判断
4314
- for (let i = 0; i < conditions.length; i++) {
4315
- let condition = conditions[i]
4316
- if (condition.defaultValue) {
4317
- let field = condition.colPrefix + condition.na
4318
- let defaultValue = condition.isScriptDefault
4319
- ? await this.getScriptDefaultValue(condition.defaultValue)
4320
- : condition.defaultValue
4321
- if (isSetSearchForm) {
4322
- this_.$set(this_.searchForm, field, defaultValue)
4323
- }
4324
- let value = defaultValue
4325
- if (condition.ty == 'number') {
4326
- value = parseFloat(value)
4327
- }
4328
- querys.push({
4329
- property: condition.queryPre ? condition.queryPre + field : field,
4330
- value: value,
4331
- group: 'main',
4332
- operation: condition.qt.toUpperCase(),
4333
- relation: 'AND',
4334
- })
4335
- }
4336
- }
4337
- //筛选字段默认值判断
4338
-
4339
- if (this.parameterqQuerys) {
4340
- let parameterQuerys = JSON.parse(Base64.decode(this.parameterqQuerys))
4341
- if (parameterQuerys && parameterQuerys.length > 0) {
4342
- parameterQuerys.forEach((query) => {
4343
- let prefix = this.templateInfo.isExternal === 1 ? '' : 'F_'
4344
- query.property = prefix + query.property
4345
- if (isSetSearchForm) {
4346
- this_.$set(this_.searchForm, query.property, query.value)
4347
- }
4348
- querys.push(query)
4349
- })
4350
- }
4351
- }
4352
- let filters = JSON.parse(this_.templateInfo.filteringField)
4353
- filters.forEach((filter) => {
4354
- if (filter.defaultValue && filter.defaultValue.length > 0) {
4355
- this_.filterMap[filter.name] = filter.defaultValue
4356
- filter.defaultValue.forEach((val) => {
4357
- querys.push({
4358
- property: `${filter.queryPre || ''}${filter.colPrefix}${
4359
- filter.name
4360
- }`,
4361
- value: val,
4362
- group: 'defVal_' + filter.name,
4363
- operation: 'EQUAL',
4364
- relation: 'OR',
4365
- })
4366
- })
4367
- }
4368
- })
4369
- this_.$on('afterMounted', () => {
4370
- const tab = document.getElementById(this_.templateInfo.alias)
4371
- if (tab && tab.__vue__) {
4372
- let headerColumns = tab.__vue__.$refs.tableHeader
4373
- ? tab.__vue__.$refs.tableHeader.columns
4374
- : []
4375
- headerColumns.forEach((column) => {
4376
- if (this_.filterMap.hasOwnProperty(column.property)) {
4377
- this_.filterMap[column.property].forEach((val) => {
4378
- column.filteredValue.push(val)
4379
- })
4380
- }
4381
- })
4382
- }
4383
- })
4384
- this.defaultQuerys = querys
4385
- return querys
4386
- },
4387
- getScriptDefaultValue(scriptValue) {
4388
- return new Promise((resolve) => {
4389
- //执行前置脚本内容
4390
- const _this = this
4391
- // 用户信息
4392
- const account = this.$requestConfig.getAccount()
4393
- const userId = this.$requestConfig.getUserId()
4394
- const userName = this.$requestConfig.getUsername()
4395
- const _moment = moment
4396
- const preScript = `const scriptFunction = function(_this, account, userId, userName, _moment){
4397
- ${scriptValue}
4398
- };`
4399
- let result = ''
4400
- try {
4401
- result = eval(
4402
- `${preScript}scriptFunction(_this, account, userId, userName, _moment);`
4403
- )
4404
- if (result && result.then && typeof result.then === 'function') {
4405
- result.then(
4406
- (t) => {
4407
- resolve(t)
4408
- },
4409
- (fail) => {
4410
- //接口返回失败则终止按钮操作,并输出错误信息
4411
- resolve('')
4412
- }
4413
- )
4414
- } else {
4415
- resolve(result)
4416
- }
4417
- } catch (err) {
4418
- resolve('')
4419
- this.$message.error(`查询值默认脚本事件执行错误:${err}`)
4420
- }
4421
- })
4422
- },
4423
3972
  handleClose() {
4424
3973
  this.dataViewDialogVisible = false
4425
3974
  },
@@ -4554,8 +4103,7 @@ export default {
4554
4103
  this.printDetail(parameter.templateId, parameter.id, parameter.action)
4555
4104
  } else if (btnAlias == 'sub' && this.checkSelect()) {
4556
4105
  this.showSubList(this.tableData.selectRows[0].id_, parameter)
4557
- } else if (btnAlias == 'js') {
4558
- if (parameter.needValidateSelect && !this.checkSelect()) return
4106
+ } else if (btnAlias == 'js' && this.checkSelect()) {
4559
4107
  this.customEvilJS(this.tableData.selectRows[0], parameter.jsValue)
4560
4108
  } else if (
4561
4109
  btnAlias == 'startFlow' &&
@@ -5107,30 +4655,6 @@ export default {
5107
4655
  )
5108
4656
  : customColumns
5109
4657
  },
5110
- countPageTotal() {
5111
- this.searchCountTotal(this.getParam())
5112
- },
5113
- switchPage(type) {
5114
- if (type == 'prev') this.pagination.page--
5115
- if (type == 'next') this.pagination.page++
5116
- this.handleCurrentChange(this.pagination.page)
5117
- },
5118
- handleInput(value) {
5119
- if (!value) {
5120
- return
5121
- }
5122
- // 使用正则表达式匹配正整数
5123
- const regex = /^[1-9]\d*$/
5124
-
5125
- // 如果输入的值不符合正整数的模式,则将其重置为1
5126
- if (!regex.test(value)) {
5127
- //如果上一次输入的页数有值,则用上一次输入的页数,否则默认为1
5128
- this.pagination.page = this.lastPage ? this.lastPage : 1
5129
- } else {
5130
- //本次分页数,赋值给上一次分页数
5131
- this.lastPage = this.pagination.page
5132
- }
5133
- },
5134
4658
  },
5135
4659
  // asyncComputed: {
5136
4660
  // showDraftList() {