doway-coms 1.4.27 → 1.4.29

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": "doway-coms",
3
- "version": "1.4.27",
3
+ "version": "1.4.29",
4
4
  "description": "doway组件库",
5
5
  "author": "dowaysoft",
6
6
  "main": "packages/index.js",
@@ -17,6 +17,7 @@
17
17
  }"
18
18
  :filter-config="{
19
19
  remote: filterRemote,
20
+ filterMethod: filterMethod
20
21
  }"
21
22
  :menu-config="menuConfig"
22
23
  @menu-click="contextMenuClickEvent"
@@ -309,6 +310,20 @@
309
310
  <a-button @click="filterConfirm(scope.column)">确认</a-button>
310
311
  </div>
311
312
  </template>
313
+ <template #pulldown_filter="scope">
314
+ <div class="interceptor-class">
315
+ <div
316
+ :class="scope.column.field + '_filter_' + $index"
317
+ v-for="(loopFilterValue, $index) in scope.column.filters[0].data
318
+ .displayValues"
319
+ :key="$index"
320
+ >
321
+ <a-input allowClear v-model="loopFilterValue.value[0]" @keyup.enter.native="filterConfirm(scope.column)" />
322
+ </div>
323
+ <a-button @click="filterAddExp(scope.column)">添加条件</a-button>
324
+ <a-button @click="filterConfirm(scope.column)">确认</a-button>
325
+ </div>
326
+ </template>
312
327
  <template #number_filter="scope">
313
328
  <div class="interceptor-class">
314
329
  <div
@@ -879,7 +894,6 @@ export default {
879
894
  },
880
895
  });
881
896
  }
882
- // console.log(this.internalColumns)
883
897
  this.gridEdit = this.edit;
884
898
  },
885
899
 
@@ -2247,38 +2261,72 @@ export default {
2247
2261
  });
2248
2262
  },
2249
2263
  filterConfirm(colInfo) {
2250
- if (this.filterRemote) {
2251
- let col= this.internalColumns.find(x=>x.field==colInfo.property)
2252
- this.$set(col.filters[0].data,'bindingValues',[])
2253
- colInfo.filters[0].data.bindingValues = [];
2254
- XEUtils.arrayEach(colInfo.filters[0].data.displayValues, (item) => {
2255
- if (colInfo.params.controlType === controlType.select) {
2256
- col.filters[0].data.bindingValues.push(item)
2264
+ console.log(colInfo);
2265
+ colInfo.filters[0].data.bindingValues = [];
2266
+ XEUtils.arrayEach(colInfo.filters[0].data.displayValues, (item) => {
2267
+ if (colInfo.params.controlType === controlType.select) {
2268
+ colInfo.filters[0].data.bindingValues.push(item);
2269
+ } else {
2270
+ if (item.value[0] || item.value[1]) {
2257
2271
  colInfo.filters[0].data.bindingValues.push(item);
2258
- } else {
2259
- if (item.value[0] || item.value[1]) {
2260
- col.filters[0].data.bindingValues.push(item)
2261
- colInfo.filters[0].data.bindingValues.push(item);
2262
- }
2263
2272
  }
2264
- });
2265
- colInfo.filters[0].checked =
2266
- colInfo.filters[0].data.bindingValues.length > 0;
2273
+ }
2274
+ });
2275
+ colInfo.filters[0].checked =
2276
+ colInfo.filters[0].data.bindingValues.length > 0;
2277
+
2278
+ if (this.filterRemote) {
2267
2279
  //设置筛选过滤条件
2268
2280
  this.setFilterExpression();
2269
2281
  //通知外部筛选改变事件
2270
2282
  this.$emit("filterChange", { filterCol: colInfo });
2271
2283
  } else {
2272
- for (let i = 0; i < colInfo.filters.length; i++) {
2273
- if (!colInfo.filters[i].value) {
2274
- colInfo.filters[i].checked = true;
2275
- } else {
2276
- colInfo.filters[i].checked = false;
2284
+ // 手动触发重新筛选filterMethod()方法
2285
+ this.$refs.baseGrid.updateData()
2286
+ }
2287
+ this.$refs.baseGrid.closeFilter()
2288
+ },
2289
+ filterMethod({ options, values, cellValue, row, column }) {
2290
+ // 如果是服务端筛选,不会跳入该方法
2291
+ let currentVisible = false
2292
+ // 获取所有筛选数据,加入data数组进行比对
2293
+ const data = []
2294
+ XEUtils.arrayEach(options[0].data.displayValues, (item) => {
2295
+ if(column.params.controlType === controlType.number) {
2296
+ // 数字范围选择
2297
+ item.value.sort((a,b)=> a-b)
2298
+ if ( item.value[0] <= cellValue && cellValue <= item.value[1]) {
2299
+ currentVisible = true
2300
+ }
2301
+ } else if(
2302
+ column.params.controlType === controlType.date ||
2303
+ column.params.controlType === controlType.datetime ||
2304
+ column.params.controlType === controlType.time
2305
+ ) {
2306
+ // 日期范围选择
2307
+ let tempDate = []
2308
+ tempDate.push(XEUtils.timestamp(item.value[0])),
2309
+ tempDate.push(XEUtils.timestamp(item.value[1])),
2310
+ cellValue = XEUtils.timestamp(cellValue)
2311
+ tempDate.sort((a,b)=> a-b)
2312
+ if ( tempDate[0] <= cellValue && cellValue <= tempDate[1]) {
2313
+ currentVisible = true
2314
+ }
2315
+ } else if (column.params.controlType === controlType.select) {
2316
+ // 下拉
2317
+ data.push(item)
2318
+ } else {
2319
+ // 其余字符串
2320
+ let tempData = item.value.find(x => x !== null)
2321
+ if (tempData) {
2322
+ data.push(tempData)
2277
2323
  }
2278
2324
  }
2279
- this.$refs.baseGrid.updateData();
2325
+ });
2326
+ if (cellValue && !currentVisible) {
2327
+ currentVisible = data.find(x => cellValue.indexOf(x) > -1)?true:false
2280
2328
  }
2281
- this.$refs.baseGrid.closeFilter()
2329
+ return currentVisible
2282
2330
  },
2283
2331
  setFilterExpression() {
2284
2332
  XEUtils.clear(this.filterExpression);
@@ -2298,6 +2346,7 @@ export default {
2298
2346
  };
2299
2347
  let expStr = "";
2300
2348
  let filterBindingValues = loopColInfo.filters[0].data.bindingValues;
2349
+
2301
2350
  //筛选条件过滤
2302
2351
  let colFilterExpression = { operator: "or", expressions: [] };
2303
2352
 
@@ -2347,7 +2396,6 @@ export default {
2347
2396
  case controlType.number:
2348
2397
  tempPushExp.operator = "RA";
2349
2398
  tempPushExp.value = loopBindingValue.value;
2350
- console.log(tempPushExp);
2351
2399
  expStr = "范围";
2352
2400
  tempStr.exp =
2353
2401
  tempStr.exp +
@@ -2363,7 +2411,6 @@ export default {
2363
2411
  }
2364
2412
  colFilterExpression.expressions.push(tempPushExp);
2365
2413
  });
2366
- // debugger
2367
2414
  this.filterExpression.push(colFilterExpression);
2368
2415
  tempStr.exp = expStr + tempStr.exp.substring(0, tempStr.exp.length - 1);
2369
2416
  this.filterStr.push(tempStr);