精简搜索函数, 添加页面

This commit is contained in:
zhengw
2026-02-06 14:49:13 +08:00
parent 3513a19880
commit 9ce21008a3
64 changed files with 519 additions and 559 deletions

View File

@@ -1,5 +1,12 @@
import { loginStatus, post } from '@/utils/https';
import { cloneLite, getAuthInfo, getDataSet, toArray, toNumber } from '@/utils/util';
import {
cloneLite,
getAuthInfo,
getDataSet,
searchValueFormat,
toArray,
toNumber,
} from '@/utils/util';
const defaultParams = { curr_page: 1, page_count: 20 };
@@ -28,12 +35,7 @@ Page({
},
searchChange(e: any) {
const key = getDataSet(e).key;
this.data.params[key] = e.detail.value;
this.setData({ params: this.data.params });
},
searchChange2(e: any) {
const key = getDataSet(e).key;
const val = `${e.detail.value || ''}`.trim();
const val = searchValueFormat(e.detail.value);
if (val) {
this.data.params[key] = val;
} else {
@@ -41,16 +43,6 @@ Page({
}
this.setData({ params: this.data.params });
},
onOptionChange(e: any) {
const key = getDataSet(e).key;
this.data.params[key] = e.detail.value;
this.setData({ params: this.data.params });
},
datePickerConfirm(e: any) {
const data = getDataSet(e);
this.data.params[data.key] = e.detail.value;
this.setData({ params: this.data.params });
},
searchOk() {
this.getList(1);
},

View File

@@ -4,20 +4,20 @@
bind:reset="searchReset" value="{{params.goods_name}}" data-key="goods_name">
<view slot="content">
<search-input label="商品编码" value="{{params.goods_code}}" data-key="goods_code"
bind:change="searchChange2" />
bind:change="searchChange" />
<search-input label="助记码" value="{{params.sku_alias}}" data-key="sku_alias"
bind:change="searchChange2" />
bind:change="searchChange" />
<!-- <option-cell-plugin title="订单阶段" value="{{params.order_step}}" bind:change="onOptionChange"
<!-- <option-cell-plugin title="订单阶段" value="{{params.order_step}}" bind:change="searchChange"
mode="checkbox" options="{{orderStep}}" data-key="order_step" /> -->
<select-plugin title="仓库" options="{{depots}}" value="{{params.depot_id}}"
bind:change="onOptionChange" data-key="depot_id" />
bind:change="searchChange" data-key="depot_id" />
<select-plugin title="商品分类" options="{{goodsClass}}" value="{{params.goods_class}}"
bind:change="onOptionChange" data-key="goods_class" />
bind:change="searchChange" data-key="goods_class" />
<date-picker-plugin title="创建开始日期" value="{{params.create_dateL}}" data-key="create_dateL"
bind:confirm="datePickerConfirm" />
bind:confirm="searchChange" />
<date-picker-plugin title="创建结束日期" value="{{params.create_dateU}}" data-key="create_dateU"
bind:confirm="datePickerConfirm" />
bind:confirm="searchChange" />
</view>
</search-popup>