|
|
@ -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) => { |
|
|
|
<div style={{ display: "flex" }}> |
|
|
|
<Button |
|
|
|
theme="borderless" |
|
|
|
// disabled={row.pepProjectIsDelete == 1} |
|
|
|
onClick={() => { |
|
|
|
setEditObj(row) |
|
|
|
setPushModal(true); |
|
|
|
// setPepname(row.name) |
|
|
|
// if (!row.name) { |
|
|
|
// setPepProjectId(row.pepProjectId) |
|
|
|
// } |
|
|
|
// else { |
|
|
|
// setPepProjectId() |
|
|
|
// } |
|
|
|
// let myanxinArr = [] |
|
|
|
// let anxinErrorList = [] |
|
|
|
// for (let i = 0; i < row.anxinProject.length; i++) { |
|
|
|
// if (row.anxinProject[i].projectState !== -1) { |
|
|
|
// myanxinArr.push(row.anxinProject[i].id) |
|
|
|
// } |
|
|
|
// else { |
|
|
|
// anxinErrorList.push(row.anxinProject[i].name) |
|
|
|
// } |
|
|
|
// } |
|
|
|
// setAnxinDelete(anxinErrorList) |
|
|
|
// let myapparr = [] |
|
|
|
// let myarrarrList = JSON.parse(JSON.stringify(row.apps)) |
|
|
|
// for (let j = 0; j < row.apps.length; j++) { |
|
|
|
// delete myarrarrList[j].projectApp |
|
|
|
// myapparr.push(JSON.stringify(myarrarrList[j])) |
|
|
|
// } |
|
|
|
// setAppArr(myapparr) |
|
|
|
// setAnxincloudArr(myanxinArr) |
|
|
|
// setBindId(row.id) |
|
|
|
setPushEdit(true) |
|
|
|
}} |
|
|
|
> |
|
|
@ -180,7 +137,7 @@ const EmPush = (props) => { |
|
|
|
style={{ color: '#F31C1C' }} |
|
|
|
onClick={() => { |
|
|
|
dispatch(service.putPushPushId({ pushId: row?.id, del: false, disable: false, msg: '更改推送配置状态' })).then(() => { |
|
|
|
// setQuery({ limit: 10, page: page.current }) |
|
|
|
getPushList({ limit: query.limit, page: page.current }); |
|
|
|
}) |
|
|
|
}} |
|
|
|
> |
|
|
@ -194,7 +151,7 @@ const EmPush = (props) => { |
|
|
|
position="topRight" |
|
|
|
onConfirm={() => { |
|
|
|
dispatch(service.putPushPushId({ pushId: row?.id, del: false, disable: true, msg: '更改推送配置状态' })).then(() => { |
|
|
|
// setQuery({ limit: 10, page: page.current }) |
|
|
|
getPushList({ limit: query.limit, page: page.current }); |
|
|
|
}) |
|
|
|
}} |
|
|
|
> |
|
|
@ -208,11 +165,11 @@ const EmPush = (props) => { |
|
|
|
position="topRight" |
|
|
|
onConfirm={() => { |
|
|
|
dispatch(service.putPushPushId({ pushId: row?.id, del: true, disable: false, msg: '删除推送配置' })).then(() => { |
|
|
|
// if (page.current > 0 && mylimits.current < 2) { |
|
|
|
// setQuery({ limit: 10, page: page.current - 1 }) |
|
|
|
// } else { |
|
|
|
// setQuery({ limit: 10, page: page.current }) |
|
|
|
// } |
|
|
|
if (page.current > 0 && mylimits.current < 2) { |
|
|
|
getPushList({ limit: query.limit, page: page.current - 1 }); |
|
|
|
} else { |
|
|
|
getPushList({ limit: query.limit, page: page.current }); |
|
|
|
} |
|
|
|
}) |
|
|
|
}} |
|
|
|
> |
|
|
@ -577,7 +534,6 @@ const EmPush = (props) => { |
|
|
|
<div style={{ marginRight: 20, display: 'flex', alignItems: 'center' }} className='myempush'> |
|
|
|
<Form |
|
|
|
onSubmit={(values) => console.log(values)} |
|
|
|
// onValueChange={values=>console.log(values)} |
|
|
|
getFormApi={(formApi) => (form.current = formApi)} |
|
|
|
layout="horizontal" |
|
|
|
style={{ position: "relative", width: "100%", flex: 1 }} |
|
|
@ -644,7 +600,7 @@ const EmPush = (props) => { |
|
|
|
border: '1px solid #005ABD' |
|
|
|
}} |
|
|
|
onClick={() => { |
|
|
|
getPushList() |
|
|
|
getPushList({ limit: query.limit, page: 0 }) |
|
|
|
}} |
|
|
|
> |
|
|
|
查询 |
|
|
@ -676,8 +632,8 @@ const EmPush = (props) => { |
|
|
|
</div> |
|
|
|
<div style={{ marginTop: 20 }}> |
|
|
|
<Skeleton |
|
|
|
// loading={loading} |
|
|
|
loading={false} |
|
|
|
loading={loading} |
|
|
|
// loading={false} |
|
|
|
active={true} |
|
|
|
placeholder={SkeletonScreen()} |
|
|
|
> |
|
|
@ -689,7 +645,7 @@ const EmPush = (props) => { |
|
|
|
hideExpandedColumn={false} |
|
|
|
empty="暂无数据" |
|
|
|
expandedRowRender={expandRowRender} |
|
|
|
// pagination={false} |
|
|
|
pagination={false} |
|
|
|
onRow={handleRow} |
|
|
|
/> |
|
|
|
</Skeleton> |
|
|
@ -715,6 +671,7 @@ const EmPush = (props) => { |
|
|
|
onChange={(currentPage, pageSize) => { |
|
|
|
setQuery({ limit: pageSize, page: currentPage - 1 }); |
|
|
|
page.current = currentPage - 1 |
|
|
|
setChange(!change) |
|
|
|
}} |
|
|
|
/> |
|
|
|
</div> |
|
|
@ -732,7 +689,7 @@ const EmPush = (props) => { |
|
|
|
}} |
|
|
|
close={() => { |
|
|
|
setPushModal(false); |
|
|
|
getPushList() |
|
|
|
getPushList(query) |
|
|
|
}} > |
|
|
|
</PushModal> : '' |
|
|
|
} |
|
|
@ -753,9 +710,9 @@ const EmPush = (props) => { |
|
|
|
} |
|
|
|
|
|
|
|
function mapStateToProps (state) { |
|
|
|
const { auth, global, ProjectPoms } = state; |
|
|
|
const { auth, global, getPush } = state; |
|
|
|
return { |
|
|
|
// loading: ProjectPoms.isRequesting, |
|
|
|
loading: getPush.isRequesting, |
|
|
|
user: auth.user, |
|
|
|
actions: global.actions, |
|
|
|
// members: members.data, |
|
|
|