Browse Source

巡检记录接口对接

wyx
fp 1 month ago
parent
commit
4ba694d39f
  1. 9
      common/api.js
  2. 4
      pages.json
  3. 45
      pages/tabBar/xjPage/xj.vue
  4. 105
      pages/tabBar/xjPage/xjRecord.vue

9
common/api.js

@ -16,6 +16,15 @@ export function addInspection(data) {
});
};
// 我的巡检记录列表
export function myInspection(data) {
return request({
url: '/mz/inspection/myList',
method: 'get',
data,
});
};
// 房屋专属左侧组织树
export function getdeptList() {
return request({

4
pages.json

@ -54,7 +54,9 @@
"path": "pages/tabBar/xjPage/xjRecord",
"style": {
"navigationBarTitleText": "巡检记录",
"disableScroll": true
"disableScroll": true,
"enablePullDownRefresh":true,
"onReachBottomDistance": 100
}
},
{

45
pages/tabBar/xjPage/xj.vue

@ -77,7 +77,7 @@
import {
queryDeptDropdownList,
} from "@/common/rec";
import { getdeptList,addInspection,uploadFile } from '@/common/api.js';
import { getdeptList,addInspection } from '@/common/api.js';
import { getDicts } from "@/common/system/dict/data";
import { baseUrl } from "@/utils/config";
export default {
@ -144,11 +144,9 @@ export default {
"children",
2
);
// console.log(this.deptOptions[0].children);
// console.log(this.deptOptions[0].children.map(item=> item.deptName));
this.deptOptions = await this.getListByParentId("1", '156');
this.form.areaId = this.deptOptions[0].children[0].deptId
this.deptOptions = await this.getListByParentId("1", this.deptOptions[0].children[0].deptId);
console.log(this.deptOptions);
});
},
//
@ -195,6 +193,43 @@ export default {
})
},
handleBtn () {
if(!this.form.apartmentId){
uni.showToast({
icon: 'none',
title: '请选择乐业社区'
})
return
} else if(!this.form.questionType){
uni.showToast({
icon: 'none',
title: '巡检问题类型'
})
return
} else if(!this.form.title){
uni.showToast({
icon: 'none',
title: '请输入标题内容'
})
return
} else if(!this.form.content){
uni.showToast({
icon: 'none',
title: '请输入问题描述'
})
return
} else if(!this.form.inspector){
uni.showToast({
icon: 'none',
title: '请输入巡检人姓名'
})
return
} else if(!this.form.inspectorPhone){
uni.showToast({
icon: 'none',
title: '请输入巡检人电话'
})
return
}
// console.log(this.form);
let parmas = JSON.parse(JSON.stringify(this.form))
delete parmas.apartmentName

105
pages/tabBar/xjPage/xjRecord.vue

@ -1,59 +1,126 @@
<!-- 巡检记录 -->
<template>
<scroll-view class="content" scroll-y="true">
<view class="conItem" v-for="(item, index) in 10">
<scroll-view class="content"
scroll-y
refresher-enabled
:refresher-triggered="isRefreshing"
@refresherrefresh="refreshData"
@scrolltolower="loadMore">
<view class="conItem" v-for="item in listData" :key="item.id">
<view class="conItemTitle">
<image src="/static/img/巡检记录列表里.png" class="titleImg"></image>
<text class="titleName">龙海路乐业社区5号楼1单元805 南卧1</text>
<text class="titleName">{{ item.apartmentName }}</text>
</view>
<view class="conItemCon">
<view class="recordItem">
<view class="recordItemName">巡检问题</view>
<view class="recordItemCon">消防安全</view>
<view class="recordItemCon">{{ item.questionTypeName }}</view>
</view>
<view class="recordItem">
<view class="recordItemName">标题内容</view>
<view class="recordItemCon">消防设施老旧</view>
<view class="recordItemCon">{{ item.title }}</view>
</view>
<view class="recordItem">
<view class="recordItemName">问题描述</view>
<view class="recordItemCon">一楼东南角消防设施老旧严重已经不能正常使用</view>
<view class="recordItemCon">{{ item.content }}</view>
</view>
<view class="recordItem">
<view class="recordItemName">图片/视频</view>
<view class="recordItemCon" style="display: flex;flex-wrap: wrap;">
<image src="/static/img/巡检记录列表里.png" class="recordItemConImg"></image>
<image src="/static/img/巡检记录列表里.png" class="recordItemConImg"></image>
<image src="/static/img/巡检记录列表里.png" class="recordItemConImg"></image>
<image src="/static/img/巡检记录列表里.png" class="recordItemConImg"></image>
<image src="/static/img/巡检记录列表里.png" class="recordItemConImg"></image>
<image src="/static/img/巡检记录列表里.png" class="recordItemConImg"></image>
<image v-for="image in item.imageList" :key="image.id" :src="image.url" class="recordItemConImg"></image>
</view>
</view>
<view class="recordItem">
<view class="recordItemName">巡检日期</view>
<view class="recordItemCon">2025-05-06 15:30:20</view>
<view class="recordItemCon">{{ item.inspectionTime }}</view>
</view>
</view>
</view>
<view style="text-align: center;" v-if="isLoading">加载中...</view>
</scroll-view>
</template>
<script>
import {
queryDeptDropdownList,
} from "@/common/rec";
import { getdeptList, myInspection } from '@/common/api.js';
export default {
data () {
return {
isLoading: false,
isRefreshing: false,
form:{
pageNum:1,
pageSize: 10,
},
listData: []
}
},
onLoad () {
this.refreshData()
},
methods: {
handleBsClick (item) {
uni.navigateTo({
url: '/pages/tabBar/bsPage/bsRecord'
getTree(){
getdeptList().then(async (res) => {
this.deptOptions = this.handleTree(
res.data,
"deptId",
"parentId",
"children",
2
);
this.deptOptions = await this.getListByParentId("1", this.deptOptions[0].children[0].deptId);
// console.log(this.deptOptions);
});
},
//
async getListByParentId(type, id) {
return new Promise((resolve, reject) => {
queryDeptDropdownList({ type, id }).then((res) => {
resolve(res.data);
});
});
},
//
refreshData() {
console.log('下拉刷新');
this.isRefreshing = true
this.list = []
this.form.pageNum = 1; //
this.fetchData()
},
//
loadMore() {
console.log('上拉加载');
if (this.isLoading) return
this.isLoading = true;
this.form.pageNum++
this.fetchData()
},
//
async fetchData() {
myInspection(this.form).then((res)=>{
const tempList = res.rows
let page = this.form.pageNum
if (page == 1) {
this.listData = tempList
} else {
if (tempList.length > 0) {
const list = [...this.listData, ...tempList]
this.listData = list
} else {
const page = this.form.pageNum - 1
this.form.pageNum = page
uni.showToast({
content: '已经加载全部'
})
}
}
this.isLoading = false;
this.isRefreshing = false
uni.stopPullDownRefresh();
})
}
}

Loading…
Cancel
Save