本帖最后由 二麻子 于 2025-11-3 16:04 编辑
已经完成的工序报工
比较有趣的地方在于活字格的v 时间线组件,点击组件的时间项后能浏览报工详情,通过监听时间线的点击来实现
- // 找到容器元素
- const stepsContainer = document.querySelector('.van-steps__items');
- // 监听容器内点击事件
- stepsContainer.addEventListener('click', (event) => {
- const stepEl = event.target.closest('.van-step');
- if (!stepEl) return;
- const titleEl = stepEl.querySelector('.van-step__title p');
- const title = titleEl ? titleEl.textContent.trim() : '未知';
- const timeEl = stepEl.querySelectorAll('.van-step__title p')[1];
- const time = timeEl ? timeEl.textContent.trim() : '';
- const index = Array.from(stepsContainer.querySelectorAll('.van-step')).indexOf(stepEl) + 1;
- // 输出结果(可以改成任何逻辑,比如存变量、调用接口)
- //console.log(`点击了第 ${index} 项:${title}(时间:${time})`);
- Forguncy.Page.getCell("Trigger_Page").setValue(title+","+time);
- });
复制代码 |