|
@ -22,35 +22,17 @@ import ApplyModal from "../components/applyModal"; |
|
|
import '../style.less' |
|
|
import '../style.less' |
|
|
|
|
|
|
|
|
const ApplicationCenter = (props) => { |
|
|
const ApplicationCenter = (props) => { |
|
|
const { dispatch, actions, user, loading, equipmentWarehouseCamera } = props; |
|
|
const { dispatch, actions, user, loading, applicationData } = props; |
|
|
// const { equipmentWarehouse } = actions; |
|
|
const { applicationCenter } = actions; |
|
|
const [cameraModal, setCameraModal] = useState(false); |
|
|
|
|
|
const [remarksModal, setRemarksModal] = useState(false); |
|
|
|
|
|
const [videoPlay, setVideoPlay] = useState(false); |
|
|
|
|
|
const [modalName, setModalName] = useState(false); //创建或修改 |
|
|
const [modalName, setModalName] = useState(false); //创建或修改 |
|
|
const [setup, setSetup] = useState(false); //表格设置是否显现 |
|
|
const [setup, setSetup] = useState(false); //表格设置是否显现 |
|
|
const [applyModal, setApplyModal] = useState(false); |
|
|
const [applyModal, setApplyModal] = useState(false); |
|
|
const [cameraSetup, setcameraSetup] = useState(false); |
|
|
|
|
|
const [setupp, setSetupp] = useState([]); |
|
|
const [setupp, setSetupp] = useState([]); |
|
|
const [venderList, setvenderList] = useState([]); //厂商信息 |
|
|
|
|
|
const [query, setQuery] = useState({ limit: 10, page: 0 }); //页码信息 |
|
|
const [query, setQuery] = useState({ limit: 10, page: 0 }); //页码信息 |
|
|
const [search, setSearch] = useState({}); //搜索条件 |
|
|
const [appData, setAppData] = useState(null); //应用id |
|
|
const [rowId, setRowId] = useState(); //表格数据id |
|
|
const APPLICATION = 'application' |
|
|
const [cameraData, setCameraData] = useState({}); //表格传递数据 |
|
|
const pageLimit = useRef({ limit: 10, page: 0 }); |
|
|
const [modify, setModify] = useState(false); //修改 |
|
|
|
|
|
const [parentCamera, setParentCamera] = useState(""); //级联摄像头父级设备 |
|
|
|
|
|
const [addNvr, setAddNvr] = useState(false); //nvr页面传递参数打开NVR摄像头添加弹框 |
|
|
|
|
|
const [nvrNumber, setNvrNumber] = useState(); |
|
|
|
|
|
const [videoObj, setVideoObj] = useState(); //播放条件 |
|
|
|
|
|
const [axyData, setAxyData] = useState(); |
|
|
|
|
|
const [cameraRemarks, setCameraRemarks] = useState([]);//备注 |
|
|
|
|
|
const api = useRef(); |
|
|
|
|
|
const searchData = useRef({}) |
|
|
|
|
|
const limits = useRef(); //每页实际条数 |
|
|
const limits = useRef(); //每页实际条数 |
|
|
const page = useRef(query.page); |
|
|
|
|
|
const deviceClickb = useRef(true) |
|
|
|
|
|
const APPLICATION = "application"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const columns = [ |
|
|
const columns = [ |
|
@ -65,16 +47,20 @@ const ApplicationCenter = (props) => { |
|
|
title: "应用名称", |
|
|
title: "应用名称", |
|
|
dataIndex: "name", |
|
|
dataIndex: "name", |
|
|
key: "name", |
|
|
key: "name", |
|
|
|
|
|
render: (text, r, index) => { |
|
|
|
|
|
return r?.name.length > 8 ? `${r?.name.substr(0, 8)}...` : r?.name |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: "APPID", |
|
|
title: "APPID", |
|
|
dataIndex: "appId", |
|
|
dataIndex: "appKey", |
|
|
key: "appId", |
|
|
key: "appId", |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: "Secret Key", |
|
|
title: "Secret Key", |
|
|
dataIndex: "secretKey", |
|
|
dataIndex: "appSecret", |
|
|
key: "secretKey", |
|
|
key: "secretKey", |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
@ -90,45 +76,55 @@ const ApplicationCenter = (props) => { |
|
|
onClick={() => { |
|
|
onClick={() => { |
|
|
setApplyModal(true) |
|
|
setApplyModal(true) |
|
|
setModalName(true) |
|
|
setModalName(true) |
|
|
|
|
|
setAppData(row) |
|
|
}} |
|
|
}} |
|
|
> |
|
|
> |
|
|
修改 |
|
|
修改 |
|
|
</Button> |
|
|
</Button> |
|
|
{row.forbidden ? ( |
|
|
{row?.forbidden ? ( |
|
|
<Button |
|
|
<Button |
|
|
theme="borderless" |
|
|
theme="borderless" |
|
|
onClick={() => { |
|
|
onClick={() => { |
|
|
|
|
|
dispatch(applicationCenter.putApplication({ appId: row?.id, forbidden: !row?.forbidden })).then(() => details()) |
|
|
}} |
|
|
}} |
|
|
> |
|
|
> |
|
|
启用 |
|
|
启用 |
|
|
</Button> |
|
|
</Button> |
|
|
) : ( |
|
|
) : ( |
|
|
<Popconfirm |
|
|
<Popconfirm |
|
|
title="禁用后,应用系统引入的页面及能力将会暂时失效,请谨慎操作。" |
|
|
title={<div style={{ width: 200 }}>禁用后,应用系统引入的页面及能力将会暂时失效,请谨慎操作。</div>} |
|
|
arrowPointAtCenter={false} |
|
|
arrowPointAtCenter={false} |
|
|
showArrow={true} |
|
|
showArrow={true} |
|
|
position="topRight" |
|
|
position="topRight" |
|
|
onConfirm={() => { |
|
|
onConfirm={() => { |
|
|
|
|
|
dispatch(applicationCenter.putApplication({ appId: row?.id, forbidden: !row?.forbidden })).then(() => { |
|
|
|
|
|
setQuery({ limit: pageLimit.current.limit, page: pageLimit.current.page }) |
|
|
|
|
|
}) |
|
|
}} |
|
|
}} |
|
|
> |
|
|
> |
|
|
<Button theme="borderless">禁用</Button> |
|
|
<Button theme="borderless">禁用</Button> |
|
|
</Popconfirm> |
|
|
</Popconfirm> |
|
|
)} |
|
|
)} |
|
|
<Popconfirm |
|
|
<Popconfirm |
|
|
title="删除后,应用系统引入的页面及能力将会永久失效,请谨慎操作。" |
|
|
title={<div style={{ width: 200 }}>删除后,应用系统引入的页面及能力将会永久失效,请谨慎操作。</div>} |
|
|
arrowPointAtCenter={false} |
|
|
arrowPointAtCenter={false} |
|
|
|
|
|
width={300} |
|
|
showArrow={true} |
|
|
showArrow={true} |
|
|
position="topRight" |
|
|
position="topRight" |
|
|
onConfirm={() => { |
|
|
onConfirm={() => { |
|
|
|
|
|
dispatch(applicationCenter.delApplication(row?.id)).then(() => { |
|
|
|
|
|
if (pageLimit.current.page > 0 && limits.current < 2) { |
|
|
|
|
|
setQuery({ limit: pageLimit.current.limit, page: pageLimit.current.page - 1 }) |
|
|
|
|
|
} else { |
|
|
|
|
|
setQuery({ limit: pageLimit.current.limit, page: pageLimit.current.page }) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
}} |
|
|
}} |
|
|
> |
|
|
> |
|
|
<Button theme="borderless">删除</Button> |
|
|
<Button theme="borderless">删除</Button> |
|
|
</Popconfirm> |
|
|
</Popconfirm> |
|
|
|
|
|
|
|
|
</div> |
|
|
</div > |
|
|
); |
|
|
); |
|
|
}, |
|
|
}, |
|
|
} |
|
|
} |
|
@ -145,18 +141,26 @@ const ApplicationCenter = (props) => { |
|
|
title: "创建时间", |
|
|
title: "创建时间", |
|
|
dataIndex: "createTime", |
|
|
dataIndex: "createTime", |
|
|
key: "createTime", |
|
|
key: "createTime", |
|
|
|
|
|
render: (_, r, index) => { |
|
|
|
|
|
return r?.createUser?.name |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: "创建账号", |
|
|
title: "创建账号", |
|
|
dataIndex: "account", |
|
|
dataIndex: "createUserId", |
|
|
key: "account", |
|
|
key: "account", |
|
|
|
|
|
render: (_, r, index) => { |
|
|
|
|
|
return moment(r.createTime).format("YYYY-MM-DD HH:MM:SS"); |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: "应用类型", |
|
|
title: "应用类型", |
|
|
dataIndex: "applicationType", |
|
|
dataIndex: "type", |
|
|
key: "applicationType", |
|
|
key: "applicationType", |
|
|
|
|
|
render: (_, r, index) => { |
|
|
|
|
|
const type = r?.type?.map((item, index) => item + ';') |
|
|
|
|
|
return type |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
@ -179,6 +183,17 @@ const ApplicationCenter = (props) => { |
|
|
}, |
|
|
}, |
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
//获取应用信息 |
|
|
|
|
|
const details = (data) => { |
|
|
|
|
|
pageLimit.current = query |
|
|
|
|
|
dispatch(applicationCenter.getApplication(pageLimit.current)).then((res) => { |
|
|
|
|
|
limits.current = res.payload.data.data.length |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
details() |
|
|
|
|
|
}, [query]) |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
//初始化表格显示设置 |
|
|
//初始化表格显示设置 |
|
|
localStorage.getItem(APPLICATION) == null |
|
|
localStorage.getItem(APPLICATION) == null |
|
@ -295,7 +310,7 @@ const ApplicationCenter = (props) => { |
|
|
> |
|
|
> |
|
|
<Table |
|
|
<Table |
|
|
columns={setupp.filter((s) => s)} |
|
|
columns={setupp.filter((s) => s)} |
|
|
dataSource={[{ name: 'csadca', }]} |
|
|
dataSource={applicationData.data} |
|
|
bordered={false} |
|
|
bordered={false} |
|
|
empty="暂无数据" |
|
|
empty="暂无数据" |
|
|
style={{ |
|
|
style={{ |
|
@ -312,17 +327,17 @@ const ApplicationCenter = (props) => { |
|
|
}} |
|
|
}} |
|
|
> |
|
|
> |
|
|
<span style={{ lineHeight: "30px" }}> |
|
|
<span style={{ lineHeight: "30px" }}> |
|
|
共{100}个设备 |
|
|
共{applicationData.total}个设备 |
|
|
</span> |
|
|
</span> |
|
|
<Pagination |
|
|
<Pagination |
|
|
className="22" |
|
|
className="22" |
|
|
total={100} |
|
|
total={applicationData.total} |
|
|
showSizeChanger |
|
|
showSizeChanger |
|
|
currentPage={query.page + 1} |
|
|
currentPage={query.page + 1} |
|
|
pageSizeOpts={[10, 20, 30, 40]} |
|
|
pageSizeOpts={[10, 20, 30, 40]} |
|
|
onChange={(currentPage, pageSize) => { |
|
|
onChange={(currentPage, pageSize) => { |
|
|
setQuery({ limit: pageSize, page: currentPage - 1 }); |
|
|
setQuery({ limit: pageSize, page: currentPage - 1 }); |
|
|
page.current = currentPage - 1 |
|
|
pageLimit.current = { limit: pageSize, page: currentPage - 1 } |
|
|
}} |
|
|
}} |
|
|
/> |
|
|
/> |
|
|
</div> |
|
|
</div> |
|
@ -347,9 +362,12 @@ const ApplicationCenter = (props) => { |
|
|
<ApplyModal |
|
|
<ApplyModal |
|
|
visible={true} |
|
|
visible={true} |
|
|
modalName={modalName} |
|
|
modalName={modalName} |
|
|
|
|
|
appData={appData} |
|
|
close={() => { |
|
|
close={() => { |
|
|
setApplyModal(false) |
|
|
setApplyModal(false) |
|
|
setModalName(false) |
|
|
setModalName(false) |
|
|
|
|
|
setAppData(null) |
|
|
|
|
|
details() |
|
|
}} |
|
|
}} |
|
|
/> |
|
|
/> |
|
|
) : ( |
|
|
) : ( |
|
@ -361,9 +379,10 @@ const ApplicationCenter = (props) => { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function mapStateToProps (state) { |
|
|
function mapStateToProps (state) { |
|
|
const { auth } = state; |
|
|
const { global, applicationData } = state; |
|
|
return { |
|
|
return { |
|
|
user: auth.user, |
|
|
actions: global.actions, |
|
|
|
|
|
applicationData: applicationData.data || {} |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|