添加工作量查看页面, 附件显示优化

This commit is contained in:
zhengw
2026-02-10 17:13:24 +08:00
parent 1d247f1049
commit d9fe6c048f
16 changed files with 229 additions and 21 deletions

View File

@@ -0,0 +1,10 @@
{
"usingComponents": {
"card-plugin": "/pages/components/card-plugin/card-plugin",
"card-item-plugin": "/pages/components/card-item-plugin/card-item-plugin",
"total-bar-plugin": "/pages/components/total-bar-plugin/total-bar-plugin",
"t-cell": "tdesign-miniprogram/cell/cell"
},
"navigationBarTitleText": "工作量查看",
"enablePullDownRefresh": true
}

View File

@@ -0,0 +1,98 @@
import { loginStatusPage, post } from '@/utils/https';
import { toArray, toNumber } from '@/utils/util';
Page({
/**
* 页面的初始数据
*/
data: {
process_count: [] as any[],
seven_process_count: [] as any[],
isLogin: false,
},
handleLogin(e: any) {
this.setData({ isLogin: e.detail });
if (e.detail) {
this.init();
}
},
init() {
this.getList();
},
getList() {
post('Index/index')
.then((res: any) => {
const process_count = toArray(res.process_count).filter((el) => {
el.count = toNumber(el.count);
return el.count > 0;
});
const arr = toArray(res.seven_process_count).filter((el) => {
el.count = toNumber(el.count);
return el.count > 0;
});
const map = new Map<string, any>();
arr.forEach((el) => {
if (!map.has(el.date)) {
map.set(el.date, []);
}
map.get(el.date).push(el);
});
// console.log([...map.values()]);
this.setData({
seven_process_count: [...map.values()],
process_count: process_count,
});
})
.finally(() => {
wx.stopPullDownRefresh();
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(_options) {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
loginStatusPage(this);
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
if (this.data.isLogin) {
this.init();
}
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {},
});

View File

@@ -0,0 +1,51 @@
<page-plugin isAuth="{{true}}" loading="{{loading}}" is-login="{{isLogin}}"
bind:handleLogin="handleLogin">
<t-cell title="今日完成工作量" left-icon="chart-bar"
custom-style="position: sticky;top: 0;z-index:1;margin-bottom: 24rpx;padding-left: 0" />
<empty-plugin wx:if="{{process_count.length == 0}}" />
<block wx:else>
<view class="process_count_th">
<view class="process_count_td1">流程工序</view>
<view class="process_count_td2">数量</view>
</view>
<view wx:for="{{process_count}}" class="process_count_tr" wx:key="index">
<view class="process_count_td1">
{{item.p_process_name}}-{{item.c_process_name}}
</view>
<view class="process_count_td2">{{item.count}}</view>
</view>
</block>
<t-cell title="7日完成工作量" left-icon="chart-line-multi"
custom-style="position: sticky;top: 0;z-index:1;margin-bottom: 24rpx;margin-top: 24rpx;padding-left: 0" />
<empty-plugin wx:if="{{seven_process_count.length == 0}}" />
<block wx:else>
<card-plugin wx:for="{{seven_process_count}}" wx:key="index" showAll="1"
contentStyle="padding-left: 16rpx;padding-right: 16rpx;">
<view slot="header">{{ item[0].date }}</view>
<view slot="content">
<view wx:for="{{item}}" class="seven_process_tr" wx:key="index">
<view class="seven_process_count_td1">
{{item.p_process_name}}-{{item.c_process_name}}
</view>
<view class="seven_process_count_td2">{{item.count}}</view>
</view>
<!-- <view class="process_count_th">
<view class="process_count_td1">流程工序</view>
<view class="process_count_td2">数量</view>
</view>
<view wx:for="{{item}}" class="process_count_tr" wx:key="index">
<view class="process_count_td1">
{{item.p_process_name}}-{{item.c_process_name}}
</view>
<view class="process_count_td2">{{item.count}}</view>
</view> -->
</view>
</card-plugin>
</block>
</page-plugin>

View File

@@ -0,0 +1,47 @@
.process_count_th,
.process_count_tr {
display: flex;
width: 100%;
}
.process_count_td1,
.process_count_td2 {
border-left: 1rpx solid #ddd;
border-bottom: 1rpx solid #ddd;
padding: 8rpx 12rpx;
word-break: break-all;
display: inline-flex;
align-items: center;
}
.process_count_th .process_count_td1,
.process_count_th .process_count_td2 {
border-top: 1rpx solid #ddd;
}
.process_count_td1 {
flex: 1;
}
.process_count_td2 {
width: 5em;
flex-shrink: 0;
border-right: 1rpx solid #ddd;
justify-content: flex-end;
}
.seven_process_tr {
display: flex;
align-items: center;
justify-content: space-between;
column-gap: 16rpx;
line-height: 1.57;
}
.seven_process_count_td1 {
word-break: break-all;
}
.seven_process_count_td2 {
flex-shrink: 0;
}