bonus-material-app/src/pages/repair/testedInBound/index.vue

582 lines
17 KiB
Vue
Raw Normal View History

2024-11-21 10:47:48 +08:00
<template>
2025-06-21 15:18:48 +08:00
<!-- <view style="padding-top: 4vh;background-color: rgb(220, 244, 255);">
</view> -->
<uni-nav-bar status-bar left-icon="left" @clickLeft="leftClick" right-icon="scan" @clickRight="rightClick" title="修试入库" title-style="font-weight: bolder;" backgroundColor="rgb(220, 244, 255)" :border="false" />
2024-11-21 10:47:48 +08:00
<!-- 维修列表 -->
<view class="page-container">
<view class="complete-btn">
<view class="btn" @click="changeTab(1)">
2024-12-31 15:37:54 +08:00
<span>未完成</span>
2024-11-21 10:47:48 +08:00
<view v-if="active == 1" class="bt-line"></view>
</view>
<view class="btn" style="margin-left: 120rpx" @click="changeTab(2)">
2024-12-31 15:37:54 +08:00
<span>已完成</span>
2024-11-21 10:47:48 +08:00
<view v-if="active == 2" class="bt-line"></view>
</view>
</view>
<uni-row :gutter="24" class="search-form">
<uni-col :span="24">
2024-11-21 10:47:48 +08:00
<view>
<uni-datetime-picker
v-model="dateArray"
type="daterange"
@maskClick="maskClick"
@change="onChangeDate"
placeholder="选择日期范围"
/>
</view>
2024-12-10 14:41:47 +08:00
</uni-col>
</uni-row>
<uni-row :gutter="24" class="search-form">
<uni-col :span="18">
2024-11-21 10:47:48 +08:00
<view>
<uni-easyinput placeholder="请输入内容" v-model="queryParams.keyWord" />
</view>
</uni-col>
<uni-col :span="4">
<view class="search" @click="onSearchBtn()">搜索</view>
2024-11-21 10:47:48 +08:00
</uni-col>
</uni-row>
<scroll-view scroll-y @scrolltolower="onScrollTolower" class="scroll-container">
<view
class="table-list-item"
:key="index"
@click="handleItem(item)"
v-for="(item, index) in tableList"
>
<!-- <uni-swipe-action> -->
<!-- <uni-swipe-action-item @click="onClick($event, item)" :right-options="options"> -->
2024-12-10 14:41:47 +08:00
<div class="title">
2025-01-24 18:00:07 +08:00
<span style="font-size: 15px; font-weight: 800;color: #3784fb;">{{ item.inputCode }}</span>
<!-- <span :style="{ color: active == 1 ? '#ff4d4f' : '#3784fb' }">{{active == 1 ? '未完成' : '已完成'}}</span> -->
<div class="title-right">
<uni-tag v-if="item.taskStatus == 0" text="未完成" type="warning" custom-style="warningStyle"/>
<uni-tag v-if="item.taskStatus == 1" text="已完成" type="success" custom-style="successStyle"/>
<uni-tag v-if="item.taskStatus == 2" text="已驳回" type="warning" custom-style="warningStyle"/>
</div>
</div>
2024-11-21 10:47:48 +08:00
<view class="line"></view>
2025-01-24 18:00:07 +08:00
<!-- <uni-row :gutter="24">
2025-01-17 15:58:54 +08:00
<uni-col :span="8">入库单号</uni-col>
<uni-col :span="16">
2024-12-31 15:37:54 +08:00
<view class="cont">{{ item.inputCode }}</view>
2024-11-21 10:47:48 +08:00
</uni-col>
2025-01-24 18:00:07 +08:00
</uni-row> -->
2024-12-31 15:37:54 +08:00
<uni-row :gutter="24">
2025-01-17 15:58:54 +08:00
<uni-col :span="8">维修单号</uni-col>
<uni-col :span="16">
2024-12-31 15:37:54 +08:00
<view class="cont">{{ item.repairCode }}</view>
2024-11-21 10:47:48 +08:00
</uni-col>
2024-12-31 15:37:54 +08:00
</uni-row>
2024-11-21 10:47:48 +08:00
<uni-row :gutter="24">
2025-01-17 15:58:54 +08:00
<uni-col :span="8">退料单位</uni-col>
<uni-col :span="16">
2024-12-31 15:37:54 +08:00
<view class="cont">{{ item.backUnit }}</view>
2024-11-21 10:47:48 +08:00
</uni-col>
</uni-row>
<uni-row :gutter="24">
2025-01-17 15:58:54 +08:00
<uni-col :span="8">退料工程</uni-col>
<uni-col :span="16">
2024-12-31 15:37:54 +08:00
<view class="cont">{{ item.backPro }}</view>
2024-11-21 10:47:48 +08:00
</uni-col>
</uni-row>
2024-12-31 15:37:54 +08:00
<uni-row :gutter="24">
2025-01-17 15:58:54 +08:00
<uni-col :span="8">物资类型</uni-col>
<uni-col :span="16">
2024-12-31 15:37:54 +08:00
<view class="cont">{{ item.materialType }}</view>
</uni-col>
</uni-row>
2024-11-21 10:47:48 +08:00
<uni-row :gutter="24">
2025-01-17 15:58:54 +08:00
<uni-col :span="8">预入库数量</uni-col>
<uni-col :span="16"
2024-12-31 15:37:54 +08:00
><view class="cont">{{ item.pendingInputNum }}</view>
2024-11-21 10:47:48 +08:00
</uni-col>
</uni-row>
<uni-row :gutter="24">
2025-01-17 15:58:54 +08:00
<uni-col :span="8">已入库数量</uni-col>
<uni-col :span="16"
2024-12-31 15:37:54 +08:00
><view class="cont">{{ item.inputNum }}</view>
2024-11-21 10:47:48 +08:00
</uni-col>
</uni-row>
2024-12-31 15:37:54 +08:00
<uni-row :gutter="24">
2025-01-17 15:58:54 +08:00
<uni-col :span="8">创建时间</uni-col>
<uni-col :span="16"
2024-12-31 15:37:54 +08:00
><view class="cont">{{ item.createTime }}</view>
</uni-col>
</uni-row>
2025-01-24 18:00:07 +08:00
<!-- <uni-row :gutter="24">
2025-01-17 15:58:54 +08:00
<uni-col :span="8">状态</uni-col>
<uni-col :span="16">
2024-11-21 10:47:48 +08:00
<view class="cont">
<uni-tag
text="未完成"
type="warning"
2024-12-31 15:37:54 +08:00
v-if="item.taskStatus == 0"
2024-11-21 10:47:48 +08:00
/>
<uni-tag
text="已完成"
type="success"
2024-12-31 15:37:54 +08:00
v-if="item.taskStatus == 1"
2024-11-21 10:47:48 +08:00
/>
</view>
</uni-col>
2025-01-24 18:00:07 +08:00
</uni-row> -->
<!-- </uni-swipe-action-item> -->
<!-- </uni-swipe-action> -->
2024-11-21 10:47:48 +08:00
</view>
<view class="loading-text">
{{ finish ? '没有更多数据了~' : '正在加载...' }}
</view>
</scroll-view>
</view>
</template>
<script setup>
import { ref, computed } from 'vue'
import { getRepairedList } from '@/services/repair/testedInBound.js'
2024-11-21 10:47:48 +08:00
import { onShow } from '@dcloudio/uni-app'
import { debounce } from 'lodash-es'
const total = ref(0) // 数据总量
const active = ref(1) // tap索引
const tableList = ref([]) // 列表数据源
const dateArray = ref([]) // 日期范围
// 查询参数
const queryParams = ref({
startTime: '', // 开始时间
endTime: '', // 结束时间
keyWord: '', // 关键字
2024-11-21 10:47:48 +08:00
pageNum: 1,
pageSize: 5,
2025-01-24 18:00:07 +08:00
appTaskStatus: 0,
2024-11-21 10:47:48 +08:00
})
// 右滑按钮组
const options = ref([
{
text: '提交',
style: {
backgroundColor: '#84c649',
color: '#fff',
fontSize: '30rpx',
},
},
{
text: '驳回',
2024-11-21 10:47:48 +08:00
style: {
backgroundColor: '#ed6042',
color: '#fff',
fontSize: '30rpx',
},
},
])
// 右滑按钮点击事件
const onClick = async (e, item) => {
if (e.index === 0) {
// 提交逻辑
// const res = await repairSubmitAPI([{ taskId: item.taskId }])
// if (res.code === 200) {
// uni.showToast({
// title: '提交成功!',
// icon: 'none',
// })
// }
} else {
// 驳回逻辑
// console.log('驳回')
// const res = await repairRejectAPI(item.taskId)
// if (res.code === 200) {
// uni.showToast({
// title: '驳回成功!',
// icon: 'none',
// })
// }
}
2024-11-21 10:47:48 +08:00
}
// 日期 change 事件
const onChangeDate = (val) => {
const [val_1, val_2] = val
queryParams.value.startTime = val_1
queryParams.value.endTime = val_2
}
// 搜索按钮
const onSearchBtn = () => {
queryParams.value.pageNum = 1
tableList.value = []
getTableList()
}
2024-11-21 10:47:48 +08:00
// 获取列表数据
const getTableList = async (isTap = false) => {
// console.log('queryParams.value查询参数', queryParams.value)
const res = await getRepairedList(queryParams.value)
2025-01-24 18:00:07 +08:00
total.value = res.data.total
2024-11-21 10:47:48 +08:00
if (isTap) {
2025-01-24 18:00:07 +08:00
tableList.value = res.data.rows
2024-11-21 10:47:48 +08:00
} else {
2025-01-24 18:00:07 +08:00
if (res.data.rows.length == 0) {
2024-11-21 10:47:48 +08:00
tableList.value = []
} else {
2025-01-24 18:00:07 +08:00
tableList.value.push(...res.data.rows)
2024-11-21 10:47:48 +08:00
}
}
}
// // 页面加载完毕
// onLoad(() => {
// getTableList()
// })
onShow(() => {
tableList.value = []
total.value = 0
getTableList()
})
// 滚动触底事件
const onScrollTolower = debounce(() => {
console.log('触底事件')
if (total.value > tableList.value.length) {
queryParams.value.pageNum++
getTableList()
}
}, 500)
// tap 栏切换
const changeTab = (index) => {
active.value = index
if (index == 1) {
2025-01-24 18:00:07 +08:00
queryParams.value.appTaskStatus = 0 // 查未完成的
2024-11-21 10:47:48 +08:00
queryParams.value.pageNum = 1
getTableList(true)
} else if (index == 2) {
2025-01-24 18:00:07 +08:00
queryParams.value.appTaskStatus = 1 // 查已完成的
2024-11-21 10:47:48 +08:00
queryParams.value.pageNum = 1
getTableList(true)
}
}
// 点击跳转详情
const handleItem = (item) => {
2024-12-19 09:06:26 +08:00
uni.navigateTo({ url: `/pages/repair/testedInBound/details?taskInfo=${JSON.stringify(item)}` })
2024-11-21 10:47:48 +08:00
}
// 判断数据是否加载完毕
const finish = computed(() => {
if (total.value === tableList.value.length) return true
})
2024-12-31 15:37:54 +08:00
const leftClick = () => {
console.log(1)
uni.navigateBack({
delta: 1 // 返回到已存在的页面
});
}
const rightClick = () => {
console.log(2)
uni.navigateTo({ url: `/pages/repair/testedInBound/codeScan` })
}
2025-01-24 18:00:07 +08:00
// 状态标签样式
const successStyle = {
color: '#52c41a',
backgroundColor: 'rgba(82, 196, 26, 0.1)',
border: '2rpx solid rgba(82, 196, 26, 0.2)',
fontWeight: '600'
}
const warningStyle = {
color: '#fa8c16',
backgroundColor: 'rgba(250, 140, 22, 0.1)',
border: '2rpx solid rgba(250, 140, 22, 0.2)',
fontWeight: '600'
}
2024-11-21 10:47:48 +08:00
const maskClick = () => {}
</script>
<style lang="scss" scoped>
.page-container {
display: flex;
height: 100vh;
padding: 24rpx;
2024-11-21 10:47:48 +08:00
flex-direction: column;
background-color: #f7f8fa;
2024-11-21 10:47:48 +08:00
.complete-btn {
display: flex;
padding: 20rpx 24rpx;
justify-content: center;
background: #fff;
border-radius: 20rpx;
margin-bottom: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.05);
2024-11-21 10:47:48 +08:00
.btn {
display: flex;
flex-direction: column;
align-items: center;
padding: 0 60rpx;
position: relative;
transition: all 0.3s ease;
span {
font-size: 32rpx;
color: #8c8c8c;
font-weight: 500;
&.active {
color: #3784fb;
font-weight: 600;
.second-active & {
color: #fa8c16;
}
}
}
.bt-line {
width: 32rpx;
height: 6rpx;
background: #3784fb;
margin-top: 12rpx;
border-radius: 6rpx;
transition: all 0.3s ease;
.second-active & {
background: #fa8c16;
}
}
2024-11-21 10:47:48 +08:00
}
}
2024-11-21 10:47:48 +08:00
.search-form {
display: flex;
align-items: center;
background: #fff;
padding: 20rpx;
border-radius: 20rpx;
margin-bottom: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.05);
:deep(.uni-easyinput__content),
:deep(.uni-date-editor) {
background-color: #f7f8fa;
border: 2rpx solid #e8e8e8;
border-radius: 12rpx;
height: 80rpx;
transition: all 0.3s ease;
&:focus-within {
border-color: #3784fb;
box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1);
}
}
:deep(.uni-date) {
width: 100%;
.uni-date-x {
width: 100%;
}
.uni-date-editor--x {
width: 100%;
}
.uni-date-range--x {
width: 100%;
.uni-date-range--x-input {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 24rpx;
.uni-date-range--x-text {
font-size: 28rpx;
color: #262626;
}
}
}
.uni-date-x--border {
width: 100%;
border: 2rpx solid #e8e8e8;
border-radius: 12rpx;
background-color: #f7f8fa;
height: 80rpx;
transition: all 0.3s ease;
&:focus-within {
border-color: #3784fb;
box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1);
}
}
}
:deep(.uni-date-editor) {
.uni-date-range {
2024-11-21 10:47:48 +08:00
display: flex;
align-items: center;
width: 100%;
.uni-date-range--text {
width: 50%;
text-align: center;
color: #333;
}
2024-11-21 10:47:48 +08:00
}
}
}
.search {
height: 80rpx;
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
text-align: center;
line-height: 80rpx;
color: #fff;
border-radius: 12rpx;
font-size: 28rpx;
font-weight: 600;
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
transition: all 0.3s ease;
&:active {
transform: translateY(2rpx);
opacity: 0.9;
}
}
.scroll-container {
padding: 0 2rpx;
.table-list-item {
margin: 24rpx 0;
padding: 32rpx;
background-color: #fff;
min-height: 300rpx;
border-radius: 20rpx;
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.06);
transition: all 0.3s ease;
&:active {
transform: scale(0.985);
background-color: #fafbfc;
}
.title {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
.title-left {
.code {
font-size: 32rpx;
font-weight: 600;
color: #3784fb;
letter-spacing: 1rpx;
}
}
span.status {
padding: 8rpx 28rpx;
border-radius: 8rpx;
font-size: 26rpx;
font-weight: 600;
&.completed {
background-color: rgba(82, 196, 26, 0.1);
color: #52c41a;
}
&.pending {
background-color: rgba(250, 140, 22, 0.1);
color: #fa8c16;
}
}
}
.line {
margin: 24rpx 0;
height: 2rpx;
background: linear-gradient(90deg,
rgba(232, 232, 232, 0) 0%,
rgba(232, 232, 232, 1) 50%,
rgba(232, 232, 232, 0) 100%
);
}
:deep(.uni-row) {
margin-bottom: 20rpx;
.uni-col-6 {
color: #8c8c8c;
font-size: 28rpx;
font-weight: 500;
}
}
.cont {
display: flex;
justify-content: flex-end;
line-height: 1.8;
color: #262626;
font-size: 28rpx;
font-weight: 500;
}
}
}
.loading-text {
text-align: center;
font-size: 26rpx;
color: #8c8c8c;
padding: 32rpx 0;
letter-spacing: 1rpx;
}
}
// 优化滑动区域样式
:deep(.uni-swipe_action) {
border-radius: 20rpx;
overflow: hidden;
.uni-swipe_content {
margin: 0 !important;
padding: 0;
background-color: #fff;
}
.uni-swipe_button-group {
height: 100%;
.uni-swipe_button {
writing-mode: vertical-rl;
padding: 0 24rpx;
font-size: 28rpx !important;
font-weight: 600;
// 查看按钮
&:nth-child(1) {
background: linear-gradient(to bottom, #3ad980, #34C759) !important;
}
// 出库按钮
&:nth-child(2) {
background: linear-gradient(to bottom, #3b95ff, #007AFF) !important;
}
&:active {
opacity: 0.85;
2024-11-21 10:47:48 +08:00
}
}
}
}
</style>