演示
This commit is contained in:
222
pages/sys/workbench/inspection/inspection.vue
Normal file
222
pages/sys/workbench/inspection/inspection.vue
Normal file
@@ -0,0 +1,222 @@
|
||||
<template>
|
||||
<view class="ins-container">
|
||||
<!-- tab栏 -->
|
||||
<view class="ins-tabs">
|
||||
<view v-for="(tab, idx) in tabs" :key="idx" :class="['ins-tab', {active: idx === activeTab}]"
|
||||
@click="changeTab(idx)">
|
||||
{{ tab }}
|
||||
<view v-if="idx === activeTab" class="tab-underline"></view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 列表区 -->
|
||||
<view class="ins-list">
|
||||
<view v-for="(item, idx) in list" :key="idx" class="ins-card" @click="goProcess(item)">
|
||||
<view class="ins-row">
|
||||
<view class="ins-no">保洁部日常巡检 {{ item.createTime.substring(0,11) }}</view>
|
||||
<view class="ins-status" :class="getStatusColor(item.status)">
|
||||
{{ getStatusLabel(item.status) }}
|
||||
</view>
|
||||
</view>
|
||||
<image class="ins-line-image" src="/static/ic_my_repair_03.png" />
|
||||
<view class="ins-info">巡检人:{{ item.createTime }}</view>
|
||||
<view class="ins-info">计划完成时间:{{ item.typeName }}</view>
|
||||
<view class="ins-info">实际完成时间:{{ item.location }}</view>
|
||||
<view class="ins-info">巡检进度:{{ item.location }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tabs: ['待进行', '处理中', '已完成'],
|
||||
activeTab: 0,
|
||||
tabData: [
|
||||
[],
|
||||
[],
|
||||
[]
|
||||
], // 每个tab的数据
|
||||
tabLoaded: [false, false, false], // 每个tab是否已加载
|
||||
loading: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
list() {
|
||||
return this.tabData[this.activeTab];
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadTabData(this.activeTab); // 初始化加载当前tab数据
|
||||
},
|
||||
methods: {
|
||||
goBack() {
|
||||
uni.navigateBack();
|
||||
},
|
||||
async changeTab(idx) {
|
||||
this.activeTab = idx;
|
||||
if (!this.tabLoaded[idx]) {
|
||||
await this.loadTabData(idx);
|
||||
}
|
||||
},
|
||||
async loadTabData(idx) {
|
||||
this.loading = true;
|
||||
// 模拟接口请求,不同tab返回不同mock数据
|
||||
let params = {}
|
||||
|
||||
|
||||
let data = [];
|
||||
|
||||
let res = await this.$u.api.getInspection(params);
|
||||
if (res.code == '200') {
|
||||
data = res.rows
|
||||
}
|
||||
|
||||
this.$set(this.tabData, idx, data);
|
||||
this.$set(this.tabLoaded, idx, true);
|
||||
this.loading = false;
|
||||
},
|
||||
goProcess(item) {
|
||||
const detailItemStr = encodeURIComponent(JSON.stringify(item));
|
||||
uni.navigateTo({
|
||||
url: `/pages/sys/workbench/inspection/inspectionProcess?detailItem=${item}`
|
||||
});
|
||||
},
|
||||
|
||||
getStatusLabel(status) {
|
||||
const statusMap = {
|
||||
0: '待确认',
|
||||
1: '已确认',
|
||||
2: '已取消',
|
||||
3: '已完成'
|
||||
};
|
||||
return statusMap[status] || '';
|
||||
},
|
||||
getStatusColor(status){
|
||||
const statusMap = {
|
||||
0: '待确认',
|
||||
1: 'orange',
|
||||
2: '已取消',
|
||||
3: '已完成'
|
||||
};
|
||||
return statusMap[status] || '';
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ins-container {
|
||||
height: 100vh;
|
||||
background: #f7f7f7;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.ins-tabs {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
background: #fff;
|
||||
height: 80rpx;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
flex-shrink: 0;
|
||||
/* 防止被压缩 */
|
||||
}
|
||||
|
||||
.ins-tab {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
font-size: 30rpx;
|
||||
color: #888;
|
||||
position: relative;
|
||||
font-weight: 500;
|
||||
padding: 0 0 10rpx 0;
|
||||
/* tab点击事件 */
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ins-tab.active {
|
||||
color: #2186FF;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.tab-underline {
|
||||
width: 60rpx;
|
||||
height: 6rpx;
|
||||
background: #2186FF;
|
||||
border-radius: 3rpx;
|
||||
margin: 0 auto;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.ins-list {
|
||||
margin: 25rpx 0 0 0;
|
||||
padding: 0 35rpx;
|
||||
flex: 1;
|
||||
/* 占据所有剩余空间 */
|
||||
overflow-y: auto;
|
||||
/* 内容超出时,开启垂直滚动 */
|
||||
padding-bottom: 200rpx;
|
||||
/* 为底部按钮留出空间 */
|
||||
}
|
||||
|
||||
.ins-card {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 24rpx;
|
||||
padding: 20rpx 40rpx 70rpx 12rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.03);
|
||||
}
|
||||
|
||||
.ins-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12rpx;
|
||||
margin-top: 25rpx;
|
||||
margin-left: 19rpx;
|
||||
margin-right: 50rpx;
|
||||
}
|
||||
|
||||
.ins-no {
|
||||
font-size: 24rpx;
|
||||
color: #0B0B0B;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.ins-status {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.ins-line-image {
|
||||
margin: left 29rpx;
|
||||
margin-right: 39rpx;
|
||||
height: 2rpx;
|
||||
margin-bottom: 29rpx;
|
||||
}
|
||||
|
||||
.ins-status.orange {
|
||||
color: #F3AB44;
|
||||
}
|
||||
|
||||
.ins-status.doing {
|
||||
color: #00C9AA;
|
||||
}
|
||||
|
||||
.ins-status.done {
|
||||
color: #8A8A8A;
|
||||
}
|
||||
|
||||
.ins-info {
|
||||
font-size: 24rpx;
|
||||
color: #888;
|
||||
margin-bottom: 30rpx;
|
||||
margin-left: 47rpx;
|
||||
}
|
||||
|
||||
</style>
|
274
pages/sys/workbench/inspection/inspectionProcess.vue
Normal file
274
pages/sys/workbench/inspection/inspectionProcess.vue
Normal file
@@ -0,0 +1,274 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
|
||||
<view class="section-title">巡检点</view>
|
||||
|
||||
<!-- 时间轴列表 -->
|
||||
<view class="timeline">
|
||||
<view v-for="(item, idx) in taskList" :key="idx" class="node"
|
||||
:class="[{ 'is-last': idx === taskList.length - 1 }]">
|
||||
<!-- 左侧:点 + 竖线 -->
|
||||
<view class="rail">
|
||||
<view class="dot" :class="{
|
||||
'dot-circle': item.dotShape === 'circle',
|
||||
'dot-square': item.dotShape === 'square',
|
||||
'dot-active': item.dotColor === 'blue'
|
||||
}"></view>
|
||||
</view>
|
||||
|
||||
<!-- 右侧内容 -->
|
||||
<view class="card">
|
||||
<!-- 标题块 + 操作区(打包在一起,方便宽度同步) -->
|
||||
<view class="title-ops-wrapper">
|
||||
<!-- 标题块 -->
|
||||
<view v-if="item.headerStyle === 'solid'" class="title-solid">
|
||||
{{ item.pointName }}({{ item.date }} {{ item.time }})
|
||||
</view>
|
||||
<view v-else class="title-dashed">
|
||||
{{ item.pointName }}({{ item.date }} {{ item.time }})
|
||||
</view>
|
||||
|
||||
<!-- 操作区:宽度跟随标题块,内部居中 -->
|
||||
<view class="ops" v-if="item.status === '待巡检'">
|
||||
<view class="btn-outline" @click="startTask(item)">立即巡检</view>
|
||||
</view>
|
||||
|
||||
<view class="ops" v-else>
|
||||
<view class="btn-disabled">完成巡检</view>
|
||||
<view class="badge" :class="item.result === '正常' ? 'badge-success' : 'badge-warn'">
|
||||
{{ item.result }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="footer-placeholder">巡检提醒</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
taskList: []
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getTaskListMock()
|
||||
},
|
||||
methods: {
|
||||
// ---- 模拟接口数据(可替换成 uni.request)----
|
||||
getTaskListMock() {
|
||||
this.taskList = [
|
||||
{
|
||||
pointName: 'A区花园',
|
||||
date: '2025-07-16',
|
||||
time: '09:00—10:00',
|
||||
status: '待巡检',
|
||||
headerStyle: 'solid',
|
||||
result: '',
|
||||
dotShape: 'circle',
|
||||
dotColor: 'gray'
|
||||
},
|
||||
{
|
||||
pointName: 'A区花园',
|
||||
date: '2025-07-16',
|
||||
time: '09:00—10:00',
|
||||
status: '已完成',
|
||||
headerStyle: 'dashed',
|
||||
result: '正常',
|
||||
dotShape: 'circle',
|
||||
dotColor: 'blue'
|
||||
},
|
||||
{
|
||||
pointName: 'A区花园',
|
||||
date: '2025-07-16',
|
||||
time: '09:00—10:00',
|
||||
status: '待巡检',
|
||||
headerStyle: 'solid',
|
||||
result: '',
|
||||
dotShape: 'square',
|
||||
dotColor: 'gray'
|
||||
},
|
||||
{
|
||||
pointName: 'A区花园',
|
||||
date: '2025-07-16',
|
||||
time: '09:00—10:00',
|
||||
status: '已完成',
|
||||
headerStyle: 'dashed',
|
||||
result: '异常',
|
||||
dotShape: 'square',
|
||||
dotColor: 'blue'
|
||||
}
|
||||
]
|
||||
},
|
||||
startTask(item) {
|
||||
uni.showToast({
|
||||
title: `开始巡检:${item.pointName}`,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 页面基础 */
|
||||
.page {
|
||||
background: #f7f8fa;
|
||||
min-height: 100vh
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
margin: 24rpx 24rpx 8rpx
|
||||
}
|
||||
|
||||
/* 时间轴容器 */
|
||||
.timeline {
|
||||
position: relative;
|
||||
padding: 16rpx 24rpx 40rpx 24rpx
|
||||
}
|
||||
|
||||
/* 每个节点 */
|
||||
.node {
|
||||
position: relative;
|
||||
padding-left: 72rpx;
|
||||
margin-bottom: 32rpx
|
||||
}
|
||||
|
||||
.node:last-child {
|
||||
margin-bottom: 0
|
||||
}
|
||||
|
||||
/* 左侧导轨与连线 */
|
||||
.node::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 37rpx;
|
||||
top: 35rpx;
|
||||
bottom: -32rpx;
|
||||
width: 2rpx;
|
||||
background: #e8e9ee
|
||||
}
|
||||
|
||||
.node.is-last::after {
|
||||
display: none
|
||||
}
|
||||
|
||||
/* 左栏(点的容器) */
|
||||
.rail {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 72rpx;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center
|
||||
}
|
||||
|
||||
.dot {
|
||||
width: 16rpx;
|
||||
height: 16rpx;
|
||||
margin-top: 20rpx;
|
||||
background: #cfd3dc
|
||||
}
|
||||
|
||||
.dot-circle {
|
||||
border-radius: 50%
|
||||
}
|
||||
|
||||
.dot-square {
|
||||
border-radius: 4rpx
|
||||
}
|
||||
|
||||
.dot-active {
|
||||
background: #2f6aff
|
||||
}
|
||||
|
||||
/* 右侧卡片 */
|
||||
.card {
|
||||
padding: 16rpx 20rpx;
|
||||
}
|
||||
|
||||
/* 标题 + 操作区包裹(宽度由标题决定) */
|
||||
.title-ops-wrapper {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* 标题两种样式 */
|
||||
.title-solid {
|
||||
background: #2f6aff;
|
||||
color: #fff;
|
||||
border-radius: 12rpx;
|
||||
padding: 12rpx 18rpx;
|
||||
display: inline-block;
|
||||
font-size: 26rpx
|
||||
}
|
||||
|
||||
.title-dashed {
|
||||
border-radius: 12rpx;
|
||||
background: #fff;
|
||||
padding: 12rpx 18rpx;
|
||||
display: inline-block;
|
||||
font-size: 26rpx;
|
||||
color: #333
|
||||
}
|
||||
|
||||
/* 操作区:宽度继承标题块,内部居中 */
|
||||
.ops {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.btn-outline {
|
||||
border: 2rpx solid #2f6aff;
|
||||
color: #2f6aff;
|
||||
background: #fff;
|
||||
padding: 12rpx 28rpx;
|
||||
border-radius: 12rpx;
|
||||
font-size: 26rpx
|
||||
}
|
||||
|
||||
.btn-disabled {
|
||||
background: #f2f3f5;
|
||||
color: #a0a0a0;
|
||||
padding: 12rpx 24rpx;
|
||||
border-radius: 12rpx;
|
||||
font-size: 26rpx
|
||||
}
|
||||
|
||||
/* 结果徽标 */
|
||||
.badge {
|
||||
padding: 8rpx 18rpx;
|
||||
border-radius: 22rpx;
|
||||
font-size: 24rpx;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.badge-success {
|
||||
color: #16a34a;
|
||||
border: 2rpx solid #16a34a;
|
||||
background: #fff
|
||||
}
|
||||
|
||||
.badge-warn {
|
||||
color: #f59e0b;
|
||||
border: 2rpx solid #f59e0b;
|
||||
background: #fff
|
||||
}
|
||||
|
||||
/* 底部占位文字 */
|
||||
.footer-placeholder {
|
||||
text-align: center;
|
||||
color: #e5e6eb;
|
||||
font-size: 28rpx;
|
||||
margin-top: 80rpx;
|
||||
letter-spacing: 2rpx
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user