three-trees-ui 1.0.34 → 1.0.36

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-trees-ui",
3
- "version": "1.0.34",
3
+ "version": "1.0.36",
4
4
  "publicPath": "/ui",
5
5
  "author": "hotent",
6
6
  "private": false,
@@ -22,6 +22,7 @@
22
22
  :filterable="filterable"
23
23
  :filter-method="filterMethod"
24
24
  @clear="clear"
25
+ @visible-change="handleVisibleChange"
25
26
  >
26
27
  <el-option v-if="selectlist && selectlist.length > 0" :value="inputVal">
27
28
  <el-scrollbar style="height:100%">
@@ -119,6 +120,11 @@
119
120
  this.loadOptions()
120
121
  },
121
122
  methods: {
123
+ handleVisibleChange(val) {
124
+ if (val && !this.valueDesc) {
125
+ this.loadOptions()
126
+ }
127
+ },
122
128
  loadOptions() {
123
129
  if (this.dickey) {
124
130
  this.$requestConfig.getDictionaryByKey(this.dickey).then((resp) => {
@@ -14,13 +14,14 @@
14
14
  <el-input
15
15
  v-if="isShowInput"
16
16
  ref="inputEle"
17
+ :class="{ readonly_input: readonly }"
17
18
  v-model="inputVal"
18
19
  v-validate="inputValidate"
19
20
  :type="type"
20
21
  :size="inputSize"
21
22
  :style="inputWidth"
22
23
  :name="inputName"
23
- :placeholder="placeholder"
24
+ :placeholder="readonly ? '' : placeholder"
24
25
  :clearable="clearable"
25
26
  :show-password="showPassword"
26
27
  :disabled="isDisabled"
@@ -6,7 +6,10 @@
6
6
  class="frame-viewer__img"
7
7
  v-else-if="contentType.indexOf('image') > -1"
8
8
  >
9
- <img :src="dataSrc" />
9
+ <img
10
+ :src="dataSrc"
11
+ :style="{ height: utils.isMobile() ? 'auto' : '100%' }"
12
+ />
10
13
  </div>
11
14
  <iframe
12
15
  v-else
@@ -26,6 +29,7 @@
26
29
  import Loading from './Loading.vue'
27
30
  import watermark from './watermark'
28
31
  import { createObjectURL } from '../../../src/util/brower.js'
32
+ import utils from '@/utils'
29
33
 
30
34
  export default {
31
35
  name: 'FrameViewer',
@@ -61,6 +65,7 @@
61
65
  dataSrc: null,
62
66
  loading: false,
63
67
  contentType: '',
68
+ utils,
64
69
  }
65
70
  },
66
71
  mounted() {
@@ -158,7 +163,6 @@
158
163
  border: 0;
159
164
  img {
160
165
  max-width: 100%;
161
- height: auto;
162
166
  }
163
167
  }
164
168
  .frame-viewer__img {
@@ -798,14 +798,26 @@
798
798
  this.$emit('sort-change', column)
799
799
  },
800
800
  handleFilterChange(m) {
801
+ // 如果是点击的是重置 筛选条件 需把默认的筛选条件里数据也删除掉
802
+ if (m) {
803
+ Object.keys(m).forEach((key) => {
804
+ if (
805
+ m[key] &&
806
+ m[key].length == 0 &&
807
+ this.resetDefaultFilter.indexOf(key) === -1
808
+ ) {
809
+ this.resetDefaultFilter.push(key)
810
+ }
811
+ })
812
+ }
801
813
  this.filters = { ...this.filters, ...m }
802
814
  Object.keys(this.filters).forEach((k) => {
803
815
  if (!this.filters[k] || this.filters[k].length == 0) {
804
816
  delete this.filters[k]
805
817
  }
806
818
  })
807
- this.load()
808
819
  this.$emit('filter-change', m)
820
+ this.load()
809
821
  },
810
822
  doLayout() {
811
823
  this.$nextTick(() => {
@@ -540,7 +540,7 @@ export default {
540
540
  //获取汇总全部数据
541
541
  getAllSummary(data) {
542
542
  const allSummaryConfig = data.reduce((pre, cur) => {
543
- pre[cur.field] = cur.val
543
+ pre[cur.field] = utils.thousandBit(cur.val)
544
544
  return pre
545
545
  }, {})
546
546
  if (Object.keys(allSummaryConfig).length) {
@@ -736,9 +736,14 @@ export default {
736
736
  let manageField = JSON.parse(this.templateInfo.manageField)
737
737
  let this_ = this
738
738
  manageField.forEach((item) => {
739
+ if (item.buttonId) {
740
+ obj[item.buttonId] = true
741
+ }
739
742
  if (item.beforeScriptValue) {
740
743
  let promise = this_.beforeScript(item.beforeScriptValue, item)
741
744
  promise.then((res) => {
745
+ obj[item.buttonId] = res
746
+ //为兼容旧数据(没有buttonId的数据)
742
747
  obj[item.name] = res
743
748
  })
744
749
  }
@@ -1404,6 +1409,10 @@ export default {
1404
1409
  },
1405
1410
  //列表数据查询入口
1406
1411
  search(param, cb, isSearchBtn) {
1412
+ // 如果是高级查询,页码重置为首页
1413
+ if (isSearchBtn) {
1414
+ this.pagination.page = 1
1415
+ }
1407
1416
  let params = {}
1408
1417
  //判断为合并查询还是高级查询
1409
1418
  let showAdvancedSearch = this.$refs.multipleTemplateTable
@@ -1480,7 +1489,7 @@ export default {
1480
1489
  let betweenConditions = {}
1481
1490
  params.pagination.querys.forEach((q) => {
1482
1491
  if (
1483
- q.value &&
1492
+ q.value != undefined &&
1484
1493
  (q.operation != 'BETWEEN' || q.value.constructor == Array)
1485
1494
  ) {
1486
1495
  tempQueryS.push(q)
@@ -1962,10 +1971,11 @@ export default {
1962
1971
  const filterField = utils.parseToJson(this.templateInfo.filteringField)
1963
1972
  temquerys.forEach((q) => {
1964
1973
  let prefix = this.getColPreFix(conditionField, q.property)
1974
+ const queryPre = this.getQueryPre(conditionField, q.property)
1965
1975
  if (!prefix) {
1966
1976
  prefix = this.getColPreFix(filterField, q.property)
1967
1977
  }
1968
- q.property = prefix + q.property
1978
+ q.property = queryPre + prefix + q.property
1969
1979
  querys.push(q)
1970
1980
  })
1971
1981
  }
@@ -2422,7 +2432,7 @@ export default {
2422
2432
  if (type === 'searchResult') {
2423
2433
  this.curSelectParams.queryFilter.querys = this.templateSearchQuery
2424
2434
  }
2425
- // 增加导出字段限制
2435
+ // 增加导出字段限制
2426
2436
  const checkField = this.getCheckField()
2427
2437
  if (checkField && checkField.length) {
2428
2438
  let fieldExport = {}
@@ -2431,18 +2441,50 @@ export default {
2431
2441
  })
2432
2442
  this.curSelectParams.fieldExport = fieldExport
2433
2443
  }
2444
+ if (type === 'selected') {
2445
+ const selectedId = this.tableData.selectRows.map((item) => item.id_)
2446
+ const selectedQuery = {
2447
+ property: 't.id_',
2448
+ value: selectedId ? selectedId.join(',') : '',
2449
+ group: 'main',
2450
+ operation: 'IN',
2451
+ relation: 'AND',
2452
+ }
2453
+ this.curSelectParams.queryFilter.querys = [
2454
+ ...this.curSelectParams.queryFilter.querys,
2455
+ selectedQuery,
2456
+ ]
2457
+ }
2458
+ //导出全部数据按钮
2459
+ if (type == 'all') {
2460
+ this.curSelectParams.queryFilter.querys = []
2461
+ }
2462
+ let loadingInstance = Loading.service({
2463
+ fullscreen: true,
2464
+ }) //开始
2434
2465
  this.$requestConfig
2435
2466
  .exportByBtnSetting({
2436
2467
  id: this.templateInfo.id,
2437
2468
  params: this.curSelectParams,
2438
2469
  })
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
- })
2470
+ .then(
2471
+ ({ data, headers }) => {
2472
+ const fileName = decodeURIComponent(
2473
+ headers['content-disposition'].split(';')[1].split('filename=')[1]
2474
+ )
2475
+ const blob = new Blob([data])
2476
+ saveAs(blob, fileName)
2477
+ loadingInstance.close() // 结束
2478
+ },
2479
+ (e) => {
2480
+ loadingInstance.close() // 结束
2481
+ let enc = new TextDecoder('utf-8')
2482
+ let uint8_msg = JSON.parse(
2483
+ enc.decode(new Uint8Array(e.response.data))
2484
+ )
2485
+ this.$message.error(uint8_msg.message)
2486
+ }
2487
+ )
2446
2488
  },
2447
2489
  importCommand(params) {
2448
2490
  switch (params.command) {
@@ -2731,6 +2773,13 @@ export default {
2731
2773
  operation: 'EQUAL',
2732
2774
  relation: 'AND',
2733
2775
  },
2776
+ {
2777
+ property: 'bo_alias_',
2778
+ value: this.templateInfo.boDefAlias,
2779
+ group: 'main',
2780
+ operation: 'EQUAL',
2781
+ relation: 'AND',
2782
+ },
2734
2783
  ],
2735
2784
  }
2736
2785
  this.recordTableLoading = true
@@ -3117,6 +3166,10 @@ export default {
3117
3166
  this.getBpmTemplateByPagination(params)
3118
3167
  },
3119
3168
  filterChange(filters) {
3169
+ // 筛选时需重置页面页码
3170
+ if (filters) {
3171
+ this.pagination.page = 1
3172
+ }
3120
3173
  if (filters && Object.keys(filters).length > 0) {
3121
3174
  const key = Object.keys(filters)[0]
3122
3175
  const filter = filters[key]
@@ -3497,7 +3550,10 @@ export default {
3497
3550
  currentRows
3498
3551
  .filter((item) => item[fields] !== undefined && item[fields] !== '')
3499
3552
  .map((item) => Number(item[fields]))
3500
- if (!list || list.length == 0) return
3553
+ if (!list || list.length == 0) {
3554
+ let num = 0
3555
+ return num.toFixed(decimal)
3556
+ }
3501
3557
  const METHOD_MAP = {
3502
3558
  count: 'getCount',
3503
3559
  sum: 'getSum',
@@ -3665,7 +3721,7 @@ export default {
3665
3721
  type: dialogConfig.custDialog,
3666
3722
  }
3667
3723
  obj.custdialog = {
3668
- name: '请选择',
3724
+ name: dialogConfig.name || '请选择',
3669
3725
  custDialog: custdialog,
3670
3726
  resultField: dialogConfig.resultField,
3671
3727
  }
@@ -3741,6 +3797,10 @@ export default {
3741
3797
  type: 'warning',
3742
3798
  })
3743
3799
  .then(() => {
3800
+ let loadingInstance = Loading.service({
3801
+ fullscreen: true,
3802
+ text: '数据更新中...',
3803
+ })
3744
3804
  let selectRows = row
3745
3805
  ? [row]
3746
3806
  : this.tableData.selectRows
@@ -3756,20 +3816,37 @@ export default {
3756
3816
  boData: selectRows,
3757
3817
  boAlias: this.templateInfo.boDefAlias,
3758
3818
  }
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
- })
3819
+ this.$requestConfig
3820
+ .batchUpdateTemplateData(data)
3821
+ .then((data) => {
3822
+ if (data.state) {
3823
+ this.$message({
3824
+ type: 'success',
3825
+ message: data.message,
3826
+ })
3827
+ this.$nextTick(() => {
3828
+ // 以服务的方式调用的 Loading 需要异步关闭
3829
+ loadingInstance.close()
3830
+ })
3831
+ this.search({
3832
+ querys: this.buildDefaultQuerys() || [],
3833
+ })
3834
+ // 更新成功后需执行后置js
3835
+ if (afterScriptValue) {
3836
+ let script = Base64.decode(afterScriptValue)
3837
+ this.tempScript(script, row)
3838
+ }
3839
+ } else {
3840
+ this.$nextTick(() => {
3841
+ // 以服务的方式调用的 Loading 需要异步关闭
3842
+ loadingInstance.close()
3843
+ })
3844
+ }
3845
+ })
3846
+ .finally(() => {
3847
+ loadingInstance.close()
3848
+ })
3849
+ this.$parent.init()
3773
3850
  })
3774
3851
  .catch(() => {
3775
3852
  this.$message({
@@ -4024,8 +4101,11 @@ export default {
4024
4101
  }
4025
4102
  } else if (btnOk.indexOf(btnAlias) != -1) {
4026
4103
  if (btnAlias == 'switch') {
4104
+ const pkFieldValue =
4105
+ parameter.pkField ||
4106
+ this.getBindValue(row, this.templateInfo.pkField)
4027
4107
  this.switchChange(
4028
- parameter.pkField,
4108
+ pkFieldValue,
4029
4109
  parameter.switchOn,
4030
4110
  parameter.switchOff,
4031
4111
  parameter.bind,
@@ -4532,7 +4612,7 @@ export default {
4532
4612
  return strData
4533
4613
  }
4534
4614
  },
4535
- getCheckField() {
4615
+ getCheckField() {
4536
4616
  let customColumns = this.$refs.multipleTemplateTable.customColumns || []
4537
4617
  let customColumnSetting = JSON.parse(
4538
4618
  localStorage.getItem('customColumnSetting') || '{}'