diff --git a/src/common/list-filter.scss b/src/common/list-filter.scss new file mode 100644 index 0000000..f92c59d --- /dev/null +++ b/src/common/list-filter.scss @@ -0,0 +1,149 @@ +@import '@/common/pda-typography.scss'; + +page { background-color: #F8F8F8; } +.filterBar { display: flex; align-items: center; padding: 16rpx 20rpx; background: #fff; gap: 16rpx; } +.filterBtn { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + min-width: 88rpx; + min-height: 76rpx; + padding: 8rpx 10rpx; + border: 2rpx solid transparent; + border-radius: 12rpx; + box-sizing: border-box; + font-size: $pda-font-nav-sub; + line-height: 1.2; + color: #666; + background: #f5f6f8; +} +.filter-active { + color: #2979ff !important; + background: #d6e8ff !important; + border-color: #2979ff !important; +} +.filterBtn__icon { + position: relative; + display: flex; + align-items: center; + justify-content: center; +} +.filterBtn__badge { + position: absolute; + top: -8rpx; + right: -10rpx; + width: 18rpx; + height: 18rpx; + border: 4rpx solid #fff; + border-radius: 50%; + background: #ff4d4f; + box-sizing: content-box; +} +.filterPanel { + min-height: 100%; + padding: 32rpx 28rpx; + box-sizing: border-box; +} +.filterTitle { + margin-bottom: 30rpx; + font-size: $pda-font-popup-title; + font-weight: bold; + color: #202328; +} +.filterItem { margin-bottom: 28rpx; } +.filterLabel { + display: block; + margin-bottom: 14rpx; + font-size: $pda-font-body; + line-height: 1.35; + color: #555b66; +} +.filterInput { + display: flex; + align-items: center; + min-height: $pda-row-min-height; + padding: 0 18rpx; + background: #f5f6f8; + border-radius: 8rpx; + box-sizing: border-box; +} +::v-deep .filterInput .u-input__input { + font-size: $pda-font-body !important; + color: #202328; +} +::v-deep .filterInput .u-input__input::placeholder { + font-size: $pda-font-placeholder; + color: #aeb4bf; +} +.filterValue { + display: flex; + align-items: center; + justify-content: space-between; + min-height: $pda-row-min-height; + padding: 0 18rpx; + background: #f5f6f8; + border-radius: 8rpx; + box-sizing: border-box; + font-size: $pda-font-body; + color: #202328; +} +.dateRow { + display: flex; + align-items: center; + gap: 10rpx; +} +.datePicker { + flex: 1; + min-width: 0; +} +.dateInput { + display: flex; + align-items: center; + justify-content: center; + min-height: $pda-row-min-height; + padding: 0 8rpx; + background: #f5f6f8; + border-radius: 8rpx; + box-sizing: border-box; + font-size: $pda-font-body; + color: #202328; + text-align: center; + white-space: nowrap; +} +.dateInput--placeholder { + font-size: $pda-font-placeholder; + color: #7d8490; +} +.dateSeparator { + flex-shrink: 0; + font-size: $pda-font-body; + color: #555b66; +} +.filterActions { + display: flex; + gap: 20rpx; + margin-top: 40rpx; +} +.filterActions .u-btn { + flex: 1; + height: $pda-button-height !important; + line-height: $pda-button-height !important; + padding: 0 !important; + font-size: $pda-font-button !important; +} +::v-deep .pdaSelect .u-select__header { + height: $pda-row-min-height; +} +::v-deep .pdaSelect .u-select__header__btn, +::v-deep .pdaSelect .u-select__header__title, +::v-deep .pdaSelect .u-select__body__picker-view__item { + font-size: $pda-font-popup-item !important; +} +::v-deep .pdaSelect .u-select__search__input { + font-size: $pda-font-body !important; +} +::v-deep .pdaSelect .u-select__loading, +::v-deep .pdaSelect .u-select__empty { + font-size: $pda-font-popup-sub !important; +} diff --git a/src/common/listFilter.js b/src/common/listFilter.js new file mode 100644 index 0000000..f81f674 --- /dev/null +++ b/src/common/listFilter.js @@ -0,0 +1,49 @@ +export function hasFilterValue(value) { + if (value === '' || value === null || value === undefined) return false; + if (typeof value === 'string') return value.trim() !== ''; + return true; +} + +export function normalizeAuditStatus(value) { + if (!hasFilterValue(value) && value !== 0) return ''; + const status = Number(value); + return Number.isNaN(status) ? '' : status; +} + +export function isActiveFilterState(filters) { + if (!filters) return false; + return Object.keys(filters).some((key) => { + if (/_name$/.test(key)) return false; + return hasFilterValue(filters[key]); + }); +} + +export function normalizeFilterState(value, defaults) { + const filters = { ...defaults }; + if (!value || typeof value !== 'object' || Array.isArray(value)) return filters; + + Object.keys(filters).forEach((key) => { + if (key === 'audit_status') return; + if (typeof value[key] === 'string' || typeof value[key] === 'number') { + filters[key] = value[key]; + } + }); + Object.keys(filters).forEach((key) => { + if (!key.endsWith('_id') || hasFilterValue(filters[key])) return; + const nameKey = `${key.slice(0, -3)}_name`; + if (nameKey in filters) filters[nameKey] = ''; + }); + if (Object.prototype.hasOwnProperty.call(value, 'audit_status')) { + filters.audit_status = normalizeAuditStatus(value.audit_status); + } + return filters; +} + +export function withSelectedOption(list, selectedValue, selectedLabel) { + const rows = Array.isArray(list) ? list.slice() : []; + const exists = rows.some((item) => String(item.value) === String(selectedValue)); + if (hasFilterValue(selectedValue) && !exists) { + rows.unshift({ value: selectedValue, label: selectedLabel || String(selectedValue) }); + } + return [{ value: '', label: '全部' }].concat(rows); +} diff --git a/src/common/pda-typography.scss b/src/common/pda-typography.scss new file mode 100644 index 0000000..ab74ca7 --- /dev/null +++ b/src/common/pda-typography.scss @@ -0,0 +1,19 @@ +/** + * PDA 小屏字号标准(以手动进仓页为准) + * 业务页请优先引用这些变量,避免字号再次变小。 + */ + +$pda-font-body: 36rpx; +$pda-font-placeholder: 34rpx; +$pda-font-action: 34rpx; +$pda-font-unit: 32rpx; +$pda-font-nav-sub: 32rpx; +$pda-font-button: 36rpx; +$pda-font-popup-title: 36rpx; +$pda-font-popup-item: 36rpx; +$pda-font-popup-sub: 34rpx; + +$pda-row-min-height: 100rpx; +$pda-scan-input-height: 100rpx; +$pda-button-height: 92rpx; +$pda-label-width: 200rpx; diff --git a/src/components/u-select/u-select.vue b/src/components/u-select/u-select.vue index cfc1f63..6a86c20 100644 --- a/src/components/u-select/u-select.vue +++ b/src/components/u-select/u-select.vue @@ -308,7 +308,11 @@ export default { this.setSelectValue(); }, setDefaultSelector() { - this.defaultSelector = Array(this.columnNum || 1).fill(0); + const columnNum = this.columnNum || 1; + const defaultValue = Array.isArray(this.defaultValue) ? this.defaultValue.slice() : []; + this.defaultSelector = defaultValue.length === columnNum + ? defaultValue + : Array(columnNum).fill(0); this.lastSelectIndex = this.defaultSelector.slice(); }, setColumnNum() { diff --git a/src/mixins/listFilterMixin.js b/src/mixins/listFilterMixin.js new file mode 100644 index 0000000..b040e7d --- /dev/null +++ b/src/mixins/listFilterMixin.js @@ -0,0 +1,119 @@ +import { + hasFilterValue, + normalizeAuditStatus, + isActiveFilterState, + normalizeFilterState, + withSelectedOption, +} from '@/common/listFilter'; + +export default { + data() { + return { + appliedFilters: null, + }; + }, + computed: { + hasActiveFilter() { + return isActiveFilterState(this.appliedFilters || this.filters); + }, + filterIconColor() { + return this.hasActiveFilter ? '#2979ff' : '#666666'; + }, + statusSelectDefault() { + const list = this.statusSelectList || []; + const index = list.findIndex( + (item) => String(item.value) === String(this.filters && this.filters.audit_status) + ); + return [index >= 0 ? index : 0]; + }, + unitSelectDefault() { + const selectedValue = this.getUnitSelectValue(); + const index = (this.unitSelectList || []).findIndex( + (item) => String(item.value) === String(selectedValue) + ); + return [index >= 0 ? index : 0]; + }, + }, + methods: { + hasFilterValue, + getDefaultFilters() { + return typeof this.createDefaultFilters === 'function' + ? this.createDefaultFilters() + : {}; + }, + getUnitSelectValue() { + const type = this.unitSelectType; + const filters = this.filters || {}; + if (type === 'warehouse') return filters.warehouse_id; + if (type === 'delivery') return filters.delivery_unit_id; + if (type === 'business') return filters.business_unit_id; + if (type === 'supplier') return filters.supplier_id; + if (type === 'process') return filters.process_unit_id; + return filters.process_unit_id || filters.supplier_id || filters.business_unit_id || ''; + }, + getUnitSelectLabel() { + const type = this.unitSelectType; + const filters = this.filters || {}; + if (type === 'warehouse') return filters.warehouse_name; + if (type === 'delivery') return filters.delivery_unit_name; + if (type === 'business') return filters.business_unit_name; + if (type === 'supplier') return filters.supplier_name; + if (type === 'process') return filters.process_name; + return filters.process_name || filters.supplier_name || filters.business_unit_name || ''; + }, + restoreFilterCache() { + const defaults = this.getDefaultFilters(); + try { + const cached = this.filterStorageKey ? uni.getStorageSync(this.filterStorageKey) : null; + if (!cached || typeof cached !== 'object' || Array.isArray(cached)) { + this.filters = { ...defaults }; + this.appliedFilters = { ...defaults }; + this.saveFilterCache(); + return; + } + const filters = normalizeFilterState(cached, defaults); + this.filters = { ...filters }; + this.appliedFilters = { ...filters }; + } catch (e) { + this.filters = { ...defaults }; + this.appliedFilters = { ...defaults }; + } + }, + saveFilterCache() { + if (!this.filterStorageKey) return; + try { + uni.setStorageSync(this.filterStorageKey, { ...this.appliedFilters }); + } catch (e) { + // 缓存失败不影响列表筛选 + } + }, + commitFilters() { + const filters = normalizeFilterState(this.filters, this.getDefaultFilters()); + this.filters = { ...filters }; + this.appliedFilters = { ...filters }; + this.saveFilterCache(); + this.loadList(); + }, + applySearch() { + this.commitFilters(); + }, + cancelFilterEdit() { + this.filters = { ...(this.appliedFilters || this.getDefaultFilters()) }; + }, + applyFilter() { + this.commitFilters(); + this.filterShow = false; + }, + resetFilter() { + this.filters = this.getDefaultFilters(); + }, + onStatusConfirm(e) { + this.filters.audit_status = normalizeAuditStatus((e[0] || {}).value); + }, + applyUnitSelectList(list, preserveSelected = true) { + const selectedValue = preserveSelected ? this.getUnitSelectValue() : ''; + const selectedLabel = preserveSelected ? this.getUnitSelectLabel() : ''; + this.unitSelectList = withSelectedOption(list, selectedValue, selectedLabel); + }, + }, +}; diff --git a/src/pages.json b/src/pages.json index 01c044f..e141cfc 100644 --- a/src/pages.json +++ b/src/pages.json @@ -915,12 +915,6 @@ "backgroundColor": "#ffffff", "borderStyle": "white", "list": [ - { - "pagePath": "pages/sys/msg/index", - "iconPath": "static/aidex/tabbar/msg_1.png", - "selectedIconPath": "static/aidex/tabbar/msg_2.png", - "text": "消息" - }, // { // "pagePath": "pages/sys/home/index", // "iconPath": "static/aidex/tabbar/home_1.png", @@ -933,12 +927,6 @@ "selectedIconPath": "static/aidex/tabbar/apply_2.png", "text": "工作台" }, - { - "pagePath": "pages/sys/book/index", - "iconPath": "static/aidex/tabbar/book_1.png", - "selectedIconPath": "static/aidex/tabbar/book_2.png", - "text": "通讯录" - }, { "pagePath": "pages/sys/user/index", "iconPath": "static/aidex/tabbar/my_1.png", diff --git a/src/pages/storefabric/storeFabricBusinessOutList.vue b/src/pages/storefabric/storeFabricBusinessOutList.vue index b389be0..6f55d78 100644 --- a/src/pages/storefabric/storeFabricBusinessOutList.vue +++ b/src/pages/storefabric/storeFabricBusinessOutList.vue @@ -1,9 +1,28 @@ @@ -68,6 +116,7 @@ import addBtn from '@/components/addBtn/addBtn.vue'; import FabricOutItem from '@/components/card/storeFabricBusinessOutItem.vue'; import { getStatusOptions, + AUDIT_STATUS, AUDIT_STATUS_MAP, BILL_TYPES, BUSINESS_UNIT_TYPE_DYE_FACTORY, @@ -77,6 +126,45 @@ import { } from '@/common/storeFabricBusinessOut'; import { withNameParam } from '@/common/remoteSelect'; +const FILTER_STORAGE_KEY = 'storeFabricBusinessOutListFilters_v2'; + +const hasFilterValue = (value) => value !== '' && value !== null && value !== undefined; + +const normalizeAuditStatus = (value) => { + if (!hasFilterValue(value)) return ''; + const status = Number(value); + return Number.isNaN(status) ? '' : status; +}; + +const createDefaultFilters = () => ({ + order_no: '', + start_date: '', + end_date: '', + delivery_unit_id: '', + delivery_unit_name: '', + business_unit_id: '', + business_unit_name: '', + audit_status: AUDIT_STATUS.PENDING, +}); + +const normalizeFilters = (value) => { + const filters = createDefaultFilters(); + if (!value || typeof value !== 'object' || Array.isArray(value)) return filters; + + Object.keys(filters).forEach((key) => { + if (key === 'audit_status') return; + if (typeof value[key] === 'string' || typeof value[key] === 'number') { + filters[key] = value[key]; + } + }); + if (!filters.delivery_unit_id) filters.delivery_unit_name = ''; + if (!filters.business_unit_id) filters.business_unit_name = ''; + if (Object.prototype.hasOwnProperty.call(value, 'audit_status')) { + filters.audit_status = normalizeAuditStatus(value.audit_status); + } + return filters; +}; + export default { components: { addBtn, FabricOutItem }, data() { @@ -95,16 +183,8 @@ export default { unitSearchSeq: 0, unitSelectList: [{ value: '', label: '全部' }], billTypeName: (BILL_TYPES[0] || {}).label || '坯布其他出货单', - filters: { - order_no: '', - start_date: '', - end_date: '', - delivery_unit_id: '', - delivery_unit_name: '', - business_unit_id: '', - business_unit_name: '', - audit_status: '', - }, + filters: createDefaultFilters(), + appliedFilters: createDefaultFilters(), statusSelectList: [ { value: '', label: '全部' }, ...getStatusOptions(), @@ -122,20 +202,85 @@ export default { businessUnitLabel() { return this.filters.business_unit_name || ''; }, + statusSelectDefault() { + const index = this.statusSelectList.findIndex( + (item) => String(item.value) === String(this.filters.audit_status) + ); + return [index >= 0 ? index : 0]; + }, + unitSelectDefault() { + const selectedValue = this.unitSelectType === 'delivery' + ? this.filters.delivery_unit_id + : this.filters.business_unit_id; + const index = this.unitSelectList.findIndex( + (item) => String(item.value) === String(selectedValue) + ); + return [index >= 0 ? index : 0]; + }, + hasActiveFilter() { + const filters = this.appliedFilters || {}; + return Boolean( + String(filters.order_no || '').trim() + || filters.start_date + || filters.end_date + || filters.delivery_unit_id + || filters.business_unit_id + || hasFilterValue(filters.audit_status) + ); + }, }, onLoad() { uni.setNavigationBarTitle({ title: '坯布出库列表' }); + this.restoreFilterCache(); uni.getSystemInfo({ success: (res) => { this.scrollHeight = `${res.windowHeight - 50}px`; }, }); - this.loadList(); }, onShow() { this.loadList(); }, methods: { + restoreFilterCache() { + try { + const cached = uni.getStorageSync(FILTER_STORAGE_KEY); + if (!cached || typeof cached !== 'object' || Array.isArray(cached)) { + const filters = createDefaultFilters(); + this.filters = { ...filters }; + this.appliedFilters = { ...filters }; + this.saveFilterCache(); + return; + } + const filters = normalizeFilters(cached); + this.filters = { ...filters }; + this.appliedFilters = { ...filters }; + } catch (e) { + const filters = createDefaultFilters(); + this.filters = { ...filters }; + this.appliedFilters = { ...filters }; + } + }, + saveFilterCache() { + try { + uni.setStorageSync(FILTER_STORAGE_KEY, { ...this.appliedFilters }); + } catch (e) { + // 缓存失败不影响列表筛选 + } + }, + commitFilters() { + const filters = normalizeFilters(this.filters); + this.filters = { ...filters }; + this.appliedFilters = { ...filters }; + this.saveFilterCache(); + this.loadList(); + }, + applySearch() { + this.commitFilters(); + }, + cancelFilterEdit() { + this.filters = { ...this.appliedFilters }; + }, loadDeliveryUnitOptions() { if (this.deliveryUnitOptions.length) return Promise.resolve(this.deliveryUnitOptions); return this.$u.api.businessUnit.list({}) @@ -160,8 +305,23 @@ export default { return this.businessUnitOptions; }); }, - applyUnitSelectList(list) { + applyUnitSelectList(list, preserveSelected = true) { const rows = Array.isArray(list) ? list.slice() : []; + if (preserveSelected) { + const isDelivery = this.unitSelectType === 'delivery'; + const selectedValue = isDelivery + ? this.filters.delivery_unit_id + : this.filters.business_unit_id; + const selectedLabel = isDelivery + ? this.filters.delivery_unit_name + : this.filters.business_unit_name; + const selectedExists = rows.some( + (item) => String(item.value) === String(selectedValue) + ); + if (selectedValue !== '' && selectedValue !== null && selectedValue !== undefined && !selectedExists) { + rows.unshift({ value: selectedValue, label: selectedLabel || String(selectedValue) }); + } + } this.unitSelectList = [{ value: '', label: '全部' }].concat(rows); }, openUnitSelect(type) { @@ -184,7 +344,7 @@ export default { if (isDelivery) this.deliveryUnitOptions = list; else this.businessUnitOptions = list; } - this.applyUnitSelectList(list); + this.applyUnitSelectList(list, empty); }) .catch((e) => { if (seq !== this.unitSearchSeq) return; @@ -213,10 +373,11 @@ export default { } }, loadList() { + const filters = this.appliedFilters; const params = {}; - if (this.filters.order_no) params.order_no = this.filters.order_no; - if (this.filters.audit_status !== '' && this.filters.audit_status !== null) { - params.audit_status = this.filters.audit_status; + if (filters.order_no) params.order_no = filters.order_no; + if (hasFilterValue(filters.audit_status)) { + params.audit_status = filters.audit_status; } fetchAllOrderList((p) => this.$u.api.gfmOtherDeliveryOrder.list(p), params) .then((rows) => { @@ -250,12 +411,13 @@ export default { }, // 后端列表仅支持 单号/状态 过滤,出仓日期与单位在前端做本地过滤 matchClientFilter(item) { - if (this.filters.start_date && item.out_date < this.filters.start_date) return false; - if (this.filters.end_date && item.out_date > this.filters.end_date) return false; - if (this.filters.delivery_unit_id && String(item.delivery_unit_id) !== String(this.filters.delivery_unit_id)) { + const filters = this.appliedFilters; + if (filters.start_date && item.out_date < filters.start_date) return false; + if (filters.end_date && item.out_date > filters.end_date) return false; + if (filters.delivery_unit_id && String(item.delivery_unit_id) !== String(filters.delivery_unit_id)) { return false; } - if (this.filters.business_unit_id && String(item.business_unit_id) !== String(this.filters.business_unit_id)) { + if (filters.business_unit_id && String(item.business_unit_id) !== String(filters.business_unit_id)) { return false; } return true; @@ -268,37 +430,20 @@ export default { uni.navigateTo({ url: `./storeFabricBusinessOutView?id=${item.id}` }); }, openStatusSelect() { this.statusSelectShow = true; }, - onStatusConfirm(e) { this.filters.audit_status = e[0].value; }, + onStatusConfirm(e) { + this.filters.audit_status = normalizeAuditStatus((e[0] || {}).value); + }, resetFilter() { - this.filters = { - order_no: '', - start_date: '', - end_date: '', - delivery_unit_id: '', - delivery_unit_name: '', - business_unit_id: '', - business_unit_name: '', - audit_status: '', - }; + this.filters = createDefaultFilters(); }, applyFilter() { + this.commitFilters(); this.filterShow = false; - this.loadList(); }, }, }; - diff --git a/src/pages/storegoods/storeGoodsProcessInList.vue b/src/pages/storegoods/storeGoodsProcessInList.vue index 4ec64a6..4d77b11 100644 --- a/src/pages/storegoods/storeGoodsProcessInList.vue +++ b/src/pages/storegoods/storeGoodsProcessInList.vue @@ -1,9 +1,12 @@ @@ -56,6 +61,7 @@ import addBtn from '@/components/addBtn/addBtn.vue'; import ProcessInItem from '@/components/card/storeGoodsProcessInItem.vue'; import { getStatusOptions, + AUDIT_STATUS, AUDIT_STATUS_MAP, BUSINESS_UNIT_TYPE_PROCESS, WAREHOUSE_TYPE_FINISHED, @@ -64,9 +70,11 @@ import { fetchAllOrderList, } from '@/common/storeGoodsProcessIn'; import { withNameParam } from '@/common/remoteSelect'; +import listFilterMixin from '@/mixins/listFilterMixin'; export default { components: { addBtn, ProcessInItem }, + mixins: [listFilterMixin], data() { return { list: [], @@ -83,13 +91,14 @@ export default { selectSearching: false, unitSearchSeq: 0, unitSelectList: [{ value: '', label: '全部' }], + filterStorageKey: 'storeGoodsProcessInListFilters_v2', filters: { order_no: '', process_unit_id: '', process_name: '', warehouse_id: '', warehouse_name: '', - audit_status: '', + audit_status: AUDIT_STATUS.PENDING, }, statusSelectList: [ { value: '', label: '全部' }, @@ -111,6 +120,7 @@ export default { }, onLoad() { uni.setNavigationBarTitle({ title: '加工进仓列表' }); + this.restoreFilterCache(); uni.getSystemInfo({ success: (res) => { this.scrollHeight = `${res.windowHeight - 50}px`; @@ -121,6 +131,16 @@ export default { this.loadList(); }, methods: { + createDefaultFilters() { + return { + order_no: '', + process_unit_id: '', + process_name: '', + warehouse_id: '', + warehouse_name: '', + audit_status: AUDIT_STATUS.PENDING, + }; + }, loadProcessUnitOptions() { if (this.processUnitOptions.length) return Promise.resolve(this.processUnitOptions); return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_PROCESS }) @@ -145,10 +165,6 @@ export default { return this.warehouseOptions; }); }, - applyUnitSelectList(list) { - const rows = Array.isArray(list) ? list.slice() : []; - this.unitSelectList = [{ value: '', label: '全部' }].concat(rows); - }, openUnitSelect(type) { this.unitSelectType = type; const cache = type === 'warehouse' ? this.warehouseOptions : this.processUnitOptions; @@ -170,7 +186,7 @@ export default { if (type === 'warehouse') this.warehouseOptions = list; else this.processUnitOptions = list; } - this.applyUnitSelectList(list); + this.applyUnitSelectList(list, empty); }).catch((e) => { if (seq !== this.unitSearchSeq) return; uni.showToast({ title: (e && e.message) || '搜索失败', icon: 'none' }); @@ -199,12 +215,13 @@ export default { loadList() { if (this.listLoading) return; this.listLoading = true; + const filters = this.appliedFilters || this.filters; const params = {}; - if (this.filters.order_no) params.order_no = this.filters.order_no; - if (this.filters.process_unit_id) params.process_unit_id = this.filters.process_unit_id; - if (this.filters.warehouse_id) params.warehouse_id = this.filters.warehouse_id; - if (this.filters.audit_status !== '' && this.filters.audit_status !== null) { - params.audit_status = this.filters.audit_status; + if (filters.order_no) params.order_no = filters.order_no; + if (filters.process_unit_id) params.process_unit_id = filters.process_unit_id; + if (filters.warehouse_id) params.warehouse_id = filters.warehouse_id; + if (this.hasFilterValue(filters.audit_status)) { + params.audit_status = filters.audit_status; } fetchAllOrderList((p) => this.$u.api.fpmProcessInOrder.list(p), params) .then((rows) => { @@ -249,33 +266,10 @@ export default { uni.navigateTo({ url: `./${page}?id=${item.id}` }); }, openStatusSelect() { this.statusSelectShow = true; }, - onStatusConfirm(e) { this.filters.audit_status = e[0].value; }, - resetFilter() { - this.filters = { - order_no: '', - process_unit_id: '', - process_name: '', - warehouse_id: '', - warehouse_name: '', - audit_status: '', - }; - }, - applyFilter() { - this.filterShow = false; - this.loadList(); - }, }, }; - diff --git a/src/pages/storegoods/storeGoodsProcessOutList.vue b/src/pages/storegoods/storeGoodsProcessOutList.vue index d9f573a..8bbf673 100644 --- a/src/pages/storegoods/storeGoodsProcessOutList.vue +++ b/src/pages/storegoods/storeGoodsProcessOutList.vue @@ -1,9 +1,12 @@ @@ -56,6 +61,7 @@ import addBtn from '@/components/addBtn/addBtn.vue'; import ProcessOutItem from '@/components/card/storeGoodsProcessOutItem.vue'; import { getStatusOptions, + AUDIT_STATUS, AUDIT_STATUS_MAP, BUSINESS_UNIT_TYPE_PROCESS, WAREHOUSE_TYPE_FINISHED, @@ -64,9 +70,11 @@ import { fetchAllOrderList, } from '@/common/storeGoodsProcessOut'; import { withNameParam } from '@/common/remoteSelect'; +import listFilterMixin from '@/mixins/listFilterMixin'; export default { components: { addBtn, ProcessOutItem }, + mixins: [listFilterMixin], data() { return { list: [], @@ -83,13 +91,14 @@ export default { selectSearching: false, unitSearchSeq: 0, unitSelectList: [{ value: '', label: '全部' }], + filterStorageKey: 'storeGoodsProcessOutListFilters_v2', filters: { order_no: '', process_unit_id: '', process_name: '', warehouse_id: '', warehouse_name: '', - audit_status: '', + audit_status: AUDIT_STATUS.PENDING, }, statusSelectList: [ { value: '', label: '全部' }, @@ -111,6 +120,7 @@ export default { }, onLoad() { uni.setNavigationBarTitle({ title: '加工出仓列表' }); + this.restoreFilterCache(); uni.getSystemInfo({ success: (res) => { this.scrollHeight = `${res.windowHeight - 50}px`; @@ -121,6 +131,16 @@ export default { this.loadList(); }, methods: { + createDefaultFilters() { + return { + order_no: '', + process_unit_id: '', + process_name: '', + warehouse_id: '', + warehouse_name: '', + audit_status: AUDIT_STATUS.PENDING, + }; + }, loadProcessUnitOptions() { if (this.processUnitOptions.length) return Promise.resolve(this.processUnitOptions); return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_PROCESS }) @@ -145,10 +165,6 @@ export default { return this.warehouseOptions; }); }, - applyUnitSelectList(list) { - const rows = Array.isArray(list) ? list.slice() : []; - this.unitSelectList = [{ value: '', label: '全部' }].concat(rows); - }, openUnitSelect(type) { this.unitSelectType = type; const cache = type === 'warehouse' ? this.warehouseOptions : this.processUnitOptions; @@ -170,7 +186,7 @@ export default { if (type === 'warehouse') this.warehouseOptions = list; else this.processUnitOptions = list; } - this.applyUnitSelectList(list); + this.applyUnitSelectList(list, empty); }).catch((e) => { if (seq !== this.unitSearchSeq) return; uni.showToast({ title: (e && e.message) || '搜索失败', icon: 'none' }); @@ -199,12 +215,13 @@ export default { loadList() { if (this.listLoading) return; this.listLoading = true; + const filters = this.appliedFilters || this.filters; const params = {}; - if (this.filters.order_no) params.order_no = this.filters.order_no; - if (this.filters.process_unit_id) params.process_unit_id = this.filters.process_unit_id; - if (this.filters.warehouse_id) params.warehouse_id = this.filters.warehouse_id; - if (this.filters.audit_status !== '' && this.filters.audit_status !== null) { - params.audit_status = this.filters.audit_status; + if (filters.order_no) params.order_no = filters.order_no; + if (filters.process_unit_id) params.process_unit_id = filters.process_unit_id; + if (filters.warehouse_id) params.warehouse_id = filters.warehouse_id; + if (this.hasFilterValue(filters.audit_status)) { + params.audit_status = filters.audit_status; } fetchAllOrderList((p) => this.$u.api.fpmProcessOutOrder.list(p), params) .then((rows) => { @@ -251,33 +268,10 @@ export default { uni.navigateTo({ url: `./${page}?id=${item.id}` }); }, openStatusSelect() { this.statusSelectShow = true; }, - onStatusConfirm(e) { this.filters.audit_status = e[0].value; }, - resetFilter() { - this.filters = { - order_no: '', - process_unit_id: '', - process_name: '', - warehouse_id: '', - warehouse_name: '', - audit_status: '', - }; - }, - applyFilter() { - this.filterShow = false; - this.loadList(); - }, }, }; - diff --git a/src/pages/storegoods/storeGoodsProcessReturnInList.vue b/src/pages/storegoods/storeGoodsProcessReturnInList.vue index 12a1be1..cebbbc5 100644 --- a/src/pages/storegoods/storeGoodsProcessReturnInList.vue +++ b/src/pages/storegoods/storeGoodsProcessReturnInList.vue @@ -1,9 +1,12 @@ @@ -56,6 +61,7 @@ import addBtn from '@/components/addBtn/addBtn.vue'; import ProcessReturnInItem from '@/components/card/storeGoodsProcessReturnInItem.vue'; import { getStatusOptions, + AUDIT_STATUS, AUDIT_STATUS_MAP, BUSINESS_UNIT_TYPE_PROCESS, WAREHOUSE_TYPE_FINISHED, @@ -64,9 +70,11 @@ import { fetchAllOrderList, } from '@/common/storeGoodsProcessReturnIn'; import { withNameParam } from '@/common/remoteSelect'; +import listFilterMixin from '@/mixins/listFilterMixin'; export default { components: { addBtn, ProcessReturnInItem }, + mixins: [listFilterMixin], data() { return { list: [], @@ -83,13 +91,14 @@ export default { selectSearching: false, unitSearchSeq: 0, unitSelectList: [{ value: '', label: '全部' }], + filterStorageKey: 'storeGoodsProcessReturnInListFilters_v2', filters: { order_no: '', process_unit_id: '', process_name: '', warehouse_id: '', warehouse_name: '', - audit_status: '', + audit_status: AUDIT_STATUS.PENDING, }, statusSelectList: [ { value: '', label: '全部' }, @@ -111,6 +120,7 @@ export default { }, onLoad() { uni.setNavigationBarTitle({ title: '加工退货进仓列表' }); + this.restoreFilterCache(); uni.getSystemInfo({ success: (res) => { this.scrollHeight = `${res.windowHeight - 50}px`; @@ -121,6 +131,16 @@ export default { this.loadList(); }, methods: { + createDefaultFilters() { + return { + order_no: '', + process_unit_id: '', + process_name: '', + warehouse_id: '', + warehouse_name: '', + audit_status: AUDIT_STATUS.PENDING, + }; + }, loadProcessUnitOptions() { if (this.processUnitOptions.length) return Promise.resolve(this.processUnitOptions); return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_PROCESS }) @@ -145,10 +165,6 @@ export default { return this.warehouseOptions; }); }, - applyUnitSelectList(list) { - const rows = Array.isArray(list) ? list.slice() : []; - this.unitSelectList = [{ value: '', label: '全部' }].concat(rows); - }, openUnitSelect(type) { this.unitSelectType = type; const cache = type === 'warehouse' ? this.warehouseOptions : this.processUnitOptions; @@ -170,7 +186,7 @@ export default { if (type === 'warehouse') this.warehouseOptions = list; else this.processUnitOptions = list; } - this.applyUnitSelectList(list); + this.applyUnitSelectList(list, empty); }).catch((e) => { if (seq !== this.unitSearchSeq) return; uni.showToast({ title: (e && e.message) || '搜索失败', icon: 'none' }); @@ -199,12 +215,13 @@ export default { loadList() { if (this.listLoading) return; this.listLoading = true; + const filters = this.appliedFilters || this.filters; const params = {}; - if (this.filters.order_no) params.order_no = this.filters.order_no; - if (this.filters.process_unit_id) params.supplier_id = this.filters.process_unit_id; - if (this.filters.warehouse_id) params.warehouse_id = this.filters.warehouse_id; - if (this.filters.audit_status !== '' && this.filters.audit_status !== null) { - params.audit_status = this.filters.audit_status; + if (filters.order_no) params.order_no = filters.order_no; + if (filters.process_unit_id) params.supplier_id = filters.process_unit_id; + if (filters.warehouse_id) params.warehouse_id = filters.warehouse_id; + if (this.hasFilterValue(filters.audit_status)) { + params.audit_status = filters.audit_status; } fetchAllOrderList((p) => this.$u.api.fpmProcessReturnInOrder.list(p), params) .then((rows) => { @@ -249,33 +266,10 @@ export default { uni.navigateTo({ url: `./${page}?id=${item.id}` }); }, openStatusSelect() { this.statusSelectShow = true; }, - onStatusConfirm(e) { this.filters.audit_status = e[0].value; }, - resetFilter() { - this.filters = { - order_no: '', - process_unit_id: '', - process_name: '', - warehouse_id: '', - warehouse_name: '', - audit_status: '', - }; - }, - applyFilter() { - this.filterShow = false; - this.loadList(); - }, }, }; - diff --git a/src/pages/storegoods/storeGoodsPurchaseInList.vue b/src/pages/storegoods/storeGoodsPurchaseInList.vue index 574d0ab..8370249 100644 --- a/src/pages/storegoods/storeGoodsPurchaseInList.vue +++ b/src/pages/storegoods/storeGoodsPurchaseInList.vue @@ -1,9 +1,12 @@ @@ -56,6 +61,7 @@ import addBtn from '@/components/addBtn/addBtn.vue'; import PurchaseInItem from '@/components/card/storeGoodsPurchaseInItem.vue'; import { getStatusOptions, + AUDIT_STATUS, AUDIT_STATUS_MAP, BUSINESS_UNIT_TYPE_PRODUCT_SUPPLIER, WAREHOUSE_TYPE_FINISHED, @@ -64,9 +70,11 @@ import { fetchAllOrderList, } from '@/common/storeGoodsPurchaseIn'; import { withNameParam } from '@/common/remoteSelect'; +import listFilterMixin from '@/mixins/listFilterMixin'; export default { components: { addBtn, PurchaseInItem }, + mixins: [listFilterMixin], data() { return { list: [], @@ -83,13 +91,14 @@ export default { selectSearching: false, unitSearchSeq: 0, unitSelectList: [{ value: '', label: '全部' }], + filterStorageKey: 'storeGoodsPurchaseInListFilters_v2', filters: { order_no: '', supplier_id: '', supplier_name: '', warehouse_id: '', warehouse_name: '', - audit_status: '', + audit_status: AUDIT_STATUS.PENDING, }, statusSelectList: [ { value: '', label: '全部' }, @@ -111,6 +120,7 @@ export default { }, onLoad() { uni.setNavigationBarTitle({ title: '成品采购进仓' }); + this.restoreFilterCache(); uni.getSystemInfo({ success: (res) => { this.scrollHeight = `${res.windowHeight - 50}px`; @@ -121,6 +131,16 @@ export default { this.loadList(); }, methods: { + createDefaultFilters() { + return { + order_no: '', + supplier_id: '', + supplier_name: '', + warehouse_id: '', + warehouse_name: '', + audit_status: AUDIT_STATUS.PENDING, + }; + }, loadSupplierOptions() { if (this.supplierOptions.length) return Promise.resolve(this.supplierOptions); return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_PRODUCT_SUPPLIER }) @@ -145,10 +165,6 @@ export default { return this.warehouseOptions; }); }, - applyUnitSelectList(list) { - const rows = Array.isArray(list) ? list.slice() : []; - this.unitSelectList = [{ value: '', label: '全部' }].concat(rows); - }, openUnitSelect(type) { this.unitSelectType = type; const cache = type === 'warehouse' ? this.warehouseOptions : this.supplierOptions; @@ -170,7 +186,7 @@ export default { if (type === 'warehouse') this.warehouseOptions = list; else this.supplierOptions = list; } - this.applyUnitSelectList(list); + this.applyUnitSelectList(list, empty); }).catch((e) => { if (seq !== this.unitSearchSeq) return; uni.showToast({ title: (e && e.message) || '搜索失败', icon: 'none' }); @@ -199,12 +215,13 @@ export default { loadList() { if (this.listLoading) return; this.listLoading = true; + const filters = this.appliedFilters || this.filters; const params = {}; - if (this.filters.order_no) params.order_no = this.filters.order_no; - if (this.filters.supplier_id) params.supplier_id = this.filters.supplier_id; - if (this.filters.warehouse_id) params.warehouse_id = this.filters.warehouse_id; - if (this.filters.audit_status !== '' && this.filters.audit_status !== null) { - params.audit_status = this.filters.audit_status; + if (filters.order_no) params.order_no = filters.order_no; + if (filters.supplier_id) params.supplier_id = filters.supplier_id; + if (filters.warehouse_id) params.warehouse_id = filters.warehouse_id; + if (this.hasFilterValue(filters.audit_status)) { + params.audit_status = filters.audit_status; } fetchAllOrderList((p) => this.$u.api.fpmPrcInOrder.list(p), params) .then((rows) => { @@ -249,33 +266,10 @@ export default { uni.navigateTo({ url: `./${page}?id=${item.id}` }); }, openStatusSelect() { this.statusSelectShow = true; }, - onStatusConfirm(e) { this.filters.audit_status = e[0].value; }, - resetFilter() { - this.filters = { - order_no: '', - supplier_id: '', - supplier_name: '', - warehouse_id: '', - warehouse_name: '', - audit_status: '', - }; - }, - applyFilter() { - this.filterShow = false; - this.loadList(); - }, }, }; -