@netang/quasar 0.2.33 → 0.2.35

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": "@netang/quasar",
3
- "version": "0.2.33",
3
+ "version": "0.2.35",
4
4
 
5
5
  "description": "netang-quasar",
6
6
  "scripts": {
package/utils/$table.js CHANGED
@@ -379,8 +379,6 @@ function create(options) {
379
379
  // 获取原始数据
380
380
  const r = getRawData(_tableColumns, Object.assign({}, $route.query), o.searchFromQuery)
381
381
 
382
- console.log('-----r', $n.cloneDeep(r.firstTableSearchValue))
383
-
384
382
  // 原始参数
385
383
  rawQuery = r.rawQuery
386
384
  // 原始表格搜索参数
@@ -136,25 +136,29 @@ export function setItemValue(value, val) {
136
136
 
137
137
  // 如果值为数组
138
138
  if (Array.isArray(val)) {
139
- // 比较类型为 in
140
- value[0].compare = dicts.SEARCH_COMPARE_TYPE__IN
141
- // 设置值为将数组转为逗号分隔的字符串
142
- value[0].value = $n_join(val, ',')
143
139
 
144
- // 如果值是逗号隔开
145
- } else if ($n_split(val, ',').length > 1) {
146
140
  // 比较类型为 in
147
141
  value[0].compare = dicts.SEARCH_COMPARE_TYPE__IN
148
- // 设置值为将数组转为逗号分隔的字符串
149
- value[0].value = val
150
142
 
151
- // 否则为单个值
152
143
  } else {
153
- // 比较类型为 ==
154
- value[0].compare = dicts.SEARCH_COMPARE_TYPE__EQUAL
155
- // 设置值为当前值
156
- value[0].value = val
144
+
145
+ // 如果值是逗号隔开
146
+ const arr = $n_split(val, ',')
147
+ if (arr.length > 1) {
148
+ // 比较类型为 in
149
+ value[0].compare = dicts.SEARCH_COMPARE_TYPE__IN
150
+ val = arr
151
+
152
+ // 否则为单个值
153
+ } else {
154
+
155
+ // 比较类型为 ==
156
+ value[0].compare = dicts.SEARCH_COMPARE_TYPE__EQUAL
157
+ }
157
158
  }
159
+
160
+ // 设置值为当前值
161
+ value[0].value = $n_numberDeep(val)
158
162
  }
159
163
 
160
164
  /**
@@ -197,9 +201,6 @@ function formatItemValueCompare(value, { compareOptions1 }) {
197
201
  */
198
202
  export function getRawData(tableColumns, query, searchFromQuery = true) {
199
203
 
200
-
201
- console.log('-----query', $n.cloneDeep(query))
202
-
203
204
  // 原始参数
204
205
  const rawQuery = {}
205
206
  // 原始表格搜索参数
@@ -281,14 +282,28 @@ export function getRawData(tableColumns, query, searchFromQuery = true) {
281
282
  newVal = decodeURIComponent(newVal)
282
283
  if ($n_isJson(newVal)) {
283
284
  $n_forEach($n_json.parse(newVal), function (v, i) {
285
+
284
286
  if (
285
287
  i <= 1
286
288
  && $n_isValidArray(v)
287
289
  && v.length >= 2
288
290
  ) {
291
+ let newVal = v[1]
292
+
293
+ // 如果比较类型为 in / not in
294
+ if ($n_indexOf([ dicts.SEARCH_COMPARE_TYPE__IN, dicts.SEARCH_COMPARE_TYPE__NOT_IN ], v[0]) > -1) {
295
+ // 如果不为数组
296
+ if (! Array.isArray(v[1])) {
297
+ newVal = $n_split(newVal, ',')
298
+ }
299
+
300
+ } else if (! $n_isRequired(newVal)) {
301
+ newVal = ''
302
+ }
303
+
289
304
  value[i] = {
290
305
  compare: v[0],
291
- value: $n_isRequired(v[1]) ? v[1] : '',
306
+ value: $n_numberDeep(newVal),
292
307
  }
293
308
  }
294
309
  })