fix(storefabric): 限制接收单位下拉仅显示织厂类型
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
530ca0c3ad
commit
02f192cac6
@ -69,6 +69,9 @@ export const BILL_TYPES = [
|
||||
/** 列表分页拉取每页条数 */
|
||||
export const LIST_PAGE_SIZE = 100;
|
||||
|
||||
/** 往来单位类型:织厂(接收单位下拉筛选) */
|
||||
export const BUSINESS_UNIT_TYPE_KNITTING_FACTORY = 11;
|
||||
|
||||
export function getStatusOptions() {
|
||||
return Object.keys(AUDIT_STATUS_MAP).map((value) => ({
|
||||
value,
|
||||
|
||||
@ -70,6 +70,7 @@ import {
|
||||
getStatusOptions,
|
||||
AUDIT_STATUS_MAP,
|
||||
BILL_TYPES,
|
||||
BUSINESS_UNIT_TYPE_KNITTING_FACTORY,
|
||||
formatRoll,
|
||||
mapToSelectOptions,
|
||||
fetchAllOrderList,
|
||||
@ -86,7 +87,8 @@ export default {
|
||||
statusSelectShow: false,
|
||||
unitSelectShow: false,
|
||||
unitSelectType: '',
|
||||
unitOptions: [],
|
||||
deliveryUnitOptions: [],
|
||||
businessUnitOptions: [],
|
||||
unitOptionsLoading: false,
|
||||
billTypeName: (BILL_TYPES[0] || {}).label || '坯布其他出货单',
|
||||
filters: {
|
||||
@ -117,7 +119,8 @@ export default {
|
||||
return this.filters.business_unit_name || '';
|
||||
},
|
||||
unitSelectList() {
|
||||
return [{ value: '', label: '全部' }, ...this.unitOptions];
|
||||
const options = this.unitSelectType === 'delivery' ? this.deliveryUnitOptions : this.businessUnitOptions;
|
||||
return [{ value: '', label: '全部' }, ...options];
|
||||
},
|
||||
},
|
||||
onLoad() {
|
||||
@ -127,39 +130,53 @@ export default {
|
||||
this.scrollHeight = `${res.windowHeight - 50}px`;
|
||||
},
|
||||
});
|
||||
this.loadUnitOptions();
|
||||
this.loadList();
|
||||
},
|
||||
onShow() {
|
||||
this.loadList();
|
||||
},
|
||||
methods: {
|
||||
loadUnitOptions() {
|
||||
if (this.unitOptions.length || this.unitOptionsLoading) return Promise.resolve(this.unitOptions);
|
||||
this.unitOptionsLoading = true;
|
||||
loadDeliveryUnitOptions() {
|
||||
if (this.deliveryUnitOptions.length) return Promise.resolve(this.deliveryUnitOptions);
|
||||
return this.$u.api.businessUnit.list({})
|
||||
.then((res) => {
|
||||
this.unitOptions = mapToSelectOptions(res);
|
||||
return this.unitOptions;
|
||||
this.deliveryUnitOptions = mapToSelectOptions(res);
|
||||
return this.deliveryUnitOptions;
|
||||
})
|
||||
.catch(() => {
|
||||
this.unitOptions = [];
|
||||
return this.unitOptions;
|
||||
this.deliveryUnitOptions = [];
|
||||
return this.deliveryUnitOptions;
|
||||
});
|
||||
},
|
||||
loadBusinessUnitOptions() {
|
||||
if (this.businessUnitOptions.length) return Promise.resolve(this.businessUnitOptions);
|
||||
return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_KNITTING_FACTORY })
|
||||
.then((res) => {
|
||||
this.businessUnitOptions = mapToSelectOptions(res);
|
||||
return this.businessUnitOptions;
|
||||
})
|
||||
.catch(() => {
|
||||
this.businessUnitOptions = [];
|
||||
return this.businessUnitOptions;
|
||||
});
|
||||
},
|
||||
openUnitSelect(type) {
|
||||
if (this.unitOptionsLoading) return;
|
||||
this.unitOptionsLoading = true;
|
||||
const loadFn = type === 'delivery' ? this.loadDeliveryUnitOptions : this.loadBusinessUnitOptions;
|
||||
loadFn.call(this)
|
||||
.then((list) => {
|
||||
if (!list.length) {
|
||||
uni.showToast({ title: '暂无可选单位', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
this.unitSelectType = type;
|
||||
this.unitSelectShow = true;
|
||||
})
|
||||
.finally(() => {
|
||||
this.unitOptionsLoading = false;
|
||||
});
|
||||
},
|
||||
openUnitSelect(type) {
|
||||
this.loadUnitOptions().then((list) => {
|
||||
if (!list.length) {
|
||||
uni.showToast({ title: '暂无可选单位', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
this.unitSelectType = type;
|
||||
this.unitSelectShow = true;
|
||||
});
|
||||
},
|
||||
openDeliveryUnitSelect() {
|
||||
this.openUnitSelect('delivery');
|
||||
},
|
||||
|
||||
@ -13,6 +13,7 @@ import scanMixin from '@/common/scanMixin.js';
|
||||
import {
|
||||
AUDIT_STATUS_MAP,
|
||||
BILL_TYPES,
|
||||
BUSINESS_UNIT_TYPE_KNITTING_FACTORY,
|
||||
normalizeOrder,
|
||||
mapToSelectOptions,
|
||||
getFineCodeScanCode,
|
||||
@ -135,7 +136,7 @@ export default {
|
||||
},
|
||||
ensureBusinessUnitOptions() {
|
||||
if (this.businessUnitOptions.length) return Promise.resolve(this.businessUnitOptions);
|
||||
return this.$u.api.businessUnit.list({})
|
||||
return this.$u.api.businessUnit.list({ unit_type_id: BUSINESS_UNIT_TYPE_KNITTING_FACTORY })
|
||||
.then((res) => {
|
||||
this.businessUnitOptions = mapToSelectOptions(res);
|
||||
return this.businessUnitOptions;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user