完善字段信息
This commit is contained in:
@@ -77,7 +77,7 @@
|
||||
.purchase-item .item-main { display: flex; justify-content: space-between; align-items: baseline; }
|
||||
.purchase-item .item-name { font-size: 16px; font-weight: 500; }
|
||||
.purchase-item .item-amount { font-size: 16px; font-weight: 600; }
|
||||
.purchase-item .item-meta { display: flex; justify-content: space-between; margin-top: 4px; font-size: 13px; color: #888; }
|
||||
.purchase-item .item-meta { display: flex; justify-content: space-between; margin-top: 4px; font-size: 13px; color: #888; flex-wrap: wrap; gap: 4px; }
|
||||
.status-badge { background: #fef3c7; padding: 1px 6px; border-radius: 8px; font-size: 12px; }
|
||||
.status-badge.done { background: #d1fae5; }
|
||||
|
||||
@@ -99,7 +99,6 @@
|
||||
|
||||
.version { text-align: center; font-size: 12px; color: #aaa; margin-top: 16px; }
|
||||
|
||||
/* 全屏预览弹窗 */
|
||||
.fullscreen-overlay {
|
||||
position: fixed; top: 0; left: 0; width: 100%; height: 100%;
|
||||
background: rgba(0,0,0,0.9); display: flex; align-items: center; justify-content: center;
|
||||
@@ -111,6 +110,8 @@
|
||||
overflow: auto; font-size: 16px; line-height: 1.5; color: #333;
|
||||
}
|
||||
.fullscreen-overlay .fullscreen-text img { max-width: 200px; border-radius: 8px; margin: 4px 0; }
|
||||
|
||||
.detail-row { margin-bottom: 8px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -123,7 +124,7 @@
|
||||
<input type="password" id="login-pass" placeholder="密码">
|
||||
<button class="primary-btn" onclick="login()" style="width:100%;">登录</button>
|
||||
<p id="login-error" style="color:red; margin-top:8px;"></p>
|
||||
<div class="version">v2.2</div>
|
||||
<div class="version">v2.4</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -332,14 +333,11 @@
|
||||
|
||||
function scrollToBottom() { messagesContainer.scrollTop = messagesContainer.scrollHeight; }
|
||||
|
||||
// 双击全屏相关
|
||||
function bindMessageEvents() {
|
||||
// 图片双击全屏
|
||||
document.querySelectorAll('.msg-img').forEach(img => {
|
||||
img.removeEventListener('dblclick', onImageDblClick);
|
||||
img.addEventListener('dblclick', onImageDblClick);
|
||||
});
|
||||
// 气泡双击全屏
|
||||
document.querySelectorAll('.msg-bubble').forEach(bubble => {
|
||||
bubble.removeEventListener('dblclick', onBubbleDblClick);
|
||||
bubble.addEventListener('dblclick', onBubbleDblClick);
|
||||
@@ -348,10 +346,9 @@
|
||||
|
||||
function onImageDblClick(e) {
|
||||
e.stopPropagation();
|
||||
const imgSrc = e.target.src;
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'fullscreen-overlay';
|
||||
overlay.innerHTML = `<img src="${imgSrc}" alt="">`;
|
||||
overlay.innerHTML = `<img src="${e.target.src}" alt="">`;
|
||||
overlay.addEventListener('click', () => overlay.remove());
|
||||
document.body.appendChild(overlay);
|
||||
}
|
||||
@@ -359,9 +356,7 @@
|
||||
function onBubbleDblClick(e) {
|
||||
e.stopPropagation();
|
||||
const bubble = e.currentTarget;
|
||||
// 克隆气泡内容,去掉事件
|
||||
const clone = bubble.cloneNode(true);
|
||||
// 移除可能有的链接行为
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'fullscreen-overlay';
|
||||
const container = document.createElement('div');
|
||||
@@ -488,12 +483,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 修正滑动手势方向
|
||||
function initSwipeGestures() {
|
||||
const chatPage = document.getElementById('chat-page');
|
||||
const purchaseOverlay = document.getElementById('purchase-panel-overlay');
|
||||
let startX = 0;
|
||||
let startY = 0;
|
||||
let startX = 0, startY = 0;
|
||||
|
||||
function handleTouchStart(e) {
|
||||
startX = e.touches[0].clientX;
|
||||
@@ -508,22 +501,12 @@
|
||||
const diffY = endY - startY;
|
||||
if (Math.abs(diffX) > Math.abs(diffY) && Math.abs(diffX) > 50) {
|
||||
if (target === chatPage && !purchaseOverlay.classList.contains('hidden')) {
|
||||
// 采购清单打开时,任意水平滑动都关闭
|
||||
if (Math.abs(diffX) > 30) {
|
||||
closePurchasePanel();
|
||||
}
|
||||
if (Math.abs(diffX) > 30) closePurchasePanel();
|
||||
} else if (target === chatPage) {
|
||||
// 右滑返回列表,左滑打开采购清单
|
||||
if (diffX > 30) {
|
||||
showList();
|
||||
} else if (diffX < -30) {
|
||||
openPurchasePanel();
|
||||
}
|
||||
if (diffX > 30) showList();
|
||||
else if (diffX < -30) openPurchasePanel();
|
||||
} else if (target === purchaseOverlay) {
|
||||
// 采购清单上任意滑动都关闭
|
||||
if (Math.abs(diffX) > 30) {
|
||||
closePurchasePanel();
|
||||
}
|
||||
if (Math.abs(diffX) > 30) closePurchasePanel();
|
||||
}
|
||||
}
|
||||
startX = 0; startY = 0;
|
||||
@@ -681,7 +664,11 @@
|
||||
html += `
|
||||
<div class="purchase-item" onclick="openDetail('${item.id}')">
|
||||
<div class="item-main"><span class="item-name">${item.item}</span><span class="item-amount">¥${item.amount}</span></div>
|
||||
<div class="item-meta"><span>${dateShort} ${timeShort}</span><span>${item.applicant || ''} / ${item.method || ''}</span><span class="status-badge ${item.status==='已完成'?'done':''}">${item.status}</span></div>
|
||||
<div class="item-meta">
|
||||
<span>${dateShort} ${timeShort}</span>
|
||||
<span>×${item.quantity} ${item.invoice_type !== '无票' ? '· ' + item.invoice_type : ''}</span>
|
||||
<span class="status-badge ${item.status==='已完成'?'done':''}">${item.status}</span>
|
||||
</div>
|
||||
</div>`;
|
||||
});
|
||||
html += '</div>';
|
||||
@@ -710,7 +697,20 @@
|
||||
let attachHtml = '';
|
||||
if (p.attachments?.length) attachHtml = '<div class="attachments">' + p.attachments.map(a => `<img class="img-thumb" src="${a.file_path}" alt="${a.file_path}">`).join('') + '</div>';
|
||||
const historyHtml = p.history?.map(h => `<li><span class="history-time">${h.timestamp}</span> ${h.user}: ${h.action}</li>`).join('') || '';
|
||||
document.getElementById('detail-content').innerHTML = `<p><strong>金额:</strong>¥${p.amount} | <strong>方式:</strong>${p.method}</p><p><strong>申请人:</strong>${p.applicant}</p>${attachHtml}<h4 style="margin-top:12px;">操作历史</h4><ul class="history-list">${historyHtml}</ul>`;
|
||||
document.getElementById('detail-content').innerHTML = `
|
||||
<div class="detail-row"><strong>数量:</strong>${p.quantity}</div>
|
||||
<div class="detail-row"><strong>单价:</strong>¥${p.unit_price}</div>
|
||||
<div class="detail-row"><strong>邮费:</strong>¥${p.freight}</div>
|
||||
<div class="detail-row"><strong>总金额:</strong>¥${p.amount}</div>
|
||||
<div class="detail-row"><strong>付款方式:</strong>${p.payment_method || '未指定'}</div>
|
||||
<div class="detail-row"><strong>发票:</strong>${p.invoice_type || '无票'}</div>
|
||||
<div class="detail-row"><strong>状态:</strong>${p.status}</div>
|
||||
<div class="detail-row"><strong>申请人:</strong>${p.applicant}</div>
|
||||
<div class="detail-row"><strong>采购时间:</strong>${p.created_at}</div>
|
||||
<div class="detail-row"><strong>备注:</strong>${p.remarks || '无'}</div>
|
||||
${attachHtml}
|
||||
<h4 style="margin-top:12px;">操作历史</h4>
|
||||
<ul class="history-list">${historyHtml}</ul>`;
|
||||
document.getElementById('detail-modal').classList.remove('hidden');
|
||||
}
|
||||
function closeDetailModal() { document.getElementById('detail-modal').classList.add('hidden'); }
|
||||
|
||||
Reference in New Issue
Block a user