three-trees-ui 1.0.48 → 1.0.49

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.48",
3
+ "version": "1.0.49",
4
4
  "publicPath": "/ui",
5
5
  "author": "hotent",
6
6
  "private": false,
@@ -36,7 +36,7 @@ export default {
36
36
  this.$showLoading()
37
37
  } else {
38
38
  this.loadingInstance = Loading.service({
39
- fullscreen: true,
39
+ fullscreen: false,
40
40
  text: '查询中...',
41
41
  })
42
42
  }
@@ -25,6 +25,7 @@
25
25
  <div
26
26
  v-else
27
27
  :style="showBorder ? textDivStyle : {}"
28
+ class="w-e-text"
28
29
  :class="{ 'empty-div': type === 'property-text' && !hasTextValue }"
29
30
  v-html="inputVal"
30
31
  ></div>
@@ -6,6 +6,7 @@
6
6
  <script>
7
7
  import utils from '@/utils.js'
8
8
  import emitter from '@/mixins/emitter.js'
9
+ import { Notification } from 'element-ui'
9
10
  const { Base64 } = require('js-base64')
10
11
  export default {
11
12
  name: 'HtGlobalValidate',
@@ -43,11 +44,19 @@
43
44
  })
44
45
  if (messages.length > 0) {
45
46
  result = false
46
- this.$notify.error({
47
- title: this.$t('ht.common.warmTips'),
48
- dangerouslyUseHTMLString: true,
49
- message: messages.join('<br/>'),
50
- })
47
+ // 判断是移动端还是pc
48
+ if (utils.isMobile()) {
49
+ this.$notify({
50
+ message: messages[0],
51
+ background: '#f25130',
52
+ })
53
+ } else {
54
+ Notification.error({
55
+ title: this.$t('ht.common.warmTips'),
56
+ dangerouslyUseHTMLString: true,
57
+ message: messages.join('<br/>'),
58
+ })
59
+ }
51
60
  }
52
61
  }
53
62
  if (result) {
@@ -63,8 +72,39 @@
63
72
  let Fn = Function('data', '_me', '$Formulas', formulasDiyJs) //一个变量指向Function,防止有些前端编译工具报错
64
73
  try {
65
74
  let result = Fn(pInst.data, pInst, pInst.$Formulas)
66
- if (!result) {
67
- messages.push(item.tips)
75
+ if (result.constructor === Array) {
76
+ result = result.filter((it) => !it.valid)
77
+ if (result.length > 0) {
78
+ const tableName = result[0].tableName
79
+ const fieldName = result[0].fieldName
80
+ const sunIndexList = Array.from(
81
+ new Set(result.map((it) => it.sunIndex + 1))
82
+ )
83
+ const sunTableName = result[0].sunTableName
84
+ const indexList = Array.from(
85
+ new Set(result.map((it) => it.index + 1))
86
+ )
87
+ if (sunTableName) {
88
+ const tips = `${tableName}:第${indexList.join(
89
+ ','
90
+ )}行,【${sunTableName}】第${sunIndexList.join(
91
+ ','
92
+ )}行,字段【${fieldName}】${item.tips}`
93
+ messages.push(tips)
94
+ } else if (tableName) {
95
+ messages.push(
96
+ `${tableName}:第${indexList.join(
97
+ ','
98
+ )}行,字段【${fieldName}】${item.tips}`
99
+ )
100
+ } else {
101
+ messages.push(item.tips)
102
+ }
103
+ }
104
+ } else {
105
+ if (!result) {
106
+ messages.push(item.tips)
107
+ }
68
108
  }
69
109
  } catch (err) {
70
110
  messages.push(`全局校验【${item.name}】脚本错误`)
@@ -43,7 +43,7 @@
43
43
  <ht-icon name="arrow" />
44
44
  </el-button>
45
45
  </el-tooltip>
46
- <el-tooltip content="刷新数据" placement="top">
46
+ <el-tooltip v-if="showRefresh" content="刷新数据" placement="top">
47
47
  <el-button
48
48
  icon="el-icon-refresh"
49
49
  class="refresh-btn-icon"
@@ -267,6 +267,10 @@
267
267
  type: Boolean,
268
268
  default: false,
269
269
  },
270
+ showRefresh: {
271
+ type: Boolean,
272
+ default: true,
273
+ },
270
274
  showCustomColumn: {
271
275
  type: Boolean,
272
276
  default: true,
@@ -366,6 +370,7 @@
366
370
  },
367
371
  data() {
368
372
  return {
373
+ resetDefaultFilter: [], // 重置时需把默认筛选条件重置
369
374
  querys: [],
370
375
  sorter: null,
371
376
  quickSearchWord: null,
@@ -394,7 +399,10 @@
394
399
  relation: 'AND',
395
400
  }
396
401
  this.defaultQuerys.forEach((c) => {
397
- calQuerys.push({ ...query, ...c })
402
+ // 如果有重置过筛选条件的 需在默认条件中剔除
403
+ if (this.resetDefaultFilter.indexOf(c.property) === -1) {
404
+ calQuerys.push({ ...query, ...c })
405
+ }
398
406
  })
399
407
  return calQuerys
400
408
  },
@@ -650,7 +658,15 @@
650
658
  this.calDefaultQuerys.forEach((item) => {
651
659
  param.querys.remove(item)
652
660
  })
653
- param.querys = param.querys.concat(this.calDefaultQuerys)
661
+ // 默认查询条件和当前查询条件重复时,取消默认条件
662
+ param.querys = param.querys.concat(
663
+ this.calDefaultQuerys.filter((item) => {
664
+ let index = param.querys.findIndex((sub) => {
665
+ return sub.property === item.property
666
+ })
667
+ return index === -1
668
+ })
669
+ )
654
670
  }
655
671
 
656
672
  const me = this
@@ -821,8 +837,8 @@
821
837
  delete this.filters[k]
822
838
  }
823
839
  })
824
- this.$emit('filter-change', m)
825
840
  this.load()
841
+ this.$emit('filter-change', m)
826
842
  },
827
843
  doLayout() {
828
844
  this.$nextTick(() => {
package/src/validate.js CHANGED
@@ -15,7 +15,7 @@ validate.install = (Vue) => {
15
15
  Validator.localize(dict)
16
16
 
17
17
  //比较类型。1,小于:datelessthan。2,小于等于:daterangeend。3,大于:datemorethan。4,大于等于:daterangestart
18
- const getDatevalAndCompare = function(selfValue, targetValue, compareType) {
18
+ const getDatevalAndCompare = function (selfValue, targetValue, compareType) {
19
19
  let targetDate = targetValue
20
20
  if (!targetDate) {
21
21
  return true
@@ -109,9 +109,10 @@ validate.install = (Vue) => {
109
109
  return true
110
110
  }
111
111
  }
112
- var re = /^([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8])))/g.test(
113
- dateVal.trim()
114
- )
112
+ var re =
113
+ /^([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8])))/g.test(
114
+ dateVal.trim()
115
+ )
115
116
  return re
116
117
  }
117
118
  },
@@ -180,7 +181,17 @@ validate.install = (Vue) => {
180
181
  Validator.extend('frontJSValidate', {
181
182
  validate: (value, args) => {
182
183
  return new Promise((resolve) => {
183
- let jsScript = args[0]
184
+ const validateStr = args[0]
185
+ const validateList = validateStr.split('&')
186
+ let jsScript = validateList[0]
187
+ let index = 0 //字表index
188
+ let sunIndex = 0 //孙表index
189
+ if (validateList.length >= 2) {
190
+ index = validateList[1].split('=')[1]
191
+ }
192
+ if (validateList.length == 3) {
193
+ sunIndex = validateList[2].split('=')[1]
194
+ }
184
195
  jsScript = decode(jsScript)
185
196
  let formElementAry = document.getElementsByName('online-form')
186
197
  let dataViewElementAry = document.getElementsByName('data-view')
@@ -189,20 +200,24 @@ validate.install = (Vue) => {
189
200
  if (formElementAry && formElementAry.length == 1) {
190
201
  //PC表单
191
202
  let frmInst = formElementAry[0].__vue__
192
- data = JSON.parse(JSON.stringify(frmInst.data))
203
+ if (frmInst && frmInst.data) {
204
+ data = JSON.parse(JSON.stringify(frmInst.data))
205
+ }
193
206
  paramName = 'data'
194
- } else if(dataViewElementAry && dataViewElementAry.length == 1){
207
+ } else if (dataViewElementAry && dataViewElementAry.length == 1) {
195
208
  //表单列表
196
209
  let dataViewInst = dataViewElementAry[0].__vue__.$children[0]
197
- data = JSON.parse(JSON.stringify(dataViewInst.searchForm))
210
+ if (dataViewInst && dataViewInst.searchForm) {
211
+ data = JSON.parse(JSON.stringify(dataViewInst.searchForm))
212
+ }
198
213
  paramName = 'searchForm'
199
214
  }
200
215
  if (value && value._isVue) {
201
216
  value = value.value
202
217
  }
203
218
  function evil() {
204
- let Fn = Function('value', paramName, jsScript) //一个变量指向Function,防止有些前端编译工具报错
205
- let result = Fn(value, data)
219
+ let Fn = Function('value', paramName, 'index', 'sunIndex', jsScript) //一个变量指向Function,防止有些前端编译工具报错
220
+ let result = Fn(value, data, Number(index), Number(sunIndex))
206
221
  return result
207
222
  }
208
223
  try {