imatrix-ui 2.9.68-dw → 2.9.70-dw

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": "imatrix-ui",
3
- "version": "2.9.68-dw",
3
+ "version": "2.9.70-dw",
4
4
  "description": "前端组件库:表格、表单、组织结构树等",
5
5
  "main": "lib/super-ui.umd.min.js",
6
6
  "private": false,
@@ -160,7 +160,21 @@ export default {
160
160
  tinymce.activeEditor && tinymce.activeEditor.uploadImages()
161
161
  return url
162
162
  }
163
- return url
163
+ // 正则表达式,用于验证URL
164
+ const urlPattern = new RegExp(
165
+ '^(https?:\\/\\/)?' + // 协议 http:// 或者 https:// (可选)
166
+ '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // 域名
167
+ '((\\d{1,3}\\.){3}\\d{1,3}))' + // 或者 IP (v4) 地址
168
+ '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // 端口号(可选)
169
+ '(\\?[;&a-z\\d%_.~+=-]*)?' + // 查询字符串(可选)
170
+ '(\\#[-a-z\\d_]*)?$', 'i') // 片段(可选)
171
+
172
+ if (urlPattern.test(url)) {
173
+ return url
174
+ } else {
175
+ alert('url invalid')
176
+ return ''
177
+ }
164
178
  },
165
179
  images_upload_handler: (blobInfo, success, failure, progress) => {
166
180
  let file
@@ -232,7 +232,11 @@ export default {
232
232
  loadCompleteQuery: {
233
233
  type: Boolean,
234
234
  default: false
235
- }
235
+ },
236
+ initializationQuery:{
237
+ type: Boolean,
238
+ default: true
239
+ }
236
240
  },
237
241
  data() {
238
242
  const customComponentNames = new Set()
@@ -245,7 +249,7 @@ export default {
245
249
  },
246
250
  mounted() {
247
251
  // 查询页面加载完成
248
- if ((this.index + 1) === this.length && this.loadCompleteQuery) {
252
+ if (this.initializationQuery && (this.index + 1) === this.length && this.loadCompleteQuery) {
249
253
  this.$emit('submit-form')
250
254
  }
251
255
  },
@@ -16,6 +16,7 @@
16
16
  :index="fieldNum*(r-1)+(n-1)"
17
17
  :length="searchableColumns.length"
18
18
  :load-complete-query="loadCompleteQuery"
19
+ :initializationQuery="initializationQuery"
19
20
  @submit-form="$emit('submit-form')"
20
21
  />
21
22
  </template>
@@ -106,7 +107,11 @@ export default {
106
107
  loadCompleteQuery: {
107
108
  type: Boolean,
108
109
  default: false
109
- }
110
+ },
111
+ initializationQuery:{
112
+ type: Boolean,
113
+ default: true
114
+ }
110
115
  },
111
116
  data() {
112
117
  let isButtonNewRow = false
@@ -14,8 +14,9 @@
14
14
  :row-num="rowNum"
15
15
  :is-open="isOpen"
16
16
  :load-complete-query="loadCompleteQuery"
17
- @submit-form="$emit('submit-form')"
18
- @reset-form="$emit('reset-form')"
17
+ :initialization-query="initializationQuery"
18
+ @submit-form="emitSubmitForm"
19
+ @reset-form="emitResetForm"
19
20
  @save-condition="$emit('save-condition')"
20
21
  @open-fold="openFold"
21
22
  />
@@ -54,8 +55,9 @@
54
55
  <script>
55
56
  import searchMethods from './search-methods'
56
57
  import store from './store'
57
- import { addDynamicProp, addDynamicPropDateSection } from './utils'
58
+ import { addDynamicProp, addDynamicPropDateSection, isHasOptionFunction } from './utils'
58
59
  import SearchFormOpen from './search-form-open.vue'
60
+ import { isPromise } from '../../../src/utils/common-util'
59
61
  export default {
60
62
  name: 'SearchForm',
61
63
  components: {
@@ -110,6 +112,10 @@ export default {
110
112
  },
111
113
  data() {
112
114
  const gridParams = store.get(this.code)
115
+ let initializationQuery = true
116
+ if (gridParams.basicInfo) {
117
+ initializationQuery = gridParams.basicInfo.initializationQuery
118
+ }
113
119
  let tableName
114
120
  if (gridParams && gridParams.basicInfo && gridParams.basicInfo.tableName) {
115
121
  tableName = gridParams.basicInfo.tableName
@@ -125,7 +131,8 @@ export default {
125
131
  dataTwo: null,
126
132
  tableName,
127
133
  isJoinTable: isHasJoinTable, // 是否是关联表
128
- isOpen: false
134
+ isOpen: false,
135
+ initializationQuery
129
136
  }
130
137
  },
131
138
  computed: {
@@ -144,6 +151,56 @@ export default {
144
151
  })
145
152
  })
146
153
  },
154
+ emitSubmitForm() {
155
+ const gridParams = store.get(this.code)
156
+ let canSearch = true
157
+ if (isHasOptionFunction('beforeListQueryButtonClick', this.code)) {
158
+ canSearch = gridParams.options.beforeListQueryButtonClick.call(this, {
159
+ searchForm: this.searchForm
160
+ })
161
+ }
162
+ if (isPromise(canSearch)) {
163
+ canSearch.then((result) => {
164
+ if (result === undefined || result === true) {
165
+ this.$emit('submit-form')
166
+ } else {
167
+ this.searchComplete()
168
+ }
169
+ })
170
+ } else {
171
+ if (canSearch === undefined || canSearch === true) {
172
+ this.$emit('submit-form')
173
+ } else {
174
+ this.searchComplete()
175
+ }
176
+ }
177
+ },
178
+ emitResetForm() {
179
+ const gridParams = store.get(this.code)
180
+ this.loading = true
181
+ this.searchParams = this.packageSearchParam()
182
+ let canSearch = true
183
+ if (isHasOptionFunction('beforeListResetButtonClick', this.code)) {
184
+ canSearch = gridParams.options.beforeListResetButtonClick.call(this, {
185
+ searchForm: this.searchForm
186
+ })
187
+ }
188
+ if (isPromise(canSearch)) {
189
+ canSearch.then((result) => {
190
+ if (result === undefined || result === true) {
191
+ this.$emit('reset-form')
192
+ } else {
193
+ this.searchComplete()
194
+ }
195
+ })
196
+ } else {
197
+ if (canSearch === undefined || canSearch === true) {
198
+ this.$emit('reset-form')
199
+ } else {
200
+ this.searchComplete()
201
+ }
202
+ }
203
+ },
147
204
  resetForm() {
148
205
  // console.log('customComponentNames=', this.customComponentNames)
149
206
  if (this.customComponentNames && this.customComponentNames.length > 0) {
@@ -144,7 +144,7 @@ export default {
144
144
  },
145
145
  data() {
146
146
  const customComponentNames = new Set()
147
- const gridParams = store.get(this.code)
147
+ const gridParams = store.get(this.code)
148
148
  const propMap = {}
149
149
  let searchForm = {}
150
150
  if (this.searchParam !== null) {
@@ -206,7 +206,7 @@ export default {
206
206
  advancedQuery,
207
207
  normalQuery,
208
208
  searchFormList: [],
209
- searchType: null
209
+ searchType: null
210
210
  }
211
211
  },
212
212
  computed: {