feat(web): 同步 web 端目录更新至 Gitea
包含加氢站站点信息、运维交车/故障、台账与数据分析等页面新增与改动。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -113,6 +113,12 @@ const Component = function() {
|
||||
var os1j = React.useState('');
|
||||
var serviceItemSearch = os1j[0];
|
||||
var setServiceItemSearch = os1j[1];
|
||||
var copyPopState = React.useState(null);
|
||||
var copyPopover = copyPopState[0];
|
||||
var setCopyPopover = copyPopState[1];
|
||||
var copyQtyState = React.useState('1');
|
||||
var copyQuantity = copyQtyState[0];
|
||||
var setCopyQuantity = copyQtyState[1];
|
||||
var os1k = React.useState(null);
|
||||
var plateNoDropdownRect = os1k[0];
|
||||
var setPlateNoDropdownRect = os1k[1];
|
||||
@@ -296,16 +302,57 @@ const Component = function() {
|
||||
next.splice(index, 1);
|
||||
setRentalOrders(next.length ? next : [Object.assign({}, emptyRentalRow)]);
|
||||
};
|
||||
var copyRentalRow = function(index) {
|
||||
var row = rentalOrders[index];
|
||||
if (!row) return;
|
||||
var serviceItemsCopy = (row.serviceItems || []).map(function(si) { return { project: si.project || '', fee: si.fee || '', effectiveDate: si.effectiveDate || '' }; });
|
||||
var buildDuplicateRentalRow = function(sourceRow) {
|
||||
var serviceItemsCopy = (sourceRow.serviceItems || []).map(function(si) { return { project: si.project || '', fee: si.fee || '', effectiveDate: si.effectiveDate || '' }; });
|
||||
if (serviceItemsCopy.length === 0) serviceItemsCopy = [{ project: '', fee: '', effectiveDate: '' }];
|
||||
var newRow = { id: nextRentalRowIdRef.current++, brand: row.brand || '', model: row.model || '', plateNo: '', vin: '', monthRent: row.monthRent || '', serviceItems: serviceItemsCopy, deposit: row.deposit || '', remark: row.remark || '' };
|
||||
return { id: nextRentalRowIdRef.current++, brand: sourceRow.brand || '', model: sourceRow.model || '', plateNo: '', vin: '', monthRent: sourceRow.monthRent || '', serviceItems: serviceItemsCopy, deposit: sourceRow.deposit || '', remark: sourceRow.remark || '' };
|
||||
};
|
||||
var applyRentalRowCopies = function(rowIndex, count) {
|
||||
var row = rentalOrders[rowIndex];
|
||||
if (!row) return;
|
||||
var n = typeof count === 'number' ? count : parseInt(String(count), 10);
|
||||
if (isNaN(n) || n < 0) {
|
||||
if (message.warning) message.warning('请输入非负整数');
|
||||
return;
|
||||
}
|
||||
n = Math.floor(n);
|
||||
if (n === 0) {
|
||||
setCopyPopover(null);
|
||||
if (message.info) message.info('复制数量为 0,未新增行');
|
||||
return;
|
||||
}
|
||||
var next = rentalOrders.slice(0);
|
||||
next.splice(index + 1, 0, newRow);
|
||||
var insertAt = rowIndex + 1;
|
||||
for (var i = 0; i < n; i++) {
|
||||
next.splice(insertAt + i, 0, buildDuplicateRentalRow(row));
|
||||
}
|
||||
setRentalOrders(next);
|
||||
if (typeof message !== 'undefined' && message.success) message.success('已复制该行(车牌号已清空)');
|
||||
setCopyPopover(null);
|
||||
if (message.success) message.success('已复制 ' + n + ' 条记录(车牌号已清空)');
|
||||
};
|
||||
var confirmRentalCopyPopover = function() {
|
||||
if (!copyPopover) return;
|
||||
if (copyQuantity === '') {
|
||||
if (message.warning) message.warning('请输入复制数量');
|
||||
return;
|
||||
}
|
||||
if (!/^\d+$/.test(copyQuantity)) {
|
||||
if (message.warning) message.warning('请输入非负整数');
|
||||
return;
|
||||
}
|
||||
applyRentalRowCopies(copyPopover.index, parseInt(copyQuantity, 10));
|
||||
};
|
||||
var openRentalCopyPopover = function(rowIndex, anchorEl) {
|
||||
if (!anchorEl || !anchorEl.getBoundingClientRect) return;
|
||||
var r = anchorEl.getBoundingClientRect();
|
||||
var cardH = 168;
|
||||
var top = r.bottom + 8;
|
||||
if (top + cardH > window.innerHeight - 8) top = Math.max(8, r.top - cardH - 8);
|
||||
var left = r.left;
|
||||
var cardW = 240;
|
||||
if (left + cardW > window.innerWidth - 8) left = Math.max(8, window.innerWidth - cardW - 8);
|
||||
setCopyPopover({ index: rowIndex, top: top, left: left });
|
||||
setCopyQuantity('1');
|
||||
};
|
||||
var updateRentalOrder = function(index, field, value) {
|
||||
var next = rentalOrders.slice(0);
|
||||
@@ -384,6 +431,22 @@ const Component = function() {
|
||||
return function() { document.removeEventListener('mousedown', handler); };
|
||||
}, [deliveryRegionOpen]);
|
||||
|
||||
React.useEffect(function() {
|
||||
if (!copyPopover) return;
|
||||
var handler = function(e) {
|
||||
var pop = document.getElementById('rental-copy-popover');
|
||||
if (pop && pop.contains(e.target)) return;
|
||||
setCopyPopover(null);
|
||||
};
|
||||
var t = window.setTimeout(function() {
|
||||
document.addEventListener('mousedown', handler);
|
||||
}, 0);
|
||||
return function() {
|
||||
window.clearTimeout(t);
|
||||
document.removeEventListener('mousedown', handler);
|
||||
};
|
||||
}, [copyPopover]);
|
||||
|
||||
React.useEffect(function() {
|
||||
if (plateNoFocusRow === null) { setPlateNoDropdownRect(null); return; }
|
||||
var timer = setTimeout(function() {
|
||||
@@ -451,7 +514,10 @@ const Component = function() {
|
||||
btnGroupItemActive: { backgroundColor: '#1677ff', color: '#fff', borderColor: '#1677ff', borderRightColor: '#1677ff' },
|
||||
feeSectionTitle: { fontSize: 16, fontWeight: 600, color: '#333', marginTop: 20, marginBottom: 10 },
|
||||
feeSectionTitleFirst: { marginTop: 0 },
|
||||
modalFormInput: { width: '100%', padding: '8px 12px', border: '1px solid #d9d9d9', borderRadius: 4, fontSize: 14, height: 36, boxSizing: 'border-box' }
|
||||
modalFormInput: { width: '100%', padding: '8px 12px', border: '1px solid #d9d9d9', borderRadius: 4, fontSize: 14, height: 36, boxSizing: 'border-box' },
|
||||
copyPopoverCard: { position: 'fixed', zIndex: 2000, backgroundColor: '#fff', borderRadius: 8, boxShadow: '0 4px 20px rgba(0,0,0,0.12), 0 0 1px rgba(0,0,0,0.08)', border: '1px solid #f0f0f0', padding: '14px 16px', minWidth: 232, maxWidth: 'calc(100vw - 24px)' },
|
||||
copyPopoverTitle: { fontSize: 14, fontWeight: 600, color: 'rgba(0,0,0,0.88)', marginBottom: 12 },
|
||||
copyPopoverFooter: { display: 'flex', justifyContent: 'flex-end', gap: 8, marginTop: 14 }
|
||||
};
|
||||
|
||||
var CardBlock = function(props) {
|
||||
@@ -582,7 +648,7 @@ const Component = function() {
|
||||
React.createElement('td', { style: styles.rentalTdCenter }, calcRowServiceFee(row) + ' 元'),
|
||||
React.createElement('td', { style: styles.rentalTd }, React.createElement('div', { style: { display: 'flex', alignItems: 'center' } }, React.createElement(Input, { placeholder: '0.00', value: row.deposit || '', onChange: function(e) { updateRentalOrder(idx, 'deposit', e.target.value); }, style: styles.rentalInput }), React.createElement('span', { style: { marginLeft: 4, whiteSpace: 'nowrap' } }, '元'))),
|
||||
React.createElement('td', { style: styles.rentalTd }, React.createElement(Input, { placeholder: '备注', value: row.remark || '', onChange: function(e) { updateRentalOrder(idx, 'remark', e.target.value); }, style: Object.assign({}, styles.rentalInput, { width: '100%' }) })),
|
||||
React.createElement('td', { style: styles.rentalTdCenter }, React.createElement('div', { style: { display: 'inline-flex', gap: 4, alignItems: 'center' } }, React.createElement(Button, { type: 'link', size: 'small', onClick: function() { copyRentalRow(idx); } }, '复制'), React.createElement(Button, { type: 'link', size: 'small', danger: true, onClick: function() { removeRentalRow(idx); } }, '删除')))
|
||||
React.createElement('td', { style: styles.rentalTdCenter }, React.createElement('div', { style: { display: 'inline-flex', gap: 4, alignItems: 'center' } }, React.createElement(Button, { type: 'link', size: 'small', 'aria-haspopup': 'dialog', 'aria-expanded': copyPopover && copyPopover.index === idx, onClick: function(e) { e.preventDefault(); e.stopPropagation(); openRentalCopyPopover(idx, e.currentTarget); } }, '复制'), React.createElement(Button, { type: 'link', size: 'small', danger: true, onClick: function() { removeRentalRow(idx); } }, '删除')))
|
||||
);
|
||||
});
|
||||
|
||||
@@ -609,6 +675,41 @@ const Component = function() {
|
||||
var rentalTableTbody = React.createElement('tbody', null, rentalTableBody);
|
||||
var rentalTableEl = React.createElement('table', { style: styles.rentalTable }, rentalTableThead, rentalTableTbody);
|
||||
var rentalTableWrap = React.createElement('div', { style: { overflowX: 'auto', marginBottom: 16 } }, rentalTableEl);
|
||||
var rentalCopyPopoverEl = copyPopover
|
||||
? React.createElement('div', {
|
||||
id: 'rental-copy-popover',
|
||||
role: 'dialog',
|
||||
'aria-modal': 'false',
|
||||
'aria-label': '复制租赁订单行',
|
||||
style: Object.assign({}, styles.copyPopoverCard, { top: copyPopover.top, left: copyPopover.left }),
|
||||
onMouseDown: function(e) { e.stopPropagation(); }
|
||||
},
|
||||
React.createElement('div', { style: styles.copyPopoverTitle }, '复制本行'),
|
||||
React.createElement('div', null,
|
||||
React.createElement('label', { style: { display: 'block', fontSize: 13, color: 'rgba(0,0,0,0.65)', marginBottom: 6 } }, '复制数量'),
|
||||
React.createElement(Input, {
|
||||
value: copyQuantity,
|
||||
placeholder: '非负整数,如 3',
|
||||
inputMode: 'numeric',
|
||||
pattern: '[0-9]*',
|
||||
autoComplete: 'off',
|
||||
'aria-label': '复制数量,非负整数',
|
||||
onChange: function(e) {
|
||||
var raw = (e.target && e.target.value) || '';
|
||||
var digits = raw.replace(/\D/g, '');
|
||||
setCopyQuantity(digits);
|
||||
},
|
||||
onPressEnter: confirmRentalCopyPopover,
|
||||
style: { width: '100%' }
|
||||
})
|
||||
),
|
||||
React.createElement('div', { style: styles.copyPopoverFooter },
|
||||
React.createElement(Button, { size: 'small', onClick: function() { setCopyPopover(null); } }, '取消'),
|
||||
React.createElement(Button, { type: 'primary', size: 'small', onClick: confirmRentalCopyPopover }, '确认')
|
||||
)
|
||||
)
|
||||
: null;
|
||||
|
||||
var rentalContent = React.createElement('div', null, rentalSummary, formErrors.rentalOrders ? React.createElement('div', { style: styles.errMsg }, formErrors.rentalOrders) : null, rentalTableWrap, React.createElement(Button, { type: 'dashed', style: { marginTop: 12, width: '100%' }, onClick: addRentalRow }, '添加一行'), hydrogenFormRow);
|
||||
|
||||
var feeTableHeader3 = React.createElement('tr', null, React.createElement('th', { style: styles.rentalTh }, '项目'), React.createElement('th', { style: styles.rentalTh }, '收费标准'), React.createElement('th', { style: styles.rentalTh }, '服务费'));
|
||||
@@ -692,6 +793,7 @@ const Component = function() {
|
||||
React.createElement(CardBlock, { id: 'card-fee', cardStyle: { marginTop: 16 }, title: '其他费用信息', collapsed: cc5, setCollapsed: setCc5 }, feeContent),
|
||||
React.createElement(CardBlock, { id: 'card-billing', cardStyle: { marginTop: 16 }, title: '账单计算方式', collapsed: cc6, setCollapsed: setCc6 }, billingContent),
|
||||
React.createElement('div', { style: { height: 60 } }),
|
||||
rentalCopyPopoverEl,
|
||||
serviceModalContent,
|
||||
reqSpecModalContent,
|
||||
React.createElement('div', { style: styles.footer }, React.createElement(Button, { type: 'primary', size: 'large', onClick: function() { if (validateSubmitAndReview()) { message.success('租赁合同已提交审核。'); } } }, '提交并审核'), React.createElement(Button, { size: 'large', onClick: function() { message.info('保存,加入租赁合同列表(仅操作人可查看编辑)'); } }, '保存'), React.createElement(Button, { size: 'large', onClick: function() { message.info('取消'); } }, '取消'))
|
||||
|
||||
Reference in New Issue
Block a user