diff --git a/api/.vscode/launch.json b/api/.vscode/launch.json index b50512d0..f64903e9 100644 --- a/api/.vscode/launch.json +++ b/api/.vscode/launch.json @@ -15,13 +15,15 @@ "args": [ "-p 13400", "-f http://localhost:13400", - // "-g postgres://postgres:123@10.8.30.32:5432/highways4good", - "-g postgres://FashionAdmin:123456@10.8.30.156:5432/highway4goodn0728", + "-g postgres://postgres:123@10.8.30.32:5432/highways4good", + //"-g postgres://FashionAdmin:123456@10.8.30.156:5432/highway4goodn0728", "--qnak XuDgkao6cL0HidoMAPnA5OB10Mc_Ew08mpIfRJK5", "--qnsk yewcieZLzKZuDfig0wLZ9if9jKp2P_1jd3CMJPSa", "--qnbkt dev-highways4good", // "--qndmn http://resources.anxinyun.cn", "--qndmn http://rfkimpwbb.hn-bkt.clouddn.com", + "--yingshiKey d0704fb9d5d14a6682c1c1d592c12512", + "--yingshiSecret 93d023269495b86be62cdfdcf34a6cd1" ] }, { diff --git a/api/app/lib/controllers/auth/index.js b/api/app/lib/controllers/auth/index.js index f2554ee0..2f42059b 100644 --- a/api/app/lib/controllers/auth/index.js +++ b/api/app/lib/controllers/auth/index.js @@ -4,7 +4,7 @@ const MD5 = require('crypto-js/md5'); const moment = require('moment'); const uuid = require('uuid'); -async function login(ctx, next) { +async function login (ctx, next) { const transaction = await ctx.fs.dc.orm.transaction(); try { const models = ctx.fs.dc.models; @@ -77,7 +77,7 @@ async function login(ctx, next) { * 微信小程序登录 * @@requires.body {phone-手机号, password-密码} ctx */ -async function wxLogin(ctx, next) { +async function wxLogin (ctx, next) { const transaction = await ctx.fs.dc.orm.transaction(); try { const models = ctx.fs.dc.models; @@ -106,14 +106,27 @@ async function wxLogin(ctx, next) { let userRslt = Object.assign({ authorized: true, + loginSource: 'wx', token: token, - ...userRes.dataValues + ...userRes.dataValues, }); + + if (params.phone == 'SuperAdmin') { + const allResource = await models.Resource.findAll({}) + userRslt.userResources = allResource.map(r => { + return { + resourceId: r.dataValues.code + } + }) + } await models.UserToken.create({ token: token, userInfo: userRslt, expired: moment().add(30, 'day').format('YYYY-MM-DD HH:mm:ss') }, { transaction: transaction }); + + + ctx.status = 200; ctx.body = Object.assign({ ...userRslt, @@ -130,7 +143,7 @@ async function wxLogin(ctx, next) { } } -async function logout(ctx) { +async function logout (ctx) { try { const { token, code } = ctx.request.body; const models = ctx.fs.dc.models; diff --git a/api/app/lib/controllers/data/assess.js b/api/app/lib/controllers/data/assess.js index e974d8a7..71145f50 100644 --- a/api/app/lib/controllers/data/assess.js +++ b/api/app/lib/controllers/data/assess.js @@ -4,7 +4,7 @@ const moment = require('moment') async function assessGet (ctx) { try { const models = ctx.fs.dc.models; - const { unit, month } = ctx.query; + const { unit, month, page, limit } = ctx.query; let findOption = { where: { @@ -21,7 +21,14 @@ async function assessGet (ctx) { findOption.where.unit = unit } - const roadRes = await models.Assess.findAll(findOption) + if (limit) { + findOption.limit = limit + } + if (page && limit) { + findOption.offset = (page - 1) * limit + } + + const roadRes = await models.Assess.findAndCountAll(findOption) ctx.status = 200; ctx.body = roadRes @@ -39,9 +46,23 @@ async function assessEdit (ctx) { const models = ctx.fs.dc.models; const data = ctx.request.body; + const repeatRes = await models.Assess.findOne({ + where: { + unit: data.unit, + month: { $between: [moment(data.month).startOf('month').format(), moment(data.month).endOf('month').format()] } + } + }) + if (!data.assessId) { + if (repeatRes) { + throw '已有相同月份的考核记录' + } + await models.Assess.create(data) } else { + if (repeatRes && repeatRes.id != data.assessId) { + throw '已有相同月份的考核记录' + } await models.Assess.update( data, { where: { @@ -81,6 +102,42 @@ async function assessDel (ctx) { } } +async function nearestSourceData (ctx) { + try { + const { models } = ctx.fs.dc; + const { monthRange } = ctx.query + + // 查最近的有数据的月份的数据 + const nearestRes = await models.Assess.findOne({ + order: [['month', 'DESC']], + }) + + let rslt = [] + if (nearestRes) { + rslt = await models.Assess.findAll({ + attributes: ['totalPoints', 'unit', 'month'], + where: { + month: { + $between: [ + moment(nearestRes.month).subtract(monthRange || 0, 'month').startOf('month').format(), moment(nearestRes.month).endOf('month').format() + ] + } + }, + order: [['month', 'DESC']], + }) + } + + ctx.status = 200; + ctx.body = rslt + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: error`); + ctx.status = 400; + ctx.body = { + message: typeof error == 'string' ? error : undefined + } + } +} + module.exports = { - assessGet, assessEdit, assessDel, + assessGet, assessEdit, assessDel, nearestSourceData, }; \ No newline at end of file diff --git a/api/app/lib/controllers/data/videoCenter.js b/api/app/lib/controllers/data/videoCenter.js new file mode 100644 index 00000000..d66f6d60 --- /dev/null +++ b/api/app/lib/controllers/data/videoCenter.js @@ -0,0 +1,59 @@ +'use strict'; +const moment = require('moment') +const request = require('superagent') + +function videoList (opts) { + return async function (ctx) { + try { + const { models, } = ctx.fs.dc; + const { app, yingshiTokenRes } = ctx + + let yingshiToken = '' + if (yingshiTokenRes && yingshiTokenRes.token && yingshiTokenRes.expire && moment().isBefore(moment(yingshiTokenRes.expire))) { + yingshiToken = yingshiTokenRes.token + } else { + const tokenRes = await app.fs.yingshiRequest.post(`lapp/token/get`, { + query: { + appKey: opts.yingshiKey, + appSecret: opts.yingshiSecret + } + }) + if (tokenRes.code == 200 && tokenRes.data) { + const { accessToken, expireTime } = tokenRes.data + + ctx.yingshiTokenRes = { + token: accessToken, + expire: expireTime + } + yingshiToken = accessToken + } else { + throw '未能获取进行萤石鉴权' + } + } + + const deviceRes = await app.fs.yingshiRequest.post(`lapp/device/list`, { + query: { + accessToken: yingshiToken, + } + }) + + ctx.status = 200; + ctx.body = (deviceRes.data || []).map(item => { + return { + ...item, + token: yingshiToken, + } + }) + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: error`); + ctx.status = 400; + ctx.body = { + message: typeof error == 'string' ? error : undefined + } + } + } +} + +module.exports = { + videoList +}; \ No newline at end of file diff --git a/api/app/lib/controllers/organization/depUsers.js b/api/app/lib/controllers/organization/depUsers.js new file mode 100644 index 00000000..255bb7cf --- /dev/null +++ b/api/app/lib/controllers/organization/depUsers.js @@ -0,0 +1,65 @@ +'use strict'; + +async function getDepUsers(ctx) { + try { + const models = ctx.fs.dc.models; + //所有部门 + const departments = await models.Department.findAll({ + attributes: ['id', 'name', 'dependence'], + order: [['id', 'asc']], + where: { + delete: false, + }, + }) + //所有用户 + const allusers = await models.User.findAll({ + attributes: ['id', 'name', 'username', 'department_id'], + order: [['id', 'asc']], + where: { + delete: false, + }, + }) + const employees = [...new Set(allusers)] + function collectEmployees(departments, employees) { + const result = []; + const processDepartment = (department) => { + const departmentData = { + depId: department.id, + depName: department.name, + users: [], + expanded: false, // 初始状态折叠 + }; + const departmentEmployees = employees.filter(employee => + //console.log('employee.dataVaules.department_id', employee.department_id) + employee.dataValues.department_id === department.id + ); + departmentData.users.push(...departmentEmployees); + departments.forEach(subDepartment => { + if (subDepartment.dependence === department.id) { + const subDepartmentData = processDepartment(subDepartment); + departmentData.users.push(...subDepartmentData.users); + } + }); + return departmentData; + }; + departments.forEach(department => { + if (department.dependence === null) { + const departmentData = processDepartment(department); + result.push(departmentData); + } + }); + return result; + } + const result = collectEmployees(departments, employees); + ctx.status = 200; + ctx.body = result + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = {} + } +} + +module.exports = { + getDepUsers +}; \ No newline at end of file diff --git a/api/app/lib/controllers/report/index.js b/api/app/lib/controllers/report/index.js index c1638f9c..1ee76d04 100644 --- a/api/app/lib/controllers/report/index.js +++ b/api/app/lib/controllers/report/index.js @@ -5,6 +5,40 @@ async function reportList (ctx) { try { const models = ctx.fs.dc.models; const { limit, page, startTime, endTime, keyword, userId, reportType, isTop, asc, projectType } = ctx.query + const { userInfo } = ctx.fs.api + const sequelize = ctx.fs.dc.orm; + + let findUsers = [] + if ( + userInfo.loginSource == 'wx' + && userInfo.isAdmin + && userInfo.phone != 'SuperAdmin' + ) { + // 是管理员但不是超管 查自己部门及下级部门的所有信息 + const sqlStr = ` + WITH RECURSIVE sub_departments AS ( + SELECT id, dependence + FROM department + WHERE id = 1 + UNION ALL + SELECT d.id, d.dependence + FROM sub_departments sd + JOIN department d ON sd.id = d.dependence + ) + SELECT u.id + FROM "user" AS u + JOIN sub_departments sd ON u.department_id = sd.id + WHERE u.delete = false; + ` + + const res = await sequelize.query(sqlStr, { type: QueryTypes.SELECT }) + let a = 1 + findUsers = res.map(item => { + return item.id + }) + findUsers.push(-1) + } + let findOption = { where: { @@ -43,6 +77,9 @@ async function reportList (ctx) { if (userId) { findOption.where.userId = userId } + if (findUsers.length) { + findOption.where.userId = { $in: findUsers } + } if (reportType) { findOption.where.reportType = reportType } @@ -53,7 +90,6 @@ async function reportList (ctx) { if (isTop) { const sqlStr = 'select * from (SELECT R.*, "row_number"() OVER(PARTITION BY R.user_id ORDER BY R."time" DESC) AS NEWINDEX FROM report AS R ) AS NR WHERE NEWINDEX = 1' - const sequelize = ctx.fs.dc.orm; reportRes = await sequelize.query(sqlStr, { type: QueryTypes.SELECT }); } else { reportRes = await models.Report.findAll(findOption) diff --git a/api/app/lib/index.js b/api/app/lib/index.js index a0fe0492..d596c7c2 100644 --- a/api/app/lib/index.js +++ b/api/app/lib/index.js @@ -5,7 +5,7 @@ const fs = require('fs'); const path = require('path'); const authenticator = require('./middlewares/authenticator'); // const apiLog = require('./middlewares/api-log'); -// const businessRest = require('./middlewares/business-rest'); +const paasRequest = require('./service/paasRequest'); module.exports.entry = function (app, router, opts) { app.fs.logger.log('info', '[FS-AUTH]', 'Inject auth and api mv into router.'); @@ -15,8 +15,9 @@ module.exports.entry = function (app, router, opts) { app.fs.api.logAttr = app.fs.api.logAttr || {}; router.use(authenticator(app, opts)); - // router.use(businessRest(app, router, opts)); // router.use(apiLog(app, opts)); + // 实例其他平台请求方法 + paasRequest(app, opts) router = routes(app, router, opts); }; diff --git a/api/app/lib/middlewares/business-rest.js b/api/app/lib/middlewares/business-rest.js deleted file mode 100644 index d9542aac..00000000 --- a/api/app/lib/middlewares/business-rest.js +++ /dev/null @@ -1,50 +0,0 @@ -'use strict'; - - const request = require('superagent'); -const buildUrl = (url,token) => { - let connector = url.indexOf('?') === -1 ? '?' : '&'; - return `${url}${connector}token=${token}`; -}; - - function factory(app, router, opts) { - return async function (ctx, next) { - - const token = ctx.fs.api.token; - - //console.log(username,password) - const req = { - get: (url, query) => { - return request - .get(buildUrl(url,token)) - .query(query) - }, - post: (url, data, query) => { - return request - .post(buildUrl(url,token)) - .query(query) - //.set('Content-Type', 'application/json') - .send(data); - }, - - put: (url, data) => { - return request - .put(buildUrl(url,token)) - //.set('Content-Type', 'application/json') - .send(data); - }, - - delete: (url) => { - return request - .del(buildUrl(url,token)) - }, - }; - - app.business = app.business || {}; - app.business.request = req; - - await next(); - }; - } - - module.exports = factory; - \ No newline at end of file diff --git a/api/app/lib/routes/data/index.js b/api/app/lib/routes/data/index.js index bc2d012a..27b41684 100644 --- a/api/app/lib/routes/data/index.js +++ b/api/app/lib/routes/data/index.js @@ -10,6 +10,7 @@ const publicity = require('../../controllers/data/publicity'); const dataIndex = require('../../controllers/data/index'); const task = require('../../controllers/data/task') const assess = require('../../controllers/data/assess') +const videoCenter = require('../../controllers/data/videoCenter') module.exports = function (app, router, opts) { @@ -23,7 +24,7 @@ module.exports = function (app, router, opts) { // 运政 //货运 - async function setFreightType(ctx, next) { + async function setFreightType (ctx, next) { ctx.request.body = { ...(ctx.request.body || {}), type: 'freight' @@ -40,7 +41,7 @@ module.exports = function (app, router, opts) { router.del('/vehicle/freight/:id', setFreightType, vehicle.del); //客运车 - async function setVehicleType(ctx, next) { + async function setVehicleType (ctx, next) { ctx.request.body = { ...(ctx.request.body || {}), type: 'vehicle' @@ -57,7 +58,7 @@ module.exports = function (app, router, opts) { router.del('/vehicle/:id', setVehicleType, vehicle.del); // 路政 - async function setRoadManageType(ctx, next) { + async function setRoadManageType (ctx, next) { ctx.request.body = { ...(ctx.request.body || {}), type: 'road_manage' @@ -192,5 +193,13 @@ module.exports = function (app, router, opts) { app.fs.api.logAttr['DEL/assess/:assessId'] = { content: '删除评分考核数据', visible: false }; router.del('/assess/:assessId', assess.assessDel); + + app.fs.api.logAttr['GET/assess/nearest'] = { content: '获取评分考核最近的月份的所有考核单位的数据', visible: true }; + router.get('/assess/nearest', assess.nearestSourceData); // 评分考核 END + + // 视频中心 + app.fs.api.logAttr['GET/videoCenter/list'] = { content: '获取萤石设备列表', visible: true }; + router.get('/videoCenter/list', videoCenter.videoList(opts)); + // 视频中心 END }; diff --git a/api/app/lib/routes/organization/index.js b/api/app/lib/routes/organization/index.js index f9c7a949..b0c4a19d 100644 --- a/api/app/lib/routes/organization/index.js +++ b/api/app/lib/routes/organization/index.js @@ -63,4 +63,6 @@ module.exports = function (app, router, opts) { + + }; \ No newline at end of file diff --git a/api/app/lib/routes/report/index.js b/api/app/lib/routes/report/index.js index d3fd64dd..708692b5 100644 --- a/api/app/lib/routes/report/index.js +++ b/api/app/lib/routes/report/index.js @@ -1,6 +1,7 @@ 'use strict'; const report = require('../../controllers/report'); +const Department = require('../../controllers/organization/depUsers') module.exports = function (app, router, opts) { app.fs.api.logAttr['GET/report/list'] = { content: '获取上报列表', visible: false }; @@ -20,4 +21,7 @@ module.exports = function (app, router, opts) { app.fs.api.logAttr['DEL/report/:reportId'] = { content: '删除上报', visible: false }; router.del('/report/:reportId', report.deleteReport); + + app.fs.api.logAttr['get/allDepUsers'] = { content: '查询所有部门的员工', visible: false }; + router.get('allDepUsers', Department.getDepUsers); } \ No newline at end of file diff --git a/api/app/lib/service/paasRequest.js b/api/app/lib/service/paasRequest.js new file mode 100644 index 00000000..1cfa0816 --- /dev/null +++ b/api/app/lib/service/paasRequest.js @@ -0,0 +1,67 @@ +'use strict'; +const request = require('superagent') + +class paasRequest { + constructor(root, { query = {} } = {}, option) { + this.root = root; + this.query = query + this.option = option + } + + #buildUrl = (url) => { + return `${this.root}/${url}`; + } + + #resultHandler = (resolve, reject) => { + return (err, res) => { + if (err) { + reject(err); + } else { + resolve(res[this.option.dataWord]); + } + }; + } + + get = (url, { query = {}, header = {} } = {}) => { + return new Promise((resolve, reject) => { + request.get(this.#buildUrl(url)).set(header).query(Object.assign(query, this.query)).end(this.#resultHandler(resolve, reject)); + }) + } + + post = (url, { data = {}, query = {}, header = {} } = {}) => { + return new Promise((resolve, reject) => { + request.post(this.#buildUrl(url)).set(header).query(Object.assign(query, this.query)).send(data).end(this.#resultHandler(resolve, reject)); + }) + } + + put = (url, { data = {}, header = {}, query = {}, } = {}) => { + return new Promise((resolve, reject) => { + request.put(this.#buildUrl(url)).set(header).query(Object.assign(query, this.query)).send(data).end(this.#resultHandler(resolve, reject)); + }) + } + + delete = (url, { header = {}, query = {} } = {}) => { + return new Promise((resolve, reject) => { + request.delete(this.#buildUrl(url)).set(header).query(Object.assign(query, this.query)).end(this.#resultHandler(resolve, reject)); + }) + } +} + +function factory (app, opts) { + if (opts.pssaRequest) { + try { + for (let r of opts.pssaRequest) { + if (r.name && r.root) { + app.fs[r.name] = new paasRequest(r.root, { ...(r.params || {}) }, { dataWord: r.dataWord || 'body' }) + } else { + throw 'opts.pssaRequest 参数错误!' + } + } + } catch (error) { + console.error(error) + process.exit(-1); + } + } +} + +module.exports = factory; diff --git a/api/config.js b/api/config.js index 109b5bad..13265b27 100644 --- a/api/config.js +++ b/api/config.js @@ -17,6 +17,8 @@ args.option('qnsk', 'qiniuSecretKey'); args.option('qnbkt', 'qiniuBucket'); args.option('qndmn', 'qiniuDomain'); // +args.option('yingshiKey', '萤石 KEY') +args.option('yingshiSecret', '萤石 SECRET') const flags = args.parse(process.argv); @@ -27,8 +29,15 @@ const QINIU_DOMAIN_QNDMN_RESOURCE = process.env.ANXINCLOUD_QINIU_DOMAIN_QNDMN_RE const QINIU_BUCKET_RESOURCE = process.env.ANXINCLOUD_QINIU_BUCKET_RESOURCE || flags.qnbkt; const QINIU_AK = process.env.ANXINCLOUD_QINIU_ACCESSKEY || flags.qnak; const QINIU_SK = process.env.ANXINCLOUD_QINIU_SECRETKEY || flags.qnsk; +// +const YINGSHI_KEY = process.env.YINGSHI_KEY || flags.yingshiKey; +const YINGSHI_SECRET = process.env.YINGSHI_SECRET || flags.yingshiSecret; +// 萤石服务的地址 +const YINGSHI_URL = process.env.YINGSHI_URL || flags.yingshiUrl || 'https://open.ys7.com/api'; -if (!FS_UNIAPP_DB) { +if ( + !FS_UNIAPP_DB || + !YINGSHI_KEY || !YINGSHI_SECRET) { console.log('缺少启动参数,异常退出'); args.showHelp(); process.exit(-1); @@ -57,7 +66,16 @@ const product = { }, { entry: require('./app').entry, opts: { + yingshiKey: YINGSHI_KEY, + yingshiSecret: YINGSHI_SECRET, exclude: [], // 不做认证的路由,也可以使用 exclude: ["*"] 跳过所有路由 + pssaRequest: [ + { + name: 'yingshiRequest', + root: YINGSHI_URL, + params: {} + } + ] } } ], diff --git a/scripts/1.2.3/schema/1.create_assess.sql b/scripts/1.2.3/schema/1.create_assess.sql new file mode 100644 index 00000000..4e15db48 --- /dev/null +++ b/scripts/1.2.3/schema/1.create_assess.sql @@ -0,0 +1,40 @@ +create table if not exists assess +( + id serial not null + constraint assess_pk + primary key, + unit varchar(64), + month timestamp with time zone, + total_points double precision, + industry_points double precision, + industry_out_points double precision, + plus_or_subtract double precision, + "industry_deduction_reason " varchar(1024), + industry_out_deduction_reason varchar(1024), + remark varchar(1024) +); + +comment on table assess is '考核评分'; + +comment on column assess.unit is '考核单位'; + +comment on column assess.month is '考核月份'; + +comment on column assess.total_points is '总分'; + +comment on column assess.industry_points is '业内得分'; + +comment on column assess.industry_out_points is '业外得分'; + +comment on column assess.plus_or_subtract is '加减得分'; + +comment on column assess."industry_deduction_reason " is '业内扣分原因 +'; + +comment on column assess.industry_out_deduction_reason is '业外扣分原因'; + +comment on column assess.remark is '备注'; + +create unique index if not exists assess_id_uindex + on assess (id); + diff --git a/weapp/src/packages/components/inputPicker/index.jsx b/weapp/src/packages/components/inputPicker/index.jsx index c28d1d87..24d06ded 100644 --- a/weapp/src/packages/components/inputPicker/index.jsx +++ b/weapp/src/packages/components/inputPicker/index.jsx @@ -6,19 +6,19 @@ import { View, Picker, Image, Input, Text } from '@tarojs/components' import arrowIcon from '../../../static/img/patrol/arrow-down.svg' import './index.scss' -export default function InputPicker(props) { - const { title, placeholder, selector, value, onInput, isView } = props +export default function InputPicker (props) { + const { title, placeholder, selector, value, onInput, isView, onlySelect } = props const [curSelector, setCurSelector] = useState([]) useEffect(() => { setCurSelector(selector) }, []) - useEffect(()=>{ + useEffect(() => { handleInput({ detail: { value: value } }) - },[value]) + }, [value]) - function handleInput({ detail: { value: v } }) { + function handleInput ({ detail: { value: v } }) { onInput(v) if (v) { setCurSelector(selector.filter(item => item && item.includes(v))) @@ -30,7 +30,7 @@ export default function InputPicker(props) { const handlePickerChange = (e) => { onInput(curSelector[e.detail.value]) } - +console.log(onlySelect); return ( @@ -42,7 +42,7 @@ export default function InputPicker(props) { border={false} value={value} onInput={handleInput} - disabled={isView} + disabled={isView || onlySelect} /> { diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx index a3dcccbb..4f0ae00a 100644 --- a/weapp/src/packages/patrol/index.jsx +++ b/weapp/src/packages/patrol/index.jsx @@ -224,7 +224,7 @@ const Index = () => { return } - if (isPatrol && prjTypeSelector.indexOf(projectType) === -1) { + if ((isPatrol || isAnomaly) && prjTypeSelector.indexOf(projectType) === -1) { Taro.showToast({ title: isAnomaly ? '反馈类型错误' : '工程类型错误', icon: 'none' }) return } @@ -520,6 +520,7 @@ const Index = () => { onInput={setProjectType} selector={prjTypeSelector} isView={isView} + onlySelect={true} /> : '' } diff --git a/web/client/assets/images/quanju/nodata.png b/web/client/assets/images/quanju/nodata.png new file mode 100644 index 00000000..f593a4d7 Binary files /dev/null and b/web/client/assets/images/quanju/nodata.png differ diff --git a/web/client/src/components/index.js b/web/client/src/components/index.js index 906a55e4..1971df6c 100644 --- a/web/client/src/components/index.js +++ b/web/client/src/components/index.js @@ -4,21 +4,21 @@ import Upload from './Upload'; import NoResource from './no-resource'; import LimitTextArea from './limit-textarea'; -import ProcessForm from './process_form' import FlowRecordTable from './flowRecordTable' import Table from './table' import Search from './search' import SketchColor from './sketchColor' import SimpleFileDownButton from './simpleFileDownButton' +import YSIframePlayer from './ysPlayerIframe' export { Upload, NoResource, LimitTextArea, - ProcessForm, FlowRecordTable, Table, Search, SketchColor, - SimpleFileDownButton + SimpleFileDownButton, + YSIframePlayer }; diff --git a/web/client/src/components/ysPlayerIframe.js b/web/client/src/components/ysPlayerIframe.js new file mode 100644 index 00000000..3d708e08 --- /dev/null +++ b/web/client/src/components/ysPlayerIframe.js @@ -0,0 +1,52 @@ +/** + * 萤石视频直播(基于萤石云iframe模式,使用方式简单) + * 官方参考:https://open.ys7.com/console/ezopenIframe.html + */ +'use strict'; + +import React from 'react'; +import { connect } from 'react-redux'; + +const YSIframePlayer = props => { + + const { containerId, height, width, url, autoplay, audio, videoState, ysToken } = props; + const at = ysToken + if (!url || !at) return null; + const src = `https://open.ys7.com/ezopen/h5/iframe?audio=${audio ? '1' : '0'}&url=${url}&autoplay=${autoplay || 1}&accessToken=${at}` + // const src = `https://open.ys7.com/ezopen/h5/iframe?audio=1&url=${url}&autoplay=${autoplay || 1}&accessToken=${at}` + return ( +
+ + { + videoState && videoState.status == 0 ? +
+ 设备中断,正在处理中... +
+ : '' + } +
+ ) +} + +function mapStateToProps (state) { + const { auth, } = state; + return { + user: auth.user, + }; +} + +export default connect(mapStateToProps)(YSIframePlayer); \ No newline at end of file diff --git a/web/client/src/layout/actions/global.js b/web/client/src/layout/actions/global.js index c7c82fc3..4b08442c 100644 --- a/web/client/src/layout/actions/global.js +++ b/web/client/src/layout/actions/global.js @@ -35,7 +35,9 @@ export function initApiRoot () { dispatch({ type: INIT_API_ROOT, payload: { - apiRoot: res.root + apiRoot: res.root, + vcmpWebUrl: res.vcmpWebUrl, + vcmpMirrorId: res.vcmpMirrorId, } }) }); diff --git a/web/client/src/layout/components/header/index.js b/web/client/src/layout/components/header/index.js index 04913c1e..066188d8 100644 --- a/web/client/src/layout/components/header/index.js +++ b/web/client/src/layout/components/header/index.js @@ -56,7 +56,7 @@ const Header = props => { style={{ border: 0 }} onClick={handelClick} > -
history.push(`/screen/cockpit`)}>进入大屏
+ {user?.username === 'SuperAdmin' ?
history.push(`/screen/cockpit`)}>进入大屏
: ''} { ); }; -function mapStateToProps (state) { +function mapStateToProps(state) { const { global, auth } = state; return { actions: global.actions, diff --git a/web/client/src/layout/components/sider/index.js b/web/client/src/layout/components/sider/index.js index d71d0ead..b7b80315 100644 --- a/web/client/src/layout/components/sider/index.js +++ b/web/client/src/layout/components/sider/index.js @@ -62,7 +62,7 @@ const Sider = props => { setSelectedKeys(selectedKeys) }} onOpenChange={(ks) => { - setOpenKeys(ks) + setOpenKeys(ks.length > 1 ? [ks.pop()] : ks) }} > {items} diff --git a/web/client/src/layout/containers/layout/index.js b/web/client/src/layout/containers/layout/index.js index dabb4eea..eb4f2e01 100644 --- a/web/client/src/layout/containers/layout/index.js +++ b/web/client/src/layout/containers/layout/index.js @@ -52,6 +52,7 @@ const LayoutContainer = props => { }) }, [user]) useEffect(() => { + resize_() scrollbar = new PerfectScrollbar('#page-content', { suppressScrollX: true }); }, []) diff --git a/web/client/src/layout/index.js b/web/client/src/layout/index.js index f7f4d123..d3d483c8 100644 --- a/web/client/src/layout/index.js +++ b/web/client/src/layout/index.js @@ -60,6 +60,9 @@ const Root = props => { } flat(routes); + //将路由信息全部放在session,方便后面拿了用(权限控制的时候) + console.log('combineRoutes1', combineRoutes) + sessionStorage.setItem('allRoutes', JSON.stringify(combineRoutes)); return combineRoutes; } @@ -160,6 +163,7 @@ const Root = props => { {combineRoutes} diff --git a/web/client/src/layout/reducers/global.js b/web/client/src/layout/reducers/global.js index 81578f35..4edb421f 100644 --- a/web/client/src/layout/reducers/global.js +++ b/web/client/src/layout/reducers/global.js @@ -1,15 +1,18 @@ 'use strict'; import Immutable from 'immutable'; -import { INIT_LAYOUT, RESIZE } from '../actions/global'; +import { INIT_LAYOUT, RESIZE, INIT_API_ROOT } from '../actions/global'; -function global(state = { +function global (state = { title: '', copyright: '', sections: [], actions: {}, plugins: {}, clientHeight: 768, - clientWidth: 1024 + clientWidth: 1024, + apiRoot: '', + vcmpWebUrl: '', + vcmpMirrorId: '', }, action) { const payload = action.payload; switch (action.type) { @@ -34,6 +37,12 @@ function global(state = { // return Immutable.fromJS(state).merge({ // detailsComponent: payload.component // }).toJS(); + case INIT_API_ROOT: + return Immutable.fromJS(state).merge({ + apiRoot: payload.apiRoot, + vcmpWebUrl: payload.vcmpWebUrl, + vcmpMirrorId: payload.vcmpMirrorId, + }).toJS(); default: return state; } diff --git a/web/client/src/sections/auth/containers/login.js b/web/client/src/sections/auth/containers/login.js index 5bb5ca5e..54dc9b31 100644 --- a/web/client/src/sections/auth/containers/login.js +++ b/web/client/src/sections/auth/containers/login.js @@ -5,6 +5,7 @@ import { push } from 'react-router-redux'; import { Button, Input, Form, Row, Col, message } from 'antd'; import { login } from '../actions/auth'; import './style.less'; +import leftTop from '../../quanju/containers/footer/conserve/left/left-top'; const FormItem = Form.Item; const Login = props => { @@ -25,7 +26,23 @@ const Login = props => { }, [error]) useEffect(() => { - user && user.authorized ? dispatch(push('/screen/cockpit')) : null + const allroutes = JSON.parse(sessionStorage.getItem('allRoutes')) || [] + let hasAuth = [] + if (user && user.authorized) { + hasAuth = allroutes?.filter((item) => { return user?.userResources.find((child) => { return child.resourceId === item.authCode }) }) + if (user?.username === 'SuperAdmin') { + dispatch(push('/fillion/infor')) + } + else if (hasAuth && hasAuth.length > 0) { + const path = hasAuth[0].path + console.log('sasa', `${path}`) + dispatch(push(path)) + } else { + dispatch(push('/noContent')) + } + } + + //user && user.authorized ? dispatch(push('/screen/cockpit')) : null }, [user]) const enterHandler = e => { diff --git a/web/client/src/sections/fillion/actions/allDepUsers.js b/web/client/src/sections/fillion/actions/allDepUsers.js new file mode 100644 index 00000000..7aac192b --- /dev/null +++ b/web/client/src/sections/fillion/actions/allDepUsers.js @@ -0,0 +1,14 @@ +import { basicAction } from '@peace/utils' +import { ApiTable } from '$utils' + +export function getAllDepUsers(query) { + return dispatch => basicAction({ + type: 'get', + dispatch: dispatch, + query: query, + actionType: 'GET_AllDEPUSERS', + url: ApiTable.getAllDepUsers, + msg: { option: '获取部门下的所有员工' },//子部门算在第一级部门下面 + reducer: { name: 'allDepUsers' } + }); +} \ No newline at end of file diff --git a/web/client/src/sections/fillion/actions/assess.js b/web/client/src/sections/fillion/actions/assess.js index 0cc6345b..e76f4bd5 100644 --- a/web/client/src/sections/fillion/actions/assess.js +++ b/web/client/src/sections/fillion/actions/assess.js @@ -30,6 +30,6 @@ export function editAssess (query) { data: query, actionType: 'PUT_ASSESS', url: ApiTable.editAssess, - msg: { option: '编辑或新增考核评分信息' }, + msg: { option: '编辑/新增考核评分信息' }, }); } \ No newline at end of file diff --git a/web/client/src/sections/fillion/actions/index.js b/web/client/src/sections/fillion/actions/index.js index 1a7ae700..cde430de 100644 --- a/web/client/src/sections/fillion/actions/index.js +++ b/web/client/src/sections/fillion/actions/index.js @@ -4,10 +4,12 @@ import * as infor from './infor' import * as patrol from './patrol' import * as file from './file' import * as assess from './assess' +import * as allDepUsers from './allDepUsers' export default { ...infor, ...patrol, ...file, ...assess, + ...allDepUsers } \ No newline at end of file diff --git a/web/client/src/sections/fillion/components/assessModal.js b/web/client/src/sections/fillion/components/assessModal.js new file mode 100644 index 00000000..5f8eb5b4 --- /dev/null +++ b/web/client/src/sections/fillion/components/assessModal.js @@ -0,0 +1,108 @@ +import React, { useState, useEffect } from 'react'; +import { connect } from 'react-redux'; +import { Form, Input, Select, DatePicker, InputNumber, Button, Modal } from 'antd'; +import { unitList } from '../containers/assess' +import { getAssess, delAssess, editAssess } from '../actions/assess'; +import moment from 'moment'; + +const { Option } = Select; + +const AssessModal = ({ editData, check, visible, onCancel, dispatch }) => { + const [form] = Form.useForm(); + + return ( + { + if (check) { + return onCancel() + } + form.validateFields().then(values => { + dispatch(editAssess({ + ...values, + month: moment(values.month).format('YYYY-MM-DD'), + assessId: editData ? editData.id : undefined + })).then(res => { + if (res.success) { + onCancel() + } + }) + }) + }} + onCancel={() => { + onCancel() + }} + > +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ ); +}; + +function mapStateToProps (state) { + const { auth, assess } = state + return { + user: auth.user, + assess: assess.data || [] + } +} +export default connect(mapStateToProps)(AssessModal); diff --git a/web/client/src/sections/fillion/components/bridgeTable.js b/web/client/src/sections/fillion/components/bridgeTable.js index 1da7c91a..64d77eb3 100644 --- a/web/client/src/sections/fillion/components/bridgeTable.js +++ b/web/client/src/sections/fillion/components/bridgeTable.js @@ -1774,13 +1774,13 @@ const BrideTable = (props) => { setDifferentiate('bridge') }}>桥梁{activeKey === 'tab1'}, }, - { - key: 'tab2', - label: { - setWhichofits('gongcheng') - setDifferentiate('project') - }}>工程一览{activeKey === 'tab2'}, - }, + // { + // key: 'tab2', + // label: { + // setWhichofits('gongcheng') + // setDifferentiate('project') + // }}>工程一览{activeKey === 'tab2'}, + // }, ], }, diff --git a/web/client/src/sections/fillion/components/maintenanceTable.js b/web/client/src/sections/fillion/components/maintenanceTable.js index a0d29e11..1f51cb1c 100644 --- a/web/client/src/sections/fillion/components/maintenanceTable.js +++ b/web/client/src/sections/fillion/components/maintenanceTable.js @@ -1,14 +1,17 @@ import { connect } from 'react-redux'; import './protable.less' -import { Card, Button, DatePicker, Input, Modal, Spin, Image, message, Popover } from 'antd'; +import { Card, Button, DatePicker, Input, Modal, Spin, Image, message, Popover, Tree, Tooltip } from 'antd'; +import { DownOutlined, RightOutlined, CaretDownOutlined, CaretRightOutlined } from '@ant-design/icons'; import ProTable from '@ant-design/pro-table'; import { getReportList, getReportDetail } from '../actions/patrol'; -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useState, useMemo } from 'react'; import { httpDel } from '@peace/utils' import { PinyinHelper } from '@peace/utils'; // @ts-ignore import styles from './protable.less'; import moment from 'moment'; +import { getAllDepUsers } from '../actions/allDepUsers' +import { getDepMessage, getDepUser, createUser, updateUser, delUser, resetPwd, createDep, delDep, updateDep } from '../../organization/actions/user' import { reportTypeText } from './patrolTable' const DetailForm = (props) => { @@ -219,25 +222,192 @@ const DetailList = (props) => { const PatrolNameList = (props) => { + const { Search } = Input; const [users, setUsers] = useState([]); - const { onChange, record, userList, loading } = props; + const { onChange, record, userList, loading, depMessage, depUser, clientHeight, dispatch, user } = props; const [selectRoad, setSelectRoad] = useState(); + const [selectedTree, setSelectedTree] = useState(); + const [depSelectedKeys, setDepSelectedKeys] = useState([]) + const [depAllUser, setDepAllUser] = useState([]) + //const [depMessagedata, setdepMessagedata] = useState()//侧边栏的展示数据 + const [expandedKeys, setExpandedKeys] = useState([]); + const [searchValue, setSearchValue] = useState(''); + const [autoExpandParent, setAutoExpandParent] = useState(true); + const [defaultData, setDefaultData] = useState([]); + const [dataList, setDataList] = useState([]); + console.log('record', record) + useEffect(() => { + let departments = [] + const generateData = (data, _preKey, _tns) => { + const preKey = _preKey || '0'; + const tns = _tns || []; + const children = []; + + data.forEach(department => { + const key = `${preKey}-${department.depId}`; + const node = { + title: department.depName.toString(), + key, + children: [], + }; + + if (department.users.length > 0) { // 仅当部门有用户时添加子节点 + department.users.forEach(user => { + node.children.push({ + title: user.name.toString(), + key: `${key}-${user.id}`, + isLeaf: true, // 用户节点为叶子节点 + }); + }); + } + + if (department.children && department.children.length > 0) { + const childKeys = generateData(department.children, key, node.children); + children.push(...childKeys); + } + + tns.push(node); + if (node.children.length > 0 && department.expanded) { // 仅当部门展开时添加子节点 + children.push(key); + } + }); + 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)] + } + + 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(() => { + dispatch(getAllDepUsers()).then((res) => { + if (res.success) setDepAllUser(res?.payload?.data) + }) + + + }, []) + const getParentKey = (key, tree) => { + let parentKey; + for (let i = 0; i < tree.length; i++) { + const node = tree[i]; + if (node.children) { + if (node.children.some((item) => item.key === key)) { + parentKey = node.key; + } else { + parentKey = getParentKey(key, node.children); + } + } + if (parentKey) { + break; + } + } + return parentKey; + }; + + const handleSearch = (value) => { + const filteredKeys = []; + const expandedKeys = []; + + const loopTreeData = (data) => { + data.forEach((item) => { + if (item.title.indexOf(value) > -1) { + filteredKeys.push(item.key); + let parentKey = getParentKey(item.key, defaultData); + while (parentKey) { + if (!expandedKeys.includes(parentKey)) { + expandedKeys.push(parentKey); + } + parentKey = getParentKey(parentKey, defaultData); + } + } + if (item.children) { + loopTreeData(item.children); + } + }); + }; + loopTreeData(defaultData); + setSearchValue(value); + setExpandedKeys(expandedKeys); + }; + + const handleExpand = (expandedKeys) => { + setExpandedKeys(expandedKeys); + }; + + const renderTreeNodes = (data) => { + return data.map((item) => { + const { key, title, children } = item; + const isLeaf = !children || children.length === 0; + + return ( + : + )} + isLeaf={isLeaf} + > + {children && children.length > 0 && renderTreeNodes(children)} + + ); + }); + }; + + const treeData = useMemo(() => { + const loop = (data) => + data.map((item) => { + const { title, key, children } = item; + const strTitle = title.toString(); + const index = strTitle.indexOf(searchValue); + const beforeStr = strTitle.substring(0, index); + const afterStr = strTitle.slice(index + searchValue.length); + const titleNode = index > -1 ? ( + + {beforeStr} + {searchValue} + {afterStr} + + ) : ( + {strTitle} + ); + + if (children && children.length > 0) { + return { + title: titleNode, + key, + children: loop(children), + }; + } + + return { + title: titleNode, + key, + }; + }); + + return loop(defaultData); + }, [searchValue, defaultData]); useEffect(() => { if (userList && userList instanceof Array && userList.length) { setSelectRoad(userList[0].id) // onChange(userList[0]); } }, [userList]) - const columns = [ - { - title: '养护人员', - key: 'name', - dataIndex: 'name', - align: 'center' - }, - - ]; useEffect(() => { if (userList && userList instanceof Array) { @@ -245,51 +415,39 @@ const PatrolNameList = (props) => { setUsers(users); } }, [userList]) + const handleSelect = (selectedKeys, { selected, selectedNodes, node }) => { + if (selected) { + if (selectedKeys[0].split("-").length - 1 >= 2) { + let id = selectedKeys[0].split('-')[selectedKeys[0].split('-').length - 1] + console.log('id', id) + onChange(id); + } - var timer = null; - const doUserNameSearch = (e) => { - const name = e.target.value; - if (timer) { - clearTimeout(timer) - } else { - setTimeout(() => { - let users = userList.filter(user => PinyinHelper.isSearchMatched(user.name, name) && user.remark != 'sp'); - setUsers(users); - }, 500); } + console.log('selectedKeys', selectedKeys, selected, selectedNodes, node) + + }; + + if (loading) { + return
Loading...
} return ( -
- { - return record.id == selectRoad ? 'list-row-actived' : ''; - }} - toolBarRender={() => [ - - ]} - options={false} - pagination={false} - search={false} - onRow={(record) => { - return { - onClick: () => { - if (record) { - let id = record.id - if (selectRoad == record.id) { - id = null - } - setSelectRoad(id); - onChange(id ? record : null); - } - }, - }; - }} - />
+
+ handleSearch(e.target.value)} + /> + + {renderTreeNodes(treeData)} + +
); }; @@ -297,8 +455,8 @@ const PatrolNameList = (props) => { const MaintenanceTable = (props) => { - const { userList, user, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading, exports } = props; - const [record, setRecord] = useState(); + const { userList, user, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading, exports, depMessage, depUser, clientHeight } = props; + const [record, setRecord] = useState(1); const [dateRange, setDateRange] = useState(); const [detailVisible, setDetailVisible] = useState(false) @@ -322,8 +480,19 @@ const MaintenanceTable = (props) => { }, [record, dateRange]) const queryData = () => { + let userId = null + if (user?.username === 'SuperAdmin' && record === 1) { + userId = undefined + } else if (user?.username === 'SuperAdmin' && record !== 1) { + userId = record + } else if (user?.username !== 'SuperAdmin' && record === 1) { + userId = user?.id + } else if (user?.username !== 'SuperAdmin' && record !== 1) { + userId = record + } + //: user?.username === 'SuperAdmin' && record === 1 ? record?.id : record ? record : user?.id let query = { - userId: record?.id, + userId, reportType: 'conserve', asc: true } @@ -360,7 +529,9 @@ const MaintenanceTable = (props) => { return (
- setRecord(record)} record={record} userList={userList} loading={userLoading} handelRefresh={handelRefresh} /> + setRecord(record)} record={record} userList={userList} loading={userLoading} handelRefresh={handelRefresh} />
@@ -386,8 +557,8 @@ const MaintenanceTable = (props) => { ); }; -function mapStateToProps (state) { - const { auth, depMessage, userList, reportList, reportDetail } = state; +function mapStateToProps(state) { + const { auth, depMessage, userList, reportList, reportDetail, depUser, global } = state; const pakData = (dep) => { return dep.map((d) => { return { @@ -399,6 +570,7 @@ function mapStateToProps (state) { } let depData = pakData(depMessage.data || []) return { + clientHeight: global.clientHeight, user: auth.user, depMessage: depMessage.data || [], depLoading: depMessage.isRequesting, @@ -409,6 +581,8 @@ function mapStateToProps (state) { reportListLoading: reportList.isRequesting, reportDetail: reportDetail.data, reportDetailLoading: reportDetail.isRequesting, + depUser: depUser.data || [], + }; } export default connect(mapStateToProps)(MaintenanceTable); \ No newline at end of file diff --git a/web/client/src/sections/fillion/components/patrolTable.js b/web/client/src/sections/fillion/components/patrolTable.js index c6ba55c3..885649f3 100644 --- a/web/client/src/sections/fillion/components/patrolTable.js +++ b/web/client/src/sections/fillion/components/patrolTable.js @@ -1,9 +1,11 @@ import { connect } from 'react-redux'; import './protable.less' -import { Card, Button, Popconfirm, Badge, Col, Row, DatePicker, Input, Modal, Spin, Image, message, Popover, Select } from 'antd'; +import { Card, Button, Popconfirm, Badge, Col, Row, DatePicker, Input, Modal, Spin, Image, message, Popover, Select, Tree } from 'antd'; import ProTable from '@ant-design/pro-table'; +import { DownOutlined, RightOutlined, CaretDownOutlined, CaretRightOutlined } from '@ant-design/icons'; import { getReportList, getReportDetail, handleReport } from '../actions/patrol'; -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useState, useMemo } from 'react'; +import { getAllDepUsers } from '../actions/allDepUsers' import { httpDel } from '@peace/utils' import { PinyinHelper } from '@peace/utils'; import PatrolGis from './gis/patrolGis'; @@ -302,14 +304,198 @@ const DetailList = (props) => { const PatrolNameList = (props) => { + const { Search } = Input; const [users, setUsers] = useState([]); - const { onChange, record, userList, loading, activeTabKey1 } = props; + const { onChange, record, userList, loading, activeTabKey1, dispatch, user } = props; const [selectRoad, setSelectRoad] = useState(); + const [defaultData, setDefaultData] = useState([]); + const [expandedKeys, setExpandedKeys] = useState([]); + const [searchValue, setSearchValue] = useState(''); + const [depAllUser, setDepAllUser] = useState([]) + const [dataList, setDataList] = useState([]); + useEffect(() => { + let departments = [] + const generateData = (data, _preKey, _tns) => { + const preKey = _preKey || '0'; + const tns = _tns || []; + const children = []; + + data.forEach(department => { + const key = `${preKey}-${department.depId}`; + const node = { + title: department.depName.toString(), + key, + children: [], + }; + + if (department.users.length > 0) { // 仅当部门有用户时添加子节点 + department.users.forEach(user => { + node.children.push({ + title: user.name.toString(), + key: `${key}-${user.id}`, + isLeaf: true, // 用户节点为叶子节点 + }); + }); + } + + if (department.children && department.children.length > 0) { + const childKeys = generateData(department.children, key, node.children); + children.push(...childKeys); + } + + tns.push(node); + if (node.children.length > 0 && department.expanded) { // 仅当部门展开时添加子节点 + children.push(key); + } + }); + 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)] + } + + 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(() => { + dispatch(getAllDepUsers()).then((res) => { + if (res.success) setDepAllUser(res?.payload?.data) + }) + + + }, []) + const getParentKey = (key, tree) => { + let parentKey; + for (let i = 0; i < tree.length; i++) { + const node = tree[i]; + if (node.children) { + if (node.children.some((item) => item.key === key)) { + parentKey = node.key; + } else { + parentKey = getParentKey(key, node.children); + } + } + if (parentKey) { + break; + } + } + return parentKey; + }; + + const handleSearch = (value) => { + const filteredKeys = []; + const expandedKeys = []; + + const loopTreeData = (data) => { + data.forEach((item) => { + if (item.title.indexOf(value) > -1) { + filteredKeys.push(item.key); + let parentKey = getParentKey(item.key, defaultData); + while (parentKey) { + if (!expandedKeys.includes(parentKey)) { + expandedKeys.push(parentKey); + } + parentKey = getParentKey(parentKey, defaultData); + } + } + if (item.children) { + loopTreeData(item.children); + } + }); + }; + + loopTreeData(defaultData); + setSearchValue(value); + setExpandedKeys(expandedKeys); + }; + + const handleExpand = (expandedKeys) => { + setExpandedKeys(expandedKeys); + }; + + const renderTreeNodes = (data) => { + return data.map((item) => { + const { key, title, children } = item; + const isLeaf = !children || children.length === 0; + + return ( + : + )} + isLeaf={isLeaf} + > + {children && children.length > 0 && renderTreeNodes(children)} + + ); + }); + }; + + const treeData = useMemo(() => { + const loop = (data) => + data.map((item) => { + const { title, key, children } = item; + const strTitle = title.toString(); + const index = strTitle.indexOf(searchValue); + const beforeStr = strTitle.substring(0, index); + const afterStr = strTitle.slice(index + searchValue.length); + const titleNode = index > -1 ? ( + + {beforeStr} + {searchValue} + {afterStr} + + ) : ( + {strTitle} + ); + + if (children && children.length > 0) { + return { + title: titleNode, + key, + children: loop(children), + }; + } + + return { + title: titleNode, + key, + }; + }); + + return loop(defaultData); + }, [searchValue, defaultData]); + const handleSelect = (selectedKeys, { selected, selectedNodes, node }) => { + if (selected) { + if (selectedKeys[0].split("-").length - 1 >= 2) { + let id = selectedKeys[0].split('-')[selectedKeys[0].split('-').length - 1] + console.log('id1', id) + onChange(id); + } + + } + console.log('selectedKeys', selectedKeys, selected, selectedNodes, node) + + }; useEffect(() => { if (userList && userList instanceof Array && userList.length) { - // setSelectRoad(userList[0].id) + setSelectRoad(userList[0].id) // onChange(userList[0]); } if (activeTabKey1 == 'tab2') { @@ -318,38 +504,38 @@ const PatrolNameList = (props) => { }, [userList, activeTabKey1]) - const columns = [ - { - title: '巡查人员', - key: 'name', - dataIndex: 'name', - align: 'center' - }, - - ]; - useEffect(() => { if (userList) { setUsers(userList) } }, [userList]) - var timer = null; - const doUserNameSearch = (e) => { - const name = e.target.value; - if (timer) { - clearTimeout(timer) - } else { - setTimeout(() => { - let users = userList.filter(user => PinyinHelper.isSearchMatched(user.name, name)); - setUsers(users); - }, 500); - } + if (loading) { + return
Loading...
} - return (
- + handleSearch(e.target.value)} + /> + + {renderTreeNodes(treeData)} + +
+ + + + + + + {/* { }, }; }} - />
+ /> + */} +
); }; @@ -385,8 +573,8 @@ const PatrolNameList = (props) => { const PatrolTable = (props) => { - const { user, userList, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading, exports, pathname } = props; - const [record, setRecord] = useState(); + const { clientHeight, user, userList, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading, exports, pathname } = props; + const [record, setRecord] = useState(1); const [dateRange, setDateRange] = useState(); const [selectProjectType, setSelectProjectType] = useState(''); const [detailVisible, setDetailVisible] = useState(false) @@ -413,7 +601,23 @@ const PatrolTable = (props) => { }, [record, dateRange, selectProjectType]) const queryData = () => { - let query = { userId: record?.id, reportType: reportType, projectType: selectProjectType, asc: true } + console.log(record, 'idididid') + let userId = null + if (user?.username === 'SuperAdmin' && record === 1) { + userId = undefined + } else if (user?.username === 'SuperAdmin' && record !== 1) { + userId = record + } else if (user?.username !== 'SuperAdmin' && record === 1) { + userId = user?.id + } else if (user?.username !== 'SuperAdmin' && record !== 1) { + userId = record + } + // user?.username === 'SuperAdmin' && record === 1 ? record?.id : record ? record : user?.id, + let query = { + userId, + reportType: reportType, projectType: selectProjectType, asc: true + } + console.log(query, 'query1') if ((dateRange && dateRange instanceof Array && dateRange[0] != '')) { query.startTime = moment(dateRange[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss') query.endTime = moment(dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss') @@ -468,13 +672,13 @@ const PatrolTable = (props) => { setActiveTabKey1(key); }; - const handleChangeRecord = (newRecord) => { - let target = null; - if (!record || (newRecord && newRecord.id != record.id)) { - target = newRecord; - } - setRecord(target); - } + // const handleChangeRecord = (newRecord) => { + // let target = null; + // if (!record || (newRecord && newRecord.id != record.id)) { + // target = newRecord; + // } + // setRecord(target); + // } const handleExport = () => { if (reportList && reportList instanceof Array && reportList.length) { @@ -487,7 +691,9 @@ const PatrolTable = (props) => {
handleChangeRecord(record)} + clientHeight={clientHeight} user={user} + dispatch={dispatch} + onChange={(record) => setRecord(record)} record={record} activeTabKey1={activeTabKey1} userList={userList} @@ -542,8 +748,8 @@ const PatrolTable = (props) => { ); }; -function mapStateToProps (state) { - const { auth, depMessage, userList, reportList, reportDetail } = state; +function mapStateToProps(state) { + const { auth, depMessage, userList, reportList, reportDetail, global } = state; const pakData = (dep) => { return dep.map((d) => { return { @@ -565,6 +771,8 @@ function mapStateToProps (state) { reportListLoading: reportList.isRequesting, reportDetail: reportDetail.data, reportDetailLoading: reportDetail.isRequesting, + clientHeight: global.clientHeight, + }; } export default connect(mapStateToProps)(PatrolTable); \ No newline at end of file diff --git a/web/client/src/sections/fillion/components/transportationTable.js b/web/client/src/sections/fillion/components/transportationTable.js index d53aa732..9c9d8f64 100644 --- a/web/client/src/sections/fillion/components/transportationTable.js +++ b/web/client/src/sections/fillion/components/transportationTable.js @@ -3780,14 +3780,15 @@ const TransporTationTable = (props) => { setGrade('村') }}>村道{activeKey === 'tab3'}, - }, { - key: 'tab4', - label: { - setWhichofits('gongcheng') - setDifferentiate('project') - - }}>工程一览{activeKey === 'tab4'}, }, + // { + // key: 'tab4', + // label: { + // setWhichofits('gongcheng') + // setDifferentiate('project') + + // }}>工程一览{activeKey === 'tab4'}, + // }, ], }, }} diff --git a/web/client/src/sections/fillion/containers/assess.js b/web/client/src/sections/fillion/containers/assess.js index 7828dcfa..7343db9a 100644 --- a/web/client/src/sections/fillion/containers/assess.js +++ b/web/client/src/sections/fillion/containers/assess.js @@ -1,24 +1,167 @@ import React, { useState, useEffect } from 'react'; import { connect } from 'react-redux'; +import { getAssess, delAssess, editAssess } from '../actions/assess'; +import ProTable from '@ant-design/pro-table'; +import AssessModal from '../components/assessModal'; +import { Form, Space, DatePicker, Button, Select, Popconfirm } from 'antd' +import moment from 'moment'; -function Assess () { +export const unitList = [ + '县道', + '蒋巷镇', + '三江镇', + '塔城乡', + '泾口乡', + '八一乡', + '冈上镇', + '南新乡', + '富山乡', + '莲塘镇', + '金湖管理处', + '武阳镇', + '向塘镇', + '幽兰镇', + '广福镇', + '塘南镇', + '银三角管委会', + '黄马乡', +] +function Assess (props) { + const { dispatch, assess } = props; + const [assessModalVisible, setAssessModalVisible] = useState(false); + const [editData, setEditData] = useState(null); + const [query, setQuery] = useState({ page: 1, pageSize: 10 }) + const [loading, setLoading] = useState(false); + const [isCheck, setIsCheck] = useState(false) useEffect(() => { - - return () => { - }; + return () => { }; }, []); + useEffect(() => { + getData() + }, [query]) + + const getData = () => { + setLoading(true) + dispatch(getAssess(query)).then(res => { + setLoading(false) + }) + } + return (
- +
+
{ + setQuery({ ...query, unit: v.unit, month: v.month ? moment(v.month).format() : undefined }) + }}> + + + + + + + + + + + +
+ + +
+ ( + text ? moment(record.month).format('YYYY-MM') : '' + ) + }, + { + title: '考核得分', + dataIndex: 'totalPoints', + key: 'totalPoints', + }, + { + title: '操作', + key: 'action', + render: (text, record) => ( + + + + { + setLoading(true) + dispatch(delAssess({ id: record.id })).then(res => { + setLoading(false) + if (res.success) { + getData() + } + }) + }} + > + + + + ), + },]} + dataSource={assess.rows || []} + loading={loading} + pagination={{ + total: assess?.count || 0, + pageSize: 10, + defaultPageSize: 10, + showSizeChanger: false, + onChange: (page, pageSize) => { + setQuery({ + ...query, + page, limit: pageSize + }) + } + }} + rowKey="key" + toolBarRender={false} + search={false} + /> + { + assessModalVisible ? { + getData() + setIsCheck(false) + setEditData(null) + setAssessModalVisible(false) + }} /> : '' + }
); } function mapStateToProps (state) { - const { auth } = state + const { auth, assess } = state return { user: auth.user, + assess: assess.data || [], } } export default connect(mapStateToProps)(Assess); \ No newline at end of file diff --git a/web/client/src/sections/fillion/containers/building.js b/web/client/src/sections/fillion/containers/building.js new file mode 100644 index 00000000..d2823e22 --- /dev/null +++ b/web/client/src/sections/fillion/containers/building.js @@ -0,0 +1,41 @@ +'use strict'; + +import React, { useState, useEffect } from 'react'; +import { connect } from 'react-redux'; +// import { Spin, Button, Popconfirm } from 'antd'; +// import ProTable from '@ant-design/pro-table'; +// //import './protable.less' +import moment from 'moment'; +// import { getRoadway, getProject, delRoadway, delProject } from "../actions/infor" +// import UserModal from './infor/details'; +// import ProjectModal from './project/project'; + +const Building = (props) => { + + return ( +
+ hha +
+ ) +} +function mapStateToProps(state) { + const { auth, depMessage } = state; + // const pakData = (dep) => { + // return dep.map((d) => { + // return { + // title: d.name, + // value: d.id, + // // children: d.type >= 2 ? [] : pakData(d.subordinate) + // children: pakData(d.subordinate) + // } + // }) + // } + // let depData = pakData(depMessage.data || []) + return { + user: auth.user, + // depMessage: depMessage.data || [], + // depLoading: depMessage.isRequesting, + // depData, + }; +} +export default connect(mapStateToProps)(Building); \ No newline at end of file diff --git a/web/client/src/sections/fillion/containers/index.js b/web/client/src/sections/fillion/containers/index.js index dc231384..4faaeb0a 100644 --- a/web/client/src/sections/fillion/containers/index.js +++ b/web/client/src/sections/fillion/containers/index.js @@ -14,4 +14,12 @@ import Patrol from './patrol'; import File from './file'; import Jiekouguanli from './jiekouguanli'; import Task from './task' -export { Infor, transportation, BridgeTable, HigHways, OperaTional, Enforce, Public, Videois, PromoTional, Maintenance, Patrol, File, Jiekouguanli, Task }; \ No newline at end of file +import Assess from './assess' +import VideoCenter from './videoCenter'; +import Building from './building' +export { + Infor, transportation, BridgeTable, HigHways, + OperaTional, Enforce, Public, Videois, PromoTional, + Maintenance, Patrol, File, Jiekouguanli, + Task, Building, Assess, VideoCenter +}; \ No newline at end of file diff --git a/web/client/src/sections/fillion/containers/videoCenter.js b/web/client/src/sections/fillion/containers/videoCenter.js new file mode 100644 index 00000000..42ff7e4a --- /dev/null +++ b/web/client/src/sections/fillion/containers/videoCenter.js @@ -0,0 +1,30 @@ +import React, { useState, useEffect } from 'react'; +import { connect } from 'react-redux'; +import { getAssess, delAssess, editAssess } from '../actions/assess'; +import ProTable from '@ant-design/pro-table'; +import AssessModal from '../components/assessModal'; +import { Form, Space, DatePicker, Button, Select, Popconfirm } from 'antd' +import moment from 'moment'; + +function VideoCenter (props) { + const { dispatch, vcmpWebUrl, vcmpMirrorId } = props; + + useEffect(() => { + return () => { }; + }, []); + + return ( +
+ +
+ ); +} +function mapStateToProps (state) { + const { auth, global } = state + return { + user: auth.user, + vcmpWebUrl: global.vcmpWebUrl, + vcmpMirrorId: global.vcmpMirrorId, + } +} +export default connect(mapStateToProps)(VideoCenter); \ No newline at end of file diff --git a/web/client/src/sections/fillion/nav-item.js b/web/client/src/sections/fillion/nav-item.js index 57cc1deb..d84c3a6d 100644 --- a/web/client/src/sections/fillion/nav-item.js +++ b/web/client/src/sections/fillion/nav-item.js @@ -26,8 +26,8 @@ export function getNavItem(user, dispatch) { 治超管理 : ''} {/* - 任务管理 - */} + 任务管理 + */} {user?.username == 'SuperAdmin' || user?.userResources?.filter(i => i.resourceId === 'ROADMANAGE')?.length !== 0 ? 道路管理 @@ -55,6 +55,16 @@ export function getNavItem(user, dispatch) { 巡查管理 : ''} + {user?.username == 'SuperAdmin' || user?.userResources?.filter(i => i.resourceId === 'FEEDBACKMANAGE')?.length !== 0 ? + + 异常反馈 + : ''} + {/* {user?.username == 'SuperAdmin' || user?.userResources?.filter(i => i.resourceId === 'FEEDBACKMANAGE')?.length !== 0 ? + + : ''} */} + + 在建项目 + {user?.username == 'SuperAdmin' || user?.userResources?.filter(i => i.resourceId === 'PUBLICTRANSPORTMANAGE')?.length !== 0 ? 公交管理 @@ -74,16 +84,19 @@ export function getNavItem(user, dispatch) { 宣传视频 : ''} - {user?.username == 'SuperAdmin' || user?.userResources?.filter(i => i.resourceId === 'FEEDBACKMANAGE')?.length !== 0 ? - - 异常反馈 - : ''} {user?.username == 'SuperAdmin' || user?.userResources?.filter(i => i.resourceId === 'REPORTMANAGE')?.length !== 0 ? 建设上报 : ''} + + + 考核评分 + + + 视频中心 + : null ); } diff --git a/web/client/src/sections/fillion/routes.js b/web/client/src/sections/fillion/routes.js index c4fc6448..d7708eac 100644 --- a/web/client/src/sections/fillion/routes.js +++ b/web/client/src/sections/fillion/routes.js @@ -12,7 +12,9 @@ import { Maintenance } from './containers' import { Patrol } from './containers' import { File } from './containers'; import { Jiekouguanli } from './containers' -import { Task } from './containers' +import { Task, Assess, VideoCenter, } from './containers' +import { Building } from './containers' + export default [{ type: 'inner', route: { @@ -27,18 +29,31 @@ export default [{ menuSelectKeys: ['fillioninfor'], component: Infor, breadcrumb: '治超管理', + authCode: 'OVERLOADMANAGE' }, { path: '/task', key: 'filliontask', menuSelectKeys: ['filliontask'], component: Task, breadcrumb: '任务管理', + //authCode: 'OVERLOADMANAGE' }, { path: '/transportation', key: 'filliontransportation', menuSelectKeys: ['filliontransportation'], component: transportation, breadcrumb: '道路管理', + authCode: 'ROADMANAGE' + + }, + { + path: '/building', + key: 'fillionbuilding', + menuSelectKeys: ['fillionbuilding'], + component: Building, + breadcrumb: '在建项目', + //authCode: 'ROADMANAGE' + } , { path: '/bridge', @@ -46,6 +61,8 @@ export default [{ menuSelectKeys: ['fillionbridge'], component: BridgeTable, breadcrumb: '桥梁管理', + authCode: 'BRIDGEMANAGE' + } , { path: '/highways', @@ -53,12 +70,16 @@ export default [{ menuSelectKeys: ['fillionhighways'], component: HigHways, breadcrumb: '管养管理', + authCode: 'MAINTENANCEMANAGE' + }, { path: '/operational', key: 'fillionoperational', menuSelectKeys: ['fillionoperational'], component: OperaTional, breadcrumb: '运政管理', + authCode: 'TRANSPORTATIONMANAGE' + }, { path: '/enforce', key: 'fillionenforce', @@ -71,30 +92,39 @@ export default [{ menuSelectKeys: ['fillionmaintenance'], component: Maintenance, breadcrumb: '养护管理', + authCode: 'CONSERVATIONMANAGE' }, { path: '/patrol', key: 'fillionpatrol', menuSelectKeys: ['fillionpatrol'], component: Patrol, breadcrumb: '巡查管理', + authCode: 'PATROLMANAGE' + }, { path: '/patrol_anomaly', key: 'fillionpatrolanomaly', menuSelectKeys: ['fillionpatrolanomaly'], component: Patrol, breadcrumb: '异常反馈', + authCode: 'FEEDBACKMANAGE' + }, { path: '/patrol_road', key: 'fillionpatrolroad', menuSelectKeys: ['fillionpatrolroad'], component: Patrol, breadcrumb: '建设上报', + authCode: 'REPORTMANAGE' + }, { path: '/public', key: 'fillionpublic', menuSelectKeys: ['fillionpublic'], component: Public, breadcrumb: '公交管理', + authCode: 'PUBLICTRANSPORTMANAGE' + }, { path: '/file', @@ -102,6 +132,8 @@ export default [{ menuSelectKeys: ['fileCont'], component: File, breadcrumb: '档案管理', + authCode: 'FILEMANAGE' + }, { path: '/videois', @@ -109,6 +141,8 @@ export default [{ menuSelectKeys: ['fillionvideois'], component: Videois, breadcrumb: '视频管理', + authCode: 'PUBLICITYVIDEO' + }, { path: '/jiekouguanli', @@ -116,13 +150,25 @@ export default [{ menuSelectKeys: ['jiekouguanli'], component: Jiekouguanli, breadcrumb: '接口管理', - } - , { + }, { path: '/promotional', key: 'fillionpromotional', menuSelectKeys: ['fillionpromotional'], component: PromoTional, breadcrumb: '视频管理', + authCode: 'PUBLICITYVIDEO' + }, { + path: '/assess', + key: 'fillionassess', + menuSelectKeys: ['fillionassess'], + component: Assess, + breadcrumb: '考核评分', + }, { + path: '/videoCenter', + key: 'fillionvideoCenter', + menuSelectKeys: ['fillionvideoCenter'], + component: VideoCenter, + breadcrumb: '视频中心', } ] } diff --git a/web/client/src/sections/organization/containers/authority.js b/web/client/src/sections/organization/containers/authority.js index aece8e9a..2f5272f0 100644 --- a/web/client/src/sections/organization/containers/authority.js +++ b/web/client/src/sections/organization/containers/authority.js @@ -10,7 +10,10 @@ const Authority = (props) => { const CheckboxGroup = Checkbox.Group; const { dispatch, loading, depMessage, depUser, resource, userResource, clientHeight, user } = props const r1 = ['USERMANAGE', 'AUTHORIMANAGE', 'OVERLOADMANAGE', 'ROADMANAGE', 'BRIDGEMANAGE', 'MAINTENANCEMANAGE', 'TRANSPORTATIONMANAGE', - 'CONSERVATIONMANAGE', 'PATROLMANAGE', 'PUBLICTRANSPORTMANAGE', 'FILEMANAGE', 'PUBLICITYVIDEO', 'FEEDBACKMANAGE', 'REPORTMANAGE'] + 'CONSERVATIONMANAGE', 'PATROLMANAGE', 'PUBLICTRANSPORTMANAGE', 'FILEMANAGE', 'PUBLICITYVIDEO', 'FEEDBACKMANAGE', 'REPORTMANAGE', + 'WXPATROLREPORT', 'WXMAINTENANCEREPORT', 'WXFEEDBACKMANAGE', 'WXBUILDINGROAD' + ] + const [depUserCopy, setDepUserCopy] = useState([])//用于存放除了自己的管理的数组,即自己不能调整自己是否为管理员 const [depSelectedKeys, setDepSelectedKeys] = useState([]) const [userSelectedKeys, setUserSelectedKeys] = useState([]) const [depSelected, setDepSelected] = useState() @@ -26,6 +29,7 @@ const Authority = (props) => { const [checkAll, setCheckAll] = useState(true); const [rescheckAll, setrescheckAll] = useState(false) const [isshow, setisshow] = useState(false); + let plainOptions = depUser.map(i => ({ label: i.name, value: i.id })); const [checkedList, setCheckedList] = useState(depUser.map(i => i.id)); const onChange = (list) => { @@ -79,24 +83,45 @@ const Authority = (props) => { useEffect(() => { if (depMessage.length) { console.log('depMessage', depMessage) - setdepMessagedata(depMessage) - setDepSelectedKeys([depMessage[0]?.id]) - setDepSelected([depMessage[0]?.name]) - dispatch(getDepUser(depMessage[0]?.id)) + //超级管理员展示所有部门 + if (user?.username === 'SuperAdmin') { + setdepMessagedata(depMessage) + dispatch(getDepUser(depMessage[0]?.id)) + setDepSelectedKeys([depMessage[0]?.id]) + setDepSelected([depMessage[0]?.name]) + } else { + //不是超级管理员,展示相应部门的数据 + let authDep = [] + depMessage.map((item) => { + if (item.id === user?.departmentId) { + authDep.push(item) + } + }) + setdepMessagedata(authDep) + if (authDep.length > 0) { + dispatch(getDepUser(authDep[0]?.id)) + setDepSelectedKeys([authDep[0]?.id]) + setDepSelected([authDep[0]?.name]) + } + } + + } }, [depMessage]) useEffect(() => { - if (depUser.length) { - setUserSelectedKeys([depUser[0].id]) - setUserSelected(depUser[0].username) - dispatch(getUserResource(depUser[0].id)) - setUseName(depUser[0].name) + const copy = depUser.filter((item) => { + return item.name !== user.name//把自己筛选出去 + }) + setDepUserCopy(copy) + if (copy.length) { + setUserSelectedKeys([copy[0].id]) + setUserSelected(copy[0].username) + dispatch(getUserResource(copy[0].id)) + setUseName(copy[0].name) } - setCheckedList(depUser.map(i => i.id)) - - + setCheckedList(copy.map(i => i.id)) }, [depUser]) // console.log(depUser,'用户信息') const handleSave = () => { @@ -131,12 +156,12 @@ const Authority = (props) => { selectedKeys={depSelectedKeys} onSelect={(selectedKeys, { selected, selectedNodes, node }) => { setUserType(selectedNodes[0].type) - setCheckedList(depUser.map(i => i.id)) + setCheckedList(depUserCopy.map(i => i.id)) // setResCode(userResource.map(i=>i.resourceId)) if (selected) { - setCheckedList(depUser.map(i => i.id)) + setCheckedList(depUserCopy.map(i => i.id)) setDepSelectedKeys(selectedKeys) setDepSelected(selectedNodes[0].name || "") dispatch(getDepUser(selectedKeys[0])) @@ -159,10 +184,10 @@ const Authority = (props) => { { - depUser.length ? + depUserCopy?.length ? { const name = node.name @@ -178,7 +203,7 @@ const Authority = (props) => { } }} - treeData={depUser} + treeData={depUserCopy} fieldNames={{ title: 'name', key: 'id' @@ -200,7 +225,7 @@ const Authority = (props) => { i.resourceId === 'AUTHORIMANAGE')[0]?.isshow === "true" ? true : ''}> 不可编辑 - {depUser.length ? + {depUserCopy?.length ? {/* { const [depUserCopy, setDepUserCopy] = useState([])//用于存放除了自己的管理的数组,即自己不能调整自己是否为管理员 const [uid, setuid] = useState() const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'USERMANAGE')[0].isshow === "true" ? true : '')//控制操作(新增删除等操作,对应权限的'不可编辑')是否可操作 + const [depMessagedata, setdepMessagedata] = useState(depMessage) + useEffect(() => { + if (depMessage.length) { + console.log('depMessage', depMessage) + //超级管理员展示所有部门 + if (user?.username === 'SuperAdmin') { + setdepMessagedata(depMessage) + setDepSelectedKeys([depMessage[0].id]) + dispatch(getDepUser(depMessage[0].id)) + } else { + //不是超级管理员,展示相应部门的数据 + let authDep = [] + depMessage.map((item) => { + if (item.id === user?.departmentId) { + authDep.push(item) + } + }) + setdepMessagedata(authDep) + if (authDep.length > 0) { + setDepSelectedKeys([authDep[0].id]) + dispatch(getDepUser(authDep[0].id)) + } + + } + } + + + }, [depMessage]) useEffect(() => { let code = ['USERMANAGE', 'AUTHORIMANAGE'] //console.log('你來u盧克嗎', depUser, uid) @@ -43,15 +71,16 @@ const UserManage = (props) => { }, []) useEffect(() => { + console.log('depuser', depUser) const copy = depUser.filter((item) => { - return item.name !== user//把自己筛选出去 + return item.name !== user.name//把自己筛选出去 }) setDepUserCopy(copy) }, [depUser]) useEffect(() => { if (depMessage.length) { - setDepSelectedKeys([depMessage[0].id]) - dispatch(getDepUser(depMessage[0].id)) + + } }, [depMessage]) @@ -295,7 +324,7 @@ const UserManage = (props) => { depMessage.length ? { // console.log('selectedKeys:',selectedKeys); @@ -310,7 +339,7 @@ const UserManage = (props) => { style={{ paddingTop: 20 }} > { - depMessage?.map((s, index) => { + depMessagedata?.map((s, index) => { return { s.subordinate.map(k => { diff --git a/web/client/src/sections/organization/routes.js b/web/client/src/sections/organization/routes.js index e3b843f6..a8baf484 100644 --- a/web/client/src/sections/organization/routes.js +++ b/web/client/src/sections/organization/routes.js @@ -15,6 +15,8 @@ export default [{ menuSelectKeys: ['userManage'], component: UserManage, breadcrumb: '用户管理', + authCode: 'USERMANAGE' + }, { path: '/authority', @@ -22,6 +24,7 @@ export default [{ menuSelectKeys: ['userAuthority'], component: Authority, breadcrumb: '权限管理', + authCode: 'AUTHORIMANAGE' } ] diff --git a/web/client/src/sections/quanju/actions/example.js b/web/client/src/sections/quanju/actions/example.js index cab22344..00371410 100644 --- a/web/client/src/sections/quanju/actions/example.js +++ b/web/client/src/sections/quanju/actions/example.js @@ -3,7 +3,7 @@ import { basicAction } from '@peace/utils' import { ApiTable } from '$utils' -export function getMembers(orgId) { +export function getMembers (orgId) { return dispatch => basicAction({ type: 'get', dispatch: dispatch, @@ -16,7 +16,7 @@ export function getMembers(orgId) { //获取大屏道路统计信息 -export function getdaolutongji() { +export function getdaolutongji () { return dispatch => basicAction({ type: 'get', dispatch: dispatch, @@ -28,7 +28,7 @@ export function getdaolutongji() { } //获取治超监测点处理数据信息 -export function getjiandmanage() { +export function getjiandmanage () { return dispatch => basicAction({ type: 'get', dispatch: dispatch, @@ -41,7 +41,7 @@ export function getjiandmanage() { //获取治超详情列 -export function getjiandetail() { +export function getjiandetail () { return dispatch => basicAction({ type: 'get', dispatch: dispatch, @@ -53,7 +53,7 @@ export function getjiandetail() { } // <<<<<<< HEAD // 获取运政数据统计 -export function getyunzheng() { +export function getyunzheng () { return dispatch => basicAction({ type: 'get', dispatch: dispatch, @@ -64,7 +64,7 @@ export function getyunzheng() { }); } // 获取道路养护数据统计及列表 -export function getRoadmaintain() { +export function getRoadmaintain () { return dispatch => basicAction({ type: 'get', dispatch: dispatch, @@ -75,7 +75,7 @@ export function getRoadmaintain() { }); } // 获取治超详情列 -export function getZhichaolist() { +export function getZhichaolist () { return dispatch => basicAction({ type: 'get', dispatch: dispatch, @@ -88,7 +88,7 @@ export function getZhichaolist() { } //获取宣传数据 -export function getxuanchuan() { +export function getxuanchuan () { return dispatch => basicAction({ type: 'get', dispatch: dispatch, @@ -100,7 +100,7 @@ export function getxuanchuan() { } //获取公交车辆层级信息 -export function getBusTierList() { +export function getBusTierList () { return dispatch => basicAction({ type: 'get', dispatch: dispatch, @@ -112,7 +112,7 @@ export function getBusTierList() { }); } //获取道路拥堵指数 -export function getGodshuju() { +export function getGodshuju () { return dispatch => basicAction({ type: 'get', dispatch: dispatch, @@ -125,7 +125,7 @@ export function getGodshuju() { } //获取路政列表 -export function getHighwayList() { +export function getHighwayList () { return dispatch => basicAction({ type: 'get', dispatch: dispatch, @@ -136,7 +136,7 @@ export function getHighwayList() { }); } //获取道路养护统计及列表 -export function getRoadMaintenanceList() { +export function getRoadMaintenanceList () { return dispatch => basicAction({ type: 'get', dispatch: dispatch, @@ -147,7 +147,7 @@ export function getRoadMaintenanceList() { }); } //获取管养单位概况 -export function getCustodyunit() { +export function getCustodyunit () { return dispatch => basicAction({ type: 'get', dispatch: dispatch, @@ -156,4 +156,26 @@ export function getCustodyunit() { msg: { error: '获取管养单位概况失败' }, // reducer: { name: 'roadMaintenances' } }); +} + +export function getNearestAssessData (query = {}) { + return dispatch => basicAction({ + type: 'get', + query, + dispatch: dispatch, + actionType: 'GET_NEAREST_ASSESS_DATA', + url: ApiTable.nearestAssessData, + msg: { error: '获取各乡镇考核得分情况失败' }, + }); +} + +export function getVideoCenterList () { + return dispatch => basicAction({ + type: 'get', + dispatch: dispatch, + actionType: 'GET_VIDEO_CENTER_LIST', + url: ApiTable.videoCenterList, + msg: { error: '获取视频中心列表失败' }, + reducer: { name: 'videoCenterList' } + }); } \ No newline at end of file diff --git a/web/client/src/sections/quanju/containers/example.js b/web/client/src/sections/quanju/containers/example.js index a10e1106..c7439221 100644 --- a/web/client/src/sections/quanju/containers/example.js +++ b/web/client/src/sections/quanju/containers/example.js @@ -32,10 +32,10 @@ const Example = (props) => { }}>
-
+
- +
@@ -45,7 +45,7 @@ const Example = (props) => { ) } -function mapStateToProps (state) { +function mapStateToProps(state) { const { auth, global, members } = state; return { loading: members.isRequesting, diff --git a/web/client/src/sections/quanju/containers/footer/conserve/left/left-center.js b/web/client/src/sections/quanju/containers/footer/conserve/left/left-center.js index 6a1180b4..f092903d 100644 --- a/web/client/src/sections/quanju/containers/footer/conserve/left/left-center.js +++ b/web/client/src/sections/quanju/containers/footer/conserve/left/left-center.js @@ -6,33 +6,114 @@ import * as echarts from 'echarts'; import ZheXian from "./zhexin" import PieChart from "./shituzujian" import Lunbo from './lunbo'; +import { connect } from 'react-redux' +import ReactECharts from 'echarts-for-react'; +import { getNearestAssessData } from "../../../../actions/example" +import moment from 'moment' const LeftCenter = (props) => { - const { data, shuju } = props + const { data, shuju, dispatch } = props const style = { height: "31%", marginTop: "3%" } // const chartRef = useState(); // const { roadData } = props const [flag, setFlag] = useState(true) // const [colorFlage, setColorFlage] = useState(true) + const [chartData, setChartData] = useState({ + series: [], + xAxis: [] + }) + + useEffect(() => { + dispatch(getNearestAssessData({ monthRange: 6 })).then(res => { + if (res.success) { + let nextChartSeries = [] + let nextXAxis = new Set() + let data = res.payload.data + data.reverse() + for (let d of data) { + let corUnitSeries = nextChartSeries.find(item => item.name == d.unit) + let month = moment(d.month).format('YYYY-MM') + nextXAxis.add(month) + if (corUnitSeries) { + corUnitSeries.data.push(d.totalPoints) + } else { + nextChartSeries.push({ + type: 'line', + smooth: true, + data: [d.totalPoints], + name: d.unit, + }) + } + } + setChartData({ + series: nextChartSeries, + xAxis: [...nextXAxis] + }) + } + }) + }, []) return ( <> - -
{ - setFlag(false) - }} style={{ position: "absolute", top: "38.5%", left: "80%", width: "50px", height: "20px", background: "linear-gradient(270deg, rgba(15,74,159,0) 0%, rgba(17,75,160,0.95) 100%)", float: "right", textAlign: "center", zIndex: 100, marginRight: "4%", borderLeft: "solid 2px #6E7A83" }} > - {/* */} -

累计

-
{ - setFlag(true) - }} style={{ position: "absolute", width: "50px", left: "60%", top: "38.5%", height: "20px", background: "linear-gradient(270deg, rgba(15,74,159,0) 0%, rgba(17,75,160,0.95) 100%)", float: "right", textAlign: "center", zIndex: 100, marginRight: "2%", borderLeft: "solid 2px #6E7A83", }}> - {/* */} -

上月

+ { - flag ? : + false ? + <> +
{ + setFlag(false) + }} style={{ position: "absolute", top: "38.5%", left: "80%", width: "50px", height: "20px", background: "linear-gradient(270deg, rgba(15,74,159,0) 0%, rgba(17,75,160,0.95) 100%)", float: "right", textAlign: "center", zIndex: 100, marginRight: "4%", borderLeft: "solid 2px #6E7A83" }} > + {/* */} +

累计

+
{ + setFlag(true) + }} style={{ position: "absolute", width: "50px", left: "60%", top: "38.5%", height: "20px", background: "linear-gradient(270deg, rgba(15,74,159,0) 0%, rgba(17,75,160,0.95) 100%)", float: "right", textAlign: "center", zIndex: 100, marginRight: "2%", borderLeft: "solid 2px #6E7A83", }}> + {/* */} +

上月

+ { + flag ? : + } + : '' } + + +
) } -export default LeftCenter \ No newline at end of file +function mapStateToProps (state) { + return { + + } +} +export default connect(mapStateToProps)(LeftCenter) \ No newline at end of file diff --git a/web/client/src/sections/quanju/containers/footer/conserve/right/right-center.js b/web/client/src/sections/quanju/containers/footer/conserve/right/right-center.js index 7189d83d..ebcbef5f 100644 --- a/web/client/src/sections/quanju/containers/footer/conserve/right/right-center.js +++ b/web/client/src/sections/quanju/containers/footer/conserve/right/right-center.js @@ -1,61 +1,123 @@ import React from 'react' import Module from '../../../public/module' import { Col, Row } from 'antd' +import { useEffect, useState } from 'react' +import { connect } from 'react-redux' +import ReactECharts from 'echarts-for-react'; +import { getNearestAssessData } from "../../../../actions/example" // const unit =['个','个',] const icon = [ - 'assets/images/quanju/jiancha.png', - 'assets/images/quanju/yushui.png', - 'assets/images/quanju/lupai.png', - 'assets/images/quanju/zerenpai.png' + 'assets/images/quanju/jiancha.png', + 'assets/images/quanju/yushui.png', + 'assets/images/quanju/lupai.png', + 'assets/images/quanju/zerenpai.png' ] const RightCenter = (props) => { - const { highwaysData } = props - const style = { height: "31%", marginTop: "3%" } - const textStyle = { fontSize: 14, color: '#E9F7FF' } - const numStyle = { color: '#fff', fontSize: 21, fontFamily: 'YouSheBiaoTiHei', textShadow: '0px 0px 8px #1C60FE', marginTop: 8 } - let list = highwaysData?.sort((a, b) => a.id - b.id) - list = highwaysData?.slice(4, 8).map((h,index)=>{ + const { highwaysData, dispatch } = props + + const [data, setData] = useState([]) + + const style = { height: "31%", marginTop: "3%" } + // const textStyle = { fontSize: 14, color: '#E9F7FF' } + // const numStyle = { color: '#fff', fontSize: 21, fontFamily: 'YouSheBiaoTiHei', textShadow: '0px 0px 8px #1C60FE', marginTop: 8 } + // let list = highwaysData?.sort((a, b) => a.id - b.id) + // list = highwaysData?.slice(4, 8).map((h, index) => { + // return { + // id: h.id, + // name: h.name, + // count: h.count, + // // unit:unit[index], + // icon: icon[index] + // } + // }) + // const arrayChunk = (array, size) => { + // let data = [] + // for (let i = 0; i < array.length; i += size) { + // data.push(array.slice(i, i + size)) + // } + // return data + // } + // let lists = list ? arrayChunk(list, 2) : [] + + + useEffect(() => { + dispatch(getNearestAssessData()).then(res => { + if (res.success) { + setData(res.payload.data) + } + }) + }, []) + + + return ( + <> + +
+ {/* { + lists?.map((item, index) => { + return
+ { + item?.map(i => ( +
+ icon +
+
{i.name}
+
{`${i.count}个`}
+
+
+ )) + } +
+ }) + } */} + d.unit), + axisTick: { + show: false + } + }, + yAxis: { + type: 'value', + splitLine: { + show: false + } + }, + tooltip: { + trigger: "axis" + }, + series: [ + { + data: data.map(d => d.totalPoints), + type: 'bar', + showBackground: true, + backgroundStyle: { + color: 'rgba(180, 180, 180, 0.2)' + } + } + ], + grid: { + left: '3%', + right: '4%', + bottom: '21%', + top: '4%', + containLabel: true + }, + }} + /> +
+
+ + ) +} +function mapStateToProps (state) { return { - id:h.id, - name:h.name, - count:h.count, - // unit:unit[index], - icon:icon[index] - } - }) - const arrayChunk = (array, size) => { - let data = [] - for (let i = 0; i < array.length; i += size) { - data.push(array.slice(i, i + size)) + } - return data - } - let lists = list ? arrayChunk(list, 2) : [] - return ( - <> - -
- { - lists?.map((item, index) => { - return
- { - item?.map(i => ( -
- icon -
-
{i.name}
-
{`${i.count}个`}
-
-
- )) - } -
- }) - } -
-
- - ) } -export default RightCenter \ No newline at end of file +export default connect(mapStateToProps)(RightCenter) \ No newline at end of file diff --git a/web/client/src/sections/quanju/containers/footer/conserve/right/right-top.js b/web/client/src/sections/quanju/containers/footer/conserve/right/right-top.js index 44d92965..c73ad5a4 100644 --- a/web/client/src/sections/quanju/containers/footer/conserve/right/right-top.js +++ b/web/client/src/sections/quanju/containers/footer/conserve/right/right-top.js @@ -1,46 +1,123 @@ import { Col, Row } from 'antd' import React, { useState, useEffect } from 'react' import Module from '../../../public/module' - +import { connect } from 'react-redux' +import Lun from "../../leadership/right/lunbo" +import { getRoadmaintain } from "../../../../actions/example" +import Hua from "../../leadership/right/hudong" +import moment from 'moment' const iconSrc = [ - 'assets/images/quanju/biaoxian.png', - 'assets/images/quanju/renxing.png', - 'assets/images/quanju/biaozhi.png', - 'assets/images/quanju/fanghu.png' + 'assets/images/quanju/biaoxian.png', + 'assets/images/quanju/renxing.png', + 'assets/images/quanju/biaozhi.png', + 'assets/images/quanju/fanghu.png' ] const unit = ['km', '处', '个', 'km'] const RightTop = (props) => { - const { highwaysData } = props - const style = { height: "31%", marginTop: "3%" } - const textStyle = { fontSize: 14, color: '#E9F7FF' } - const numStyle = { color: '#fff', fontSize: 21, fontFamily: 'YouSheBiaoTiHei', textShadow: '0px 0px 8px #1C60FE', marginTop: 8 } - let list = highwaysData?.sort((a, b) => a.id - b.id) - list = highwaysData?.slice(0, 4).map((h, index) => { - return { - id: h.id, - name: h.name, - count: h.count, - unit: unit[index], - icon: iconSrc[index] + const { highwaysData, dispatch } = props + const [roadmaintainList, setRoadmaintainList] = useState([]) + const [beijing, setBeijing] = useState() + const [num, setNum] = useState() - } - }) + const style = { height: "31%", marginTop: "3%" } + // const textStyle = { fontSize: 14, color: '#E9F7FF' } + // const numStyle = { color: '#fff', fontSize: 21, fontFamily: 'YouSheBiaoTiHei', textShadow: '0px 0px 8px #1C60FE', marginTop: 8 } + // let list = highwaysData?.sort((a, b) => a.id - b.id) + // list = highwaysData?.slice(0, 4).map((h, index) => { + // return { + // id: h.id, + // name: h.name, + // count: h.count, + // unit: unit[index], + // icon: iconSrc[index] + + // } + // }) - const arrayChunk = (array, size) => { - let data = [] - for (let i = 0; i < array.length; i += size) { - data.push(array.slice(i, i + size)) + // const arrayChunk = (array, size) => { + // let data = [] + // for (let i = 0; i < array.length; i += size) { + // data.push(array.slice(i, i + size)) + // } + // return data + // } + // let lists = list ? arrayChunk(list, 2) : [] + + useEffect(() => { + dispatch(getRoadmaintain()).then((res) => { + setRoadmaintainList(res.payload.data.reportList.filter((item, index) => { + return item.projectType == "road" + })) + }) + }, []) + + const renderBody = () => { + return ( +
+ { + roadmaintainList.map((item, index) => { + return ( +
  • { + setBeijing(index) + setNum(index) + }} onMouseLeave={() => { + setBeijing() + setNum() + }}> + {beijing == index ? : ""} + {beijing == index ? : ""} +

    {item?.user?.name || '--'}

    +

    {item.road ? item.road : "--"}

    +

    + { + item.time ? + moment(item.time).format("YYYY-MM-DD") + : "--" + } +

    + { + num == index ? +
    + +
    + +
    +
    +

    + {item.roadSectionStart ? item.roadSectionStart : ""}{item.roadSectionStart && item.roadSectionEnd ? "——" : ""}{item.roadSectionEnd ? item.roadSectionEnd : ""}{item.roadSectionStart || item.roadSectionEnd ? "" : "--"} +

    +

    养护类型日常养护

    +

    负责人{item.user?.name ? item.user.name : "--"}

    +

    日期{moment(item.time).format("YYYY-MM-DD") ? moment(item.time).format("YYYY-MM-DD") : "--"}

    +
    +
    : "" + } +
  • + ) + }) + } +
    + ) } - return data - } - let lists = list ? arrayChunk(list, 2) : [] - return ( - <> - -
    - { + + return ( + <> + +
    + {/* { lists?.map((item, index) => { return
    { @@ -56,10 +133,22 @@ const RightTop = (props) => { }
    }) - } -
    -
    - - ) + } */} + +
    +
    + + ) +} +function mapStateToProps (state) { + return { + + } } -export default RightTop \ No newline at end of file +export default connect(mapStateToProps)(RightTop) \ No newline at end of file diff --git a/web/client/src/sections/quanju/containers/footer/leadership/index.js b/web/client/src/sections/quanju/containers/footer/leadership/index.js index e12bf0bb..8ad3fa3f 100644 --- a/web/client/src/sections/quanju/containers/footer/leadership/index.js +++ b/web/client/src/sections/quanju/containers/footer/leadership/index.js @@ -1,19 +1,30 @@ -import React from 'react' +import React, { useEffect, useState } from 'react' import Left from './left' import Right from './right' import CenterLeft from "./centerLeft" import Centerright from "./centerRight" +import { connect } from 'react-redux' +import { getNearestAssessData, getVideoCenterList } from "../../../actions/example" const Leadership = (props) => { const { dispatch } = props + + useEffect(() => { + dispatch(getVideoCenterList()) + }, []) + return ( <> {/* */} - ) } -export default Leadership \ No newline at end of file +function mapStateToProps (state) { + return { + + } +} +export default connect(mapStateToProps)(Leadership) \ No newline at end of file diff --git a/web/client/src/sections/quanju/containers/footer/leadership/left/left-center.js b/web/client/src/sections/quanju/containers/footer/leadership/left/left-center.js index 542a8743..872032b3 100644 --- a/web/client/src/sections/quanju/containers/footer/leadership/left/left-center.js +++ b/web/client/src/sections/quanju/containers/footer/leadership/left/left-center.js @@ -1,95 +1,130 @@ import React, { useEffect, useState } from 'react' import Module from '../../../public/module' import Lunbo from "../right/lunbo" +import { connect } from 'react-redux' +import { YSIframePlayer } from '../../../../../../components' // import "./left.less" -const Leftcenter = () => { - const style = { height: "30%", marginTop: "5%" } - // const hualun = "auto" - const [num, setNum] = useState(1); - const [tu, setTu] = useState(""); - const [name, setName] = useState(""); - const [list, setList] = useState([ - { name: '沙潭至五星', img: "/assets/images/leadership/fake/1.jpg" }, - { name: '滁槎至协城', img: "/assets/images/leadership/fake/2.jpg" }, - { name: '瓜山至广福', img: "/assets/images/leadership/fake/3.jpg" }, - { name: '罗舍至泗洪', img: "/assets/images/leadership/fake/4.jpg" }, - { name: '渔业至万州', img: "/assets/images/leadership/fake/5.jpg" }, - // { name: '小蓝至东新', img: "/assets/images/leadership/shiyantu.png" }, - ]) - useEffect(() => { - const timer = setInterval(() => { - if (num == list.length) { - setNum(1); - setTu(list[0].img); - } else { - setNum(num + 1); - setTu(list[num].img); - } - }, 2000); - return () => clearInterval(timer); - }, [num]); - const renderBody = () => { - return ( -
    { - list.map((item, index) => { - return ( - //
    - // {/*
    */} -
  • { - setTu(item.img); - setNum(index + 1); - setName(item.name) - // console.log(list); - }}> -

    {item.name}

    - -
  • - // {/*
    */} - //
    - ) +const Leftcenter = ({ videoCenterList }) => { + const style = { height: "30%", marginTop: "5%" } + // const hualun = "auto" + const [num, setNum] = useState(1); + const [tu, setTu] = useState(""); + const [name, setName] = useState(""); + const [list, setList] = useState([ + // { name: '沙潭至五星', img: "/assets/images/leadership/fake/1.jpg" }, + // { name: '滁槎至协城', img: "/assets/images/leadership/fake/2.jpg" }, + // { name: '瓜山至广福', img: "/assets/images/leadership/fake/3.jpg" }, + // { name: '罗舍至泗洪', img: "/assets/images/leadership/fake/4.jpg" }, + // { name: '渔业至万州', img: "/assets/images/leadership/fake/5.jpg" }, - }) - } -
    - ) - } - return ( - <> -
    - {/*

    {title || []}

    */} - - 主要路段拥堵情况分析 - -
    -
    -
    - { - list.map((item, index) => { - return index + 1 == num ? -
    + // { name: '小蓝至东新', img: "/assets/images/leadership/shiyantu.png" }, + ]) - -

    - - {item.name}

    -
    : "" + useEffect(() => { + if (videoCenterList.length) { + setList(videoCenterList.slice(0, 5)) + } + }, [videoCenterList]) - }) - } + useEffect(() => { + const timer = setInterval(() => { + if (num == list.length) { + setNum(1); + // setTu(list[0].img); + } else { + setNum(num + 1); + // setTu(list[num].img); + } + }, 2000 * 10); + return () => clearInterval(timer); + }, [num]); + + const renderBody = () => { + return ( +
    { + list.map((item, index) => { + return ( + //
    + // {/*
    */} +
  • { + setTu(item.img); + setNum(index + 1); + setName(item.deviceName) + // console.log(list); + }}> +

    {item.deviceName}

    + +
  • + // {/*
    */} + //
    + ) + + }) + } +
    + ) + } + return ( + <> +
    + {/*

    {title || []}

    */} + + 主要路段拥堵情况 +
    - -
    - - ) +
    +
    + { + list.map((item, index) => { + console.log(item); + return index + 1 == num ? +
    + + {/* */} + + + +

    + + + {item.deviceName} + +

    + +
    : "" + }) + } +
    + +
    + + ) +} +function mapStateToProps (state) { + const { videoCenterList } = state + + return { + videoCenterList: videoCenterList.data || [] + } } -export default Leftcenter \ No newline at end of file +export default connect(mapStateToProps)(Leftcenter) \ No newline at end of file diff --git a/web/client/src/sections/quanju/containers/footer/leadership/right/hudong.js b/web/client/src/sections/quanju/containers/footer/leadership/right/hudong.js index 77ec7cc0..2ec43eb3 100644 --- a/web/client/src/sections/quanju/containers/footer/leadership/right/hudong.js +++ b/web/client/src/sections/quanju/containers/footer/leadership/right/hudong.js @@ -1,108 +1,109 @@ import React, { Component } from 'react'; import './left.less'; class ReactCarousel extends Component { - chunk (arr, size) { - var arr1 = new Array(); - for (var i = 0; i < Math.ceil(arr.length / size); i++) { - arr1[i] = new Array(); - } - var j = 0; - var x = 0; - for (var i = 0; i < arr.length; i++) { - if (!((i % size == 0) && (i != 0))) { - arr1[j][x] = arr[i]; - x++; - } else { - j++; - x = 0; - arr1[j][x] = arr[i]; - x++; - } - } - return arr1; - } + chunk (arr, size) { + var arr1 = new Array(); + for (var i = 0; i < Math.ceil(arr.length / size); i++) { + arr1[i] = new Array(); + } + var j = 0; + var x = 0; + for (var i = 0; i < arr.length; i++) { + if (!((i % size == 0) && (i != 0))) { + arr1[j][x] = arr[i]; + x++; + } else { + j++; + x = 0; + arr1[j][x] = arr[i]; + x++; + } + } + return arr1; + } - constructor() { - super(); - this.state = { - shuzu: [ - { name: '沙潭至五星', img: "/assets/images/leadership/fake/1.jpg" }, - { name: '滁槎至协城', img: "/assets/images/leadership/fake/2.jpg" }, - { name: '瓜山至广福', img: "/assets/images/leadership/fake/3.jpg" }, - { name: '罗舍至泗洪', img: "/assets/images/leadership/fake/4.jpg" }, - { name: '渔业至万州', img: "/assets/images/leadership/fake/5.jpg" }, - { name: '沙潭至五星', img: "/assets/images/leadership/fake/1.jpg" }, - { name: '滁槎至协城', img: "/assets/images/leadership/fake/2.jpg" }, - { name: '瓜山至广福', img: "/assets/images/leadership/fake/3.jpg" }, - { name: '罗舍至泗洪', img: "/assets/images/leadership/fake/4.jpg" }, - { name: '渔业至万州', img: "/assets/images/leadership/fake/5.jpg" }, - ], - imgs: [], - showIndex: 0, //显示第几个图片 - timer: null, // 定时器 - show: false, // 前后按钮显示 - // arr1: "" - } - // console.log(this.state.imgs); - this.state.imgs = this.chunk((this.state.shuzu), 4) - } + constructor() { + super(); + this.state = { + shuzu: [ + { name: '沙潭至五星', img: "/assets/images/leadership/fake/1.jpg" }, + { name: '滁槎至协城', img: "/assets/images/leadership/fake/2.jpg" }, + { name: '瓜山至广福', img: "/assets/images/leadership/fake/3.jpg" }, + { name: '罗舍至泗洪', img: "/assets/images/leadership/fake/4.jpg" }, + { name: '渔业至万州', img: "/assets/images/leadership/fake/5.jpg" }, + { name: '沙潭至五星', img: "/assets/images/leadership/fake/1.jpg" }, + { name: '滁槎至协城', img: "/assets/images/leadership/fake/2.jpg" }, + { name: '瓜山至广福', img: "/assets/images/leadership/fake/3.jpg" }, + { name: '罗舍至泗洪', img: "/assets/images/leadership/fake/4.jpg" }, + { name: '渔业至万州', img: "/assets/images/leadership/fake/5.jpg" }, + ], + imgs: [], + showIndex: 0, //显示第几个图片 + timer: null, // 定时器 + show: false, // 前后按钮显示 + // arr1: "" + } + // console.log(this.state.imgs); + this.state.imgs = this.chunk((this.state.shuzu), 4) + } - render () { - return ( -
    -
    { this.stop() }} //鼠标进入停止自动播放 - onMouseLeave={() => { this.start() }} //鼠标退出自动播放 - > -
      - { - this.state.imgs.map((value, index) => { - return ( -
    • -
      -
      -
      - - {value[0]?.name} -
      -
      + render () { + console.log(this.props); + return ( +
      +
      { this.stop() }} //鼠标进入停止自动播放 + onMouseLeave={() => { this.start() }} //鼠标退出自动播放 + > +
        + { + this.state.imgs.map((value, index) => { + return ( +
      • +
        +
        +
        + + {value[0]?.name} +
        +
        -
        - {value[1]?.name ?
        -
        -
        - - {value[1]?.name} -
        -
        -
        : ""} - {value[2]?.name ?
        -
        -
        - - {value[2]?.name} -
        -
        -
        : ""} - {value[3]?.name ?
        -
        -
        - - {value[3]?.name} -
        -
        -
        : ""} - {/*
        {value[1].name}
        +
      + {value[1]?.name ?
      +
      +
      + + {value[1]?.name} +
      +
      +
      : ""} + {value[2]?.name ?
      +
      +
      + + {value[2]?.name} +
      +
      +
      : ""} + {value[3]?.name ?
      +
      +
      + + {value[3]?.name} +
      +
      +
      : ""} + {/*
      {value[1].name}
      {value[2].name}
      {value[3].name}
      */} -
    • - ) - }) - } -
    - {/*
      + + ) + }) + } +
    + {/*
      { this.state.imgs.map((value, index) => { return ( @@ -115,68 +116,71 @@ class ReactCarousel extends Component { }
    */} -
    - { this.previous(e) }}> - - - { this.next(e) }}> - - -
    +
    + { this.previous(e) }}> + + + { this.next(e) }}> + + +
    +
    -
    - ) - } - componentDidMount () { //一开始自动播放 - this.start(); - } + ) + } + componentDidMount () { //一开始自动播放 + if(this.props.shuzu) + setTimeout(() => { + this.start(); + }, 0) + } - componentWillUnmount () { //销毁前清除定时器 - this.stop(); - } - stop = () => { //暂停 - let { timer } = this.state; - clearInterval(timer); - } - start = () => { //开始 - let { timer } = this.state; - timer = setInterval(() => { - this.next(); - }, 300000); - this.setState({ - timer - }) - } - change = (index) => { //点击下面的按钮切换当前显示的图片 - let { showIndex } = this.state; - showIndex = index; - this.setState({ - showIndex - }) - } - previous = (e) => { //上一张 - let ev = e || window.event; - let { showIndex, imgs } = this.state; - if (showIndex <= 0) { - showIndex = imgs.length - 1; - } else { - showIndex--; - } - this.setState({ - showIndex - }) - } - next = (e) => { //下一张 - let ev = e || window.event; - let { showIndex, imgs } = this.state; - if (showIndex >= imgs.length - 1) { - showIndex = 0; - } else { - showIndex++; - } - this.setState({ - showIndex - }) - } + componentWillUnmount () { //销毁前清除定时器 + this.stop(); + } + stop = () => { //暂停 + let { timer } = this.state; + clearInterval(timer); + } + start = () => { //开始 + let { timer } = this.state; + timer = setInterval(() => { + this.next(); + }, 300000); + this.setState({ + timer + }) + } + change = (index) => { //点击下面的按钮切换当前显示的图片 + let { showIndex } = this.state; + showIndex = index; + this.setState({ + showIndex + }) + } + previous = (e) => { //上一张 + let ev = e || window.event; + let { showIndex, imgs } = this.state; + if (showIndex <= 0) { + showIndex = imgs.length - 1; + } else { + showIndex--; + } + this.setState({ + showIndex + }) + } + next = (e) => { //下一张 + let ev = e || window.event; + let { showIndex, imgs } = this.state; + if (showIndex >= imgs.length - 1) { + showIndex = 0; + } else { + showIndex++; + } + this.setState({ + showIndex + }) + } } export default ReactCarousel; \ No newline at end of file diff --git a/web/client/src/sections/quanju/containers/footer/leadership/right/hudongVideo.js b/web/client/src/sections/quanju/containers/footer/leadership/right/hudongVideo.js new file mode 100644 index 00000000..ae9aca35 --- /dev/null +++ b/web/client/src/sections/quanju/containers/footer/leadership/right/hudongVideo.js @@ -0,0 +1,202 @@ +import React, { Component } from 'react'; +import './left.less'; +import { connect } from 'react-redux' +import { YSIframePlayer } from '../../../../../../components' + +class ReactCarousel extends Component { + chunk (arr, size) { + var arr1 = new Array(); + for (var i = 0; i < Math.ceil(arr.length / size); i++) { + arr1[i] = new Array(); + } + var j = 0; + var x = 0; + for (var i = 0; i < arr.length; i++) { + if (!((i % size == 0) && (i != 0))) { + arr1[j][x] = arr[i]; + x++; + } else { + j++; + x = 0; + arr1[j][x] = arr[i]; + x++; + } + } + return arr1; + } + + constructor() { + super(); + this.state = { + imgs: [], + showIndex: 0, //显示第几个图片 + timer: null, // 定时器 + show: false, // 前后按钮显示 + } + } + + renderVideo = (item, index) => { + return + } + + render () { + console.log(this.props); + const { imgs } = this.state + return ( +
    +
    { this.stop() }} //鼠标进入停止自动播放 + onMouseLeave={() => { this.start() }} //鼠标退出自动播放 + > +
      + { + this.state.imgs.map((value, index) => { + return ( +
    • + { + imgs.map((value, index) => { + if (index == 0) { + return value?.deviceSerial ?
      + {this.renderVideo(value, index)} +
      +
      + + {value?.deviceName} +
      +
      +
      : '' + } else if (index == 1) { + return value?.deviceSerial ?
      + {this.renderVideo(value, index)} +
      +
      + + {value?.deviceName} +
      +
      +
      : "" + } else if (index == 2) { + return value?.deviceSerial ?
      + {this.renderVideo(value, index)} +
      +
      + + {value?.deviceName} +
      +
      +
      : "" + } else if (index == 3) { + return value?.deviceSerial ?
      + {this.renderVideo(value, index)} +
      +
      + + {value?.deviceName} +
      +
      +
      : "" + } else { + return undefined + } + }) + } +
    • + ) + }) + } +
    + {/*
    + { this.previous(e) }}> + + + { this.next(e) }}> + + +
    */} +
    +
    + ) + } + + componentWillReceiveProps (nextProps, oldProps) { + if (nextProps.videoCenterList && nextProps.videoCenterList.length && (!oldProps.videoCenterList || !oldProps.videoCenterList.length)) { + this.setState({ + imgs: nextProps.videoCenterList.slice(-4) + }) + } + } + componentDidMount () { //一开始自动播放 + setTimeout(() => { + this.start(); + }, 0) + } + + componentWillUnmount () { //销毁前清除定时器 + this.stop(); + } + stop = () => { //暂停 + let { timer } = this.state; + clearInterval(timer); + } + start = () => { //开始 + let { timer } = this.state; + timer = setInterval(() => { + this.next(); + }, 300000); + this.setState({ + timer + }) + } + change = (index) => { //点击下面的按钮切换当前显示的图片 + let { showIndex } = this.state; + showIndex = index; + this.setState({ + showIndex + }) + } + previous = (e) => { //上一张 + let ev = e || window.event; + let { showIndex, imgs } = this.state; + if (showIndex <= 0) { + showIndex = imgs.length - 1; + } else { + showIndex--; + } + this.setState({ + showIndex + }) + } + next = (e) => { //下一张 + let ev = e || window.event; + let { showIndex, imgs } = this.state; + if (showIndex >= imgs.length - 1) { + showIndex = 0; + } else { + showIndex++; + } + this.setState({ + showIndex + }) + } +} + +function mapStateToProps (state) { + const { videoCenterList } = state + + return { + videoCenterList: videoCenterList.data || [] + } +} +export default connect(mapStateToProps)(ReactCarousel) \ No newline at end of file diff --git a/web/client/src/sections/quanju/containers/footer/leadership/right/right-center.js b/web/client/src/sections/quanju/containers/footer/leadership/right/right-center.js index 609facf8..0276069b 100644 --- a/web/client/src/sections/quanju/containers/footer/leadership/right/right-center.js +++ b/web/client/src/sections/quanju/containers/footer/leadership/right/right-center.js @@ -2,8 +2,10 @@ import React from 'react' const Rightcenter = () => { return ( - <>
    -
    + <> +
    +
    + ) } export default Rightcenter \ No newline at end of file diff --git a/web/client/src/sections/quanju/containers/footer/leadership/right/right-top.js b/web/client/src/sections/quanju/containers/footer/leadership/right/right-top.js index c46e0de6..8fd1c6f5 100644 --- a/web/client/src/sections/quanju/containers/footer/leadership/right/right-top.js +++ b/web/client/src/sections/quanju/containers/footer/leadership/right/right-top.js @@ -2,133 +2,152 @@ import React, { useState, useEffect } from 'react'; import Module from '../../../public/module' import { Radio, Select, Spin } from 'antd'; import Lunbo from "./lunbo" -import Huadong from './hudong'; +import Huadong from './hudongVideo'; +import { connect } from 'react-redux' import "./left.less" -const Righttop = () => { - const { Option } = Select; - const style = { height: "68%" } - const children = []; - const [size, setSize] = useState('454544545'); - const [num, setNum] = useState(); - const [tu, setTu] = useState(""); - const [name, setName] = useState(""); - const handleChange = (value) => { - // console.log(`Selected: ${value}`); - setSize(value) - }; +const Righttop = ({ videoCenterList }) => { + const { Option } = Select; + const style = { height: "68%" } + const children = []; + const [size, setSize] = useState('454544545'); + const [num, setNum] = useState(); + const [tu, setTu] = useState(""); + const [name, setName] = useState(""); + const handleChange = (value) => { + // console.log(`Selected: ${value}`); + setSize(value) + }; - const [list, setList] = useState([ - { name: '沙潭至五星', img: "/assets/images/leadership/fake/1.jpg" }, - { name: '滁槎至协城', img: "/assets/images/leadership/fake/2.jpg" }, - { name: '瓜山至广福', img: "/assets/images/leadership/fake/3.jpg" }, - { name: '罗舍至泗洪', img: "/assets/images/leadership/fake/4.jpg" }, - { name: '渔业至万州', img: "/assets/images/leadership/fake/5.jpg" }, - { name: '沙潭至五星', img: "/assets/images/leadership/fake/1.jpg" }, - { name: '滁槎至协城', img: "/assets/images/leadership/fake/2.jpg" }, - { name: '瓜山至广福', img: "/assets/images/leadership/fake/3.jpg" }, - { name: '罗舍至泗洪', img: "/assets/images/leadership/fake/4.jpg" }, - { name: '渔业至万州', img: "/assets/images/leadership/fake/5.jpg" }, - ]) - for (let i = 0; i < list.length; i++) { - children.push(); - } + const [list, setList] = useState([ + // { name: '沙潭至五星', img: "/assets/images/leadership/fake/1.jpg" }, + // { name: '滁槎至协城', img: "/assets/images/leadership/fake/2.jpg" }, + // { name: '瓜山至广福', img: "/assets/images/leadership/fake/3.jpg" }, + // { name: '罗舍至泗洪', img: "/assets/images/leadership/fake/4.jpg" }, + // { name: '渔业至万州', img: "/assets/images/leadership/fake/5.jpg" }, + // { name: '沙潭至五星', img: "/assets/images/leadership/fake/1.jpg" }, + // { name: '滁槎至协城', img: "/assets/images/leadership/fake/2.jpg" }, + // { name: '瓜山至广福', img: "/assets/images/leadership/fake/3.jpg" }, + // { name: '罗舍至泗洪', img: "/assets/images/leadership/fake/4.jpg" }, + // { name: '渔业至万州', img: "/assets/images/leadership/fake/5.jpg" }, + ]) + // for (let i = 0; i < list.length; i++) { + // children.push(); + // } - // useEffect(() => { - // const timer = setInterval(() => { - // if (num == 12) { - // setNum(1); - // setTu(list[0].img); - // } else { - // setNum(num + 1); - // setTu(list[num].img); - // } - // }, 6000); - // return () => clearInterval(timer); - // }, [num]); - const renderBody = () => { - return ( -
    { - list.map((item, index) => { - return ( -
    -
    -
  • { - // setTu(item.img); - setNum(index); - }} onMouseLeave={() => { - setNum() - }}> - {num == index ? : ""} - {num == index ? : ""} + // useEffect(() => { + // const timer = setInterval(() => { + // if (num == 12) { + // setNum(1); + // setTu(list[0].img); + // } else { + // setNum(num + 1); + // setTu(list[num].img); + // } + // }, 6000); + // return () => clearInterval(timer); + // }, [num]); -

    {item.name}

    -

    {item.name}

    -
  • -
    -
    - ) + useEffect(() => { + if (videoCenterList.length) { + setList(videoCenterList.slice(-4)) + } + }, [videoCenterList]) + const renderBody = () => { + const offlineDevice = videoCenterList.filter(v => v.status == 0) + return ( +
    { + offlineDevice.length ? offlineDevice.map((item, index) => { + return ( +
    +
    +
  • { + // setTu(item.img); + setNum(index); + }} onMouseLeave={() => { + setNum() + }}> + {/* {num == index ? : ""} + {num == index ? : ""} */} - }) - } -
  • - ) - } - return ( - <> +

    {item.deviceName}

    +

    {item.deviceSerial}

    + +
    +
    + ) + }) : + + } +
    + ) + } + return ( + <> - -
    -

    监控总数

    129

    -

    在线率

    88.87%

    -
    - + +
    +

    监控总数

    {videoCenterList.length}

    +

    在线率

    + { + videoCenterList.length ? + ((videoCenterList.filter(v => v.status == 1).length / videoCenterList.length) * 100).toFixed(0) : '100' + }%

    +
    + -
    - -
    {size}
    + {/*
    + +
    {size}
    +
    */} -
    +
    +
    + +
    +
    +
    +
    + {/*

    {title || ''}

    */} + + 离线详情 + +
    + + + +
    -
    -
    - -
    -
    -
    -
    - {/*

    {title || ''}

    */} - - 离线详情 - -
    - - - -
    +
    -
    + + ) +} + +function mapStateToProps (state) { + const { videoCenterList } = state - - ) + return { + videoCenterList: videoCenterList.data || [] + } } -export default Righttop \ No newline at end of file +export default connect(mapStateToProps)(Righttop) \ No newline at end of file diff --git a/web/client/src/sections/quanju/containers/heand/index.js b/web/client/src/sections/quanju/containers/heand/index.js index 2589ffb6..2897b285 100644 --- a/web/client/src/sections/quanju/containers/heand/index.js +++ b/web/client/src/sections/quanju/containers/heand/index.js @@ -7,13 +7,25 @@ import { Tabs } from 'antd'; const { TabPane } = Tabs; const Header = (props) => { const { dispatch, tabChange, tabKey, user } = props + console.log('user111', user) // const [tab, setTad] = useState("base") const onClick = (tab) => { // setTad({ tab }) tabChange(tab) } const dianji = () => { - dispatch(push('/noContent')) + const allroutes = JSON.parse(sessionStorage.getItem('allRoutes')) || [] + const hasAuth = allroutes?.filter((item) => { return user?.userResources.find((child) => { return child.resourceId === item.authCode }) }) + if (user?.username === 'SuperAdmin') { + dispatch(push('/fillion/infor')) + } + else if (hasAuth && hasAuth.length > 0) { + const path = hasAuth[0].path + console.log('sasa', `${path}`) + dispatch(push(path)) + } else { + dispatch(push('/noContent')) + } } return (
    diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js index a4bb27e0..580f4f23 100644 --- a/web/client/src/utils/webapi.js +++ b/web/client/src/utils/webapi.js @@ -168,9 +168,13 @@ export const ApiTable = { // 考核评分 getAssess: 'assess', - putAssess: 'assess', + editAssess: 'assess', delAssess: 'assess/{assessId}', + nearestAssessData:'assess/nearest', + // 视频中心 + videoCenterList:'videoCenter/list', + //工程数据 getProject: 'project', putProject: 'project', @@ -289,7 +293,9 @@ export const ApiTable = { //养护费用 getMaintenance: '/road/maintenance/cost/nanchang/query', //任务信息 - getTask: 'task', delTask: 'task/{taskId}', editTask: 'task' + getTask: 'task', delTask: 'task/{taskId}', editTask: 'task', + //部门下所有员工 + getAllDepUsers: 'allDepUsers' }; diff --git a/web/config.js b/web/config.js index babd0300..27b84b6b 100644 --- a/web/config.js +++ b/web/config.js @@ -18,13 +18,22 @@ args.option(['u', 'api-url'], 'webapi的URL'); args.option('apiUrl', '可外网访问的 webapi 的URL'); args.option(['r', 'report-node'], '报表进程地址'); args.option('qndmn', '七牛'); +args.option('vcmpWebUrl', '视频平台web可访问地址'); +args.option('vcmpMirrorId', '视频平台镜像服务id') const flags = args.parse(process.argv); + const FS_UNIAPP_API = process.env.FS_UNIAPP_API || flags.apiUrl; const QINIU_DOMAIN_QNDMN_RESOURCE = process.env.ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE || flags.qndmn; const API_URL = process.env.API_URL || flags.apiUrl; +// +const VCMP_WEB_URL = process.env.VCMP_WEB_URL || flags.vcmpWebUrl; +const VCMP_MIRROR_ID = process.env.VCMP_MIRROR_ID || flags.vcmpMirrorId; -if (!FS_UNIAPP_API) { +if ( + !FS_UNIAPP_API || + !VCMP_WEB_URL || !VCMP_MIRROR_ID +) { console.log('缺少启动参数,异常退出'); args.showHelp(); process.exit(-1); @@ -56,6 +65,8 @@ const product = { opts: { apiUrl: API_URL, qndmn: QINIU_DOMAIN_QNDMN_RESOURCE, + vcmpWebUrl: VCMP_WEB_URL, + vcmpMirrorId: VCMP_MIRROR_ID, staticRoot: './client', } }, { diff --git a/web/package-lock.json b/web/package-lock.json index 0cf7743c..abb0ed23 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -4446,7 +4446,7 @@ }, "cross-env": { "version": "7.0.3", - "resolved": "http://10.8.30.22:7000/cross-env/-/cross-env-7.0.3.tgz", + "resolved": "http://npm.anxinyun.cn/cross-env/-/cross-env-7.0.3.tgz", "integrity": "sha1-hlJkspZ33AFbqEGJGJZd0jL8VM8=", "requires": { "cross-spawn": "^7.0.1" @@ -4964,6 +4964,15 @@ } } }, + "echarts-for-react": { + "version": "3.0.2", + "resolved": "http://10.8.30.22:7000/echarts-for-react/-/echarts-for-react-3.0.2.tgz", + "integrity": "sha512-DRwIiTzx8JfwPOVgGttDytBqdp5VzCSyMRIxubgU/g2n9y3VLUmF2FK7Icmg/sNVkv4+rktmrLN9w22U2yy3fA==", + "requires": { + "fast-deep-equal": "^3.1.3", + "size-sensor": "^1.0.1" + } + }, "ee-first": { "version": "1.1.1", "resolved": "http://npm.anxinyun.cn/ee-first/-/ee-first-1.1.1.tgz", @@ -7510,7 +7519,7 @@ }, "lodash": { "version": "4.17.21", - "resolved": "http://npm.anxinyun.cn/lodash/-/lodash-4.17.21.tgz", + "resolved": "http://10.8.30.22:7000/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, "lodash-es": { @@ -10299,6 +10308,11 @@ "totalist": "^1.0.0" } }, + "size-sensor": { + "version": "1.0.1", + "resolved": "http://10.8.30.22:7000/size-sensor/-/size-sensor-1.0.1.tgz", + "integrity": "sha1-+E5GIG0+JZ+v8dVI5LO+ypMhnbs=" + }, "smart-buffer": { "version": "4.2.0", "resolved": "http://npm.anxinyun.cn/smart-buffer/-/smart-buffer-4.2.0.tgz", diff --git a/web/package.json b/web/package.json index e91b1530..add7d5a1 100644 --- a/web/package.json +++ b/web/package.json @@ -6,7 +6,7 @@ "scripts": { "test": "mocha", "start": "cross-env NODE_ENV=development npm run start-params", - "start-params": "node server -p 5000 -u http://localhost:13400 --qndmn http://rfkimpwbb.hn-bkt.clouddn.com", + "start-params": "node server -p 5000 -u http://localhost:13400 --qndmn http://rfkimpwbb.hn-bkt.clouddn.com --vcmpWebUrl https://mediaconsole.ngaiot.com --vcmpMirrorId 24461524032354", "deploy": "export NODE_ENV=production&&npm run color && npm run build && node server", "build-dev": "export NODE_ENV=development&&webpack --config webpack.config.js", "build": "export NODE_ENV=production&&webpack --config webpack.config.prod.js", @@ -77,6 +77,7 @@ "co-busboy": "^1.4.1", "cross-env": "^7.0.3", "echarts": "^5.3.2", + "echarts-for-react": "^3.0.2", "fs-web-server-scaffold": "^1.0.6", "koa-better-http-proxy": "^0.2.5", "koa-convert": "^2.0.0", @@ -94,4 +95,4 @@ "webpack-dev-server": "^3.11.2", "xlsx": "^0.16.9" } -} +} \ No newline at end of file diff --git a/web/routes/attachment/index.js b/web/routes/attachment/index.js index f539d50f..e1c2d916 100644 --- a/web/routes/attachment/index.js +++ b/web/routes/attachment/index.js @@ -19,9 +19,9 @@ module.exports = { entry: function (app, router, opts) { const getApiRoot = async function (ctx) { try { - const { apiUrl, qndmn } = opts; + const { apiUrl, qndmn, vcmpWebUrl, vcmpMirrorId } = opts; ctx.status = 200; - ctx.body = { root: apiUrl, qndmn }; + ctx.body = { root: apiUrl, qndmn, vcmpWebUrl, vcmpMirrorId }; } catch (error) { console.error('getApiRoot', error) }