@@ -8,6 +8,8 @@
|
||||
*/
|
||||
import util from '@/common/util';
|
||||
import scanMixin from '@/common/scanMixin.js';
|
||||
import remoteSelectMixin from '@/common/remoteSelectMixin.js';
|
||||
import { withNameParam } from '@/common/remoteSelect';
|
||||
import { initTts, speak } from '@/common/tts.js';
|
||||
import {
|
||||
AUDIT_STATUS_MAP,
|
||||
@@ -36,7 +38,7 @@ import {
|
||||
} from '@/common/storeGoodsProcessIn';
|
||||
|
||||
export default {
|
||||
mixins: [scanMixin],
|
||||
mixins: [scanMixin, remoteSelectMixin],
|
||||
data() {
|
||||
return {
|
||||
pageMode: 'add',
|
||||
@@ -309,6 +311,34 @@ export default {
|
||||
return this.saleSystemOptions;
|
||||
});
|
||||
},
|
||||
fetchRemoteSelectOptions(type, keyword) {
|
||||
const empty = !String(keyword || '').trim();
|
||||
if (type === '加工单位') {
|
||||
return this.$u.api.businessUnit.list(withNameParam({ unit_type_id: BUSINESS_UNIT_TYPE_PROCESS }, keyword))
|
||||
.then((res) => {
|
||||
const list = mapToSelectOptions(res);
|
||||
if (empty) this.processUnitOptions = list;
|
||||
return list;
|
||||
});
|
||||
}
|
||||
if (type === '仓库名称') {
|
||||
return this.$u.api.physicalWarehouse.getDropdownList(withNameParam({ warehouse_type_id: WAREHOUSE_TYPE_FINISHED }, keyword))
|
||||
.then((res) => {
|
||||
const list = mapToSelectOptions(res);
|
||||
if (empty) this.warehouseOptions = list;
|
||||
return list;
|
||||
});
|
||||
}
|
||||
if (type === '营销体系') {
|
||||
return this.$u.api.saleSystem.getDropdownList(withNameParam({}, keyword))
|
||||
.then((res) => {
|
||||
const list = mapToSelectOptions(res);
|
||||
if (empty) this.saleSystemOptions = list;
|
||||
return list;
|
||||
});
|
||||
}
|
||||
return Promise.resolve([]);
|
||||
},
|
||||
applyDefaultWarehouse() {
|
||||
const app = getApp();
|
||||
const picked = pickDefaultWarehouse(
|
||||
@@ -390,30 +420,22 @@ export default {
|
||||
},
|
||||
pickerSelectFun(type) {
|
||||
if (!this.headerEditable) return;
|
||||
this.selectType = type;
|
||||
const openPicker = (list) => {
|
||||
if (!list.length) {
|
||||
if (type === '进仓类型') {
|
||||
this.selectType = type;
|
||||
if (!this.inOrderTypeOptions.length) {
|
||||
this.showError('暂无可选数据');
|
||||
return;
|
||||
}
|
||||
this.selectList = list;
|
||||
this.selectList = this.inOrderTypeOptions;
|
||||
this.selectShow = true;
|
||||
};
|
||||
if (type === '进仓类型') {
|
||||
openPicker(this.inOrderTypeOptions);
|
||||
} else if (type === '加工单位') {
|
||||
this.ensureProcessUnitOptions()
|
||||
.then(openPicker)
|
||||
.catch((e) => this.showError(e.message || '加载加工单位失败'));
|
||||
} else if (type === '仓库名称') {
|
||||
this.ensureWarehouseOptions()
|
||||
.then(openPicker)
|
||||
.catch((e) => this.showError(e.message || '加载仓库失败'));
|
||||
} else if (type === '营销体系') {
|
||||
this.ensureSaleSystemOptions()
|
||||
.then(openPicker)
|
||||
.catch((e) => this.showError(e.message || '加载营销体系失败'));
|
||||
return;
|
||||
}
|
||||
const cache = {
|
||||
'加工单位': this.processUnitOptions,
|
||||
'仓库名称': this.warehouseOptions,
|
||||
'营销体系': this.saleSystemOptions,
|
||||
};
|
||||
if (cache[type]) this.openSelectPicker(type, cache[type]);
|
||||
},
|
||||
selectConfirmFun(e) {
|
||||
const item = e[0];
|
||||
|
||||
Reference in New Issue
Block a user