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 LIST_PAGE_SIZE = 100;
|
||||||
|
|
||||||
|
/** 往来单位类型:织厂(接收单位下拉筛选) */
|
||||||
|
export const BUSINESS_UNIT_TYPE_KNITTING_FACTORY = 11;
|
||||||
|
|
||||||
export function getStatusOptions() {
|
export function getStatusOptions() {
|
||||||
return Object.keys(AUDIT_STATUS_MAP).map((value) => ({
|
return Object.keys(AUDIT_STATUS_MAP).map((value) => ({
|
||||||
value,
|
value,
|
||||||
|
|||||||
@ -70,6 +70,7 @@ import {
|
|||||||
getStatusOptions,
|
getStatusOptions,
|
||||||
AUDIT_STATUS_MAP,
|
AUDIT_STATUS_MAP,
|
||||||
BILL_TYPES,
|
BILL_TYPES,
|
||||||
|
BUSINESS_UNIT_TYPE_KNITTING_FACTORY,
|
||||||
formatRoll,
|
formatRoll,
|
||||||
mapToSelectOptions,
|
mapToSelectOptions,
|
||||||
fetchAllOrderList,
|
fetchAllOrderList,
|
||||||
@ -86,7 +87,8 @@ export default {
|
|||||||
statusSelectShow: false,
|
statusSelectShow: false,
|
||||||
unitSelectShow: false,
|
unitSelectShow: false,
|
||||||
unitSelectType: '',
|
unitSelectType: '',
|
||||||
unitOptions: [],
|
deliveryUnitOptions: [],
|
||||||
|
businessUnitOptions: [],
|
||||||
unitOptionsLoading: false,
|
unitOptionsLoading: false,
|
||||||
billTypeName: (BILL_TYPES[0] || {}).label || '坯布其他出货单',
|
billTypeName: (BILL_TYPES[0] || {}).label || '坯布其他出货单',
|
||||||
filters: {
|
filters: {
|
||||||
@ -117,7 +119,8 @@ export default {
|
|||||||
return this.filters.business_unit_name || '';
|
return this.filters.business_unit_name || '';
|
||||||
},
|
},
|
||||||
unitSelectList() {
|
unitSelectList() {
|
||||||
return [{ value: '', label: '全部' }, ...this.unitOptions];
|
const options = this.unitSelectType === 'delivery' ? this.deliveryUnitOptions : this.businessUnitOptions;
|
||||||
|
return [{ value: '', label: '全部' }, ...options];
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
@ -127,37 +130,51 @@ export default {
|
|||||||
this.scrollHeight = `${res.windowHeight - 50}px`;
|
this.scrollHeight = `${res.windowHeight - 50}px`;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
this.loadUnitOptions();
|
|
||||||
this.loadList();
|
this.loadList();
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.loadList();
|
this.loadList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
loadUnitOptions() {
|
loadDeliveryUnitOptions() {
|
||||||
if (this.unitOptions.length || this.unitOptionsLoading) return Promise.resolve(this.unitOptions);
|
if (this.deliveryUnitOptions.length) return Promise.resolve(this.deliveryUnitOptions);
|
||||||
this.unitOptionsLoading = true;
|
|
||||||
return this.$u.api.businessUnit.list({})
|
return this.$u.api.businessUnit.list({})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.unitOptions = mapToSelectOptions(res);
|
this.deliveryUnitOptions = mapToSelectOptions(res);
|
||||||
return this.unitOptions;
|
return this.deliveryUnitOptions;
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.unitOptions = [];
|
this.deliveryUnitOptions = [];
|
||||||
return this.unitOptions;
|
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;
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.catch(() => {
|
||||||
this.unitOptionsLoading = false;
|
this.businessUnitOptions = [];
|
||||||
|
return this.businessUnitOptions;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
openUnitSelect(type) {
|
openUnitSelect(type) {
|
||||||
this.loadUnitOptions().then((list) => {
|
if (this.unitOptionsLoading) return;
|
||||||
|
this.unitOptionsLoading = true;
|
||||||
|
const loadFn = type === 'delivery' ? this.loadDeliveryUnitOptions : this.loadBusinessUnitOptions;
|
||||||
|
loadFn.call(this)
|
||||||
|
.then((list) => {
|
||||||
if (!list.length) {
|
if (!list.length) {
|
||||||
uni.showToast({ title: '暂无可选单位', icon: 'none' });
|
uni.showToast({ title: '暂无可选单位', icon: 'none' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.unitSelectType = type;
|
this.unitSelectType = type;
|
||||||
this.unitSelectShow = true;
|
this.unitSelectShow = true;
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.unitOptionsLoading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
openDeliveryUnitSelect() {
|
openDeliveryUnitSelect() {
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import scanMixin from '@/common/scanMixin.js';
|
|||||||
import {
|
import {
|
||||||
AUDIT_STATUS_MAP,
|
AUDIT_STATUS_MAP,
|
||||||
BILL_TYPES,
|
BILL_TYPES,
|
||||||
|
BUSINESS_UNIT_TYPE_KNITTING_FACTORY,
|
||||||
normalizeOrder,
|
normalizeOrder,
|
||||||
mapToSelectOptions,
|
mapToSelectOptions,
|
||||||
getFineCodeScanCode,
|
getFineCodeScanCode,
|
||||||
@ -135,7 +136,7 @@ export default {
|
|||||||
},
|
},
|
||||||
ensureBusinessUnitOptions() {
|
ensureBusinessUnitOptions() {
|
||||||
if (this.businessUnitOptions.length) return Promise.resolve(this.businessUnitOptions);
|
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) => {
|
.then((res) => {
|
||||||
this.businessUnitOptions = mapToSelectOptions(res);
|
this.businessUnitOptions = mapToSelectOptions(res);
|
||||||
return this.businessUnitOptions;
|
return this.businessUnitOptions;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user