|
@@ -276,18 +276,12 @@ const assignForm = reactive({
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// 供应商列表
|
|
// 供应商列表
|
|
|
-const supplierList = ref<any[]>([
|
|
|
|
|
- { id: '1', name: '供应商A' },
|
|
|
|
|
- { id: '2', name: '供应商B' },
|
|
|
|
|
- { id: '3', name: '供应商C' }
|
|
|
|
|
-]);
|
|
|
|
|
|
|
+const supplierList = ref<any[]>([]);
|
|
|
|
|
+// 缓存的供应商列表(打开抽屉时预先加载)
|
|
|
|
|
+const cachedSupplierList = ref<any[]>([]);
|
|
|
|
|
|
|
|
// 伙伴商列表
|
|
// 伙伴商列表
|
|
|
-const partnerList = ref<any[]>([
|
|
|
|
|
- { id: '1', name: '伙伴商A' },
|
|
|
|
|
- { id: '2', name: '伙伴商B' },
|
|
|
|
|
- { id: '3', name: '伙伴商C' }
|
|
|
|
|
-]);
|
|
|
|
|
|
|
+const partnerList = ref<any[]>([]);
|
|
|
|
|
|
|
|
// 标签页
|
|
// 标签页
|
|
|
const activeTab = ref('pending');
|
|
const activeTab = ref('pending');
|
|
@@ -337,12 +331,31 @@ const open = async (orderId: string | number) => {
|
|
|
|
|
|
|
|
// 加载分配记录
|
|
// 加载分配记录
|
|
|
await loadAssignRecords(orderId);
|
|
await loadAssignRecords(orderId);
|
|
|
|
|
+
|
|
|
|
|
+ // 预加载供应商数据以加快后续操作响应
|
|
|
|
|
+ loadSupplierData();
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
proxy?.$modal.msgError('获取订单信息失败');
|
|
proxy?.$modal.msgError('获取订单信息失败');
|
|
|
drawer.visible = false;
|
|
drawer.visible = false;
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+/** 预加载供应商数据 */
|
|
|
|
|
+const loadSupplierData = async () => {
|
|
|
|
|
+ if (cachedSupplierList.value.length > 0) return;
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res: any = await listInfo({ pageNum: 1, pageSize: 1000 });
|
|
|
|
|
+ const list = res.rows || res.data || [];
|
|
|
|
|
+ cachedSupplierList.value = list.map((item: any) => ({
|
|
|
|
|
+ ...item,
|
|
|
|
|
+ id: item.id,
|
|
|
|
|
+ name: item.enterpriseName || item.supplierName || item.id
|
|
|
|
|
+ }));
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('获取供应商列表失败', error);
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
/** 加载分配记录 */
|
|
/** 加载分配记录 */
|
|
|
const loadAssignRecords = async (orderId: string | number) => {
|
|
const loadAssignRecords = async (orderId: string | number) => {
|
|
|
try {
|
|
try {
|
|
@@ -506,6 +519,12 @@ const submitAssign = async () => {
|
|
|
const handleTargetTypeChange = () => {
|
|
const handleTargetTypeChange = () => {
|
|
|
// 切换类型时清空已选择的目标
|
|
// 切换类型时清空已选择的目标
|
|
|
assignForm.targetId = '';
|
|
assignForm.targetId = '';
|
|
|
|
|
+
|
|
|
|
|
+ if (assignForm.targetType === 'srm') {
|
|
|
|
|
+ supplierList.value = cachedSupplierList.value;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 处理伙伴商等其他情况(目前留空或使用别的缓存)
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
defineExpose({
|
|
defineExpose({
|