diff --git a/api/app/lib/controllers/patrolManage/patrolPlan.js b/api/app/lib/controllers/patrolManage/patrolPlan.js
index 23f2065..b21fa37 100644
--- a/api/app/lib/controllers/patrolManage/patrolPlan.js
+++ b/api/app/lib/controllers/patrolManage/patrolPlan.js
@@ -4,9 +4,10 @@ const moment = require('moment');
async function getPatrolPlan (ctx, next) {
try {
const models = ctx.fs.dc.models;
- const { limit, page, userId } = ctx.query;
+ const { limit, page, userId, name, projectName } = ctx.query;
let where = {}
let userWhere = {};
+ let projectWhere = {};
let options = {
order: [['id', 'desc']],
where,
@@ -22,9 +23,16 @@ async function getPatrolPlan (ctx, next) {
}, {
model: models.Project,
attributes: ['id', 'name'],
+ where: projectWhere,
}],
distinct: true,
};
+ if (name) {
+ options.where.name = { $like: `%${name}%` };
+ }
+ if (projectName) {
+ projectWhere.name = { $like: `%${projectName}%` };
+ }
if (limit) {
options.limit = Number(limit);
}
diff --git a/web/client/src/sections/patrolManage/actions/plan.js b/web/client/src/sections/patrolManage/actions/plan.js
index 6b94bca..eff3d6a 100644
--- a/web/client/src/sections/patrolManage/actions/plan.js
+++ b/web/client/src/sections/patrolManage/actions/plan.js
@@ -3,9 +3,10 @@
import { basicAction } from '@peace/utils'
import { ApiTable } from '$utils'
-export function getPatrolPlan() {
+export function getPatrolPlan(query) {
return dispatch => basicAction({
type: 'get',
+ query,
dispatch: dispatch,
actionType: 'GET_PATROL_PLAN',
url: ApiTable.patrolPlan,
diff --git a/web/client/src/sections/patrolManage/containers/patrolPlan.js b/web/client/src/sections/patrolManage/containers/patrolPlan.js
index 4850fa4..ac95bce 100644
--- a/web/client/src/sections/patrolManage/containers/patrolPlan.js
+++ b/web/client/src/sections/patrolManage/containers/patrolPlan.js
@@ -7,7 +7,7 @@ import { createPatrolPlan, delPatrolPlan, updatePatrolPlan, getPatrolPlan } from
import { getPatrolTemplate } from '../actions/template';
import moment from 'moment';
-function PatrolPlan (props) {
+function PatrolPlan(props) {
const { dispatch, user } = props;
const tableRef = useRef();
const [dataSource, setDataSource] = useState([{}]);
@@ -39,8 +39,8 @@ function PatrolPlan (props) {
const columns = [{
title: '结构物名称',
- dataIndex: 'struName',
- key: 'struName',
+ dataIndex: 'projectName',
+ key: 'projectName',
ellipsis: true,
render: (_, record) => {
return
{record?.project?.name}
@@ -55,36 +55,41 @@ function PatrolPlan (props) {
dataIndex: 'startTime',
key: 'startTime',
ellipsis: true,
+ search: false,
render: (_, record) => moment(record.startTime).format('YYYY-MM-DD')
}, {
title: '结束时间',
dataIndex: 'endTime',
key: 'endTime',
ellipsis: true,
+ search: false,
render: (_, record) => moment(record.endTime).format('YYYY-MM-DD')
-
}, {
title: '巡检频次',
dataIndex: 'frequency',
key: 'frequency',
ellipsis: true,
+ search: false,
}, {
title: '巡检点位',
dataIndex: 'patrolPoints',
key: 'patrolPoints',
ellipsis: true,
+ search: false,
render: (_, record) => {record?.points?.length ? record?.points?.map(p => p.name).join() : '-'}
}, {
title: '巡检人',
dataIndex: 'patrolPerson',
key: 'patrolPerson',
ellipsis: true,
+ search: false,
render: (_, record) => {record?.users?.map(u => u.name).join()}
}, {
title: '巡检次数统计',
dataIndex: 'patrolCount',
key: 'patrolCount',
ellipsis: true,
+ search: false,
}, {
title: '操作',
dataIndex: 'action',
@@ -127,23 +132,27 @@ function PatrolPlan (props) {
dataSource={dataSource || []}
rowKey='id'
pagination={{ pageSize: 10 }}
- search={false}
+ search={{
+ defaultCollapsed: false,
+ labelWidth: 'auto',
+ optionRender: (searchConfig, formProps, dom) => [
+ ...dom.reverse(),
+ ,
+ ],
+ }}
request={async (params = {}) => {
const res = await dispatch(getPatrolPlan(params));
setDataSource(res?.payload.data?.rows);
return { ...res };
}}
onReset={() => { }}
- toolBarRender={() => [
-
- ]}
/>
{
visible ?
@@ -162,7 +171,7 @@ function PatrolPlan (props) {
)
}
-function mapStateToProps (state) {
+function mapStateToProps(state) {
const { auth } = state
return {
user: auth.user
diff --git a/web/client/src/sections/projectRegime/containers/point.js b/web/client/src/sections/projectRegime/containers/point.js
index deaee14..cf861ab 100644
--- a/web/client/src/sections/projectRegime/containers/point.js
+++ b/web/client/src/sections/projectRegime/containers/point.js
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux';
-import { Button, Table, Popconfirm } from 'antd';
+import { Button, Table, Popconfirm, Input } from 'antd';
import '../style.less';
import PointModel from '../components/pointModel'
@@ -17,6 +17,8 @@ const Information = (props) => {
const [select, setSelect] = useState([])
const [selec, setSelec] = useState()
const [qrCodeingIds, setQrCodeingIds] = useState(null)
+ const [searchTableList, setSearchTableList] = useState([])
+ const [name, setName] = useState('')
const qrCodeId = props?.match?.params?.id
@@ -35,6 +37,7 @@ const Information = (props) => {
})
})
settableList(data?.map(v => ({ ...v, key: v.id })))
+ setSearchTableList(data?.map(v => ({ ...v, key: v.id })))
setLimits(res.payload.data?.count)
}
})
@@ -128,14 +131,18 @@ const Information = (props) => {
})
}
}} disabled={qrCodeingIds?.length}>一键生成二维码
+ { setName(e.target.value) }} />
+