// 【重要】必须使用 const Component 作为组件变量名
// 车辆资产管理 - 车辆管理模块（中后台 Ant Design 原型）

/** 外部样式表路径，构建时可在入口设置 window.VM_STYLESHEET_HREF */
var VM_STYLESHEET_DEFAULT_HREF = 'styles/vehicle-management.css';

function vmEnsureStylesheet() {
	if (typeof document === 'undefined') return;
	var href = (typeof window !== 'undefined' && window.VM_STYLESHEET_HREF) || VM_STYLESHEET_DEFAULT_HREF;
	if (document.getElementById('vm-page-stylesheet')) return;
	var link = document.createElement('link');
	link.id = 'vm-page-stylesheet';
	link.rel = 'stylesheet';
	link.href = href;
	document.head.appendChild(link);
}

function vmSvgIcon(paths, size) {
	return React.createElement('svg', {
		viewBox: '0 0 24 24',
		width: size || 16,
		height: size || 16,
		fill: 'none',
		stroke: 'currentColor',
		strokeWidth: 2,
		strokeLinecap: 'round',
		strokeLinejoin: 'round',
		'aria-hidden': true
	}, paths.map(function (p, i) {
		if (p.tag === 'circle') return React.createElement('circle', { key: i, cx: p.cx, cy: p.cy, r: p.r });
		if (p.tag === 'line') return React.createElement('line', { key: i, x1: p.x1, y1: p.y1, x2: p.x2, y2: p.y2 });
		return React.createElement('path', { key: i, d: p.d });
	}));
}

var VM_ICONS = {
	doc: vmSvgIcon([{ d: 'M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z' }, { d: 'M14 2v6h6' }], 14),
	search: vmSvgIcon([{ tag: 'circle', cx: 11, cy: 11, r: 8 }, { tag: 'line', x1: 21, y1: 21, x2: 16.65, y2: 16.65 }], 14),
	export: vmSvgIcon([{ d: 'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4' }, { d: 'M7 10l5 5 5-5' }, { tag: 'line', x1: 12, y1: 15, x2: 12, y2: 3 }], 14),
	upload: vmSvgIcon([{ d: 'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4' }, { d: 'M17 8l-5-5-5 5' }, { tag: 'line', x1: 12, y1: 3, x2: 12, y2: 15 }], 14),
	back: vmSvgIcon([{ tag: 'line', x1: 19, y1: 12, x2: 5, y2: 12 }, { d: 'M12 19l-7-7 7-7' }], 16),
	truck: vmSvgIcon([{ d: 'M1 3h15v13H1zM16 8h4l3 3v5h-7V8z' }, { tag: 'circle', cx: 5.5, cy: 18.5, r: 2.5 }, { tag: 'circle', cx: 18.5, cy: 18.5, r: 2.5 }], 18),
	empty: vmSvgIcon([{ tag: 'circle', cx: 12, cy: 12, r: 10 }, { tag: 'line', x1: 8, y1: 12, x2: 16, y2: 12 }], 40)
};

function vmMoreIcon() {
	return React.createElement('svg', { viewBox: '0 0 16 16', width: 16, height: 16, fill: 'currentColor', 'aria-hidden': true },
		React.createElement('circle', { cx: 8, cy: 3, r: 1.5 }),
		React.createElement('circle', { cx: 8, cy: 8, r: 1.5 }),
		React.createElement('circle', { cx: 8, cy: 13, r: 1.5 })
	);
}

function vmOperateStatusColor(status) {
	if (status === '租赁') return 'processing';
	if (status === '自营') return 'geekblue';
	if (status === '可运营') return 'success';
	if (status === '待运营') return 'warning';
	if (status === '退出运营') return 'default';
	return 'default';
}

function vmAlertStatusColor(status) {
	if (status === '异常') return 'error';
	if (status === '正常') return 'success';
	return 'default';
}

const Component = function () {
	var useState = React.useState;
	var useMemo = React.useMemo;
	var useCallback = React.useCallback;
	var antd = window.antd;

	var Breadcrumb = antd.Breadcrumb;
	var Cascader = antd.Cascader;
	var Select = antd.Select;
	var Input = antd.Input;
	var Button = antd.Button;
	var Table = antd.Table;
	var Space = antd.Space;
	var Dropdown = antd.Dropdown;
	var Modal = antd.Modal;
	var Upload = antd.Upload;
	var Card = antd.Card;
	var Tabs = antd.Tabs;
	var Tag = antd.Tag;
	var Tooltip = antd.Tooltip;
	var Form = antd.Form;
	var Row = antd.Row;
	var Col = antd.Col;
	var message = antd.message;
	var App = antd.App;

	// 联调后对接权限中心；原型默认 admin 可编辑，改为 'staff' 可验证无权限隐藏
	var CURRENT_USER = { id: 'u_admin', name: '系统管理员', role: 'admin' };
	var isAdmin = CURRENT_USER.role === 'admin';

	// 筛选项状态
	var _region = useState([]);
	var _vehicleType = useState(undefined);
	var _brand = useState(undefined);
	var _model = useState(undefined);
	var _customer = useState(undefined);
	var _department = useState(undefined);
	var _contractNo = useState(undefined);
	var _ownership = useState(undefined);
	var _operateCompany = useState(undefined);
	var _vehicleSource = useState(undefined);
	var _leaseCompany = useState(undefined);

	var _plateFilter = useState('');
	var _selectedRowKeys = useState([]);
	var _uploadModalVisible = useState(false);
	var _confirmModalVisible = useState(false);
	var _ocrLoadingVisible = useState(false);
	var _currentRow = useState(null);
	var _plateForm = useState({ vin: '', plateNo: '' });
	var _plateError = useState('');
	var _detailRecord = useState(null);
	var _detailCardExpanded = useState(false);
	var _detailTab = useState('型号参数');
	var _filterExpanded = useState(false);
	var _requirementModalVisible = useState(false);
	var _inspectImportModalVisible = useState(false);
	var _inspectImportResult = useState(null);
	var _editModalVisible = useState(false);
	var _editRecord = useState(null);
	var _editForm = useState({});

	// 省-市 地区数据（示例）
	var regionOptions = [
		{ value: 'guangdong', label: '广东省', children: [{ value: 'guangzhou', label: '广州市' }, { value: 'shenzhen', label: '深圳市' }] },
		{ value: 'beijing', label: '北京市', children: [{ value: 'beijing', label: '北京市' }] },
		{ value: 'shanghai', label: '上海市', children: [{ value: 'shanghai', label: '上海市' }] }
	];

	// 车辆类型、品牌、型号、客户、部门、合同、登记所有权（模拟下拉数据）
	var vehicleTypeOptions = [{ label: '小型轿车', value: 'type1' }, { label: 'SUV', value: 'type2' }, { label: '厢式货车', value: 'type3' }];
	var brandOptions = [{ label: '比亚迪', value: 'byd' }, { label: '特斯拉', value: 'tsl' }, { label: '蔚来', value: 'nio' }];
	var modelOptions = [{ label: '汉EV', value: 'han' }, { label: 'Model 3', value: 'm3' }, { label: 'ET5', value: 'et5' }];
	var customerOptions = [{ label: '无', value: 'none' }, { label: '客户A', value: 'c1' }, { label: '客户B', value: 'c2' }];
	var departmentOptions = [{ label: '无', value: 'none' }, { label: '华南区', value: 'd1' }, { label: '华东区', value: 'd2' }];
	var contractOptions = [{ label: 'HT-2024-001', value: 'HT-2024-001' }, { label: 'HT-2024-002', value: 'HT-2024-002' }];
	var ownershipOptions = [{ label: '某某租赁公司', value: 'o1' }, { label: '某某科技有限公司', value: 'o2' }];
	var operateCompanyOptions = [
		{ label: '羚牛运营（嘉兴）', value: '羚牛运营（嘉兴）' },
		{ label: '羚牛运营（上海）', value: '羚牛运营（上海）' },
		{ label: '羚牛运营（广东）', value: '羚牛运营（广东）' }
	];
	var vehicleSourceOptions = [
		{ label: '自有', value: '自有' },
		{ label: '外租', value: '外租' },
		{ label: '挂靠', value: '挂靠' }
	];
	var leaseCompanyOptions = [
		{ label: '某某租赁公司', value: '某某租赁公司' },
		{ label: '某某科技有限公司', value: '某某科技有限公司' },
		{ label: '第三方融资租赁有限公司', value: '第三方融资租赁有限公司' },
		{ label: '无', value: '-' }
	];
	var parkingOptions = [
		{ label: '天河停车场', value: '天河停车场' },
		{ label: '黄埔停车场', value: '黄埔停车场' },
		{ label: '朝阳停车场', value: '朝阳停车场' },
		{ label: '福田停车场', value: '福田停车场' },
		{ label: '浦东停车场', value: '浦东停车场' },
		{ label: '南山停车场', value: '南山停车场' },
		{ label: '番禺停车场', value: '番禺停车场' },
		{ label: '大兴停车场', value: '大兴停车场' },
		{ label: '龙岗停车场', value: '龙岗停车场' },
		{ label: '白云停车场', value: '白云停车场' },
		{ label: '西城停车场', value: '西城停车场' },
		{ label: '虹口停车场', value: '虹口停车场' },
		{ label: '昌平停车场', value: '昌平停车场' },
		{ label: '-', value: '-' }
	];
	var operateStatusOptions = [
		{ label: '租赁', value: '租赁' },
		{ label: '自营', value: '自营' },
		{ label: '可运营', value: '可运营' },
		{ label: '待运营', value: '待运营' },
		{ label: '退出运营', value: '退出运营' }
	];
	var vehicleStatusOptions = [
		{ label: '待验车', value: '待验车' },
		{ label: '未备车', value: '未备车' },
		{ label: '已备车', value: '已备车' },
		{ label: '待交车', value: '待交车' },
		{ label: '已交车', value: '已交车' },
		{ label: '待还车', value: '待还车' },
		{ label: '销售中', value: '销售中' },
		{ label: '替换中', value: '替换中' },
		{ label: '调拨中', value: '调拨中' },
		{ label: '异动中', value: '异动中' },
		{ label: '三方退租中', value: '三方退租中' },
		{ label: '无', value: '无' }
	];
	var yearOptions = (function () {
		var y = new Date().getFullYear();
		var opts = [];
		for (var i = y; i >= y - 12; i--) opts.push({ label: String(i), value: String(i) });
		return opts;
	})();

	// 表格数据（模拟 20 条）— 状态字段按《车辆状态》脑图（2026-03）：
	// 运营状态：租赁、自营、可运营、待运营、退出运营（原「库存」并入「可运营」）
	// 车辆状态：合并原库位/整备/过户/维修/报废等维度，枚举含：待验车、未备车、已备车、待交车、已交车、待还车、销售中、替换中、调拨中、异动中、三方退租中、无 等（不含：等待验车功能上线、呆滞车、过户中、报废中、维修中）
	// 出库状态：三方退租出库、销售出库、报废出库、无（不再使用异动/调拨/交车等旧出库细分）
	// 证照状态：正常、异常、无
	// 保险状态：正常、异常
	var rawData = [
		{ id: '1', region: '广东省/广州市', vin: 'LGWEF4A59NS123456', plateNo: '粤A12345', vehicleNo: 'V001', vehicleType: '小型轿车', brand: '比亚迪', model: '汉EV', color: '白色', parking: '天河停车场', customer: '客户A', department: '华南区', manager: '张三', operateStatus: '租赁', vehicleStatus: '已交车', outStatus: '无', licenseStatus: '正常', insuranceStatus: '正常', ownership: '某某租赁公司', operateCompany: '羚牛运营（嘉兴）', vehicleSource: '自有', leaseCompany: '某某租赁公司', onlineStatus: '在线', year: '2023', mileage: '12580.50', purchaseDate: '2023-06-15', regDate: '2023-07-01', inspectExpire: '2025-07', lastDeliveryTime: '2024-01-10', lastDeliveryMile: '12000.00', lastReturnTime: '2024-02-01', lastReturnMile: '12580.50', scrapDate: '2038-12-31', contractNo: 'HT-2024-001', location: '广东省广州市天河区天河路100号', gpsTime: '2024-02-12 14:30' },
		{ id: '2', region: '广东省/深圳市', vin: 'LGWEF4A59NS789012', plateNo: '粤B67890', vehicleNo: '-', vehicleType: 'SUV', brand: '特斯拉', model: 'Model 3', color: '黑色', parking: '-', customer: '客户B', department: '华南区', manager: '李四', operateStatus: '可运营', vehicleStatus: '未备车', outStatus: '无', licenseStatus: '正常', insuranceStatus: '正常', ownership: '某某科技有限公司', operateCompany: '羚牛运营（上海）', vehicleSource: '外租', leaseCompany: '某某科技有限公司', onlineStatus: '离线', year: '2022', mileage: '25600.00', purchaseDate: '2022-08-20', regDate: '2022-09-01', inspectExpire: '2024-09', lastDeliveryTime: '2024-01-05', lastDeliveryMile: '25500.00', lastReturnTime: '2024-01-20', lastReturnMile: '25600.00', scrapDate: '2037-09-30', contractNo: '-', location: '广东省深圳市南山区科技园南路', gpsTime: '2024-02-11 09:00' },
		{ id: '3', region: '广东省/广州市', vin: 'LSJA24U70PS001234', plateNo: '粤A88K88', vehicleNo: 'V003', vehicleType: '小型轿车', brand: '蔚来', model: 'ET5', color: '灰色', parking: '黄埔停车场', customer: '客户A', department: '华南区', manager: '王五', operateStatus: '租赁', vehicleStatus: '已交车', outStatus: '无', licenseStatus: '正常', insuranceStatus: '正常', ownership: '某某租赁公司', operateCompany: '羚牛运营（广东）', vehicleSource: '挂靠', leaseCompany: '第三方融资租赁有限公司', onlineStatus: '在线', year: '2023', mileage: '8320.00', purchaseDate: '2023-09-01', regDate: '2023-09-20', inspectExpire: '2025-09', lastDeliveryTime: '2024-02-05', lastDeliveryMile: '8100.00', lastReturnTime: '2024-02-10', lastReturnMile: '8320.00', scrapDate: '2039-09-30', contractNo: 'HT-2024-002', location: '广东省广州市黄埔区开泰大道200号', gpsTime: '2024-02-12 10:15' },
		{ id: '4', region: '北京市/北京市', vin: 'WVWZZZ3CZWE123456', plateNo: '京C12345', vehicleNo: '-', vehicleType: 'SUV', brand: '特斯拉', model: 'Model Y', color: '蓝色', parking: '朝阳停车场', customer: '无', department: '无', manager: '-', operateStatus: '自营', vehicleStatus: '已交车', outStatus: '无', licenseStatus: '正常', insuranceStatus: '正常', ownership: '某某科技有限公司', operateCompany: '羚牛运营（嘉兴）', vehicleSource: '自有', leaseCompany: '-', onlineStatus: '离线', year: '2022', mileage: '18900.25', purchaseDate: '2022-11-10', regDate: '2022-12-01', inspectExpire: '2024-12', lastDeliveryTime: '2024-01-15', lastDeliveryMile: '18500.00', lastReturnTime: '2024-01-28', lastReturnMile: '18900.25', scrapDate: '2037-12-31', contractNo: '-', location: '北京市朝阳区望京街88号', gpsTime: '2024-02-10 16:00' },
		{ id: '5', region: '上海市/上海市', vin: 'LSVAU2BR3NS567890', plateNo: '沪D66666', vehicleNo: 'V005', vehicleType: '厢式货车', brand: '比亚迪', model: '汉EV', color: '白色', parking: '-', customer: '客户C', department: '华东区', manager: '赵六', operateStatus: '租赁', vehicleStatus: '已交车', outStatus: '无', licenseStatus: '异常', insuranceStatus: '异常', ownership: '某某租赁公司', operateCompany: '羚牛运营（上海）', vehicleSource: '外租', leaseCompany: '某某租赁公司', onlineStatus: '在线', year: '2021', mileage: '45200.80', purchaseDate: '2021-05-20', regDate: '2021-06-15', inspectExpire: '2024-06', lastDeliveryTime: '2024-02-01', lastDeliveryMile: '44800.00', lastReturnTime: '2024-02-08', lastReturnMile: '45200.80', scrapDate: '2036-06-30', contractNo: 'HT-2024-003', location: '上海市浦东新区张江高科路500号', gpsTime: '2024-02-12 09:45' },
		{ id: '6', region: '广东省/深圳市', vin: '5YJ3E1EA1NF123456', plateNo: '粤B12345', vehicleNo: '-', vehicleType: '小型轿车', brand: '特斯拉', model: 'Model 3', color: '红色', parking: '福田停车场', customer: '客户B', department: '华南区', manager: '李四', operateStatus: '租赁', vehicleStatus: '已交车', outStatus: '无', licenseStatus: '正常', insuranceStatus: '正常', ownership: '某某租赁公司', operateCompany: '羚牛运营（广东）', vehicleSource: '挂靠', leaseCompany: '某某科技有限公司', onlineStatus: '在线', year: '2023', mileage: '5600.00', purchaseDate: '2023-03-08', regDate: '2023-04-01', inspectExpire: '2025-04', lastDeliveryTime: '2024-02-02', lastDeliveryMile: '5200.00', lastReturnTime: '2024-02-11', lastReturnMile: '5600.00', scrapDate: '2038-04-30', contractNo: 'HT-2024-004', location: '广东省深圳市福田区福华路188号', gpsTime: '2024-02-12 11:20' },
		{ id: '7', region: '广东省/广州市', vin: 'LGWEF4A59NS234567', plateNo: '粤A99A99', vehicleNo: 'V007', vehicleType: '小型轿车', brand: '比亚迪', model: '汉EV', color: '黑色', parking: '天河停车场', customer: '客户A', department: '华南区', manager: '张三', operateStatus: '可运营', vehicleStatus: '待还车', outStatus: '无', licenseStatus: '正常', insuranceStatus: '正常', ownership: '某某租赁公司', operateCompany: '羚牛运营（嘉兴）', vehicleSource: '自有', leaseCompany: '第三方融资租赁有限公司', onlineStatus: '离线', year: '2022', mileage: '22100.30', purchaseDate: '2022-07-15', regDate: '2022-08-01', inspectExpire: '2024-08', lastDeliveryTime: '2024-01-20', lastDeliveryMile: '21800.00', lastReturnTime: '2024-02-05', lastReturnMile: '22100.30', scrapDate: '2037-08-31', contractNo: '-', location: '广东省广州市天河区体育西路200号', gpsTime: '2024-02-11 18:30' },
		{ id: '8', region: '北京市/北京市', vin: 'WVWZZZ3CZWE789012', plateNo: '京E88888', vehicleNo: '-', vehicleType: 'SUV', brand: '蔚来', model: 'ET5', color: '绿色', parking: '-', customer: '客户D', department: '华北区', manager: '孙七', operateStatus: '自营', vehicleStatus: '已交车', outStatus: '无', licenseStatus: '正常', insuranceStatus: '正常', ownership: '某某科技有限公司', operateCompany: '羚牛运营（上海）', vehicleSource: '外租', leaseCompany: '-', onlineStatus: '在线', year: '2023', mileage: '11200.00', purchaseDate: '2023-01-12', regDate: '2023-02-01', inspectExpire: '2025-02', lastDeliveryTime: '2024-02-06', lastDeliveryMile: '11000.00', lastReturnTime: '2024-02-12', lastReturnMile: '11200.00', scrapDate: '2038-02-28', contractNo: 'HT-2024-005', location: '北京市海淀区中关村大街1号', gpsTime: '2024-02-12 08:00' },
		{ id: '9', region: '上海市/上海市', vin: 'LSVAU2BR3NS111222', plateNo: '沪A12345', vehicleNo: '-', vehicleType: '小型轿车', brand: '比亚迪', model: '汉EV', color: '银色', parking: '浦东停车场', customer: '无', department: '无', manager: '-', operateStatus: '可运营', vehicleStatus: '待还车', outStatus: '无', licenseStatus: '正常', insuranceStatus: '正常', ownership: '某某租赁公司', operateCompany: '羚牛运营（广东）', vehicleSource: '挂靠', leaseCompany: '某某租赁公司', onlineStatus: '离线', year: '2021', mileage: '38500.60', purchaseDate: '2021-10-05', regDate: '2021-11-01', inspectExpire: '2024-11', lastDeliveryTime: '2024-01-08', lastDeliveryMile: '38000.00', lastReturnTime: '2024-01-25', lastReturnMile: '38500.60', scrapDate: '2036-11-30', contractNo: '-', location: '上海市徐汇区漕溪路250号', gpsTime: '2024-02-09 14:00' },
		{ id: '10', region: '广东省/深圳市', vin: '5YJ3E1EA2NF333444', plateNo: '粤B55B55', vehicleNo: 'V010', vehicleType: 'SUV', brand: '特斯拉', model: 'Model Y', color: '白色', parking: '南山停车场', customer: '客户B', department: '华南区', manager: '李四', operateStatus: '租赁', vehicleStatus: '已交车', outStatus: '无', licenseStatus: '正常', insuranceStatus: '正常', ownership: '某某科技有限公司', operateCompany: '羚牛运营（嘉兴）', vehicleSource: '自有', leaseCompany: '某某科技有限公司', onlineStatus: '在线', year: '2022', mileage: '16800.00', purchaseDate: '2022-04-18', regDate: '2022-05-10', inspectExpire: '2024-05', lastDeliveryTime: '2024-01-30', lastDeliveryMile: '16500.00', lastReturnTime: '2024-02-09', lastReturnMile: '16800.00', scrapDate: '2037-05-31', contractNo: 'HT-2024-006', location: '广东省深圳市南山区后海大道300号', gpsTime: '2024-02-12 13:10' },
		{ id: '11', region: '广东省/广州市', vin: 'LSJA24U70PS555666', plateNo: '粤A11B22', vehicleNo: '-', vehicleType: '小型轿车', brand: '蔚来', model: 'ET5', color: '蓝色', parking: '番禺停车场', customer: '客户A', department: '华南区', manager: '王五', operateStatus: '租赁', vehicleStatus: '替换中', outStatus: '无', licenseStatus: '正常', insuranceStatus: '正常', ownership: '某某租赁公司', operateCompany: '羚牛运营（上海）', vehicleSource: '外租', leaseCompany: '第三方融资租赁有限公司', onlineStatus: '在线', year: '2023', mileage: '7200.50', purchaseDate: '2023-07-20', regDate: '2023-08-05', inspectExpire: '2025-08', lastDeliveryTime: '2024-02-03', lastDeliveryMile: '7000.00', lastReturnTime: '2024-02-11', lastReturnMile: '7200.50', scrapDate: '2038-08-31', contractNo: 'HT-2024-007', location: '广东省广州市番禺区市桥街100号', gpsTime: '2024-02-12 12:00' },
		{ id: '12', region: '北京市/北京市', vin: 'WVWZZZ3CZWE333555', plateNo: '京F33333', vehicleNo: '-', vehicleType: '厢式货车', brand: '比亚迪', model: '汉EV', color: '灰色', parking: '大兴停车场', customer: '客户D', department: '华北区', manager: '孙七', operateStatus: '可运营', vehicleStatus: '未备车', outStatus: '无', licenseStatus: '正常', insuranceStatus: '正常', ownership: '某某租赁公司', operateCompany: '羚牛运营（广东）', vehicleSource: '挂靠', leaseCompany: '-', onlineStatus: '离线', year: '2020', mileage: '52100.00', purchaseDate: '2020-09-01', regDate: '2020-10-01', inspectExpire: '2024-10', lastDeliveryTime: '2024-01-12', lastDeliveryMile: '51800.00', lastReturnTime: '2024-01-30', lastReturnMile: '52100.00', scrapDate: '2035-10-31', contractNo: '-', location: '北京市大兴区亦庄经济开发区', gpsTime: '2024-02-08 11:00' },
		{ id: '13', region: '上海市/上海市', vin: 'LSVAU2BR3NS777888', plateNo: '沪B99999', vehicleNo: 'V013', vehicleType: '小型轿车', brand: '特斯拉', model: 'Model 3', color: '黑色', parking: '-', customer: '客户C', department: '华东区', manager: '赵六', operateStatus: '租赁', vehicleStatus: '已交车', outStatus: '无', licenseStatus: '正常', insuranceStatus: '正常', ownership: '某某科技有限公司', operateCompany: '羚牛运营（嘉兴）', vehicleSource: '自有', leaseCompany: '某某租赁公司', onlineStatus: '在线', year: '2022', mileage: '19800.00', purchaseDate: '2022-12-01', regDate: '2023-01-05', inspectExpire: '2025-01', lastDeliveryTime: '2024-02-07', lastDeliveryMile: '19500.00', lastReturnTime: '2024-02-12', lastReturnMile: '19800.00', scrapDate: '2038-01-31', contractNo: 'HT-2024-008', location: '上海市闵行区莘庄镇莘松路88号', gpsTime: '2024-02-12 15:45' },
		{ id: '14', region: '广东省/深圳市', vin: 'LGWEF4A59NS888999', plateNo: '粤B22C33', vehicleNo: '-', vehicleType: 'SUV', brand: '比亚迪', model: '汉EV', color: '白色', parking: '龙岗停车场', customer: '客户B', department: '华南区', manager: '李四', operateStatus: '租赁', vehicleStatus: '已交车', outStatus: '无', licenseStatus: '正常', insuranceStatus: '正常', ownership: '某某租赁公司', operateCompany: '羚牛运营（上海）', vehicleSource: '外租', leaseCompany: '某某科技有限公司', onlineStatus: '在线', year: '2023', mileage: '4200.00', purchaseDate: '2023-10-10', regDate: '2023-11-01', inspectExpire: '2025-11', lastDeliveryTime: '2024-02-04', lastDeliveryMile: '4000.00', lastReturnTime: '2024-02-10', lastReturnMile: '4200.00', scrapDate: '2038-11-30', contractNo: 'HT-2024-009', location: '广东省深圳市龙岗区龙城大道500号', gpsTime: '2024-02-12 10:30' },
		{ id: '15', region: '广东省/广州市', vin: 'LSJA24U70PS000111', plateNo: '粤A66D66', vehicleNo: 'V015', vehicleType: '小型轿车', brand: '蔚来', model: 'ET5', color: '红色', parking: '天河停车场', customer: '无', department: '无', manager: '-', operateStatus: '待运营', vehicleStatus: '待验车', outStatus: '无', licenseStatus: '异常', insuranceStatus: '异常', ownership: '某某科技有限公司', operateCompany: '羚牛运营（广东）', vehicleSource: '挂靠', leaseCompany: '第三方融资租赁有限公司', onlineStatus: '离线', year: '2021', mileage: '31200.40', purchaseDate: '2021-03-15', regDate: '2021-04-01', inspectExpire: '2024-04', lastDeliveryTime: '2024-01-18', lastDeliveryMile: '30800.00', lastReturnTime: '2024-02-02', lastReturnMile: '31200.40', scrapDate: '2036-04-30', contractNo: '-', location: '广东省广州市越秀区中山五路66号', gpsTime: '2024-02-07 09:00' },
		{ id: '16', region: '北京市/北京市', vin: '5YJ3E1EA3NF222333', plateNo: '京G12345', vehicleNo: '-', vehicleType: '小型轿车', brand: '特斯拉', model: 'Model 3', color: '银色', parking: '西城停车场', customer: '客户D', department: '华北区', manager: '孙七', operateStatus: '租赁', vehicleStatus: '已交车', outStatus: '无', licenseStatus: '正常', insuranceStatus: '正常', ownership: '某某租赁公司', operateCompany: '羚牛运营（嘉兴）', vehicleSource: '自有', leaseCompany: '-', onlineStatus: '在线', year: '2023', mileage: '9800.00', purchaseDate: '2023-05-01', regDate: '2023-05-20', inspectExpire: '2025-05', lastDeliveryTime: '2024-02-01', lastDeliveryMile: '9500.00', lastReturnTime: '2024-02-11', lastReturnMile: '9800.00', scrapDate: '2038-05-31', contractNo: 'HT-2024-010', location: '北京市西城区金融街28号', gpsTime: '2024-02-12 14:00' },
		{ id: '17', region: '上海市/上海市', vin: 'LGWEF4A59NS444555', plateNo: '沪C11111', vehicleNo: '-', vehicleType: '小型轿车', brand: '比亚迪', model: '汉EV', color: '黑色', parking: '虹口停车场', customer: '客户C', department: '华东区', manager: '赵六', operateStatus: '可运营', vehicleStatus: '已备车', outStatus: '无', licenseStatus: '正常', insuranceStatus: '正常', ownership: '某某租赁公司', operateCompany: '羚牛运营（上海）', vehicleSource: '外租', leaseCompany: '某某租赁公司', onlineStatus: '离线', year: '2022', mileage: '24500.00', purchaseDate: '2022-02-28', regDate: '2022-03-15', inspectExpire: '2024-03', lastDeliveryTime: '2024-01-22', lastDeliveryMile: '24200.00', lastReturnTime: '2024-02-06', lastReturnMile: '24500.00', scrapDate: '2037-03-31', contractNo: '-', location: '上海市虹口区四川北路1688号', gpsTime: '2024-02-11 17:00' },
		{ id: '18', region: '广东省/深圳市', vin: 'LSVAU2BR3NS666777', plateNo: '粤B44E44', vehicleNo: 'V018', vehicleType: '厢式货车', brand: '比亚迪', model: '汉EV', color: '灰色', parking: '-', customer: '客户B', department: '华南区', manager: '李四', operateStatus: '租赁', vehicleStatus: '已交车', outStatus: '无', licenseStatus: '正常', insuranceStatus: '正常', ownership: '某某科技有限公司', operateCompany: '羚牛运营（广东）', vehicleSource: '挂靠', leaseCompany: '某某科技有限公司', onlineStatus: '在线', year: '2020', mileage: '67800.25', purchaseDate: '2020-06-10', regDate: '2020-07-01', inspectExpire: '2024-07', lastDeliveryTime: '2024-01-25', lastDeliveryMile: '67500.00', lastReturnTime: '2024-02-09', lastReturnMile: '67800.25', scrapDate: '2035-07-31', contractNo: 'HT-2024-011', location: '广东省深圳市宝安区新安街道创业路', gpsTime: '2024-02-12 08:20' },
		{ id: '19', region: '广东省/广州市', vin: '5YJ3E1EA4NF888999', plateNo: '粤A77F77', vehicleNo: '-', vehicleType: 'SUV', brand: '特斯拉', model: 'Model Y', color: '蓝色', parking: '白云停车场', customer: '客户A', department: '华南区', manager: '张三', operateStatus: '租赁', vehicleStatus: '销售中', outStatus: '无', licenseStatus: '正常', insuranceStatus: '正常', ownership: '某某租赁公司', operateCompany: '羚牛运营（嘉兴）', vehicleSource: '自有', leaseCompany: '第三方融资租赁有限公司', onlineStatus: '在线', year: '2023', mileage: '3500.00', purchaseDate: '2023-11-05', regDate: '2023-11-25', inspectExpire: '2025-11', lastDeliveryTime: '2024-02-08', lastDeliveryMile: '3200.00', lastReturnTime: '2024-02-12', lastReturnMile: '3500.00', scrapDate: '2038-11-30', contractNo: 'HT-2024-012', location: '广东省广州市白云区白云大道南888号', gpsTime: '2024-02-12 16:00' },
		{ id: '20', region: '北京市/北京市', vin: 'LSJA24U70PS999000', plateNo: '京H88888', vehicleNo: '-', vehicleType: '小型轿车', brand: '蔚来', model: 'ET5', color: '白色', parking: '昌平停车场', customer: '客户D', department: '华北区', manager: '孙七', operateStatus: '退出运营', vehicleStatus: '无', outStatus: '报废出库', licenseStatus: '无', insuranceStatus: '正常', ownership: '某某科技有限公司', operateCompany: '羚牛运营（上海）', vehicleSource: '外租', leaseCompany: '-', onlineStatus: '离线', year: '2022', mileage: '15600.00', purchaseDate: '2022-06-20', regDate: '2022-07-10', inspectExpire: '2024-07', lastDeliveryTime: '2024-01-10', lastDeliveryMile: '15300.00', lastReturnTime: '2024-01-28', lastReturnMile: '15600.00', scrapDate: '2037-07-31', contractNo: '-', location: '北京市昌平区回龙观西大街100号', gpsTime: '2024-02-10 12:30' }
	];

	var _tableData = useState(rawData);

	var dataSource = useMemo(function () {
		var plate = _plateFilter[0];
		var list = _tableData[0];
		if (!plate || plate.trim() === '') return list;
		return list.filter(function (row) {
			return row.plateNo && row.plateNo.indexOf(plate) !== -1;
		});
	}, [_tableData[0], _plateFilter[0]]);

	var onPlateFilterChange = useCallback(function (e) {
		_plateFilter[1](e.target.value);
	}, []);

	var onSelectChange = useCallback(function (keys) {
		_selectedRowKeys[1](keys);
	}, []);

	var rowSelection = {
		selectedRowKeys: _selectedRowKeys[0],
		onChange: onSelectChange
	};

	var handleExport = useCallback(function () {
		if (_selectedRowKeys[0].length === 0) {
			message.warning('请先勾选要导出的记录');
			return;
		}
		message.success('导出功能（联动多选）：已选 ' + _selectedRowKeys[0].length + ' 条');
	}, []);

	var handleBatchImport = useCallback(function () {
		message.info('批量导入：请上传文件（原型演示）');
	}, []);

	var openInspectImportModal = useCallback(function () {
		_inspectImportModalVisible[1](true);
		_inspectImportResult[1](null);
	}, []);
	var closeInspectImportModal = useCallback(function () {
		_inspectImportModalVisible[1](false);
		_inspectImportResult[1](null);
	}, []);
	var downloadInspectTemplate = useCallback(function () {
		var csv = '\uFEFF\u8F66\u724C\u53F7,\u7B49\u8BC4\u65F6\u95F4\n';
		var blob = new Blob([csv], { type: 'text/csv;charset=utf-8' });
		var url = URL.createObjectURL(blob);
		var a = document.createElement('a');
		a.href = url;
		a.download = '\u5BFC\u5165\u6A21\u677F_\u7B49\u8BC4\u65F6\u95F4.csv';
		a.click();
		URL.revokeObjectURL(url);
		message.success('模板已下载');
	}, []);
	var handleInspectImportUpload = useCallback(function (file) {
		var reader = new FileReader();
		reader.onload = function (e) {
			var text = e.target && e.target.result ? String(e.target.result) : '';
			var lines = text.split(/\r?\n/).filter(function (line) { return line.trim(); });
			var failedList = [];
			if (lines.length > 0) {
				var header = lines[0];
				for (var i = 1; i < Math.min(lines.length, 6); i++) {
					var parts = lines[i].split(',');
					var plateNo = (parts[0] || '').trim();
					var inspectTime = (parts[1] || '').trim();
					failedList.push({ plateNo: plateNo || '-', inspectTime: inspectTime || '-', reason: '\u8F66\u724C\u53F7\u4E0D\u5B58\u5728\u6216\u683C\u5F0F\u9519\u8BEF' });
				}
			}
			if (failedList.length === 0) failedList.push({ plateNo: '-', inspectTime: '-', reason: '\u6587\u4EF6\u683C\u5F0F\u9519\u8BEF' });
			_inspectImportResult[1]({ hasFailed: true, failedList: failedList });
		};
		reader.readAsText(file, 'UTF-8');
		return false;
	}, []);
	var downloadInspectFailedCsv = useCallback(function () {
		var result = _inspectImportResult[0];
		if (!result || !result.failedList || result.failedList.length === 0) return;
		var escape = function (v) {
			var s = v == null ? '' : String(v);
			if (s.indexOf(',') !== -1 || s.indexOf('"') !== -1 || s.indexOf('\n') !== -1) return '"' + s.replace(/"/g, '""') + '"';
			return s;
		};
		var header = '\u8F66\u724C\u53F7,\u7B49\u8BC4\u65F6\u95F4,\u5931\u8D25\u539F\u56E0';
		var rows = result.failedList.map(function (r) { return escape(r.plateNo) + ',' + escape(r.inspectTime) + ',' + escape(r.reason); });
		var csv = '\uFEFF' + header + '\n' + rows.join('\n');
		var blob = new Blob([csv], { type: 'text/csv;charset=utf-8' });
		var url = URL.createObjectURL(blob);
		var a = document.createElement('a');
		a.href = url;
		a.download = '\u7B49\u8BC4\u65F6\u95F4\u5BFC\u5165\u5931\u8D25\u8BB0\u5F55.csv';
		a.click();
		URL.revokeObjectURL(url);
		message.success('失败记录已下载');
	}, [_inspectImportResult[0]]);

	var goDetail = useCallback(function (record) {
		_detailRecord[1](record);
	}, []);

	var backToList = useCallback(function () {
		_detailRecord[1](null);
	}, []);

	var openUploadModal = useCallback(function (record) {
		_currentRow[1](record);
		_uploadModalVisible[1](true);
		_confirmModalVisible[1](false);
		_plateForm[1]({ vin: record.vin || '', plateNo: record.plateNo || '' });
		_plateError[1]('');
	}, []);

	var closeUploadModal = useCallback(function () {
		_uploadModalVisible[1](false);
		_currentRow[1](null);
	}, []);

	var startOcrThenConfirm = useCallback(function () {
		_uploadModalVisible[1](false);
		_ocrLoadingVisible[1](true);
		setTimeout(function () {
			_ocrLoadingVisible[1](false);
			_confirmModalVisible[1](true);
		}, 1500);
	}, []);

	var closeConfirmModal = useCallback(function () {
		_confirmModalVisible[1](false);
		_currentRow[1](null);
		_plateForm[1]({ vin: '', plateNo: '' });
		_plateError[1]('');
	}, []);

	var onPlateFormChange = useCallback(function (field, value) {
		_plateError[1]('');
		_plateForm[1](function (prev) {
			var next = {};
			next[field] = value;
			return Object.assign({}, prev, next);
		});
	}, []);

	var confirmPlate = useCallback(function () {
		var row = _currentRow[0];
		var form = _plateForm[0];
		if (!row) return;
		var vinMatch = form.vin && row.vin && form.vin.trim() === row.vin.trim();
		if (!form.vin || !form.plateNo) {
			_plateError[1]('请填写车辆识别代号与车牌号');
			return;
		}
		if (!vinMatch) {
			_plateError[1]('车辆识别代号与该车辆不匹配');
			return;
		}
		message.success('上牌信息已更新（原型演示）');
		closeConfirmModal();
	}, []);

	var openEditModal = useCallback(function (record) {
		if (!isAdmin) {
			message.warning('仅 Admin 可编辑车辆信息');
			return;
		}
		_editRecord[1](record);
		_editForm[1]({
			parking: record.parking === '-' ? '-' : (record.parking || undefined),
			operateStatus: record.operateStatus || undefined,
			vehicleStatus: record.vehicleStatus || undefined,
			ownership: record.ownership && record.ownership !== '-' ? record.ownership : '',
			operateCompany: record.operateCompany || undefined,
			vehicleSource: record.vehicleSource || undefined,
			leaseCompany: record.leaseCompany && record.leaseCompany !== '-' ? record.leaseCompany : '',
			year: record.year || undefined,
			purchaseDate: record.purchaseDate || ''
		});
		_editModalVisible[1](true);
	}, []);

	var closeEditModal = useCallback(function () {
		_editModalVisible[1](false);
		_editRecord[1](null);
		_editForm[1]({});
	}, []);

	var onEditFormChange = useCallback(function (field, value) {
		_editForm[1](function (prev) {
			var next = Object.assign({}, prev);
			next[field] = value;
			return next;
		});
	}, []);

	var saveEdit = useCallback(function () {
		if (!isAdmin) {
			message.warning('仅 Admin 可保存');
			return;
		}
		var record = _editRecord[0];
		var form = _editForm[0];
		if (!record) return;
		if (!form.operateStatus || !form.vehicleStatus) {
			message.warning('请选择运营状态与车辆状态');
			return;
		}
		_tableData[1](function (prev) {
			return prev.map(function (row) {
				if (row.id !== record.id) return row;
				var ownershipVal = (form.ownership || '').trim();
				var leaseVal = (form.leaseCompany || '').trim();
				return Object.assign({}, row, {
					parking: form.parking || '-',
					operateStatus: form.operateStatus,
					vehicleStatus: form.vehicleStatus,
					ownership: ownershipVal || '-',
					operateCompany: form.operateCompany || row.operateCompany,
					vehicleSource: form.vehicleSource || row.vehicleSource,
					leaseCompany: leaseVal || '-',
					year: form.year || row.year,
					purchaseDate: form.purchaseDate || row.purchaseDate
				});
			});
		});
		if (_detailRecord[0] && _detailRecord[0].id === record.id) {
			_detailRecord[1](function (prev) {
				if (!prev || prev.id !== record.id) return prev;
				var ownershipVal = (form.ownership || '').trim();
				var leaseVal = (form.leaseCompany || '').trim();
				return Object.assign({}, prev, {
					parking: form.parking || '-',
					operateStatus: form.operateStatus,
					vehicleStatus: form.vehicleStatus,
					ownership: ownershipVal || '-',
					operateCompany: form.operateCompany || prev.operateCompany,
					vehicleSource: form.vehicleSource || prev.vehicleSource,
					leaseCompany: leaseVal || '-',
					year: form.year || prev.year,
					purchaseDate: form.purchaseDate || prev.purchaseDate
				});
			});
		}
		message.success('车辆信息已保存（原型演示）');
		closeEditModal();
	}, []);

	var handleFilterReset = useCallback(function () {
		_region[1]([]);
		_vehicleType[1](undefined);
		_brand[1](undefined);
		_model[1](undefined);
		_customer[1](undefined);
		_department[1](undefined);
		_contractNo[1](undefined);
		_ownership[1](undefined);
		_operateCompany[1](undefined);
		_vehicleSource[1](undefined);
		_leaseCompany[1](undefined);
		_plateFilter[1]('');
	}, []);

	// 状态类字段：枚举为「无」时界面显示为「-」
	var formatStatusDisplay = function (val) {
		if (val === '无') return '-';
		return val;
	};

	var getMoreMenuItems = function (record) {
		return [
			{ key: 'plate', label: '车辆上牌', onClick: function () { openUploadModal(record); } },
			{ key: 'transfer', label: '车辆过户', onClick: function () { message.info('车辆过户（原型）'); } },
			{ key: 'move', label: '车辆异动', onClick: function () { message.info('车辆异动（原型）'); } },
			{ key: 'allocate', label: '车辆调拨', onClick: function () { message.info('车辆调拨（原型）'); } },
			{ key: 'scrap', label: '车辆报废', onClick: function () { message.info('车辆报废（原型）'); } },
			{ key: 'inspect', label: '车辆年审', onClick: function () { message.info('车辆年审（原型）'); } },
			{ key: 'sell', label: '车辆出售', onClick: function () { message.info('车辆出售（原型）'); } },
			{ key: 'fault', label: '故障提报', onClick: function () { message.info('故障提报（原型）'); } }
		];
	};

	var renderFilterField = useCallback(function (label, control) {
		return React.createElement('div', { className: 'vm-filter-field' },
			React.createElement('span', { className: 'vm-filter-field-label' }, label),
			React.createElement('div', { className: 'vm-filter-field-control' }, control)
		);
	}, []);

	var renderStatusTag = useCallback(function (text, colorFn) {
		var display = formatStatusDisplay(text);
		if (display === '-') return React.createElement('span', { style: { color: '#94a3b8' } }, '-');
		return React.createElement(Tag, { className: 'vm-status-tag', color: colorFn(text) }, display);
	}, []);

	var columns = [
		{ title: '运营城市', dataIndex: 'region', key: 'region', width: 140, fixed: 'left' },
		{ title: '车辆识别代号', dataIndex: 'vin', key: 'vin', width: 180, fixed: 'left', render: function (t) { return React.createElement('span', { className: 'vm-vin-text', title: t }, t || '-'); } },
		{ title: '车牌号', dataIndex: 'plateNo', key: 'plateNo', width: 110, fixed: 'left', render: function (text, record) {
			return React.createElement('button', { type: 'button', className: 'vm-plate-link', onClick: function () { goDetail(record); }, title: '查看详情' }, text || '-');
		} },
		{ title: '车辆编号', dataIndex: 'vehicleNo', key: 'vehicleNo', width: 100 },
		{ title: '车辆类型', dataIndex: 'vehicleType', key: 'vehicleType', width: 100 },
		{ title: '品牌', dataIndex: 'brand', key: 'brand', width: 90 },
		{ title: '型号', dataIndex: 'model', key: 'model', width: 100 },
		{ title: '车身颜色', dataIndex: 'color', key: 'color', width: 90 },
		{ title: '归属停车场', dataIndex: 'parking', key: 'parking', width: 120 },
		{ title: '客户名称', dataIndex: 'customer', key: 'customer', width: 100 },
		{ title: '业务部门', dataIndex: 'department', key: 'department', width: 100 },
		{ title: '业务负责人', dataIndex: 'manager', key: 'manager', width: 100 },
		{ title: '运营状态', dataIndex: 'operateStatus', key: 'operateStatus', width: 100, render: function (text) { return renderStatusTag(text, vmOperateStatusColor); } },
		{ title: '车辆状态', dataIndex: 'vehicleStatus', key: 'vehicleStatus', width: 110, render: function (text) { return renderStatusTag(text, function () { return 'blue'; }); } },
		{ title: '出库状态', dataIndex: 'outStatus', key: 'outStatus', width: 120, render: function (text) { return renderStatusTag(text, function () { return 'default'; }); } },
		{ title: '证照状态', dataIndex: 'licenseStatus', key: 'licenseStatus', width: 90, render: function (text) { return renderStatusTag(text, vmAlertStatusColor); } },
		{ title: '保险状态', dataIndex: 'insuranceStatus', key: 'insuranceStatus', width: 90, render: function (text) { return renderStatusTag(text, vmAlertStatusColor); } },
		{ title: '登记所有权', dataIndex: 'ownership', key: 'ownership', width: 160, ellipsis: true },
		{ title: '运营公司', dataIndex: 'operateCompany', key: 'operateCompany', width: 150, ellipsis: true },
		{ title: '车辆来源', dataIndex: 'vehicleSource', key: 'vehicleSource', width: 90 },
		{ title: '租赁公司', dataIndex: 'leaseCompany', key: 'leaseCompany', width: 160, ellipsis: true },
		{ title: '在线状态', dataIndex: 'onlineStatus', key: 'onlineStatus', width: 100, render: function (text) {
			var on = text === '在线';
			return React.createElement('span', { className: 'vm-online-pill vm-online-pill--' + (on ? 'on' : 'off') },
				React.createElement('span', { className: 'vm-online-dot', 'aria-hidden': true }),
				text || '-'
			);
		} },
		{ title: '出厂年份', dataIndex: 'year', key: 'year', width: 90 },
		{ title: '行驶公里数（KM）', dataIndex: 'mileage', key: 'mileage', width: 130 },
		{ title: '采购入库时间', dataIndex: 'purchaseDate', key: 'purchaseDate', width: 120 },
		{ title: '行驶证注册日期', dataIndex: 'regDate', key: 'regDate', width: 130 },
		{ title: '行驶证检验有效期', dataIndex: 'inspectExpire', key: 'inspectExpire', width: 130 },
		{ title: '上次交车时间', dataIndex: 'lastDeliveryTime', key: 'lastDeliveryTime', width: 120 },
		{ title: '上次交车里程（KM）', dataIndex: 'lastDeliveryMile', key: 'lastDeliveryMile', width: 140 },
		{ title: '上次还车时间', dataIndex: 'lastReturnTime', key: 'lastReturnTime', width: 120 },
		{ title: '上次还车里程（KM）', dataIndex: 'lastReturnMile', key: 'lastReturnMile', width: 140 },
		{ title: '强制报废日期', dataIndex: 'scrapDate', key: 'scrapDate', width: 120 },
		{ title: '合同编号', dataIndex: 'contractNo', key: 'contractNo', width: 120 },
		{ title: '当前位置', dataIndex: 'location', key: 'location', width: 300 },
		{ title: 'GPS最后上传时间', dataIndex: 'gpsTime', key: 'gpsTime', width: 160 },
		{
			title: '操作',
			key: 'action',
			width: isAdmin ? 180 : 140,
			fixed: 'right',
			render: function (_, record) {
				return React.createElement('div', { style: { display: 'inline-flex', alignItems: 'center', gap: 4 } },
					React.createElement(Button, { key: 'view', type: 'link', size: 'small', className: 'vm-action-btn', onClick: function () { goDetail(record); } }, '查看'),
					isAdmin ? React.createElement(Button, {
						key: 'edit',
						type: 'link',
						size: 'small',
						className: 'vm-action-btn',
						onClick: function () { openEditModal(record); }
					}, '编辑') : null,
					React.createElement(Dropdown, { key: 'more', menu: { items: getMoreMenuItems(record) }, trigger: ['click'] },
						React.createElement(Tooltip, { title: '更多操作' },
							React.createElement('span', {
								className: 'vm-action-more-btn',
								role: 'button',
								tabIndex: 0,
								'aria-label': '更多操作',
								onClick: function (e) { e.stopPropagation(); }
							}, vmMoreIcon())
						)
					)
				);
			}
		}
	];

	var filterControlStyle = { width: '100%' };

	vmEnsureStylesheet();

	var emptyNode = React.createElement('div', { className: 'vm-empty-wrap' },
		VM_ICONS.empty,
		React.createElement('div', { style: { marginTop: 12 } }, '暂无符合条件的车辆')
	);

	// 车辆详情页：卡片标题、默认只显示前三列+收起/展开，下方 Tab+内容卡片
	var detailRecord = _detailRecord[0];
	if (detailRecord) {
		var r = detailRecord;
		var labelStyle = { color: 'rgba(0,0,0,0.45)', fontSize: 14, flexShrink: 0, minWidth: 100, textAlign: 'right' };
		var valueStyle = { color: 'rgba(0,0,0,0.85)', fontSize: 14, textAlign: 'left' };
		var linkStyle = { color: '#1890ff', cursor: 'pointer', fontSize: 14 };
		var cellStyle = { marginBottom: 16, minHeight: 22, display: 'flex', alignItems: 'center', gap: 8 };
		var link = function (text, onClick) { return React.createElement('a', { style: linkStyle, onClick: onClick }, text); };
		var detailCardStyle = { background: '#fff', borderRadius: 8, padding: 24, marginTop: 16, boxShadow: '0 1px 2px rgba(0,0,0,0.03)' };
		var gridColStyle = { flex: '1', minWidth: 180 };
		var field = function (label, val) { return React.createElement('div', { style: cellStyle }, React.createElement('span', { style: labelStyle }, label), React.createElement('span', { style: valueStyle }, val)); };
		var fieldLink = function (label, text, onClick) { return React.createElement('div', { style: cellStyle }, React.createElement('span', { style: labelStyle }, label), React.createElement('span', { style: valueStyle }, link(text, onClick))); };
		var detailFields = [
			{ label: '车架号', node: field('车架号', r.vin || '-') },
			{ label: '车辆编号', node: field('车辆编号', r.vehicleNo || '-') },
			{ label: '实际所有权', node: field('实际所有权', r.ownership || '-') },
			{ label: '合同编号', node: r.contractNo && r.contractNo !== '-' ? fieldLink('合同编号', r.contractNo, function () { message.info('合同详情（原型）'); }) : field('合同编号', r.contractNo || '-') },
			{ label: '运营状态', node: field('运营状态', formatStatusDisplay(r.operateStatus) || '-') },
			{ label: '车辆状态', node: field('车辆状态', formatStatusDisplay(r.vehicleStatus) || '-') },
			{ label: '出库状态', node: field('出库状态', formatStatusDisplay(r.outStatus) || '-') },
			{ label: '车身颜色', node: field('车身颜色', r.color || '-') },
			{ label: '采购交车日期', node: field('采购交车日期', r.purchaseDate || '-') },
			{ label: '登记所有权', node: field('登记所有权', r.ownership || '-') },
			{ label: '运营公司', node: field('运营公司', r.operateCompany || '-') },
			{ label: '车辆来源', node: field('车辆来源', r.vehicleSource || '-') },
			{ label: '租赁公司', node: field('租赁公司', r.leaseCompany && r.leaseCompany !== '-' ? r.leaseCompany : '-') },
			{ label: '客户名称', node: field('客户名称', r.customer || '-') },
			{ label: '证照状态', node: field('证照状态', formatStatusDisplay(r.licenseStatus) || '-') },
			{ label: '保险状态', node: field('保险状态', formatStatusDisplay(r.insuranceStatus) || '-') },
			{ label: '资源分类', node: field('资源分类', 'XXXXXXXXX') },
			{ label: '出厂年份', node: field('出厂年份', r.year || '-') },
			{ label: '业务部门', node: field('业务部门', r.department || '-') },
			{ label: '上次整备时间', node: field('上次整备时间', r.lastDeliveryTime || '-') },
			{ label: '资产评级', node: field('资产评级', 'XXXXXXXXX') },
			{ label: '等评时间', node: field('等评时间', r.regDate || '-') },
			{ label: '强制报废期', node: field('强制报废期', r.scrapDate || '-') },
			{ label: '停车位置', node: field('停车位置', r.parking || '-') },
			{ label: '业务负责人', node: r.manager && r.manager !== '-' ? fieldLink('业务负责人', r.manager, function () { message.info('负责人（原型）'); }) : field('业务负责人', r.manager || '-') },
			{ label: '运营城市', node: field('运营城市', r.region ? r.region.replace(/\//g, '-') : '-') },
			{ label: '下次年检时间', node: field('下次年检时间', r.inspectExpire || '-') },
			{ label: '上次维修时间', node: field('上次维修时间', r.lastDeliveryTime || '-') },
			{ label: 'GPS最后上传时间', node: field('GPS最后上传时间', r.gpsTime || '-') },
			{ label: '车辆当前位置', node: fieldLink('车辆当前位置', r.location || '-', function () { message.info('查看位置（原型）'); }) }
		];
		var rowCount = _detailCardExpanded[0] ? 8 : 3;
		var rows = [];
		for (var i = 0; i < rowCount; i++) {
			var rowCells = [];
			for (var j = 0; j < 4; j++) {
				var idx = i * 4 + j;
				rowCells.push(React.createElement('div', { key: idx, style: gridColStyle }, detailFields[idx] ? detailFields[idx].node : null));
			}
			rows.push(React.createElement('div', { key: i, style: { display: 'flex', gap: 24, marginBottom: i < rowCount - 1 ? 16 : 0 } }, rowCells));
		}
		var tabContentCardStyle = { background: '#fff', borderRadius: 8, padding: 24, marginTop: 0, boxShadow: '0 1px 2px rgba(0,0,0,0.03)' };
		var tabContent = function (text) { return React.createElement('div', { style: { padding: '8px 0', color: 'rgba(0,0,0,0.65)', fontSize: 14 } }, text); };
		var sectionTitleStyle = { display: 'flex', alignItems: 'center', gap: 8, marginBottom: 16, fontSize: 15, fontWeight: 600, color: 'rgba(0,0,0,0.85)' };
		var sectionIconStyle = { width: 6, height: 6, borderRadius: 3, backgroundColor: '#1890ff', flexShrink: 0 };
		var kvLabelStyle = { color: 'rgba(0,0,0,0.45)', fontSize: 14, flexShrink: 0, minWidth: 90, textAlign: 'right' };
		var kvValueStyle = { color: 'rgba(0,0,0,0.85)', fontSize: 14, textAlign: 'left' };
		var kvItem = function (label, value, badge) {
			var valNode = value;
			if (badge) valNode = React.createElement('span', null, value, React.createElement('span', { style: { marginLeft: 6, padding: '0 6px', fontSize: 12, background: '#faad14', color: '#fff', borderRadius: 2 } }, badge));
			return React.createElement('div', { key: label, style: { display: 'flex', alignItems: 'center', gap: 8 } }, React.createElement('span', { style: kvLabelStyle }, label), React.createElement('span', { style: kvValueStyle }, valNode));
		};
		var modelParamRowStyle = { display: 'flex', gap: 24, marginBottom: 16 };
		var fourColRows = function (nodes) {
			var out = [];
			for (var i = 0; i < nodes.length; i += 4) {
				var rowCells = [];
				for (var j = 0; j < 4; j++) {
					var idx = i + j;
					rowCells.push(React.createElement('div', { key: idx, style: gridColStyle }, nodes[idx] || null));
				}
				out.push(React.createElement('div', { key: i, style: modelParamRowStyle }, rowCells));
			}
			return out;
		};
		var maintenanceTableData = [
			{ key: '1', no: 1, item: '变速器油', kmCycle: '60000', monthCycle: '24', labor: '0', material: '571', total: '571', lastKm: '' },
			{ key: '2', no: 2, item: '变速器油', kmCycle: '60000', monthCycle: '24', labor: '0', material: '571', total: '571', lastKm: '' },
			{ key: '3', no: 3, item: '变速器油', kmCycle: '60000', monthCycle: '24', labor: '0', material: '571', total: '571', lastKm: '5000' },
			{ key: '4', no: 4, item: '变速器油', kmCycle: '60000', monthCycle: '24', labor: '0', material: '571', total: '571', lastKm: '5000' },
			{ key: '5', no: 5, item: '变速器油', kmCycle: '60000', monthCycle: '24', labor: '0', material: '571', total: '571', lastKm: '5000' }
		];
		var maintenanceColumns = [
			{ title: '序号', dataIndex: 'no', key: 'no', width: 60 },
			{ title: '养护项目', dataIndex: 'item', key: 'item', width: 120 },
			{ title: '保养公里周期(km)', dataIndex: 'kmCycle', key: 'kmCycle', width: 140 },
			{ title: '保养时间周期(月)', dataIndex: 'monthCycle', key: 'monthCycle', width: 130 },
			{ title: '工时费(元)', dataIndex: 'labor', key: 'labor', width: 100 },
			{ title: '材料费(元)', dataIndex: 'material', key: 'material', width: 100 },
			{ title: '合计', dataIndex: 'total', key: 'total', width: 80 },
			{ title: '上次保养公里数(KM)', dataIndex: 'lastKm', key: 'lastKm', width: 140 }
		];
		var modelParamContent = React.createElement('div', { style: tabContentCardStyle },
			React.createElement('div', { style: sectionTitleStyle }, React.createElement('span', { style: sectionIconStyle }), '型号参数'),
			React.createElement('div', { style: { marginBottom: 24 } }, fourColRows([
				kvItem('品牌', r.brand || '苏龙'),
				kvItem('型号', r.model || '海格牌KLQ5180XYKFCEV'),
				kvItem('车辆类型', r.vehicleType || '18吨双飞翼货车'),
				kvItem('燃料种类', '氢'),
				kvItem('整车尺寸', '5995mm x 2145mm x 3130mm'),
				kvItem('车牌颜色', '绿牌')
			])),
			React.createElement('div', { style: sectionTitleStyle }, React.createElement('span', { style: sectionIconStyle }), '轮胎情况'),
			React.createElement('div', { style: { marginBottom: 24 } }, fourColRows([
				kvItem('轮胎数量', '8'),
				kvItem('轮胎规格', '15/80R22.5')
			])),
			React.createElement('div', { style: sectionTitleStyle }, React.createElement('span', { style: sectionIconStyle }), '电气系统'),
			React.createElement('div', { style: { marginBottom: 24 } }, fourColRows([
				kvItem('电池类型', '磷酸铁锂'),
				kvItem('电池厂家', 'XXXXXXXXXXXXX企业名称'),
				kvItem('储电量', '100000 kWh'),
				kvItem('续航里程', '200 KM')
			])),
			React.createElement('div', { style: sectionTitleStyle }, React.createElement('span', { style: sectionIconStyle }), '供氢系统'),
			React.createElement('div', { style: { marginBottom: 24 } }, fourColRows([
				kvItem('氢瓶容量', 'xxx L'),
				kvItem('仪表盘模式', 'MPa'),
				kvItem('续航里程', '1000 KM'),
				kvItem('供氢系统厂家', 'XXXXXXXX企业')
			])),
			React.createElement('div', { style: sectionTitleStyle }, React.createElement('span', { style: sectionIconStyle }), '其他系统'),
			React.createElement('div', { style: { marginBottom: 24 } }, fourColRows([
				kvItem('冷机生产企业', 'XXXXXXXX企业'),
				kvItem('电堆生产企业', 'XXXXXXXX企业')
			])),
			React.createElement('div', { style: sectionTitleStyle }, React.createElement('span', { style: sectionIconStyle }), '保养参数'),
			React.createElement(Table, { size: 'small', rowKey: 'key', columns: maintenanceColumns, dataSource: maintenanceTableData, pagination: false })
		);

		var detailTabItems = [
			{ key: '型号参数', label: '型号参数', children: modelParamContent },
			{ key: '后装设备', label: '后装设备', children: React.createElement('div', { style: tabContentCardStyle }, tabContent('后装设备列表（原型占位）')) },
			{ key: '证照信息', label: '证照信息', children: React.createElement('div', { style: tabContentCardStyle }, tabContent('证照信息（原型占位）')) },
			{ key: '租赁记录', label: '租赁记录', children: React.createElement('div', { style: tabContentCardStyle }, tabContent('租赁记录（原型占位）')) },
			{ key: '保险记录', label: '保险记录', children: React.createElement('div', { style: tabContentCardStyle }, tabContent('保险记录（原型占位）')) },
			{ key: '维修记录', label: '维修记录', children: React.createElement('div', { style: tabContentCardStyle }, tabContent('维修记录（原型占位）')) },
			{ key: '事故记录', label: '事故记录', children: React.createElement('div', { style: tabContentCardStyle }, tabContent('事故记录（原型占位）')) },
			{ key: '故障记录', label: '故障记录', children: React.createElement('div', { style: tabContentCardStyle }, tabContent('故障记录（原型占位）')) },
			{ key: '违章记录', label: '违章记录', children: React.createElement('div', { style: tabContentCardStyle }, tabContent('违章记录（原型占位）')) },
			{ key: '异动记录', label: '异动记录', children: React.createElement('div', { style: tabContentCardStyle }, tabContent('异动记录（原型占位）')) },
			{ key: '调拨记录', label: '调拨记录', children: React.createElement('div', { style: tabContentCardStyle }, tabContent('调拨记录（原型占位）')) },
			{ key: '整备记录', label: '整备记录', children: React.createElement('div', { style: tabContentCardStyle }, tabContent('整备记录（原型占位）')) }
		];
		return React.createElement(App, null,
			React.createElement('div', { className: 'vm-page vm-detail-shell' },
				React.createElement('div', { className: 'vm-page-header' },
					React.createElement(Breadcrumb, {
						items: [
							{ title: '运维管理' },
							{ title: React.createElement('button', { type: 'button', className: 'vm-kv-link', style: { border: 'none', background: 'none', padding: 0 }, onClick: backToList }, '车辆管理') },
							{ title: '车辆详情' }
						]
					}),
					React.createElement(Button, { icon: VM_ICONS.back, onClick: backToList }, '返回列表')
				),
				React.createElement('div', { className: 'vm-detail-card' },
					React.createElement('div', { className: 'vm-section-title' }, '基本信息'),
					React.createElement('div', { className: 'vm-detail-hero' },
						React.createElement('span', { className: 'vm-online-dot', style: { width: 10, height: 10, borderRadius: 5, background: r.onlineStatus === '在线' ? '#10b981' : '#94a3b8', flexShrink: 0 } }),
						React.createElement('span', { className: 'vm-detail-plate' }, r.plateNo || '-'),
						renderStatusTag(r.operateStatus, vmOperateStatusColor),
						renderStatusTag(r.vehicleStatus, function () { return 'blue'; })
					),
					React.createElement('div', { style: { marginBottom: 8 } }, rows),
					React.createElement('div', { className: 'vm-expand-bar' },
						React.createElement(Button, { type: 'link', size: 'small', onClick: function () { _detailCardExpanded[1](!_detailCardExpanded[0]); } }, _detailCardExpanded[0] ? '收起详情' : '展开全部字段')
					)
				),
				React.createElement('div', { className: 'vm-detail-card vm-detail-tabs' },
					React.createElement(Tabs, {
						activeKey: _detailTab[0],
						onChange: function (key) { _detailTab[1](key); },
						items: detailTabItems
					})
				)
			)
		);
	}

	var requirementText = '# 车辆管理\n一个「车辆资产管理」后台的「车辆管理」模块，功能从上到下依次为：\n\n1.面包屑：\n运维管理-车辆管理\n\n2.筛选：\n2.1.运营城市：地区选择器，支持省-市2级地区选择；\n2.2.车辆类型：选择器，根据车辆类型表拉取；\n2.3.品牌：选择器，根据型号参数表拉取品牌字段；\n2.4.型号：选择器，根据型号参数表拉取型号字段；\n2.5.客户名称：选择器，根据租赁合同/自营合同对应客户名称拉取，并包含无；\n2.6.归属业务部门：选择器，根据租赁合同/自营合同对应归属业务部门拉取，并包含无；\n2.7.合同编号：选择器，支持输入框内输入内容模糊匹配选项；\n2.8.登记所有权：选择器，支持输入框内输入内容模糊匹配选项；\n2.9.运营公司：选择器，根据集团内运营公司维护，支持模糊搜索；批量导入时模板含该列则直接导入；\n2.10.车辆来源：选择器，选项为：自有、外租、挂靠；\n2.11.租赁公司：选择器，支持模糊搜索；批量导入时模板含该列则直接导入；\n\n3.列表：\n列表左上角为车牌号筛选框，输入车牌号可快速筛选列表内记录；右侧按钮为导出（联动多选）、批量导入，字段依次为运营城市、车辆识别代号、车牌号、车辆编号、车辆类型、品牌、型号、车身颜色、归属停车场、客户名称、业务部门、业务负责人、运营状态、车辆状态、出库状态、证照状态、保险状态、登记所有权、运营公司、车辆来源、租赁公司、在线状态、出厂年份、行驶公里数、采购入库时间、行驶证注册日期、行驶证检验有效期、上次交车时间、上次交车里程（KM）、上次还车时间、上次还车里程（KM）、强制报废日期、合同编号、当前位置、GPS最后上传时间、操作；\n（状态字段规则见《车辆状态》脑图：原库位/整备/过户/维修/报废等维度合并为「车辆状态」；「出库状态」仅保留三方退租出库、销售出库、报废出库、无。）\n\n3.1.运营城市：列固定在左侧，车辆实际运营城市，通过GPS当前位置获取，只显示至省-市2级；\n3.2.车辆识别代号：列固定在左侧，显示车辆识别代号（VIN码），为唯一值，采购、外部租赁等方式录入的车架号与系统现有车架号不能重复，导入亦然；\n3.3.车牌号：列固定在左侧，显示车牌号，主要通过上牌管理功能录入；\n3.4.车辆编号：显示车辆编号，主要由旧版迁移数据获取（这批车在港口需要单独以编号记录），其他车辆无此需求；\n3.5.车辆类型：显示车辆对应车辆类型，由车辆类型表中获取；\n3.6.品牌：显示车辆对应品牌，由型号参数表-品牌字段获取；\n3.7.型号：显示车辆对应型号，由型号参数表-型号字段获取；\n3.8.车身颜色：显示车辆对应颜色，由用户采购/外部租赁车辆合同时填写车身颜色（旧版迁移数据）字段获取；\n3.9.归属停车场：显示车辆归属停车场，交车出去租赁给客户的车辆显示为-，还车或发生异动时，根据运维记录，记录最后停放的停车场，停车场从停车场表中获取；\n3.10.客户名称：显示车辆租赁/自营合同发生时，该合同对应客户名称；\n3.11.业务部门：显示车辆租赁/自营合同发生时，该合同对应业务部门；\n3.12.业务负责人：显示车辆租赁/自营合同发生时，该合同对应业务负责人；\n3.13.运营状态：租赁、自营、可运营、待运营、退出运营（用以界定车辆当前业务情况）；\n3.14.车辆状态：合并展示原库位/整备/在途业务等，枚举含待验车、未备车、已备车、待交车、已交车、待还车、销售中、替换中、调拨中、异动中、三方退租中、无等；不含等待验车功能上线、呆滞车、过户中、报废中、维修中（用以界定用户可见的车辆资产状态）；\n3.15.出库状态：三方退租出库、销售出库、报废出库、无；\n3.16.证照状态：正常、异常、无（退出运营车辆可为无）；\n3.17.保险状态：正常、异常（交强险/商业险缺失或过期等）；\n3.18.登记所有权：行驶证对应所有人；\n3.19.运营公司：用于界定归属集团哪个公司运营，数据可来自手工维护或批量导入直接写入；\n3.20.车辆来源：分为：自有、外租、挂靠；\n3.21.租赁公司：车辆关联的租赁公司等信息，无则显示为-；可来自批量导入直接写入；\n3.22.在线状态：分为在线、离线，显示GPS在线状态，根据实际对接设备取状态；\n3.23.出厂年份：格式为YYYY，根据车辆采购合同时记录的出厂年份获取；\n3.24.行驶公里数（KM）：精确至2位小数，根据最近一次交车/还车/备车/异动/调拨记录时记录的行驶公里数获取；\n3.25.采购入库时间：格式为YYYY-MM-DD，根据采购合同时，采购完成车辆验车单提交时的时间；\n3.26.行驶证注册日期：格式为YYYY-MM-DD，根据上牌管理中，最后一次上传行驶证时的行驶证注册日期获取；\n3.27.行驶证检验有效期：根据行驶证（副联）中，检验记录中检验有效期获取；\n3.28.上次交车时间：格式为YYYY-MM-DD，根据最近一次交车记录完成时间获取；\n3.29.上次交车里程（KM）：精确至2位小数，根据最近一次交车记录中记录的里程获取；\n3.30.上次还车日期：格式为YYYY-MM-DD，根据最近一次还车记录完成时间获取；\n3.31.上次还车里程（KM）：精确至2位小数，根据最近一次还车记录中记录的里程获取；\n3.32.强制报废日期：格式为YYYY-MM-DD，根据行驶证（副联）中强制报废期获取；\n3.33.合同编号：显示当前租赁/自营合同合同编号，如无则显示为-；\n3.34.当前位置：根据车辆GPS当前定位获取，格式为xxx省xx市xx区/县xxxxx路xxxxx号xxxxxx\n3.35.GPS最后上传时间：格式为YYYY-MM-DD HH:MM，显示车辆GPS最后一次获取时间\n3.36.操作：操作列固定在右侧，显示查看、更多，悬浮更多时，显示车辆上牌、车辆过户、车辆异动、车辆调拨、车辆报废、车辆年审、车辆出售、故障提报；\n3.36.1.查看，点击跳转车辆详情页；\n3.36.2.车辆上牌，点击后上传照片，OCR识别过程中卡片提示：识别中，请勿关闭页面，之后弹出卡片，标题为确认上牌信息，左侧为行驶证照片，右侧为车辆识别代号（输入框，根据行驶证照片反写，可编辑）与车牌号（输入框，根据行驶证照片反写，可编辑），下侧为取消和确认按钮，点击确认，判断车辆识别代码与车牌号是否一致，如不一致提示车辆识别代号与该车辆不匹配，如一致则更新车牌号和行驶证照片（具体参考车辆业务-上牌管理）；\n3.36.3.车辆过户：\n3.36.4.车辆异动：\n3.36.5.车辆调拨：\n3.36.6.车辆报废：\n3.36.7.车辆年审：\n3.36.8.车辆出售；\n3.36.9.故障提报：';

	var buildFilterFields = function () {
		return [
			renderFilterField('运营城市', React.createElement(Cascader, { options: regionOptions, placeholder: '请选择省 / 市', style: filterControlStyle, value: _region[0].length ? _region[0] : undefined, onChange: function (v) { _region[1](v || []); }, allowClear: true })),
			renderFilterField('车辆类型', React.createElement(Select, { placeholder: '请选择', style: filterControlStyle, options: vehicleTypeOptions, value: _vehicleType[0], onChange: _vehicleType[1], allowClear: true })),
			renderFilterField('品牌', React.createElement(Select, { placeholder: '请选择', style: filterControlStyle, options: brandOptions, value: _brand[0], onChange: _brand[1], allowClear: true })),
			renderFilterField('型号', React.createElement(Select, { placeholder: '请选择', style: filterControlStyle, options: modelOptions, value: _model[0], onChange: _model[1], allowClear: true })),
			renderFilterField('客户名称', React.createElement(Select, { placeholder: '请选择', style: filterControlStyle, options: customerOptions, value: _customer[0], onChange: _customer[1], allowClear: true })),
			renderFilterField('归属部门', React.createElement(Select, { placeholder: '请选择', style: filterControlStyle, options: departmentOptions, value: _department[0], onChange: _department[1], allowClear: true })),
			renderFilterField('合同编号', React.createElement(Select, { placeholder: '请选择或搜索', style: filterControlStyle, options: contractOptions, value: _contractNo[0], onChange: _contractNo[1], allowClear: true, showSearch: true, filterOption: function (input, opt) { return (opt.label || '').toString().toLowerCase().indexOf((input || '').toLowerCase()) !== -1; } })),
			renderFilterField('登记所有权', React.createElement(Select, { placeholder: '请选择或搜索', style: filterControlStyle, options: ownershipOptions, value: _ownership[0], onChange: _ownership[1], allowClear: true, showSearch: true, filterOption: function (input, opt) { return (opt.label || '').toString().toLowerCase().indexOf((input || '').toLowerCase()) !== -1; } })),
			renderFilterField('运营公司', React.createElement(Select, { placeholder: '请选择或搜索', style: filterControlStyle, options: operateCompanyOptions, value: _operateCompany[0], onChange: _operateCompany[1], allowClear: true, showSearch: true, filterOption: function (input, opt) { return (opt.label || '').toString().toLowerCase().indexOf((input || '').toLowerCase()) !== -1; } })),
			renderFilterField('车辆来源', React.createElement(Select, { placeholder: '请选择', style: filterControlStyle, options: vehicleSourceOptions, value: _vehicleSource[0], onChange: _vehicleSource[1], allowClear: true })),
			renderFilterField('租赁公司', React.createElement(Select, { placeholder: '请选择或搜索', style: filterControlStyle, options: leaseCompanyOptions, value: _leaseCompany[0], onChange: _leaseCompany[1], allowClear: true, showSearch: true, filterOption: function (input, opt) { return (opt.label || '').toString().toLowerCase().indexOf((input || '').toLowerCase()) !== -1; } }))
		];
	};

	return React.createElement(App, null,
		React.createElement('div', { className: 'vm-page' },
			React.createElement('div', { className: 'vm-page-header' },
				React.createElement(Breadcrumb, { items: [{ title: '运维管理' }, { title: '车辆管理' }] }),
				React.createElement(Button, { type: 'default', className: 'vm-btn-req', icon: VM_ICONS.doc, onClick: function () { _requirementModalVisible[1](true); }, 'aria-label': '查看需求说明' }, '需求说明')
			),

			React.createElement(Card, { className: 'vm-filter-card', title: '筛选条件', bordered: false },
				React.createElement('div', { className: 'vm-filter-grid' }, (function () {
					var items = buildFilterFields();
					var limit = _filterExpanded[0] ? items.length : 8;
					var out = [];
					for (var i = 0; i < limit && i < items.length; i++) out.push(items[i]);
					return out;
				})()),
				React.createElement('div', { className: 'vm-filter-actions' },
					React.createElement(Button, { type: 'link', size: 'small', onClick: function () { _filterExpanded[1](!_filterExpanded[0]); } }, _filterExpanded[0] ? '收起筛选项' : '展开更多筛选项'),
					React.createElement(Button, { onClick: handleFilterReset }, '重置'),
					React.createElement(Button, { type: 'primary', icon: VM_ICONS.search, onClick: function () { message.success('已应用筛选条件（原型）'); } }, '查询')
				)
			),

			React.createElement('div', { className: 'vm-table-section' },
				React.createElement('div', { className: 'vm-table-toolbar' },
					React.createElement('div', { className: 'vm-table-toolbar-meta' },
						'共 ', React.createElement('strong', null, String(dataSource.length)), ' 辆车',
						_selectedRowKeys[0].length ? React.createElement('span', null, '　已选 ', React.createElement('strong', null, String(_selectedRowKeys[0].length)), ' 条') : null
					),
					React.createElement('div', { className: 'vm-table-toolbar-actions' },
						React.createElement(Input.Search, {
							className: 'vm-plate-search',
							placeholder: '输入车牌号快速筛选',
							allowClear: true,
							value: _plateFilter[0],
							onChange: onPlateFilterChange,
							onSearch: onPlateFilterChange
						}),
						React.createElement(Button, { icon: VM_ICONS.export, onClick: handleExport }, '导出'),
						React.createElement(Button, { icon: VM_ICONS.upload, onClick: handleBatchImport }, '批量导入'),
						React.createElement(Button, { onClick: openInspectImportModal }, '导入等评时间')
					)
				),
				React.createElement('div', { className: 'vm-table-card' },
					React.createElement(Table, {
						className: 'vm-list-table',
						rowKey: 'id',
						columns: columns,
						dataSource: dataSource,
						rowSelection: rowSelection,
						scroll: { x: 4020 },
						size: 'middle',
						locale: { emptyText: emptyNode },
						pagination: { showSizeChanger: true, showQuickJumper: true, showTotal: function (t) { return '共 ' + t + ' 条'; }, defaultPageSize: 10, pageSizeOptions: ['10', '20', '50'] }
					})
				)
			),

			// 车辆上牌：上传/识别中
			React.createElement(Modal, {
				title: '上传行驶证',
				open: _uploadModalVisible[0],
				wrapClassName: 'vm-modal-wrap',
				onCancel: closeUploadModal,
				footer: [
					React.createElement(Button, { key: 'cancel', onClick: closeUploadModal }, '取消'),
					React.createElement(Button, { key: 'ok', type: 'primary', onClick: startOcrThenConfirm }, '开始识别')
				]
			},
				React.createElement('div', { className: 'vm-modal-hint' }, '上传行驶证照片后将自动 OCR 识别车架号与车牌号'),
				React.createElement(Upload.Dragger, { accept: 'image/*', multiple: false, style: { borderRadius: 12 } },
					React.createElement('p', { className: 'ant-upload-drag-icon', style: { marginBottom: 8 } }, VM_ICONS.upload),
					React.createElement('p', { style: { margin: 0, fontWeight: 600, color: '#334155' } }, '点击或拖拽行驶证照片到此区域')
				)
			),

			React.createElement(Modal, {
				title: '识别中，请勿关闭页面',
				open: _ocrLoadingVisible[0],
				wrapClassName: 'vm-modal-wrap',
				footer: null,
				closable: false,
				maskClosable: false
			}, React.createElement('div', { style: { textAlign: 'center', padding: '24px 0' } }, '正在识别行驶证信息...')),

			React.createElement(Modal, {
				title: '确认上牌信息',
				open: _confirmModalVisible[0],
				wrapClassName: 'vm-modal-wrap',
				onCancel: closeConfirmModal,
				width: 640,
				footer: [
					React.createElement(Button, { key: 'cancel', onClick: closeConfirmModal }, '取消'),
					React.createElement(Button, { key: 'ok', type: 'primary', onClick: confirmPlate }, '确认')
				]
			}, React.createElement('div', { style: { display: 'flex', gap: 24 } },
				React.createElement('div', { style: { flex: '0 0 240px' } },
					React.createElement('div', { style: { marginBottom: 8, color: '#666' } }, '行驶证照片'),
					React.createElement('img', { src: 'https://picsum.photos/240/160', alt: '行驶证', style: { width: '100%', borderRadius: 8 } })
				),
				React.createElement('div', { style: { flex: 1 } },
					React.createElement('div', { style: { marginBottom: 12 } },
						React.createElement('span', { style: { marginRight: 8 } }, '车辆识别代号'),
						React.createElement(Input, {
							value: _plateForm[0].vin,
							onChange: function (e) { onPlateFormChange('vin', e.target.value); },
							placeholder: '根据行驶证反写，可编辑',
							style: { width: '100%' }
						})
					),
					React.createElement('div', { style: { marginBottom: 12 } },
						React.createElement('span', { style: { marginRight: 8 } }, '车牌号'),
						React.createElement(Input, {
							value: _plateForm[0].plateNo,
							onChange: function (e) { onPlateFormChange('plateNo', e.target.value); },
							placeholder: '根据行驶证反写，可编辑',
							style: { width: '100%' }
						})
					),
					_plateError[0] ? React.createElement('div', { style: { color: '#ff4d4f', fontSize: 12 } }, _plateError[0]) : null
				)
			)),
			React.createElement(Modal, {
				title: '需求说明',
				open: _requirementModalVisible[0],
				wrapClassName: 'vm-modal-wrap',
				onCancel: function () { _requirementModalVisible[1](false); },
				width: 720,
				footer: React.createElement(Button, { onClick: function () { _requirementModalVisible[1](false); } }, '关闭')
			}, React.createElement('div', { className: 'vm-prd-content' }, requirementText)),

			React.createElement(Modal, {
				title: '编辑车辆信息',
				open: _editModalVisible[0],
				wrapClassName: 'vm-modal-wrap',
				onCancel: closeEditModal,
				width: 720,
				destroyOnClose: true,
				footer: [
					React.createElement(Button, { key: 'cancel', onClick: closeEditModal }, '取消'),
					React.createElement(Button, { key: 'save', type: 'primary', onClick: saveEdit }, '保存')
				]
			}, _editRecord[0] ? React.createElement('div', null,
				React.createElement('div', { className: 'vm-edit-banner' },
					'车牌号：', React.createElement('span', { style: { fontWeight: 600, color: 'rgba(0,0,0,0.85)' } }, _editRecord[0].plateNo || '-'),
					'　VIN：', React.createElement('span', { style: { color: 'rgba(0,0,0,0.85)' } }, _editRecord[0].vin || '-')
				),
				React.createElement(Form, { layout: 'vertical' },
					React.createElement(Row, { gutter: 16 },
						React.createElement(Col, { span: 12 },
							React.createElement(Form.Item, { label: '车辆归属停车场', required: true },
								React.createElement(Select, {
									placeholder: '请选择停车场',
									style: { width: '100%' },
									options: parkingOptions,
									value: _editForm[0].parking,
									onChange: function (v) { onEditFormChange('parking', v); },
									allowClear: true,
									showSearch: true,
									filterOption: function (input, opt) { return (opt.label || '').toString().toLowerCase().indexOf((input || '').toLowerCase()) !== -1; }
								})
							)
						),
						React.createElement(Col, { span: 12 },
							React.createElement(Form.Item, { label: '运营状态', required: true },
								React.createElement(Select, {
									placeholder: '请选择运营状态',
									style: { width: '100%' },
									options: operateStatusOptions,
									value: _editForm[0].operateStatus,
									onChange: function (v) { onEditFormChange('operateStatus', v); }
								})
							)
						),
						React.createElement(Col, { span: 12 },
							React.createElement(Form.Item, { label: '车辆状态', required: true },
								React.createElement(Select, {
									placeholder: '请选择车辆状态',
									style: { width: '100%' },
									options: vehicleStatusOptions,
									value: _editForm[0].vehicleStatus,
									onChange: function (v) { onEditFormChange('vehicleStatus', v); }
								})
							)
						),
						React.createElement(Col, { span: 12 },
							React.createElement(Form.Item, { label: '登记所有权' },
								React.createElement(Input, {
									placeholder: '请输入登记所有权',
									value: _editForm[0].ownership || '',
									onChange: function (e) { onEditFormChange('ownership', e.target.value); },
									allowClear: true
								})
							)
						),
						React.createElement(Col, { span: 12 },
							React.createElement(Form.Item, { label: '运营公司' },
								React.createElement(Select, {
									placeholder: '请选择运营公司',
									style: { width: '100%' },
									options: operateCompanyOptions,
									value: _editForm[0].operateCompany,
									onChange: function (v) { onEditFormChange('operateCompany', v); },
									allowClear: true,
									showSearch: true,
									filterOption: function (input, opt) { return (opt.label || '').toString().toLowerCase().indexOf((input || '').toLowerCase()) !== -1; }
								})
							)
						),
						React.createElement(Col, { span: 12 },
							React.createElement(Form.Item, { label: '车辆来源' },
								React.createElement(Select, {
									placeholder: '请选择车辆来源',
									style: { width: '100%' },
									options: vehicleSourceOptions,
									value: _editForm[0].vehicleSource,
									onChange: function (v) { onEditFormChange('vehicleSource', v); },
									allowClear: true
								})
							)
						),
						React.createElement(Col, { span: 12 },
							React.createElement(Form.Item, { label: '租赁公司' },
								React.createElement(Input, {
									placeholder: '请输入租赁公司，无则留空',
									value: _editForm[0].leaseCompany || '',
									onChange: function (e) { onEditFormChange('leaseCompany', e.target.value); },
									allowClear: true
								})
							)
						),
						React.createElement(Col, { span: 12 },
							React.createElement(Form.Item, { label: '出厂年份' },
								React.createElement(Select, {
									placeholder: '请选择出厂年份',
									style: { width: '100%' },
									options: yearOptions,
									value: _editForm[0].year,
									onChange: function (v) { onEditFormChange('year', v); },
									allowClear: true
								})
							)
						),
						React.createElement(Col, { span: 12 },
							React.createElement(Form.Item, { label: '采购入库时间', extra: '格式：YYYY-MM-DD' },
								React.createElement(Input, {
									placeholder: '请输入采购入库时间',
									value: _editForm[0].purchaseDate || '',
									onChange: function (e) { onEditFormChange('purchaseDate', e.target.value); },
									allowClear: true
								})
							)
						)
					)
				)
			) : null),

			React.createElement(Modal, {
				title: '批量导入等评时间',
				open: _inspectImportModalVisible[0],
				wrapClassName: 'vm-modal-wrap',
				onCancel: closeInspectImportModal,
				width: 520,
				footer: React.createElement(Button, { onClick: closeInspectImportModal }, '关闭')
			}, React.createElement('div', null,
				React.createElement('div', { style: { marginBottom: 16 } },
					React.createElement(Upload.Dragger, {
						accept: '.csv',
						showUploadList: false,
						beforeUpload: function (file) { handleInspectImportUpload(file); return false; }
					}, React.createElement('p', { style: { margin: 0, padding: '16px 0' } }, '点击或拖拽 CSV 文件到此区域批量上传')),
					React.createElement(Button, { type: 'link', onClick: downloadInspectTemplate, style: { marginTop: 8, padding: 0 } }, '下载导入模板')
				),
				_inspectImportResult[0] && _inspectImportResult[0].hasFailed ? React.createElement('div', { className: 'vm-import-fail' },
					React.createElement('span', { style: { color: 'rgba(0,0,0,0.85)' } }, '上传失败，'),
					React.createElement('a', { href: '#', onClick: function (e) { e.preventDefault(); downloadInspectFailedCsv(); }, style: { color: '#1890ff' } }, '查看失败记录')
				) : null
			))
		)
	);
};
