From 3a5ea96745081df8ce55cbdcfce9d88adefac347 Mon Sep 17 00:00:00 2001 From: zhaobing Date: Fri, 14 Jul 2023 12:33:47 +0800 Subject: [PATCH 1/6] =?UTF-8?q?feat:=E6=96=B0=E5=A2=9E=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E9=9A=90=E8=97=8F+=E6=96=B0=E5=BB=BA=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=8F=AA=E8=83=BD=E6=93=8D=E4=BD=9C=E7=94=A8=E6=88=B7=E6=89=80?= =?UTF-8?q?=E5=9C=A8=E9=83=A8=E9=97=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/report/index.js | 16 ++++++----- .../fillion/components/patrolTable.js | 28 ++++++++----------- .../organization/components/userModal.js | 20 +++++++++++-- .../sections/organization/containers/user.js | 7 +++-- 4 files changed, 43 insertions(+), 28 deletions(-) diff --git a/api/app/lib/controllers/report/index.js b/api/app/lib/controllers/report/index.js index 2ca58067..c15235f5 100644 --- a/api/app/lib/controllers/report/index.js +++ b/api/app/lib/controllers/report/index.js @@ -1,7 +1,7 @@ 'use strict'; const { QueryTypes } = require('sequelize'); -async function reportList (ctx) { +async function reportList(ctx) { try { const models = ctx.fs.dc.models; const { limit, page, startTime, endTime, keyword, userId, reportType, isTop, asc, projectType, handleState = '', performerId = '' } = ctx.query @@ -48,7 +48,9 @@ async function reportList (ctx) { model: models.User, attributes: ['name'] }], - order: [['time', asc ? 'ASC' : 'DESC']], + //order: [['time', asc ? 'ASC' : 'DESC']], + order: [['time', 'DESC']], + } if (limit) { findOption.limit = limit @@ -114,7 +116,7 @@ async function reportList (ctx) { } } -async function reportPosition (ctx) { +async function reportPosition(ctx) { try { const models = ctx.fs.dc.models; const { startTime, endTime, userId, reportType } = ctx.query @@ -164,7 +166,7 @@ async function reportPosition (ctx) { } } -async function reportDetail (ctx) { +async function reportDetail(ctx) { try { const models = ctx.fs.dc.models; const { reportId } = ctx.params @@ -186,7 +188,7 @@ async function reportDetail (ctx) { } } -async function reportHandle (ctx) { +async function reportHandle(ctx) { try { const { models } = ctx.fs.dc; @@ -216,7 +218,7 @@ async function reportHandle (ctx) { } } -async function createReport (ctx) { +async function createReport(ctx) { try { const { userId } = ctx.fs.api const models = ctx.fs.dc.models; @@ -238,7 +240,7 @@ async function createReport (ctx) { } } -async function deleteReport (ctx) { +async function deleteReport(ctx) { try { const models = ctx.fs.dc.models; const { reportId } = ctx.params; diff --git a/web/client/src/sections/fillion/components/patrolTable.js b/web/client/src/sections/fillion/components/patrolTable.js index 823f273a..93cd5f86 100644 --- a/web/client/src/sections/fillion/components/patrolTable.js +++ b/web/client/src/sections/fillion/components/patrolTable.js @@ -368,23 +368,19 @@ const PatrolNameList = (props) => { }); return children; }; - if (user?.username === 'SuperAdmin') { - departments = [...new Set(depAllUser)] - } else { - let depAllUserCopy = [] - depAllUser.map((item) => { - if (item.depId === user?.departmentId) { - depAllUserCopy.push(item) - } - }) - departments = [...new Set(depAllUserCopy)] + if (depAllUser && depAllUser.length) { + if (user?.username === 'SuperAdmin') { + departments = [...new Set(depAllUser)] + } else { + const targetDepartment = depAllUser.find(department => department.users.some(item => item.id === user?.id)); + departments = [targetDepartment] + } + const processedData = []; + const expandedKeys = generateData(departments, null, processedData); + setDefaultData(processedData); + setDataList(processedData.map(item => ({ key: item.key, title: item.title.toString(), children: item.children }))); + setExpandedKeys(expandedKeys); } - - const processedData = []; - const expandedKeys = generateData(departments, null, processedData); - setDefaultData(processedData); - setDataList(processedData.map(item => ({ key: item.key, title: item.title.toString(), children: item.children }))); - setExpandedKeys(expandedKeys); }, [depAllUser]) useEffect(() => { diff --git a/web/client/src/sections/organization/components/userModal.js b/web/client/src/sections/organization/components/userModal.js index 01e731a2..4e94e0ff 100644 --- a/web/client/src/sections/organization/components/userModal.js +++ b/web/client/src/sections/organization/components/userModal.js @@ -3,14 +3,30 @@ import { connect } from 'react-redux'; import { Spin } from 'antd'; import ProForm, { ProFormText, ModalForm, ProFormSwitch, ProFormTreeSelect } from '@ant-design/pro-form'; + + const UserModal = (props) => { - const { visible, modalType, depData, onVisibleChange, onConfirm, editData } = props + const { visible, modalType, depData, onVisibleChange, onConfirm, editData, depMessagedata } = props + const pakData = (dep) => { + // console.log(dep); + return dep.map((d) => { + return { + title: d.name, + value: d.id, + // key: d.id, + children: pakData(d.subordinate) + } + }) + } + + let depDatas = pakData(depMessagedata || []) const onFinish = (values) => { if (onConfirm) { onConfirm(values); } } + const checkName = (rule, value, callback) => { if (value && value.replace(/[^\u4E00-\u9FA5]/g).includes('undefined')) { callback(new Error('请输入中文!')); @@ -98,7 +114,7 @@ const UserModal = (props) => { }} rules={[{ required: true, message: '请选择所属部门' }]} request={async () => { - return depData + return depDatas }} expandedKeys={["title"]} /> diff --git a/web/client/src/sections/organization/containers/user.js b/web/client/src/sections/organization/containers/user.js index 2a4de927..fde71379 100644 --- a/web/client/src/sections/organization/containers/user.js +++ b/web/client/src/sections/organization/containers/user.js @@ -315,14 +315,14 @@ const UserManage = (props) => { - + 新建部门 : null} + { depMessage.length ? @@ -412,6 +412,7 @@ const UserManage = (props) => { { depMessage.length && modalVisible ? Date: Fri, 14 Jul 2023 13:29:37 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=EF=BC=88*=EF=BC=89=E4=BF=AE=E6=94=B9title?= =?UTF-8?q?=EF=BC=8C=E5=BD=B1=E8=97=8F=E6=B7=BB=E5=8A=A0=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/src/packages/patrol/index.jsx | 36 +++++++++++++++---------- weapp/src/packages/patrolView/index.jsx | 2 +- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx index 31a4ff5a..d1002660 100644 --- a/weapp/src/packages/patrol/index.jsx +++ b/weapp/src/packages/patrol/index.jsx @@ -19,7 +19,8 @@ const Index = () => { const isSuperAdmin = userInfo && userInfo.username === 'SuperAdmin' ? true : false const router = useRouter() - const { params: { type, kind, wait, handle } } = router + const { params: { type, kind, wait, handle, videoShow } } = router + console.log(router); const isView = type === 'view' ? true : false const isPatrol = kind === 'patrol' || kind == 'conserve' ? true : false const isRoad = kind === 'road' ? true : false @@ -105,8 +106,10 @@ const Index = () => { useEffect(() => { if (isRoad) { Taro.setNavigationBarTitle({ title: '在建项目' }) - } else if (wait == 'wait' || handle == 'handle') { + } else if (wait == 'wait') { Taro.setNavigationBarTitle({ title: '待办事项' }) + }else if (handle == 'handle') { + Taro.setNavigationBarTitle({ title: '已办事项' }) } else if (isAnomaly) { Taro.setNavigationBarTitle({ title: '异常反馈' }) } else if (kind == 'conserve') { @@ -594,6 +597,8 @@ const Index = () => { } }) } + console.log(scenePic, '现场图片'); + console.log(videoShow, 'videoShow'); return ( {/* { @@ -891,19 +896,22 @@ const Index = () => { } { - video.length ?