From 01333be4e86be44da466536dbe6c190ea7c28e70 Mon Sep 17 00:00:00 2001 From: deartibers <947466799@qq.com> Date: Mon, 31 Oct 2022 11:16:38 +0800 Subject: [PATCH 01/16] =?UTF-8?q?em=E6=8E=A8=E9=80=81=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/sections/service/actions/emPush.js | 2 +- .../sections/service/components/pushModal.jsx | 1 - .../sections/service/containers/emPush.jsx | 99 ++++++------------- 3 files changed, 29 insertions(+), 73 deletions(-) diff --git a/web/client/src/sections/service/actions/emPush.js b/web/client/src/sections/service/actions/emPush.js index cadbb00..b560310 100644 --- a/web/client/src/sections/service/actions/emPush.js +++ b/web/client/src/sections/service/actions/emPush.js @@ -10,7 +10,7 @@ export function getPush (query) { //获取推送配置列表 actionType: 'GET_PUSH', url: `${ApiTable.getPush}`, msg: { error: '获取推送配置列表失败' }, - reducer: { name: '' } + reducer: { name: "getPush", params: { noClear: true } }, }); } diff --git a/web/client/src/sections/service/components/pushModal.jsx b/web/client/src/sections/service/components/pushModal.jsx index 3c089c9..d271001 100644 --- a/web/client/src/sections/service/components/pushModal.jsx +++ b/web/client/src/sections/service/components/pushModal.jsx @@ -378,7 +378,6 @@ function pushModal (props) { labelAlign="right" labelWidth="120px" onValueChange={(values, field) => { - console.log('values', values); for (var key in field) { if (key == 'tactics') { if (values.tactics == 'abnormal_rate') { diff --git a/web/client/src/sections/service/containers/emPush.jsx b/web/client/src/sections/service/containers/emPush.jsx index 1e1354a..8a4795d 100644 --- a/web/client/src/sections/service/containers/emPush.jsx +++ b/web/client/src/sections/service/containers/emPush.jsx @@ -7,7 +7,6 @@ import moment from "moment"; import PushModal from '../components/pushModal' import '../style.less' import { Setup } from "$components"; -// import { set } from 'nprogress'; const EmPush = (props) => { const form = useRef();//表单 @@ -15,22 +14,13 @@ const EmPush = (props) => { const { service } = actions; const [setup, setSetup] = useState(false); //表格设置是否显现 const [setupp, setSetupp] = useState([]);//实际显示的表格列表 - const [tableSetup, setTableSetup] = useState([]); //单一表格设置信息 const [query, setQuery] = useState({ limit: 10, page: 0 }); //页码信息 const [limits, setLimits] = useState()//每页实际条数 const mylimits = useRef(); //每页实际条数 const [pushModal, setPushModal] = useState(false) //信鸽弹框 const [pushEdit, setPushEdit] = useState(false) //是否是修改 - const [anxincloudList, setAnxincloudList] = useState([]) //安心云列表 - const [peplist, setPeplist] = useState([]) //PEP项目管理项目列表 - const [appList, setAppList] = useState([]) //应用列表 - const [pepProjectId, setPepProjectId] = useState() //修改时项企id - const [anxincloudArr, setAnxincloudArr] = useState([]) //修改时已经选择的安心云列表 - const [pepname, setPepname] = useState() //修改时自定义项目名称 - const [anxinDelete, setAnxinDelete] = useState([]) //修改时安心云项目有删除,显示提示信息 - const [appArr, setAppArr] = useState([]) //修改时添加应用 - const [bindId, setBindId] = useState() //修改时绑定的id - const [tableKey, setTableKey] = useState([]) //修改时绑定的id + const [change, setChange] = useState(false) //是否改变 + const [allTableData, setAllTableData] = useState([]) //获取到的所有表格信息 const [editObj, setEditObj] = useState({});//管理员弹框修改内容 const [projectStatus, setProjectStatus] = useState([]); //获取项目状态列表 const page = useRef(query.page);//哪一页 @@ -82,16 +72,6 @@ const EmPush = (props) => { const [tableData, setTableData] = useState([]) //表格数据 useEffect(() => { - // dispatch(service.getPush(query)).then((res) => {//获取推送配置列表 - // console.log('res.payload.datares.payload.data',res.payload.data); - // setAnxincloudList(res.payload.data) - // }) - // dispatch(install.getProjectPmanage(query)).then((res) => {//获取PEP项目管理项目 - // setPeplist(res.payload.data) - // }) - // dispatch(install.getProjectAppList(query)).then((res) => {//获取应用列表 - // setAppList(res.payload.data) - // }) localStorage.getItem(EMPUSH) == null ? localStorage.setItem( EMPUSH, @@ -99,23 +79,28 @@ const EmPush = (props) => { ) : ""; getProjectStatusList() + getPushList(query); }, []) useEffect(() => { - getPushList(); - }, [query]); + let showTableData = JSON.parse(JSON.stringify(allTableData)).slice(query.page * query.limit, (query.page + 1) * query.limit) + setTableData(showTableData) + mylimits.current = showTableData.length + }, [change]); - function getPushList () { + function getPushList (query) { let val = form.current.getValues() - // , ...query dispatch(service.getPush({ ...val })).then((res) => {//获取已绑定项目 if (res.success) { let mytableData = JSON.parse(JSON.stringify(res.payload.data)); for (let index = 0; index < mytableData.length; index++) { mytableData[index].key = String(mytableData[index].id) } - setTableData(mytableData) + setAllTableData(mytableData) + let showTableData = mytableData.slice(query.page * query.limit, (query.page + 1) * query.limit) + setTableData(showTableData) + setQuery(query) setLimits(res.payload.data.length) - mylimits.current = res.payload.data.length + mylimits.current = showTableData.length } }) } @@ -138,37 +123,9 @@ const EmPush = (props) => {