功能调整
This commit is contained in:
+212
-110
@@ -2,38 +2,43 @@
|
||||
<view class="page-list">
|
||||
<!-- 头部过滤区域 -->
|
||||
<view class="filter-header">
|
||||
<!-- 第一行:管线编号搜索 -->
|
||||
<view class="search-row">
|
||||
<u-search v-model="pipelineCode" placeholder="请输入管线编号" :show-action="false" shape="square"
|
||||
bg-color="#f5f6f8" @change="handleSearch" />
|
||||
</view>
|
||||
<!-- 第二行:焊工编号 + 焊接日期 + 单位工程 -->
|
||||
<view class="filter-row">
|
||||
<view class="welder-input-wrap">
|
||||
<input class="welder-input" v-model="welderCode" placeholder="焊工编号" confirm-type="search"
|
||||
@confirm="handleSearch" @blur="handleSearch" />
|
||||
</view>
|
||||
<picker mode="date" :value="weldingDate" @change="onDateChange">
|
||||
<view class="filter-btn">
|
||||
<text class="filter-btn__text" :class="{ 'filter-btn__text--placeholder': !weldingDate }">
|
||||
{{ weldingDate || '焊接日期' }}
|
||||
<!-- 焊工编号 + 焊接日期 + 单位工程 -->
|
||||
<view class="filter-grid">
|
||||
<view class="filter-item">
|
||||
<view class="filter-btn" @click="handleShowUnitWorkSelect">
|
||||
<text class="filter-btn__text" :class="{ 'filter-btn__text--placeholder': !selectedUnitWork }">
|
||||
{{ selectedUnitWork?.BaseInfoName || '单位工程' }}
|
||||
</text>
|
||||
<u-icon v-if="weldingDate" name="close" :size="20" color="#999" @click.stop="onDateClear" />
|
||||
<u-icon v-else name="calendar" :size="24" color="#999" />
|
||||
<u-icon name="arrow-down" :size="18" color="#999" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="filter-item">
|
||||
<picker class="filter-picker" mode="date" :value="weldingDate" @change="onDateChange">
|
||||
<view class="filter-btn">
|
||||
<text class="filter-btn__text" :class="{ 'filter-btn__text--placeholder': !weldingDate }">
|
||||
{{ weldingDate || '焊接日期' }}
|
||||
</text>
|
||||
<u-icon v-if="weldingDate" name="close" :size="20" color="#999" @click.stop="onDateClear" />
|
||||
<u-icon v-else name="calendar" :size="24" color="#999" />
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="filter-item">
|
||||
<u-search v-model="pipelineCode" placeholder="请输入管线编号" :show-action="false" shape="square"
|
||||
height="70" bg-color="#f5f6f8" @change="handleSearch" />
|
||||
</view>
|
||||
<view class="filter-item">
|
||||
<view class="filter-btn">
|
||||
<input class="welder-input" v-model="welderCode" placeholder="焊工编号" confirm-type="search"
|
||||
@confirm="handleSearch" @blur="handleSearch" />
|
||||
</view>
|
||||
</picker>
|
||||
<view class="filter-btn" @click="handleShowUnitWorkSelect">
|
||||
<text class="filter-btn__text" :class="{ 'filter-btn__text--placeholder': !selectedUnitWork }">
|
||||
{{ selectedUnitWork?.BaseInfoName || '单位工程' }}
|
||||
</text>
|
||||
<u-icon name="arrow-down" :size="18" color="#999" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 列表内容 -->
|
||||
<scroll-view class="list-scroll" scroll-y refresher-enabled="true" :refresher-triggered="refreshing"
|
||||
@refresherrefresh="handleRefresh">
|
||||
@refresherrefresh="handleRefresh" @scrolltolower="loadMore">
|
||||
<view class="list-wrap">
|
||||
<view v-for="(item, index) in listData" :key="item.TempDetailId || index" class="card-item audit-card"
|
||||
@click="handleItemClick(item)">
|
||||
@@ -45,7 +50,9 @@
|
||||
<view class="audit-card__content">
|
||||
<view class="card-header">
|
||||
<text class="card-code">{{ item.WeldJointCode || '--' }}</text>
|
||||
<text class="card-tag status-1">待审核</text>
|
||||
<text class="card-tag" :class="item.AuditState == 1 ? 'status-2' : 'status-1'">
|
||||
{{ item.AuditStateText || '待审核' }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="card-body">
|
||||
<view class="card-row">
|
||||
@@ -78,10 +85,16 @@
|
||||
|
||||
<!-- 空状态 -->
|
||||
<u-empty v-if="!loading && listData.length === 0" mode="list" text="暂无待审核日报"></u-empty>
|
||||
<view v-if="loading && listData.length > 0" class="loading-more">
|
||||
<u-loading mode="circle" size="32"></u-loading>
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
<view v-if="!loading && !hasMore && listData.length > 0" class="no-more">
|
||||
<text>— 没有更多了 —</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 底部批量操作栏 -->
|
||||
<view v-if="canEdit" class="audit-bar">
|
||||
<view class="audit-bar__all" @click="handleToggleAll">
|
||||
<view class="check-circle" :class="{ 'check-circle--checked': isAllSelected }">
|
||||
@@ -91,10 +104,12 @@
|
||||
</view>
|
||||
<text class="audit-bar__count">已选 {{ selectedIds.length }} 项</text>
|
||||
<view class="audit-bar__btns">
|
||||
<u-button size="medium" type="error" :disabled="selectedIds.length === 0"
|
||||
@click="handleBatchDelete">删除</u-button>
|
||||
<u-button size="medium" type="primary" :disabled="selectedIds.length === 0"
|
||||
@click="handleBatchAudit">审核通过</u-button>
|
||||
<u-button size="mini" type="error" :disabled="submitting || selectedIds.length === 0"
|
||||
:loading="submitting" @click="handleBatchDelete">删除</u-button>
|
||||
<u-button size="mini" type="primary" :disabled="submitting || selectedIds.length === 0"
|
||||
:loading="submitting" @click="handleTeamAudit">班组审核</u-button>
|
||||
<u-button size="mini" type="primary" :disabled="submitting || selectedIds.length === 0"
|
||||
:loading="submitting" @click="handleProfessionalAudit">专工审核</u-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -125,6 +140,7 @@
|
||||
} from '@/api/base.js'
|
||||
import {
|
||||
reqPendingWeldingDailyList,
|
||||
reqTeamAuditWeldingDaily,
|
||||
reqAuditWeldingDaily,
|
||||
reqDeleteWeldingDaily
|
||||
} from '@/api/hj.js'
|
||||
@@ -136,6 +152,9 @@
|
||||
currentProject
|
||||
} = storeToRefs(userStore)
|
||||
const canEdit = computed(() => menuStore.canEditFunc('dailyAudit'))
|
||||
const submitting = ref(false)
|
||||
|
||||
const uniqIds = (ids) => [...new Set((ids || []).filter(Boolean))]
|
||||
|
||||
// ===== 筛选条件 =====
|
||||
const pipelineCode = ref('')
|
||||
@@ -144,12 +163,12 @@
|
||||
|
||||
const onDateChange = (e) => {
|
||||
weldingDate.value = e.detail.value
|
||||
fetchData()
|
||||
resetAndLoad()
|
||||
}
|
||||
|
||||
const onDateClear = () => {
|
||||
weldingDate.value = ''
|
||||
fetchData()
|
||||
resetAndLoad()
|
||||
}
|
||||
|
||||
// ===== 单位工程选择 =====
|
||||
@@ -170,44 +189,73 @@
|
||||
const handleUnitWorkConfirm = (item) => {
|
||||
selectedUnitWork.value = item?.BaseInfoId ? item : null
|
||||
showUnitWorkSelect.value = false
|
||||
fetchData()
|
||||
resetAndLoad()
|
||||
}
|
||||
|
||||
// ===== 列表数据 =====
|
||||
const listData = ref([])
|
||||
const loading = ref(false)
|
||||
const refreshing = ref(false)
|
||||
const hasMore = ref(true)
|
||||
const currentPage = ref(1)
|
||||
const pageSize = 20
|
||||
|
||||
// 加载待审核列表(不分页,一次拉全部待审核记录)
|
||||
const fetchData = async () => {
|
||||
if (loading.value) return
|
||||
const fetchData = async (isRefresh = false) => {
|
||||
if (loading.value || (!isRefresh && !hasMore.value)) return
|
||||
loading.value = true
|
||||
refreshing.value = true
|
||||
if (isRefresh) refreshing.value = true
|
||||
try {
|
||||
const res = await reqPendingWeldingDailyList({
|
||||
projectId: currentProject.value?.ProjectId,
|
||||
unitWorkId: selectedUnitWork.value?.BaseInfoId || '',
|
||||
weldingDate: weldingDate.value || '',
|
||||
pipelineCode: pipelineCode.value || '',
|
||||
welderCode: welderCode.value || ''
|
||||
welderCode: welderCode.value || '',
|
||||
pageIndex: currentPage.value,
|
||||
pageSize
|
||||
})
|
||||
listData.value = res.data?.list || res.data?.getDataList || (Array.isArray(res.data) ? res.data : [])
|
||||
// 刷新后清空已选(原记录可能已不存在)
|
||||
selectedIds.value = []
|
||||
const pageData = res.data?.list || res.data?.getDataList || (Array.isArray(res.data) ? res.data : [])
|
||||
if (isRefresh) {
|
||||
listData.value = pageData
|
||||
selectedIds.value = []
|
||||
} else {
|
||||
listData.value = [...listData.value, ...pageData]
|
||||
}
|
||||
const totalCount = Number(res.data?.totalCount ?? res.data?.pageCount ?? 0)
|
||||
if (totalCount > 0) {
|
||||
hasMore.value = listData.value.length < totalCount
|
||||
} else {
|
||||
hasMore.value = pageData.length >= pageSize
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载待审核日报失败:', error)
|
||||
if (!isRefresh && currentPage.value > 1) currentPage.value--
|
||||
} finally {
|
||||
loading.value = false
|
||||
refreshing.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const resetAndLoad = () => {
|
||||
currentPage.value = 1
|
||||
hasMore.value = true
|
||||
listData.value = []
|
||||
fetchData(true)
|
||||
}
|
||||
|
||||
const handleRefresh = () => {
|
||||
fetchData()
|
||||
resetAndLoad()
|
||||
}
|
||||
|
||||
const handleSearch = () => {
|
||||
fetchData()
|
||||
resetAndLoad()
|
||||
}
|
||||
|
||||
const loadMore = () => {
|
||||
if (!loading.value && hasMore.value) {
|
||||
currentPage.value++
|
||||
fetchData(false)
|
||||
}
|
||||
}
|
||||
|
||||
// ===== 勾选 =====
|
||||
@@ -233,57 +281,79 @@
|
||||
if (isAllSelected.value) {
|
||||
selectedIds.value = []
|
||||
} else {
|
||||
selectedIds.value = listData.value.map(item => item.TempDetailId)
|
||||
selectedIds.value = uniqIds(listData.value.map(item => item.TempDetailId))
|
||||
}
|
||||
}
|
||||
|
||||
// ===== 批量操作 =====
|
||||
const handleBatchAudit = () => {
|
||||
const getSelectedIds = () => {
|
||||
const ids = uniqIds(selectedIds.value)
|
||||
if (!ids.length) {
|
||||
uni.showToast({
|
||||
title: '请先选择要操作的日报',
|
||||
icon: 'none'
|
||||
})
|
||||
return []
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
const runBatch = ({
|
||||
title,
|
||||
request
|
||||
}) => {
|
||||
if (submitting.value) return
|
||||
const ids = getSelectedIds()
|
||||
if (!ids.length) return
|
||||
uni.showModal({
|
||||
title: '信息提示',
|
||||
content: `确定审核通过选中的 ${selectedIds.value.length} 条日报吗?`,
|
||||
content: `确定${title}选中的 ${ids.length} 条日报吗?`,
|
||||
success: async ({
|
||||
confirm
|
||||
}) => {
|
||||
if (!confirm) return
|
||||
submitting.value = true
|
||||
try {
|
||||
await reqAuditWeldingDaily({
|
||||
TempDetailIds: selectedIds.value,
|
||||
AuditMan: userInfo.value?.PersonId
|
||||
})
|
||||
await request(ids)
|
||||
} catch (err) {
|
||||
return // 报错已由 request.js 统一 toast
|
||||
submitting.value = false
|
||||
return
|
||||
}
|
||||
uni.showToast({
|
||||
title: '审核成功',
|
||||
title: '操作成功',
|
||||
icon: 'none'
|
||||
})
|
||||
fetchData()
|
||||
submitting.value = false
|
||||
resetAndLoad()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const handleTeamAudit = () => {
|
||||
runBatch({
|
||||
title: '班组审核',
|
||||
request: (ids) => reqTeamAuditWeldingDaily({
|
||||
TempDetailIds: ids,
|
||||
AuditMan: userInfo.value?.PersonId
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const handleProfessionalAudit = () => {
|
||||
runBatch({
|
||||
title: '专工审核',
|
||||
request: (ids) => reqAuditWeldingDaily({
|
||||
TempDetailIds: ids,
|
||||
AuditMan: userInfo.value?.PersonId
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const handleBatchDelete = () => {
|
||||
uni.showModal({
|
||||
title: '信息提示',
|
||||
content: `确定删除选中的 ${selectedIds.value.length} 条日报吗?`,
|
||||
success: async ({
|
||||
confirm
|
||||
}) => {
|
||||
if (!confirm) return
|
||||
try {
|
||||
await reqDeleteWeldingDaily({
|
||||
TempDetailIds: selectedIds.value
|
||||
})
|
||||
} catch (err) {
|
||||
return // 报错已由 request.js 统一 toast
|
||||
}
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'none'
|
||||
})
|
||||
fetchData()
|
||||
}
|
||||
runBatch({
|
||||
title: '删除',
|
||||
request: (ids) => reqDeleteWeldingDaily({
|
||||
TempDetailIds: ids
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -315,48 +385,57 @@
|
||||
|
||||
// ===== 生命周期 =====
|
||||
onShow(() => {
|
||||
fetchData()
|
||||
resetAndLoad()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$primary: $app-primary;
|
||||
|
||||
.filter-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
.page-list {
|
||||
height: calc(100vh - var(--window-top, 0px));
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.welder-input-wrap {
|
||||
flex: 1;
|
||||
.filter-header {
|
||||
.filter-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.filter-item {
|
||||
min-width: 0;
|
||||
background: #f5f6f8;
|
||||
border-radius: 12rpx;
|
||||
height: 70rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 16rpx;
|
||||
}
|
||||
|
||||
.welder-input {
|
||||
.filter-picker {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
height: 70rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: 70rpx;
|
||||
}
|
||||
|
||||
.filter-btn {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
width: 100%;
|
||||
height: 70rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background: #f5f6f8;
|
||||
border-radius: 12rpx;
|
||||
padding: 0 16rpx;
|
||||
height: 70rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
&__text {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 26rpx;
|
||||
line-height: 70rpx;
|
||||
color: #333;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@@ -367,9 +446,26 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.welder-input {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
:deep(.u-search) {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
:deep(.u-content) {
|
||||
height: 70rpx !important;
|
||||
border-radius: 12rpx !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
|
||||
// 勾选圆圈
|
||||
.check-circle {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
@@ -387,7 +483,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 带勾选框的卡片
|
||||
.audit-card {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
@@ -403,18 +498,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 底部批量操作栏
|
||||
.list-scroll {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.list-wrap {
|
||||
padding-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.audit-bar {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
z-index: 20;
|
||||
background: #ffffff;
|
||||
padding: 20rpx 32rpx;
|
||||
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
|
||||
padding: 16rpx 24rpx;
|
||||
padding-bottom: calc(16rpx + env(safe-area-inset-bottom));
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
gap: 12rpx;
|
||||
box-shadow: 0 -2rpx 12rpx rgba(0, 0, 0, 0.06);
|
||||
|
||||
&__all {
|
||||
@@ -436,20 +540,18 @@
|
||||
|
||||
&__btns {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
flex: 1 0 100%;
|
||||
gap: 12rpx;
|
||||
|
||||
.u-size-medium {
|
||||
height: 72rpx;
|
||||
font-size: 28rpx;
|
||||
:deep(.u-btn) {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
height: 64rpx;
|
||||
font-size: 24rpx;
|
||||
border-radius: 8rpx;
|
||||
margin: 0;
|
||||
padding: 0 32rpx;
|
||||
padding: 0 8rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 给底部操作栏留出空间(含安全区)
|
||||
.list-scroll {
|
||||
padding-bottom: calc(140rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user