|
@@ -128,6 +128,11 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
/**
|
|
|
+ * 过滤后的客户选项列表
|
|
|
+ * @type {CustomerOption[]}
|
|
|
+ */
|
|
|
+ filteredCustomerOptions: [],
|
|
|
+ /**
|
|
|
* 表格数据
|
|
|
* @type {OrderItem[]}
|
|
|
*/
|
|
@@ -341,6 +346,59 @@ export default {
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 加载客户选项(加载所有客户数据)
|
|
|
+ * @returns {Promise<void>}
|
|
|
+ */
|
|
|
+ async loadCustomerOptions() {
|
|
|
+ try {
|
|
|
+ this.customerLoading = true
|
|
|
+ const response = await getCustomerList(1, 1000, {}) // 加载更多数据,或根据实际情况调整
|
|
|
+
|
|
|
+ if (response.data && response.data.success) {
|
|
|
+ const customers = response.data.data.records || []
|
|
|
+ this.customerOptions = customers.map(customer => ({
|
|
|
+ value: customer.Customer_ID.toString(),
|
|
|
+ label: `${customer.Customer_CODE} - ${customer.Customer_NAME}`,
|
|
|
+ customerCode: customer.Customer_CODE,
|
|
|
+ customerName: customer.Customer_NAME,
|
|
|
+ customerId: customer.Customer_ID.toString()
|
|
|
+ }))
|
|
|
+ // 初始化时显示所有选项
|
|
|
+ this.filteredCustomerOptions = [...this.customerOptions]
|
|
|
+ } else {
|
|
|
+ this.customerOptions = []
|
|
|
+ this.filteredCustomerOptions = []
|
|
|
+ this.$message.warning('获取客户列表失败')
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ this.customerOptions = []
|
|
|
+ this.filteredCustomerOptions = []
|
|
|
+ console.error('加载客户选项失败:', error)
|
|
|
+ this.$message.error('加载客户选项失败,请稍后重试')
|
|
|
+ } finally {
|
|
|
+ this.customerLoading = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 本地过滤客户选项
|
|
|
+ * @param {string} query - 搜索关键词
|
|
|
+ * @returns {void}
|
|
|
+ */
|
|
|
+ filterCustomers(query) {
|
|
|
+ if (query) {
|
|
|
+ const keyword = query.toLowerCase()
|
|
|
+ this.filteredCustomerOptions = this.customerOptions.filter(option => {
|
|
|
+ return option.label.toLowerCase().includes(keyword) ||
|
|
|
+ option.customerCode.toLowerCase().includes(keyword) ||
|
|
|
+ option.customerName.toLowerCase().includes(keyword)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.filteredCustomerOptions = [...this.customerOptions]
|
|
|
+ }
|
|
|
+ },
|
|
|
/**
|
|
|
* 获取订单类型标签
|
|
|
* @param {OrderType} orderType - 订单类型值
|