巴林闲侠 2 years ago
parent
commit
f057a7a1dd
  1. 5
      api/app/lib/controllers/patrolManage/patrolRecord.js
  2. 5
      api/app/lib/models/patrol_record.js
  3. 9
      api/app/lib/models/patrol_record_issue_handle.js
  4. 4
      script/1.0.5/schema/2.update_patrol_record.sql
  5. 4
      script/1.0.5/schema/3.update_patrol_record_issue_handle.sql
  6. 3
      weapp/app.json
  7. BIN
      weapp/images/circle.png
  8. 1
      weapp/images/refresh.svg
  9. 3
      weapp/package/inspectionInput/inspectionInput.js
  10. 66
      weapp/package/pointsStatus/pointsStatus.js
  11. 3
      weapp/package/pointsStatus/pointsStatus.json
  12. 2
      weapp/package/pointsStatus/pointsStatus.wxml
  13. 1
      weapp/package/pointsStatus/pointsStatus.wxss
  14. 15
      weapp/package/troubleshooting/shootingForm/index.js
  15. 1
      weapp/package/troubleshooting/shootingForm/index.wxml
  16. 159
      weapp/pages/index/index.js
  17. 40
      weapp/pages/index/index.wxml
  18. 82
      weapp/pages/index/index.wxss
  19. 7
      web/client/src/sections/issueHandle/components/isuue-handle-mdal.js

5
api/app/lib/controllers/patrolManage/patrolRecord.js

@ -169,7 +169,7 @@ async function addPatrolRecord (ctx, next) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const data = ctx.request.body; const data = ctx.request.body;
let { patrolPlanId, inspectionTime, points, alarm, pointId } = data let { patrolPlanId, inspectionTime, points, alarm, pointId, projectId } = data
const pointRecord = await models.PatrolRecord.findAll({ const pointRecord = await models.PatrolRecord.findAll({
where: { pointId: pointId }, where: { pointId: pointId },
order: [['inspectionTime', 'desc']], order: [['inspectionTime', 'desc']],
@ -185,7 +185,8 @@ async function addPatrolRecord (ctx, next) {
inspectionTime, inspectionTime,
points, points,
alarm, alarm,
pointId: pointId pointId: pointId,
projectId
} }
, { , {
transaction transaction

5
api/app/lib/models/patrol_record.js

@ -45,6 +45,11 @@ module.exports = dc => {
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
allowNull: false, allowNull: false,
}, },
projectId: {
field: "project_id",
type: DataTypes.INTEGER,
allowNull: true,
},
}, { }, {
tableName: "patrol_record", tableName: "patrol_record",
comment: "", comment: "",

9
api/app/lib/models/patrol_record_issue_handle.js

@ -204,6 +204,15 @@ module.exports = dc => {
field: "isgaojing", field: "isgaojing",
autoIncrement: false autoIncrement: false
}, },
cost: {
type: DataTypes.DECIMAL(11, 2),
allowNull: true,
defaultValue: null,
comment: '成本',
primaryKey: false,
field: "cost",
autoIncrement: false
},
}, { }, {
tableName: "patrol_record_issue_handle", tableName: "patrol_record_issue_handle",
comment: "", comment: "",

4
script/1.0.5/schema/2.update_patrol_record.sql

@ -0,0 +1,4 @@
ALTER TABLE "public"."patrol_record"
ADD COLUMN "project_id" int4;
COMMENT ON COLUMN "public"."patrol_record"."project_id" IS '结构物id';

4
script/1.0.5/schema/3.update_patrol_record_issue_handle.sql

@ -0,0 +1,4 @@
ALTER TABLE "public"."patrol_record_issue_handle"
ADD COLUMN "cost" decimal(11,2);
COMMENT ON COLUMN "public"."patrol_record_issue_handle"."cost" IS '成本';

3
weapp/app.json

@ -16,7 +16,8 @@
"inspectionInput/inspectionInput", "inspectionInput/inspectionInput",
"troubleshooting/index", "troubleshooting/index",
"troubleshooting/shootingForm/index", "troubleshooting/shootingForm/index",
"inspectionReport/inspectionReport" "inspectionReport/inspectionReport",
"pointsStatus/pointsStatus"
] ]
} }
], ],

BIN
weapp/images/circle.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

1
weapp/images/refresh.svg

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1678087046282" class="icon" viewBox="0 0 1879 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2319" width="29.359375" height="16" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M938.617341 45.280925c-106.987283 0-205.687861 35.810405-285.003468 96.184971-17.905202 13.613873-19.532948 39.953757-3.551445 55.93526 13.169942 13.169942 34.034682 14.649711 48.83237 3.255491 66.589595-50.608092 149.752601-80.795376 239.574566-80.795375 207.16763 0 377.932948 159.667052 395.542197 362.247399 1.627746 19.384971-0.295954 34.774566-0.295954 34.774566l-93.225434 0.739884 113.202313 225.516763c9.766474 0 150.788439-226.404624 150.788439-226.404624h-94.409249c0.443931-24.564162-1.183815-35.810405-1.627745-40.545665-20.716763-241.054335-223.593064-430.760694-469.82659-430.90867zM938.617341 913.905202c-219.00578 0-397.021965-178.164162-397.021965-397.021965v-0.443931l94.261271-1.035838-112.018497-224.924855-150.936416 226.256647h94.261272C467.015029 781.317919 692.087861 988.485549 938.617341 988.485549c110.982659 0 213.234682-38.621965 293.882081-102.991907 17.313295-13.909827 18.645087-39.80578 2.959538-55.49133-13.465896-13.465896-34.774566-14.649711-49.572255-2.811561-67.921387 54.307514-153.895954 86.714451-247.269364 86.714451z" fill="#2c2c2c" p-id="2320"></path></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

3
weapp/package/inspectionInput/inspectionInput.js

@ -356,7 +356,8 @@ Page({
inspectContent, inspectContent,
address: address address: address
}, },
alarm alarm,
projectId: dataList.project.id
} }
wx.showLoading({ title: '提交中...' }); wx.showLoading({ title: '提交中...' });
that.setData({ isCommitting: true }); that.setData({ isCommitting: true });

66
weapp/package/pointsStatus/pointsStatus.js

@ -0,0 +1,66 @@
// package/pointsStatus/pointsStatus.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log(options, 'options')
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

3
weapp/package/pointsStatus/pointsStatus.json

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

2
weapp/package/pointsStatus/pointsStatus.wxml

@ -0,0 +1,2 @@
<!--package/pointsStatus/pointsStatus.wxml-->
<text>package/pointsStatus/pointsStatus.wxml</text>

1
weapp/package/pointsStatus/pointsStatus.wxss

@ -0,0 +1 @@
/* package/pointsStatus/pointsStatus.wxss */

15
weapp/package/troubleshooting/shootingForm/index.js

@ -34,6 +34,7 @@ Page({
repair: '', repair: '',
repairImgs: [], repairImgs: [],
checkDesc: '', checkDesc: '',
cost: '',
checkImgs: [], checkImgs: [],
// 表单控制 // 表单控制
@ -124,6 +125,7 @@ Page({
if (issue.state > 4) { if (issue.state > 4) {
this.setData({ this.setData({
checkDesc: issue.checkOpinion, checkDesc: issue.checkOpinion,
cost: issue.cost,
checkImgs: issue.checkImage || [], checkImgs: issue.checkImage || [],
}) })
} }
@ -198,8 +200,16 @@ Page({
}, },
onInputChange (e) { onInputChange (e) {
let value = e.detail.value
if (e.target.dataset.type === 'cost' && !/^(\d?)+(\.\d{0,2})?$/.test(e.detail.value)) {
wx.showToast({
title: '只能输入两位小数',
icon: 'none'
})
value = value.substring(0, value.length - 1);
}
this.setData({ this.setData({
[e.target.dataset.type]: e.detail.value [e.target.dataset.type]: value
}) })
}, },
@ -322,7 +332,7 @@ Page({
maintenancePersonIndex, maintenancePersonDepartmentShow, qualityPersonIndex, planStartTime, planEndTime, planStartTimeShow, planEndTimeShow, maintenanceRequirement, maintenancePersonIndex, maintenancePersonDepartmentShow, qualityPersonIndex, planStartTime, planEndTime, planStartTimeShow, planEndTimeShow, maintenanceRequirement,
userInfo, planApproval, userInfo, planApproval,
repair, repairImgs, repair, repairImgs,
checkDesc, checkImgs checkDesc, cost, checkImgs
} = this.data } = this.data
let nextState = '' let nextState = ''
let confirmData = {} let confirmData = {}
@ -372,6 +382,7 @@ Page({
confirmData = { confirmData = {
...confirmData, ...confirmData,
checkOpinion: checkDesc, checkOpinion: checkDesc,
cost,
checkImage: checkImgs, checkImage: checkImgs,
// checkPerson: { id: userInfo.id, name: userInfo.name } // checkPerson: { id: userInfo.id, name: userInfo.name }
} }

1
weapp/package/troubleshooting/shootingForm/index.wxml

@ -137,6 +137,7 @@
<span>质检验收</span> <span>质检验收</span>
</view> </view>
<van-field value="{{data.checkPerson.name}}" label="验收人" readonly border="{{ false }}" /> <van-field value="{{data.checkPerson.name}}" label="验收人" readonly border="{{ false }}" />
<van-field value="{{ cost }}" extra-event-params="{{true}}" label="成本(元)" type="digit" placeholder="请输入" border="{{ isCheck }}" bind:input="onInputChange" data-type='cost' readonly="{{!isCheck}}" />
<van-cell border="{{false}}"> <van-cell border="{{false}}">
<view style="display:flex"> <view style="display:flex">
<view class="fs-cell-title" style="">现场图片</view> <view class="fs-cell-title" style="">现场图片</view>

159
weapp/pages/index/index.js

@ -1,78 +1,81 @@
// pages/index/index.js // pages/index/index.js
import { getProjectList } from "../../utils/getApiUrl"; import { getProjectList, getPatrolRecord } from "../../utils/getApiUrl";
import { Request } from "../../common"; import { Request } from "../../common";
const moment = require("../../utils/moment");
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
dataList: [], project: [],
limit: 10, //条数 todayRecord: [], // 今日巡检记录
page: 0, //当前页 markers: [],
count: '', //总条数 isShowCallout: false,
keyName: '', //结构物名称
hidden: true,
imgUrl: getApp().globalData.imgUrl
}, },
// 输入框 setMarkers(project, todayRecord) {
formInp(e) { const markers = project.map(p => {
let that = this; let todayCount = 0;
that.setData({ todayRecord.forEach(r => {
keyName: e.detail.value if (r.projectId === p.id) { todayCount += 1 }
})
return {
id: p.id,
latitude: p.latitude,
longitude: p.longitude,
name: p.name,
iconPath: '/images/circle.png',
width: 15,
height: 15,
callout: {
content: `${p.name}\n今日巡检:${todayCount}`,
padding: 10,
display: this.data.isShowCallout ? 'ALWAYS' : 'BYCLICK',
},
}
}) })
this.setData({ markers })
}, },
// 手机键盘点击完成按钮(回车事件) // 获取结构物和今日巡检次数
bindconfirm() { getData() {
let that = this; const that = this;
that.setData({ wx.showLoading({ title: '加载中' })
page: 0, //当前页 const promiseArr = [];
count: '', //总条数 promiseArr.push(Request.get(getProjectList(), {}));
dataList: [] promiseArr.push(Request.get(getPatrolRecord('all', moment().format('YYYY-MM-DD') + ' 00:00:00', moment().format('YYYY-MM-DD') + ' 23:59:59', 'null', 'null')));
Promise.all(promiseArr).then(res => {
wx.hideLoading()
that.setData({
project: res[0].rows,
todayRecord: res[1]
})
that.setMarkers(res[0].rows, res[1]);
// 缩放视野展示所有 markers
const mapCtx = wx.createMapContext('mapDom')
mapCtx.includePoints({
points: res[0].rows,
padding: [40, 40, 40, 40]
})
}) })
that.getProjectList();
}, },
// 搜索表单 showCallout() {
goSearch() { this.setData(
let that = this; { isShowCallout: !this.data.isShowCallout },
that.setData({ () => { this.setMarkers(this.data.markers, this.data.todayRecord); }
page: 0, //当前页 );
count: '', //总条数
dataList: []
})
that.getProjectList();
}, },
// 获取巡检总览列表 onRefresh() {
getProjectList: function () { this.getData();
let that = this; },
let { page, limit, keyName } = that.data;
let data = keyName ? { limit, page, name: keyName } : { limit, page } onMarkerTap(e) {
wx.showLoading({ console.log(e.detail.markerId, 'e.detail.markerId')
title: '加载中', wx.navigateTo({url: `/package/pointsStatus/pointsStatus?projectId=${e.detail.markerId}`})
})
Request.get(getProjectList(), data).then(res => {
if (res.rows.length == 0) {
that.setData({
dataList: res.rows,
hidden: false
})
wx.hideLoading()
return;
}
var arr1 = that.data.dataList; //从data获取当前dataList数组
var arr2 = res.rows; //从此次请求返回的数据中获取新数组
arr1 = arr1.concat(arr2); //合并数组
that.setData({
dataList: arr1,
count: res.count, //总条数
hidden: true
})
wx.hideLoading()
})
}, },
/** /**
@ -104,7 +107,7 @@ Page({
url: '/pages/login/login' url: '/pages/login/login'
}); });
} else { } else {
this.getProjectList(); this.getData();
} }
}, },
@ -112,60 +115,28 @@ Page({
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide() { onHide() {
this.setData({
dataList: [],
keyName: '',
page: 0, //当前页
count: '', //总条数
})
}, },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload() { onUnload() {
this.setData({
dataList: [],
keyName: '',
page: 0, //当前页
count: '', //总条数
})
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh() { onPullDownRefresh() {
let that = this;
that.setData({
dataList: [],
keyName: '',
page: 0, //当前页
count: '', //总条数
})
that.getProjectList()
// 手动控制回弹
wx.stopPullDownRefresh();
}, },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom() { onReachBottom() {
let _that = this;
let page = _that.data.page + 1; //获取当前页数并+1
let { dataList, count } = _that.data;
if (dataList.length == count) {
wx.showToast({
title: '没有更多数据了...',
icon: 'none',
})
return;
}
_that.setData({
page: page, //更新当前页数
})
_that.getProjectList()
}, },
/** /**

40
weapp/pages/index/index.wxml

@ -1,32 +1,14 @@
<!--pages/index/index.wxml--> <!--pages/index/index.wxml-->
<view> <map
<view class="searchFixed"> id="mapDom"
<view class="searchBoxs"> class="map"
<input class="searchInps" bindinput="formInp" bindconfirm="bindconfirm" value='{{keyName}}' type="text" placeholder="请输入结构物名称" /> markers="{{markers}}"
<button class="btnSearch" bindtap="goSearch">搜索</button> bindmarkertap="onMarkerTap"
>
<view class="action-box">
<view class="text flex-center" bind:tap="showCallout">数据</view>
<view class="img flex-center" bind:tap="onRefresh">
<image src="/images/refresh.svg"></image>
</view> </view>
</view> </view>
</map>
<view style="margin-top: 140rpx;">
<block wx:for="{{dataList}}" wx:key='*this'>
<view style="padding-bottom: 60rpx;">
<image wx:if="{{item.img != null && item.img.length > 0}}" style="width: 100%;height: 372rpx;display: block;" src="{{imgUrl + item.img[0]}}"></image>
<view wx:if="{{item.img == null || item.img.length == 0}}" style="width: 100%;height: 372rpx;line-height: 372rpx;text-align: center;background: #fff;border-bottom: 2rpx solid #ccc;">暂无图片</view>
<view class="box">
<view style="font-weight:bold;font-size:32rpx;">{{item.name}}</view>
<view style="font-size:28rpx;color: rgb(166,166,166);">
<view style=" margin-top:6rpx;">今日问题:<text>12</text></view>
<view style="float:left;width:360rpx;">未处理问题:<text>12</text></view>
<view style="float:left;width:350rpx;">已处理问题:<text>12</text></view>
</view>
</view>
</view>
</block>
</view>
<!-- 暂无数据 -->
<view hidden="{{hidden}}">
<image class="noData" src="../../images/noData.png"></image>
<view class="noTxt">暂无数据~</view>
</view>
</view>

82
weapp/pages/index/index.wxss

@ -1,70 +1,36 @@
/* pages/index/index.wxss */ /* pages/index/index.wxss */
page { .flex-center {
background: #F7F7FA; display: flex;
justify-content: center;
align-items: center;
} }
.searchBoxs { .map {
position: relative; width: 100vw;
margin: 20rpx 0rpx; height: 100vh;
height: 76rpx;
} }
.searchInps { .action-box {
background-color: #fff; position: absolute;
width: 542rpx; bottom: 30px;
height: 76rpx; right: 10px;
border-radius: 8rpx; width: 46px;
padding-left: 32rpx; height: 80px;
padding-right: 144rpx; display: flex;
border: 1px solid rgba(225, 225, 225, 0.44); flex-direction: column;
position: absolute; justify-content: space-evenly;
top: -2rpx;
left: 16rpx;
font-size: 28rpx;
} }
.btnSearch { .action-box .text {
width: 128rpx; background-color: white;
height: 68rpx; height: 30px;
line-height: 68rpx;
border-radius: 8rpx;
color: #fff;
font-size: 28rpx;
background: linear-gradient(180deg, #1979ff 0%, #1979ff 100%);
position: absolute;
top: 6rpx;
right: 28rpx;
z-index: 10;
} }
.searchFixed { .action-box .img {
position: fixed; background-color: white;
top: 0;
width: 100%;
background-color: #fff;
box-shadow: 0rpx -4rpx 20rpx #c2c2c2;
z-index: 10;
} }
.box { .action-box .img image {
padding: 20rpx; width: 30px;
box-shadow: 0rpx 10rpx 10rpx #ccc; height: 30px;
overflow: hidden;
line-height: 50rpx;
background: #fff;
}
/* 暂无数据 */
.noData {
width: 254rpx;
height: 298rpx;
display: block;
margin: 450rpx auto 16rpx;
}
.noTxt {
font-size: 30rpx;
color: #999;
font-weight: bold;
text-align: center;
} }

7
web/client/src/sections/issueHandle/components/isuue-handle-mdal.js

@ -178,6 +178,13 @@ export default (props) => {
value={editData?.patrolRecordIssueHandles[0]?.checkPerson?.name} value={editData?.patrolRecordIssueHandles[0]?.checkPerson?.name}
/> />
<ProFormText
name="checkPerson1"
label="成本(元):"
disabled={true}
value={editData?.patrolRecordIssueHandles[0]?.cost}
/>
<Form.Item label="完工图片:"> <Form.Item label="完工图片:">
<Uploads <Uploads
listType='picture-card' listType='picture-card'

Loading…
Cancel
Save