From 4c35e45f4cd9e0c6f78b54baf13a851137e7255d Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Wed, 22 Feb 2023 09:38:11 +0800 Subject: [PATCH] =?UTF-8?q?(*)=20=E6=A3=80=E6=9F=A5=E9=A1=B9=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/patrolManage/checkItems.js | 6 +++- .../patrolManage/actions/checkItems.js | 5 +-- .../components/checkItemsModal.js | 3 +- .../patrolManage/containers/checkItems.js | 32 +++++++++++-------- 4 files changed, 28 insertions(+), 18 deletions(-) diff --git a/api/app/lib/controllers/patrolManage/checkItems.js b/api/app/lib/controllers/patrolManage/checkItems.js index d9e6e7b..1613e51 100644 --- a/api/app/lib/controllers/patrolManage/checkItems.js +++ b/api/app/lib/controllers/patrolManage/checkItems.js @@ -38,8 +38,9 @@ async function createGroup(ctx, next) { async function getCheckItems(ctx, next) { try { const models = ctx.fs.dc.models; - const { limit, page } = ctx.query; + const { limit, page, name } = ctx.query; let options = { + where: {}, order: [['id', 'asc']], include: [{ required: true, @@ -47,6 +48,9 @@ async function getCheckItems(ctx, next) { attributes: ['id', 'name'], }] } + if (name) { + options.where.name = { $like: `%${name}%` }; + } if (limit) { options.limit = Number(limit); } diff --git a/web/client/src/sections/patrolManage/actions/checkItems.js b/web/client/src/sections/patrolManage/actions/checkItems.js index b98fe62..16e3033 100644 --- a/web/client/src/sections/patrolManage/actions/checkItems.js +++ b/web/client/src/sections/patrolManage/actions/checkItems.js @@ -24,10 +24,11 @@ export function createCheckItemsGroup(data) { }); } -export function getCheckItems() { +export function getCheckItems(query) { return dispatch => basicAction({ type: 'get', dispatch: dispatch, + query: query, actionType: 'GET_CHECK_ITEMS', url: ApiTable.checkItems, msg: { error: '获取检查项失败' } @@ -61,7 +62,7 @@ export function delCheckItems(ids) { type: 'del', dispatch: dispatch, actionType: 'DEL_CHECK_ITEMS', - url: ApiTable.delUser.replace('{ids}', ids), + url: ApiTable.delCheckItems.replace('{ids}', ids), msg: { option: '删除检查项' }, }); } diff --git a/web/client/src/sections/patrolManage/components/checkItemsModal.js b/web/client/src/sections/patrolManage/components/checkItemsModal.js index ebe6fab..017950c 100644 --- a/web/client/src/sections/patrolManage/components/checkItemsModal.js +++ b/web/client/src/sections/patrolManage/components/checkItemsModal.js @@ -2,7 +2,6 @@ import { Button, Form, Input, Modal, Select } from 'antd'; import React, { useState, useEffect } from 'react'; import { connect } from 'react-redux'; import { getCheckItemsGroup } from '../actions/checkItems'; -import moment from 'moment'; const CheckItemsModal = ({ visible, onOk, onCancel, curRecord, dispatch }) => { const [group, setGroup] = useState([]); @@ -50,7 +49,7 @@ const CheckItemsModal = ({ visible, onOk, onCancel, curRecord, dispatch }) => { name="form_in_modal" initialValues={{ ...curRecord, - userDept: curRecord?.user?.department?.name, + group: curRecord?.check_items_group?.id }} > { + if (res.success) { + tableRef.current.reload(); + } + }) + } + const columns = [{ title: '检查项', dataIndex: 'name', @@ -75,13 +82,7 @@ function CheckItems(props) { }}>修改 { - dispatch(delPatrolPlan(record.id)).then(res => { - if (res.success) { - tableRef.current.reload(); - } - }) - }}> + onConfirm={() => { delItems(record.id) }}> @@ -98,7 +99,11 @@ function CheckItems(props) { rowKey='id' pagination={{ pageSize: 10 }} request={async (params = {}) => { - const res = await dispatch(getCheckItems(params)); + const res = await dispatch(getCheckItems({ + limit: params.pageSize, + page: params.current - 1, + name: params?.name + })); setDataSource(res?.payload.data?.rows); return { ...res }; }} @@ -118,9 +123,10 @@ function CheckItems(props) { , ],