wenlele
2 years ago
28 changed files with 904 additions and 35 deletions
After Width: | Height: | Size: 668 B |
@ -0,0 +1,85 @@ |
|||
// package/inspectionRecord/inspectionRecord.js
|
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
ResList: [ //阅读状态
|
|||
{ |
|||
value: 'normal', |
|||
text: '正常', |
|||
}, |
|||
{ |
|||
value: 'abnormal', |
|||
text: '异常', |
|||
} |
|||
], |
|||
ResIndex: 0, //巡检结果
|
|||
dataList: [1, 2, 3, 4, 5,] |
|||
}, |
|||
|
|||
// 巡检结果
|
|||
bindPickerRes(e) { |
|||
let that = this; |
|||
that.setData({ |
|||
ResIndex: e.detail.value |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad(options) { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage() { |
|||
|
|||
} |
|||
}) |
@ -0,0 +1,6 @@ |
|||
{ |
|||
"navigationBarBackgroundColor": "#1979ff", |
|||
"navigationBarTextStyle": "white", |
|||
"navigationBarTitleText": "巡检记录", |
|||
"enablePullDownRefresh": false |
|||
} |
@ -0,0 +1,40 @@ |
|||
<!--package/inspectionRecord/inspectionRecord.wxml--> |
|||
<view style="box-shadow:0px 0px 5px #7e7e7e;padding: 15px;background: #fff;position:fixed;top:0;left:0;width: 100%;"> |
|||
<view style="display: flex;"> |
|||
<view style="line-height:50rpx;">时间范围:</view> |
|||
<view style="display: flex;"> |
|||
<view style="border:2rpx solid #ccc;padding:6rpx 16rpx;margin-right:20rpx;border-radius:6rpx;">2022-12-15</view> |
|||
<view style="line-height: 55rpx;">至</view> |
|||
<view style="border:2rpx solid #ccc;padding:6rpx 16rpx;margin-left:20rpx;border-radius:6rpx;">2022-12-26</view> |
|||
</view> |
|||
</view> |
|||
<view style='display:flex;margin-top:28rpx;'> |
|||
<view style="line-height: 55rpx;">巡检结果:</view> |
|||
<picker class='my-picker' bindchange="bindPickerRes" value="{{ResIndex}}" rangeKey='text' range='{{ResList}}' style="border:2rpx solid #ccc;padding:6rpx 20rpx;border-radius: 6rpx;"> |
|||
{{ResList[ResIndex].text}} |
|||
<image style="width:20rpx;height:20rpx;margin-left:10rpx;" src="../../images/down.svg" /> |
|||
</picker> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="contentBox"> |
|||
<block wx:for="{{dataList}}" wx:key='*this'> |
|||
<view class="listBox"> |
|||
<view style="padding-bottom:40rpx;overflow: hidden;"> |
|||
<view class="titleBox" style="width: 630rpx; margin: 0 auto;"> |
|||
<view class="title">结构物A</view> |
|||
</view> |
|||
<view style="line-height:50rpx;font-size:28rpx;width: 630rpx; margin: 0 auto;"> |
|||
本次巡检日期:<text>2022-12-21 17:00</text> |
|||
</view> |
|||
<view style="line-height:50rpx;font-size:28rpx;width: 630rpx; margin: 0 auto;"> |
|||
巡检人:<text>巡检人</text> |
|||
</view> |
|||
<view style="line-height:50rpx;font-size:28rpx;width: 630rpx; margin: 0 auto;"> |
|||
巡检结果:<text>异常</text> |
|||
</view> |
|||
<view class="btn" bindtap="bindStart">查看详情</view> |
|||
</view> |
|||
</view> |
|||
</block> |
|||
</view> |
@ -0,0 +1,47 @@ |
|||
/* package/inspectionRecord/inspectionRecord.wxss */ |
|||
page{ |
|||
background: #F7F7FA; |
|||
} |
|||
|
|||
.my-picker { |
|||
white-space: nowrap; |
|||
width: 100rpx; |
|||
} |
|||
|
|||
.contentBox { |
|||
padding: 210rpx 30rpx 20rpx; |
|||
} |
|||
|
|||
.listBox { |
|||
background-color: #fff; |
|||
border-radius: 10rpx; |
|||
box-shadow: 0rpx 0rpx 10rpx #ddd; |
|||
margin: 30rpx auto; |
|||
overflow: hidden; |
|||
} |
|||
|
|||
.titleBox { |
|||
overflow: hidden; |
|||
padding-bottom: 20rpx; |
|||
padding-top: 40rpx; |
|||
} |
|||
|
|||
.title { |
|||
float: left; |
|||
font-size: 32rpx; |
|||
width: 460rpx; |
|||
font-weight: bold; |
|||
} |
|||
|
|||
.btn { |
|||
width: 130rpx; |
|||
text-align: center; |
|||
font-size: 30rpx; |
|||
padding: 20rpx; |
|||
background: #1979ff; |
|||
color: #fff; |
|||
border-radius: 10rpx; |
|||
float: left; |
|||
margin-left: 30rpx; |
|||
margin-top: 20rpx; |
|||
} |
@ -0,0 +1,138 @@ |
|||
// package/startInspection/startInspection.js
|
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
dataList: [1, 2, 3] |
|||
}, |
|||
|
|||
handleChangeTwo(e) { |
|||
this.setData({ |
|||
changeTwo: e.detail.value |
|||
}) |
|||
}, |
|||
|
|||
handleChangeThree(e) { |
|||
this.setData({ |
|||
changeThree: e.detail.value |
|||
}) |
|||
}, |
|||
|
|||
showModal() { |
|||
this.setData({ |
|||
showModal: true |
|||
}) |
|||
}, |
|||
|
|||
bindCancel() { |
|||
this.setData({ |
|||
showModal: false |
|||
}) |
|||
}, |
|||
|
|||
selfLocation() { |
|||
const self = this |
|||
wx.showLoading({ |
|||
title: '定位中', |
|||
mask: true, |
|||
}); |
|||
wx.getLocation({ |
|||
type: 'gcj02', |
|||
success: (res) => { |
|||
let latitude, longitude; |
|||
latitude = res.latitude.toString(); |
|||
longitude = res.longitude.toString(); |
|||
this.latitude = res.latitude |
|||
this.longitude = res.longitude |
|||
getGeocoder({ lat: latitude, long: longitude }).then(res => { // 获取详细信息的接口
|
|||
const data = res.data; |
|||
self.userAddress.userAddressdetail = '' |
|||
var params = { |
|||
text: data.address |
|||
} |
|||
parseAddress(params).then(res => { // 粘贴详细信息的接口
|
|||
console.log(res) |
|||
if (res.status == 200 && res.message == "success") { |
|||
this.$forceUpdate(); // 定位后,界面没有反应,因此加上强制刷新
|
|||
this.userAddress.userAddressdetail = res.data.town + res.data.detail; |
|||
this.$set(this.userAddress, 'selectAddress', parseInt(res.data.county_info.city_id)); |
|||
this.addressInfo[0] = res.data.province_info ? res.data.province_info : {}; |
|||
this.addressInfo[1] = res.data.city_info ? res.data.city_info : {}; |
|||
this.addressInfo[2] = res.data.county_info ? res.data.county_info : {}; |
|||
} |
|||
}).catch(res => { |
|||
console.log("没有地址信息") |
|||
}) |
|||
wx.hideLoading(); |
|||
}) |
|||
}, |
|||
fail: (res) => { |
|||
console.log(res) |
|||
wx.hideLoading(); |
|||
wx.showToast({ |
|||
title: res.errMsg, |
|||
icon: 'none', |
|||
duration: 1000 |
|||
}); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad(options) { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage() { |
|||
|
|||
} |
|||
}) |
@ -0,0 +1,6 @@ |
|||
{ |
|||
"navigationBarBackgroundColor": "#1979ff", |
|||
"navigationBarTextStyle": "white", |
|||
"navigationBarTitleText": "开始巡检", |
|||
"enablePullDownRefresh": false |
|||
} |
@ -0,0 +1,87 @@ |
|||
<!--package/startInspection/startInspection.wxml--> |
|||
<view class="box"> |
|||
<view class="titleFirst">巡检要求</view> |
|||
<view class="txt"> |
|||
<view style="float: left;font-weight: bold;">结构物名称</view> |
|||
<view style="float:left;width:70%;margin-left:40rpx;">结构物名称</view> |
|||
</view> |
|||
<view class="txt"> |
|||
<view style="float: left;font-weight: bold;">开始时间</view> |
|||
<view style="float:left;width:70%;margin-left:40rpx;">2022-12-25</view> |
|||
</view> |
|||
<view class="txt"> |
|||
<view style="float: left;font-weight: bold;">结束时间</view> |
|||
<view style="float:left;width:70%;margin-left:40rpx;">2023-01-15</view> |
|||
</view> |
|||
<view class="txt"> |
|||
<view style="float: left;font-weight: bold;">巡检方式</view> |
|||
<view style="float:left;width:70%;margin-left:40rpx;">周期巡检</view> |
|||
</view> |
|||
<view class="txt"> |
|||
<view style="float: left;font-weight: bold;">巡检频次</view> |
|||
<view style="float:left;width:70%;margin-left:40rpx;">3天一次</view> |
|||
</view> |
|||
<view class="txt"> |
|||
<view style="float: left;font-weight: bold;">巡检人</view> |
|||
<view style="float:left;width:70%;margin-left:40rpx;">巡检人</view> |
|||
</view> |
|||
<view class="txt"> |
|||
<view style="float: left;font-weight: bold;">巡检单位</view> |
|||
<view style="float:left;width:70%;margin-left:40rpx;">巡检单位</view> |
|||
</view> |
|||
<view class="txt"> |
|||
<view style="float: left;font-weight: bold;">巡检点位</view> |
|||
<view style="float:left;width:70%;margin-left:40rpx;">点位A、点位B、点位C</view> |
|||
</view> |
|||
<view class="line"></view> |
|||
<view class="titleFirst">巡检结果录入</view> |
|||
<block wx:for="{{dataList}}" wx:key="*this"> |
|||
<view style="margin-bottom: 60rpx;"> |
|||
<view class="txt" style="margin-bottom: 20rpx;"> |
|||
<view style="float: left;font-weight: bold;">巡检点位</view> |
|||
<view style="float:left;width:55%;margin-left:40rpx;">点位A</view> |
|||
<view class="startBtn" bindtap="showModal">开始巡检</view> |
|||
</view> |
|||
<view class="txt" style="margin-bottom: 20rpx;"> |
|||
<view style="float: left;font-weight: bold;">上次巡检日期</view> |
|||
<view style="float:left;width:55%;margin-left:40rpx;">2022-10-26</view> |
|||
</view> |
|||
<view class="txt" style="margin-bottom: 20rpx;"> |
|||
<view style="float: left;font-weight: bold;">巡检人</view> |
|||
<view style="float:left;width:55%;margin-left:40rpx;">巡检人A</view> |
|||
</view> |
|||
<view class="txt" style="margin-bottom: 20rpx;"> |
|||
<view style="float: left;font-weight: bold;">本次巡检日期</view> |
|||
<view style="float:left;width:55%;margin-left:40rpx;">2022-12-23</view> |
|||
</view> |
|||
</view> |
|||
</block> |
|||
|
|||
<view class="modal" wx:if="{{showModal}}"> |
|||
<view class="popBox"> |
|||
<view style="padding:20rpx 30rpx;overflow: hidden;"> |
|||
<view style="float: left;">当前点位:</view> |
|||
<view style="float:left;width: 75%;">点位A</view> |
|||
</view> |
|||
<view style="padding:20rpx 30rpx;overflow: hidden;"> |
|||
<view style="float: left;">当前位置:</view> |
|||
<view style="float:left;width: 75%;">点位A</view> |
|||
</view> |
|||
<radio-group style="padding:10px 15px;display:flex;justify-content: space-evenly;" bindchange="handleChangeTwo"> |
|||
<radio style="color:#1979ff;" color="#1979ff" value="normal">正常</radio> |
|||
<radio style="color:#CC0000;" color="#CC0000" value="abnormal">异常</radio> |
|||
</radio-group> |
|||
<textarea style="width: 84%;margin:0 auto;border:2rpx solid #ccc;padding:20rpx;height: 120rpx;border-radius: 10rpx;" placeholder="请输入巡查详情" maxlength="-1" wx:if="{{changeTwo == 'abnormal'}}"></textarea> |
|||
<radio-group style="padding:10px 15px;display:flex;justify-content: space-evenly;" bindchange="handleChangeThree" wx:if="{{changeTwo == 'abnormal'}}"> |
|||
<radio style="color:#FF9900;" color="#FF9900" value="slight">轻微</radio> |
|||
<radio style="color:#FF3300;" color="#FF3300" value="moderate">中度</radio> |
|||
<radio style="color:#990000;" color="#990000" value="severity">严重</radio> |
|||
</radio-group> |
|||
<view class="btnBox"> |
|||
<view class="cancel" bindtap="bindCancel">取消</view> |
|||
<view class="submit">提交</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
</view> |
@ -0,0 +1,85 @@ |
|||
/* package/startInspection/startInspection.wxss */ |
|||
.box { |
|||
width: 696rpx; |
|||
margin: 0 auto; |
|||
padding: 30rpx 0; |
|||
} |
|||
|
|||
.titleFirst { |
|||
font-size: 32rpx; |
|||
margin-bottom: 30rpx; |
|||
} |
|||
|
|||
.txt { |
|||
width: 100%; |
|||
overflow: hidden; |
|||
margin-bottom: 40rpx; |
|||
color: #333; |
|||
font-size: 28rpx; |
|||
} |
|||
|
|||
.line { |
|||
width: 100%; |
|||
height: 2rpx; |
|||
background: #ccc; |
|||
margin-bottom: 40rpx; |
|||
} |
|||
|
|||
.startBtn { |
|||
float: right; |
|||
padding: 10rpx 20rpx; |
|||
background: #1979ff; |
|||
color: #fff; |
|||
border-radius: 10rpx; |
|||
font-size: 26rpx; |
|||
} |
|||
|
|||
.modal { |
|||
background: rgba(0, 0, 0, 0.6); |
|||
width: 100%; |
|||
position: fixed; |
|||
top: 0; |
|||
left: 0; |
|||
z-index: 10; |
|||
height: 100%; |
|||
} |
|||
|
|||
.popBox { |
|||
position: absolute; |
|||
top: 50%; |
|||
left: 50%; |
|||
z-index: 1000; |
|||
background: #fff; |
|||
width: 95%; |
|||
margin-left: -356rpx; |
|||
margin-top: -500rpx; |
|||
padding: 20rpx 0; |
|||
} |
|||
|
|||
.btnBox { |
|||
padding: 30rpx; |
|||
overflow: hidden; |
|||
font-size: 30rpx; |
|||
} |
|||
|
|||
.cancel { |
|||
width: 180rpx; |
|||
float: left; |
|||
text-align: center; |
|||
background: #fff; |
|||
border: 2rpx solid #1979ff; |
|||
border-radius: 10rpx; |
|||
padding: 12rpx 0; |
|||
color: #1979ff; |
|||
} |
|||
|
|||
.submit { |
|||
width: 180rpx; |
|||
float: right; |
|||
text-align: center; |
|||
border-radius: 10rpx; |
|||
padding: 12rpx 0; |
|||
background: #1979ff; |
|||
color: #fff; |
|||
border: 2rpx solid #1979ff; |
|||
} |
@ -0,0 +1,7 @@ |
|||
'use strict'; |
|||
|
|||
import * as plan from './plan' |
|||
|
|||
export default { |
|||
...plan, |
|||
} |
@ -0,0 +1,46 @@ |
|||
'use strict'; |
|||
|
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
export function getPatrolPlan() { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_PATROL_PLAN', |
|||
url: ApiTable.patrolPlan, |
|||
msg: { error: '获取巡检计划失败' }, |
|||
}); |
|||
} |
|||
|
|||
export function createPatrolPlan(data) { |
|||
return dispatch => basicAction({ |
|||
type: 'post', |
|||
data, |
|||
dispatch: dispatch, |
|||
actionType: 'CREATE_PATROL_PLAN', |
|||
url: ApiTable.patrolPlan, |
|||
msg: { error: '新增巡检计划失败' }, |
|||
}); |
|||
} |
|||
|
|||
export function delPatrolPlan(id) { |
|||
return dispatch => basicAction({ |
|||
type: 'del', |
|||
dispatch: dispatch, |
|||
actionType: 'DEL_PATROL_PLAN', |
|||
url: ApiTable.delPatrolPlan.replace('{id}', id), |
|||
msg: { error: '删除巡检计划失败' }, |
|||
}); |
|||
} |
|||
|
|||
export function updatePatrolPlan(data) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
data, |
|||
dispatch: dispatch, |
|||
actionType: 'UPDATE_PATROL_PLAN', |
|||
url: ApiTable.patrolPlan, |
|||
msg: { error: '修改巡检计划失败' }, |
|||
}); |
|||
} |
@ -0,0 +1,72 @@ |
|||
import { Button, Form, Input, Modal } from 'antd'; |
|||
import React, { useState } from 'react'; |
|||
|
|||
const UserModal = ({ visible, onCreate, onCancel }) => { |
|||
const [form] = Form.useForm(); |
|||
const reg_tel = /^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/; |
|||
return ( |
|||
<Modal |
|||
visible={visible} |
|||
title="新建用户" |
|||
okText="新建" |
|||
cancelText="取消" |
|||
onCancel={() => { |
|||
form.resetFields(); |
|||
onCancel(); |
|||
}} |
|||
onOk={() => { |
|||
form |
|||
.validateFields() |
|||
.then((values) => { |
|||
form.resetFields(); |
|||
onCreate(values); |
|||
}) |
|||
.catch((info) => { |
|||
console.log('Validate Failed:', info); |
|||
}); |
|||
}} |
|||
> |
|||
<Form |
|||
form={form} |
|||
layout="vertical" |
|||
name="form_in_modal" |
|||
initialValues={{ |
|||
modifier: 'public', |
|||
}} |
|||
> |
|||
<Form.Item |
|||
name="name" |
|||
label="姓名" |
|||
rules={[ |
|||
{ required: true, message: '请输入姓名' }, |
|||
{ max: 24, message: '姓名不能大于24个字符' }, |
|||
]} |
|||
> |
|||
<Input /> |
|||
</Form.Item> |
|||
<Form.Item |
|||
name="phone" |
|||
label="用户名(手机号)" |
|||
rules={[ |
|||
{ required: true, message: '请输入正确的手机号' }, |
|||
{ pattern: reg_tel, message: '请输入正确的手机号' }, |
|||
]} |
|||
> |
|||
<Input /> |
|||
</Form.Item> |
|||
<Form.Item |
|||
name="password" |
|||
label="密码" |
|||
rules={[ |
|||
{ required: true, message: '请填写密码' }, |
|||
{ min: 6, message: '请填写至少6位密码' }, |
|||
]} |
|||
> |
|||
<Input type="password" /> |
|||
</Form.Item> |
|||
</Form> |
|||
</Modal> |
|||
); |
|||
}; |
|||
|
|||
export default UserModal; |
@ -0,0 +1,5 @@ |
|||
'use strict'; |
|||
|
|||
import PatrolPlan from './patrolPlan'; |
|||
|
|||
export { PatrolPlan }; |
@ -0,0 +1,131 @@ |
|||
import React, { useState, useRef } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Button, Popconfirm } from 'antd'; |
|||
import ProTable from '@ant-design/pro-table'; |
|||
import UserModal from '../components/userModal'; |
|||
import { createPatrolPlan, delPatrolPlan, updatePatrolPlan, getPatrolPlan } from '../actions/plan'; |
|||
|
|||
function PatrolPlan(props) { |
|||
const { dispatch, user } = props; |
|||
const tableRef = useRef(); |
|||
const [dataSource, setDataSource] = useState([{}]); |
|||
const [visible, setVisible] = useState(false); |
|||
|
|||
const onCreate = (values) => { |
|||
console.log(values, 'values') |
|||
// dispatch(createEarthquakeUser(values)).then(res => {
|
|||
// if (res.success) {
|
|||
// tableRef.current.reload();
|
|||
// }
|
|||
// })
|
|||
// setVisible(false);
|
|||
}; |
|||
|
|||
const columns = [{ |
|||
title: '结构物名称', |
|||
dataIndex: 'struName', |
|||
key: 'struName', |
|||
ellipsis: true |
|||
}, { |
|||
title: '巡检任务名称', |
|||
dataIndex: 'name', |
|||
key: 'name', |
|||
ellipsis: true |
|||
}, { |
|||
title: '开始时间', |
|||
dataIndex: 'startTime', |
|||
key: 'startTime', |
|||
ellipsis: true, |
|||
}, { |
|||
title: '结束时间', |
|||
dataIndex: 'endTime', |
|||
key: 'endTime', |
|||
ellipsis: true, |
|||
}, { |
|||
title: '巡检频次', |
|||
dataIndex: 'frequency', |
|||
key: 'frequency', |
|||
ellipsis: true, |
|||
}, { |
|||
title: '巡检点位', |
|||
dataIndex: 'patrolPoints', |
|||
key: 'patrolPoints', |
|||
ellipsis: true, |
|||
}, { |
|||
title: '巡检人', |
|||
dataIndex: 'patrolPerson', |
|||
key: 'patrolPerson', |
|||
ellipsis: true, |
|||
render: (_, record) => <div></div> |
|||
}, { |
|||
title: '巡检次数统计', |
|||
dataIndex: 'patrolCount', |
|||
key: 'patrolCount', |
|||
ellipsis: true, |
|||
}, { |
|||
title: '操作', |
|||
dataIndex: 'action', |
|||
key: 'action', |
|||
search: false, |
|||
render: (_, record) => { |
|||
return <> |
|||
<Button type="link">修改</Button> |
|||
<Button type="link">查看</Button> |
|||
<Popconfirm |
|||
title="确认删除?" |
|||
onConfirm={() => { |
|||
dispatch(delPatrolPlan(record.id)).then(res => { |
|||
if (res.success) { |
|||
tableRef.current.reload(); |
|||
} |
|||
}) |
|||
}}> |
|||
<Button type="link" danger>删除</Button> |
|||
</Popconfirm> |
|||
</> |
|||
}, |
|||
}]; |
|||
|
|||
return ( |
|||
<> |
|||
<ProTable |
|||
columns={columns} |
|||
actionRef={tableRef} |
|||
options={false} |
|||
dataSource={dataSource || []} |
|||
rowKey='id' |
|||
pagination={{ pageSize: 10 }} |
|||
search={false} |
|||
request={async (params = {}) => { |
|||
const res = await dispatch(getPatrolPlan(params)); |
|||
console.log(res, 'res') |
|||
setDataSource(res?.payload.data?.rows); |
|||
return { ...res }; |
|||
}} |
|||
onReset={() => { }} |
|||
toolBarRender={() => [ |
|||
<Button |
|||
type="primary" |
|||
key="primary" |
|||
onClick={() => { setVisible(true) }} |
|||
>新增巡检计划</Button> |
|||
]} |
|||
/> |
|||
<UserModal |
|||
visible={visible} |
|||
onCreate={onCreate} |
|||
onCancel={() => { |
|||
setVisible(false); |
|||
}} |
|||
/> |
|||
</> |
|||
) |
|||
} |
|||
|
|||
function mapStateToProps(state) { |
|||
const { auth } = state |
|||
return { |
|||
user: auth.user |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(PatrolPlan); |
@ -0,0 +1,15 @@ |
|||
'use strict'; |
|||
|
|||
import reducers from './reducers'; |
|||
import routes from './routes'; |
|||
import actions from './actions'; |
|||
import { getNavItem } from './nav-item'; |
|||
|
|||
export default { |
|||
key: 'patrolManage', |
|||
name: '', |
|||
reducers: reducers, |
|||
routes: routes, |
|||
actions: actions, |
|||
getNavItem: getNavItem |
|||
}; |
@ -0,0 +1,19 @@ |
|||
import React from 'react'; |
|||
import { Link } from 'react-router-dom'; |
|||
import { Menu } from 'antd'; |
|||
import { SettingOutlined } from '@ant-design/icons'; |
|||
|
|||
const SubMenu = Menu.SubMenu; |
|||
|
|||
export function getNavItem(user, dispatch) { |
|||
// if (!Func.isAuthorized("ORG_MANAGE")) {
|
|||
// return null
|
|||
// }
|
|||
return ( |
|||
<SubMenu key="patrolManage" icon={<SettingOutlined />} title={'巡检管理'}> |
|||
<Menu.Item key="patrolPlan"> |
|||
<Link to="/patrolManage/patrolPlan">巡检计划制定</Link> |
|||
</Menu.Item> |
|||
</SubMenu> |
|||
); |
|||
} |
@ -0,0 +1,5 @@ |
|||
'use strict'; |
|||
|
|||
export default { |
|||
|
|||
}; |
@ -0,0 +1,17 @@ |
|||
'use strict'; |
|||
import { PatrolPlan } from './containers'; |
|||
|
|||
export default [{ |
|||
type: 'inner', |
|||
route: { |
|||
path: '/patrolManage', |
|||
key: 'patrolManage', |
|||
breadcrumb: '巡检管理', |
|||
childRoutes: [{ |
|||
path: '/patrolPlan', |
|||
key: 'patrolPlan', |
|||
component: PatrolPlan, |
|||
breadcrumb: '巡检计划制定', |
|||
}] |
|||
} |
|||
}]; |
Loading…
Reference in new issue