three-trees-ui 1.0.46 → 1.0.48

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.46",
3
+ "version": "1.0.48",
4
4
  "publicPath": "/ui",
5
5
  "author": "hotent",
6
6
  "private": false,
@@ -11,12 +11,13 @@ export default {
11
11
  total: 0,
12
12
  form: {},
13
13
  itemSavestate: {},
14
+ loadingInstance: null,
14
15
  }
15
16
  },
16
17
  methods: {
17
18
  //更新对话框数据
18
19
  setDialogData(data) {
19
- data.forEach(item => {
20
+ data.forEach((item) => {
20
21
  delete item.row_id
21
22
  })
22
23
  if (this.isMobile && this.pagination && this.pagination.page > 1) {
@@ -25,12 +26,19 @@ export default {
25
26
  this.dialogData = data
26
27
  }
27
28
  },
29
+ closeLoadingInstance() {
30
+ if (this.loadingInstance) {
31
+ this.loadingInstance.close()
32
+ }
33
+ },
28
34
  getDialoglistJson(pagination) {
29
- let loadingInstance
30
35
  if (this.isMobile) {
31
36
  this.$showLoading()
32
37
  } else {
33
- loadingInstance = Loading.service({ fullscreen: true, text: '查询中...' })
38
+ this.loadingInstance = Loading.service({
39
+ fullscreen: true,
40
+ text: '查询中...',
41
+ })
34
42
  }
35
43
  return this.$requestConfig
36
44
  .request({
@@ -42,13 +50,13 @@ export default {
42
50
  if (this.isMobile) {
43
51
  this.$cancelLoading()
44
52
  } else {
45
- loadingInstance.close()
53
+ this.loadingInstance.close()
46
54
  }
47
55
  const listKey = pagination.listKey
48
56
  ? pagination.listKey
49
57
  : pagination.dsType && pagination.dsType == 'dataSource'
50
- ? 'rows'
51
- : ''
58
+ ? 'rows'
59
+ : ''
52
60
  if (!listKey) {
53
61
  console.warn(
54
62
  '自定义对话框未获取到数据返回的listKey,数据加载可能产生异常。'
@@ -78,11 +86,12 @@ export default {
78
86
  }
79
87
  this.setPagination(pageBean)
80
88
  this.setTodoRows(rows) //列表数据
81
- }).catch(err=>{
89
+ })
90
+ .catch(() => {
82
91
  if (this.isMobile) {
83
92
  this.$cancelLoading()
84
93
  } else {
85
- loadingInstance.close()
94
+ this.loadingInstance.close()
86
95
  }
87
96
  })
88
97
  },
@@ -77,8 +77,8 @@
77
77
  </div>
78
78
  <!-- 下拉框 -->
79
79
  <div
80
- class="search-item_main"
81
80
  v-if="condition.controllerType == '3'"
81
+ class="search-item_main"
82
82
  >
83
83
  <!-- 静态选项 -->
84
84
  <ht-select
@@ -126,7 +126,7 @@
126
126
  ? 'yyyy-MM-dd HH:mm:ss'
127
127
  : condition.config.inputFormat
128
128
  "
129
- :valueFormat="
129
+ :value-format="
130
130
  condition.config.inputFormat.includes('mm:ss')
131
131
  ? 'yyyy-MM-dd HH:mm:ss'
132
132
  : condition.config.inputFormat
@@ -140,7 +140,7 @@
140
140
  ? 'yyyy-MM-dd HH:mm:ss'
141
141
  : condition.config.inputFormat
142
142
  "
143
- :valueFormat="
143
+ :value-format="
144
144
  condition.config.inputFormat.includes('mm:ss')
145
145
  ? 'yyyy-MM-dd HH:mm:ss'
146
146
  : condition.config.inputFormat
@@ -148,14 +148,14 @@
148
148
  ></ht-date>
149
149
  </div>
150
150
  <ht-date
151
- v-model="queryParams[index][condition.field]"
152
151
  v-else
152
+ v-model="queryParams[index][condition.field]"
153
153
  :format="
154
154
  condition.config.inputFormat.includes('mm:ss')
155
155
  ? 'yyyy-MM-dd HH:mm:ss'
156
156
  : condition.config.inputFormat
157
157
  "
158
- :valueFormat="
158
+ :value-format="
159
159
  condition.config.inputFormat.includes('mm:ss')
160
160
  ? 'yyyy-MM-dd HH:mm:ss'
161
161
  : condition.config.inputFormat
@@ -230,7 +230,7 @@
230
230
  <ht-custom-dialog
231
231
  v-model="queryParams[index][condition.field]"
232
232
  :model-name="condition.config.valueBind"
233
- dialogType="search"
233
+ dialog-type="search"
234
234
  :custdialog="{
235
235
  name: '请选择',
236
236
  icon: '',
@@ -264,7 +264,7 @@
264
264
  </el-button>
265
265
  </div>
266
266
  </el-header>
267
- <el-main class="custom-dialog_main" ref="customTableRef">
267
+ <el-main ref="customTableRef" class="custom-dialog_main">
268
268
  <el-table
269
269
  ref="orgTable"
270
270
  :data="dialogData"
@@ -1571,6 +1571,7 @@
1571
1571
  const this_ = this
1572
1572
  this_.queryParam = ''
1573
1573
  this.setDialogData([])
1574
+ this.closeLoadingInstance()
1574
1575
  this_.customDialogShowList = false
1575
1576
  //判断是否是点击了确认再点击取消的 inputVal没有值则表示直接点击的取消
1576
1577
  if (!this_.inputVal) {
@@ -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