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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-trees-ui",
3
- "version": "1.0.31",
3
+ "version": "1.0.32",
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] = ''
686
+ obj[ele.field] = ele.regularValue || ''
687
687
  queryParams.push(obj)
688
688
  // queryParams[ele.field] = "";
689
689
  this_.conditionBind.push(ele)
@@ -1122,6 +1122,11 @@
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
+ }
1125
1130
  // 日期范围特殊处理
1126
1131
  if (item.dbType == 'date' && item.condition == 'BETWEEN') {
1127
1132
  if (
@@ -2109,10 +2114,8 @@
2109
2114
  height: 90%;
2110
2115
  min-height: 400px;
2111
2116
  }
2112
- @media (max-height: 960px) {
2113
- .el-dialog__body .el-container {
2114
- height: 100% !important;
2115
- }
2117
+ .el-dialog__body .el-container {
2118
+ height: 100% !important;
2116
2119
  }
2117
2120
  .el-divider--vertical {
2118
2121
  height: 100%;
@@ -2,6 +2,12 @@
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>
5
11
  <iframe
6
12
  v-else
7
13
  id="myNormframe"
@@ -54,6 +60,7 @@
54
60
  return {
55
61
  dataSrc: null,
56
62
  loading: false,
63
+ contentType: '',
57
64
  }
58
65
  },
59
66
  mounted() {
@@ -71,7 +78,7 @@
71
78
  .then((response) => {
72
79
  const { data, headers } = response
73
80
  const type = headers['content-type']
74
-
81
+ this.contentType = type
75
82
  if (type) {
76
83
  if (window.navigator && window.navigator.msSaveBlob) {
77
84
  //使用Blob构造函数可以直接在客户端上创建和操作Blob。msSaveBlob:只提供一个保存按钮
@@ -109,12 +116,12 @@
109
116
  return
110
117
  }
111
118
  if (iframe.attachEvent) {
112
- iframe.attachEvent('onload', function () {
119
+ iframe.attachEvent('onload', function() {
113
120
  that.setFrameBody(this.contentWindow.document)
114
121
  that.watermarkRender()
115
122
  })
116
123
  } else {
117
- iframe.onload = function () {
124
+ iframe.onload = function() {
118
125
  that.setFrameBody(this.contentWindow.document)
119
126
  that.watermarkRender()
120
127
  }
@@ -144,7 +151,8 @@
144
151
  height: 100%;
145
152
  }
146
153
 
147
- .frame-viewer__iframe {
154
+ .frame-viewer__iframe,
155
+ .frame-viewer__img {
148
156
  width: 100%;
149
157
  height: 100%;
150
158
  border: 0;
@@ -153,5 +161,10 @@
153
161
  height: auto;
154
162
  }
155
163
  }
164
+ .frame-viewer__img {
165
+ display: flex;
166
+ align-items: center;
167
+ justify-content: center;
168
+ }
156
169
  }
157
170
  </style>
@@ -33,14 +33,14 @@
33
33
  { id: '3', name: '我的所有部门' },
34
34
  { id: '4', name: '我的所有部门及下属部门' },
35
35
  ],
36
- currentPolicy: '',
36
+ currentPolicy: '1',
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 = ''
43
+ this.currentPolicy = '1'
44
44
  }
45
45
  },
46
46
  currentPolicy: function(newVal, oldVal) {
@@ -49,6 +49,9 @@
49
49
  }
50
50
  },
51
51
  },
52
+ mounted() {
53
+ this.loadUserWithPolicy(this.currentPolicy)
54
+ },
52
55
  methods: {
53
56
  // 按照指定策略加载数据
54
57
  loadUserWithPolicy(policy) {
@@ -61,7 +64,7 @@
61
64
  this.$message.error(
62
65
  '未获取到当前用户的部门信息,无法按照该策略加载数据。'
63
66
  )
64
- this.currentPolicy = ''
67
+ this.currentPolicy = '1'
65
68
  })
66
69
  },
67
70
  // 根据策略构建不同的查询参数
@@ -218,7 +218,7 @@
218
218
  data() {
219
219
  return {
220
220
  dialogVisible: false,
221
- activeRange: 'contact',
221
+ activeRange: 'policy',
222
222
  searchWord: null,
223
223
  loading: false,
224
224
  }
@@ -18,63 +18,128 @@
18
18
  @click="handleDialogClose"
19
19
  />
20
20
  </template>
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)"
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"
42
40
  >
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>
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>
61
78
  </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>
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>
71
136
  </div>
72
- </div>
73
- </div>
74
- </van-cell>
75
- </van-checkbox-group>
76
- </van-list>
77
- </van-pull-refresh>
137
+ </van-cell>
138
+ </van-checkbox-group>
139
+ </van-list>
140
+ </van-pull-refresh>
141
+ </van-tab>
142
+ </van-tabs>
78
143
  </van-action-sheet>
79
144
  </template>
80
145
  <script>
@@ -141,6 +206,8 @@
141
206
  selectIds: [],
142
207
  selectedData: [],
143
208
  finished: false,
209
+ activeGroupVal: 'myDep',
210
+ querys: [],
144
211
  }
145
212
  },
146
213
  computed: {
@@ -169,6 +236,9 @@
169
236
  }
170
237
  },
171
238
  },
239
+ mounted() {
240
+ this.getOrgId()
241
+ },
172
242
  methods: {
173
243
  onSearchInput: debounce(function() {
174
244
  this.onRefresh()
@@ -233,6 +303,30 @@
233
303
  }
234
304
  this.$emit('row-click', row, column, event)
235
305
  },
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
+ },
236
330
  },
237
331
  }
238
332
  </script>
@@ -321,7 +415,8 @@
321
415
  }
322
416
 
323
417
  .user-data__list {
324
- min-height: 400px;
418
+ max-height: 400px;
419
+ overflow: auto;
325
420
  }
326
421
  .van-action-sheet__cancel {
327
422
  padding: 5px;
@@ -34,7 +34,7 @@
34
34
  <i
35
35
  v-if="inputWriteable"
36
36
  class="el-tag__close el-icon-close"
37
- @click="handleRemove(item)"
37
+ @click.stop="handleRemove(item)"
38
38
  ></i>
39
39
  </span>
40
40
  <template v-if="!selectors.length && value">
@@ -48,7 +48,7 @@
48
48
  <i
49
49
  v-if="inputWriteable"
50
50
  class="el-tag__close el-icon-close"
51
- @click="handleRemoveText(index)"
51
+ @click.stop="handleRemoveText(index)"
52
52
  ></i>
53
53
  </span>
54
54
  </template>
@@ -123,6 +123,7 @@
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)"
126
127
  />
127
128
  </div>
128
129
  </template>
@@ -38,6 +38,7 @@
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 || [])"
41
42
  ></ht-user-selector>
42
43
  </div>
43
44
  </template>
@@ -92,6 +93,7 @@
92
93
  total: 0,
93
94
  showTotal: true,
94
95
  },
96
+ customQuerys: [],
95
97
  }
96
98
  },
97
99
  mounted() {
@@ -227,6 +229,7 @@
227
229
  },
228
230
  // 加载全部用户
229
231
  loadAllUser(param) {
232
+ param.querys = [...param.querys, ...this.customQuerys]
230
233
  this.$requestConfig.getUserList(param).then((data) => {
231
234
  const { rows, page, pageSize, total } = data
232
235
  if (this.isMobile && page > 1) {
@@ -2,6 +2,8 @@ import { Loading } from 'element-ui'
2
2
  import utils from 'three-trees-ui/src/utils.js'
3
3
  const { Base64 } = require('js-base64')
4
4
  const { saveAs } = require('file-saver')
5
+ import { decode } from '@/util/base64'
6
+
5
7
  import Vue from 'vue'
6
8
  import $ from 'jquery'
7
9
  import _ from 'lodash'
@@ -49,12 +51,12 @@ export default {
49
51
  }
50
52
  },
51
53
  watch: {
52
- formKey: function (newVal) {
54
+ formKey: function(newVal) {
53
55
  if (newVal) {
54
56
  this.init()
55
57
  }
56
58
  },
57
- 'tableData.selectRows': function (newVal) {
59
+ 'tableData.selectRows': function(newVal) {
58
60
  if (newVal.length > 0) {
59
61
  let me_ = this
60
62
  me_.uploadParams.id = []
@@ -83,10 +85,10 @@ export default {
83
85
  handler(newVal) {
84
86
  if (newVal.shows) {
85
87
  let displayField = utils.parseToJson(newVal.shows)
86
- let buttonsts = utils.parseToJson(newVal.buttons);
88
+ let buttonsts = utils.parseToJson(newVal.buttons)
87
89
  console.log(buttonsts)
88
- if(buttonsts[0].isdefault == "1"){
89
- this.isdefaultQuery = false
90
+ if (buttonsts[0].isdefault == '1') {
91
+ this.isdefaultQuery = false
90
92
  }
91
93
  for (var i = 0; i < displayField.length; i++) {
92
94
  if (displayField[i].hidden == 0) {
@@ -247,7 +249,7 @@ export default {
247
249
  this.$router.push(url)
248
250
  },
249
251
 
250
- handleSizeChange: function (size) {
252
+ handleSizeChange: function(size) {
251
253
  //每页下拉显示数据
252
254
  this.pagination.pageSize = size
253
255
  if (this.$refs.queryViewList) {
@@ -256,7 +258,7 @@ export default {
256
258
  this.search()
257
259
  }
258
260
  },
259
- handleCurrentChange: function (currentPage) {
261
+ handleCurrentChange: function(currentPage) {
260
262
  //点击第几页
261
263
  this.pagination.page = currentPage
262
264
  if (this.$refs.queryViewList) {
@@ -266,7 +268,7 @@ export default {
266
268
  }
267
269
  },
268
270
  //回车查询
269
- searchEnterFun: function (e) {
271
+ searchEnterFun: function(e) {
270
272
  let keyCode = window.event ? e.keyCode : e.which
271
273
  if (keyCode == 13) {
272
274
  this.pagination.page = 1
@@ -419,11 +421,19 @@ export default {
419
421
  ? operationType[operation]
420
422
  : operation
421
423
  } else if (
422
- typeof $(searchItems[i]).children().attr('ht-query') != 'undefined'
424
+ typeof $(searchItems[i])
425
+ .children()
426
+ .attr('ht-query') != 'undefined'
423
427
  ) {
424
428
  //查询条件类型
425
- operation = $(searchItems[i]).children().attr('operation')
426
- operationMap[$(searchItems[i]).children().attr('ht-query')] =
429
+ operation = $(searchItems[i])
430
+ .children()
431
+ .attr('operation')
432
+ operationMap[
433
+ $(searchItems[i])
434
+ .children()
435
+ .attr('ht-query')
436
+ ] =
427
437
  typeof operationType[operation] != 'undefined'
428
438
  ? operationType[operation]
429
439
  : operation
@@ -445,12 +455,16 @@ export default {
445
455
  searchItems[i]
446
456
  ).attr('field-query')
447
457
  } else if (
448
- typeof $(searchItems[i]).children().attr('ht-query') != 'undefined'
458
+ typeof $(searchItems[i])
459
+ .children()
460
+ .attr('ht-query') != 'undefined'
449
461
  ) {
450
462
  //查询条件字段
451
- fieldQueryMap[$(searchItems[i]).children().attr('ht-query')] = $(
452
- searchItems[i]
453
- )
463
+ fieldQueryMap[
464
+ $(searchItems[i])
465
+ .children()
466
+ .attr('ht-query')
467
+ ] = $(searchItems[i])
454
468
  .children()
455
469
  .attr('field-query')
456
470
  }
@@ -472,12 +486,19 @@ export default {
472
486
  ? true
473
487
  : false
474
488
  } else if (
475
- typeof $(searchItems[i]).children().attr('ht-query') != 'undefined'
489
+ typeof $(searchItems[i])
490
+ .children()
491
+ .attr('ht-query') != 'undefined'
476
492
  ) {
477
493
  //查询条件字段
478
- fieldQueryMap[$(searchItems[i]).children().attr('ht-query')] =
479
- typeof $(searchItems[i]).children().attr('special-query') !=
480
- 'undefined'
494
+ fieldQueryMap[
495
+ $(searchItems[i])
496
+ .children()
497
+ .attr('ht-query')
498
+ ] =
499
+ typeof $(searchItems[i])
500
+ .children()
501
+ .attr('special-query') != 'undefined'
481
502
  ? true
482
503
  : false
483
504
  }
@@ -559,14 +580,16 @@ export default {
559
580
  },
560
581
  //点击导出按钮
561
582
  exports() {
562
- if(this.isdefaultQuery){
583
+ if (this.isdefaultQuery) {
563
584
  this.dialogExportVisible = true
564
- }else{
565
- this.exportData.expField= JSON.parse(JSON.stringify(this.displayFields))
566
- console.log(this.exportData)
585
+ } else {
586
+ // 增加导出字段限制
587
+ const checkField = this.getCheckField().map((item) => item.value)
588
+ this.exportData.expField = this.displayFields.filter((item) =>
589
+ checkField.includes(item.fieldName)
590
+ )
567
591
  this.submitExport()
568
592
  }
569
-
570
593
  },
571
594
  punchOrder() {
572
595
  this.$store
@@ -861,5 +884,19 @@ export default {
861
884
  showSearchPane() {
862
885
  return true
863
886
  },
887
+ getCheckField() {
888
+ let customColumns = this.$refs.queryViewList.customColumns || []
889
+ let customColumnSetting = JSON.parse(
890
+ localStorage.getItem('customColumnSetting') || '{}'
891
+ )
892
+ const keys = customColumns.reduce((m, n) => m.concat(n.key), [])
893
+ const customColumnsHashCode = utils.hashCode(keys.join(','))
894
+ const checkField = JSON.parse(
895
+ decode(customColumnSetting[customColumnsHashCode]) || '[]'
896
+ )
897
+ return checkField.filter(
898
+ (field) => field.checked && ['序号', '操作'].indexOf(field.value) == -1
899
+ )
900
+ },
864
901
  },
865
902
  }