import { getCustomerList, getSupplierList } from '../api/index' import { getAppInstance } from './app'; // 获取客户数据 export async function getCustomerData() { const app = getAppInstance(); const res = await getCustomerList({ isGetAll: true, orderBy: 'sortnum asc' }).catch(() => {}); if (res && res.data.list) { app.globalData.customerList = res.data.list.map(item => { item.label = item.name; item.value = item.id; return item; }); app.globalData.customerList.unshift({label: '全部',value: 0}) }else { app.globalData.customerList = []; } } // 获取供应商数据 export async function getSupplierData() { const app = getAppInstance(); const res = await getSupplierList({ isGetAll: true, orderBy: 'sortnum asc' }).catch(() => {}); if (res && res.data.list) { app.globalData.supplierList = res.data.list.map(item => { item.label = item.name; item.value = item.id; return item; }); app.globalData.supplierList.unshift({label: '全部',value: 0}) }else { app.globalData.supplierList = []; } }