解决冲突

This commit is contained in:
zhouyanli
2026-05-20 16:12:43 +08:00
24 changed files with 1413 additions and 751 deletions

View File

@@ -74,6 +74,12 @@ export default {
.overflow-auto { .overflow-auto {
overflow: auto; overflow: auto;
} }
.nodata {
color: #ccc;
text-align: center;
margin-top: 200rpx;
letter-spacing: 1rpx;
}
/* 自定义导航栏专用 */ /* 自定义导航栏专用 */
.custom-header { .custom-header {
height: calc(var(--status-bar-height) + 88rpx); height: calc(var(--status-bar-height) + 88rpx);

View File

@@ -0,0 +1,15 @@
/**
* @Description: 抽离 公共基础地址
* @Author: Zy
* @Date: 2026-05-18 15:36:10
* @LastEditor: Zy
* @LastEditTime: 2026-05-18 15:36:21
*/
let baseUrl = ''
if (process.env.NODE_ENV === 'development') {
baseUrl = 'http://192.168.0.239:8080' // 开发环境
} else {
baseUrl = 'http://192.168.0.239:8080' // 生产环境
}
export default baseUrl;

View File

@@ -3,9 +3,12 @@
* @Author: Zy * @Author: Zy
* @Date: 2026-05-15 11:37:01 * @Date: 2026-05-15 11:37:01
* @LastEditor: Zy * @LastEditor: Zy
* @LastEditTime: 2026-05-15 17:02:25 * @LastEditTime: 2026-05-19 16:32:46
*/ */
import request, { get, post } from './request.js' import request, {
get,
post
} from './request.js'
/** /**
* @typedef EmployeeItem 员工信息项 * @typedef EmployeeItem 员工信息项
@@ -61,8 +64,19 @@ export function getSystemUsers_employee(roleKey, keyword) {
* @param {string} [keyword=''] - 搜索关键词(可选),房屋号/业主姓名 * @param {string} [keyword=''] - 搜索关键词(可选),房屋号/业主姓名
* @returns {Promise<RowsResult<HouseItem>>} * @returns {Promise<RowsResult<HouseItem>>}
*/ */
export function getVillageHouseList_keyword(data, keyword) { export function getVillageHouseList_keyword(data, searchValue = '') {
return get( return get(
`/manage/replace/sdb/village/house?pageSize=${data.pageSize}&pageNum=${data.pageNum}&keyword=${keyword}` `/manage/replace/sdb/village/house?pageSize=${data.pageSize}&pageNum=${data.pageNum}&searchValue=${searchValue}`
) )
} }
/**
* @description: 管家端通用 文件上传
* @param {FormData} file
* @return
*/
export function uploadFile(file) {
return post('/resource/oss/upload', file)
}

View File

@@ -3,7 +3,7 @@
* @Author: Zy * @Author: Zy
* @Date: 2026-05-15 08:50:47 * @Date: 2026-05-15 08:50:47
* @LastEditor: Zy * @LastEditor: Zy
* @LastEditTime: 2026-05-15 16:47:31 * @LastEditTime: 2026-05-19 16:34:23
*/ */
import request, { import request, {
filterParams, filterParams,

View File

@@ -0,0 +1,110 @@
/**
* @Description: 巡检记录 API
* @Author: Zy
* @Date: 2026-05-16 15:43:07
* @LastEditor: Zy
* @LastEditTime: 2026-05-19 16:25:14
*/
import request, {
filterParams,
get,
put,
post
} from "./request.js";
/**
* @typedef PointsType 巡检任务表
* @property {string} id = [巡检点ID]
* @property {string[]} itemNames = [巡检项目名称]
* @property {string[]} itemIds = [巡检项目ID]
* @property {string} pointName = [巡检点名称]
* */
/**
* @typedef InspectionListType 巡检任务表
* @property {string} id = [巡检任务ID]
*
* @property {0|1} inspectSetting = [0必须拍照, 1允许跳检]
* @property {string} inspectorName = [巡检人员]
* @property {string} phoneNumber = [巡检人员 联系方式]
* @property {string} inspectTime = [巡检时间]
*
* @property {string} taskName = [巡检任务名称]
* @property {string} taskTime = [巡检任务执行时间]
* @property {string} taskStatus = [巡检状态]
* @property {string} planName = [巡检计划]
* @property {string} executeDate = [巡检日期]
* @property {PointsType[]} points = [巡检点]
* @property {string[]} [itemslist] = [巡检项目]
* */
/**
* @description: 获取巡检任务列表
* @param { RequestParams<{ date?:string }> } data
* @return { Promise<RowsResult<InspectionListType>> }
*/
export const getInspectionList = (data) => {
return get('/api/inspection/today/list', filterParams(data))
}
/**
* @typedef PointType 巡检点 信息
* @property {string} imgUrl = [0必须拍照, 1允许跳检]
* @property {string} itemNames = [巡检人员]
* @property {string} itemStandards = [巡检人员 联系方式]
* @property {string} pointId = [巡检时间]
* @property {string} pointName = [巡检点名称]
* @property {string} remark = [巡检描述]
* @property { 0 | 1 } status = [巡检点状态 ]
* */
/**
* @typedef RoutesType 巡检路线 信息
* @property {string} inspectSetting = [0必须拍照, 1允许跳检]
* @property {string} description = [巡检人员]
* @property {string} routeId = [巡检人员 联系方式]
* @property {string} routeName = [巡检时间]
* @property {PointType[]} points = [巡检计划]
* */
/**
* @typedef InspectionMainType 巡检任务详情
* @property {0|1} inspectSetting = [0必须拍照, 1允许跳检]
* @property {string} inspectorName = [巡检人员]
* @property {string} villageName = [巡检小区]
* @property {string} phoneNumber = [巡检人员 联系方式]
* @property {string} inspectTime = [巡检时间]
* @property {string} planName = [巡检计划]
* @property {string} remindTime = [提醒时间]
* @property {string} taskId = [巡检任务ID]
* @property {string} taskName = [巡检任务名称]
* @property {string} taskTime = [巡检任务执行时间]
* @property {RoutesType[]} routes = [巡检路线信息]
* */
/**
* @description: 获取 巡检任务详情
* @param {string} id
* @return {Promise<DataResult<InspectionMainType>>}
*/
export const getInspectionMain = (id) => {
return get('/api/inspection/today/detail', {
taskId: id
})
}
/**
* @typedef inspectionPointParams 巡检任务表
* @property {string} pointId = [巡检点ID]
* @property {string} imgUrl = [巡检点,图片上传]
* @property {string} remark = [巡检点 巡检描述]
* @property {string} taskId = [巡检任务ID]
* @property {number} status = [巡检点状态] 0正常1异常
* */
/**
* @description: 巡检点上传
* @param {inspectionPointParams} data
*/
export const putInsepctionPoint = (data) => {
return post('/api/inspection/today/pointImg', data)
}

View File

@@ -1,4 +1,50 @@
/**
* @Description: 仪表换新API
* @Author: Zy
* @Date: 2026-05-16 15:53:23
* @LastEditor: Zy
* @LastEditTime: 2026-05-16 16:38:54
*/
import request, { import request, {
filterParams,
get, get,
post post,
put
} from "./request.js" } from "./request.js"
/**
* 设备类型枚举
* @typedef {1 | 2} DeviceType
* @description 1=水表 2=电表
*/
/**
* @typedef ReplaceMentRecordList 巡检任务表
* @property {string} deviceCode = [设备编号]
* @property {DeviceType} deviceType = [设备类型]
* @property {string} houseId = [楼栋ID]
* @property {string} buildingName = [楼栋名称]
* @property {string} unitNo = [单元号]
* @property {string} houseNo = [房屋号]
* @property {string} addressCn = [房屋地址]
* @property {string} addressHyphen = [房屋地址]
* @property {string} createTime = [创建时间]
* */
/**
* 获取仪表换新记录
* @param {RequestParams} data 请求参数
* @return {Promise<RowsResult<ReplaceMentRecordList>>}
*/
export const getReplaceMainList = (data) => {
return get('/manage/replace/sdb/record/list', filterParams(data))
}
/**
* @description: 添加仪表API
* @param {{ deviceType:DeviceType, deviceCode:string,houseId:string }} data
*/
export const AddReplaceMainList = (data) => {
return put('/manage/replace/sdb/replace/device', filterParams(data))
}

View File

@@ -1,9 +1,4 @@
let baseUrl = '' import baseUrl from './BaseUrl.js'
if (process.env.NODE_ENV === 'development') {
baseUrl = 'http://192.168.0.239:8080' // 开发环境
} else {
baseUrl = 'http://192.168.0.239:8080' // 生产环境
}
export default function request(url, data = {}, method = 'GET') { export default function request(url, data = {}, method = 'GET') {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {

View File

@@ -0,0 +1,106 @@
/**
* @Description: 工单API
* @Author: Zy
* @Date: 2026-05-19 16:29:20
* @LastEditor: Zy
* @LastEditTime: 2026-05-20 08:36:23
*/
import request, {
get,
filterParams,
post,
put,
} from './request.js'
/**
* @typedef myOrderListType 个人维修工单列表
* @property {String} id = [工单ID]
* @property {String} houseId = [维修房屋ID]
* @property {String} maintenanceItemId = [维修项目ID]
* @property {String} maintenanceItemName = [维修项目名称]
* @property {String} problem = [报修描述]
* @property {String} residentId = [报修用户ID]
* @property {String} residentName = [报修用户名称]
* @property {String} phone = [报修用户 联系方式]
* @property {String} orderDate = [工单日期]
* @property {String} problemImageUrl = [报修图片]
* @property {String} problemStatus = [报修状态]
* @property {String} repairDes = [维修描述]
* @property {String} repairImageUrl = [维修描述]
* @property {String} repairId = [维修ID]
* @property {String} repairName = [维修人员名称]
* @property {String} houseName = [维修房屋地址]
* @property {String} item = []
* @property {String} projectType = [报修项目类型]
* @property {String} projectTypeStr = [报修 项目 名称]
* @property {String} repairIsCheck = [维修人员 已读]
* @property {String} manageIsCheck = [管理人员 已读]
* @property {String} isCheckStr = [状态已读]
*/
/**
* @description: 获取我的维修工单
* @param {RequestParams<{
itemType?: 0 | 1
problemStatus:1|2
}>} data
* @return { Promise<RowsResult<myOrderListType>>}
*/
export function getUserTicketlist(data) {
return get(`/manage/repair/order/myorderlist`, filterParams(data))
}
/**
* @typedef TicketMainInfoTyp 维修工单信息
* @property {String} id = [工单ID]
* @property {String} houseId = [维修房屋ID]
* @property {String} houseName = [维修房屋地址]
* @property {String} isCheckStr = [状态已读]
* @property {String} item = [标题]
* @property {String} maintenanceItemId = [维修项目ID]
* @property {String} maintenanceItemName = [维修项目名称]
* @property {String} manageIsCheck = [管理人员 已读]
* @property {String} orderDate = [工单日期]
* @property {String} phone = [报修用户 联系方式]
* @property {String} problem = [报修描述]
* @property {String} problemImageUrl = [报修图片]
* @property {String} problemStatus = [报修状态]
* @property {String} projectType = [报修项目类型]
* @property {String} projectTypeStr = [报修 项目 名称]
* @property {String} repairDes = [维修描述]
* @property {String} repairId = [维修ID]
* @property {String} repairImageUrl = [维修描述]
* @property {String} repairIsCheck = [维修人员 已读]
* @property {String} residentName = [报修用户名称]
* @property {String} residentId = [报修用户ID]
* @property {String} repairName = [维修人员名称]
*/
/**
* @description: 获取工单详细信息 by id
* @param {string} id
* @return { Promise<DataResult<TicketMainInfoTyp>>}
*/
export function getTicketMainById(id) {
return get('/manage/repair/order/orderdetail', {
id,
})
}
/**
* @typedef ticketComputedInfo 维修工单信息
* @property {String} id = [工单ID]
* @property {String} repairDes = [维修房屋ID]
* @property {String} repairImageUrl = [维修房屋地址]
*/
/**
* @description: 维修工单完成
* @param {ticketComputedInfo} data
*/
export function ticketComputed(data) {
return put('/manage/repair/order', filterParams(data))
}

View File

@@ -24,6 +24,7 @@
<script setup> <script setup>
import { ref, watch } from 'vue' import { ref, watch } from 'vue'
import baseUrl from '@/api/BaseUrl.js'
// ====================== // ======================
// Props(可配置) // Props(可配置)
@@ -102,7 +103,6 @@ function choose() {
sizeType: props.sizeType, sizeType: props.sizeType,
success: async res => { success: async res => {
const tempPaths = res.tempFilePaths const tempPaths = res.tempFilePaths
// 如果没传上传接口,只返回临时路径 // 如果没传上传接口,只返回临时路径
if (!props.uploadUrl) { if (!props.uploadUrl) {
const newItems = tempPaths.map(path => ({ url: path })) const newItems = tempPaths.map(path => ({ url: path }))
@@ -135,9 +135,13 @@ async function uploadSingle(filePath) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.uploadFile({ uni.uploadFile({
url: props.uploadUrl, url: `${baseUrl}${props.uploadUrl}`,
filePath: filePath, filePath: filePath,
name: props.fileFieldName, name: props.fileFieldName,
header: {
Authorization: 'Bearer ' + (uni.getStorageSync('token') || ''),
clientid: 'butler'
},
// ✅ 新增:携带额外参数 // ✅ 新增:携带额外参数
formData: props.extraData, formData: props.extraData,
success: res => { success: res => {

View File

@@ -1,24 +1,35 @@
// 全局 JSDoc 类型定义 全项目所有文件通用 // 全局 JSDoc 类型定义 全项目所有文件通用
/** /**
* 【全局】通用分页接口返回结构1 * 【全局】通用分页接口返回结构
* @template T - 列表项类型 * @template T - 列表项类型
* @typedef {Object} RowsResult * @typedef RowsResult 分页结构
* @property {number} code 响应码,200=成功 * @property {number} code 响应码,200=成功
* @property {string} msg 响应消息 * @property {string} msg 响应消息
* @property {number} total 总条数 * @property {number} total 总条数
* @property {T[]} rows 数据列表 * @property {T[]} rows 数据列表
*/ */
/** /**
* 【全局】通用接口返回结构2 * 返回结果
* @template T - 列表项类型 * @template T
* @typedef {Object} DataResult * @typedef {Object} DataResult
* @property {T} data 列表数据
* @property {number} code 响应码,200=成功 * @property {number} code 响应码,200=成功
* @property {string} msg 响应消息 * @property {string} msg 响应消息
* @property {T} data 数据列表
*/ */
/**
* 分页参数
* @typedef {Object} PageType
* @property {number} pageSize 每页条数
* @property {number} pageNum 当前页码
*/
/**
* 通用请求参数(T 不传时 = PageType)
* @template [T=undefined]
* @typedef {T extends undefined ? PageType : PageType & T} RequestParams
*/
/** /**
* 【全局】角色标识枚举 * 【全局】角色标识枚举

View File

@@ -118,7 +118,6 @@ function getlist() {
}) })
getSystemUsers_employee('complainUser', queryParmas.value.value) getSystemUsers_employee('complainUser', queryParmas.value.value)
.then(res => { .then(res => {
console.log(res)
searchlist.value = res.data searchlist.value = res.data
}) })
.finally(() => { .finally(() => {

View File

@@ -5,132 +5,158 @@
<view class="title_box flex items-center justify-between"> <view class="title_box flex items-center justify-between">
<view class="title flex items-center"> <view class="title flex items-center">
<view class="line"> </view> <view class="line"> </view>
<text>{{ info.taskName }}</text> <text>{{ info.villageName }} - {{ info.taskName }}</text>
</view>
<view class="inspection_status" v-if="info.status === 0"> <text>已巡检</text> </view>
<view class="inspection_status todo" v-else>
<text>未巡检</text>
</view> </view>
<view class="inspection_status"> <text>已巡检</text> </view>
</view> </view>
<view class="info"> <view class="info">
<view class="item"> <view class="item">
<text>巡检项目:</text> <text>巡检项目:</text>
<text>{{ info.items.join('; ') }}</text> <text>{{ info.planName }}</text>
</view> </view>
<view class="item"> <view class="item">
<text>巡检时间:</text> <text>巡检时间:</text>
<text>{{ info.time }}</text> <text>{{ info.taskTime }}</text>
</view> </view>
<view class="item"> <view class="item">
<text>巡检小区:</text> <text>巡检小区:</text>
<text>{{ info.villageName }}</text> <text>{{ info.villageName }}</text>
</view> </view>
<view class="item"> <view class="" v-for="(item, index) in baseFormData" :key="index">
<text>巡检路线:</text> <view class="item">
<text>{{ info.planName }}</text> <text>巡检路线:</text>
</view> <text>{{ item.routeName }}</text>
<view class="item"> </view>
<text>巡检点:</text> <view class="item">
<text>{{ info.point.join('; ') }}</text> <text>巡检点:</text>
<text v-for="(ite, ind) in item.points" :key="ind">{{ ite.pointName }};</text>
</view>
</view> </view>
</view> </view>
</view> </view>
<view class="result_box"> <view class="result_box" v-if="baseFormData.length > 0">
<view class="inspecton_result_title"> <view class="inspecton_result_title">
<text>巡检结果</text> <text>巡检结果</text>
</view> </view>
<view class="inspection_body" v-for="(item, index) in result" :key="index"> <view class="inspection_body" v-for="(item, index) in baseFormData" :key="index">
<view class="inspection_items"> <view v-for="(ite, ind) in item.points" :key="ind">
<text class="label">巡检点:</text> <view class="inspection_items">
<text>{{ item.pointName }}</text> <text class="label">巡检路线:</text>
<text style="font-weight: 550">{{ item.routeName }}</text>
</view>
<view class="inspection_items">
<text class="label">巡检点:</text>
<text>{{ ite.pointName }}</text>
</view>
<view class="inspection_items">
<text class="label">巡检人:</text>
<text>{{ info.inspectorName }}</text>
</view>
<view class="inspection_items">
<text class="label">手机号码:</text>
<text>{{ info.phoneNumber }}</text>
</view>
<view class="inspection_items">
<text class="label">巡检时间:</text>
<text>{{ ite.createTime }}</text>
</view>
<view class="inspection_items">
<text class="label">巡检状态:</text>
<text>{{ ite.status === 0 ? '正常' : '异常' }}</text>
</view>
<view class="inspection_items">
<view class="label">巡检结果:</view>
<!-- <view class="desction_value"> {{ ite.desition }}</view> -->
<view class="desction_value">
<!-- <rich-text :nodes="ite.desition"></rich-text> -->
<textarea class="my_textarea" disabled auto-height :value="ite.desition" />
</view>
</view>
<view class="inspection_items">
<view class="label">巡检照片:</view>
<image
lazy-load
class="inspection_photo"
v-for="(it, ind) in ite.files"
:key="ind"
:src="it"
mode="scaleToFill"
></image>
</view>
<view class="linedash" v-show="ind + 1 !== item.points.length"> </view>
</view> </view>
<view class="inspection_items">
<text class="label">巡检人:</text>
<text>{{ item.user }}</text>
</view>
<view class="inspection_items">
<text class="label">手机号码:</text>
<text>{{ item.phone }}</text>
</view>
<view class="inspection_items">
<text class="label">巡检时间:</text>
<text>{{ item.time }}</text>
</view>
<view class="inspection_items">
<view class="label">巡检结果:</view>
<view class="desction_value">{{ item.descrtion }}</view>
</view>
<view class="inspection_items">
<view class="label">巡检照片:</view>
<image
lazy-load
class="inspection_photo"
v-for="(ite, ind) in item.photos"
:key="ind"
:src="ite"
mode="scaleToFill"
></image>
</view>
<view class="linedash" v-show="index + 1 !== result.length"> </view>
</view> </view>
</view> </view>
<view class="nodata" v-else>
<text>暂无数据</text>
</view>
</view> </view>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref } from 'vue'
import { getInspectionMain } from '@/api/insepction.js'
import { onLoad } from '@dcloudio/uni-app'
const taskid = ref('')
const info = ref({ const info = ref({
items: ['设备巡检', '电力检查'], planName: '',
time: '07:00:00-12:00:00', remindTime: '',
villageName: '幸福苑小区', routes: [],
taskName: '幸福苑小区-B1层地下车区', taskId: '',
status: 0, // 0 已巡检 1未巡检 taskName: '',
planName: '常规巡检路线1', taskTime: '',
point: ['安全出口1号', '巡检点2号', '巡检点3号'] inspectorName: '',
phoneNumber: '',
villageName: ''
})
const baseFormData = ref([])
function init() {
if (!taskid.value) return
getInspectionMain(taskid.value)
.then(res => {
info.value = res.data
if (!res.data.routes) return
let result = res.data.routes
.map(item => {
if (!item.points || item.points.length <= 0) return false
const points = item.points.map(ite => {
return {
pointId: ite.pointId,
pointName: ite.pointName,
status: ite.status ?? 0,
createTime: ite.createTime,
desition: ite.remark,
files: ite.imgUrl ? ite.imgUrl.split(',') : [],
phone: '',
time: '',
resientName: ''
}
})
return {
routeName: item.routeName,
routeId: item.routeId,
description: item.description,
points: points
}
})
.filter(item => item !== false)
baseFormData.value = result
})
.catch(err => {
uni.showToast({
icon: 'error',
title: '网络异常'
})
})
}
onLoad(options => {
taskid.value = options.id
init()
}) })
const result = ref([
{
pointName: '安全出口1号',
user: '李相龙',
phone: '1502360831',
time: '2026-10-25 08:10:01',
descrtion: '设备正常运转,电力系统正常,设备使用正常',
photos: [
'https://picsum.photos/80',
'https://picsum.photos/80',
'https://picsum.photos/80',
'https://picsum.photos/80'
]
},
{
pointName: '巡检点2号',
user: '李相龙',
phone: '1502360831',
time: '2026-10-25 10:10:01',
descrtion: '部分墙体漏水',
photos: [
'https://picsum.photos/80',
'https://picsum.photos/80',
'https://picsum.photos/80',
'https://picsum.photos/80'
]
},
{
pointName: '巡检点3号',
user: '李相龙',
phone: '1502360831',
time: '2026-10-25 12:10:01',
descrtion: '正常',
photos: [
'https://picsum.photos/80',
'https://picsum.photos/80',
'https://picsum.photos/80',
'https://picsum.photos/80'
]
}
])
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -216,7 +242,6 @@ const result = ref([
width: 160rpx; width: 160rpx;
height: 160rpx; height: 160rpx;
margin-right: 20rpx; margin-right: 20rpx;
margin-bottom: 20rpx;
margin-top: 20rpx; margin-top: 20rpx;
} }
@@ -224,7 +249,6 @@ const result = ref([
font-weight: 450; font-weight: 450;
font-size: 28rpx; font-size: 28rpx;
color: #333333; color: #333333;
margin-bottom: 20rpx;
} }
.desction_value { .desction_value {
@@ -233,11 +257,23 @@ const result = ref([
font-size: 28rpx; font-size: 28rpx;
color: #666666; color: #666666;
line-height: 36rpx; line-height: 36rpx;
max-height: 250rpx; /* 最大高度,超出滚动 */
overflow-y: auto; /* 超出滚动 */
.my_textarea {
min-height: 80rpx;
font-weight: 400;
font-size: 28rpx;
color: #666666;
line-height: 36rpx;
}
} }
} }
.linedash { .linedash {
width: 100%; width: 100%;
border: 2rpx dashed #ccc; height: 0;
border: 1rpx dashed #ccc;
margin: 40rpx 0;
} }
} }
} }

View File

@@ -3,45 +3,59 @@
<view class="page_padding"> <view class="page_padding">
<view class="inspection_record_box flex-1 flex flex-col"> <view class="inspection_record_box flex-1 flex flex-col">
<navBar @clickLeft="navBack" title="巡检记录"></navBar> <navBar @clickLeft="navBack" title="巡检记录"></navBar>
<TabsComponents :tabslist="tabslist" @update="handleChangeTabs"></TabsComponents> <TabsComponents :tabslist="tabslist" @update="handleChangeTabs"></TabsComponents>
<view class="timebox">
<view class="daybox flex items-center">
<uni-datetime-picker
type="date"
:clear-icon="false"
@change="handleChangeTime"
v-model="queryParmas.date"
>
<view class="day">{{ showDate }}</view>
</uni-datetime-picker>
<view class="searchiconbox flex items-center">
<view class="arrow"> </view>
<view class="arrow1"> </view>
</view>
</view>
</view>
<scroll-view <scroll-view
class="record_body record-list" class="record_body record-list"
scroll-y scroll-y
lower-threshold="60" lower-threshold="160"
@scrolltolower="scrolltolower" @scrolltolower="scrolltolower"
v-if="list.length > 0"
> >
<!-- v-for --> <view
<view class="record_item" v-for="(item, index) in list" :key="index"> class="record_list_item"
<view class="time"> v-for="(ite, index) in list"
<view>{{ item.day }}</view> :key="index"
@tap="handleTap(ite)"
>
<view class="title flex items-center">
<view class="title_name"> {{ ite.taskName }} </view>
<view class="title_status" v-if="isComputed(ite.taskStatus)"> 已巡检 </view>
<view class="title_status noinspection" v-else> 未巡检 </view>
</view> </view>
<view class="record_list_box"> <view class="items" v-if="ite.points">
<!-- v-for --> <view class="item" v-for="(itemname, itemindex) in ite.itemslist" :key="itemindex">
<view class="record_list_item" v-for="(ite, ind) in item.list" :key="ind"> <text>{{ itemname }}</text>
<view class="title flex items-center">
<view class="title_name"> {{ ite.title }} </view>
<view class="title_status" v-if="ite.status === 0"> 已巡检 </view>
<view class="title_status noinspection" v-else> 未巡检 </view>
</view>
<view class="items">
<!-- v-for -->
<view class="item" v-for="(it, inde) in ite.items" :key="inde">
<text>{{ it }}</text>
</view>
</view>
<view class="time">
<text>巡检时间:</text>
<text>{{ ite.time }}</text>
</view>
<view class="time user">
<text>巡检人:</text>
<text>{{ ite.user }}</text>
</view>
</view> </view>
</view> </view>
<view class="time">
<text>巡检时间:</text>
<text>{{ ite.taskTime }}</text>
</view>
<view class="time user">
<text>巡检人:</text>
<text>{{ ite.inspectorName }}</text>
</view>
</view> </view>
</scroll-view> </scroll-view>
<view class="nodata" v-else>
<text>暂无数据</text>
</view>
</view> </view>
</view> </view>
</template> </template>
@@ -49,62 +63,48 @@
<script setup lang="ts"> <script setup lang="ts">
import TabsComponents from '@/components/tabs/tabs.vue' import TabsComponents from '@/components/tabs/tabs.vue'
import navBar from '@/components/navbar/navbar.vue' import navBar from '@/components/navbar/navbar.vue'
import { ref } from 'vue' import { computed, ref } from 'vue'
import { getInspectionList } from '@/api/insepction.js'
import { parseTime } from '@/utils/time.js'
import { onShow } from '@dcloudio/uni-app'
const isComputed = (status: string) => {
const awaitlist = ['未完成', '待执行', '执行中']
return !awaitlist.includes(status)
}
const tabslist = [ const tabslist = [
{ {
name: '全部', name: '全部',
value: 0 value: 2
}, },
{ {
name: '未巡检', name: '未巡检',
value: 1 value: 0
}, },
{ {
name: ' 已巡检', name: ' 已巡检',
value: 2 value: 1
} }
] ]
function handleChangeTabs(val: number) {}
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
const list = ref([ const list = ref([])
{
day: '10月11日',
list: [
{
title: '标题1',
status: 0,
items: ['设备巡检'],
time: '07:00:00-09:00:00',
user: '李兴'
},
{
title: '标题3',
status: 0,
items: ['设备巡检'],
time: '07:00:00-09:00:00',
user: '湖色'
}
]
}
])
const queryParmas = ref({ const queryParmas = ref({
date: '',
status: 2,
pageNum: 1, pageNum: 1,
pageSize: 5 pageSize: 10
})
const showDate = computed(() => {
return parseTime(queryParmas.value.date, '{m}月{d}日')
}) })
const isLoading = ref(false) // 加载锁 const isLoading = ref(false) // 加载锁
const hasMore = ref(true) // 是否还有更多数据 const hasMore = ref(true) // 是否还有更多数据
const total = ref(21) const total = ref(0)
function scrolltolower() {
// 必须加这两个判断!
if (isLoading.value || !hasMore.value) {
return
}
queryParmas.value.pageNum += 1
getlist()
}
function getlist() { function getlist() {
// 1. 如果正在加载或没有更多数据,直接返回 // 1. 如果正在加载或没有更多数据,直接返回
if (isLoading.value || !hasMore.value) return if (isLoading.value || !hasMore.value) return
@@ -114,51 +114,76 @@ function getlist() {
title: '加载中', title: '加载中',
mask: true mask: true
}) })
const { pageNum, pageSize } = queryParmas.value const { pageNum, pageSize, date, status } = queryParmas.value
getInspectionList({
const startId = (pageNum - 1) * pageSize + 1 pageSize,
const arr = Array.from({ length: pageSize }).map((_, index) => { pageNum,
const realId = startId + index // ✅ 修复 ID 错误 date,
status
// ✅ 随机生成 0、1、2
const randomStatus = Math.floor(Math.random() * 2)
return {
day: '10月' + realId + '日',
list: [
{
title: '标题1',
status: randomStatus,
items: ['设备巡检'],
time: '07:00:00-09:00:00',
user: '李兴'
},
{
title: '标题3',
status: randomStatus,
items: ['设备巡检'],
time: '07:00:00-09:00:00',
user: '湖色'
}
]
}
}) })
.then(res => {
// 追加数据(正确方式) list.value = res.rows
list.value = [...list.value, ...arr] let items: Set<string> = new Set()
// 判断是否还有更多 res.rows.forEach(item => {
hasMore.value = list.value.length < total.value if (!item.points || item.points.length <= 0) return
isLoading.value = false item.points.forEach(ite => {
uni.hideLoading() ite.itemNames.forEach(it => items.add(it))
})
item.itemslist = Array.from(items)
})
hasMore.value = list.value.length < res.total
total.value = res.total
})
.finally(() => {
isLoading.value = false
uni.hideLoading()
})
} }
getlist()
function resetList() { function handleChangeTime(event: string) {
list.value = []
queryParmas.value.pageNum = 1
hasMore.value = true hasMore.value = true
queryParmas.value.date = event
getlist()
}
function handleTap(ite) {
if (isComputed(ite.taskStatus)) {
uni.navigateTo({
url: '/pageSubPack/inspection/inspection_main?id=' + ite.id
})
} else {
uni.navigateTo({
url: '/pageSubPack/inspection/inspection_upload?id=' + ite.id
})
}
}
function scrolltolower() {
if (isLoading.value || !hasMore.value) {
return
}
queryParmas.value.pageNum += 1
getlist()
}
function handleChangeTabs(val: number) {
hasMore.value = true
queryParmas.value.status = val
queryParmas.value.pageNum = 1
queryParmas.value.pageSize = 10
getlist() getlist()
} }
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
function init() {
queryParmas.value.date = parseTime(new Date(), '{y}-{m}-{d}')
getlist()
}
onShow(() => {
hasMore.value = true
init()
})
// 返回上一页 // 返回上一页
const navBack = () => { const navBack = () => {
uni.navigateBack() uni.navigateBack()
@@ -174,91 +199,121 @@ const navBack = () => {
height: 100vh; height: 100vh;
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
.record_body { .timebox {
width: 178rpx;
height: 48rpx;
background: #ffffff;
border-radius: 24rpx;
text-align: center;
line-height: 48rpx;
font-weight: 400;
font-size: 28rpx;
color: #666666;
margin-bottom: 20rpx;
margin-top: 20rpx; margin-top: 20rpx;
.daybox {
height: 100%;
box-sizing: border-box;
position: relative;
.day {
flex: 1;
font-size: 28rpx;
text-align: left;
padding-left: 15rpx;
}
.searchiconbox {
width: 38rpx;
height: 48rpx;
padding-right: 10rpx;
flex-direction: column;
justify-content: center;
.arrow,
.arrow1 {
border: 1rpx solid #ccc;
width: 8rpx;
height: 8rpx;
}
.arrow {
border-right-color: transparent;
border-top-color: transparent;
transform: rotateZ(135deg);
}
.arrow1 {
border-left-color: transparent;
border-bottom-color: transparent;
transform: rotateZ(135deg);
}
}
}
}
.record_body {
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;
overflow-y: auto; overflow-y: auto;
box-sizing: border-box; box-sizing: border-box;
.record_item {
& > .time { .record_list_item {
width: 168rpx; margin-bottom: 20rpx;
height: 48rpx; background: #ffffff;
background: #ffffff; border-radius: 16rpx;
border-radius: 24rpx; box-sizing: border-box;
text-align: center; padding: 32rpx;
line-height: 48rpx; // 巡检标题
.title {
font-weight: 400; font-weight: 400;
font-size: 28rpx; font-size: 32rpx;
color: #666666; color: #222222;
line-height: 40rpx;
height: 40rpx;
margin-bottom: 25rpx;
margin-bottom: 20rpx; .title_status {
} width: 86rpx;
.record_list_box { height: 30rpx;
margin-bottom: 20rpx; background: #4d5dfa;
.record_list_item { border-radius: 198rpx 198rpx 198rpx 198rpx;
margin-bottom: 20rpx; text-align: center;
background: #ffffff; font-weight: 400;
border-radius: 16rpx; font-size: 20rpx;
box-sizing: border-box; color: #ffffff;
padding: 32rpx; line-height: 30rpx;
// 巡检标题 margin-left: 5rpx;
.title {
font-weight: 400;
font-size: 32rpx;
color: #222222;
line-height: 40rpx;
height: 40rpx;
margin-bottom: 25rpx;
.title_status { &.noinspection {
width: 86rpx; background-color: #ccc;
height: 30rpx;
background: #4d5dfa;
border-radius: 198rpx 198rpx 198rpx 198rpx;
text-align: center;
font-weight: 400;
font-size: 20rpx;
color: #ffffff;
line-height: 30rpx;
margin-left: 5rpx;
&.noinspection {
background-color: #ccc;
}
}
}
// 巡检项目
.items {
margin-bottom: 20rpx;
display: flex;
align-items: center;
flex-wrap: wrap;
.item {
padding: 0 10rpx;
height: 42rpx;
border-radius: 8rpx 8rpx 8rpx 8rpx;
border: 1rpx solid #4d5dfa;
font-weight: 400;
font-size: 24rpx;
color: #4d5dfa;
text-align: center;
line-height: 42rpx;
margin-right: 20rpx;
margin-bottom: 10rpx;
}
}
// 巡检人 巡检时间
& > .time {
font-weight: 400;
font-size: 28rpx;
color: #999999;
} }
} }
} }
// 巡检项目
.items {
margin-bottom: 20rpx;
display: flex;
align-items: center;
flex-wrap: wrap;
.item {
padding: 0 10rpx;
height: 42rpx;
border-radius: 8rpx 8rpx 8rpx 8rpx;
border: 1rpx solid #4d5dfa;
font-weight: 400;
font-size: 24rpx;
color: #4d5dfa;
text-align: center;
line-height: 42rpx;
margin-right: 20rpx;
margin-bottom: 10rpx;
}
}
// 巡检人 巡检时间
& > .time {
font-weight: 400;
font-size: 28rpx;
color: #999999;
}
} }
} }
} }

View File

@@ -5,16 +5,16 @@
<view class="inspection_title flex flex-between"> <view class="inspection_title flex flex-between">
<view class="title flex"> <view class="title flex">
<text class="line"></text> <text class="line"></text>
<text>幸福苑小区- B1层地下车库</text> <text>{{ info.villageName }} - {{ info.taskName }}</text>
</view> </view>
<view class="status"> <view class="status" v-if="!isComputed">
<text>未巡检</text> <text>未巡检</text>
</view> </view>
</view> </view>
<view class="inspection_item_info_box"> <view class="inspection_item_info_box">
<view class="inspection_item"> <view class="inspection_item">
<text>巡检项目:</text> <text>巡检项目:</text>
<text>设备巡检</text> <text>{{ info.planName }}</text>
</view> </view>
<view class="inspection_item"> <view class="inspection_item">
<text>巡检时间:</text> <text>巡检时间:</text>
@@ -22,106 +22,95 @@
</view> </view>
<view class="inspection_item"> <view class="inspection_item">
<text>巡检小区:</text> <text>巡检小区:</text>
<text>幸福苑小区</text> <text>{{ info.villageName }}</text>
</view> </view>
<view class="inspection_item"> <view class="" v-for="(item, index) in baseFormData" :key="index">
<text>巡检路线:</text> <view class="inspection_item">
<text>常规巡检路线1</text> <text>巡检路线:</text>
</view> <text>{{ item.routeName }}</text>
<view class="inspection_item"> </view>
<text>巡检点:</text> <view class="inspection_item">
<text>安全巡检点1;</text> <text>巡检点:</text>
<text>安全巡检点2;</text> <text v-for="(ite, ind) in item.points" :key="ind">{{ ite.ponitName }};</text>
<text>安全巡检点3;</text> </view>
<text>安全巡检点4;</text>
</view> </view>
</view> </view>
</view> </view>
<view class="inspection_info_upload_box"> <view class="inspection_info_upload_box" v-if="baseFormData.length > 0">
<view class="header"> <text>巡检结果</text> </view> <view class="inspection_routes" v-for="(item, index) in baseFormData" :key="index">
<view class="info_body" :key="index" v-for="(item, index) in baseFormData"> <view class="header">
<view class="info_title" style="margin-bottom: 20rpx"> {{ item.name }} </view> <text>{{ item.routeName }} - 巡检结果</text>
<uni-forms :modelValue="item" :rules="rules" label-position="left" label-width="150"> </view>
<uni-forms-item label="巡检状态" required> <view class="info_body" v-for="(ite, ind) in item.points" :key="ind">
<uni-data-checkbox <view class="info_title" style="margin-bottom: 20rpx"> {{ ite.ponitName }} </view>
:disabled="item.complated" <uni-forms :modelValue="ite" :rules="rules" label-position="left" label-width="150">
v-model="item.status" <uni-forms-item label="巡检状态" required>
:localdata="statuslist" <uni-data-checkbox
/> :disabled="ite.complated"
</uni-forms-item> v-model="ite.status"
<uni-forms-item label="巡检描述"> :localdata="statuslist"
<uni-easyinput />
type="textarea" </uni-forms-item>
:disabled="item.complated" <uni-forms-item label="巡检描述" v-if="!ite.complated">
:input-border="true" <uni-easyinput
v-model="item.desition" type="textarea"
placeholder="请输入" :disabled="ite.complated"
></uni-easyinput> :input-border="true"
</uni-forms-item> v-model="ite.desition"
<uni-forms-item label="巡检时间"> placeholder="请输入"
<uni-datetime-picker ></uni-easyinput>
type="datetime" </uni-forms-item>
:disabled="item.complated" <view class="items_picker_box flex" style="align-items: baseline" v-else>
return-type="timestamp" <view class="label"> 巡检描述 </view>
v-model="item.datetimesingle" <view class="desitionbox flex-1">
/> <text class="desition">{{ ite.desition }}</text>
</uni-forms-item> </view>
<!-- <uni-forms-item label="巡检照片"> </view>
<uni-file-picker <view class="items_picker_box">
@delete="deleteFile" <view class="label">
@select="select" <text v-if="info.inspectSetting === 1" class="is-required">*</text>
mode="grid" <text>巡检照片</text>
v-model="item.files" </view>
:auto-upload="false" <view class="filePickerbox" v-if="!ite.complated">
:sourceType="['camera']" <filePicker
file-mediatype="image" v-model="ite.files"
> :sourceType="['camera']"
<view class="filePicker flex-center"> file-field-name="file"
<uni-icons color="#a6a6a6" type="plusempty" size="25"> </uni-icons> :extra-data="uploadParams"
</view> uploadUrl="/resource/oss/upload"
</uni-file-picker> @fail="onUploadFail"
</uni-forms-item> --> ></filePicker>
<view class="items_picker_box"> </view>
<view class="label"> 巡检照片 </view> <view class="filePickerbox showimagegrid" v-else>
<view class="filePickerbox" v-if="!item.complated"> <image
<filePicker class="img"
v-model="item.files" mode="scaleToFill"
:sourceType="['camera']" v-for="(ite, ind) in ite.files"
file-field-name="file" lazy-load
:extra-data="uploadParams" :key="ind"
@success="onUploadSuccess" :src="ite"
@fail="onUploadFail" @tap="previewImages(ite.files, index)"
></filePicker> ></image>
</view> </view>
<view class="filePickerbox showimagegrid" v-else> </view>
<image </uni-forms>
class="img" <view class="submitbox" @tap="handleSubmit(ite)" v-if="!ite.complated">
mode="scaleToFill" <text>提交</text>
v-for="(ite, ind) in item.files" </view>
lazy-load <view class="line" v-if="ind + 1 === baseFormData.length"> </view>
:key="ind"
:src="ite"
@tap="previewImages(item.files, index)"
></image>
</view>
</view>
</uni-forms>
<view class="submitbox" @tap="handleSubmit(item.id)">
<text>提交</text>
</view> </view>
<view class="line" v-if="index + 1 !== baseFormData.length"> </view>
</view> </view>
<!-- <view class="submitbox">
<text>提交</text>
</view> -->
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref } from 'vue' import { computed, ref } from 'vue'
import filePicker from '@/components/filePicker/filePicker.vue' import filePicker from '@/components/filePicker/filePicker.vue'
import { getInspectionMain } from '@/api/insepction.js'
import { onLoad } from '@dcloudio/uni-app'
import { putInsepctionPoint } from '@/api/insepction.js'
const statuslist = [ const statuslist = [
{ {
@@ -133,27 +122,16 @@ const statuslist = [
value: 1 value: 1
} }
] ]
const taskid = ref('')
const baseFormData = ref([]) const baseFormData = ref([])
const info = ref({ const info = ref({
point: Array.from({ length: 4 }).map((_, index) => { planName: '',
let obj1 = { remindTime: '',
name: `巡检点${index + 1}`, routes: [],
id: index + '' taskId: '',
} taskName: '',
let obj = { taskTime: '',
id: index, villageName: ''
name: obj1.name,
desition: '', // 描述
datetimesingle: '', // 时间
status: 0, // 状态 0正常1异常
files: [], // 图片
complated: false, // 巡检点完成检查
fileUrls: '' // 图片
}
baseFormData.value.push(obj)
return obj1
})
}) })
const rules = { const rules = {
status: { status: {
@@ -163,39 +141,104 @@ const rules = {
errorMessage: '巡检状态不能为空' errorMessage: '巡检状态不能为空'
} }
] ]
},
files: {
rules: [
{
required: true,
errorMessage: '巡检照片不能为空'
}
]
} }
} }
// ---------------------------------------------- function init() {
const uploadParams = ref({ if (!taskid.value) return
type: 'repair', // 上传类型:报修 getInspectionMain(taskid.value)
businessId: '123456', // 关联业务ID .then(res => {
userId: '789' // 用户ID info.value = res.data
if (!res.data.routes) return
let result = res.data.routes
.map(item => {
if (!item.points || item.points.length <= 0) return false
const points = item.points.map(ite => {
return {
pointId: ite.pointId,
ponitName: ite.pointName,
status: ite.status ?? 0,
desition: ite.remark,
complated: ite.status !== null,
files: ite.imgUrl ? ite.imgUrl.split(',') : []
}
})
return {
routeName: item.routeName,
routeId: item.routeId,
description: item.description,
points: points
}
})
.filter(item => item !== false)
baseFormData.value = result
})
.catch(err => {
uni.showToast({
icon: 'error',
title: '网络异常'
})
})
}
onLoad(options => {
taskid.value = options.id
// taskid.value = '2044684785371725826'
init()
}) })
// 选择文件 // ----------------------------------------------
function onUploadSuccess(e) { const uploadParams = ref({})
console.log('上传成功', e)
}
function onUploadFail(e) { function onUploadFail(e) {
console.log('上传失败', e) console.log('上传失败', e)
} }
function submit() {
console.log('最终要提交的图片URL', imageList.value)
// 这里调用你的提交接口
}
/** 提交巡检点 检查情况 */ /** 提交巡检点 检查情况 */
function handleSubmit(id) { function handleSubmit(item) {
console.log(typeof id, id, baseFormData.value) if (info.value.inspectSetting === 1) {
const find = baseFormData.value.find(item => item.id === id) if (item.files.length <= 0) {
if (find) { uni.showToast({
find.complated = true icon: 'error',
mask: true,
title: '必须拍照'
})
return
}
} }
let obj = {
pointId: item.pointId,
imgUrl: item.files.length > 0 ? item.files.join(',') : '',
remark: item.desition,
status: item.status,
taskId: taskid.value
}
putInsepctionPoint(obj)
.then(res => {
item.complated = true
})
.catch(err => {
uni.showToast({
icon: 'error',
title: '网络错误'
})
})
} }
const isComputed = computed(() => {
// 遍历每一项
return baseFormData.value.every(item => {
// 每一项里的所有 points 都必须是已完成
return item.points.every(point => point.complated)
})
})
/** /**
* 预览图片 * 预览图片
* @param {Array} images - 所有图片的URL数组 * @param {Array} images - 所有图片的URL数组
@@ -215,6 +258,10 @@ function previewImages(images, currentIndex) {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.is-required {
color: #dd524d;
font-weight: bold;
}
.inspection_upload_box { .inspection_upload_box {
background: #f9f9f9; background: #f9f9f9;
padding: 20rpx 40rpx; padding: 20rpx 40rpx;
@@ -279,12 +326,22 @@ function previewImages(images, currentIndex) {
} }
.info_body { .info_body {
margin-bottom: 40rpx; margin-bottom: 40rpx;
.desitionbox {
.desition {
font-size: small;
color: #ccc;
line-height: 1;
letter-spacing: 1px;
}
}
} }
.info_title { .info_title {
font-weight: 550; font-weight: 550;
} }
.line { .line {
width: 100%; width: 100%;
margin-top: 40rpx;
margin-bottom: 40rpx;
border: 1rpx dashed #ccc; border: 1rpx dashed #ccc;
} }
.items_picker_box { .items_picker_box {
@@ -320,7 +377,6 @@ function previewImages(images, currentIndex) {
color: #ffffff; color: #ffffff;
line-height: 80rpx; line-height: 80rpx;
margin-top: 40rpx; margin-top: 40rpx;
margin-bottom: 40rpx;
} }
} }
</style> </style>

View File

@@ -3,41 +3,45 @@
<view class="today_inspection_page flex flex-col"> <view class="today_inspection_page flex flex-col">
<!-- 状态筛选标签 --> <!-- 状态筛选标签 -->
<TabsComponents :tabslist="tabslist" @update="handleTabs"></TabsComponents> <TabsComponents :tabslist="tabslist" @update="handleTabs"></TabsComponents>
<!-- body --> <!-- body -->
<view class="inspection_body flex-1"> <view class="inspection_body flex-1" v-if="list.length > 0">
<view <view
class="inspection_items" class="inspection_items"
v-for="(item, index) in list" v-for="(item, index) in list"
:key="index" :key="index"
@tap="gotoInspection(item)" @tap="handleTap(item)"
> >
<view class="title"> <view class="title">
<text class="subtitle"> <text class="subtitle">
<i></i> <i></i>
{{ item.address }} {{ item.taskName }}
</text> </text>
<text class="noactions" v-if="item.status === 0">未巡检</text> <text class="noactions" v-if="!isComputed(item.taskStatus)">未巡检</text>
<text class="noactions alaway_actions" v-else>已巡检</text> <text class="noactions alaway_actions" v-else>已巡检</text>
</view> </view>
<view class="inspection_item_box flex"> <view class="inspection_item_box flex">
<text class="inspection_item" v-for="(ite, index) in item.item" :key="index"> <text class="inspection_item" v-for="(ite, index) in item.itemslist" :key="index">
{{ ite }} {{ ite }}
</text> </text>
</view> </view>
<view class="inspection_time"> <view class="inspection_time">
<text>巡检时间:</text> <text>巡检时间:</text>
<text>{{ item.time }}</text> <text>{{ item.taskTime }}</text>
</view> </view>
<view class="inspection_time"> <view class="inspection_time flex items-center justify-between">
<text>巡检人:</text> <view class="">
<text>{{ item.user }}</text> <text>巡检人:</text>
<view class="actions" v-if="item.status === 0"> <text>{{ item.inspectorName }}</text>
</view>
<view class="actions" v-if="!isComputed(item.taskStatus)">
<text>去巡检</text> <text>去巡检</text>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="nodata" v-else>
<text>暂无数据</text>
</view>
</view> </view>
<!-- body --> <!-- body -->
</view> </view>
@@ -46,85 +50,104 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed } from 'vue' import { ref, computed } from 'vue'
import TabsComponents from '@/components/tabs/tabs.vue' import TabsComponents from '@/components/tabs/tabs.vue'
import { onShow } from '@dcloudio/uni-app'
import { getInspectionList } from '@/api/insepction.js'
import { parseTime } from '@/utils/time.js'
// tabs ========================================================= // tabs =========================================================
const activeValue = ref(0) const activeValue = ref(0)
const tabslist = ref([ const tabslist = ref([
{ {
name: '全部', name: '全部',
value: 0 value: 2
}, },
{ {
name: '未巡检', name: '未巡检',
value: 1 value: 0
}, },
{ {
name: '已巡检', name: '已巡检',
value: 2 value: 1
} }
]) ])
// 点击事件 // 点击事件
const handleTabs = (val: number) => { const handleTabs = (val: number) => {
activeValue.value = val activeValue.value = val
queryParmas.value.status = val
init()
} }
// tabs ========================================================= // tabs =========================================================
// body ========================================================= // body =========================================================
const isComputed = (status: string) => {
const awaitlist = ['未完成', '待执行', '执行中']
return !awaitlist.includes(status)
}
const list = ref([])
const queryParmas = ref({
date: '',
status: 2,
pageNum: 1,
pageSize: 10
})
const isLoading = ref(false) // 加载锁
const hasMore = ref(true) // 是否还有更多数据
const total = ref(0)
function getlist() {
if (isLoading.value || !hasMore.value) return
isLoading.value = true
uni.showLoading({
title: '加载中',
mask: true
})
const { pageNum, pageSize, date, status } = queryParmas.value
getInspectionList({
pageSize,
pageNum,
status,
date
})
.then(res => {
let items: Set<string> = new Set()
res.rows.forEach(item => {
if (!item.points || item.points.length <= 0) return
item.points.forEach(ite => {
ite.itemNames.forEach(it => items.add(it))
})
item.itemslist = Array.from(items)
})
list.value = res.rows
hasMore.value = list.value.length < res.total
total.value = res.total
})
.finally(() => {
isLoading.value = false
uni.hideLoading()
})
}
/** 跳转到巡检上传页面 */ /** 跳转到巡检上传页面 */
// 0未巡检 1已巡检 function handleTap(ite) {
const gotoInspection = row => { if (isComputed(ite.taskStatus)) {
if (row.status === 0) {
uni.navigateTo({ uni.navigateTo({
url: '/pageSubPack/inspection/inspection_upload' url: '/pageSubPack/inspection/inspection_main?id=' + ite.id
}) })
} else { } else {
uni.navigateTo({ uni.navigateTo({
url: '/pageSubPack/inspection/inspection_main' url: '/pageSubPack/inspection/inspection_upload?id=' + ite.id
}) })
} }
} }
// body =========================================================
const list = ref([ function init() {
{ hasMore.value = true
address: '幸福苑小区- B1层地下车库', queryParmas.value.date = parseTime(new Date(), '{y}-{m}-{d}')
time: '07:00:00 -09:00:00', getlist()
item: [ }
'防火设施安全巡检',
'防火设施安全巡检', onShow(() => {
'防火设施安全巡检', init()
'防火设施安全巡检', })
'防火设施安全巡检'
],
user: '李相龙',
status: 0 // 0未巡检 1已巡检
},
{
address: '幸福苑小区- B2层地下车库',
time: '13:00:00 -15:00:00',
item: ['设备巡检'],
user: '李相龙',
status: 1 // 0未巡检 1已巡检
},
{
address: '幸福苑小区- B2层地下车库',
time: '13:00:00 -15:00:00',
item: ['设备巡检'],
user: '李相龙',
status: 1 // 0未巡检 1已巡检
},
{
address: '幸福苑小区- B2层地下车库',
time: '13:00:00 -15:00:00',
item: ['设备巡检'],
user: '李相龙',
status: 1 // 0未巡检 1已巡检
},
{
address: '幸福苑小区- B2层地下车库',
time: '13:00:00 -15:00:00',
item: ['设备巡检'],
user: '李相龙',
status: 1 // 0未巡检 1已巡检
}
])
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@@ -252,13 +275,11 @@ const list = ref([
color: #333333; color: #333333;
line-height: 36rpx; line-height: 36rpx;
position: relative; position: relative;
overflow: hidden;
text-overflow: ellipsis;
} }
.actions { .actions {
position: absolute;
right: 0;
bottom: 0;
width: 140rpx; width: 140rpx;
height: 50rpx; height: 50rpx;
background: #4d5dfa; background: #4d5dfa;
@@ -272,5 +293,12 @@ const list = ref([
} }
} }
} }
.nodata {
color: #ccc;
text-align: center;
margin-top: 200rpx;
letter-spacing: 1rpx;
}
} }
</style> </style>

View File

@@ -2,7 +2,7 @@
<view class="page_container addreplacement_box"> <view class="page_container addreplacement_box">
<uni-forms border :modelValue="formData" label-position="left"> <uni-forms border :modelValue="formData" label-position="left">
<uni-forms-item label="仪表类型"> <uni-forms-item label="仪表类型">
<uni-data-checkbox v-model="formData.type" :localdata="items"></uni-data-checkbox> <uni-data-checkbox v-model="formData.deviceType" :localdata="items"></uni-data-checkbox>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="设备编号"> <uni-forms-item label="设备编号">
<view class="flex items-center justify-between"> <view class="flex items-center justify-between">
@@ -14,7 +14,13 @@
:clearable="true" :clearable="true"
> >
</uni-easyinput> </uni-easyinput>
<uni-icons @tap="handleScan" size="48rpx" type="scan" color="#737373"></uni-icons> <uni-icons
class="scanicons"
@tap="handleScan"
size="48rpx"
type="scan"
color="#737373"
></uni-icons>
</view> </view>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="房屋号"> <uni-forms-item label="房屋号">
@@ -42,19 +48,22 @@
<script setup> <script setup>
import { ref } from 'vue' import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { AddReplaceMainList } from '@/api/instrument.js'
const formData = ref({ const formData = ref({
type: 1, deviceType: 2,
deviceCode: '', deviceCode: '',
houseId: '' houseId: ''
}) })
// 水表,电表列表
const items = [ const items = [
{ {
text: '水表', text: '水表',
value: 1 value: 2
}, },
{ {
text: '电表', text: '电表',
value: 2 value: 1
} }
] ]
@@ -67,22 +76,57 @@ function handleClick() {
backData: data => { backData: data => {
houseName.value = data.HouseName houseName.value = data.HouseName
formData.value.houseId = data.Houseid formData.value.houseId = data.Houseid
console.log(data)
} }
} }
}) })
} }
/** 处理 扫码 */ /** 处理 扫码 */
function handleScan() { function handleScan() {
// 允许从相机和相册扫码
uni.scanCode({ uni.scanCode({
success: function (res) { success: function (res) {
formData.value.deviceCode = res.result formData.value.deviceCode = res.result
},
error: err => {
uni.showToast({
icon: 'error',
title: '扫描异常'
})
} }
}) })
} }
function handleSubmit() {} function handleSubmit() {
formData.value.deviceCode = formData.value.deviceCode.trim()
formData.value.houseId = formData.value.houseId.trim()
if (!formData.value.deviceCode.trim()) {
uni.showToast({
icon: 'exception',
title: '检查设备编号'
})
}
if (!formData.value.houseId.trim()) {
uni.showToast({
icon: 'exception',
title: '选择房屋'
})
}
AddReplaceMainList(formData.value)
.then(() => {
uni.showToast({
icon: 'success',
title: '操作成功',
success() {
uni.navigateBack()
}
})
})
.catch(err => {
uni.showToast({
icon: 'error',
title: '检查编号'
})
})
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -116,5 +160,9 @@ function handleSubmit() {}
color: #ffffff; color: #ffffff;
line-height: 80rpx; line-height: 80rpx;
} }
.scanicons {
margin-left: 20rpx;
}
} }
</style> </style>

View File

@@ -4,23 +4,25 @@
<view <view
@click="handleClick" @click="handleClick"
class="search_view flex-center" class="search_view flex-center"
v-if="!queryParmas.keyword.trim() && Searching" v-if="!queryParmas.searchValue.trim() && Searching"
> >
<uni-icons type="search" size="34rpx" color="rgba(0,0,0,0.26)"></uni-icons> <uni-icons type="search" size="34rpx" color="rgba(0,0,0,0.26)"></uni-icons>
<text>请输入关键字进行搜索</text> <text>请输入关键字进行搜索</text>
</view> </view>
<uni-easyinput <uni-easyinput
@blur="handleInput" @blur="handleInput"
@change="handleSearch" @clear="handleInput"
@confirm="handleSearch"
@input="handleInputString"
:focus="true" :focus="true"
ref="inputRef" ref="inputRef"
v-model="queryParmas.keyword" v-model="queryParmas.searchValue"
v-else v-else
/> />
</view> </view>
<view class="search_list flex-1 flex"> <view class="search_list flex-1 flex">
<scroll-view lower-threshold="160" scroll-y="true" @scrolltolower="scrolltolower"> <scroll-view lower-threshold="160" scroll-y="true" @scrolltolower="scrolltolower">
<radio-group @change="radioChange"> <radio-group @change="radioChange" v-if="searchlist.length > 0">
<label v-for="(item, index) in searchlist" :key="index"> <label v-for="(item, index) in searchlist" :key="index">
<view <view
class="search_item flex flex-between" class="search_item flex flex-between"
@@ -39,6 +41,9 @@
</view> </view>
</label> </label>
</radio-group> </radio-group>
<view class="noData" v-else>
<text>暂无数据</text>
</view>
</scroll-view> </scroll-view>
</view> </view>
@@ -54,18 +59,31 @@ import { getVillageHouseList_keyword } from '@/api/common.js'
const Searching = ref(true) const Searching = ref(true)
const queryParmas = ref({ const queryParmas = ref({
keyword: '', searchValue: '',
pageNum: 1, pageNum: 1,
pageSize: 10 pageSize: 10
}) })
/** 点击时切换到input,并聚焦 */ /** 点击时切换到input,并聚焦 */
function handleClick() { function handleClick() {
Searching.value = false Searching.value = false
queryParmas.value.searchValue = ''
} }
/** 判断 失去焦点时 切换回 view */ /** 判断 失去焦点时 切换回 view */
function handleInput() { function handleInput() {
if (queryParmas.value.keyword.trim()) { const value = queryParmas.value.searchValue.trim()
if (value) {
handleSearch()
} else if (value === '') {
queryParmas.value.searchValue = ''
Searching.value = true Searching.value = true
handleSearch()
}
}
function handleInputString() {
if (queryParmas.value.searchValue.trim() === '') {
queryParmas.value.searchValue = ''
Searching.value = true
handleSearch()
} }
} }
@@ -102,13 +120,20 @@ function getlist() {
title: '加载中', title: '加载中',
mask: true mask: true
}) })
getVillageHouseList_keyword(queryParmas.value, queryParmas.value.keyword) getVillageHouseList_keyword(queryParmas.value, queryParmas.value.searchValue)
.then(res => { .then(res => {
// 追加数据(正确方式) // 追加数据(正确方式)
searchlist.value = [...searchlist.value, ...res.rows] searchlist.value = [...searchlist.value, ...res.rows]
total.value = res.total
// 判断是否还有更多 // 判断是否还有更多
hasMore.value = searchlist.value.length < total.value hasMore.value = searchlist.value.length < total.value
}) })
.catch(() => {
uni.showToast({
icon: 'error',
title: '网络异常'
})
})
.finally(() => { .finally(() => {
isLoading.value = false isLoading.value = false
uni.hideLoading() uni.hideLoading()
@@ -126,6 +151,7 @@ function resetList() {
// Search // Search
function handleSearch() { function handleSearch() {
hasMore.value = true
queryParmas.value.pageNum = 1 queryParmas.value.pageNum = 1
queryParmas.value.pageSize = 10 queryParmas.value.pageSize = 10
searchlist.value = [] searchlist.value = []
@@ -211,6 +237,13 @@ function handleSelecthouse() {
} }
} }
} }
.noData {
text-align: center;
color: rgba(0, 0, 0, 0.26);
font-size: larger;
padding-top: 50rpx;
letter-spacing: 10rpx;
}
.action_btn { .action_btn {
width: 670rpx; width: 670rpx;

View File

@@ -17,16 +17,16 @@
<image lazy-load src="/static/imgs/home.png" class="icon" mode=""></image> <image lazy-load src="/static/imgs/home.png" class="icon" mode=""></image>
<view class="instrument_info"> <view class="instrument_info">
<view class="instrument_title"> <view class="instrument_title">
<text>{{ item.title }}</text> <text>{{ item.addressCn }}</text>
</view> </view>
<view class="instrument_time"> <view class="instrument_time">
<text>换新时间时间:{{ item.time }}</text> <text>换新时间时间:{{ item.createTime }}</text>
</view> </view>
</view> </view>
</view> </view>
<view class="instrument_type"> <view class="instrument_type">
<text v-if="item.type === 2">电表</text> <text v-if="item.deviceType === '1'">电表</text>
<text v-else>水表</text> <text v-else-if="item.deviceType === '2'">水表</text>
</view> </view>
</view> </view>
<!-- 底部加载状态提示 --> <!-- 底部加载状态提示 -->
@@ -42,7 +42,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, nextTick, ref } from 'vue' import { computed, nextTick, ref } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import TabsComponents from '@/components/tabs/tabs.vue' import TabsComponents from '@/components/tabs/tabs.vue'
import { getReplaceMainList } from '@/api/instrument.js'
/** 加载状态 */ /** 加载状态 */
const statusmore = computed(() => { const statusmore = computed(() => {
if (isLoading.value === true) { if (isLoading.value === true) {
@@ -65,25 +68,35 @@ const tabslist = [
}, },
{ {
name: '水表', name: '水表',
value: 1 value: 2
}, },
{ {
name: '电表', name: '电表',
value: 2 value: 1
} }
] ]
// 切换tabs
function handleChangeTabs(val: number) { function handleChangeTabs(val: number) {
queryParmas.value.deviceType = val
if (val === 0) {
queryParmas.value.deviceType = undefined
}
queryParmas.value.pageNum = 1 queryParmas.value.pageNum = 1
infolist.value = [] infolist.value = []
hasMore.value = true
getlist() getlist()
} }
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
const infolist = ref([]) const infolist = ref([])
const queryParmas = ref({ const queryParmas = ref({
pageNum: 1, pageNum: 1,
pageSize: 10 pageSize: 10,
deviceType: undefined
}) })
const total = ref(21) // 总数
const total = ref(0)
// 上滑加载
function scrolltolower() { function scrolltolower() {
// 必须加这两个判断! // 必须加这两个判断!
if (isLoading.value || !hasMore.value) { if (isLoading.value || !hasMore.value) {
@@ -92,6 +105,7 @@ function scrolltolower() {
queryParmas.value.pageNum += 1 queryParmas.value.pageNum += 1
getlist() getlist()
} }
function getlist() { function getlist() {
// 1. 如果正在加载或没有更多数据,直接返回 // 1. 如果正在加载或没有更多数据,直接返回
if (isLoading.value || !hasMore.value) return if (isLoading.value || !hasMore.value) return
@@ -101,29 +115,29 @@ function getlist() {
title: '加载中', title: '加载中',
mask: true mask: true
}) })
const { pageNum, pageSize } = queryParmas.value const { pageNum, pageSize, deviceType } = queryParmas.value
getReplaceMainList({
const startId = (pageNum - 1) * pageSize + 1 pageNum,
const arr = Array.from({ length: pageSize }).map((_, index) => { pageSize,
const realId = startId + index // ✅ 修复 ID 错误 deviceType
// ✅ 随机生成 0、1、2
const randomStatus = Math.floor(Math.random() * 2)
return {
title: 'M2栋3单元18' + realId + '室(M2-3-1801)',
time: '2023-08-01 10:05:46',
type: randomStatus //1水表 2电表
}
}) })
.then(res => {
// 追加数据(正确方式) infolist.value = [...infolist.value, ...res.rows]
infolist.value = [...infolist.value, ...arr] total.value = res.total
// 判断是否还有更多 hasMore.value = infolist.value.length < total.value
hasMore.value = infolist.value.length < total.value })
isLoading.value = false .finally(() => {
uni.hideLoading() isLoading.value = false
uni.hideLoading()
})
} }
getlist() onShow(() => {
infolist.value = []
hasMore.value = true
getlist()
})
// 重置
function resetList() { function resetList() {
infolist.value = [] infolist.value = []
queryParmas.value.pageNum = 1 queryParmas.value.pageNum = 1
@@ -131,6 +145,7 @@ function resetList() {
getlist() getlist()
} }
// 跳转到 仪表换新
function handleClick() { function handleClick() {
uni.navigateTo({ uni.navigateTo({
url: '/pageSubPack/instrument/addreplacement' url: '/pageSubPack/instrument/addreplacement'

View File

@@ -38,27 +38,29 @@
<!-- 记录卡片 --> <!-- 记录卡片 -->
<view <view
v-for="(record, index) in reportRecords" v-for="(record, index) in reportRecords"
@tap="handleComplted(record.id)" @tap="handleComplted(record)"
:key="index" :key="index"
class="record-card" class="record-card"
> >
<!-- 标题 + 状态标签 --> <!-- 标题 + 状态标签 -->
<view class="card-header"> <view class="card-header">
<text class="card-title">{{ record.title }}</text> <text class="card-title">{{ record.item }}</text>
<view class="status-tag" :class="record.status"> <view class="status-tag pending" v-if="record.problemStatus === '0'"> 待分配 </view>
{{ getStatusText(record.status) }} <view class="status-tag processing" v-if="record.problemStatus === '1'"> 待解决 </view>
</view> <view class="status-tag completed" v-if="record.problemStatus === '2'"> 已完成 </view>
</view> </view>
<!-- 类型标签 --> <!-- 类型标签 -->
<view class="tag-group"> <view class="tag-group" v-if="record.projectTypeStr || record.maintenanceItemName">
<view class="tag-item">{{ record.reportType }}</view> <view class="tag-item" v-if="record.projectTypeStr">{{ record.projectTypeStr }}</view>
<view class="tag-item">{{ record.category }}</view> <view class="tag-item" v-if="record.maintenanceItemName">{{
record.maintenanceItemName
}}</view>
</view> </view>
<!-- 内容 --> <!-- 内容 -->
<view class="card-content"> <view class="card-content">
{{ record.content }} {{ record.problem }}
</view> </view>
<!-- 工单图片 --> <!-- 工单图片 -->
<!-- <view class="card-image"> <!-- <view class="card-image">
@@ -75,10 +77,10 @@
<!-- 底部信息 --> <!-- 底部信息 -->
<view class="card-footer"> <view class="card-footer">
<text class="create-time">{{ record.createTime }}</text> <text class="create-time">{{ record.createTime }}</text>
<text v-if="record.repairStatus === 2" class="repairman" <text v-if="record.problemStatus === '1'" class="repairman"
>维修师傅:{{ record.repairman }}</text >维修师傅:{{ record.repairName }}</text
> >
<view class="share" v-if="record.repairStatus === 1"> <view class="share" v-if="record.problemStatus === '0'">
<text>维修完成</text> <text>维修完成</text>
</view> </view>
</view> </view>
@@ -90,63 +92,41 @@
<script setup> <script setup>
import { ref, computed } from 'vue' import { ref, computed } from 'vue'
import { onReady } from '@dcloudio/uni-app' import { onReady, onShow } from '@dcloudio/uni-app'
import TabsComponents from '@/components/tabs/tabs.vue' import TabsComponents from '@/components/tabs/tabs.vue'
import NavBar from '@/components/navbar/navbar.vue' import NavBar from '@/components/navbar/navbar.vue'
import { getUserTicketlist } from '@/api/ticket.js'
// 导航栏/标签高度(适配不同设备)
const navHeight = ref(44)
const statusTabHeight = ref(88)
const typeTabHeight = ref(88)
// 筛选状态 // 筛选状态
const activeStatus = ref('all') // 全部/待分配/待解决/已完成 const activeStatus = ref(0) // 全部/待分配/待解决/已完成
const activeType = ref('all') // 全部/公共报修/个人报修 const activeType = ref(-1) // 全部/公共报修/个人报修
// 状态筛选选项 // 状态筛选选项
const statusTabs = ref([ const statusTabs = ref([
{ label: '全部', value: 'all' }, { label: '全部', value: 0 },
{ label: '待解决', value: 'processing' }, { label: '待解决', value: 1 },
{ label: '已完成', value: 'completed' } { label: '已完成', value: 2 }
]) ])
// 类型筛选选项 // 类型筛选选项
const typeTabs = ref([ const typeTabs = ref([
{ label: '全部', value: 'all' }, { label: '全部', value: -1 },
{ label: '公共报修', value: 'public' }, { label: '公共报修', value: 0 },
{ label: '个人报修', value: 'private' } { label: '个人报修', value: 1 }
]) ])
// 模拟上报记录数据(实际项目替换为接口请求) // 模拟上报记录数据(实际项目替换为接口请求)
const reportRecords = ref([ const reportRecords = ref([])
{
id: 1,
title: '标题巴拉巴拉巴拉',
status: 'processing', // pending/processing/completed
reportType: '公共报修',
category: '路灯',
content: '1栋楼下道路路灯不亮,并且有的亮度不够,请物业公司及时更换,防止发生意外事故。',
createTime: '2026-08-01 10:05:46',
repairman: '张胜',
images: [
'https://picsum.photos/93',
'https://picsum.photos/93',
'https://picsum.photos/93',
'https://picsum.photos/93',
'https://picsum.photos/93'
],
repairStatus: 1 // 1待解决 2已完成
}
])
const queryParmas = ref({ const queryParmas = ref({
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
value: '' itemType: undefined,
problemStatus: undefined
}) })
const isLoading = ref(false) // 加载锁 const isLoading = ref(false) // 加载锁
const hasMore = ref(true) // 是否还有更多数据 const hasMore = ref(true) // 是否还有更多数据
const total = ref(21) const total = ref(0)
function scrolltolower() { function scrolltolower() {
// 必须加这两个判断! // 必须加这两个判断!
if (isLoading.value || !hasMore.value) { if (isLoading.value || !hasMore.value) {
@@ -164,39 +144,20 @@ function getlist() {
title: '加载中', title: '加载中',
mask: true mask: true
}) })
const { pageNum, pageSize } = queryParmas.value getUserTicketlist(queryParmas.value)
.then(res => {
const startId = (pageNum - 1) * pageSize + 1 reportRecords.value = [...reportRecords.value, ...res.rows]
const arr = Array.from({ length: pageSize }).map((_, index) => { hasMore.value = reportRecords.value.length < total.value
const realId = startId + index total.value = res.total
const randomStatus = Math.floor(Math.random() * 2) })
return { .finally(() => {
id: realId, isLoading.value = false
title: '标题巴拉巴拉巴拉', uni.hideLoading()
status: 'processing', // pending/processing/completed })
reportType: '公共报修',
category: '路灯',
content: '1栋楼下道路路灯不亮,并且有的亮度不够,请物业公司及时更换,防止发生意外事故。',
createTime: '2026-08-01 10:05:46',
repairman: '',
images: [
'https://picsum.photos/93',
'https://picsum.photos/93',
'https://picsum.photos/93',
'https://picsum.photos/93',
'https://picsum.photos/93'
],
repairStatus: randomStatus // 1待解决 2已完成
}
})
// 追加数据(正确方式)
reportRecords.value = [...reportRecords.value, ...arr]
// 判断是否还有更多
hasMore.value = reportRecords.value.length < total.value
isLoading.value = false
uni.hideLoading()
} }
getlist() onShow(() => {
getlist()
})
function resetList() { function resetList() {
reportRecords.value = [] reportRecords.value = []
queryParmas.value.pageNum = 1 queryParmas.value.pageNum = 1
@@ -207,20 +168,29 @@ function resetList() {
// 切换状态(全部/待分配/待解决/已完成)筛选 // 切换状态(全部/待分配/待解决/已完成)筛选
const switchStatus = value => { const switchStatus = value => {
activeStatus.value = value activeStatus.value = value
if (value === 0) {
queryParmas.value.problemStatus = undefined
} else {
queryParmas.value.problemStatus = value
}
hasMore.value = true
reportRecords.value = []
queryParmas.value.pageNum = 1
getlist()
} }
// 切换类型(公共/个人)筛选 // 切换类型(公共/个人)筛选
const switchType = value => { const switchType = value => {
activeType.value = value activeType.value = value
} if (value === -1) {
queryParmas.value.itemType = undefined
// 获取状态文本 } else {
const statusMap = { queryParmas.value.itemType = value
processing: '待解决', }
completed: '已完成' hasMore.value = true
} reportRecords.value = []
const getStatusText = status => { queryParmas.value.pageNum = 1
return statusMap[status] || '' getlist()
} }
// 返回上一页 // 返回上一页
@@ -228,17 +198,16 @@ const navBack = () => {
uni.navigateBack() uni.navigateBack()
} }
// 1待解决 2已完成 // 1待解决 2已完成
function handleComplted(id) { function handleComplted(row) {
const find = reportRecords.value.find(item => item.id === id) if (row) {
if (find) { const status = row.repairStatus
const status = find.repairStatus
if (status === 2) { if (status === 2) {
uni.navigateTo({ uni.navigateTo({
url: `/pageSubPack/ticket/repairMain?id=${id}&showbtn=${false}&path=myticket` url: `/pageSubPack/ticket/repairMain?id=${row.id}&showbtn=${false}&path=myticket`
}) })
} else { } else {
uni.navigateTo({ uni.navigateTo({
url: `/pageSubPack/ticket/repairMain?id=${id}&showbtn=${true}&path=myticket` url: `/pageSubPack/ticket/repairMain?id=${row.id}&showbtn=${true}&path=myticket`
}) })
} }
} }

View File

@@ -6,7 +6,11 @@
<text>问题描述</text> <text>问题描述</text>
</view> </view>
<view class="descrition"> <view class="descrition">
<textarea value="" placeholder-style="color:#e8e8e8;" placeholder="请描述您的问题" /> <textarea
v-model="form.descrition"
placeholder-style="color:#e8e8e8;"
placeholder="请描述您的问题"
/>
</view> </view>
</view> </view>
<view class="item"> <view class="item">
@@ -14,11 +18,17 @@
<text>问题照片</text> <text>问题照片</text>
</view> </view>
<view class=""> <view class="">
<uni-file-picker v-model="form.images" file-mediatype="image"> <!-- <uni-file-picker v-model="form.images" file-mediatype="image">
<view class="addimages images flex flex-center"> <view class="addimages images flex flex-center">
<uni-icons type="plusempty" color="#a6a6a6" size="27"></uni-icons> <uni-icons type="plusempty" color="#a6a6a6" size="27"></uni-icons>
</view> </view>
</uni-file-picker> </uni-file-picker> -->
<filePicker
v-model="form.images"
:sourceType="['camera']"
file-field-name="file"
uploadUrl="/resource/oss/upload"
></filePicker>
</view> </view>
</view> </view>
<view class="action_btn" @tap="handleSelecthouse"> <view class="action_btn" @tap="handleSelecthouse">
@@ -30,35 +40,39 @@
<script setup> <script setup>
import { ref } from 'vue' import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import filePicker from '@/components/filePicker/filePicker.vue'
import { ticketComputed } from '@/api/ticket.js'
const form = ref({ const form = ref({
id: '',
descrition: '', descrition: '',
images: [ images: []
{
name: 'file1.png',
extname: 'png',
url: 'https://picsum.photos/80'
},
{
name: 'file2.png',
extname: 'png',
url: 'https://picsum.photos/80'
},
{
name: 'file3.png',
extname: 'png',
url: 'https://picsum.photos/80'
},
{
name: 'file4.png',
extname: 'png',
url: 'https://picsum.photos/80'
}
]
}) })
onLoad(options => {
form.value.id = options.id
})
/** 返回上一页 */ /** 返回上一页 */
function handleSelecthouse() { function handleSelecthouse() {
console.log('compltee') const obj = {
uni.navigateBack() id: form.value.id,
repairDes: form.value.descrition,
repairImageUrl: ''
}
if (form.value.images.length > 0) {
obj.repairImageUrl = form.value.images.join(',')
}
ticketComputed(obj)
.then(() => {
uni.navigateBack()
})
.catch(() => {
uni.showToast({
icon: 'error',
title: '网络错误'
})
})
} }
</script> </script>

View File

@@ -16,12 +16,15 @@
</view> </view>
<view class="flex justify-between"> <view class="flex justify-between">
<span class="subtitle">{{ data.desc }}</span> <span class="subtitle">{{ data.desc }}</span>
<span class="subtime" v-if="currentStep > index">2026/08/01 10:30:35</span> <span class="subtime" v-if="currentStep == index + 1">{{
repairInfo.updateTime
}}</span>
</view> </view>
</view> </view>
</template> </template>
</Stops> </Stops>
</view> </view>
<view class="info"> <view class="info">
<view class="info_title"> <view class="info_title">
<text>保修信息</text> <text>保修信息</text>
@@ -36,19 +39,19 @@
<view class="item"> <view class="item">
<view class="label"> <text>维修项目</text> </view> <view class="label"> <text>维修项目</text> </view>
<view class="value"> <view class="value">
<text>{{ repairInfo.repairProject }} </text> <text>{{ repairInfo.maintenanceItemName }} </text>
</view> </view>
</view> </view>
<view class="item"> <view class="item">
<view class="label"> <text>标题</text> </view> <view class="label"> <text>标题</text> </view>
<view class="value"> <view class="value">
<text> {{ repairInfo.title }}</text> <text> {{ repairInfo.item }}</text>
</view> </view>
</view> </view>
<view class="item descrition"> <view class="item descrition">
<view class="label"> <text>问题描述</text> </view> <view class="label"> <text>问题描述</text> </view>
<view class="value"> <view class="value">
<text>{{ repairInfo.descrtion }}</text> <text>{{ repairInfo.problem }}</text>
</view> </view>
</view> </view>
<view class="item"> <view class="item">
@@ -60,14 +63,14 @@
<view class="item"> <view class="item">
<view class="label"> <text>报修时间</text> </view> <view class="label"> <text>报修时间</text> </view>
<view class="value"> <view class="value">
<text> {{ repairInfo.time }} </text> <text> {{ repairInfo.createTime }} </text>
</view> </view>
</view> </view>
<view class="item photobox"> <view class="item photobox">
<view class="label"> <text>问题照片</text> </view> <view class="label"> <text>问题照片</text> </view>
<view class="value"> <view class="value" v-if="problemImageUrl.length > 0">
<image <image
v-for="(item, index) in repairInfo.photo" v-for="(item, index) in problemImageUrl"
:key="index" :key="index"
class="images" class="images"
:src="item" :src="item"
@@ -78,41 +81,47 @@
</view> </view>
</view> </view>
<view class="info" v-if="(currentStep >= 2 && prevPath === 'hall') || currentStep > 2"> <view
class="info"
v-if="
(currentStep >= 2 && prevPath === 'hall') || (currentStep >= 2 && prevPath === 'myticket')
"
>
<view class="info_title"> <view class="info_title">
<text>维修信息</text> <text>维修信息</text>
</view> </view>
<view class="info_body"> <view class="info_body">
<view class="item"> <view class="item">
<view class="label"> <text>姓名</text> </view> <view class="label"> <text>姓名</text> </view>
<view class="value"> {{ repairInfo.repairUser.name }} </view> <view class="value"> {{ repairInfo.repairName }} </view>
</view> </view>
<view class="item"> <view class="item">
<view class="label"> <text>状态</text> </view> <view class="label"> <text>状态</text> </view>
<view class="value"> {{ repairInfo.repairUser.status }} </view> <view class="value"> {{ repairInfo.repairStatus === 0 ? '正常' : '异常' }} </view>
</view> </view>
<view class="item"> <view class="item">
<view class="label"> <text>角色</text> </view> <view class="label"> <text>角色</text> </view>
<view class="value"> {{ repairInfo.repairUser.role }} </view> <view class="value"> {{ repairInfo.repairRoleName }} </view>
</view> </view>
<view class="item"> <view class="item">
<view class="label"> <text>手机号</text> </view> <view class="label"> <text>手机号</text> </view>
<view class="value"> {{ repairInfo.repairUser.phone }} </view> <view class="value"> {{ repairInfo.repairPhone }} </view>
</view> </view>
<view class="" v-if="currentStep >= 3"> <view class="" v-if="currentStep >= 3">
<view class="item descrition flex-col"> <view class="item descrition flex-col">
<view class="label"> <text>问题描述</text> </view> <view class="label"> <text>问题描述</text> </view>
<view class="value"> {{ repairInfo.repairUser.descrtion }} </view> <view class="value" v-if="repairInfo.repairDes && repairInfo.repairDes.trim()">
{{ repairInfo.repairDes }}
</view>
</view> </view>
<view class="item photobox"> <view class="item photobox">
<view class="label"> <text>问题照片</text> </view> <view class="label"> <text>问题照片</text> </view>
<view class="value"> <view class="value" v-if="repairImageUrl.length > 0">
<image <image
v-for="(item, index) in repairInfo.repairUser.photo" v-for="(item, index) in repairImageUrl"
:key="index" :key="index"
class="images" class="images"
:src="item" :src="item"
mode=""
></image> ></image>
</view> </view>
</view> </view>
@@ -131,78 +140,120 @@
<script setup> <script setup>
import { ref } from 'vue' import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app' import { onLoad, onShow } from '@dcloudio/uni-app'
import Stops from '@/components/stops/stops.vue' import Stops from '@/components/stops/stops.vue'
import { getTicketMainById } from '@/api/ticket.js'
// -------------------------------------- // --------------------------------------
/** 维修步骤:0提交 1分配 2维修完成 / 待解决 3记录完成 完成*/ /** 维修步骤:0提交 1分配 2维修完成 / 待解决 3记录完成 完成*/
const currentStep = ref(2) const currentStep = ref(2)
// 步骤数据 // 步骤数据
const stepList = ref([ const stepList = ref([
{ title: '提交维修信息', desc: '提交报修成功', time: '2026/08/01 10:30:26' }, { title: '提交维修信息', desc: '等待提交报修' },
{ title: '待分配', desc: '等待物业派单中', time: '2026/08/01 10:32:21' }, { title: '待分配', desc: '等待物业派单中' },
{ title: '维修/待解决', desc: '维修人员进行维修', time: '2026/08/01 10:38:07' }, { title: '待解决', desc: '等待维修人员' },
{ title: '维修完成', desc: '填写维修记录', time: '2026/08/01 10:40:33' } { title: '维修完成', desc: '填写维修记录' }
]) ])
// -------------------------------------- // --------------------------------------
const queryParams = ref({ const queryParams = ref({
id: null id: null
}) })
// 展示 button
const Showbtn = ref(false) const Showbtn = ref(false)
// 上一个页面地址
const prevPath = ref('') const prevPath = ref('')
// 工单信息
const repairInfo = ref({ const repairInfo = ref({
houseName: '桂花园(别墅)2号楼2层', createTime: null,
repairProject: '照明-路灯', houseId: null,
title: '1栋楼下道路灯不亮了', houseName: '',
descrtion: '1栋楼下道路路灯不亮,并且有的亮度不够,请物业公司及时更换,防止发生意外事故。', id: '',
phone: '15688888888', isCheckStr: null,
time: '2023-08-01 15:30', item: '',
photo: [ maintenanceItemId: '',
'https://picsum.photos/80', maintenanceItemName: '',
'https://picsum.photos/80', manageIsCheck: '',
'https://picsum.photos/80', orderDate: '',
'https://picsum.photos/80' phone: '',
], problem: '',
problemImageUrl: '',
repairUser: { problemStatus: '1',
name: '盘下但', projectType: null,
status: '正常', projectTypeStr: '',
role: '维修人员', repairDes: '',
phone: '15688888888', repairId: '',
descrtion: '1栋楼下道路路灯不亮,并且有的亮度不够,请物业公司及时更换,防止发生意外事故。', repairImageUrl: '',
photo: [ repairIsCheck: '',
'https://picsum.photos/80', repairName: '',
'https://picsum.photos/80', residentId: '',
'https://picsum.photos/80', residentName: '',
'https://picsum.photos/80' updateTime: ''
]
}
}) })
// 报修图片
const problemImageUrl = ref([])
// 维修图片
const repairImageUrl = ref([])
onLoad(options => { onLoad(options => {
queryParams.value.id = options.id queryParams.value.id = options.id
Showbtn.value = JSON.parse(options.showbtn) Showbtn.value = JSON.parse(options.showbtn)
prevPath.value = options.path prevPath.value = options.path
}) })
onShow(() => {
getTicketById()
})
function getTicketById() {
getTicketMainById(queryParams.value.id)
.then(res => {
repairInfo.value = res.data
problemImageUrl.value = repairInfo.value.problemImageUrl
? repairInfo.value.problemImageUrl.split(',').filter(item => item)
: []
repairImageUrl.value = repairInfo.value.repairImageUrl
? repairInfo.value.repairImageUrl.split(',').filter(item => item)
: []
handleStop(res.data)
})
.catch(err => {
console.log(err)
})
}
// -------------------------------------- // --------------------------------------
function handleStop(row) {
// 0 已提交 1 已分配 2已解决
let status = row.problemStatus
// 维修步骤:0提交 1分配 2维修完成 / 待解决 3记录完成 完成
if (status === '0') {
currentStep.value = 1
stepList.value[0].desc = '提交报修成功'
} else if (status === '1') {
currentStep.value = 2
stepList.value[1].title = '已派单'
stepList.value[1].desc = '物业已派单'
stepList.value[2].title = '待解决'
stepList.value[2].desc = `维修人员(${row.repairName})维修中`
} else if (status === '2') {
currentStep.value = 4
stepList.value[2].title = '已解决'
stepList.value[2].desc = `维修人员(${row.repairName})已解决`
} else {
currentStep.value = 0
}
}
/** 选择维修人员 */ /** 选择维修人员 */
function handleSelecthouse() { function handleSelecthouse() {
uni.navigateTo({ uni.navigateTo({
url: '/pageSubPack/ticket/shareUser', url: '/pageSubPack/ticket/shareUser'
events: {
backData: val => {
currentStep.value += 1
//api;
}
}
}) })
} }
/** 跳转到维修完成 */ /** 跳转到维修完成 */
function handleRepairCompluted() { function handleRepairCompluted() {
uni.navigateTo({ uni.navigateTo({
url: '/pageSubPack/ticket/repairCompleted' url: '/pageSubPack/ticket/repairCompleted?id=' + repairInfo.value.id
}) })
} }
</script> </script>
@@ -241,12 +292,12 @@ function handleRepairCompluted() {
} }
.subtitle { .subtitle {
font-weight: 400; font-weight: 400;
font-size: 24rpx; font-size: 22rpx;
line-height: 40rpx; line-height: 40rpx;
} }
.subtime { .subtime {
font-weight: 400; font-weight: 400;
font-size: 24rpx; font-size: 22rpx;
color: #999999; color: #999999;
line-height: 40rpx; line-height: 40rpx;
} }
@@ -317,7 +368,7 @@ function handleRepairCompluted() {
font-size: 28rpx; font-size: 28rpx;
color: #222222; color: #222222;
line-height: 36rpx; line-height: 36rpx;
width: 45%; width: 35%;
} }
.value { .value {
flex: 1; flex: 1;

View File

@@ -71,8 +71,8 @@
"path": "notice-list", "path": "notice-list",
"style": { "style": {
"navigationBarTitleText": "通知公告", "navigationBarTitleText": "通知公告",
"enablePullDownRefresh": true, "enablePullDownRefresh": true,
"onReachBottomDistance": 100 "onReachBottomDistance": 100
} }
} }
] ]

View File

@@ -124,6 +124,7 @@ import { ref } from 'vue'
import { onLoad, onUnload } from '@dcloudio/uni-app' import { onLoad, onUnload } from '@dcloudio/uni-app'
import { getCurrentVillage,getTodayInspection,getNewNoticeData,getBannarList} from '../../api/api.js' import { getCurrentVillage,getTodayInspection,getNewNoticeData,getBannarList} from '../../api/api.js'
// 列表数据状态 // 列表数据状态
const current = ref(0) const current = ref(0)
const currentCommunity = ref('请选择小区') const currentCommunity = ref('请选择小区')
@@ -134,17 +135,16 @@ const pendingCount = ref(0) //待巡检
const InspectedCount = ref(0) //已巡检 const InspectedCount = ref(0) //已巡检
const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight || 0) const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight || 0)
// =======方法======= // =======方法=======
// 跳转小区 // 跳转小区
const navigateToPage = () => { const navigateToPage = () => {
const curVillageId = uni.getStorageSync('currentVillage') const curVillageId = uni.getStorageSync('currentVillage')
let villageId = '' let villageId = ''
if(curVillageId){ if (curVillageId) {
try{ try {
villageId = JSON.parse(curVillageId).villageId || JSON.parse(curVillageId).id || '' villageId = JSON.parse(curVillageId).villageId || JSON.parse(curVillageId).id || ''
}catch(e){} } catch (e) {}
} }
uni.navigateTo({ uni.navigateTo({
url: `/pageSubPack/notice-list/select-community?villageId=${villageId}` url: `/pageSubPack/notice-list/select-community?villageId=${villageId}`
}) })
@@ -199,14 +199,16 @@ const goToReport = () => {
} }
// 获取当前小区 // 获取当前小区
const currentVillageData = () => { const currentVillageData = () => {
getCurrentVillage().then(res => { getCurrentVillage()
const data = res.data .then(res => {
if (data) { const data = res.data
currentCommunity.value = data.villageName if (data) {
uni.setStorageSync('currentVillage', JSON.stringify(data)) currentCommunity.value = data.villageName
getNoticeData() uni.setStorageSync('currentVillage', JSON.stringify(data))
} getNoticeData()
}).catch(() => {}) }
})
.catch(() => {})
} }
// 获取今日巡检数据 // 获取今日巡检数据
const getInspectionData = () =>{ const getInspectionData = () =>{
@@ -217,24 +219,28 @@ const getInspectionData = () =>{
pendingCount.value = res.data.unfinishedTasks pendingCount.value = res.data.unfinishedTasks
InspectedCount.value = res.data.completedTasks InspectedCount.value = res.data.completedTasks
}else{ }else{
allCount.value = 0 allCount.value = 0
pendingCount.value = 0 pendingCount.value = 0
InspectedCount.value = 0 InspectedCount.value = 0
} }
}else{
uni.showToast({ title: res.msg || '获取失败', icon: 'none' })
} }
}).catch(err =>{ }).catch(err => {
uni.showToast({title:err.msg || '获取失败',icon:'none'}) uni.showToast({ title: err.msg || '获取失败', icon: 'none' })
}) })
} }
// 获取消息通知 // 获取消息通知
const getNoticeData = () => { const getNoticeData = () => {
getNewNoticeData().then(res => { getNewNoticeData()
if (res.code === 200 && res.data) { .then(res => {
noticeText.value = res.data.notice || '' if (res.code === 200 && res.data) {
}else{ noticeText.value = res.data.notice || ''
noticeText.value = '暂无公告' } else {
} noticeText.value = '暂无公告'
}).catch(() => {}) }
})
.catch(() => {})
} }
// 获取bannar图 // 获取bannar图
function getbannarData(){ function getbannarData(){
@@ -380,7 +386,6 @@ const clickItem = index => {
} }
.inspectionClass { .inspectionClass {
// margin-top: 20rpx;
background: linear-gradient(to right, #7b87fa, #4d5dfa); background: linear-gradient(to right, #7b87fa, #4d5dfa);
border-radius: 16rpx; border-radius: 16rpx;
box-sizing: border-box; box-sizing: border-box;
@@ -406,10 +411,10 @@ const clickItem = index => {
margin-right: 16rpx; margin-right: 16rpx;
.notice-icon { .notice-icon {
width: 48rpx; width: 48rpx;
height: 48rpx; height: 48rpx;
margin-right: 15rpx; margin-right: 15rpx;
} }
.notice-line { .notice-line {
width: 1rpx; width: 1rpx;

View File

@@ -0,0 +1,46 @@
/**
* 日期格式化
*/
export function parseTime(time, pattern) {
if (arguments.length === 0 || !time) {
return null;
}
const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}';
let date;
if (typeof time === 'object') {
date = time;
} else {
if (typeof time === 'string' && /^[0-9]+$/.test(time)) {
time = parseInt(time);
} else if (typeof time === 'string') {
time = time
.replace(new RegExp(/-/gm), '/')
.replace('T', ' ')
.replace(new RegExp(/\.[\d]{3}/gm), '');
}
if (typeof time === 'number' && time.toString().length === 10) {
time = time * 1000;
}
date = new Date(time);
}
const formatObj = {
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
};
return format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
let value = formatObj[key];
// Note: getDay() returns 0 on Sunday
if (key === 'a') {
return ['日', '一', '二', '三', '四', '五', '六'][value];
}
if (result.length > 0 && value < 10) {
value = '0' + value;
}
return value || 0;
});
}