/** * 客户主表模型 */ const Customer = { /** * 模型字段定义 */ fields: { customer_id: 'number', customer_name: 'string', create_date: 'date', last_order_date: 'date', last_followup_date: 'date', followup_status: 'string', responsible_person: 'string', department: 'string', assistant: 'string', region: 'string', customer_type: 'string', customer_level: 'string', basic_requirements: 'string', specifications: 'string', created_at: 'date', updated_at: 'date' }, /** * 创建客户实例 * @param {Object} data - 数据对象 * @returns {Object} - 客户实例 */ create: function(data) { return { customer_id: data.customer_id || null, customer_name: data.customer_name || '', create_date: data.create_date || null, last_order_date: data.last_order_date || null, last_followup_date: data.last_followup_date || null, followup_status: data.followup_status || '', responsible_person: data.responsible_person || null, department: data.department || null, assistant: data.assistant || null, region: data.region || null, customer_type: data.customer_type || null, customer_level: data.customer_level || null, basic_requirements: data.basic_requirements || '', specifications: data.specifications || '', created_at: data.created_at || new Date(), updated_at: data.updated_at || new Date() }; } }; // 导出为全局变量 window.Customer = Customer;