three-trees-ui 1.0.31 → 1.0.32

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.
@@ -9,6 +9,7 @@ import $ from 'jquery'
9
9
  const axios = require('axios')
10
10
  const { saveAs } = require('file-saver')
11
11
  import _ from 'lodash'
12
+ import { decode } from '@/util/base64'
12
13
 
13
14
  const req = function(url, data = {}, option = {}) {
14
15
  const requestData = {
@@ -464,9 +465,13 @@ export default {
464
465
  return list
465
466
  },
466
467
  tableHeight() {
468
+ const currentHeight = 0.85 * window.innerHeight
469
+ const tableHeight = this.currentTableHeight
470
+ ? this.currentTableHeight
471
+ : currentHeight
467
472
  return this.summaryFields && this.summaryFields.length > 0
468
- ? this.defaultCurrentInnerHeight - this.summaryTableHeight
469
- : this.defaultCurrentInnerHeight
473
+ ? tableHeight - this.summaryTableHeight
474
+ : tableHeight
470
475
  },
471
476
  },
472
477
  mounted() {
@@ -535,7 +540,7 @@ export default {
535
540
  //获取汇总全部数据
536
541
  getAllSummary(data) {
537
542
  const allSummaryConfig = data.reduce((pre, cur) => {
538
- pre[cur.field] = utils.thousandBit(cur.val)
543
+ pre[cur.field] = cur.val
539
544
  return pre
540
545
  }, {})
541
546
  if (Object.keys(allSummaryConfig).length) {
@@ -731,14 +736,9 @@ export default {
731
736
  let manageField = JSON.parse(this.templateInfo.manageField)
732
737
  let this_ = this
733
738
  manageField.forEach((item) => {
734
- if (item.buttonId) {
735
- obj[item.buttonId] = true
736
- }
737
739
  if (item.beforeScriptValue) {
738
740
  let promise = this_.beforeScript(item.beforeScriptValue, item)
739
741
  promise.then((res) => {
740
- obj[item.buttonId] = res
741
- //为兼容旧数据(没有buttonId的数据)
742
742
  obj[item.name] = res
743
743
  })
744
744
  }
@@ -1404,10 +1404,6 @@ export default {
1404
1404
  },
1405
1405
  //列表数据查询入口
1406
1406
  search(param, cb, isSearchBtn) {
1407
- // 如果是高级查询,页码重置为首页
1408
- if (isSearchBtn) {
1409
- this.pagination.page = 1
1410
- }
1411
1407
  let params = {}
1412
1408
  //判断为合并查询还是高级查询
1413
1409
  let showAdvancedSearch = this.$refs.multipleTemplateTable
@@ -1484,7 +1480,7 @@ export default {
1484
1480
  let betweenConditions = {}
1485
1481
  params.pagination.querys.forEach((q) => {
1486
1482
  if (
1487
- q.value != undefined &&
1483
+ q.value &&
1488
1484
  (q.operation != 'BETWEEN' || q.value.constructor == Array)
1489
1485
  ) {
1490
1486
  tempQueryS.push(q)
@@ -1966,11 +1962,10 @@ export default {
1966
1962
  const filterField = utils.parseToJson(this.templateInfo.filteringField)
1967
1963
  temquerys.forEach((q) => {
1968
1964
  let prefix = this.getColPreFix(conditionField, q.property)
1969
- const queryPre = this.getQueryPre(conditionField, q.property)
1970
1965
  if (!prefix) {
1971
1966
  prefix = this.getColPreFix(filterField, q.property)
1972
1967
  }
1973
- q.property = queryPre + prefix + q.property
1968
+ q.property = prefix + q.property
1974
1969
  querys.push(q)
1975
1970
  })
1976
1971
  }
@@ -2427,50 +2422,27 @@ export default {
2427
2422
  if (type === 'searchResult') {
2428
2423
  this.curSelectParams.queryFilter.querys = this.templateSearchQuery
2429
2424
  }
2430
- if (type === 'selected') {
2431
- const selectedId = this.tableData.selectRows.map((item) => item.id_)
2432
- const selectedQuery = {
2433
- property: 't.id_',
2434
- value: selectedId ? selectedId.join(',') : '',
2435
- group: 'main',
2436
- operation: 'IN',
2437
- relation: 'AND',
2438
- }
2439
- this.curSelectParams.queryFilter.querys = [
2440
- ...this.curSelectParams.queryFilter.querys,
2441
- selectedQuery,
2442
- ]
2443
- }
2444
- //导出全部数据按钮
2445
- if (type == 'all') {
2446
- this.curSelectParams.queryFilter.querys = []
2425
+ // 增加导出字段限制
2426
+ const checkField = this.getCheckField()
2427
+ if (checkField && checkField.length) {
2428
+ let fieldExport = {}
2429
+ checkField.forEach((item) => {
2430
+ fieldExport[item.key] = item.value
2431
+ })
2432
+ this.curSelectParams.fieldExport = fieldExport
2447
2433
  }
2448
- let loadingInstance = Loading.service({
2449
- fullscreen: true,
2450
- }) //开始
2451
2434
  this.$requestConfig
2452
2435
  .exportByBtnSetting({
2453
2436
  id: this.templateInfo.id,
2454
2437
  params: this.curSelectParams,
2455
2438
  })
2456
- .then(
2457
- ({ data, headers }) => {
2458
- const fileName = decodeURIComponent(
2459
- headers['content-disposition'].split(';')[1].split('filename=')[1]
2460
- )
2461
- const blob = new Blob([data])
2462
- saveAs(blob, fileName)
2463
- loadingInstance.close() // 结束
2464
- },
2465
- (e) => {
2466
- loadingInstance.close() // 结束
2467
- let enc = new TextDecoder('utf-8')
2468
- let uint8_msg = JSON.parse(
2469
- enc.decode(new Uint8Array(e.response.data))
2470
- )
2471
- this.$message.error(uint8_msg.message)
2472
- }
2473
- )
2439
+ .then(({ data, headers }) => {
2440
+ const fileName = decodeURIComponent(
2441
+ headers['content-disposition'].split(';')[1].split('filename=')[1]
2442
+ )
2443
+ const blob = new Blob([data])
2444
+ saveAs(blob, fileName)
2445
+ })
2474
2446
  },
2475
2447
  importCommand(params) {
2476
2448
  switch (params.command) {
@@ -2759,13 +2731,6 @@ export default {
2759
2731
  operation: 'EQUAL',
2760
2732
  relation: 'AND',
2761
2733
  },
2762
- {
2763
- property: 'bo_alias_',
2764
- value: this.templateInfo.boDefAlias,
2765
- group: 'main',
2766
- operation: 'EQUAL',
2767
- relation: 'AND',
2768
- },
2769
2734
  ],
2770
2735
  }
2771
2736
  this.recordTableLoading = true
@@ -3152,10 +3117,6 @@ export default {
3152
3117
  this.getBpmTemplateByPagination(params)
3153
3118
  },
3154
3119
  filterChange(filters) {
3155
- // 筛选时需重置页面页码
3156
- if (filters) {
3157
- this.pagination.page = 1
3158
- }
3159
3120
  if (filters && Object.keys(filters).length > 0) {
3160
3121
  const key = Object.keys(filters)[0]
3161
3122
  const filter = filters[key]
@@ -3536,10 +3497,7 @@ export default {
3536
3497
  currentRows
3537
3498
  .filter((item) => item[fields] !== undefined && item[fields] !== '')
3538
3499
  .map((item) => Number(item[fields]))
3539
- if (!list || list.length == 0) {
3540
- let num = 0
3541
- return num.toFixed(decimal)
3542
- }
3500
+ if (!list || list.length == 0) return
3543
3501
  const METHOD_MAP = {
3544
3502
  count: 'getCount',
3545
3503
  sum: 'getSum',
@@ -3707,7 +3665,7 @@ export default {
3707
3665
  type: dialogConfig.custDialog,
3708
3666
  }
3709
3667
  obj.custdialog = {
3710
- name: dialogConfig.name || '请选择',
3668
+ name: '请选择',
3711
3669
  custDialog: custdialog,
3712
3670
  resultField: dialogConfig.resultField,
3713
3671
  }
@@ -3783,10 +3741,6 @@ export default {
3783
3741
  type: 'warning',
3784
3742
  })
3785
3743
  .then(() => {
3786
- let loadingInstance = Loading.service({
3787
- fullscreen: true,
3788
- text: '数据更新中...',
3789
- })
3790
3744
  let selectRows = row
3791
3745
  ? [row]
3792
3746
  : this.tableData.selectRows
@@ -3802,37 +3756,20 @@ export default {
3802
3756
  boData: selectRows,
3803
3757
  boAlias: this.templateInfo.boDefAlias,
3804
3758
  }
3805
- this.$requestConfig
3806
- .batchUpdateTemplateData(data)
3807
- .then((data) => {
3808
- if (data.state) {
3809
- this.$message({
3810
- type: 'success',
3811
- message: data.message,
3812
- })
3813
- this.$nextTick(() => {
3814
- // 以服务的方式调用的 Loading 需要异步关闭
3815
- loadingInstance.close()
3816
- })
3817
- this.search({
3818
- querys: this.buildDefaultQuerys() || [],
3819
- })
3820
- // 更新成功后需执行后置js
3821
- if (afterScriptValue) {
3822
- let script = Base64.decode(afterScriptValue)
3823
- this.tempScript(script, row)
3824
- }
3825
- } else {
3826
- this.$nextTick(() => {
3827
- // 以服务的方式调用的 Loading 需要异步关闭
3828
- loadingInstance.close()
3829
- })
3830
- }
3831
- })
3832
- .finally(() => {
3833
- loadingInstance.close()
3834
- })
3835
- this.$parent.init()
3759
+ this.$requestConfig.batchUpdateTemplateData(data).then((data) => {
3760
+ if (data.state) {
3761
+ this.$message({
3762
+ type: 'success',
3763
+ message: data.message,
3764
+ })
3765
+ this.search({
3766
+ querys: this.buildDefaultQuerys() || [],
3767
+ })
3768
+ // 更新成功后需执行后置js
3769
+ let script = Base64.decode(afterScriptValue)
3770
+ this.tempScript(script, row)
3771
+ }
3772
+ })
3836
3773
  })
3837
3774
  .catch(() => {
3838
3775
  this.$message({
@@ -4087,11 +4024,8 @@ export default {
4087
4024
  }
4088
4025
  } else if (btnOk.indexOf(btnAlias) != -1) {
4089
4026
  if (btnAlias == 'switch') {
4090
- const pkFieldValue =
4091
- parameter.pkField ||
4092
- this.getBindValue(row, this.templateInfo.pkField)
4093
4027
  this.switchChange(
4094
- pkFieldValue,
4028
+ parameter.pkField,
4095
4029
  parameter.switchOn,
4096
4030
  parameter.switchOff,
4097
4031
  parameter.bind,
@@ -4598,6 +4532,20 @@ export default {
4598
4532
  return strData
4599
4533
  }
4600
4534
  },
4535
+ getCheckField() {
4536
+ let customColumns = this.$refs.multipleTemplateTable.customColumns || []
4537
+ let customColumnSetting = JSON.parse(
4538
+ localStorage.getItem('customColumnSetting') || '{}'
4539
+ )
4540
+ const keys = customColumns.reduce((m, n) => m.concat(n.key), [])
4541
+ const customColumnsHashCode = utils.hashCode(keys.join(','))
4542
+ const checkField = JSON.parse(
4543
+ decode(customColumnSetting[customColumnsHashCode]) || '[]'
4544
+ )
4545
+ return checkField.filter(
4546
+ (field) => field.checked && ['序号', '操作'].indexOf(field.value) == -1
4547
+ )
4548
+ },
4601
4549
  },
4602
4550
  // asyncComputed: {
4603
4551
  // showDraftList() {