@netang/quasar 0.1.87 → 0.1.88

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/utils/$table.js +25 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netang/quasar",
3
- "version": "0.1.87",
3
+ "version": "0.1.88",
4
4
  "description": "netang-quasar",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/utils/$table.js CHANGED
@@ -1203,14 +1203,30 @@ async function getViewData(options) {
1203
1203
  const {
1204
1204
  url,
1205
1205
  field,
1206
- value,
1206
+ value: httpValue,
1207
+ data: httpData,
1207
1208
  } = Object.assign({
1208
1209
  field: 'id',
1209
1210
  value: [],
1211
+ data: {},
1210
1212
  }, options)
1211
1213
 
1212
- const _isValidValue = $n_isValidValue(value)
1213
- if (_isValidValue || $n_isValidArray(value)) {
1214
+ const _isValidValue = $n_isValidValue(httpValue)
1215
+ if (_isValidValue || $n_isValidArray(httpValue)) {
1216
+
1217
+ let per_page
1218
+ let value
1219
+ let compare
1220
+
1221
+ if (_isValidValue) {
1222
+ compare = dicts.SEARCH_COMPARE_TYPE__EQUAL
1223
+ value = httpValue
1224
+ per_page = 1
1225
+ } else {
1226
+ compare = dicts.SEARCH_COMPARE_TYPE__IN
1227
+ value = $n_uniq(httpValue)
1228
+ per_page = value.length
1229
+ }
1214
1230
 
1215
1231
  const { status, data } = await $n_http({
1216
1232
  url,
@@ -1219,15 +1235,17 @@ async function getViewData(options) {
1219
1235
  // 添加头部查看请求
1220
1236
  Pview: 1,
1221
1237
  },
1222
- data: {
1238
+ data: Object.assign({
1223
1239
  n_search: [
1224
1240
  {
1225
1241
  field,
1226
- compare: _isValidValue ? dicts.SEARCH_COMPARE_TYPE__EQUAL : dicts.SEARCH_COMPARE_TYPE__IN,
1227
- value: _isValidValue ? value : $n_uniq(value),
1242
+ compare,
1243
+ value,
1228
1244
  },
1229
1245
  ],
1230
- },
1246
+ page: 1,
1247
+ per_page,
1248
+ }, httpData),
1231
1249
  })
1232
1250
 
1233
1251
  if (