three-trees-ui 1.0.29 → 1.0.31

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.29",
3
+ "version": "1.0.31",
4
4
  "publicPath": "/ui",
5
5
  "author": "hotent",
6
6
  "private": false,
@@ -683,7 +683,7 @@
683
683
  var obj = {}
684
684
  //条件查询参数(用户输入的) 文本框输入 defaultType 1 用户输入 2固定值 3参数传入 5脚本
685
685
  if (ele.defaultType == '1') {
686
- obj[ele.field] = ele.regularValue || ''
686
+ obj[ele.field] = ''
687
687
  queryParams.push(obj)
688
688
  // queryParams[ele.field] = "";
689
689
  this_.conditionBind.push(ele)
@@ -1122,11 +1122,6 @@
1122
1122
  let flag = false
1123
1123
  if (this.queryParams.length != 0 && this.queryParams[0] != '') {
1124
1124
  this.conditionBind.forEach((item, index) => {
1125
- if (item.isRequire == 1 && !this.queryParams[index][item.field]) {
1126
- this.$message.error(`${item.comment}必填`)
1127
- flag = true
1128
- return
1129
- }
1130
1125
  // 日期范围特殊处理
1131
1126
  if (item.dbType == 'date' && item.condition == 'BETWEEN') {
1132
1127
  if (
@@ -2,12 +2,6 @@
2
2
  <div class="frame-container">
3
3
  <div class="frame-container__body">
4
4
  <loading v-if="loading" />
5
- <div
6
- class="frame-viewer__img"
7
- v-else-if="contentType.indexOf('image') > -1"
8
- >
9
- <img :src="dataSrc" />
10
- </div>
11
5
  <iframe
12
6
  v-else
13
7
  id="myNormframe"
@@ -60,7 +54,6 @@
60
54
  return {
61
55
  dataSrc: null,
62
56
  loading: false,
63
- contentType: '',
64
57
  }
65
58
  },
66
59
  mounted() {
@@ -78,7 +71,7 @@
78
71
  .then((response) => {
79
72
  const { data, headers } = response
80
73
  const type = headers['content-type']
81
- this.contentType = type
74
+
82
75
  if (type) {
83
76
  if (window.navigator && window.navigator.msSaveBlob) {
84
77
  //使用Blob构造函数可以直接在客户端上创建和操作Blob。msSaveBlob:只提供一个保存按钮
@@ -116,12 +109,12 @@
116
109
  return
117
110
  }
118
111
  if (iframe.attachEvent) {
119
- iframe.attachEvent('onload', function() {
112
+ iframe.attachEvent('onload', function () {
120
113
  that.setFrameBody(this.contentWindow.document)
121
114
  that.watermarkRender()
122
115
  })
123
116
  } else {
124
- iframe.onload = function() {
117
+ iframe.onload = function () {
125
118
  that.setFrameBody(this.contentWindow.document)
126
119
  that.watermarkRender()
127
120
  }
@@ -151,8 +144,7 @@
151
144
  height: 100%;
152
145
  }
153
146
 
154
- .frame-viewer__iframe,
155
- .frame-viewer__img {
147
+ .frame-viewer__iframe {
156
148
  width: 100%;
157
149
  height: 100%;
158
150
  border: 0;
@@ -161,10 +153,5 @@
161
153
  height: auto;
162
154
  }
163
155
  }
164
- .frame-viewer__img {
165
- display: flex;
166
- align-items: center;
167
- justify-content: center;
168
- }
169
156
  }
170
157
  </style>
@@ -33,14 +33,14 @@
33
33
  { id: '3', name: '我的所有部门' },
34
34
  { id: '4', name: '我的所有部门及下属部门' },
35
35
  ],
36
- currentPolicy: '1',
36
+ currentPolicy: '',
37
37
  currentUserOrgs: [],
38
38
  }
39
39
  },
40
40
  watch: {
41
41
  mode: function(newVal, oldVal) {
42
42
  if (newVal !== oldVal && newVal == 'search') {
43
- this.currentPolicy = '1'
43
+ this.currentPolicy = ''
44
44
  }
45
45
  },
46
46
  currentPolicy: function(newVal, oldVal) {
@@ -49,9 +49,6 @@
49
49
  }
50
50
  },
51
51
  },
52
- mounted() {
53
- this.loadUserWithPolicy(this.currentPolicy)
54
- },
55
52
  methods: {
56
53
  // 按照指定策略加载数据
57
54
  loadUserWithPolicy(policy) {
@@ -64,7 +61,7 @@
64
61
  this.$message.error(
65
62
  '未获取到当前用户的部门信息,无法按照该策略加载数据。'
66
63
  )
67
- this.currentPolicy = '1'
64
+ this.currentPolicy = ''
68
65
  })
69
66
  },
70
67
  // 根据策略构建不同的查询参数
@@ -218,7 +218,7 @@
218
218
  data() {
219
219
  return {
220
220
  dialogVisible: false,
221
- activeRange: 'policy',
221
+ activeRange: 'contact',
222
222
  searchWord: null,
223
223
  loading: false,
224
224
  }
@@ -18,128 +18,63 @@
18
18
  @click="handleDialogClose"
19
19
  />
20
20
  </template>
21
- <van-tabs
22
- v-model="activeGroupVal"
23
- :color="primaryColor"
24
- @change="loadFilterGroup"
25
- >
26
- <van-tab title="我的主部门" name="myDep">
27
- <van-search
28
- v-model="searchWord"
29
- :placeholder="searchPlaceholder"
30
- @input="onSearchInput"
31
- @clear="reset"
32
- />
33
- <van-pull-refresh v-model="isLoading" @refresh="onRefresh">
34
- <van-list
35
- v-model="isLoading"
36
- class="user-data__list"
37
- :finished="finished"
38
- finished-text="没有更多了"
39
- @load="loadMore"
21
+
22
+ <van-search
23
+ v-model="searchWord"
24
+ :placeholder="searchPlaceholder"
25
+ @input="onSearchInput"
26
+ @clear="reset"
27
+ />
28
+ <van-pull-refresh v-model="isLoading" @refresh="onRefresh">
29
+ <van-list
30
+ v-model="isLoading"
31
+ class="user-data__list"
32
+ :finished="finished"
33
+ finished-text="没有更多了"
34
+ @load="loadMore"
35
+ >
36
+ <van-checkbox-group v-model="selectIds">
37
+ <van-cell
38
+ v-for="item in data"
39
+ :key="item[primaryFieldProp]"
40
+ clickable
41
+ @click="rowClick(item, null, $event)"
40
42
  >
41
- <van-checkbox-group v-model="selectIds">
42
- <van-cell
43
- v-for="item in data"
44
- :key="item[primaryFieldProp]"
45
- clickable
46
- @click="rowClick(item, null, $event)"
47
- >
48
- <template #icon>
49
- <van-checkbox
50
- :name="item[primaryFieldProp]"
51
- :shape="single ? 'round' : 'square'"
52
- />
53
- </template>
54
- <div class="user-list__container">
55
- <ht-avatar-image
56
- class="follow-theme-background-color"
57
- :username="item[selectLabel]"
58
- background-color="#409EFF"
59
- color="#fff"
60
- :size="36"
61
- />
62
- <div class="selector-item__detail">
63
- <div class="selector-detail__name">
64
- <label>{{ item[selectLabel] }}</label>
65
- <span>({{ item['account'] }})</span>
66
- </div>
67
- <div class="selector-detail__desc">
68
- <span :title="item.orgname">
69
- <ht-icon name="org-tree" />
70
- {{ item.orgname || '无' }}
71
- </span>
72
- <span :title="item.postname">
73
- <ht-icon name="users" />
74
- {{ item.postname || '无' }}
75
- </span>
76
- </div>
77
- </div>
43
+ <template #icon>
44
+ <van-checkbox
45
+ :name="item[primaryFieldProp]"
46
+ :shape="single ? 'round' : 'square'"
47
+ />
48
+ </template>
49
+ <div class="user-list__container">
50
+ <ht-avatar-image
51
+ class="follow-theme-background-color"
52
+ :username="item[selectLabel]"
53
+ background-color="#409EFF"
54
+ color="#fff"
55
+ :size="36"
56
+ />
57
+ <div class="selector-item__detail">
58
+ <div class="selector-detail__name">
59
+ <label>{{ item[selectLabel] }}</label>
60
+ <span>({{ item['account'] }})</span>
78
61
  </div>
79
- </van-cell>
80
- </van-checkbox-group>
81
- </van-list>
82
- </van-pull-refresh>
83
- </van-tab>
84
- <van-tab title="所有用户" name="all">
85
- <van-search
86
- v-model="searchWord"
87
- :placeholder="searchPlaceholder"
88
- @input="onSearchInput"
89
- @clear="reset"
90
- />
91
- <van-pull-refresh v-model="isLoading" @refresh="onRefresh">
92
- <van-list
93
- v-model="isLoading"
94
- class="user-data__list"
95
- :finished="finished"
96
- finished-text="没有更多了"
97
- @load="loadMore"
98
- >
99
- <van-checkbox-group v-model="selectIds">
100
- <van-cell
101
- v-for="item in data"
102
- :key="item[primaryFieldProp]"
103
- clickable
104
- @click="rowClick(item, null, $event)"
105
- >
106
- <template #icon>
107
- <van-checkbox
108
- :name="item[primaryFieldProp]"
109
- :shape="single ? 'round' : 'square'"
110
- />
111
- </template>
112
- <div class="user-list__container">
113
- <ht-avatar-image
114
- class="follow-theme-background-color"
115
- :username="item[selectLabel]"
116
- background-color="#409EFF"
117
- color="#fff"
118
- :size="36"
119
- />
120
- <div class="selector-item__detail">
121
- <div class="selector-detail__name">
122
- <label>{{ item[selectLabel] }}</label>
123
- <span>({{ item['account'] }})</span>
124
- </div>
125
- <div class="selector-detail__desc">
126
- <span :title="item.orgname">
127
- <ht-icon name="org-tree" />
128
- {{ item.orgname || '无' }}
129
- </span>
130
- <span :title="item.postname">
131
- <ht-icon name="users" />
132
- {{ item.postname || '无' }}
133
- </span>
134
- </div>
135
- </div>
62
+ <div class="selector-detail__desc">
63
+ <span :title="item.orgname">
64
+ <ht-icon name="org-tree" />
65
+ {{ item.orgname || '无' }}
66
+ </span>
67
+ <span :title="item.postname">
68
+ <ht-icon name="users" />
69
+ {{ item.postname || '无' }}
70
+ </span>
136
71
  </div>
137
- </van-cell>
138
- </van-checkbox-group>
139
- </van-list>
140
- </van-pull-refresh>
141
- </van-tab>
142
- </van-tabs>
72
+ </div>
73
+ </div>
74
+ </van-cell>
75
+ </van-checkbox-group>
76
+ </van-list>
77
+ </van-pull-refresh>
143
78
  </van-action-sheet>
144
79
  </template>
145
80
  <script>
@@ -206,8 +141,6 @@
206
141
  selectIds: [],
207
142
  selectedData: [],
208
143
  finished: false,
209
- activeGroupVal: 'myDep',
210
- querys: [],
211
144
  }
212
145
  },
213
146
  computed: {
@@ -236,9 +169,6 @@
236
169
  }
237
170
  },
238
171
  },
239
- mounted() {
240
- this.getOrgId()
241
- },
242
172
  methods: {
243
173
  onSearchInput: debounce(function() {
244
174
  this.onRefresh()
@@ -303,30 +233,6 @@
303
233
  }
304
234
  this.$emit('row-click', row, column, event)
305
235
  },
306
- loadFilterGroup(tabName) {
307
- // 重置分页
308
- if (tabName !== this.activeGroupVal) this.pagination.page = 1
309
- this.activeGroupVal = tabName
310
- this.$emit('getCustomQuerys', tabName === 'all' ? [] : this.querys)
311
- this.onRefresh()
312
- },
313
- getOrgId() {
314
- this.$requestConfig
315
- .getOrgListByUserId(this.$requestConfig.getUserId())
316
- .then((orgs) => {
317
- const masterOrg = (orgs || []).find((org) => org.isMaster == 1)
318
- this.querys = [
319
- {
320
- group: 'mainOrg',
321
- operation: 'EQUAL',
322
- property: 'uo.id_',
323
- relation: 'AND',
324
- value: masterOrg.id,
325
- },
326
- ]
327
- this.$emit('getCustomQuerys', this.querys)
328
- })
329
- },
330
236
  },
331
237
  }
332
238
  </script>
@@ -415,8 +321,7 @@
415
321
  }
416
322
 
417
323
  .user-data__list {
418
- max-height: 400px;
419
- overflow: auto;
324
+ min-height: 400px;
420
325
  }
421
326
  .van-action-sheet__cancel {
422
327
  padding: 5px;
@@ -123,7 +123,6 @@
123
123
  @row-click="(row) => $emit('row-click', row)"
124
124
  @select-data="(data) => $emit('select-data', data)"
125
125
  @page-change="(page) => $emit('page-change', page)"
126
- @getCustomQuerys="(querys) => $emit('getCustomQuerys', querys)"
127
126
  />
128
127
  </div>
129
128
  </template>
@@ -38,7 +38,6 @@
38
38
  @load-role-user="loadRoleUser"
39
39
  @row-click="(row) => $emit('row-click', row)"
40
40
  @select-data="(data) => $emit('select-data', data)"
41
- @getCustomQuerys="(querys) => (customQuerys = querys || [])"
42
41
  ></ht-user-selector>
43
42
  </div>
44
43
  </template>
@@ -93,7 +92,6 @@
93
92
  total: 0,
94
93
  showTotal: true,
95
94
  },
96
- customQuerys: [],
97
95
  }
98
96
  },
99
97
  mounted() {
@@ -229,7 +227,6 @@
229
227
  },
230
228
  // 加载全部用户
231
229
  loadAllUser(param) {
232
- param.querys = [...param.querys, ...this.customQuerys]
233
230
  this.$requestConfig.getUserList(param).then((data) => {
234
231
  const { rows, page, pageSize, total } = data
235
232
  if (this.isMobile && page > 1) {
@@ -535,7 +535,7 @@ export default {
535
535
  //获取汇总全部数据
536
536
  getAllSummary(data) {
537
537
  const allSummaryConfig = data.reduce((pre, cur) => {
538
- pre[cur.field] = cur.val
538
+ pre[cur.field] = utils.thousandBit(cur.val)
539
539
  return pre
540
540
  }, {})
541
541
  if (Object.keys(allSummaryConfig).length) {
@@ -731,9 +731,14 @@ export default {
731
731
  let manageField = JSON.parse(this.templateInfo.manageField)
732
732
  let this_ = this
733
733
  manageField.forEach((item) => {
734
+ if (item.buttonId) {
735
+ obj[item.buttonId] = true
736
+ }
734
737
  if (item.beforeScriptValue) {
735
738
  let promise = this_.beforeScript(item.beforeScriptValue, item)
736
739
  promise.then((res) => {
740
+ obj[item.buttonId] = res
741
+ //为兼容旧数据(没有buttonId的数据)
737
742
  obj[item.name] = res
738
743
  })
739
744
  }
@@ -1399,6 +1404,10 @@ export default {
1399
1404
  },
1400
1405
  //列表数据查询入口
1401
1406
  search(param, cb, isSearchBtn) {
1407
+ // 如果是高级查询,页码重置为首页
1408
+ if (isSearchBtn) {
1409
+ this.pagination.page = 1
1410
+ }
1402
1411
  let params = {}
1403
1412
  //判断为合并查询还是高级查询
1404
1413
  let showAdvancedSearch = this.$refs.multipleTemplateTable
@@ -1475,7 +1484,7 @@ export default {
1475
1484
  let betweenConditions = {}
1476
1485
  params.pagination.querys.forEach((q) => {
1477
1486
  if (
1478
- q.value &&
1487
+ q.value != undefined &&
1479
1488
  (q.operation != 'BETWEEN' || q.value.constructor == Array)
1480
1489
  ) {
1481
1490
  tempQueryS.push(q)
@@ -1957,10 +1966,11 @@ export default {
1957
1966
  const filterField = utils.parseToJson(this.templateInfo.filteringField)
1958
1967
  temquerys.forEach((q) => {
1959
1968
  let prefix = this.getColPreFix(conditionField, q.property)
1969
+ const queryPre = this.getQueryPre(conditionField, q.property)
1960
1970
  if (!prefix) {
1961
1971
  prefix = this.getColPreFix(filterField, q.property)
1962
1972
  }
1963
- q.property = prefix + q.property
1973
+ q.property = queryPre + prefix + q.property
1964
1974
  querys.push(q)
1965
1975
  })
1966
1976
  }
@@ -2417,18 +2427,50 @@ export default {
2417
2427
  if (type === 'searchResult') {
2418
2428
  this.curSelectParams.queryFilter.querys = this.templateSearchQuery
2419
2429
  }
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 = []
2447
+ }
2448
+ let loadingInstance = Loading.service({
2449
+ fullscreen: true,
2450
+ }) //开始
2420
2451
  this.$requestConfig
2421
2452
  .exportByBtnSetting({
2422
2453
  id: this.templateInfo.id,
2423
2454
  params: this.curSelectParams,
2424
2455
  })
2425
- .then(({ data, headers }) => {
2426
- const fileName = decodeURIComponent(
2427
- headers['content-disposition'].split(';')[1].split('filename=')[1]
2428
- )
2429
- const blob = new Blob([data])
2430
- saveAs(blob, fileName)
2431
- })
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
+ )
2432
2474
  },
2433
2475
  importCommand(params) {
2434
2476
  switch (params.command) {
@@ -2717,6 +2759,13 @@ export default {
2717
2759
  operation: 'EQUAL',
2718
2760
  relation: 'AND',
2719
2761
  },
2762
+ {
2763
+ property: 'bo_alias_',
2764
+ value: this.templateInfo.boDefAlias,
2765
+ group: 'main',
2766
+ operation: 'EQUAL',
2767
+ relation: 'AND',
2768
+ },
2720
2769
  ],
2721
2770
  }
2722
2771
  this.recordTableLoading = true
@@ -3103,6 +3152,10 @@ export default {
3103
3152
  this.getBpmTemplateByPagination(params)
3104
3153
  },
3105
3154
  filterChange(filters) {
3155
+ // 筛选时需重置页面页码
3156
+ if (filters) {
3157
+ this.pagination.page = 1
3158
+ }
3106
3159
  if (filters && Object.keys(filters).length > 0) {
3107
3160
  const key = Object.keys(filters)[0]
3108
3161
  const filter = filters[key]
@@ -3483,7 +3536,10 @@ export default {
3483
3536
  currentRows
3484
3537
  .filter((item) => item[fields] !== undefined && item[fields] !== '')
3485
3538
  .map((item) => Number(item[fields]))
3486
- if (!list || list.length == 0) return
3539
+ if (!list || list.length == 0) {
3540
+ let num = 0
3541
+ return num.toFixed(decimal)
3542
+ }
3487
3543
  const METHOD_MAP = {
3488
3544
  count: 'getCount',
3489
3545
  sum: 'getSum',
@@ -3651,7 +3707,7 @@ export default {
3651
3707
  type: dialogConfig.custDialog,
3652
3708
  }
3653
3709
  obj.custdialog = {
3654
- name: '请选择',
3710
+ name: dialogConfig.name || '请选择',
3655
3711
  custDialog: custdialog,
3656
3712
  resultField: dialogConfig.resultField,
3657
3713
  }
@@ -3727,6 +3783,10 @@ export default {
3727
3783
  type: 'warning',
3728
3784
  })
3729
3785
  .then(() => {
3786
+ let loadingInstance = Loading.service({
3787
+ fullscreen: true,
3788
+ text: '数据更新中...',
3789
+ })
3730
3790
  let selectRows = row
3731
3791
  ? [row]
3732
3792
  : this.tableData.selectRows
@@ -3742,20 +3802,37 @@ export default {
3742
3802
  boData: selectRows,
3743
3803
  boAlias: this.templateInfo.boDefAlias,
3744
3804
  }
3745
- this.$requestConfig.batchUpdateTemplateData(data).then((data) => {
3746
- if (data.state) {
3747
- this.$message({
3748
- type: 'success',
3749
- message: data.message,
3750
- })
3751
- this.search({
3752
- querys: this.buildDefaultQuerys() || [],
3753
- })
3754
- // 更新成功后需执行后置js
3755
- let script = Base64.decode(afterScriptValue)
3756
- this.tempScript(script, row)
3757
- }
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
3836
  })
3760
3837
  .catch(() => {
3761
3838
  this.$message({
@@ -4010,8 +4087,11 @@ export default {
4010
4087
  }
4011
4088
  } else if (btnOk.indexOf(btnAlias) != -1) {
4012
4089
  if (btnAlias == 'switch') {
4090
+ const pkFieldValue =
4091
+ parameter.pkField ||
4092
+ this.getBindValue(row, this.templateInfo.pkField)
4013
4093
  this.switchChange(
4014
- parameter.pkField,
4094
+ pkFieldValue,
4015
4095
  parameter.switchOn,
4016
4096
  parameter.switchOff,
4017
4097
  parameter.bind,