From ef6020e48a043803f2a0d1b17da2bbc8a25b647d Mon Sep 17 00:00:00 2001 From: deartibers <947466799@qq.com> Date: Mon, 29 Aug 2022 11:02:34 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../openness/containers/mirroring.jsx | 12 +- .../openness/containers/mirroringDetail.jsx | 189 ++++++++++++++---- 2 files changed, 151 insertions(+), 50 deletions(-) diff --git a/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroring.jsx b/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroring.jsx index a624223..78bbf79 100644 --- a/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroring.jsx +++ b/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroring.jsx @@ -15,11 +15,11 @@ const Mirroring = (props) => { img: '/assets/images/imageImg/textblue.png', color: 'blue' }, { - title: '白', + title: '静谧白', img: '/assets/images/imageImg/textwhite.png', color: 'white' }, { - title: '黑色(深灰)', + title: '神秘黑', img: '/assets/images/imageImg/textblack.png', color: 'black' }, @@ -44,10 +44,8 @@ const Mirroring = (props) => { function todetail (color) {//去模板内部 dispatch(push('/mirroring_detail'+'?template='+color)); } - function tomirrordetail(mid){ - dispatch(openness.getMirrorDetail(mid)).then((res) => { - // dispatch(push('/mirroring_detail'+'?id='+item.id+'&template='+item.template)) - }) + function tomirrordetail(mid,template){ + dispatch(push('/mirroring_detail'+'?template='+template+'&mid='+mid)); } function todelete (id) {//删除我的自定义镜像服务 dispatch(openness.delMirror(id)).then((res) => { @@ -207,7 +205,7 @@ const Mirroring = (props) => { src={item.template == 'blue' ? '/assets/images/imageImg/textblue.png' : item.template == 'black' ? '/assets/images/imageImg/textblack.png' : '/assets/images/imageImg/textwhite.png'} alt="设置" style={{ width: 330, height: 153, cursor: 'pointer' }} - onClick={() => {tomirrordetail(item.mid)}} + onClick={() => {tomirrordetail(item.mid,item.template)}} />
{item.title} diff --git a/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx b/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx index df36a7d..9912178 100644 --- a/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx +++ b/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx @@ -9,22 +9,87 @@ const MirroringDetail = (props) => { const { history, dispatch, actions, user, loading, StatusPushList } = props; const { openness } = actions; useEffect(() => { - let search=props.location.search + let search = props.location.search let result = search.slice(1) - let searcharr=result.split('&') - if(searcharr.length==1){ + let searcharr = result.split('&') + if (searcharr.length == 1) { setTemplate(searcharr[0].split('=')[1])//主题颜色 } - else{ + else { setTemplate(searcharr[0].split('=')[1])//主题颜色 - setMirrorId(searcharr[2].split('=')[1])//id + dispatch(openness.getMirrorDetail(searcharr[1].split('=')[1])).then((res) => { + let filterGrouplist = res.payload.data.filterGroup + for (let i = 0; i < filterGrouplist.length; i++) { + filterGrouplist[i].num = i + if (filterGrouplist[i].filters.length > 0) { + for (let j = 0; j < filterGrouplist[i].filters.length; j++) { + filterGrouplist[i].filters[j].num = j + } + } + } + setFilterGroup(filterGrouplist); + setMirrorId(res.payload.data.id);//id + setShowHeader(res.payload.data.showHeader); + setHeaderName(res.payload.data.title); + let mytreeData = res.payload.data.tree + for (let i = 0; i < mytreeData.length; i++) {//第一层 + mytreeData[i].value = mytreeData[i].key + for (let j = 0; j < mytreeData[i].children.length; j++) {//第二层 + mytreeData[i].children[j].value = mytreeData[i].children[j].key + if (mytreeData[i].children[j].camera) { + if (mytreeData[i].children[j].camera.type == 'yingshi') { + mytreeData[i].children[j].camera.content = mytreeData[i].children[j].camera.cameraRemarks.map(v => v.remark), + mytreeData[i].children[j].camera.yingshiToken = mytreeData[i].children[j].camera.secretYingshi.token + } + else { + mytreeData[i].children[j].camera.content = mytreeData[i].children[j].camera.cameraRemarks.map(v => v.remark), + mytreeData[i].children[j].camera.yingshiToken = null + } + } + else { + for (let k = 0; k < mytreeData[i].children[j].children.length; k++) {//第三层 + mytreeData[i].children[j].children[k].value = mytreeData[i].children[j].children[k].key + if (mytreeData[i].children[j].children[k].camera) { + if (mytreeData[i].children[j].children[k].camera.type == 'yingshi') { + mytreeData[i].children[j].children[k].camera.content = mytreeData[i].children[j].children[k].camera.cameraRemarks.map(v => v.remark), + mytreeData[i].children[j].children[k].camera.yingshiToken = mytreeData[i].children[j].children[k].camera.secretYingshi.token + } + else { + mytreeData[i].children[j].children[k].camera.content = mytreeData[i].children[j].children[k].camera.cameraRemarks.map(v => v.remark), + mytreeData[i].children[j].children[k].camera.yingshiToken = null + } + } + else { + for (let l = 0; l < mytreeData[i].children[j].children[k].children.length; l++) { + mytreeData[i].children[j].children[k].children[l].value = mytreeData[i].children[j].children[k].children[l].key + if (mytreeData[i].children[j].children[k].children[l].camera) { + if (mytreeData[i].children[j].children[k].children[l].camera.type == 'yingshi') { + mytreeData[i].children[j].children[k].children[l].camera.content = mytreeData[i].children[j].children[k].children[l].camera.cameraRemarks.map(v => v.remark), + mytreeData[i].children[j].children[k].children[l].camera.yingshiToken = mytreeData[i].children[j].children[k].children[l].camera.secretYingshi.token + } + else { + mytreeData[i].children[j].children[k].children[l].camera.content = mytreeData[i].children[j].children[k].children[l].camera.cameraRemarks.map(v => v.remark), + mytreeData[i].children[j].children[k].children[l].camera.yingshiToken = null + } + } + } + } + } + } + } + } + setTreeData(mytreeData); + }) } equipmentGetCamera(); }, []); - const [showHeader,setShowHeader] = useState(false)//是否展示头部 - const [mirrorId,setMirrorId] = useState(null)//id - - const [template,setTemplate] = useState('')//主题颜色 + const [hasModify, sethasModify] = useState(false)//有没有进行修改 + const [showHeader, setShowHeader] = useState(false)//是否展示头部 + const [mirrorId, setMirrorId] = useState(null)//id + const [backVisible, setBackVisible] = useState(false)//返回上一页是否修改过 + + + const [template, setTemplate] = useState('')//主题颜色 const [chooseNum, setChooseNum] = useState(0);//当前选择tab const [chooseList, setChooseList] = useState(['节点', '样式', '功能']); const [editKey, setEditKey] = useState('') @@ -117,18 +182,18 @@ const MirroringDetail = (props) => { setIndeterminate(!!checkedList.length && checkedList.length < showCameraList.length); setCheckall(checkedList.length === showCameraList.length); } - function topublish(publish){//编辑镜像信息 - let mirrordata={ - mirrorId:mirrorId, - template:template, - title:headerName, - showHeader:showHeader, - publish:publish, - tree:treeData, - filterGroup:filterGroup + function topublish (publish) {//编辑镜像信息 + let mirrordata = { + mirrorId: mirrorId, + template: template, + title: headerName, + showHeader: showHeader, + publish: publish, + tree: treeData, + filterGroup: filterGroup } dispatch(openness.putMirror(mirrordata)).then((res) => { - console.log('res',res); + history.goBack() }) } function nodeDelete (item) {//删除树状子节点 @@ -183,6 +248,7 @@ const MirroringDetail = (props) => { } } } + sethasModify(true) setAddCamera(false) setTreeData(mainData) } @@ -240,6 +306,7 @@ const MirroringDetail = (props) => { } } } + sethasModify(true) setTreeData(mainData) } function changeLable (value, item) {//编辑摄像头名称 @@ -270,6 +337,7 @@ const MirroringDetail = (props) => { } } } + sethasModify(true) setTreeData(mainData) } function lableBlur () { @@ -277,29 +345,33 @@ const MirroringDetail = (props) => { } function cameraAdd (item) {//添加摄像头 let myplainOptions = JSON.parse(JSON.stringify(plainOptions)) - for (let i = 0; i < myplainOptions.length; i++) {//摄像头列表 - for (let j = 0; j < treeData.length; j++) {//第一级 - if (treeData[j].children) {//有没有子集 - for (let k = 0; k < treeData[j].children.length; k++) {//第二级 - if (treeData[j].children[k].children) {//有没有子集 - for (let l = 0; l < treeData[j].children[k].children.length; l++) {//第三级 - if (treeData[j].children[k].children[l].children) {//有没有子集 - for (let p = 0; p < treeData[j].children[k].children[l].children.length; p++) { - if (treeData[j].children[k].children[l].children[p].cameraId) { + for (let j = 0; j < treeData.length; j++) {//第一级 + if (treeData[j].children) {//有没有子集 + for (let k = 0; k < treeData[j].children.length; k++) {//第二级 + if (treeData[j].children[k].children) {//有没有子集 + for (let l = 0; l < treeData[j].children[k].children.length; l++) {//第三级 + if (treeData[j].children[k].children[l].children) {//有没有子集 + for (let p = 0; p < treeData[j].children[k].children[l].children.length; p++) { + if (treeData[j].children[k].children[l].children[p].cameraId) { + for (let i = 0; i < myplainOptions.length; i++) { if (myplainOptions[i].value == treeData[j].children[k].children[l].children[p].cameraId) { myplainOptions.splice(i, 1) } } } } - else if (treeData[j].children[k].children[l].cameraId) {//有没有摄像头 + } + else if (treeData[j].children[k].children[l].cameraId) {//有没有摄像头 + for (let i = 0; i < myplainOptions.length; i++) { if (myplainOptions[i].value == treeData[j].children[k].children[l].cameraId) { myplainOptions.splice(i, 1) } } } } - else if (treeData[j].children[k].cameraId) {//有没有摄像头 + } + else if (treeData[j].children[k].cameraId) {//有没有摄像头 + for (let i = 0; i < myplainOptions.length; i++) { if (myplainOptions[i].value == treeData[j].children[k].cameraId) { myplainOptions.splice(i, 1) } @@ -396,7 +468,7 @@ const MirroringDetail = (props) => {
{ - (item.children && item.children.length > 0 && item.children[0].cameraId) || keyArr.length > 2||item.cameraId ? ('') : ( + (item.children && item.children.length > 0 && item.children[0].cameraId) || keyArr.length > 2 || item.cameraId ? ('') : (
nodeAdd(item)}> { ) }; function toback () {//返回上一个页面 - history.goBack() + if (hasModify) { + setBackVisible(true) + } + else { + history.goBack() + } } function tochange (index) {//节点样式功能切换 setChooseNum(index); @@ -438,6 +515,7 @@ const MirroringDetail = (props) => { key: '0', }) } + sethasModify(true) setTreeData(mainData) } function searchCamera () {//查询摄像头 @@ -611,7 +689,7 @@ const MirroringDetail = (props) => { } } } - console.log('mainDatamainDatamainData',mainData); + sethasModify(true) setTreeData(mainData); setAddCamera(false); setMykeyword('') @@ -642,22 +720,26 @@ const MirroringDetail = (props) => { filters: [] }) } + sethasModify(true) setFilterGroup(filterGroupList) } function switchOnChange (val, index) {//筛选项是否禁用 let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) filterGroupList[index].forbidden = val setFilterGroup(filterGroupList) + sethasModify(true) } function screenDel (index) {//筛选项删除 let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) filterGroupList.splice(index, 1) setFilterGroup(filterGroupList) + sethasModify(true) } function toEditscreen (val, index) {//编辑筛选项名称 let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) filterGroupList[index].name = val setFilterGroup(filterGroupList) + sethasModify(true) } function toAddLabel () {//添加标签组 let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) @@ -675,29 +757,33 @@ const MirroringDetail = (props) => { cameraIds: [] }) } + sethasModify(true) setFilterGroup(filterGroupList) } function labelDel (index) {//标签组删除 let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) filterGroupList[addLabelNum].filters.splice(index, 1) setFilterGroup(filterGroupList) + sethasModify(true) } - function addFiltersCamera (val, index) { + function addFiltersCamera (val, index) {//标签组添加摄像头 let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) filterGroupList[addLabelNum].filters[index].cameraIds = val setFilterGroup(filterGroupList) + sethasModify(true) } - function toEditLabel (val, index) { + function toEditLabel (val, index) {//标签组名称修改 let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) filterGroupList[addLabelNum].filters[index].name = val setFilterGroup(filterGroupList) + sethasModify(true) } return (
-
+
{ { editHeaderName ? (
- { setEditHeaderName(false) }} onChange={(value) => setHeaderName(value)} style={{ width: 200,color: 'rgba(255,255,255,0.9)',background: 'rgba(0,0,0,0.2)' }} maxLength={20} className='inputpadding'> + { setEditHeaderName(false) }} onChange={(value) => setHeaderName(value)} style={{ width: 200, color: 'rgba(255,255,255,0.9)', background: 'rgba(0,0,0,0.2)' }} maxLength={20} className='inputpadding'>
) : (
@@ -716,7 +802,7 @@ const MirroringDetail = (props) => {
) } -
+
设置 {
-
{setVideoPlay(!videoPlay)}}> +
{ setVideoPlay(!videoPlay) }}> 设置
-
{topublish(false)}}> +
{ hasModify ? topublish(false) : '' }}> 设置
-
{topublish(true)}}> +
{ topublish(true) }}> 设置 {
header
-
setShowHeader(v)} size="small" aria-label="是否有头部">
+
setShowHeader(v)} size="small" aria-label="是否有头部">
{ setComingVisible(true) }}>
自定义样式
@@ -1023,7 +1109,7 @@ const MirroringDetail = (props) => { }
- +
{ > 开发中,敬请期待~ + { + topublish(false) + setBackVisible(false) + }} + width={610} + onCancel={() => { + setBackVisible(false) + }} + okText="确定" + cancelText="取消" + closeOnEsc={true} + > + 是否保存修改?~ +
) } From 9e6e5a0584764b72aa25d6dfa996c14d21a8353a Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Mon, 29 Aug 2022 14:02:02 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E9=95=9C=E5=83=8F=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../1.3.0/schema/2.create_mirror_table.sql | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 code/VideoAccess-VCMP/script/1.3.0/schema/2.create_mirror_table.sql diff --git a/code/VideoAccess-VCMP/script/1.3.0/schema/2.create_mirror_table.sql b/code/VideoAccess-VCMP/script/1.3.0/schema/2.create_mirror_table.sql new file mode 100644 index 0000000..2a8cae7 --- /dev/null +++ b/code/VideoAccess-VCMP/script/1.3.0/schema/2.create_mirror_table.sql @@ -0,0 +1,90 @@ +create table if not exists mirror +( + id serial not null, + template varchar(63) not null, + create_user integer not null, + create_time timestamp with time zone not null, + update_time timestamp with time zone, + title varchar(128), + show_header boolean not null, + publish boolean default false not null, + mid varchar(32) not null, + publish_time timestamp with time zone, + constraint mirror_pk + primary key (id) +); + +comment on column mirror.template is '模板标识'; + +create unique index if not exists mirror_id_uindex + on mirror (id); + +create table if not exists mirror_tree +( + id serial not null, + name varchar(64) not null, + level integer not null, + dependence integer, + mirror_id integer not null, + constraint mirror_tree_pk + primary key (id), + constraint mirror_tree_mirror_id_fk + foreign key (mirror_id) references mirror +); + +comment on table mirror_tree is '镜像服务的树节点'; + +comment on column mirror_tree.level is '层级标注'; + +create unique index if not exists mirror_tree_id_uindex + on mirror_tree (id); + +create table if not exists mirror_filter_group +( + id serial not null, + name varchar(64) not null, + forbidden boolean default false not null, + mirror_id integer not null, + constraint mirror_filter_group_pk + primary key (id), + constraint mirror_filter_group_mirror_id_fk + foreign key (mirror_id) references mirror +); + +comment on table mirror_filter_group is '筛选分组'; + +create unique index if not exists mirror_filter_group_id_uindex + on mirror_filter_group (id); + +create table if not exists mirror_filter +( + id serial not null, + name varchar(64) not null, + group_id integer not null, + constraint mirror_filter_pk + primary key (id), + constraint mirror_filter_mirror_filter_group_id_fk + foreign key (group_id) references mirror_filter_group +); + +create unique index if not exists mirror_filter_id_uindex + on mirror_filter (id); + +create table if not exists mirror_camera +( + id serial not null, + camera_id integer not null, + tree_ids integer[] not null, + filter_ids integer[], + mirror_id integer not null, + constraint mirror_camera_pk + primary key (id), + constraint mirror_camera_camera_id_fk + foreign key (camera_id) references camera, + constraint mirror_camera_mirror_id_fk + foreign key (mirror_id) references mirror +); + +create unique index if not exists mirror_camera_id_uindex + on mirror_camera (id); + From c01b9a9a60eccd5077680c54c1ddeec9688fe1d7 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Mon, 29 Aug 2022 14:13:47 +0800 Subject: [PATCH 3/4] dockerfile --- code/VideoAccess-VCMP/api/Dockerfile | 41 ++++++++++++++++-------- code/VideoAccess-VCMP/web/Dockerfile | 48 ++++++++++++++++++---------- 2 files changed, 60 insertions(+), 29 deletions(-) diff --git a/code/VideoAccess-VCMP/api/Dockerfile b/code/VideoAccess-VCMP/api/Dockerfile index 13c1e95..74ac3c3 100644 --- a/code/VideoAccess-VCMP/api/Dockerfile +++ b/code/VideoAccess-VCMP/api/Dockerfile @@ -1,21 +1,36 @@ -FROM repository.anxinyun.cn/devops/node:12-dev as builder +# FROM repository.anxinyun.cn/devops/node:12-dev as builder -COPY . /var/app +# COPY . /var/app -WORKDIR /var/app +# WORKDIR /var/app -EXPOSE 8080 +# EXPOSE 8080 + +# RUN npm config set registry=http://10.8.30.22:7000 +# RUN echo "{\"time\":\"$BUILD_TIMESTAMP\",\"build\": \"$BUILD_NUMBER\",\"revision\": \"$SVN_REVISION_1\",\"URL\":\"$SVN_URL_1\"}" > version.json +# RUN npm cache clean -f +# RUN rm -rf package-lock.json +# RUN npm install --registry http://10.8.30.22:7000 + +# FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12 + +# COPY --from=builder --chown=node /var/app /home/node/app + +# WORKDIR /home/node/app -RUN npm config set registry=http://10.8.30.22:7000 -RUN echo "{\"time\":\"$BUILD_TIMESTAMP\",\"build\": \"$BUILD_NUMBER\",\"revision\": \"$SVN_REVISION_1\",\"URL\":\"$SVN_URL_1\"}" > version.json -RUN npm cache clean -f -RUN rm -rf package-lock.json -RUN npm install --registry http://10.8.30.22:7000 +# CMD ["node", "server.js"] -FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12 -COPY --from=builder --chown=node /var/app /home/node/app +# 旧版本构建方式 + +FROM repository.anxinyun.cn/base-images/nodejs12:20.10.12.2 + +COPY . /var/app + +WORKDIR /var/app + +EXPOSE 8080 -WORKDIR /home/node/app +CMD ["-u", "http://localhost:8088"] -CMD ["node", "server.js"] \ No newline at end of file +ENTRYPOINT [ "node", "server.js" ] \ No newline at end of file diff --git a/code/VideoAccess-VCMP/web/Dockerfile b/code/VideoAccess-VCMP/web/Dockerfile index 9e05d4b..12a6800 100644 --- a/code/VideoAccess-VCMP/web/Dockerfile +++ b/code/VideoAccess-VCMP/web/Dockerfile @@ -1,24 +1,40 @@ -FROM repository.anxinyun.cn/devops/node:12-dev as builder +# FROM repository.anxinyun.cn/devops/node:12-dev as builder -COPY . /var/app +# COPY . /var/app -WORKDIR /var/app +# WORKDIR /var/app -EXPOSE 8080 +# EXPOSE 8080 + +# RUN npm config set registry=http://10.8.30.22:7000 +# RUN echo "{\"time\":\"$BUILD_TIMESTAMP\",\"build\": \"$BUILD_NUMBER\",\"revision\": \"$SVN_REVISION_1\",\"URL\":\"$SVN_URL_1\"}" > version.json +# RUN npm cache clean -f +# RUN npm install --registry http://10.8.30.22:7000 +# RUN npm run build +# RUN rm -rf client/src +# RUN rm -rf node_modules +# RUN npm install --production --registry http://10.8.30.22:7000 + +# FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node-16:7.22-06-20 + +# COPY --from=builder --chown=node /var/app /home/node/app + +# WORKDIR /home/node/app + +# CMD ["node", "server.js"] -RUN npm config set registry=http://10.8.30.22:7000 -RUN echo "{\"time\":\"$BUILD_TIMESTAMP\",\"build\": \"$BUILD_NUMBER\",\"revision\": \"$SVN_REVISION_1\",\"URL\":\"$SVN_URL_1\"}" > version.json -RUN npm cache clean -f -RUN npm install --registry http://10.8.30.22:7000 -RUN npm run build -RUN rm -rf client/src -RUN rm -rf node_modules -RUN npm install --production --registry http://10.8.30.22:7000 -FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node-16:7.22-06-20 +# 就版本构建方式 -COPY --from=builder --chown=node /var/app /home/node/app -WORKDIR /home/node/app +FROM repository.anxinyun.cn/base-images/nodejs12:20.10.12.2 + +COPY . /var/app + +WORKDIR /var/app + +EXPOSE 8080 + +CMD ["-u", "http://localhost:8088"] -CMD ["node", "server.js"] \ No newline at end of file +ENTRYPOINT [ "node", "server.js" ] \ No newline at end of file From 1b10eba24f4f98d2d1f09c807e9faf1dfb953bda Mon Sep 17 00:00:00 2001 From: deartibers <947466799@qq.com> Date: Mon, 29 Aug 2022 14:40:05 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=8E=BB=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../openness/containers/mirroringDetail.jsx | 124 +++++++++++++++--- 1 file changed, 104 insertions(+), 20 deletions(-) diff --git a/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx b/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx index 9912178..3f400e3 100644 --- a/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx +++ b/code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx @@ -1,8 +1,9 @@ import React, { useEffect, useState, useRef } from 'react'; import { connect } from 'react-redux'; import '../style.less' -import { Tree, Popconfirm, Typography, Input, Switch, Modal, Checkbox, CheckboxGroup, Select } from "@douyinfe/semi-ui" +import { Tree, Popconfirm, Typography, Input, Switch, Modal, Checkbox, CheckboxGroup, Select, Toast,Button } from "@douyinfe/semi-ui" import VideoScreen from '../components/videoScreen'; +import { set } from 'nprogress'; const MirroringDetail = (props) => { @@ -183,18 +184,51 @@ const MirroringDetail = (props) => { setCheckall(checkedList.length === showCameraList.length); } function topublish (publish) {//编辑镜像信息 - let mirrordata = { - mirrorId: mirrorId, - template: template, - title: headerName, - showHeader: showHeader, - publish: publish, - tree: treeData, - filterGroup: filterGroup + let filterGroupnum=0 + let cantopublish=true + for (let i = 0; i < filterGroup.length; i++) { + for (let j = 0; j < filterGroup.length; j++) { + if(filterGroup[i].name==filterGroup[j].name){ + filterGroupnum++ + } + } + } + if(filterGroupnum>filterGroup.length){ + cantopublish=false + let opts = { + content: '筛选项名称不能重复,请修改', + duration: 3, + }; + Toast.error(opts) + }else{ + for (let k = 0; k < filterGroup.length; k++) { + let filtersarr=[] + for (let l = 0; l < filterGroup[k].filters.length; l++) { + filtersarr.push(filterGroup[k].filters[l].name) + } + if(Array.from(new Set(filtersarr)).length { + history.goBack() + }) } - dispatch(openness.putMirror(mirrordata)).then((res) => { - history.goBack() - }) } function nodeDelete (item) {//删除树状子节点 let mainData = JSON.parse(JSON.stringify(treeData)) @@ -723,6 +757,44 @@ const MirroringDetail = (props) => { sethasModify(true) setFilterGroup(filterGroupList) } + function toChangeScreen (num, name) {//筛选项去重 + let samenum = 0 + for (let i = 0; i < filterGroup.length; i++) { + if (filterGroup[i].name == name) { + samenum++ + } + } + if (samenum > 1) { + let opts = { + content: '筛选项名称不能重复,请修改', + duration: 3, + }; + Toast.error(opts) + setEditNum(num) + } + else { + setEditNum(1000) + } + } + function toChangeLabel (num, name, index) {//标签组去重 + let samenum = 0 + for (let i = 0; i < filterGroup[index].filters.length; i++) { + if (filterGroup[index].filters[i].name == name) { + samenum++ + } + } + if (samenum > 1) { + let opts = { + content: '标签组名称不能重复,请修改', + duration: 3, + }; + Toast.error(opts) + setLabelEditNum(num) + } + else { + setLabelEditNum(1000) + } + } function switchOnChange (val, index) {//筛选项是否禁用 let filterGroupList = JSON.parse(JSON.stringify(filterGroup)) filterGroupList[index].forbidden = val @@ -1000,7 +1072,7 @@ const MirroringDetail = (props) => {
{ editNum == item.num ? ( - { setEditNum(1000) }} onChange={(value) => toEditscreen(value, index)} style={{ width: 120 }} maxLength={8} className='inputpadding' size='small'> + { toChangeScreen(item.num, item.name) }} onChange={(value) => toEditscreen(value, index)} style={{ width: 120 }} maxLength={8} className='inputpadding' size='small'> ) : (item.name) }
@@ -1068,7 +1140,7 @@ const MirroringDetail = (props) => {
{ labelEditNum == item.num ? ( - { setLabelEditNum(1000) }} onChange={(value) => toEditLabel(value, index)} style={{ width: 120 }} maxLength={8} className='inputpadding' size='small'> + { toChangeLabel(item.num, item.name, addLabelNum) }} onChange={(value) => toEditLabel(value, index)} style={{ width: 120 }} maxLength={8} className='inputpadding' size='small'> ) : (item.name) }
@@ -1121,6 +1193,7 @@ const MirroringDetail = (props) => { width={610} onCancel={() => { setComingVisible(false) + history.goBack() }} okText="确定" cancelText="取消" @@ -1131,17 +1204,28 @@ const MirroringDetail = (props) => { { - topublish(false) - setBackVisible(false) - }} width={610} onCancel={() => { setBackVisible(false) }} - okText="确定" - cancelText="取消" + // okText="确定" + // cancelText="取消" closeOnEsc={true} + footer={ +
+ + +
+ } > 是否保存修改?~