feat(costreview): 询价附件支持清单绑定并新增项目筛选、动态明细标签与行结构统一
This commit is contained in:
@@ -125,7 +125,7 @@ const COLS = {
|
||||
// 标记 'F' = 固定宽列;无标记 = 伸缩列(名称/规格型号),平分容器剩余宽度
|
||||
// —— 表宽始终贴合容器撑满屏幕,见 flexFit() / flexRedistribute()。
|
||||
lme: [['序号', 52, 'c', 'F'], ['编码', 120, 'c', 'F'], ['名称', 220, 'l'], ['规格型号', 200, 'l'],
|
||||
['单位', 56, 'c', 'F'], ['数量', 90, 'r', 'F'], ['除税编制价', 110, 'r', 'F'], ['税率', 70, 'r', 'F'],
|
||||
['单位', 56, 'c', 'F'], ['数量', 135, 'r', 'F'], ['除税编制价', 110, 'r', 'F'], ['税率', 70, 'r', 'F'], // 决策 145:数量列宽 ×1.5(90→135)
|
||||
['含税编制价', 110, 'r', 'F'], ['取消采纳', 76, 'c', 'F', 'ns', 'wb'], ['备注', 160, 'l', '', '', 'wb']]
|
||||
};
|
||||
/* 后台列数组 = 工作台列剔除 wb 列(派生,不另维护)。
|
||||
@@ -196,9 +196,11 @@ let BILL_SORT = { k: -1, dir: 1 };
|
||||
const BILL_ATTR_IDX = COLS.bill.findIndex(c => c[3] === 'attr'); // 项目特征列(显示下标)
|
||||
const BILL_SORT_DS = { 1: 8, 2: 1, 4: 9, 5: 2, 6: 3, 7: 4, 8: 5, 9: 6, 10: 7 };
|
||||
const BILL_SORT_NUM = new Set([8, 5, 6, 7]); // 序号/工程量/单价/合价 按数值比
|
||||
function billHeadHTML() {
|
||||
return '<tr>' + billCols().map((c, i) => {
|
||||
const can = BILL_SORT_DS[i] != null;
|
||||
function billHeadHTML(opts) {
|
||||
const cols = billColsO(opts);
|
||||
const off = (opts && opts.checkbox) ? 1 : 0;
|
||||
return '<tr>' + cols.map((c, i) => {
|
||||
const can = BILL_SORT_DS[i - off] != null;
|
||||
const mark = (can && BILL_SORT.k === i) ? (BILL_SORT.dir > 0 ? ' ▲' : ' ▼') : '';
|
||||
const click = can
|
||||
? ' onclick="if(event.target.closest(\'.rs\'))return;billSort(this,' + i + ')"'
|
||||
@@ -212,7 +214,8 @@ function billSort(th, i) {
|
||||
else { BILL_SORT.k = i; BILL_SORT.dir = 1; }
|
||||
const tb = th.closest('table');
|
||||
billSortDOM(tb);
|
||||
th.closest('thead').innerHTML = billHeadHTML(); // 重画 ▲/▼(colgroup 不动,列宽保持)
|
||||
const ck = tb && tb.dataset.ck === '1'; // 决策 153③:附件复选框表重画表头带选项
|
||||
th.closest('thead').innerHTML = billHeadHTML(ck ? { checkbox: true, backend: tb.dataset.bk === '1' } : undefined); // 重画 ▲/▼(colgroup 不动,列宽保持)
|
||||
}
|
||||
/* 组 key('bg3'/'bx0'/'ag2')→ 数据组。原先内联在 tgGrp 里,组内排序也要用,收编成一份。 */
|
||||
function _grpByKey(key) {
|
||||
@@ -225,7 +228,8 @@ function _grpByKey(key) {
|
||||
}
|
||||
function billSortDOM(tb) {
|
||||
if (!tb || BILL_SORT.k < 0) return;
|
||||
const rk = BILL_SORT_DS[BILL_SORT.k];
|
||||
const off = billCkOff(tb); // 决策 153③:复选框列偏移
|
||||
const rk = BILL_SORT_DS[BILL_SORT.k - off];
|
||||
const tbody = tb && tb.tBodies[0];
|
||||
if (rk == null || !tbody) return;
|
||||
tbody.querySelectorAll('tr.grp[data-grp],tr.grp2[data-grp]').forEach(hdr => {
|
||||
@@ -640,6 +644,20 @@ function billCols() {
|
||||
const bk = (typeof WB_OPTS !== 'undefined') && WB_OPTS && WB_OPTS.backend;
|
||||
return bk ? noWB(COLS.bill) : COLS.bill;
|
||||
}
|
||||
/* 决策 153③:按渲染选项取列数组(checkbox=前置复选框列,供附件动态标签页勾选绑附件;
|
||||
backend=批次侧剔除 wb 列)。既有调用 billHeadHTML()/billCols() 行为不变。 */
|
||||
function billColsO(opts) {
|
||||
opts = opts || {};
|
||||
const base = opts.backend ? noWB(COLS.bill) : billCols();
|
||||
return opts.checkbox ? [['', 36, 'c', 'F']].concat(base) : base.slice();
|
||||
}
|
||||
/* 复选框列导致的显示下标偏移:优先读渲染时存下的 GRP_DATA.opts,其次表上的 data-ck 标记 */
|
||||
function billCkOff(tb) {
|
||||
if (tb && tb.dataset && tb.dataset.ck === '1') return 1;
|
||||
if (typeof GRP_DATA !== 'undefined' && GRP_DATA && GRP_DATA.opts && GRP_DATA.opts.checkbox) return 1;
|
||||
if (typeof WB_OPTS !== 'undefined' && WB_OPTS && WB_OPTS.checkbox) return 1;
|
||||
return 0;
|
||||
}
|
||||
const CB_LAST = () => billCols().length - 1, CB_TOTAL = () => billCols().length - 2;
|
||||
|
||||
function grpTitle(tag, g) {
|
||||
@@ -657,6 +675,7 @@ function billTR(r, grp, hide, opts) {
|
||||
const cls = (r[12] ? ' xtdel' : '') + (r[11] ? ' xnew' : '');
|
||||
// data-bid:组内排序按它对回 GRP_DATA 里的数据行(billSortDOM);右键菜单也按它定位清单
|
||||
return '<tr class="' + cls + '" data-grp="' + grp + '" data-bid="' + r[0] + '"' + st + clk + ' data-name="' + esc(r[2] || '') + '" data-price="' + esc(pr) + '">'
|
||||
+ (opts.checkbox ? '<td class="c"><input type="checkbox" class="qbindck" data-id="' + r[0] + '" onclick="event.stopPropagation()"></td>' : '')
|
||||
+ '<td class="tg"><span class="tog" title="展开/收起该清单下的定额" onclick="event.stopPropagation();tgNorm(this,' + r[0] + ')">+</span></td>'
|
||||
+ '<td class="c">' + ((r[8] == null || r[8] === '') ? '—' : esc(r[8])) + '</td>'
|
||||
+ '<td class="c">' + ell(r[1], '—') + '</td>'
|
||||
@@ -734,9 +753,10 @@ function tgGrp(key, tr) {
|
||||
let GRP_DATA = null;
|
||||
function grpRowsHTML(g, key, opts) {
|
||||
let rows = g.rows || [];
|
||||
// 组内排序激活时,懒展开的组也按同一排序出(2026-10-10 主人定)
|
||||
// 组内排序激活时,懒展开的组也按同一排序出(2026-10-10 主人定);复选框表偏移同步(决策 153③)
|
||||
if (BILL_SORT.k >= 0) {
|
||||
const rk = BILL_SORT_DS[BILL_SORT.k];
|
||||
const off = (opts && opts.checkbox) ? 1 : billCkOff(null);
|
||||
const rk = BILL_SORT_DS[BILL_SORT.k - off];
|
||||
if (rk != null) rows = sortRows(rows, rk, BILL_SORT.dir, BILL_SORT_NUM);
|
||||
}
|
||||
return rows.map(r => billTR(r, key, false, opts)).join('');
|
||||
@@ -832,13 +852,14 @@ function grpTreeBind(box, tbId, d, opt) {
|
||||
grpTreeRender(box, d, key => {
|
||||
const tb = document.getElementById(tbId);
|
||||
if (!tb) return;
|
||||
if (key === 'all') { tb.innerHTML = renderGroups(d, kind); return; }
|
||||
const o = (typeof GRP_DATA !== 'undefined' && GRP_DATA && GRP_DATA.opts) || undefined; // 决策 153③:左树重画保留渲染选项(checkbox/backend)
|
||||
if (key === 'all') { tb.innerHTML = renderGroups(d, kind, o); return; }
|
||||
const i = +key.slice(2);
|
||||
const g = key.charAt(1) === 'g' ? (d.groups || [])[i] : (d.extra || [])[i];
|
||||
if (!g) return;
|
||||
const lbl = key.charAt(1) === 'g' ? ('第 ' + (i + 1) + ' 组')
|
||||
: ('第 ' + ((d.groups || []).length + i + 1) + ' 组');
|
||||
tb.innerHTML = renderGroups({ groups: [g], labels: [lbl] }, kind);
|
||||
tb.innerHTML = renderGroups({ groups: [g], labels: [lbl] }, kind, o);
|
||||
// 决策 90(2026-10-17):点组=只显示该组时,列宽整体缩到贴住容器——右边不再有下滑条
|
||||
if (typeof fitGroupWidth === 'function') fitGroupWidth(tbId);
|
||||
}, { kind: kind, rootName: opt.rootName });
|
||||
@@ -856,17 +877,20 @@ function renderLme(rows, opts) {
|
||||
const click = opts.rowClick
|
||||
? (id => ' onclick="' + opts.rowClick + "('lme'," + id + ',this)"')
|
||||
: (() => '');
|
||||
// 决策 147:opts.rowClass 行类(原数据卡挂 lmerow 接双击改价)、opts.subSet 台班/配合比三格 title
|
||||
const subT = (opts.subSet && opts.subSet.size)
|
||||
? (code => (opts.subSet.has(code) ? ' title="' + RAW_LME_SUB_TIP + '"' : '')) : null;
|
||||
return (rows || []).map((r, i) =>
|
||||
'<tr' + click(r[0]) + ' data-id="' + r[0] + '" data-name="' + esc(r[2] || '') + '" data-price="' + esc(r[6] == null ? '' : r[6]) + '">'
|
||||
'<tr class="' + (opts.rowClass || '') + '"' + click(r[0]) + ' data-id="' + r[0] + '" data-name="' + esc(r[2] || '') + '" data-price="' + esc(r[6] == null ? '' : r[6]) + '">'
|
||||
+ '<td class="c">' + (i + 1) + '</td>'
|
||||
+ '<td class="c">' + ell(r[1], '—') + '</td>'
|
||||
+ '<td>' + ell(r[2], '—') + '</td>'
|
||||
+ '<td>' + ell(r[3], '—') + '</td>'
|
||||
+ '<td class="c u">' + esc(r[4] || '—') + '</td>'
|
||||
+ '<td class="r">' + num(r[5], 3) + '</td>'
|
||||
+ '<td class="r">' + num(r[6]) + '</td>'
|
||||
+ '<td class="r">' + num(r[7], 2) + '</td>'
|
||||
+ '<td class="r">' + num(r[8]) + '</td>'
|
||||
+ '<td class="r"' + (subT ? subT(r[1]) : '') + '>' + num(r[6]) + '</td>'
|
||||
+ '<td class="r"' + (subT ? subT(r[1]) : '') + '>' + num(r[7], 2) + '</td>'
|
||||
+ '<td class="r"' + (subT ? subT(r[1]) : '') + '>' + num(r[8]) + '</td>'
|
||||
+ (opts.backend ? '' : '<td class="c">' + lmeAdoptCellHTML(r) + '</td>'
|
||||
+ '<td title="' + esc(r[10] || '') + '">' + esc(r[10] || '') + '</td>')
|
||||
+ '</tr>').join('');
|
||||
@@ -1048,8 +1072,25 @@ function rawLmeSort(k) {
|
||||
function rawLmeTbl(rows, tip, qtyLabel, extra) {
|
||||
rows = rows || [];
|
||||
RV_LME_ROWS = rows; RV_LME_TIP = tip || ''; RV_LME_QL = qtyLabel || '';
|
||||
RV_LME_IDS = (extra && extra.ids) || null; // 项目级带行 id(行级改价定位用);单位级无=只读
|
||||
const subSet = new Set((extra && extra.sub) || []); // 带子级组成的编码集 → 三格挂 title 提示
|
||||
if (!RAW_LME_KIND) {
|
||||
/* 决策 147(2026-10-21 主人定):项目级卡与「项目工料机」**同码同形** —— renderLme 唯一渲染、
|
||||
COLS.lme 同列宽(数量135/备注160)、同排序同点击同双击改价,改一处=改两处;
|
||||
数据集差异按主人原文保留:项目工料机走单位过滤,此处全量(含台班/配合比)。
|
||||
列头数量名沿用决策 40 的「总数量」(qtyLabel 传入);单位工程级卡走下方原路径不动。 */
|
||||
RV_LME_IDS = null; RV_LME_DS = {}; RV_LME_O2V = null;
|
||||
for (let i = 1; i <= 10; i++) RV_LME_DS[i] = i; // 恒等映射:视图位=数据位(双击改价 lmePriceCells 用)
|
||||
const view = sortRows(rows, RV_LME_SORT.k, RV_LME_SORT.dir, RV_LME_NUM);
|
||||
const backend = !!RVO.lmeBackend; // 决策 147/149:后台=后台项目工料机列集(剔除 wb 专列)
|
||||
const cols = backend ? COLS.lme.filter(c => c[5] !== 'wb') : COLS.lme; // 决策 148:列头统一「数量」,与行格严格同列
|
||||
const body = renderLme(view, { rowClass: 'lmerow', subSet: subSet,
|
||||
rowClick: (typeof window !== 'undefined' && window.rawLmePick) ? 'rawLmePick' : '',
|
||||
backend: backend });
|
||||
return rawTbl(cols.map(c => c[1]), cols.map(c => [c[0], c[2]]),
|
||||
body || '<tr><td class="empty">没有工料机数据</td></tr>', null,
|
||||
{ cur: RV_LME_SORT.k, dir: RV_LME_SORT.dir, fn: 'rawLmeSort' }); // 决策 147:表头排序由 rawTbl 统一装饰(与项目工料机同款点击)
|
||||
}
|
||||
RV_LME_IDS = (extra && extra.ids) || null; // 单位级无=只读(项目级 id 已在行首位)
|
||||
// 视图列 = [序号, 编码, 名称, 规格, 类别?, 单位, 消耗量, 除税编制价, 税率, 含税编制价];
|
||||
// DS = 各视图列对应的数据下标(序号列无;类别列在 RAW_LME_KIND=0 时既不显示也不占视图下标)。
|
||||
// O2V = 原始列下标→视图下标:rawTbl 表头 onclick 传的是 cols 原始下标(common.js rawTbl),
|
||||
@@ -1075,6 +1116,7 @@ function rawLmeTbl(rows, tip, qtyLabel, extra) {
|
||||
const subT = subSet.has(r[0] || '') ? ' title="' + RAW_LME_SUB_TIP + '"' : '';
|
||||
// 2026-10-13 主人定:加「序号」列(视图行号,随排序重排)
|
||||
return '<tr class="lmerow"' + (lid != null ? ' data-lmeid="' + esc(lid) + '"' : '')
|
||||
+ (lid != null && window.rawLmePick ? ' data-name="' + esc(r[1] || '') + '" data-price="' + esc(r[6] == null ? '' : r[6]) + '" onclick="rawLmePick(this)"' : '') // 决策 142:项目级行接历史对比框(后台未定义 rawLmePick 则不挂)
|
||||
+ '><td class="c">' + (i + 1) + '</td><td class="c">' + ell(r[0], '—') + '</td><td class="l">' + ell(r[1], '—') + '</td>'
|
||||
+ '<td class="l">' + ell(r[2], '—') + '</td>' + kind
|
||||
+ '<td class="c u">' + esc(r[3] || '—') + '</td><td class="r">' + r3(r[5]) + '</td>'
|
||||
@@ -2300,7 +2342,7 @@ function licEnsureStyle() {
|
||||
'.btn.lic-warn{color:#b02a2a;border-color:#e4b6b6;background:#fdf3f3;font-weight:600}';
|
||||
document.head.appendChild(st);
|
||||
}
|
||||
function licMount(sel) {
|
||||
function licMount(sel, opts) {
|
||||
const host = document.querySelector(sel);
|
||||
if (!host || document.getElementById('licWarn')) return;
|
||||
licEnsureStyle();
|
||||
@@ -2311,7 +2353,8 @@ function licMount(sel) {
|
||||
btn.className = 'btn'; btn.textContent = '设置'; btn.setAttribute('data-i18n','btn.settings');
|
||||
btn.title = '授权状态 / 激活 / 续费提示(后续设置项统一收这里)';
|
||||
btn.onclick = licDlg;
|
||||
host.appendChild(warn); host.appendChild(btn);
|
||||
host.appendChild(warn);
|
||||
if (!opts || opts.settings !== false) host.appendChild(btn); // 决策 153⑥:后台不挂「设置」,共用工作台的
|
||||
if (typeof wbApplyLang === 'function') wbApplyLang(); // 晚于首轮回填注入,补一次语言套用
|
||||
licBannerTick();
|
||||
setInterval(licBannerTick, 10 * 60 * 1000);
|
||||
@@ -2770,6 +2813,7 @@ const APP_I18N = {
|
||||
'全部': '全部', '精确 + 次精确 + 字集': '精確 + 次精確 + 字集',
|
||||
'只看精确': '只看精確', '全部(含模糊)': '全部(含模糊)', '默认': '默認',
|
||||
'低→高': '低→高', '高→低': '高→低', '有': '有', '无': '無', '工程工料机': '工程工料機',
|
||||
'本项目': '本項目',
|
||||
'项目名称 / 文件名关键字': '項目名稱 / 文件名關鍵字',
|
||||
'选文件后自动带出文件名,可改': '選文件後自動帶出文件名,可改',
|
||||
'点这里选起~止(同月就选同一个)': '點這裡選起~止(同月就選同一個)',
|
||||
@@ -2883,6 +2927,7 @@ const APP_I18N = {
|
||||
'全部': 'All', '精确 + 次精确 + 字集': 'Exact + Near + Charset',
|
||||
'只看精确': 'Exact only', '全部(含模糊)': 'All (incl. fuzzy)', '默认': 'Default',
|
||||
'低→高': 'Low→High', '高→低': 'High→Low', '有': 'Yes', '无': 'No',
|
||||
'本项目': 'This Project', '是': 'Yes', '否': 'No',
|
||||
'工程工料机': 'Project L&M',
|
||||
'项目名称 / 文件名关键字': 'Project name / file name keyword',
|
||||
'选文件后自动带出文件名,可改': 'Auto-filled from file name, editable',
|
||||
@@ -3146,19 +3191,19 @@ function appWatch() {
|
||||
const WB_I18N = {
|
||||
'zh-CN': {
|
||||
'tab.p3': '原数据', 'tab.p2': '类似清单', 'tab.p1': '组价不一致清单', 'tab.p0': '项目工料机',
|
||||
'btn.cfg': '分组&过滤', 'btn.admin': '后台管理', 'btn.export': '导出', 'btn.inq': '询价附件',
|
||||
'btn.cfg': '分组&过滤', 'btn.admin': '后台管理', 'btn.export': '导出', 'btn.inq': '附件',
|
||||
'btn.recent': '最近审核', 'btn.open': '打开项目', 'btn.settings': '设置',
|
||||
'lv.group': '分组', 'lv.bill': '清单', 'lv.det': '定额', 'lv.defw': '默认列宽', 'lk.reload': '⟳ 重载'
|
||||
},
|
||||
'zh-TW': {
|
||||
'tab.p3': '原數據', 'tab.p2': '類似清單', 'tab.p1': '組價不一致清單', 'tab.p0': '項目工料機',
|
||||
'btn.cfg': '分組&過濾', 'btn.admin': '後台管理', 'btn.export': '導出', 'btn.inq': '詢價附件',
|
||||
'btn.cfg': '分組&過濾', 'btn.admin': '後台管理', 'btn.export': '導出', 'btn.inq': '附件',
|
||||
'btn.recent': '最近審核', 'btn.open': '打開項目', 'btn.settings': '設置',
|
||||
'lv.group': '分組', 'lv.bill': '清單', 'lv.det': '定額', 'lv.defw': '默認列寬', 'lk.reload': '⟳ 重載'
|
||||
},
|
||||
'en': {
|
||||
'tab.p3': 'Raw Data', 'tab.p2': 'Similar Bills', 'tab.p1': 'Price Mismatch', 'tab.p0': 'L&M Summary',
|
||||
'btn.cfg': 'Group&Filter', 'btn.admin': 'Admin', 'btn.export': 'Export', 'btn.inq': 'Inquiry Files',
|
||||
'btn.cfg': 'Group&Filter', 'btn.admin': 'Admin', 'btn.export': 'Export', 'btn.inq': 'Attachments',
|
||||
'btn.recent': 'Recent', 'btn.open': 'Open Project', 'btn.settings': 'Settings',
|
||||
'lv.group': 'Group', 'lv.bill': 'Bill', 'lv.det': 'Norm', 'lv.defw': 'Default Width', 'lk.reload': '⟳ Reload'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user