Browse Source

列表展开与勾选

dev_trial
wenlele 2 years ago
parent
commit
245245a69a
  1. 8
      code/VideoAccess-VCMP/api/app/lib/controllers/mirror/index.js
  2. 9
      code/VideoAccess-VCMP/api/app/lib/models/mirror.js
  3. 8
      code/VideoAccess-VCMP/script/1.6.3.1/achema/1.update_mirror.sql
  4. 35
      code/VideoAccess-VCMP/web/client/src/sections/openness/components/container.jsx
  5. 6
      code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoScreen.jsx
  6. 54
      code/VideoAccess-VCMP/web/client/src/sections/openness/containers/callService.jsx
  7. 2691
      code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx

8
code/VideoAccess-VCMP/api/app/lib/controllers/mirror/index.js

@ -9,7 +9,7 @@ async function edit (ctx) {
const { userId } = ctx.fs.api
const data = ctx.request.body
const timeNow = moment()
const { mirrorId, tree = [], filterGroup = [], listOpen = false } = data
const { mirrorId, tree = [], filterGroup = [], listOpen = false ,check=[] } = data
let mirrorId_ = mirrorId
if (mirrorId_) {
@ -18,7 +18,8 @@ async function edit (ctx) {
updateTime: timeNow.format(),
title: data.title,
showHeader: Boolean(data.showHeader),
listOpen:listOpen
listOpen:listOpen,
check:check
}
if (data.publish) {
upData.publish = true
@ -64,7 +65,8 @@ async function edit (ctx) {
showHeader: Boolean(data.showHeader),
publish: false,
mid: timeNow.format(`ssmmHHDDMMYY${Math.floor(Math.random() * 89 + 10)}`),
listOpen: listOpen
listOpen: listOpen,
check:check
}
if (data.publish) {
createData.publish = true

9
code/VideoAccess-VCMP/api/app/lib/models/mirror.js

@ -87,6 +87,15 @@ module.exports = dc => {
field: "publish",
autoIncrement: false
},
check: {
type: DataTypes.ARRAY(DataTypes.INTEGER),
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "check",
autoIncrement: false
},
mid: {
type: DataTypes.STRING,
allowNull: false,

8
code/VideoAccess-VCMP/script/1.6.3.1/achema/1.update_mirror.sql

@ -1,4 +1,10 @@
alter table mirror
add list_open boolean;
comment on column mirror.list_open is '镜像大屏列表是否折叠';
comment on column mirror.list_open is '镜像大屏列表是否折叠';
alter table mirror
add "check" integer[];
comment on column mirror."check" is '分组勾选';

35
code/VideoAccess-VCMP/web/client/src/sections/openness/components/container.jsx

@ -12,22 +12,18 @@ const Container = ({ videoObj, pageSize, showHeader, videoPlay, mould }) => {
// console.log(videoObj);
useEffect(() => {
// const resize_ = async () => {
// try {
// let video = document.getElementById('video' + videoObj.key)
// if (video) {
// await setVideoWidth(video.clientWidth)
// await setVideoHeight(video.clientHeight)
// }
// } catch (error) {
// console.error(error)
// }
// }
// resize_()
// window.addEventListener('resize', resize_); //
// return () => {
// window.removeEventListener('resize', resize_);
// }
const resize_ = async () => {
try {
let video = document.getElementById('video' + videoObj.key)
if (video) {
await setVideoWidth(video.clientWidth)
await setVideoHeight(video.clientHeight)
}
} catch (error) {
console.error(error)
}
}
const div = document.getElementById('rearProjection');
@ -42,7 +38,14 @@ const Container = ({ videoObj, pageSize, showHeader, videoPlay, mould }) => {
};
document.addEventListener('fullscreenchange', handleFullscreenChange);
resize_()
window.addEventListener('resize', resize_); //
return () => {
window.removeEventListener('resize', resize_);
document.removeEventListener('fullscreenchange', handleFullscreenChange);
};
}, [])

6
code/VideoAccess-VCMP/web/client/src/sections/openness/components/videoScreen.jsx

@ -8,7 +8,7 @@ import PerfectScrollbar from "perfect-scrollbar";
let timing
let projectScrollbar;
const VideoScreen = ({ treeData, filterGroup, videoPlay, template, headerName, showHeader, listOpen }) => {
const VideoScreen = ({ treeData, filterGroup, videoPlay, template, treeValue, headerName, showHeader, listOpen }) => {
// console.log('', treeData);
// console.log('', filterGroup);
// console.log(headerName);
@ -112,9 +112,9 @@ const VideoScreen = ({ treeData, filterGroup, videoPlay, template, headerName, s
let values = treeData.map(v => v.value)
videoData(treeData, values)
setLefTtree(treeData)
setLeftValue(treeData.map(v => v.value))
setLeftValue(treeValue)
api.current?.reset()
}, [treeData, filterGroup])
}, [treeValue,treeData, filterGroup])
useEffect(() => {

54
code/VideoAccess-VCMP/web/client/src/sections/openness/containers/callService.jsx

@ -18,6 +18,7 @@ const CallService = (props) => {
const [videoPlay, setVideoPlay] = useState(true) //
const [listOpen, setlistOpen] = useState(false)//
const [loading, setLoading] = useState(false)
const [treeValue, setTreeValue] = useState([])
useEffect(async () => {
@ -40,6 +41,58 @@ const CallService = (props) => {
setlistOpen(data.listOpen || false)
setFilterGroup(filterGrouplist)
setTemplate(data.template)
if (data?.check?.length > 0) {
let checks = data?.check
let vlaue = []
data?.tree?.map(f => {
if (f.children?.length > 0) { //1
f.children?.map(d => {
if (checks.includes(d.cameraId)) {
vlaue.push(d.key);
} else if (d.children?.length > 0) { //2
d.children?.map(s => {
if (checks.includes(s.cameraId)) {
vlaue.push(s.key);
} else if (s.children?.length > 0) {
s.children?.map(g => { //3
if (checks.includes(g.cameraId)) {
vlaue.push(g.key);
}
})
}
})
}
})
}
})
setTreeValue(vlaue)
} else {
let vlaue = []
data?.tree?.map(f => {
if (f.children?.length > 0) { //1
f.children?.map(d => {
if (d.cameraId) {
vlaue.push(d.key);
} else if (d.children?.length > 0) { //2
d.children?.map(s => {
if (s.cameraId) {
vlaue.push(s.key);
} else if (s.children?.length > 0) {
s.children?.map(g => { //3
if (g.cameraId) {
vlaue.push(g.key);
}
})
}
})
}
})
}
})
console.log(vlaue);
setTreeValue(vlaue)
}
} else {
dispatch(push('/noMatch'))
Notification.error({
@ -57,6 +110,7 @@ const CallService = (props) => {
{treeData && loading ? <VideoScreen
treeData={treeData}
treeValue={treeValue}
headerName={headerName}
showHeader={showHeader}
filterGroup={filterGroup}

2691
code/VideoAccess-VCMP/web/client/src/sections/openness/containers/mirroringDetail.jsx

File diff suppressed because it is too large
Loading…
Cancel
Save