Browse Source

feat:1.6漏交

master
zhaobing’ 1 year ago
parent
commit
2e0032dd54
  1. 70
      weapp/pages/home/home.js
  2. 2
      weapp/pages/home/home.wxml
  3. 2
      weapp/pages/index/index.js
  4. 2
      weapp/pages/workbench/workbench.js
  5. 5
      weapp/utils/getApiUrl.js
  6. 11
      web/client/src/sections/patrolManage/actions/report.js
  7. 134
      web/client/src/sections/patrolManage/containers/patrolReport.js
  8. 9
      web/client/src/sections/projectRegime/containers/information.js
  9. 1
      web/client/src/utils/webapi.js

70
weapp/pages/home/home.js

@ -29,47 +29,47 @@ Page({
markers: [], markers: [],
pageHeight:0,//屏幕高度 pageHeight:0,//屏幕高度
isShowCallout: false, isShowCallout: false,
itemList:[{ itemList:[
picPath:'/images/conduct.png', {
itemName:'指挥中心' picPath:'/images/gas.png',
}, itemName:'燃气仓'
{ },
picPath:'/images/waterSupply.png', {
itemName:'给水仓' picPath:'/images/waterSupply.png',
}, itemName:'给水仓'
{ },
picPath:'/images/pipeGallery.png', {
itemName:'管廊本体' picPath:'/images/electricalStorageRoom.png',
}, itemName:'电气仓'
{ },
picPath:'/images/elevator.png', {
itemName:'电梯系统' picPath:'/images/highTension.png',
}, itemName:'高压电力仓'
{ },
picPath:'/images/power.png', {
itemName:'供配电系统' picPath:'/images/pipeGallery.png',
}, itemName:'管廊本体'
{ },
picPath:'/images/gas.png', {
itemName:'燃气仓' picPath:'/images/conduct.png',
}, itemName:'指挥中心'
},
{
picPath:'/images/power.png',
itemName:'供配电系统'
},
{
picPath:'/images/elevator.png',
itemName:'电梯系统'
},
{ {
picPath:'/images/security.png', picPath:'/images/security.png',
itemName:'安防系统' itemName:'安防系统'
}, },
{
picPath:'/images/highTension.png',
itemName:'高压电力仓'
},
{
picPath:'/images/electricalStorageRoom.png',
itemName:'电气仓'
},
{ {
picPath:'/images/lightningProtection.png', picPath:'/images/lightningProtection.png',
itemName:'防雷与接地' itemName:'防雷与接地'
} }
], ],
}, },
@ -96,13 +96,13 @@ Page({
}; };
wx.showLoading({ title: '加载中' }) wx.showLoading({ title: '加载中' })
const date1 = new Date('1970-01-01 00:00:00'); const date1 = new Date('1970-01-01 00:00:00');
promiseArr.push(Request.get(getPatrolRecord('all', moment(date1).format('YYYY-MM-DD') + ' 00:00:00', moment('2099-12-31').format('YYYY-MM-DD') + ' 23:59:59', 'null', 'null'))); promiseArr.push(Request.get(getPatrolRecord('all', moment(date1).format('YYYY-MM-DD') + ' 00:00:00', moment('2099-12-31').format('YYYY-MM-DD') + ' 23:59:59', 'null', 'null',{home:true})));
Promise.all(promiseArr).then(res => { Promise.all(promiseArr).then(res => {
wx.hideLoading() wx.hideLoading()
//与自己相关的所有巡检记录 //与自己相关的所有巡检记录
let list=res[0] let list=res[0]
if(userInfo.username!=='SuperAdmin'){ if(userInfo.username!=='SuperAdmin'){
list=res[0]?.filter(item=> userInfo.structure.find((x) => x === item.points.project.id))||[] list=res[0]?.filter(item=> userInfo.structure.find((x) => x === item.project_id))||[]
} }
//过去七天的所有巡检记录 //过去七天的所有巡检记录
const sevenDaysList=list?.filter(item=> const sevenDaysList=list?.filter(item=>

2
weapp/pages/home/home.wxml

@ -61,7 +61,7 @@
</view> </view>
</view> </view>
<view style="display: flex; justify-content: space-around;"> <view style="display: flex; justify-content: space-around;">
<view class="flex"> <view class="flex" bindtap="jumpToRiskCalendar">
<view style="margin:10px 0px;" class="only">发现问题个数</view> <view style="margin:10px 0px;" class="only">发现问题个数</view>
<view style="margin:10px 0px;"><text class="fontStyle">{{allQuestionCount}}</text></view> <view style="margin:10px 0px;"><text class="fontStyle">{{allQuestionCount}}</text></view>
<view style="margin:10px 0px;" class="only"> 个</view> <view style="margin:10px 0px;" class="only"> 个</view>

2
weapp/pages/index/index.js

@ -47,7 +47,7 @@ Page({
wx.showLoading({ title: '加载中' }) wx.showLoading({ title: '加载中' })
const promiseArr = []; const promiseArr = [];
promiseArr.push(Request.get(getProjectList(), {})); promiseArr.push(Request.get(getProjectList(), {}));
promiseArr.push(Request.get(getPatrolRecord('all', moment().format('YYYY-MM-DD') + ' 00:00:00', moment().format('YYYY-MM-DD') + ' 23:59:59', 'null', 'null'))); promiseArr.push(Request.get(getPatrolRecord('all', moment().format('YYYY-MM-DD') + ' 00:00:00', moment().format('YYYY-MM-DD') + ' 23:59:59', 'null', 'null',{home:false})));
Promise.all(promiseArr).then(res => { Promise.all(promiseArr).then(res => {
wx.hideLoading() wx.hideLoading()
that.setData({ that.setData({

2
weapp/pages/workbench/workbench.js

@ -33,7 +33,7 @@ Page({
}, },
{ {
iconPath: '/images/workbench/issues.png', iconPath: '/images/workbench/issues.png',
text: '发现问题', text: '巡检指派',
page: '/package/report/report' page: '/package/report/report'
}, },
{ {

5
weapp/utils/getApiUrl.js

@ -40,8 +40,9 @@ exports.reportQuest = () => {
// 获取巡检记录 // 获取巡检记录
exports.getPatrolRecord = (patrolPlanId, startTime, endTime, alarm, pointId) => { exports.getPatrolRecord = (patrolPlanId, startTime, endTime, alarm, pointId,query) => {
return `/patrolRecord/${patrolPlanId}/${startTime}/${endTime}/${alarm}/${pointId}` const {home } = query
return `/patrolRecord/${patrolPlanId}/${startTime}/${endTime}/${alarm}/${pointId}?home=${home}`
} }
//设备 //设备
exports.getDevices = () => { exports.getDevices = () => {

11
web/client/src/sections/patrolManage/actions/report.js

@ -13,3 +13,14 @@ export function getPatrolReport (query) {
msg: { error: '获取巡检报告失败' }, msg: { error: '获取巡检报告失败' },
}); });
} }
export function delpatrolRecord (id) {
return dispatch => basicAction({
type: 'delete',
dispatch: dispatch,
actionType: 'DEL_PATROL_RECORD',
url: ApiTable.delpatrolRecord.replace('{id}', id),
msg: { error: '删除巡检报告失败' },
})
}

134
web/client/src/sections/patrolManage/containers/patrolReport.js

@ -1,6 +1,6 @@
import React, { useState, useRef, useEffect } from 'react'; import React, { useState, useRef, useEffect } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Button, Tabs, Popconfirm, Tooltip,Spin } from 'antd'; import { Button, Tabs, Popconfirm, Tooltip, Spin } from 'antd';
import ProTable from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table';
import { getPatrolReport } from '../actions/report'; import { getPatrolReport } from '../actions/report';
import { getProjectList } from '../actions/plan'; import { getProjectList } from '../actions/plan';
@ -8,20 +8,20 @@ import moment from 'moment';
import AddReportRulesModal from '../components/addReportRulesModal'; import AddReportRulesModal from '../components/addReportRulesModal';
function patrolReport(props) { function patrolReport(props) {
const { dispatch, actions } = props; const { dispatch, actions } = props;
const { projectRegime, patrolManage } = actions const { projectRegime, patrolManage } = actions
const tableRef = useRef(); const tableRef = useRef();
const tableRef2 = useRef(); const tableRef2 = useRef();
const [selectOpts, setSelectOpts] = useState([]); const [selectOpts, setSelectOpts] = useState([]);
const [date, setDate] = useState([moment().subtract(1, 'days'), moment()]); const [date, setDate] = useState([moment().subtract(1, 'days'), moment()]);
const [dataSource, setDataSource] = useState([]); const [dataSource, setDataSource] = useState([]);
const [modalVis, setModalVis] = useState(false) const [modalVis, setModalVis] = useState(false)
const [structAll,setStructAll]=useState([])//完整的结构物列表(包括subType) const [structAll, setStructAll] = useState([])//完整的结构物列表(包括subType)
const [reportList, setReportList] = useState([])//报表 const [reportList, setReportList] = useState([])//报表
const qnDomain = localStorage.getItem('qnDomain'); const qnDomain = localStorage.getItem('qnDomain');
const [query, setQuery] = useState({ limit: 10, page: 0 }) const [query, setQuery] = useState({ limit: 10, page: 0 })
const [typeList, setTypeList] = useState([{ value: 1, label: '周报表' }, { value: 2, label: '月报表' }]) const [typeList, setTypeList] = useState([{ value: 1, label: '周报表' }, { value: 2, label: '月报表' }])
const [modalData, setModalData] = useState(null) const [modalData, setModalData] = useState(null)
const [loading,setLoading]=useState(false) const [loading, setLoading] = useState(false)
//报表配置 //报表配置
// const getReportConfig = (query) => { // const getReportConfig = (query) => {
// const { limit, page, name } = query // const { limit, page, name } = query
@ -72,26 +72,32 @@ function patrolReport(props) {
} }
}) })
} }
const generateReport=(record)=>{ const generateReport = (record) => {
setLoading(true) setLoading(true)
let data={ let data = {
reportName:record?.name, reportName: record?.name,
startTime:moment(record?.startTime).format('YYYY-MM-DD HH:mm:ss'), startTime: moment(record?.startTime).format('YYYY-MM-DD HH:mm:ss'),
endTime:moment(record?.endTime).format('YYYY-MM-DD HH:mm:ss'), endTime: moment(record?.endTime).format('YYYY-MM-DD HH:mm:ss'),
structIds:record?.structure, structIds: record?.structure,
structNames:structAll?.filter(item=>record?.structure.some(q=>q==item.id))?.map(o=>o.name)||[], structNames: structAll?.filter(item => record?.structure.some(q => q == item.id))?.map(o => o.name) || [],
reportType:record?.type, reportType: record?.type,
system:record?.system, system: record?.system,
images:record?.reportpic.map(item=>qnDomain+'/'+item)||[] images: record?.reportpic.map(item => qnDomain + '/' + item) || []
} }
dispatch(patrolManage.postGenerateReport(data)).then(res => { dispatch(patrolManage.postGenerateReport(data)).then(res => {
if(res.success){ if (res.success) {
setLoading(false) setLoading(false)
tableRef.current.reload(); tableRef.current.reload();
} }
}) })
} }
//删除巡检记录
const delReport = (id) => {
}
const columns = [{ const columns = [{
title: '结构物名称', title: '结构物名称',
dataIndex: 'projectName', dataIndex: 'projectName',
@ -104,13 +110,12 @@ function patrolReport(props) {
}, },
ellipsis: true, ellipsis: true,
width: 150, width: 150,
render: (_, record) => render: (_, record) => {
{ const rslt = structAll?.filter(p => record.structure?.some(q => q == p.id))
const rslt=structAll?.filter(p => record.structure?.some(q => q == p.id))
return <> return <>
<div>{record?.project?record?.project?.name: record.structure?.length > 1 ? <Tooltip title={rslt?.map(item => item.name)?.join(',')}> <div>{record?.project ? record?.project?.name : record.structure?.length > 1 ? <Tooltip title={rslt?.map(item => item.name)?.join(',')}>
<span>{rslt&&rslt.length?rslt[0].name+'...':''}</span> <span>{rslt && rslt.length ? rslt[0].name + '...' : ''}</span>
</Tooltip> : rslt?.map(item => item.name)?.join(',') </Tooltip> : rslt?.map(item => item.name)?.join(',')
}</div> }</div>
</> </>
@ -129,7 +134,7 @@ function patrolReport(props) {
return <div>{fileName}</div> return <div>{fileName}</div>
} }
}, { }, {
title: '巡检日期', title: '生成日期',
dataIndex: 'date', dataIndex: 'date',
key: 'date', key: 'date',
valueType: 'dateRange', valueType: 'dateRange',
@ -155,6 +160,19 @@ function patrolReport(props) {
}}>预览</Button> }}>预览</Button>
{/* onClick={() => { window.open() }} */} {/* onClick={() => { window.open() }} */}
<a href={'/_file-server' + '/' + record?.excelPath}>下载</a> <a href={'/_file-server' + '/' + record?.excelPath}>下载</a>
<Popconfirm
placement='left'
title={`确定删除?`}
onConfirm={() => {
dispatch(patrolManage.delpatrolRecord(record?.id)).then(res=>{
if(res.success){
tableRef.current.reload();
}
})
}}
>
<Button type="link">删除</Button>
</Popconfirm>
</> </>
}, },
}]; }];
@ -192,10 +210,10 @@ function patrolReport(props) {
search: false, search: false,
width: 250, width: 250,
render: (_, record) => { render: (_, record) => {
const rslt=structAll?.filter(p => record.structure?.some(q => q == p.id)) const rslt = structAll?.filter(p => record.structure?.some(q => q == p.id))
return <> return <>
{record.structure.length > 1 ? <Tooltip title={rslt?.map(item => item.name)?.join(',')}> {record.structure.length > 1 ? <Tooltip title={rslt?.map(item => item.name)?.join(',')}>
<span>{rslt&&rslt.length?rslt[0].name+'...':''}</span> <span>{rslt && rslt.length ? rslt[0].name + '...' : ''}</span>
</Tooltip> : rslt?.map(item => item.name)?.join(',')} </Tooltip> : rslt?.map(item => item.name)?.join(',')}
</> </>
} }
@ -220,7 +238,7 @@ function patrolReport(props) {
width: 250, width: 250,
render: (_, record) => { render: (_, record) => {
return <> return <>
{record.system?record.system===1?'动力系统':record.system===2?'网络系统':'--':'--'} {record.system ? record.system === 1 ? '动力系统' : record.system === 2 ? '网络系统' : '--' : '--'}
</> </>
} }
}, },
@ -237,7 +255,7 @@ function patrolReport(props) {
description="确定删除报表吗?" description="确定删除报表吗?"
onConfirm={() => { confirmHandler(record?.id) }} onConfirm={() => { confirmHandler(record?.id) }}
><Button type="primary" style={{ marginRight: 10 }} danger>删除</Button></Popconfirm> ><Button type="primary" style={{ marginRight: 10 }} danger>删除</Button></Popconfirm>
<Button type="primary" onClick={()=>{generateReport(record)}}>立即生成</Button> <Button type="primary" onClick={() => { generateReport(record) }}>立即生成</Button>
</> </>
} }
} }
@ -300,41 +318,41 @@ function patrolReport(props) {
key: '2', key: '2',
children: <> children: <>
<Spin spinning={loading}> <Spin spinning={loading}>
<ProTable <ProTable
actionRef={tableRef2} actionRef={tableRef2}
options={false} options={false}
columns={column2} columns={column2}
dataSource={reportList || []} dataSource={reportList || []}
pagination={{ pageSize: 10, size: 'default', className: 'global-pagination' }} pagination={{ pageSize: 10, size: 'default', className: 'global-pagination' }}
request={async (query) => { request={async (query) => {
const { limit, page, name } = query const { limit, page, name } = query
const res = await dispatch(patrolManage.getReportList({ limit, page, name })) const res = await dispatch(patrolManage.getReportList({ limit, page, name }))
const list = res?.payload?.data?.rows const list = res?.payload?.data?.rows
setReportList(list) setReportList(list)
return { return {
...res, ...res,
total: res.payload.data.count ? res.payload.data.count : 0, total: res.payload.data.count ? res.payload.data.count : 0,
}; };
}} }}
// cardProps={{ title: '新建报表规则', bordered: true }} // cardProps={{ title: '新建报表规则', bordered: true }}
headerTitle={ headerTitle={
<Button <Button
key="primary" key="primary"
type="primary" type="primary"
onClick={() => { onClick={() => {
setModalVis(true) setModalVis(true)
}} }}
> >
新建报表规则 新建报表规则
</Button> </Button>
} }
rowKey="key" rowKey="key"
search={true} search={true}
/> />
</Spin> </Spin>
<AddReportRulesModal structAll={structAll} typeList={typeList} modalData={modalData} onOk={onOk} visible={modalVis} cancelHandle={cancelHandle}> <AddReportRulesModal structAll={structAll} typeList={typeList} modalData={modalData} onOk={onOk} visible={modalVis} cancelHandle={cancelHandle}>
</AddReportRulesModal> </AddReportRulesModal>
</> </>

9
web/client/src/sections/projectRegime/containers/information.js

@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Form, Input, Button, Table, Modal, Popconfirm } from 'antd'; import { Form, Input, Button, Table, Modal, Popconfirm, Tooltip } from 'antd';
import '../style.less'; import '../style.less';
import { push } from 'react-router-redux'; import { push } from 'react-router-redux';
import ProjectAddModel from '../components/projectAddModel' import ProjectAddModel from '../components/projectAddModel'
@ -83,7 +83,10 @@ const Information = (props) => {
title: '描述', title: '描述',
dataIndex: 'describe', dataIndex: 'describe',
key: 'describe', key: 'describe',
render: (text, record, index) => record.describe || '--' render: (text, record, index) => record.describe?.length>10?<Tooltip title={record.describe}><span>
{record?.describe.substring(0,10)}...
</span>
</Tooltip>: record.describe || '--'
}, { }, {
title: '操作', title: '操作',
dataIndex: 'operation', dataIndex: 'operation',
@ -199,7 +202,7 @@ const Information = (props) => {
if (index % 2 === 1) className = 'global-dark-row'; if (index % 2 === 1) className = 'global-dark-row';
return className; return className;
}} }}
scroll={{ y: 590 }} // scroll={{ y: 590 }}
/> />
{ {
<Modal <Modal

1
web/client/src/utils/webapi.js

@ -29,6 +29,7 @@ export const ApiTable = {
// 巡检记录 // 巡检记录
patrolRecord: 'patrolRecord/:patrolPlanId/:startTime/:endTime/:alarm/:pointId', patrolRecord: 'patrolRecord/:patrolPlanId/:startTime/:endTime/:alarm/:pointId',
delpatrolRecord: 'patrolReport/{id}',
// 巡检报告 // 巡检报告
patrolReport: 'patrolReport', patrolReport: 'patrolReport',

Loading…
Cancel
Save