three-trees-ui 1.0.45 → 1.0.47

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.45",
3
+ "version": "1.0.47",
4
4
  "publicPath": "/ui",
5
5
  "author": "hotent",
6
6
  "private": false,
@@ -18,7 +18,7 @@
18
18
  type="text"
19
19
  :permission="permission_sub"
20
20
  >
21
- <template v-if="inputWriteable" slot="append">
21
+ <template v-if="comWriteable" slot="append">
22
22
  <el-button
23
23
  btn="btn"
24
24
  :size="inputSize"
@@ -32,7 +32,7 @@
32
32
  </ht-input>
33
33
  <el-button
34
34
  v-else
35
- :disabled="!inputWriteable"
35
+ :disabled="!comWriteable"
36
36
  btn="btn"
37
37
  :size="inputSize"
38
38
  type="primary"
@@ -57,6 +57,11 @@
57
57
  icon: String,
58
58
  btnName: String,
59
59
  isShowInput: Boolean,
60
+ statusAndAvailable: {
61
+ //表单查看状态下是否可用
62
+ type: Boolean,
63
+ default: false,
64
+ },
60
65
  },
61
66
  computed: {
62
67
  inputVal: {
@@ -67,6 +72,13 @@
67
72
  this.$emit('input', val)
68
73
  },
69
74
  },
75
+ comWriteable() {
76
+ if (this.statusAndAvailable) {
77
+ return this.statusAndAvailable
78
+ } else {
79
+ return this.inputWriteable
80
+ }
81
+ },
70
82
  },
71
83
  methods: {
72
84
  customEvilJS() {
@@ -229,7 +229,7 @@
229
229
  >
230
230
  <ht-custom-dialog
231
231
  v-model="queryParams[index][condition.field]"
232
- :model-name="condition.config.keyBind"
232
+ :model-name="condition.config.valueBind"
233
233
  dialogType="search"
234
234
  :custdialog="{
235
235
  name: '请选择',
@@ -1684,8 +1684,9 @@
1684
1684
  // 如果是查询中使用的对话框
1685
1685
  if (this.dialogType == 'search') {
1686
1686
  let returnVal = []
1687
+ let from = this.modelName.toLowerCase()
1687
1688
  str.forEach((item) => {
1688
- returnVal.push(decodeURIComponent(item[this.modelName]))
1689
+ returnVal.push(decodeURIComponent(item[from]))
1689
1690
  })
1690
1691
  this.$emit('updateInput', returnVal.join(','))
1691
1692
  return
@@ -121,7 +121,7 @@
121
121
  type: {
122
122
  type: String,
123
123
  default: 'table',
124
- validator: function(value) {
124
+ validator: function (value) {
125
125
  return ['table', 'list', 'card'].indexOf(value) !== -1
126
126
  },
127
127
  },
@@ -230,7 +230,7 @@
230
230
  }
231
231
  },
232
232
  computed: {
233
- typeVal: function() {
233
+ typeVal: function () {
234
234
  return this.isSimple || this.simplicity ? 'list' : this.type
235
235
  },
236
236
  inputsContainerWidth() {
@@ -238,7 +238,7 @@
238
238
  ? { width: 'auto' }
239
239
  : {}
240
240
  },
241
- actionUrlVal: function() {
241
+ actionUrlVal: function () {
242
242
  return this.actionUrl
243
243
  ? this.actionUrl
244
244
  : this.$requestConfig.uploadUrl
@@ -262,14 +262,14 @@
262
262
  }
263
263
  return baseUrl
264
264
  },
265
- headerVal: function() {
265
+ headerVal: function () {
266
266
  return this.header
267
267
  ? this.header
268
268
  : this.$requestConfig.header
269
269
  ? this.$requestConfig.header()
270
270
  : null
271
271
  },
272
- acceptType: function() {
272
+ acceptType: function () {
273
273
  if (this.accept) {
274
274
  const ary = []
275
275
  this.accept.split(',').forEach((m) => {
@@ -283,10 +283,10 @@
283
283
  }
284
284
  return null
285
285
  },
286
- previewableVal: function() {
286
+ previewableVal: function () {
287
287
  return (this.inputWriteable && this.previewable) || this.allowPreview
288
288
  },
289
- downloadableVal: function() {
289
+ downloadableVal: function () {
290
290
  return (this.inputWriteable && this.downloadable) || this.allowDownload
291
291
  },
292
292
  },
@@ -472,7 +472,13 @@
472
472
  if (this.previewableVal) {
473
473
  // 当前组件未添加preview事件监听 并且 设置了全局预览方法
474
474
  if (!this._events.preview && this.$preview) {
475
- this.$preview(file)
475
+ if (this.isMobile) {
476
+ this.$preview(file)
477
+ } else {
478
+ let token = this.$requestConfig.getToken().replace('Bearer ', '')
479
+ let url = `${window.context.front}/previewFile/${file.response.fileId}/${file.response.fileName}?token=${token}`
480
+ window.open(url, '_blank')
481
+ }
476
482
  } else {
477
483
  this.$emit('preview', file, this.inputVal)
478
484
  }
@@ -164,14 +164,14 @@
164
164
  }
165
165
  },
166
166
  computed: {
167
- headerVal: function() {
167
+ headerVal: function () {
168
168
  return this.headers
169
169
  ? this.headers
170
170
  : this.$requestConfig.header
171
171
  ? this.$requestConfig.header()
172
172
  : null
173
173
  },
174
- titleVal: function() {
174
+ titleVal: function () {
175
175
  return this.tempTitle ? this.tempTitle : this.title
176
176
  },
177
177
  },
@@ -180,6 +180,7 @@
180
180
  this.src = null
181
181
  this.mode = null
182
182
  this.errorMessage = null
183
+ this.$emit('handleClosePreview')
183
184
  },
184
185
  handlePreviewErr(err) {
185
186
  this.errorMessage = `预览失败:${err}`
@@ -145,7 +145,7 @@
145
145
  },
146
146
  },
147
147
  watch: {
148
- templateKey: function (n, o) {
148
+ templateKey: function(n, o) {
149
149
  if (n && o && n != o) {
150
150
  this.init()
151
151
  }
@@ -201,8 +201,9 @@
201
201
  printDetail() {
202
202
  this.$refs.btnRegion.style.display = 'none'
203
203
  setTimeout(() => {
204
- document.body.innerHTML =
205
- document.getElementsByClassName('custom-form')[0].innerHTML
204
+ document.body.innerHTML = document.getElementsByClassName(
205
+ 'custom-form'
206
+ )[0].innerHTML
206
207
  window.print()
207
208
  this.$refs.btnRegion.style.display = 'block'
208
209
  location.reload()
@@ -255,9 +256,6 @@
255
256
  .then((result) => {
256
257
  if (result.state) {
257
258
  if (this.closeSave) {
258
- if (this.isMobile) {
259
- this.$notify({ type: 'success', message: result.message })
260
- }
261
259
  this.close()
262
260
  return
263
261
  }
@@ -288,10 +286,7 @@
288
286
  this.disabled = false
289
287
  }
290
288
  })
291
- .catch((err) => {
292
- if (this.isMobile) {
293
- this.$notify.error(err)
294
- }
289
+ .catch(() => {
295
290
  this.disabled = false
296
291
  })
297
292
  })
@@ -310,7 +310,7 @@ const Formulas = {
310
310
  let num = 0
311
311
  args.forEach((item) => {
312
312
  item = Formulas.parseNumber(item)
313
- num += item
313
+ num = Formulas.floatAdd(num, item)
314
314
  })
315
315
  return num
316
316
  },
@@ -693,6 +693,137 @@ const Formulas = {
693
693
  }
694
694
  return new Date(Date.parse(str.replace(/-/g, '/')))
695
695
  },
696
+ //格式化
697
+ toNonExponential(num) {
698
+ if (num == null) {
699
+ return num
700
+ }
701
+ if (typeof num == 'number') {
702
+ var m = num.toExponential().match(/\d(?:\.(\d*))?e([+-]\d+)/)
703
+ return num.toFixed(Math.max(0, (m[1] || '').length - m[2]))
704
+ } else {
705
+ return num
706
+ }
707
+ },
708
+ // 加
709
+ floatAdd(arg1, arg2) {
710
+ arg1 = Number(arg1) || 0
711
+ arg2 = Number(arg2) || 0
712
+ arg1 = Formulas.toNonExponential(arg1)
713
+ arg2 = Formulas.toNonExponential(arg2)
714
+ var r1, r2, m
715
+ try {
716
+ r1 = arg1.toString().split('.')[1].length
717
+ } catch (e) {
718
+ r1 = 0
719
+ }
720
+ try {
721
+ r2 = arg2.toString().split('.')[1].length
722
+ } catch (e) {
723
+ r2 = 0
724
+ }
725
+ m = Math.pow(10, Math.max(r1, r2))
726
+ return (
727
+ (Formulas.floatMultiply(arg1, m) + Formulas.floatMultiply(arg2, m)) / m
728
+ )
729
+ },
730
+ // 减
731
+ floatSub(arg1, arg2) {
732
+ arg1 = Number(arg1) || 0
733
+ arg2 = Number(arg2) || 0
734
+ arg1 = Formulas.toNonExponential(arg1)
735
+ arg2 = Formulas.toNonExponential(arg2)
736
+ var r1, r2, m, n
737
+ try {
738
+ r1 = arg1.toString().split('.')[1].length
739
+ } catch (e) {
740
+ r1 = 0
741
+ }
742
+ try {
743
+ r2 = arg2.toString().split('.')[1].length
744
+ } catch (e) {
745
+ r2 = 0
746
+ }
747
+ m = Math.pow(10, Math.max(r1, r2))
748
+ // 动态控制精度长度
749
+ n = r1 >= r2 ? r1 : r2
750
+ return (
751
+ (Formulas.floatMultiply(arg1, m) - Formulas.floatMultiply(arg2, m)) /
752
+ m
753
+ ).toFixed(n)
754
+ },
755
+ //乘
756
+ floatMultiply(arg1, arg2) {
757
+ arg1 = Number(arg1)
758
+ arg2 = Number(arg2)
759
+ if ((!arg1 && arg1 !== 0) || (!arg2 && arg2 !== 0)) {
760
+ return null
761
+ }
762
+ arg1 = Formulas.toNonExponential(arg1)
763
+ arg2 = Formulas.toNonExponential(arg2)
764
+ var n1, n2
765
+ var r1, r2 // 小数位数
766
+ try {
767
+ r1 = arg1.toString().split('.')[1].length
768
+ } catch (e) {
769
+ r1 = 0
770
+ }
771
+ try {
772
+ r2 = arg2.toString().split('.')[1].length
773
+ } catch (e) {
774
+ r2 = 0
775
+ }
776
+ n1 = Number(arg1.toString().replace('.', ''))
777
+ n2 = Number(arg2.toString().replace('.', ''))
778
+ return (n1 * n2) / Math.pow(10, r1 + r2)
779
+ },
780
+ //除
781
+ floatDivide(arg1, arg2) {
782
+ arg1 = Number(arg1)
783
+ arg2 = Number(arg2)
784
+ if (!arg2) {
785
+ return null
786
+ }
787
+ if (!arg1 && arg1 !== 0) {
788
+ return null
789
+ } else if (arg1 === 0) {
790
+ return 0
791
+ }
792
+ arg1 = Formulas.toNonExponential(arg1)
793
+ arg2 = Formulas.toNonExponential(arg2)
794
+ var n1, n2
795
+ var r1, r2 // 小数位数
796
+ try {
797
+ r1 = arg1.toString().split('.')[1].length
798
+ } catch (e) {
799
+ r1 = 0
800
+ }
801
+ try {
802
+ r2 = arg2.toString().split('.')[1].length
803
+ } catch (e) {
804
+ r2 = 0
805
+ }
806
+ n1 = Number(arg1.toString().replace('.', ''))
807
+ n2 = Number(arg2.toString().replace('.', ''))
808
+ return Formulas.floatMultiply(n1 / n2, Math.pow(10, r2 - r1))
809
+ },
810
+ //余
811
+ floatMod(arg1, arg2) {
812
+ arg1 = Number(arg1)
813
+ arg2 = Number(arg2)
814
+ if (!arg2) {
815
+ return null
816
+ }
817
+ if (!arg1 && arg1 !== 0) {
818
+ return null
819
+ } else if (arg1 === 0) {
820
+ return 0
821
+ }
822
+ let intNum = arg1 / arg2
823
+ intNum = intNum < 0 ? Math.ceil(arg1 / arg2) : Math.floor(arg1 / arg2) // -1.02 取整为 -1; 1.02取整为1
824
+ let intVal = Formulas.floatMultiply(intNum, arg2)
825
+ return Formulas.floatSub(arg1, intVal)
826
+ },
696
827
  getArrayByPath(obj) {
697
828
  let array = []
698
829
  if (!obj.data) return array
@@ -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,
@@ -251,7 +251,7 @@ export default {
251
251
  deep: true,
252
252
  },
253
253
  ents: {
254
- handler: function (newVal, oldValue) {
254
+ handler: function(newVal, oldValue) {
255
255
  if (newVal && newVal.length >= 1 && newVal != oldValue) {
256
256
  this.getSubData(this, this.refId)
257
257
  }
@@ -260,7 +260,7 @@ export default {
260
260
  immediate: true,
261
261
  },
262
262
  templateInfo: {
263
- handler: function (newVal) {
263
+ handler: function(newVal) {
264
264
  if (newVal && newVal.id) {
265
265
  let _me = this
266
266
  _me.templateInfo = newVal
@@ -380,13 +380,13 @@ export default {
380
380
  deep: true,
381
381
  immediate: true,
382
382
  },
383
- currentTabName: function (newVal) {
383
+ currentTabName: function(newVal) {
384
384
  if (newVal) {
385
385
  this.querySubValue = ''
386
386
  }
387
387
  },
388
388
  rows: {
389
- handler: function (newVal) {
389
+ handler: function(newVal) {
390
390
  if (this.templateInfo.defId) {
391
391
  let this_ = this
392
392
  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()
@@ -1859,10 +1860,18 @@ export default {
1859
1860
  ? operationType[operation]
1860
1861
  : operation
1861
1862
  } else if (
1862
- typeof $(searchItems[i]).children().attr('ht-query') != 'undefined'
1863
+ typeof $(searchItems[i])
1864
+ .children()
1865
+ .attr('ht-query') != 'undefined'
1863
1866
  ) {
1864
- operation = $(searchItems[i]).children().attr('operation')
1865
- operationMap[$(searchItems[i]).children().attr('ht-query')] =
1867
+ operation = $(searchItems[i])
1868
+ .children()
1869
+ .attr('operation')
1870
+ operationMap[
1871
+ $(searchItems[i])
1872
+ .children()
1873
+ .attr('ht-query')
1874
+ ] =
1866
1875
  typeof operationType[operation] != 'undefined'
1867
1876
  ? operationType[operation]
1868
1877
  : operation
@@ -1888,10 +1897,18 @@ export default {
1888
1897
  ? operationType[operation]
1889
1898
  : operation
1890
1899
  } else if (
1891
- typeof $(searchItems[i]).children().attr('ht-query') != 'undefined'
1900
+ typeof $(searchItems[i])
1901
+ .children()
1902
+ .attr('ht-query') != 'undefined'
1892
1903
  ) {
1893
- operation = $(searchItems[i]).children().attr('type')
1894
- operationMap[$(searchItems[i]).children().attr('ht-query')] =
1904
+ operation = $(searchItems[i])
1905
+ .children()
1906
+ .attr('type')
1907
+ operationMap[
1908
+ $(searchItems[i])
1909
+ .children()
1910
+ .attr('ht-query')
1911
+ ] =
1895
1912
  typeof operationType[operation] != 'undefined'
1896
1913
  ? operationType[operation]
1897
1914
  : operation
@@ -1914,12 +1931,19 @@ export default {
1914
1931
  ? true
1915
1932
  : false
1916
1933
  } else if (
1917
- typeof $(searchItems[i]).children().attr('ht-query') != 'undefined'
1934
+ typeof $(searchItems[i])
1935
+ .children()
1936
+ .attr('ht-query') != 'undefined'
1918
1937
  ) {
1919
1938
  //查询条件字段
1920
- fieldQueryMap[$(searchItems[i]).children().attr('ht-query')] =
1921
- typeof $(searchItems[i]).children().attr('special-query') !=
1922
- 'undefined'
1939
+ fieldQueryMap[
1940
+ $(searchItems[i])
1941
+ .children()
1942
+ .attr('ht-query')
1943
+ ] =
1944
+ typeof $(searchItems[i])
1945
+ .children()
1946
+ .attr('special-query') != 'undefined'
1923
1947
  ? true
1924
1948
  : false
1925
1949
  }
@@ -1987,7 +2011,7 @@ export default {
1987
2011
  }
1988
2012
  },
1989
2013
  //回车查询
1990
- searchEnterFun: function (e) {
2014
+ searchEnterFun: function(e) {
1991
2015
  let keyCode = window.event ? e.keyCode : e.which
1992
2016
  if (keyCode == 13) {
1993
2017
  this.search()
@@ -2106,6 +2130,18 @@ export default {
2106
2130
  openType,
2107
2131
  quitAfterSaving
2108
2132
  ) {
2133
+ let customTitleName =
2134
+ action == 'addFlow'
2135
+ ? `${this.templateInfo.subject || this.templateInfo.formName}`
2136
+ : `${this.templateInfo.formName}-${
2137
+ action == 'add'
2138
+ ? '新增'
2139
+ : action == 'edit'
2140
+ ? '编辑'
2141
+ : action == 'get'
2142
+ ? '明细'
2143
+ : ''
2144
+ }`
2109
2145
  //isStartFlow (false:可以发起流程,true:不可以发起流程)
2110
2146
  if (this.templateInfo.manageField && !isStartFlow) {
2111
2147
  //先配置不能发起流程
@@ -2197,6 +2233,7 @@ export default {
2197
2233
  path: path + '&isNewPage=true',
2198
2234
  query: {
2199
2235
  quitAfterSaving,
2236
+ customTitleName,
2200
2237
  },
2201
2238
  }).href,
2202
2239
  '_blank'
@@ -2224,6 +2261,7 @@ export default {
2224
2261
  path,
2225
2262
  query: {
2226
2263
  quitAfterSaving,
2264
+ customTitleName,
2227
2265
  },
2228
2266
  })
2229
2267
  }