three-trees-ui 1.0.59 → 1.0.60

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.59",
3
+ "version": "1.0.60",
4
4
  "publicPath": "/ui",
5
5
  "author": "hotent",
6
6
  "private": false,
@@ -112,7 +112,7 @@
112
112
  :highlight-current-row="highlightCurrentRow"
113
113
  :row-class-name="rowClassName"
114
114
  :cell-class-name="cellClassName"
115
- :height="`${tableMaxHeight ? tableMaxHeight : 400}`"
115
+ :style="{ height: `${tableMaxHeight ? tableMaxHeight : 400}` + 'px' }"
116
116
  :row-key="rowKey"
117
117
  :show-summary="showSummary"
118
118
  :summary-method="getSummaries"
@@ -1,10 +1,8 @@
1
1
  import SubPagination from '../services/SubPagination.js'
2
- import utils from '../utils.js'
3
2
 
4
3
  export default {
5
4
  data() {
6
5
  return {
7
- searchVal: '', //搜索关键字
8
6
  fillOrg: {},
9
7
  fillOrgConfMap: {},
10
8
  transitionIndex: -1,
@@ -54,287 +52,6 @@ export default {
54
52
  }
55
53
  },
56
54
  methods: {
57
- //合计计算
58
- getSummaries(param, list) {
59
- let CancelTheCalculation = sessionStorage.getItem(
60
- 'Cancel_The_Calculation'
61
- )
62
- ? JSON.parse(sessionStorage.getItem('Cancel_The_Calculation'))
63
- : {}
64
- //
65
- let listChange = JSON.parse(Base64.decode(list, 'utf-8'))
66
-
67
- //
68
-
69
- if (listChange.length < 1) {
70
- return
71
- }
72
- const { columns, data } = param
73
- this.tableData = data
74
- const sums = []
75
- let calcProp = []
76
- let columnsDep = _.cloneDeep(columns)
77
- listChange.forEach((item, idex) => {
78
- if (item.addFunc == 'calcFunc') {
79
- columnsDep.forEach((column, index) => {
80
- if (
81
- item.mathExp &&
82
- item.mathExp.indexOf('.' + column.property) > -1
83
- ) {
84
- calcProp.push(column.property)
85
- }
86
- })
87
- }
88
-
89
- columnsDep.forEach((column, index) => {
90
- if (item.columnField == column.property) {
91
- column.combinedOption = item
92
- }
93
- })
94
- })
95
-
96
- columnsDep.forEach((column, index) => {
97
- if (index === 0 && columnsDep[0].type == 'index') {
98
- sums[index] = ''
99
- return
100
- }
101
- //当有需要才合计
102
- if (column.combinedOption) {
103
- let {
104
- addFunc,
105
- columnField,
106
- name,
107
- unit,
108
- showType,
109
- num,
110
- tag,
111
- mainTarget,
112
- } = column.combinedOption
113
-
114
- let Bol =
115
- tag &&
116
- CancelTheCalculation &&
117
- CancelTheCalculation[tag] &&
118
- CancelTheCalculation[tag].length > 0
119
- const values = data.map((item) => Number(item[column.property]))
120
- let depValues = _.cloneDeep(values)
121
- if (Bol) {
122
- let delMin = []
123
- depValues.forEach((item, i) => {
124
- if (!CancelTheCalculation[tag].includes(i)) {
125
- delMin.push(item)
126
- }
127
- })
128
-
129
- depValues = delMin
130
- }
131
- let units = unit ? unit : ''
132
- //求和
133
- if (addFunc === 'add') {
134
- if (!depValues.every((value) => isNaN(value))) {
135
- sums[index] = depValues.reduce((prev, curr) => {
136
- const value = Number(curr)
137
- if (!isNaN(value)) {
138
- return prev + curr
139
- } else {
140
- return prev
141
- }
142
- }, 0)
143
-
144
- sums[index] = this.dealWithDataHtml(
145
- name,
146
- sums[index],
147
- showType,
148
- num,
149
- units,
150
- mainTarget
151
- )
152
- } else {
153
- sums[index] = this.dealWithDataHtml(
154
- name,
155
- 0,
156
- showType,
157
- num,
158
- units,
159
- mainTarget
160
- )
161
- }
162
- }
163
- //计数
164
- if (addFunc === 'count') {
165
- let numCount = values.length
166
-
167
- if (Bol) {
168
- numCount = values.length - CancelTheCalculation[tag].length
169
- }
170
- sums[index] = this.dealWithDataHtml(
171
- name,
172
- numCount,
173
- showType,
174
- num,
175
- units,
176
- mainTarget
177
- )
178
- }
179
- //平均值
180
- if (addFunc === 'average') {
181
- let sum = 0
182
- var average = 0
183
-
184
- for (var i = 0; i < depValues.length; i++) {
185
- sum += depValues[i]
186
- }
187
-
188
- depValues.length > 0
189
- ? (average = sum / depValues.length)
190
- : (average = 0)
191
-
192
- sums[index] = this.dealWithDataHtml(
193
- name,
194
- average,
195
- showType,
196
- num,
197
- units,
198
- mainTarget
199
- )
200
- }
201
- //最大值
202
- if (addFunc === 'max') {
203
- let maxNum = Math.max.apply(
204
- null,
205
- depValues.length > 0 ? depValues : [0]
206
- )
207
-
208
- sums[index] = this.dealWithDataHtml(
209
- name,
210
- maxNum,
211
- showType,
212
- num,
213
- units,
214
- mainTarget
215
- )
216
- }
217
- //最小值
218
- if (addFunc === 'min') {
219
- let minNum = Math.min.apply(
220
- null,
221
- depValues.length > 0 ? depValues : [0]
222
- )
223
- sums[index] = this.dealWithDataHtml(
224
- name,
225
- minNum,
226
- showType,
227
- num,
228
- units,
229
- mainTarget
230
- )
231
- }
232
-
233
- //公式计算
234
- if (addFunc === 'calcFunc') {
235
- const calcVal = this.dealCustomCalc(data, column.combinedOption)
236
- sums[index] = this.dealWithDataHtml(
237
- name,
238
- calcVal,
239
- showType,
240
- num,
241
- units,
242
- mainTarget
243
- )
244
- }
245
- } else if (calcProp.indexOf(column.property) > -1) {
246
- const values = data.map((item) => Number(item[column.property]))
247
- }
248
- })
249
-
250
- return sums
251
- },
252
- //合计行
253
- handleSummary(summary) {
254
- return summary && !this.searchVal ? true : false
255
- },
256
- dealWithDataHtml(name, type, showType, num, units, mainTarget) {
257
- let { data, monCap } = this.dealWithData(type, showType, num, mainTarget)
258
- if (monCap) {
259
- return name + ':' + data + units + '\n' + monCap
260
- }
261
- return name + ':' + data + units
262
- },
263
- //处理数据
264
- dealWithData(data, showType, numfix = 0, mainTarget) {
265
- data = Number(data)
266
-
267
- let list = showType
268
- let num = {
269
- data: 0,
270
- monCap: '',
271
- }
272
- // 保留小数位
273
- if (list.includes('keepSmall')) {
274
- const fixData = data.toFixedRound(numfix)
275
- num.data = fixData
276
- if (mainTarget) {
277
- mainTarget = !mainTarget.startsWith('data.')
278
- ? 'data.' + mainTarget
279
- : mainTarget
280
- utils.setValueByConfigKey(this, { trget: mainTarget }, 'trget', data)
281
- }
282
- } else {
283
- if (mainTarget && data != null) {
284
- mainTarget = !mainTarget.startsWith('data.')
285
- ? 'data.' + mainTarget
286
- : mainTarget
287
- utils.setValueByConfigKey(
288
- this,
289
- { trget: mainTarget },
290
- 'trget',
291
- data.toFixedRound(4)
292
- )
293
- }
294
- }
295
-
296
- //百分比
297
- if (list.includes('percentage')) {
298
- num.data = Number(data * 100) + '%'
299
- }
300
- // 千分位
301
- if (list.includes('Micrometer')) {
302
- num.data = utils.thousandBit(data)
303
- }
304
- if (
305
- list.includes('keepSmall') &&
306
- list.includes('percentage') &&
307
- list.includes('Micrometer')
308
- ) {
309
- num.data =
310
- utils.thousandBit(Number(data * 100).toFixedRound(numfix)) + '%'
311
-
312
- return num
313
- }
314
- if (list.includes('keepSmall') && list.includes('percentage')) {
315
- num.data = Number(data * 100).toFixedRound(numfix) + '%'
316
-
317
- return num
318
- }
319
- if (list.includes('Micrometer') && list.includes('percentage')) {
320
- num.data = utils.thousandBit(Number(data * 100)) + '%'
321
- return num
322
- }
323
- if (list.includes('keepSmall') && list.includes('Micrometer')) {
324
- num.data = utils.thousandBit(data.toFixedRound(numfix))
325
- }
326
-
327
- // 货币大写
328
- if (list.includes('monCap')) {
329
- num = {
330
- data: data,
331
- monCap: utils.convertCurrency(data),
332
- }
333
- return num
334
- }
335
-
336
- return num
337
- },
338
55
  getExpandArr(data, type) {
339
56
  if (type === 'expand' && data) {
340
57
  let arr = []
@@ -11,7 +11,7 @@ const { saveAs } = require('file-saver')
11
11
  import _ from 'lodash'
12
12
  import { decode } from '@/util/base64'
13
13
 
14
- const req = function (url, data = {}, option = {}) {
14
+ const req = function(url, data = {}, option = {}) {
15
15
  const requestData = {
16
16
  url: url,
17
17
  data: data,
@@ -253,7 +253,7 @@ export default {
253
253
  deep: true,
254
254
  },
255
255
  ents: {
256
- handler: function (newVal, oldValue) {
256
+ handler: function(newVal, oldValue) {
257
257
  if (newVal && newVal.length >= 1 && newVal != oldValue) {
258
258
  this.getSubData(this, this.refId)
259
259
  }
@@ -262,7 +262,7 @@ export default {
262
262
  immediate: true,
263
263
  },
264
264
  templateInfo: {
265
- handler: function (newVal) {
265
+ handler: function(newVal) {
266
266
  if (newVal && newVal.id) {
267
267
  let _me = this
268
268
  _me.templateInfo = newVal
@@ -382,13 +382,13 @@ export default {
382
382
  deep: true,
383
383
  immediate: true,
384
384
  },
385
- currentTabName: function (newVal) {
385
+ currentTabName: function(newVal) {
386
386
  if (newVal) {
387
387
  this.querySubValue = ''
388
388
  }
389
389
  },
390
390
  rows: {
391
- handler: function (newVal) {
391
+ handler: function(newVal) {
392
392
  if (this.templateInfo.defId) {
393
393
  let this_ = this
394
394
  let boAlias = this.templateInfo.boDefAlias
@@ -430,8 +430,9 @@ export default {
430
430
  if (val) {
431
431
  this.$nextTick(() => {
432
432
  if (document.getElementById('summaryDiv')) {
433
- this.summaryTableHeight =
434
- document.getElementById('summaryDiv').clientHeight
433
+ this.summaryTableHeight = document.getElementById(
434
+ 'summaryDiv'
435
+ ).clientHeight
435
436
  }
436
437
  })
437
438
  }
@@ -442,7 +443,7 @@ export default {
442
443
  //如果当前页面被嵌入iframe里面不显示草稿
443
444
  return !this.isJoinFlow
444
445
  },
445
- navbarCollapseStyle: function () {
446
+ navbarCollapseStyle: function() {
446
447
  if (this.asideShow) {
447
448
  return { left: '200px' }
448
449
  }
@@ -481,7 +482,7 @@ export default {
481
482
  })
482
483
  this.handelBindFiledValua()
483
484
  let this_ = this
484
- this.$on('data-reload-success', function () {
485
+ this.$on('data-reload-success', function() {
485
486
  this_.calcScriptBtnPermission()
486
487
  })
487
488
  this.$emit('afterMounted')
@@ -807,7 +808,7 @@ export default {
807
808
  this.listSelectable = false
808
809
  }
809
810
  let _this = this
810
- setTimeout(function () {
811
+ setTimeout(function() {
811
812
  let tdDom = _this.$el.querySelector('td.right_menu')
812
813
  if (
813
814
  !tdDom ||
@@ -912,7 +913,7 @@ export default {
912
913
  selectList[i].selectValue = value
913
914
 
914
915
  //添加监听
915
- pInst.$watch(path, function (newVal, oldVal) {
916
+ pInst.$watch(path, function(newVal, oldVal) {
916
917
  // 监听中使用间隔请求,减少请求次数
917
918
  clearTimeout(this.timeout)
918
919
  this.timeout = setTimeout(() => {
@@ -935,7 +936,7 @@ export default {
935
936
  const value = utils.getValueByPath(pInst, path)
936
937
 
937
938
  bindList[i].fillValue = value
938
- pInst.$watch(path, function (newVal, oldVal) {
939
+ pInst.$watch(path, function(newVal, oldVal) {
939
940
  // 监听中使用间隔请求,减少请求次数
940
941
  clearTimeout(this.timeout)
941
942
  this.timeout = setTimeout(() => {
@@ -1193,7 +1194,7 @@ export default {
1193
1194
  }
1194
1195
  let msg = document.createElement('canvas')
1195
1196
 
1196
- this.$qrcode.toCanvas(msg, QRCodeurl, function (error) {
1197
+ this.$qrcode.toCanvas(msg, QRCodeurl, function(error) {
1197
1198
  console.error(error)
1198
1199
  })
1199
1200
  let _canvas = document.createElement('div')
@@ -1233,7 +1234,7 @@ export default {
1233
1234
  .generateAsync({
1234
1235
  type: 'blob',
1235
1236
  })
1236
- .then(function (content) {
1237
+ .then(function(content) {
1237
1238
  let eleLink = document.createElement('a')
1238
1239
  eleLink.download = '二维码.zip'
1239
1240
  eleLink.style.display = 'none'
@@ -1286,7 +1287,7 @@ export default {
1286
1287
  context.scale(2, 2)
1287
1288
  return html2canvas(document.querySelector(classs), {
1288
1289
  canvas: canvas2,
1289
- }).then(function (canvas) {
1290
+ }).then(function(canvas) {
1290
1291
  resolve(canvas)
1291
1292
  })
1292
1293
  })
@@ -1328,7 +1329,7 @@ export default {
1328
1329
  // Base64.encode(this.$store.state.login.currentUser.account);
1329
1330
  let msg = document.getElementById('QRCode')
1330
1331
 
1331
- this.$qrcode.toCanvas(msg, this.QRCodeurl, function (error) {
1332
+ this.$qrcode.toCanvas(msg, this.QRCodeurl, function(error) {
1332
1333
  console.log(error)
1333
1334
  })
1334
1335
  this.QRCodeShow = true
@@ -1351,13 +1352,13 @@ export default {
1351
1352
  this.rowTemplateId = templateId
1352
1353
  this.rowId = id
1353
1354
  },
1354
- handleSizeChange: function (size) {
1355
+ handleSizeChange: function(size) {
1355
1356
  //每页下拉显示数据
1356
1357
  this.pagination.page = 1
1357
1358
  this.pagination.pageSize = size
1358
1359
  this.$refs.multipleTemplateTable.handleFilterChange()
1359
1360
  },
1360
- handleCurrentChange: function (currentPage) {
1361
+ handleCurrentChange: function(currentPage) {
1361
1362
  //点击第几页
1362
1363
  this.pagination.page = currentPage
1363
1364
  this.$refs.multipleTemplateTable.handleFilterChange()
@@ -1876,10 +1877,18 @@ export default {
1876
1877
  ? operationType[operation]
1877
1878
  : operation
1878
1879
  } else if (
1879
- typeof $(searchItems[i]).children().attr('ht-query') != 'undefined'
1880
+ typeof $(searchItems[i])
1881
+ .children()
1882
+ .attr('ht-query') != 'undefined'
1880
1883
  ) {
1881
- operation = $(searchItems[i]).children().attr('operation')
1882
- operationMap[$(searchItems[i]).children().attr('ht-query')] =
1884
+ operation = $(searchItems[i])
1885
+ .children()
1886
+ .attr('operation')
1887
+ operationMap[
1888
+ $(searchItems[i])
1889
+ .children()
1890
+ .attr('ht-query')
1891
+ ] =
1883
1892
  typeof operationType[operation] != 'undefined'
1884
1893
  ? operationType[operation]
1885
1894
  : operation
@@ -1905,10 +1914,18 @@ export default {
1905
1914
  ? operationType[operation]
1906
1915
  : operation
1907
1916
  } else if (
1908
- typeof $(searchItems[i]).children().attr('ht-query') != 'undefined'
1917
+ typeof $(searchItems[i])
1918
+ .children()
1919
+ .attr('ht-query') != 'undefined'
1909
1920
  ) {
1910
- operation = $(searchItems[i]).children().attr('type')
1911
- operationMap[$(searchItems[i]).children().attr('ht-query')] =
1921
+ operation = $(searchItems[i])
1922
+ .children()
1923
+ .attr('type')
1924
+ operationMap[
1925
+ $(searchItems[i])
1926
+ .children()
1927
+ .attr('ht-query')
1928
+ ] =
1912
1929
  typeof operationType[operation] != 'undefined'
1913
1930
  ? operationType[operation]
1914
1931
  : operation
@@ -1931,12 +1948,19 @@ export default {
1931
1948
  ? true
1932
1949
  : false
1933
1950
  } else if (
1934
- typeof $(searchItems[i]).children().attr('ht-query') != 'undefined'
1951
+ typeof $(searchItems[i])
1952
+ .children()
1953
+ .attr('ht-query') != 'undefined'
1935
1954
  ) {
1936
1955
  //查询条件字段
1937
- fieldQueryMap[$(searchItems[i]).children().attr('ht-query')] =
1938
- typeof $(searchItems[i]).children().attr('special-query') !=
1939
- 'undefined'
1956
+ fieldQueryMap[
1957
+ $(searchItems[i])
1958
+ .children()
1959
+ .attr('ht-query')
1960
+ ] =
1961
+ typeof $(searchItems[i])
1962
+ .children()
1963
+ .attr('special-query') != 'undefined'
1940
1964
  ? true
1941
1965
  : false
1942
1966
  }
@@ -2004,7 +2028,7 @@ export default {
2004
2028
  }
2005
2029
  },
2006
2030
  //回车查询
2007
- searchEnterFun: function (e) {
2031
+ searchEnterFun: function(e) {
2008
2032
  let keyCode = window.event ? e.keyCode : e.which
2009
2033
  if (keyCode == 13) {
2010
2034
  this.search()
@@ -4079,8 +4103,7 @@ export default {
4079
4103
  this.printDetail(parameter.templateId, parameter.id, parameter.action)
4080
4104
  } else if (btnAlias == 'sub' && this.checkSelect()) {
4081
4105
  this.showSubList(this.tableData.selectRows[0].id_, parameter)
4082
- } else if (btnAlias == 'js') {
4083
- if (parameter.needValidateSelect && !this.checkSelect()) return
4106
+ } else if (btnAlias == 'js' && this.checkSelect()) {
4084
4107
  this.customEvilJS(this.tableData.selectRows[0], parameter.jsValue)
4085
4108
  } else if (
4086
4109
  btnAlias == 'startFlow' &&
package/src/utils.js CHANGED
@@ -955,7 +955,7 @@ var utils = {
955
955
  }
956
956
  const keyPath = config[key]
957
957
  // 获取当前组件所在的表单
958
- const formInst = utils.getOnlineFormInstance(inst)
958
+ const formInst = utils.getOnlineFormInstance(inst.$parent)
959
959
  // 获取当前组件是否在子表中的某一行
960
960
  const { subScopeEl, index, subname } = utils.getSubScopeElAndIndex(inst.$el)
961
961
  if (subScopeEl) {
@@ -1256,35 +1256,4 @@ Date.prototype.format = function(format) {
1256
1256
  return format
1257
1257
  }
1258
1258
 
1259
- //精确四舍五入
1260
- Number.prototype.toFixedRound = function(d) {
1261
- d = Number(d)
1262
- var s = this + ''
1263
- if (!d) d = 0
1264
- if (s.indexOf('.') == -1) s += '.'
1265
- s += new Array(d + 1).join('0')
1266
- if (new RegExp('^(-|\\+)?(\\d+(\\.\\d{0,' + (d + 1) + '})?)\\d*$').test(s)) {
1267
- var s = '0' + RegExp.$2,
1268
- pm = RegExp.$1,
1269
- a = RegExp.$3.length,
1270
- b = true
1271
- if (a == d + 2) {
1272
- a = s.match(/\d/g)
1273
- if (parseInt(a[a.length - 1]) > 4) {
1274
- for (var i = a.length - 2; i >= 0; i--) {
1275
- a[i] = parseInt(a[i]) + 1
1276
- if (a[i] == 10) {
1277
- a[i] = 0
1278
- b = i != 1
1279
- } else break
1280
- }
1281
- }
1282
- s = a.join('').replace(new RegExp('(\\d+)(\\d{' + d + '})\\d$'), '$1.$2')
1283
- }
1284
- if (b) s = s.substr(1)
1285
- return (pm + s).replace(/\.$/, '')
1286
- }
1287
- return this + ''
1288
- }
1289
-
1290
1259
  export default utils