three-trees-ui 1.0.71 → 1.0.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/three-trees-ui.common.js +17716 -16437
- package/lib/three-trees-ui.css +1 -1
- package/lib/three-trees-ui.umd.js +17716 -16437
- package/lib/three-trees-ui.umd.min.js +1 -1
- package/package.json +1 -1
- package/packages/CustomDialog/src/customDialog.vue +74 -12
- package/packages/DataLists/src/main.vue +2 -3
- package/packages/QuerySqlPreview/src/QuerySqlPreview.vue +43 -1
- package/packages/Subtable/src/SubExportDialog.vue +92 -1
- package/packages/Subtable/src/SubImportDialog.vue +171 -8
- package/packages/TableSearchField/src/main.vue +5 -0
- package/packages/TemplatePreview/src/TemplatePreview.vue +43 -0
- package/src/directive/formulas.js +1 -1
- package/src/mixins/onlineSubtable.js +301 -0
- package/src/mixins/querySqlPreview.js +354 -32
- package/src/mixins/templatePreview.js +525 -42
- package/src/services/SubPagination.js +40 -1
- package/src/utils.js +32 -1
|
@@ -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
|
},
|
|
@@ -112,7 +116,9 @@ export default {
|
|
|
112
116
|
pageSize: 10,
|
|
113
117
|
total: 1,
|
|
114
118
|
},
|
|
119
|
+
lastPage: 1, //上一次输入的分页数、默认为1
|
|
115
120
|
paginationLayout: 'total, sizes, prev, pager, next, jumper',
|
|
121
|
+
paginationLayoutWithoutTotal: 'sizes, prev, pager, next, jumper',
|
|
116
122
|
total: 0,
|
|
117
123
|
permission: {
|
|
118
124
|
print: true,
|
|
@@ -222,6 +228,45 @@ export default {
|
|
|
222
228
|
: 0.85 * window.innerHeight,
|
|
223
229
|
needRequestTotal: false, // 需不需要后端统计列表全部数据
|
|
224
230
|
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
|
+
],
|
|
225
270
|
}
|
|
226
271
|
},
|
|
227
272
|
watch: {
|
|
@@ -262,7 +307,7 @@ export default {
|
|
|
262
307
|
immediate: true,
|
|
263
308
|
},
|
|
264
309
|
templateInfo: {
|
|
265
|
-
handler: function(newVal) {
|
|
310
|
+
handler: async function(newVal) {
|
|
266
311
|
if (newVal && newVal.id) {
|
|
267
312
|
let _me = this
|
|
268
313
|
_me.templateInfo = newVal
|
|
@@ -335,7 +380,7 @@ export default {
|
|
|
335
380
|
)
|
|
336
381
|
params.pagination.querys = querys
|
|
337
382
|
}
|
|
338
|
-
let defaultQuery = this.
|
|
383
|
+
let defaultQuery = await this.newBuildDefaultQuerys()
|
|
339
384
|
if (defaultQuery.length > 0) {
|
|
340
385
|
if (params.pagination.querys) {
|
|
341
386
|
params.pagination.querys.concat(defaultQuery)
|
|
@@ -486,11 +531,31 @@ export default {
|
|
|
486
531
|
this_.calcScriptBtnPermission()
|
|
487
532
|
})
|
|
488
533
|
this.$emit('afterMounted')
|
|
534
|
+
if (this.templateInfo.jsScript) {
|
|
535
|
+
// 执行js脚本
|
|
536
|
+
this.handleDiyScript(this.templateInfo.jsScript)
|
|
537
|
+
}
|
|
489
538
|
// setTimeout(() => {
|
|
490
539
|
// this.$refs.multipleTemplateTable.handleFilterChange(this.filterMap)
|
|
491
540
|
// }, 100)
|
|
492
541
|
},
|
|
493
542
|
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
|
+
},
|
|
494
559
|
//因为row.id_ 或row.id可能会有重复,所以加随机值使其唯一
|
|
495
560
|
getRowKey(row) {
|
|
496
561
|
/** 检查row.id是否有重复的缓存对象 */
|
|
@@ -1342,8 +1407,10 @@ export default {
|
|
|
1342
1407
|
}
|
|
1343
1408
|
for (let x = 0; x < display.length; x++) {
|
|
1344
1409
|
let item = JSON.parse(display[x])
|
|
1345
|
-
if (this.rows[index][item.name]) {
|
|
1346
|
-
|
|
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}`)
|
|
1347
1414
|
}
|
|
1348
1415
|
}
|
|
1349
1416
|
this.mobileFormAlias = mobileFormAlias
|
|
@@ -1359,8 +1426,8 @@ export default {
|
|
|
1359
1426
|
this.$refs.multipleTemplateTable.handleFilterChange()
|
|
1360
1427
|
},
|
|
1361
1428
|
handleCurrentChange: function(currentPage) {
|
|
1362
|
-
|
|
1363
|
-
this.pagination.page = currentPage
|
|
1429
|
+
//点击第几页,如果当前页数没有值,则默认用上一次页数
|
|
1430
|
+
this.pagination.page = currentPage ? currentPage : this.lastPage
|
|
1364
1431
|
this.$refs.multipleTemplateTable.handleFilterChange()
|
|
1365
1432
|
},
|
|
1366
1433
|
getParam(str) {
|
|
@@ -1408,7 +1475,7 @@ export default {
|
|
|
1408
1475
|
return params
|
|
1409
1476
|
},
|
|
1410
1477
|
//列表数据查询入口
|
|
1411
|
-
search(param, cb, isSearchBtn, needRequestTotal = false) {
|
|
1478
|
+
async search(param, cb, isSearchBtn, needRequestTotal = false) {
|
|
1412
1479
|
// 不需要请求后端接口统计列表数据
|
|
1413
1480
|
this.needRequestTotal = needRequestTotal
|
|
1414
1481
|
// 如果是高级查询,页码重置为首页
|
|
@@ -1521,8 +1588,7 @@ export default {
|
|
|
1521
1588
|
}
|
|
1522
1589
|
//初始化时,把查询字段和筛选字段的默认值也加进去
|
|
1523
1590
|
if (this.isInit) {
|
|
1524
|
-
this.
|
|
1525
|
-
this.handleInitQuery(params)
|
|
1591
|
+
await this.handleInitQuery(params)
|
|
1526
1592
|
}
|
|
1527
1593
|
//数据视图控件
|
|
1528
1594
|
if (this.dataView) {
|
|
@@ -1539,12 +1605,196 @@ export default {
|
|
|
1539
1605
|
params.taskType = this_.taskType
|
|
1540
1606
|
params.defKey = this_.defKey
|
|
1541
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
|
|
1542
1622
|
if ($.isEmptyObject(this.searchForm)) {
|
|
1543
1623
|
this.getBpmTemplateByPagination(params, cb)
|
|
1544
1624
|
} else {
|
|
1545
1625
|
this.getBpmTemplateByPagination(params, cb)
|
|
1546
1626
|
}
|
|
1547
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) {
|
|
1662
|
+
// 不需要请求后端接口统计列表数据
|
|
1663
|
+
this.needRequestTotal = needRequestTotal
|
|
1664
|
+
// 如果是高级查询,页码重置为首页
|
|
1665
|
+
if (isSearchBtn) {
|
|
1666
|
+
this.pagination.page = 1
|
|
1667
|
+
}
|
|
1668
|
+
let params = {}
|
|
1669
|
+
//判断为合并查询还是高级查询
|
|
1670
|
+
let showAdvancedSearch = this.$refs.multipleTemplateTable
|
|
1671
|
+
? this.$refs.multipleTemplateTable.showAdvancedSearch
|
|
1672
|
+
: false
|
|
1673
|
+
//高级查询
|
|
1674
|
+
if (showAdvancedSearch) {
|
|
1675
|
+
params = this.getQueryFilter()
|
|
1676
|
+
} else {
|
|
1677
|
+
//合并查询
|
|
1678
|
+
// 快速查询时,需处理添加快速查询字段前缀
|
|
1679
|
+
param = this.handleQuickParams(param)
|
|
1680
|
+
params = this.getConditionQuery(param)
|
|
1681
|
+
}
|
|
1682
|
+
this.templateSearchQuery =
|
|
1683
|
+
(params.pagination && params.pagination.querys) || []
|
|
1684
|
+
if (!params.pagination) {
|
|
1685
|
+
params.pagination = {}
|
|
1686
|
+
}
|
|
1687
|
+
if (!params.pagination.querys) {
|
|
1688
|
+
params.pagination.querys = []
|
|
1689
|
+
}
|
|
1690
|
+
//处理排序字段
|
|
1691
|
+
if (param && param.sorter && param.sorter.length > 0) {
|
|
1692
|
+
let sortField = JSON.parse(this.templateInfo.sortField)
|
|
1693
|
+
params.pagination = params.pagination || {}
|
|
1694
|
+
params.pagination.sorter = []
|
|
1695
|
+
param.sorter.forEach((s) => {
|
|
1696
|
+
let prefix = this.getColPreFix(sortField, s.property)
|
|
1697
|
+
let queryPre = this.getQueryPre(sortField, s.property)
|
|
1698
|
+
// 关联表时需特殊处理
|
|
1699
|
+
let relevancyProperty = this.getRelevancyProperty(
|
|
1700
|
+
sortField,
|
|
1701
|
+
s.property
|
|
1702
|
+
)
|
|
1703
|
+
if (relevancyProperty) {
|
|
1704
|
+
s.property = relevancyProperty
|
|
1705
|
+
}
|
|
1706
|
+
params.pagination.sorter.push({
|
|
1707
|
+
property: queryPre + prefix + s.property,
|
|
1708
|
+
direction: s.direction,
|
|
1709
|
+
})
|
|
1710
|
+
})
|
|
1711
|
+
} else if (this.templateInfo.sortField) {
|
|
1712
|
+
let sortField = JSON.parse(this.templateInfo.sortField)
|
|
1713
|
+
let sorter = []
|
|
1714
|
+
for (let x = 0; x < sortField.length; x++) {
|
|
1715
|
+
const s = sortField[x]
|
|
1716
|
+
// 默认排序字段的排序方向为空或者不为指定值时放弃
|
|
1717
|
+
if (!s.sort || (s.sort != 'ASC' && s.sort != 'DESC')) {
|
|
1718
|
+
continue
|
|
1719
|
+
}
|
|
1720
|
+
let prefix = this.getColPreFix(sortField, s.name)
|
|
1721
|
+
let queryPre = this.getQueryPre(sortField, s.name)
|
|
1722
|
+
if (!queryPre) {
|
|
1723
|
+
if (s.joinTableField && s.tableName) {
|
|
1724
|
+
prefix = `${s.tableName}.${prefix}`
|
|
1725
|
+
} else {
|
|
1726
|
+
prefix = `t.${prefix}`
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
sorter.push({
|
|
1730
|
+
property: queryPre + prefix + s.name,
|
|
1731
|
+
direction: s.sort,
|
|
1732
|
+
})
|
|
1733
|
+
}
|
|
1734
|
+
params.pagination.sorter = sorter
|
|
1735
|
+
} else if (param.querys && param.querys.length > 0) {
|
|
1736
|
+
params.pagination.querys.concat(param.querys)
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
if (params.pagination && params.pagination.querys) {
|
|
1740
|
+
let tempQueryS = []
|
|
1741
|
+
let betweenConditions = {}
|
|
1742
|
+
params.pagination.querys.forEach((q) => {
|
|
1743
|
+
if (
|
|
1744
|
+
q.value != undefined &&
|
|
1745
|
+
(q.operation != 'BETWEEN' || q.value.constructor == Array)
|
|
1746
|
+
) {
|
|
1747
|
+
tempQueryS.push(q)
|
|
1748
|
+
} else if (q.value) {
|
|
1749
|
+
let conditions = q
|
|
1750
|
+
if (betweenConditions[q.property]) {
|
|
1751
|
+
conditions = betweenConditions[q.property]
|
|
1752
|
+
conditions.value = [conditions.value]
|
|
1753
|
+
conditions.value.push(q.value)
|
|
1754
|
+
}
|
|
1755
|
+
betweenConditions[q.property] = conditions
|
|
1756
|
+
}
|
|
1757
|
+
})
|
|
1758
|
+
for (const key in betweenConditions) {
|
|
1759
|
+
tempQueryS.push(betweenConditions[key])
|
|
1760
|
+
}
|
|
1761
|
+
params.pagination.querys = tempQueryS
|
|
1762
|
+
params.pagination.querys = params.pagination.querys
|
|
1763
|
+
? params.pagination.querys.concat(this.treeQuerys)
|
|
1764
|
+
: this.treeQuerys
|
|
1765
|
+
}
|
|
1766
|
+
//把过滤树的条件也拼接进去
|
|
1767
|
+
if (this.treeQuerys && this.treeQuerys.length > 0) {
|
|
1768
|
+
params.pagination.querys = params.pagination.querys
|
|
1769
|
+
? params.pagination.querys.concat(this.treeQuerys)
|
|
1770
|
+
: this.treeQuerys
|
|
1771
|
+
}
|
|
1772
|
+
//初始化时,把查询字段和筛选字段的默认值也加进去
|
|
1773
|
+
if (this.isInit) {
|
|
1774
|
+
this.isInit = false
|
|
1775
|
+
this.handleInitQuery(params)
|
|
1776
|
+
}
|
|
1777
|
+
//数据视图控件
|
|
1778
|
+
if (this.dataView) {
|
|
1779
|
+
this.handelBindFiledValua()
|
|
1780
|
+
params.refIdValue = this.dataView.refIdValue
|
|
1781
|
+
//关联查询字段
|
|
1782
|
+
if (this.dataView.selectList && this.dataView.selectList.length > 0) {
|
|
1783
|
+
params.selectList = this.dataView.selectList
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
const this_ = this
|
|
1787
|
+
if (this_.isJoinFlow) {
|
|
1788
|
+
params.isJoinFlow = true
|
|
1789
|
+
params.taskType = this_.taskType
|
|
1790
|
+
params.defKey = this_.defKey
|
|
1791
|
+
}
|
|
1792
|
+
if ($.isEmptyObject(this.searchForm)) {
|
|
1793
|
+
this.getBpmTemplateByPaginationTotal(params, cb)
|
|
1794
|
+
} else {
|
|
1795
|
+
this.getBpmTemplateByPaginationTotal(params, cb)
|
|
1796
|
+
}
|
|
1797
|
+
},
|
|
1548
1798
|
// 处理快速查询参数
|
|
1549
1799
|
handleQuickParams(param) {
|
|
1550
1800
|
if (param && param.querys && param.querys.length) {
|
|
@@ -1563,20 +1813,24 @@ export default {
|
|
|
1563
1813
|
}
|
|
1564
1814
|
return param
|
|
1565
1815
|
},
|
|
1566
|
-
handleInitQuery(params) {
|
|
1816
|
+
async handleInitQuery(params) {
|
|
1567
1817
|
const conditionFields = JSON.parse(this.templateInfo.conditionField) || []
|
|
1568
1818
|
const querys = []
|
|
1569
|
-
conditionFields.
|
|
1819
|
+
for (let i = 0; i < conditionFields.length; i++) {
|
|
1820
|
+
let item = conditionFields[i]
|
|
1570
1821
|
if (item.defaultValue) {
|
|
1822
|
+
let defaultValue = item.isScriptDefault
|
|
1823
|
+
? await this.getScriptDefaultValue(item.defaultValue)
|
|
1824
|
+
: item.defaultValue
|
|
1571
1825
|
querys.push({
|
|
1572
1826
|
property: `${item.queryPre || ''}${item.colPrefix}${item.name}`,
|
|
1573
|
-
value:
|
|
1827
|
+
value: defaultValue,
|
|
1574
1828
|
operation: item.qt.toUpperCase(),
|
|
1575
1829
|
relation: 'AND',
|
|
1576
1830
|
group: 'defaultQuery',
|
|
1577
1831
|
})
|
|
1578
1832
|
}
|
|
1579
|
-
}
|
|
1833
|
+
}
|
|
1580
1834
|
const filteringFields = JSON.parse(this.templateInfo.filteringField) || []
|
|
1581
1835
|
filteringFields.forEach((item) => {
|
|
1582
1836
|
if (item.defaultValue && item.defaultValue.length) {
|
|
@@ -1629,13 +1883,15 @@ export default {
|
|
|
1629
1883
|
})
|
|
1630
1884
|
}
|
|
1631
1885
|
this.$requestConfig
|
|
1632
|
-
.
|
|
1886
|
+
.getDataTemplateDataListWithoutTotal(dataTemplateQueryVo)
|
|
1633
1887
|
.then((response) => {
|
|
1634
1888
|
this.rows = response.rows
|
|
1635
|
-
this.total = response.total
|
|
1636
1889
|
this.$set(this.pagination, 'page', response.page)
|
|
1637
1890
|
this.$set(this.pagination, 'pageSize', response.pageSize)
|
|
1638
|
-
|
|
1891
|
+
//每次请求后不再统计总数,而是在统计按钮中去统计,当数量统计过一次后,再重新设置到当前页
|
|
1892
|
+
if (this.total) {
|
|
1893
|
+
this.$set(this.pagination, 'total', this.total)
|
|
1894
|
+
}
|
|
1639
1895
|
this.$set(this, 'flowBtnPermission', {})
|
|
1640
1896
|
this.$emit('data-reload-success')
|
|
1641
1897
|
if (response.summary && response.summary.length) {
|
|
@@ -1659,6 +1915,46 @@ export default {
|
|
|
1659
1915
|
cb2 && cb2()
|
|
1660
1916
|
})
|
|
1661
1917
|
},
|
|
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
|
+
},
|
|
1662
1958
|
getQueryFilter() {
|
|
1663
1959
|
let operationMap = this.getSearchItems()
|
|
1664
1960
|
let fieldTypeMap = this.getFieldType()
|
|
@@ -1675,6 +1971,12 @@ export default {
|
|
|
1675
1971
|
params.pagination = pageBean
|
|
1676
1972
|
if (!$.isEmptyObject(this.searchForm)) {
|
|
1677
1973
|
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
|
|
1678
1980
|
for (let key in this.searchForm) {
|
|
1679
1981
|
if (
|
|
1680
1982
|
typeof this.searchForm[key] != 'undefined' &&
|
|
@@ -1712,6 +2014,16 @@ export default {
|
|
|
1712
2014
|
if (fieldTypeMap[key] && fieldTypeMap[key] == 'number') {
|
|
1713
2015
|
value = parseFloat(this.searchForm[key])
|
|
1714
2016
|
}
|
|
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
|
+
}
|
|
1715
2027
|
let queryPre = this.getQueryPre(conditionField, key)
|
|
1716
2028
|
querys.push({
|
|
1717
2029
|
property: queryPre + key,
|
|
@@ -1724,7 +2036,14 @@ export default {
|
|
|
1724
2036
|
}
|
|
1725
2037
|
}
|
|
1726
2038
|
this.clearQueryByGroupName(querys, 'filter')
|
|
1727
|
-
//
|
|
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
|
+
}
|
|
1728
2047
|
this.buildFilterParams(querys)
|
|
1729
2048
|
}
|
|
1730
2049
|
// 判断table中是否含有filter查询
|
|
@@ -2333,7 +2652,9 @@ export default {
|
|
|
2333
2652
|
handledUrlParams(url, row, fieldName) {
|
|
2334
2653
|
if (this.templateInfo.displayField) {
|
|
2335
2654
|
let displayFields = JSON.parse(this.templateInfo.displayField)
|
|
2336
|
-
let params =
|
|
2655
|
+
let params =
|
|
2656
|
+
this.getParentId(displayFields, fieldName, 'name') ||
|
|
2657
|
+
this.getParentId(displayFields, fieldName, 'fieldsAlias')
|
|
2337
2658
|
if (params && params.urlParams && params.urlParams.length > 0) {
|
|
2338
2659
|
let urlParams = params.urlParams
|
|
2339
2660
|
let suffix = ''
|
|
@@ -2488,6 +2809,14 @@ export default {
|
|
|
2488
2809
|
selectedQuery,
|
|
2489
2810
|
]
|
|
2490
2811
|
}
|
|
2812
|
+
// 校验
|
|
2813
|
+
let errorMsg = this.validateSearchRequired(
|
|
2814
|
+
this.curSelectParams.queryFilter.querys
|
|
2815
|
+
)
|
|
2816
|
+
if (errorMsg) {
|
|
2817
|
+
this.$message.warning(errorMsg)
|
|
2818
|
+
return
|
|
2819
|
+
}
|
|
2491
2820
|
//导出全部数据按钮
|
|
2492
2821
|
if (type == 'all') {
|
|
2493
2822
|
this.curSelectParams.queryFilter.querys = []
|
|
@@ -2500,24 +2829,30 @@ export default {
|
|
|
2500
2829
|
id: this.templateInfo.id,
|
|
2501
2830
|
params: this.curSelectParams,
|
|
2502
2831
|
})
|
|
2503
|
-
.then(
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
)
|
|
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
|
+
})
|
|
2521
2856
|
},
|
|
2522
2857
|
importCommand(params) {
|
|
2523
2858
|
switch (params.command) {
|
|
@@ -3124,7 +3459,7 @@ export default {
|
|
|
3124
3459
|
}
|
|
3125
3460
|
this.dialogSubVisible = true
|
|
3126
3461
|
},
|
|
3127
|
-
nodeClick(node) {
|
|
3462
|
+
async nodeClick(node) {
|
|
3128
3463
|
this.pagination.page = 1
|
|
3129
3464
|
//每次点击过滤树,应该把右边的table 与分页全部重置为初始
|
|
3130
3465
|
|
|
@@ -3159,7 +3494,9 @@ export default {
|
|
|
3159
3494
|
pageBean.querys.push({
|
|
3160
3495
|
property: item.isMain
|
|
3161
3496
|
? `t.${item.key_.oldTableField}`
|
|
3162
|
-
: `${item.key_.
|
|
3497
|
+
: `${item.key_.alias ? item.key_.alias : item.key_.tableName}.${
|
|
3498
|
+
item.key_.oldTableField
|
|
3499
|
+
}`,
|
|
3163
3500
|
value,
|
|
3164
3501
|
group: 'main',
|
|
3165
3502
|
operation,
|
|
@@ -3188,7 +3525,13 @@ export default {
|
|
|
3188
3525
|
params.taskType = this_.taskType
|
|
3189
3526
|
params.defKey = this_.defKey
|
|
3190
3527
|
}
|
|
3191
|
-
this.handleInitQuery(params)
|
|
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
|
+
}
|
|
3192
3535
|
this.getBpmTemplateByPagination(params)
|
|
3193
3536
|
},
|
|
3194
3537
|
filterChange(filters) {
|
|
@@ -3844,7 +4187,7 @@ export default {
|
|
|
3844
4187
|
}
|
|
3845
4188
|
this.$requestConfig
|
|
3846
4189
|
.batchUpdateTemplateData(data)
|
|
3847
|
-
.then((data) => {
|
|
4190
|
+
.then(async (data) => {
|
|
3848
4191
|
if (data.state) {
|
|
3849
4192
|
this.$message({
|
|
3850
4193
|
type: 'success',
|
|
@@ -3854,8 +4197,9 @@ export default {
|
|
|
3854
4197
|
// 以服务的方式调用的 Loading 需要异步关闭
|
|
3855
4198
|
loadingInstance.close()
|
|
3856
4199
|
})
|
|
4200
|
+
let defaultValue = await this.newBuildDefaultQuerys()
|
|
3857
4201
|
this.search({
|
|
3858
|
-
querys:
|
|
4202
|
+
querys: defaultValue || [],
|
|
3859
4203
|
})
|
|
3860
4204
|
// 更新成功后需执行后置js
|
|
3861
4205
|
if (afterScriptValue) {
|
|
@@ -3969,6 +4313,120 @@ export default {
|
|
|
3969
4313
|
})
|
|
3970
4314
|
return querys
|
|
3971
4315
|
},
|
|
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
|
+
},
|
|
3972
4430
|
handleClose() {
|
|
3973
4431
|
this.dataViewDialogVisible = false
|
|
3974
4432
|
},
|
|
@@ -4103,7 +4561,8 @@ export default {
|
|
|
4103
4561
|
this.printDetail(parameter.templateId, parameter.id, parameter.action)
|
|
4104
4562
|
} else if (btnAlias == 'sub' && this.checkSelect()) {
|
|
4105
4563
|
this.showSubList(this.tableData.selectRows[0].id_, parameter)
|
|
4106
|
-
} else if (btnAlias == 'js'
|
|
4564
|
+
} else if (btnAlias == 'js') {
|
|
4565
|
+
if (parameter.needValidateSelect && !this.checkSelect()) return
|
|
4107
4566
|
this.customEvilJS(this.tableData.selectRows[0], parameter.jsValue)
|
|
4108
4567
|
} else if (
|
|
4109
4568
|
btnAlias == 'startFlow' &&
|
|
@@ -4655,6 +5114,30 @@ export default {
|
|
|
4655
5114
|
)
|
|
4656
5115
|
: customColumns
|
|
4657
5116
|
},
|
|
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
|
+
},
|
|
4658
5141
|
},
|
|
4659
5142
|
// asyncComputed: {
|
|
4660
5143
|
// showDraftList() {
|