This commit is contained in:
zhouyanli
2026-05-18 17:20:29 +08:00
14 changed files with 601 additions and 245 deletions

View File

@@ -2,3 +2,4 @@ node_modules/
unpackage/ unpackage/
.hbuilderx/ .hbuilderx/
.DS_Store .DS_Store
.history/

View File

@@ -117,5 +117,20 @@ export default {
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
} }
/* 单行省略 */
.ellipsis {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
/* 2行省略 */
.ellipsis-2 {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
/* 1 电表 2水表 */ /* 1 电表 2水表 */
</style> </style>

View File

@@ -0,0 +1,68 @@
/**
* @Description: (计划中)公共接口
* @Author: Zy
* @Date: 2026-05-15 11:37:01
* @LastEditor: Zy
* @LastEditTime: 2026-05-15 17:02:25
*/
import request, { get, post } from './request.js'
/**
* @typedef EmployeeItem 员工信息项
* @property {string} userId
* @property {string} tenantId
* @property {string} villageIds
* @property {string} roleName
* @property {string} userName
* @property {string} nickName
* @property {string} userType
* @property {string} email
* @property {string} phonenumber
* @property {string} sex
* @property {string} avatar
* @property {string} status
* @property {string} loginIp
* @property {string} loginDate
* @property {string} remark
* @property {string} createTime
* @property {string} roles
* @property {string} roleIds
* @property {string} postIds
* @property {string} roleId
*/
/**
* 获取对应类型的员工信息列表
* @param {RoleKeyEnum} roleKey - 角色标识
* @param {string} [keyword=''] - 搜索关键词(可选),手机号/姓名
* @returns {Promise<DataResult<EmployeeItem[]>>}
*/
export function getSystemUsers_employee(roleKey, keyword) {
return get(`/manage/repair/person/users?roleKey=${roleKey}&keyword=${keyword}`)
}
/**
* @typedef HouseItem 房屋信息项
* @property {string} addressCn
* @property {string} addressHyphen
* @property {string} buildingName
* @property {number} floorNo
* @property {string} houseId
* @property {string} houseNo
* @property {string} userType
* @property {string} residentName
* @property {number} unitNo
*/
/**
* 获取 小区房屋 列表
* @param {Object} data - 请求参数
* @param {number} data.pageNum - 页码(第几页)
* @param {number} data.pageSize - 每页条数
* @param {string} [keyword=''] - 搜索关键词(可选),房屋号/业主姓名
* @returns {Promise<RowsResult<HouseItem>>}
*/
export function getVillageHouseList_keyword(data, keyword) {
return get(
`/manage/replace/sdb/village/house?pageSize=${data.pageSize}&pageNum=${data.pageNum}&keyword=${keyword}`
)
}

View File

@@ -0,0 +1,85 @@
/**
* @Description: 投诉详情API
* @Author: Zy
* @Date: 2026-05-15 08:50:47
* @LastEditor: Zy
* @LastEditTime: 2026-05-15 16:47:31
*/
import request, {
filterParams,
get,
put,
post
} from "./request.js";
/**
* 获取投诉信息分页列表
* @param {Object} data - 请求参数
* @param {number} data.pageNum - 页码(第几页)
* @param {number} data.pageSize - 每页条数
* @param {number} [data.status] - 投诉状态(可选),不传=全部,0=待处理,2=已完成
* @returns {Promise<{
* code: number,
* msg: string,
* total: number,
* rows: Array<{
* id: string,
* typeId: number,
* typeName: string,
* problemDes: string,
* complaintName: string,
* phone: string,
* villageId: number,
* problemImageUrl: string,
* status: string,
* createTime: string|null,
* handleId: number|null,
* handleName: string|null,
* handleContent: string|null
* }>
* }>} 返回接口响应结果
*/
export const getComplainList = (data) => {
return get('/manage/complain/list', filterParams(data))
}
/**
* 获取 某一个 投诉详情
* @param {string} id 投诉id
*/
export const getComplaniMain = (id) => {
return post('/manage/complain/list', data)
}
/**
* @description: 处理投诉API
* @param {Object} data
* @param {string} data.id 处理人员id
* @param {string} data.handleContent 处理描述
*/
export const putComplainProcess = (data) => {
return put('/manage/complain/process', data)
}
/**
* @typedef complainMain 投诉详情内容
* @property {number} typeId
* @property {string} typeName
* @property {string} problemDes
* @property {string} complaintName
* @property {string} phone
* @property {string} villageId
* @property {string} problemImageUrl
* @property {string} status
* @property {string} createTime
* @property {string} handleName
* @property {string} handleContent
*/
/**
* @description: 查询 具体 投诉详情
* @param {string} 投诉 id
* @return {Promise<DataResult<complainMain>>}
*/
export const getComplainMain = (id) => {
return get('/manage/complain/detail?id=' + id)
}

View File

@@ -0,0 +1,4 @@
import request, {
get,
post
} from "./request.js"

View File

@@ -1,92 +1,129 @@
let baseUrl = ''; let baseUrl = ''
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
baseUrl = 'http://192.168.0.239:8080'; // 开发环境 baseUrl = 'http://192.168.0.239:8080' // 开发环境
} else { } else {
baseUrl = 'http://192.168.0.239:8080'; // 生产环境 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) => {
uni.showLoading({ uni.showLoading({
title: '请求中...', title: '请求中...',
mask: true mask: true
}); })
uni.request({ uni.request({
url: baseUrl + url, url: baseUrl + url,
data: data, data: data,
method: method, method: method,
header: { header: {
"Authorization": "Bearer " + (uni.getStorageSync("token") || ''), Authorization: 'Bearer ' + (uni.getStorageSync('token') || ''),
"clientid": "butler", clientid: 'butler',
'content-type': 'application/json' 'content-type': 'application/json'
}, },
success: (res) => { success: res => {
uni.hideLoading(); uni.hideLoading()
// HTTP 失败 // HTTP 失败
if (res.statusCode !== 200) { if (res.statusCode !== 200) {
reject({ msg: `请求异常 ${res.statusCode}`, code: res.statusCode }); reject({
return; msg: `请求异常 ${res.statusCode}`,
} code: res.statusCode
})
return
}
const resData = res.data || {}; const resData = res.data || {}
// token 过期 // token 过期
if (resData.code === 401) { if (resData.code === 401) {
uni.showToast({ title: '登录过期,请重新登录', icon: 'none' }); uni.showToast({
uni.clearStorageSync('token'); title: '登录过期,请重新登录',
setTimeout(() => { icon: 'none'
uni.reLaunch({ url: '/pageSubPack/loginSub/pwd-login' }); })
}, 1500); uni.clearStorageSync('token')
reject({ msg: '登录过期', code: 401 }); setTimeout(() => {
return; uni.reLaunch({
} url: '/pageSubPack/loginSub/pwd-login'
})
}, 1500)
reject({
msg: '登录过期',
code: 401
})
return
}
// 成功 // 成功
if (resData.code === 200) { if (resData.code === 200) {
resolve(resData); resolve(resData)
} }
// 业务失败 // 业务失败
else { else {
reject({ msg: resData.msg || '请求失败', code: resData.code, data: resData }); reject({
} msg: resData.msg || '请求失败',
}, code: resData.code,
fail: (err) => { data: resData
uni.hideLoading(); })
reject({ msg: '网络异常', code: -1, raw: err }); }
} },
}); fail: err => {
}); uni.hideLoading()
reject({
msg: '网络异常',
code: -1,
raw: err
})
}
})
})
} }
export const get = (url, data) => request(url, data, 'GET'); export const get = (url, data) => request(url, data, 'GET')
export const post = (url, data) => request(url, data, 'POST'); export const post = (url, data) => request(url, data, 'POST')
export const put = (url, data) => request(url, data, 'PUT')
// export const deleteMethod = (url, data) => request(url, data, 'DELETE'); // export const deleteMethod = (url, data) => request(url, data, 'DELETE');
// export const putMethod = (url, data) => request(url, data, 'PUT'); // export const putMethod = (url, data) => request(url, data, 'PUT');
// 上传 // 上传
export const upload = (filePath, url) => { export const upload = (filePath, url) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.uploadFile({ uni.uploadFile({
url: baseUrl + url, url: baseUrl + url,
filePath: filePath, filePath: filePath,
name: 'file', name: 'file',
header: { header: {
"Authorization": "Bearer " + (uni.getStorageSync("token") || ''), Authorization: 'Bearer ' + (uni.getStorageSync('token') || ''),
"clientid": "resident" clientid: 'resident'
}, },
success: (res) => { success: res => {
try { try {
const data = JSON.parse(res.data); const data = JSON.parse(res.data)
resolve(data.data || ''); // 直接返回图片地址 resolve(data.data || '') // 直接返回图片地址
} catch (e) { } catch (e) {
resolve(''); resolve('')
} }
}, },
fail: (err) => { fail: err => {
reject(err); reject(err)
} }
}); })
}); })
}; }
/**
* 过滤请求参数:移除值为 null / undefined / 空字符串 的字段
* 用于避免将空参数拼接到 URL 或请求体中
* @param {Object|null|undefined} params - 原始请求参数
* @returns {Object} 过滤后的干净参数对象,只保留有效值
*/
export function filterParams(params) {
if (!params) return {}
return Object.keys(params).reduce((acc, key) => {
const value = params[key]
if (value !== null && value !== undefined && value !== '') {
acc[key] = value
}
return acc
}, {})
}

View File

@@ -0,0 +1,33 @@
// 全局 JSDoc 类型定义 全项目所有文件通用
/**
* 【全局】通用分页接口返回结构1
* @template T - 列表项类型
* @typedef {Object} RowsResult
* @property {number} code 响应码,200=成功
* @property {string} msg 响应消息
* @property {number} total 总条数
* @property {T[]} rows 数据列表
*/
/**
* 【全局】通用接口返回结构2
* @template T - 列表项类型
* @typedef {Object} DataResult
* @property {number} code 响应码,200=成功
* @property {string} msg 响应消息
* @property {T} data 数据列表
*/
/**
* 【全局】角色标识枚举
* @typedef {'manage'|'repair'|'inspection'|'EquipmentMaintenance'|'complainUser'} RoleKeyEnum
*
* @enum {RoleKeyEnum}
* @property {'manage'} manage - 物业管理员
* @property {'repair'} repair - 小区维修人员
* @property {'inspection'} inspection - 巡检人员
* @property {'EquipmentMaintenance'} EquipmentMaintenance - 设备维护人员
* @property {'complainUser'} complainUser - 投诉处理人员
*/

View File

@@ -9,21 +9,28 @@
></TabsComponents> ></TabsComponents>
<view class="detail_list flex flex-1 overflow-auto"> <view class="detail_list flex flex-1 overflow-auto">
<scroll-view scroll-y="true"> <scroll-view scroll-y="true" lower-threshold="160" @scrolltolower="scrolltolower">
<view class="item" v-for="(item, index) in list" :key="index" @tap="handleComplaint"> <view
class="item"
v-for="(item, index) in list"
:key="index"
@tap="handleComplaint(item.id)"
>
<view class="title flex items-center"> <view class="title flex items-center">
<text>{{ item.title }}</text> <text>{{ item.typeName }}</text>
<view class="status padding" v-if="item.status === 0"> <text>待处理</text> </view> <view class="status padding" v-if="item.status === '待处理'">
<text>待处理</text>
</view>
<view class="status compluted" v-else> <view class="status compluted" v-else>
<text>已完成</text> <text>已完成</text>
</view> </view>
</view> </view>
<view class="descrtion"> <view class="descrtion">
<text>{{ item.desction }}</text> <text>{{ item.problemDes }}</text>
</view> </view>
<view class="detailsMan"> <view class="detailsMan">
<text>投诉人:</text> <text>投诉人:</text>
<text>{{ item.user }}</text> <text>{{ item.complaintName }}</text>
</view> </view>
<view class="detailsMan"> <view class="detailsMan">
<text>手机号:</text> <text>手机号:</text>
@@ -32,9 +39,9 @@
<view class="detailsMan flex justify-between"> <view class="detailsMan flex justify-between">
<view class=""> <view class="">
<text>投诉时间:</text> <text>投诉时间:</text>
<text>{{ item.time }}</text> <text>{{ item.createTime }}</text>
</view> </view>
<view class="actions" v-if="item.status === 0"> <view class="actions" v-if="item.status === '待处理'">
<text>处理</text> <text>处理</text>
</view> </view>
</view> </view>
@@ -45,18 +52,22 @@
</view> </view>
</template> </template>
<script setup> <script setup lang="ts">
import { ref } from 'vue' import { ref } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import TabsComponents from '@/components/tabs/tabs.vue' import TabsComponents from '@/components/tabs/tabs.vue'
const activeStatus = ref(0) import { getComplainList } from '@/api/complain.js'
const scrollTop = ref(0)
const activeStatus = ref(-1)
const statusTabs = [ const statusTabs = [
{ {
name: '全部', name: '全部',
value: 0 value: -1
}, },
{ {
name: '待处理', name: '待处理',
value: 1 value: 0
}, },
{ {
name: '已完成', name: '已完成',
@@ -64,57 +75,74 @@ const statusTabs = [
} }
] ]
// 切换状态(全部/待分配/待解决/已完成)筛选 // 切换状态(全部/待分配/待解决/已完成)筛选
const switchStatus = value => { const switchStatus = (value: number) => {
activeStatus.value = value activeStatus.value = value
if (value === -1) {
querySearch.value.status = undefined
} else {
querySearch.value.status = value
}
querySearch.value.pageNum = 1
querySearch.value.pageSize = 10
hasMore.value = true
isLoading.value = false
scrollTop.value = 0
list.value = []
init()
} }
// //
const list = [
{
title: '小区环境',
status: 0, // 0 待处理 1 已完成
desction: '1栋楼下道路路灯不亮,并且有的亮度不够,请物业公司及时更换,防止发生意外事故。',
user: '胡小小',
phone: '19113212388',
time: '2023-08-01 10:05:46'
},
{
title: '小区环境',
status: 1, // 0 待处理 1 已完成
desction: '1栋楼下道路路灯不亮,并且有的亮度不够,请物业公司及时更换,防止发生意外事故。',
user: '胡小小',
phone: '19113212388',
time: '2023-08-01 10:05:46'
},
{
title: '小区环境',
status: 1, // 0 待处理 1 已完成
desction: '1栋楼下道路路灯不亮,并且有的亮度不够,请物业公司及时更换,防止发生意外事故。',
user: '胡小小',
phone: '19113212388',
time: '2023-08-01 10:05:46'
},
{
title: '小区环境',
status: 0, // 0 待处理 1 已完成
desction: '1栋楼下道路路灯不亮,并且有的亮度不够,请物业公司及时更换,防止发生意外事故。',
user: '胡小小',
phone: '19113212388',
time: '2023-08-01 10:05:46'
},
{
title: '小区环境',
status: 1, // 0 待处理 1 已完成
desction: '1栋楼下道路路灯不亮,并且有的亮度不够,请物业公司及时更换,防止发生意外事故。',
user: '胡小小',
phone: '19113212388',
time: '2023-08-01 10:05:46'
}
]
function handleComplaint() { const total = ref(0) //
uni.navigateTo({ const isLoading = ref(false) // 加载锁
url: '/pageSubPack/complaint/Details_handle' const hasMore = ref(true) // 是否还有更多数据
const list = ref([])
const querySearch = ref({
pageSize: 10,
pageNum: 1,
status: undefined // 0 待处理 1 已完成
})
function init() {
// 1. 如果正在加载或没有更多数据,直接返回
if (isLoading.value || !hasMore.value) return
// 2. 开启锁
isLoading.value = true
uni.showLoading({
title: '加载中',
mask: true
}) })
getComplainList(querySearch.value)
.then(res => {
list.value = [...list.value, ...res.rows]
total.value = res.total
// 判断是否还有更多
hasMore.value = list.value.length < total.value
})
.finally(() => {
isLoading.value = false
uni.hideLoading()
})
}
onShow(() => {
hasMore.value = true
init()
})
// actions
function handleComplaint(id: string) {
uni.navigateTo({
url: '/pageSubPack/complaint/Details_handle?id=' + id
})
}
function scrolltolower() {
// 必须加这两个判断!
if (isLoading.value || !hasMore.value) {
return
}
querySearch.value.pageNum += 1
init()
} }
</script> </script>
@@ -128,12 +156,11 @@ function handleComplaint() {
padding: 20rpx 40rpx; padding: 20rpx 40rpx;
.detail_list { .detail_list {
.item { .item {
height: 390rpx;
background: #ffffff; background: #ffffff;
border-radius: 16rpx; border-radius: 16rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
box-sizing: border-box; box-sizing: border-box;
padding: 30rpx 36rpx 55rpx 54rpx; padding: 30rpx 36rpx 30rpx 54rpx;
.title { .title {
font-weight: 400; font-weight: 400;
font-size: 32rpx; font-size: 32rpx;

View File

@@ -6,13 +6,14 @@
<view class="line"></view> <view class="line"></view>
<text>投诉状态</text> <text>投诉状态</text>
</view> </view>
<view class="status" v-if="info.status === 0"> <text>待处理</text> </view> <view class="status" v-if="complainInfo.status === '0'"> <text>待处理</text> </view>
<view class="status alwary" v-if="info.status === 1"> <view class="status alwary" v-if="complainInfo.status === '2'">
<text>已完成</text> <text>已完成</text>
</view> </view>
</view> </view>
<view class="subDescrition" v-if="info.status === 1"> <view class="subDescrition" v-if="complainInfo.status === '2'">
<text>已完成处理,已联系工作人员粘贴标语提醒,并派人定时巡视。</text> <!-- <text>已完成处理,已联系工作人员粘贴标语提醒,并派人定时巡视。</text> -->
<text>{{ complainInfo.handleContent }}</text>
</view> </view>
<view class="items flex items-center justify-between"> <view class="items flex items-center justify-between">
<view class="title flex items-center"> <view class="title flex items-center">
@@ -24,28 +25,30 @@
<view class="item"> <view class="item">
<view class="label"> 投诉类型 </view> <view class="label"> 投诉类型 </view>
<view class="value flex items-center justify-between"> <view class="value flex items-center justify-between">
<view class=""> 社区服务 </view> <view class="">
<text>{{ complainInfo.typeName }}</text>
</view>
<uni-icons type="right" size="14" color="#000000"></uni-icons> <uni-icons type="right" size="14" color="#000000"></uni-icons>
</view> </view>
</view> </view>
<view class="item"> <view class="item">
<view class="label"> 问题描述 </view> <view class="label"> 问题描述 </view>
<view class="value"> <view class="value">
<text <text>{{ complainInfo.problemDes }} </text>
>投诉内容投诉内容投诉内容投诉内容投诉内容投诉内容投诉内容投诉内容投诉内容投诉内容
</text>
</view> </view>
</view> </view>
<view class="item"> <view class="item">
<view class="label"> 投诉人姓名 </view> <view class="label"> 投诉人姓名 </view>
<view class="value"> <view class="value">
<text>匿名 </text> <text>
{{ complainInfo.complaintName }}
</text>
</view> </view>
</view> </view>
<view class="item"> <view class="item">
<view class="label"> 手机号码 </view> <view class="label"> 手机号码 </view>
<view class="value"> <view class="value">
<text>无 </text> <text> {{ complainInfo.phone }}</text>
</view> </view>
</view> </view>
<view class="photobox"> <view class="photobox">
@@ -54,7 +57,7 @@
</view> </view>
<view class="imgbox"> <view class="imgbox">
<image <image
v-for="(item, index) in info.imgs" v-for="(item, index) in showImages"
:key="index" :key="index"
:src="item" :src="item"
class="img" class="img"
@@ -65,7 +68,7 @@
</view> </view>
<!-- submit --> <!-- submit -->
<view v-if="info.status === 0" class="action_btn" @tap="handleSelecthouse"> <view v-if="complainInfo.status === '0'" class="action_btn" @tap="handleSelecthouse">
<text>处理</text> <text>处理</text>
</view> </view>
</view> </view>
@@ -73,7 +76,10 @@
</template> </template>
<script setup> <script setup>
import { ref } from 'vue' import { onMounted, ref } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { getComplainMain } from '@/api/complain.js'
const info = ref({ const info = ref({
status: 0, //0待解决 1已完成 status: 0, //0待解决 1已完成
imgs: [ imgs: [
@@ -84,10 +90,55 @@ const info = ref({
'https://picsum.photos/61' 'https://picsum.photos/61'
] ]
}) })
/** 投诉详情id */
const complainId = ref('')
/** 投诉详情内容 */
const complainInfo = ref({
id: '',
typeId: null,
typeName: '',
problemDes: '',
complaintName: '',
phone: '',
villageId: null,
problemImageUrl: '',
status: '0',
createTime: null,
handleId: '',
handleName: '',
handleContent: ''
})
const showImages = ref([])
// 接受列表传递过来的id
onLoad(options => {
if (options && options.id && options.id.trim()) {
complainId.value = options.id
}
})
// 查询 投诉详情
function init() {
if (complainId.value) {
getComplainMain(complainId.value).then(res => {
complainInfo.value = res.data
showImages.value = res.data.problemImageUrl
.split(',')
.filter(item => item.includes('http'))
.map(item => item.split('?')[0])
})
}
}
onShow(() => {
init()
})
function handleSelecthouse() { function handleSelecthouse() {
uni.navigateTo({ if (complainId.value) {
url: '/pageSubPack/complaint/handle' uni.navigateTo({
}) url: '/pageSubPack/complaint/handle?handleId=' + complainId.value
})
}
} }
</script> </script>
@@ -176,6 +227,7 @@ function handleSelecthouse() {
.img { .img {
width: 132rpx; width: 132rpx;
height: 132rpx; height: 132rpx;
border: 1rpx solid #efefef;
} }
} }
} }

View File

@@ -3,12 +3,22 @@
<view class="handlebox flex-1"> <view class="handlebox flex-1">
<view class="items checkout flex items-center" @tap="handleClick"> <view class="items checkout flex items-center" @tap="handleClick">
<view class="label">处理人员</view> <view class="label">处理人员</view>
<view class="value"> {{ checkoutinfo.username ? checkoutinfo.username : '请选择' }} </view> <view class="value ellipsis">
<text>{{ checkoutinfo.userName ? checkoutinfo.userName : '请选择' }}</text>
</view>
</view> </view>
<view class="items"> <view class="items">
<view class="label">处理描述</view> <view class="label">处理描述</view>
<view class="areabox"> <view class="areabox">
<textarea value="" placeholder="请输入" placeholder-style="font-size:28rpx;" /> <textarea
style="width: 100%; height: 100%; overflow: hidden"
:value="form.handleContent"
:maxlength="-1"
auto-height
placeholder="请输入"
@blur="handleBlur"
placeholder-style="font-size:28rpx;"
/>
</view> </view>
</view> </view>
<view class="action_btn" @tap="handleSelecthouse"> <view class="action_btn" @tap="handleSelecthouse">
@@ -18,26 +28,50 @@
</view> </view>
</template> </template>
<script setup> <script setup lang="ts" key="handle">
import { ref } from 'vue' import { ref } from 'vue'
import { onLoad, onUnload } from '@dcloudio/uni-app'
import { putComplainProcess } from '@/api/complain'
const checkoutinfo = ref({ const checkoutinfo = ref({
username: '', userName: '',
userid: '' userId: ''
}) })
const form = ref({
complaintId: '',
handleContent: ''
})
onLoad(options => {
if (options && options.handleId && options.handleId.trim()) {
form.value.complaintId = options.handleId
}
})
// 选择处理人员
function handleClick() { function handleClick() {
uni.navigateTo({ uni.navigateTo({
url: '/pageSubPack/complaint/handleUser', url: '/pageSubPack/complaint/handleUser',
events: { events: {
backData: data => { backData: (data: { userName: string; userId: string }) => {
checkoutinfo.value.username = data.username checkoutinfo.value.userName = decodeURIComponent(data.userName)
checkoutinfo.value.userid = data.userid checkoutinfo.value.userId = data.userId
} }
} }
}) })
} }
function handleBlur(e) {
form.value.handleContent = e.detail.value
}
// 处理投诉 提交
function handleSelecthouse() { function handleSelecthouse() {
uni.navigateBack() putComplainProcess({
id: form.value.complaintId,
handleContent: form.value.handleContent
}).then(() => {
uni.navigateBack()
})
} }
</script> </script>
@@ -48,6 +82,7 @@ function handleSelecthouse() {
.items { .items {
margin-bottom: 30rpx; margin-bottom: 30rpx;
overflow: hidden;
&.checkout { &.checkout {
height: 100rpx; height: 100rpx;
line-height: 100rpx; line-height: 100rpx;
@@ -55,6 +90,7 @@ function handleSelecthouse() {
} }
.label { .label {
width: 128rpx; width: 128rpx;
min-width: 128rpx;
height: 40rpx; height: 40rpx;
font-weight: 550; font-weight: 550;
font-size: 32rpx; font-size: 32rpx;
@@ -76,6 +112,9 @@ function handleSelecthouse() {
border: 2rpx solid #e7e7e7; border: 2rpx solid #e7e7e7;
padding: 10rpx; padding: 10rpx;
box-sizing: border-box; box-sizing: border-box;
min-height: 162rpx;
max-height: 450rpx;
overflow: auto;
} }
} }
.action_btn { .action_btn {

View File

@@ -38,7 +38,7 @@
<view class=""> <view class="">
<view class="info"> <view class="info">
<text>姓名:</text> <text>姓名:</text>
<text>{{ item.name }}</text> <text>{{ item.nickName }}</text>
</view> </view>
<view class="info"> <view class="info">
<text>角色:</text> <text>角色:</text>
@@ -46,10 +46,10 @@
</view> </view>
<view class="info"> <view class="info">
<text>手机号码:</text> <text>手机号码:</text>
<text>{{ item.phone }}</text> <text>{{ item.phonenumber }}</text>
</view> </view>
</view> </view>
<radio color="#4d5dfa" :value="item.id" /> <radio color="#4d5dfa" :value="item.userId" />
</view> </view>
</label> </label>
</radio-group> </radio-group>
@@ -63,10 +63,17 @@
</view> </view>
</template> </template>
<script setup> <script setup key="Details">
import { ref, onMounted, getCurrentInstance } from 'vue' import { ref, onMounted, getCurrentInstance } from 'vue'
import { getSystemUsers_employee } from '@/api/common.js'
import navBar from '@/components/navbar/navbar.vue' import navBar from '@/components/navbar/navbar.vue'
let eventChannel = null
onMounted(() => {
const instance = getCurrentInstance().proxy
eventChannel = instance.getOpenerEventChannel()
})
const Searching = ref(true) const Searching = ref(true)
/** 点击时切换到input,并聚焦 */ /** 点击时切换到input,并聚焦 */
function handleClick() { function handleClick() {
@@ -100,70 +107,52 @@ function scrolltolower() {
getlist() getlist()
} }
function getlist() { function getlist() {
// 1. 如果正在加载或没有更多数据,直接返回
if (isLoading.value || !hasMore.value) return
// 2. 开启锁 // 2. 开启锁
if (isLoading.value) {
return
}
isLoading.value = true isLoading.value = true
uni.showLoading({ uni.showLoading({
title: '加载中', title: '加载中',
mask: true mask: true
}) })
const { pageNum, pageSize } = queryParmas.value getSystemUsers_employee('complainUser', queryParmas.value.value)
.then(res => {
const startId = (pageNum - 1) * pageSize + 1 console.log(res)
const arr = Array.from({ length: pageSize }).map((_, index) => { searchlist.value = res.data
const realId = startId + index })
const randomStatus = Math.floor(Math.random() * 3) .finally(() => {
return { isLoading.value = false
name: '张三' + realId, uni.hideLoading()
roleName: '维修人员', })
phone: '19578012123',
id: realId
}
})
// 追加数据(正确方式)
searchlist.value = [...searchlist.value, ...arr]
// 判断是否还有更多
hasMore.value = searchlist.value.length < total.value
isLoading.value = false
uni.hideLoading()
} }
getlist() getlist()
function resetList() {
reportRecords.value = []
queryParmas.value.pageNum = 1
hasMore.value = true
getlist()
}
//======================= //=======================
// 选中的人员id
const checkoutUserid = ref(null) const checkoutUserid = ref(null)
// 选中的人员信息
const checkoutUserInfo = ref(null) const checkoutUserInfo = ref(null)
function radioChange(val) { function radioChange(val) {
checkoutUserid.value = Number(val.detail.value) checkoutUserid.value = val.detail.value
const find = searchlist.value.find(item => item.id === Number(val.detail.value)) const find = searchlist.value.find(item => item.userId === val.detail.value)
if (find) { if (find) {
checkoutUserInfo.value = find checkoutUserInfo.value = find
} }
} }
let eventChannel = null
// 必须在 onMounted 里获取
onMounted(() => {
const instance = getCurrentInstance().proxy
if (instance && instance.getOpenerEventChannel) {
eventChannel = instance.getOpenerEventChannel()
}
})
function handleSelecthouse() { function handleSelecthouse() {
if (eventChannel) { // 携带你要传递的参数
eventChannel.emit('backData', { const params = {
userid: checkoutUserid.value, userId: checkoutUserid.value,
username: checkoutUserInfo.value.name userName: checkoutUserInfo.value.nickName
})
// 3. 返回上一页
uni.navigateBack()
} }
eventChannel.emit('backData', {
userId: params.userId,
userName: encodeURIComponent(params.userName)
})
uni.navigateBack()
} }
</script> </script>

View File

@@ -67,6 +67,7 @@ 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)
} }
} }
}) })

View File

@@ -4,7 +4,7 @@
<view <view
@click="handleClick" @click="handleClick"
class="search_view flex-center" class="search_view flex-center"
v-if="!queryParmas.value.trim() && Searching" v-if="!queryParmas.keyword.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>
@@ -14,7 +14,7 @@
@change="handleSearch" @change="handleSearch"
:focus="true" :focus="true"
ref="inputRef" ref="inputRef"
v-model="queryParmas.value" v-model="queryParmas.keyword"
v-else v-else
/> />
</view> </view>
@@ -25,17 +25,17 @@
<view <view
class="search_item flex flex-between" class="search_item flex flex-between"
:class="{ :class="{
active: checkoutHouseid === item.id active: checkoutHouseid === item.houseId
}" }"
> >
<view class="flex items-center flex-1"> <view class="flex items-center flex-1">
<!-- checkout --> <!-- checkout -->
<radio color="#4d5dfa" :value="item.id" /> <radio color="#4d5dfa" :value="item.houseId" />
<!-- housename --> <!-- housename -->
<text class="address">{{ item.address }}</text> <text class="address">{{ item.addressCn ?? item.addressHyphen }}</text>
</view> </view>
<!-- username --> <!-- username -->
<view class="username">{{ item.username }}</view> <view class="username">{{ item.residentName }}</view>
</view> </view>
</label> </label>
</radio-group> </radio-group>
@@ -50,9 +50,11 @@
</template> </template>
<script setup> <script setup>
import { ref, getCurrentInstance, onMounted } from 'vue' import { ref, getCurrentInstance, onMounted } from 'vue'
import { getVillageHouseList_keyword } from '@/api/common.js'
const Searching = ref(true) const Searching = ref(true)
const queryParmas = ref({ const queryParmas = ref({
value: '', keyword: '',
pageNum: 1, pageNum: 1,
pageSize: 10 pageSize: 10
}) })
@@ -62,18 +64,17 @@ function handleClick() {
} }
/** 判断 失去焦点时 切换回 view */ /** 判断 失去焦点时 切换回 view */
function handleInput() { function handleInput() {
if (queryParmas.value.value.trim()) { if (queryParmas.value.keyword.trim()) {
Searching.value = true Searching.value = true
} }
} }
function handleSearch() {}
const checkoutHouseid = ref(null) const checkoutHouseid = ref(null)
const checkoutHouseInfo = ref(null) const checkoutHouseInfo = ref(null)
/** 选择房屋,返回id*/ /** 选择房屋,返回id*/
function radioChange(res) { function radioChange(res) {
checkoutHouseid.value = Number(res.detail.value) checkoutHouseid.value = res.detail.value
const find = searchlist.value.find(item => item.id === Number(res.detail.value)) const find = searchlist.value.find(item => item.houseId === res.detail.value)
if (find) { if (find) {
checkoutHouseInfo.value = find checkoutHouseInfo.value = find
} }
@@ -83,7 +84,7 @@ function radioChange(res) {
const searchlist = ref([]) const searchlist = ref([])
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) {
@@ -101,26 +102,21 @@ function getlist() {
title: '加载中', title: '加载中',
mask: true mask: true
}) })
const { pageNum, pageSize } = queryParmas.value getVillageHouseList_keyword(queryParmas.value, queryParmas.value.keyword)
.then(res => {
const startId = (pageNum - 1) * pageSize + 1 // 追加数据(正确方式)
const arr = Array.from({ length: pageSize }).map((_, index) => { searchlist.value = [...searchlist.value, ...res.rows]
const realId = startId + index // ✅ 修复 ID 错误 // 判断是否还有更多
return { hasMore.value = searchlist.value.length < total.value
id: realId, })
username: '李赫', .finally(() => {
address: 'A栋3单元3' + realId isLoading.value = false
} uni.hideLoading()
}) })
// 追加数据(正确方式)
searchlist.value = [...searchlist.value, ...arr]
// 判断是否还有更多
hasMore.value = searchlist.value.length < total.value
isLoading.value = false
uni.hideLoading()
} }
getlist() getlist()
// 重置list
function resetList() { function resetList() {
searchlist.value = [] searchlist.value = []
queryParmas.value.pageNum = 1 queryParmas.value.pageNum = 1
@@ -128,7 +124,15 @@ function resetList() {
getlist() getlist()
} }
// -0--------------------------------------- // Search
function handleSearch() {
queryParmas.value.pageNum = 1
queryParmas.value.pageSize = 10
searchlist.value = []
getlist()
}
// ----------------------------------------
let eventChannel = null let eventChannel = null
// 必须在 onMounted 里获取 // 必须在 onMounted 里获取
onMounted(() => { onMounted(() => {
@@ -139,11 +143,10 @@ onMounted(() => {
}) })
function handleSelecthouse() { function handleSelecthouse() {
console.log(checkoutHouseInfo.value)
if (!eventChannel) return if (!eventChannel) return
eventChannel.emit('backData', { eventChannel.emit('backData', {
Houseid: checkoutHouseid.value, Houseid: checkoutHouseid.value,
HouseName: checkoutHouseInfo.value.address HouseName: checkoutHouseInfo.value.addressCn ?? checkoutHouseInfo.value.addressHyphen
}) })
// 3. 返回上一页 // 3. 返回上一页
uni.navigateBack() uni.navigateBack()

View File

@@ -140,7 +140,8 @@
{ {
"path": "handle", "path": "handle",
"style": { "style": {
"navigationBarTitleText": "处理投诉" "navigationBarTitleText": "处理投诉",
"navigationBarBackgroundColor": "#ffffff"
} }
}, },
{ {
@@ -152,7 +153,8 @@
{ {
"path": "Details_handle", "path": "Details_handle",
"style": { "style": {
"navigationBarTitleText": "投诉详情处理" "navigationBarTitleText": "投诉详情处理",
"navigationBarBackgroundColor": "#ffffff"
} }
} }
] ]