From ba0e114983c42fa65ad98b3931a9a292f1c66faf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?zhaobing=E2=80=99?= Date: Fri, 29 Dec 2023 08:45:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=B7=A1=E6=A3=801.7=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../advisoryNotice/advisoryNotice.js | 145 ++++++++++++ api/app/lib/controllers/device/network.js | 118 ++++++++++ api/app/lib/index.js | 6 +- api/app/lib/models/advisory_notice.js | 60 +++++ api/app/lib/models/network.js | 66 ++++++ .../routes/advisoryNotice/advisoryNotice.js | 19 ++ api/app/lib/routes/device/network.js | 20 ++ .../1.7/schema/1.create_advisory_notice.sql | 18 ++ script/1.7/schema/2.create_network.sql | 26 +++ weapp/app.json | 8 +- weapp/images/importantNews.png | Bin 0 -> 3589 bytes weapp/package/AIOTOverview/AIOTOverview.js | 27 ++- weapp/package/AIOTOverview/AIOTOverview.wxml | 25 ++ weapp/package/AIOTOverview/network/network.js | 139 ++++++++++++ .../package/AIOTOverview/network/network.json | 8 + .../package/AIOTOverview/network/network.wxml | 44 ++++ .../package/AIOTOverview/network/network.wxss | 69 ++++++ .../package/advisoryNotice/advisoryNotice.js | 108 +++++++++ .../advisoryNotice/advisoryNotice.json | 6 + .../advisoryNotice/advisoryNotice.wxml | 14 ++ .../advisoryNotice/advisoryNotice.wxss | 41 ++++ weapp/package/advisoryNotice/detail/detail.js | 76 +++++++ .../package/advisoryNotice/detail/detail.json | 6 + .../package/advisoryNotice/detail/detail.wxml | 11 + .../package/advisoryNotice/detail/detail.wxss | 16 ++ .../inspectionRecordDetail.js | 6 + .../riskCalendar/riskCalendar.js | 45 +++- .../riskCalendar/riskCalendar.json | 5 +- .../riskCalendar/riskCalendar.wxml | 17 +- .../riskCalendar/riskCalendar.wxss | 5 + weapp/package/troubleshooting/index.js | 72 +++++- weapp/package/troubleshooting/index.wxml | 6 +- weapp/pages/home/home.js | 14 +- weapp/pages/home/home.wxml | 10 + weapp/pages/home/home.wxss | 11 +- weapp/pages/myInfo/myInfo.js | 7 +- weapp/pages/myInfo/myInfo.wxml | 6 +- weapp/pages/workbench/workbench.js | 7 +- weapp/pages/workbench/workbench.wxml | 4 +- weapp/utils/getApiUrl.js | 10 + web/client/src/app.js | 3 +- .../advisoryNotice/actions/advisoryNotice.js | 60 +++++ .../sections/advisoryNotice/actions/index.js | 6 + .../components/addAdvisoryNoticeModal.js | 108 +++++++++ .../containers/advisoryNotice.js | 208 +++++++++++++++++ .../advisoryNotice/containers/index.js | 5 + .../advisoryNotice/containers/style.less | 0 .../src/sections/advisoryNotice/index.js | 15 ++ .../src/sections/advisoryNotice/nav-item.js | 14 ++ .../sections/advisoryNotice/reducers/index.js | 5 + .../src/sections/advisoryNotice/routes.js | 12 + .../sections/deviceManage/actions/index.js | 3 +- .../sections/deviceManage/actions/network.js | 50 ++++ .../components/addNetworkModal.js | 103 +++++++++ .../sections/deviceManage/containers/index.js | 4 +- .../deviceManage/containers/network.js | 213 ++++++++++++++++++ .../src/sections/deviceManage/nav-item.js | 17 +- .../src/sections/deviceManage/routes.js | 19 +- web/client/src/utils/webapi.js | 12 +- 59 files changed, 2101 insertions(+), 57 deletions(-) create mode 100644 api/app/lib/controllers/advisoryNotice/advisoryNotice.js create mode 100644 api/app/lib/controllers/device/network.js create mode 100644 api/app/lib/models/advisory_notice.js create mode 100644 api/app/lib/models/network.js create mode 100644 api/app/lib/routes/advisoryNotice/advisoryNotice.js create mode 100644 api/app/lib/routes/device/network.js create mode 100644 script/1.7/schema/1.create_advisory_notice.sql create mode 100644 script/1.7/schema/2.create_network.sql create mode 100644 weapp/images/importantNews.png create mode 100644 weapp/package/AIOTOverview/network/network.js create mode 100644 weapp/package/AIOTOverview/network/network.json create mode 100644 weapp/package/AIOTOverview/network/network.wxml create mode 100644 weapp/package/AIOTOverview/network/network.wxss create mode 100644 weapp/package/advisoryNotice/advisoryNotice.js create mode 100644 weapp/package/advisoryNotice/advisoryNotice.json create mode 100644 weapp/package/advisoryNotice/advisoryNotice.wxml create mode 100644 weapp/package/advisoryNotice/advisoryNotice.wxss create mode 100644 weapp/package/advisoryNotice/detail/detail.js create mode 100644 weapp/package/advisoryNotice/detail/detail.json create mode 100644 weapp/package/advisoryNotice/detail/detail.wxml create mode 100644 weapp/package/advisoryNotice/detail/detail.wxss create mode 100644 web/client/src/sections/advisoryNotice/actions/advisoryNotice.js create mode 100644 web/client/src/sections/advisoryNotice/actions/index.js create mode 100644 web/client/src/sections/advisoryNotice/components/addAdvisoryNoticeModal.js create mode 100644 web/client/src/sections/advisoryNotice/containers/advisoryNotice.js create mode 100644 web/client/src/sections/advisoryNotice/containers/index.js create mode 100644 web/client/src/sections/advisoryNotice/containers/style.less create mode 100644 web/client/src/sections/advisoryNotice/index.js create mode 100644 web/client/src/sections/advisoryNotice/nav-item.js create mode 100644 web/client/src/sections/advisoryNotice/reducers/index.js create mode 100644 web/client/src/sections/advisoryNotice/routes.js create mode 100644 web/client/src/sections/deviceManage/actions/network.js create mode 100644 web/client/src/sections/deviceManage/components/addNetworkModal.js create mode 100644 web/client/src/sections/deviceManage/containers/network.js diff --git a/api/app/lib/controllers/advisoryNotice/advisoryNotice.js b/api/app/lib/controllers/advisoryNotice/advisoryNotice.js new file mode 100644 index 0000000..f6c5ccb --- /dev/null +++ b/api/app/lib/controllers/advisoryNotice/advisoryNotice.js @@ -0,0 +1,145 @@ +'use strict'; +const moment = require('moment') + + + +async function getAdvisoryNotices (ctx) { + try{ + const models = ctx.fs.dc.models + const { limit, page, name,home } = ctx.query + let options + if(home==='true'){ + options = { + where: {state:2}, + order: [['publish_time', 'desc']], + limit: 1, + } + }else if(home==='false'){ + options = { + where: {state:2}, + order: [['id', 'asc']], + } + }else{ + options = { + where: {}, + order: [['id', 'asc']], + } + } + + if (name) { + options.where.name = { $like: `%${name}%` }; + } + if (limit) { + options.limit = Number(limit); + } + if (page && limit) { + options.offset = Number(page) * Number(limit); + } + const advisoryNoticeList = await models.AdvisoryNotice.findAndCountAll(options) + ctx.status = 200; + ctx.body = advisoryNoticeList + }catch(error){ + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { + "message": "获取资讯公告失败" + } + } + } + + async function addOrUpdateAdvisoryNotice(ctx){ + const { id, title,content,attachments } = ctx.request.body + try{ + if(id){ + // 更新 + await ctx.fs.dc.models.AdvisoryNotice.update({ + title, + content, + attachments, + }, { + where: { + id + } + }) + ctx.status = 200; + ctx.body = { + message: '更新资讯公告成功' + } + }else{ + //新增 + await ctx.fs.dc.models.AdvisoryNotice.create({ + title, + content, + attachments, + state:1 + }) + ctx.status = 200; + ctx.body = { + message: '新增资讯公告成功' + } + + } + + }catch(error){ + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { + "message": id?'编辑资讯公告失败':'新增资讯公告失败' + } + + } + } + + + async function delAdvisoryNotice(ctx){ + try{ + const { id } = ctx.params + await ctx.fs.dc.models.AdvisoryNotice.destroy({ + where: { + id + } + }) + ctx.status = 200; + ctx.body = { + message: '删除资讯公告成功' + } + + }catch(error){ + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { + "message": "删除资讯公告失败" + } + + } + } +//上架下架 + async function updateAdvisoryNoticeState(ctx){ + const { id } = ctx.params + const { msg ,publishTime} = ctx.request.body + try{ + await ctx.fs.dc.models.AdvisoryNotice.update({ + state:msg==='发布'?2:3, + publishTime:msg==='发布'?moment().format('YYYY-MM-DD HH:mm:ss'):publishTime, + },{where:{id}}) + + ctx.status = 204 + + }catch(error){ + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { + "message": `${msg}公告失败` + } + } + } + + +module.exports = { + getAdvisoryNotices, + addOrUpdateAdvisoryNotice, + delAdvisoryNotice, + updateAdvisoryNoticeState + + } + \ No newline at end of file diff --git a/api/app/lib/controllers/device/network.js b/api/app/lib/controllers/device/network.js new file mode 100644 index 0000000..23e7b31 --- /dev/null +++ b/api/app/lib/controllers/device/network.js @@ -0,0 +1,118 @@ +'use strict'; +const moment = require('moment') + + + +async function getNetworks (ctx) { + try{ + const models = ctx.fs.dc.models + const { limit, page, name } = ctx.query + let options = { + where: {}, + order: [['id', 'asc']], + include:[{ + model: models.Project, + attributes: ['id', 'name','type'], + }] + } + + if (name) { + options.where.name = { $like: `%${name}%` }; + } + if (limit) { + options.limit = Number(limit); + } + if (page && limit) { + options.offset = Number(page) * Number(limit); + } + const Networks = await models.Network.findAndCountAll(options) + ctx.status = 200; + ctx.body = Networks + }catch(error){ + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { + "message": "获取宽带专网失败" + } + } + } + + async function addOrUpdateNetwork(ctx){ + const { id,name,type,account,indate,projectId } = ctx.request.body + try{ + if(id){ + // 更新 + await ctx.fs.dc.models.Network.update({ + name, + type, + account, + indate, + projectId + }, { + where: { + id + } + }) + ctx.status = 200; + ctx.body = { + message: '更新宽带专网成功' + } + }else{ + //新增 + await ctx.fs.dc.models.Network.create({ + name, + type, + account, + indate, + projectId + }) + ctx.status = 200; + ctx.body = { + message: '新增宽带专网成功' + } + + } + + }catch(error){ + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { + "message": id?'编辑宽带专网失败':'新增宽带专网失败' + } + + } + } + + + async function delNetwork(ctx){ + try{ + const { id } = ctx.params + await ctx.fs.dc.models.Network.destroy({ + where: { + id + } + }) + ctx.status = 200; + ctx.body = { + message: '删除宽带专网成功' + } + + }catch(error){ + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { + "message": "删除宽带专网失败" + } + + } + } + + + +module.exports = { + getNetworks, + addOrUpdateNetwork, + delNetwork, + + } + \ No newline at end of file diff --git a/api/app/lib/index.js b/api/app/lib/index.js index 767760a..6bbfadd 100644 --- a/api/app/lib/index.js +++ b/api/app/lib/index.js @@ -57,7 +57,7 @@ module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Seq PatrolPlan, PatrolRecord, ReportInfo, PatrolPlanUser, CheckItems, CheckItemsGroup, PatrolTemplate, PatrolTemplateCheckItems, PatrolRecordIssueHandle, - Device, PointDevice + Device, PointDevice,Network } = dc.models; PatrolRecord.belongsTo(PatrolPlan, { foreignKey: 'patrolPlanId', targetKey: 'id' }); @@ -115,6 +115,6 @@ module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Seq Device.belongsToMany(Point,{ through: PointDevice, foreignKey: 'deviceId', otherKey: 'pointId' }) Point.belongsToMany(Device,{ through: PointDevice, foreignKey: 'pointId', otherKey: 'deviceId' }) - - + Network.belongsTo(Project,{ foreignKey: 'projectId', otherKey: 'id' }) + Project.hasMany(Network,{ foreignKey: 'projectId', sourceKey: 'id' }) }; diff --git a/api/app/lib/models/advisory_notice.js b/api/app/lib/models/advisory_notice.js new file mode 100644 index 0000000..b4c93e5 --- /dev/null +++ b/api/app/lib/models/advisory_notice.js @@ -0,0 +1,60 @@ +/* eslint-disable*/ +'use strict'; + +module.exports = dc => { + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const AdvisoryNotice = sequelize.define("AdvisoryNotice", { + id: { + field: "id", + type: DataTypes.INTEGER, + allowNull: false, + primaryKey: true, + autoIncrement: true, + }, + title: { + field: "title", + type: DataTypes.STRING, + allowNull: false, + primaryKey: false, + autoIncrement: false + }, + publishTime: { + field: "publish_time", + type: DataTypes.DATE, + allowNull: true, + primaryKey: false, + autoIncrement: false, + timezone: false, // 设置为 false 表示不带时区信息的时间戳 + }, + state: { + field: "state", + type: DataTypes.INTEGER, + allowNull: false, + primaryKey: false, + autoIncrement: false + }, + content: { + field: "content", + type: DataTypes.TEXT, + allowNull: false, + primaryKey: false, + autoIncrement: false + }, + attachments: { + type: DataTypes.ARRAY(DataTypes.STRING), + allowNull: false, + comment: null, + primaryKey: false, + field: "attachments", + autoIncrement: false + }, + }, { + tableName: "advisory_notice", + comment: "", + indexes: [] + }); + + dc.models.AdvisoryNotice = AdvisoryNotice; + return AdvisoryNotice; +}; \ No newline at end of file diff --git a/api/app/lib/models/network.js b/api/app/lib/models/network.js new file mode 100644 index 0000000..3cb8bec --- /dev/null +++ b/api/app/lib/models/network.js @@ -0,0 +1,66 @@ +/* eslint-disable*/ +'use strict' + +module.exports = dc => { + const DataTypes = dc.ORM + const sequelize = dc.orm + const Network = sequelize.define( + 'Network', + { + id: { + field: 'id', + type: DataTypes.INTEGER, + allowNull: false, + primaryKey: true, + autoIncrement: true, + unique: 'network_pk', + }, + name: { + field: 'name', + type: DataTypes.STRING, + allowNull: false, + primaryKey: false, + autoIncrement: false, + }, + type: { + field: 'type', + type: DataTypes.INTEGER, + allowNull: false, + primaryKey: false, + autoIncrement: false, + // timezone: false, // 设置为 false 表示不带时区信息的时间戳 + }, + account: { + field: 'account', + type: DataTypes.STRING, + allowNull: false, + primaryKey: false, + autoIncrement: false, + }, + indate: { + field: 'indate', + type: DataTypes.DATE, + allowNull: false, + primaryKey: false, + autoIncrement: false, + timezone: false, // 设置为 false 表示不带时区信息的时间戳 + }, + projectId: { + type: DataTypes.INTEGER, + allowNull: false, + comment: null, + primaryKey: false, + field: 'project_id', + autoIncrement: false, + }, + }, + { + tableName: 'network', + comment: '', + indexes: [], + } + ) + + dc.models.Network = Network + return Network +} diff --git a/api/app/lib/routes/advisoryNotice/advisoryNotice.js b/api/app/lib/routes/advisoryNotice/advisoryNotice.js new file mode 100644 index 0000000..457eb20 --- /dev/null +++ b/api/app/lib/routes/advisoryNotice/advisoryNotice.js @@ -0,0 +1,19 @@ +'use strict'; + +const advisoryNotice = require('../../controllers/advisoryNotice/advisoryNotice'); + +module.exports = function (app, router, opts) { + + app.fs.api.logAttr['GET/advisoryNotices/list'] = { content: '获取资讯公告', visible: true }; + router.get('/advisoryNotices/list', advisoryNotice.getAdvisoryNotices); + + app.fs.api.logAttr['POST/advisoryNotices/addOrUpdate'] = { content: '新增或编辑资讯公告', visible: true }; + router.post('/advisoryNotices/addOrUpdate', advisoryNotice.addOrUpdateAdvisoryNotice); + + app.fs.api.logAttr['DEL/advisoryNotices/:id'] = { content: '删除资讯公告', visible: true }; + router.delete('/advisoryNotices/:id', advisoryNotice.delAdvisoryNotice); + + app.fs.api.logAttr['POST/updateAdvisoryNotices/:id'] = { content: '上架或者下架公告', visible: true }; + router.post('/updateAdvisoryNotices/:id', advisoryNotice.updateAdvisoryNoticeState); + +}; \ No newline at end of file diff --git a/api/app/lib/routes/device/network.js b/api/app/lib/routes/device/network.js new file mode 100644 index 0000000..11737e4 --- /dev/null +++ b/api/app/lib/routes/device/network.js @@ -0,0 +1,20 @@ +'use strict'; + +const network = require('../../controllers/device/network'); + +module.exports = function (app, router, opts, AuthCode) { + + app.fs.api.logAttr['POST/network'] = { content: '增加或修改宽带专网', visible: true }; + router.post('/network', network.addOrUpdateNetwork) + + // 删除设备信息 + app.fs.api.logAttr['DEL/network/:id'] = { content: '删除宽带专网', visible: true }; + router.del('/network/:id', network.delNetwork) + + // 获取设备信息列表 + app.fs.api.logAttr['GET/network'] = { content: '获取宽带专网列表', visible: true }; + router.get('/network', network.getNetworks); + + + +}; \ No newline at end of file diff --git a/script/1.7/schema/1.create_advisory_notice.sql b/script/1.7/schema/1.create_advisory_notice.sql new file mode 100644 index 0000000..4f3ebc7 --- /dev/null +++ b/script/1.7/schema/1.create_advisory_notice.sql @@ -0,0 +1,18 @@ +create table advisory_notice +( + id serial + constraint advisory_notice_pk + primary key, + title varchar(300) not null, + publish_time timestamp without TIME ZONE, + state integer not null, + content text not null, + attachments text[] + +); + +comment on column advisory_notice.title is '公告标题'; + +comment on column advisory_notice.publish_time is '发布时间'; + +comment on column advisory_notice.state is '/*1.草稿,2.已发布,3.已下架*/'; \ No newline at end of file diff --git a/script/1.7/schema/2.create_network.sql b/script/1.7/schema/2.create_network.sql new file mode 100644 index 0000000..510da6c --- /dev/null +++ b/script/1.7/schema/2.create_network.sql @@ -0,0 +1,26 @@ +create table network +( + id serial + constraint network_pk + primary key, + name varchar(300) not null, + type integer not null, + account varchar(300) not null, + indate timestamp without time zone not null, + project_id integer not null + constraint project_id + references public.project +); + +comment on table network is '宽带专网'; + +comment on column network.name is '专网名称'; + +comment on column network.type is '专网类型/*1.专网,2.内网*/'; + +comment on column network.account is '账号'; + +comment on column network.indate is '有效期'; + +comment on column network.project_id is '关联的结构物'; + diff --git a/weapp/app.json b/weapp/app.json index 1006061..158fd4a 100644 --- a/weapp/app.json +++ b/weapp/app.json @@ -33,7 +33,10 @@ "groundDisasterInspection/groundDisasterInspection", "AIOTOverview/AIOTOverview", "AIOTOverview/flowMonitoring/flowMonitoring", - "AIOTOverview/electricityMonitoring/electricityMonitoring" + "AIOTOverview/electricityMonitoring/electricityMonitoring", + "advisoryNotice/advisoryNotice", + "advisoryNotice/detail/detail", + "AIOTOverview/network/network" ] } ], @@ -87,7 +90,8 @@ } }, "requiredPrivateInfos": [ - "getLocation","chooseLocation" + "getLocation", + "chooseLocation" ], "sitemapLocation": "sitemap.json", "usingComponents": {} diff --git a/weapp/images/importantNews.png b/weapp/images/importantNews.png new file mode 100644 index 0000000000000000000000000000000000000000..9f6f850dc549274465c4bc444b198d8b4597345c GIT binary patch literal 3589 zcmaJ^XEfY#v;OaD8(nmwMGF#j^%cE$qK8BfWtBu-L=6@jEl5K2L`0&uC?TSEf+eh; zCCFlxh+QRDzTErazUMv9dFGj!-<Rl?r4Io>NKb(DU&$poE(ri6MIeCWQbGT6Md1H^ zH7g?dKmT8$)QXYm<)?o7TIzQYpq)IbN6cvU{=+rF1e@4wgA8igrW+RN@~h<~5Unyj zb$$rb&3xJ$+RC?5X`eO(F)8glLrb$zX}|@i40O3;LC+HakUg0>67Nw?36Y}bg^_IS zeZjTtF5*TP+xYa{k4N(I0y<_DPgR#gcb5bN7KnP-iN1oipruX=Yqgv`FVGgUcN^7bR6bg>`VFsx#k_wu#wy^RmBu>ZP#bZ2 z>}k^C+?^mRDke7EXTqqdEB;c!dVP9&nqu%C6qc!RDkH_!j_$Fc&Od^#Pdu|` z&j@;tyStuEYyYvL#>U+Fog#YYS_TFKAB*HCYx%f(VBgc zrd-0bv2Dd=cRTVv^MSnPy=vTge%Ti0o_kB}n5kbs2HdADYGt4JM218sicobT0TDk; zlh3K+@jM4U{o6IAv{idS_U%Gyzt{sjIeY7nP|ZrEz;a%5UW;$R(+dT{zNpJj2LT%j zHLC%b!n1@eXNx<>jEIT6dF%@6985K?rFIu9h#HaJ=+o%dw8n6WL4D>Mnv04$!7~$C z*Dc*Jw?DfLv%u9ExyF4-9uI; zmajG030Ua+wUy)}v_>q!G&3Sy+dJ>h?u`2^DSP1NKJm?S1hmve?BCSTQ?8|i`~DWAYG z>K8W&9NZ6jR^?+0b%=_Z&6UMsZmVI`(UCgG)(=*KhhNCNH|}8%#O>t=ej&6XiqP?} zN21xXDOP-E5Y&?&dSCfnT=n5V4~h8hZ1wW;tB_L?S3?$*sigU?vyk|e2%mUgT|Btp zQ$c9`%_1=%p<)$Z z80&T*j@(m3cosP$<>`tGN;UC-xnsZ)l$?5%>)vK z^u9eJ`R zT8a0w152qoDHU`%og^yX?Z7|8n0c(I1#L&0D<5psFW@RH8J&04$@PW@h+Qj1>Ze-g z#FHtsFB*QeSt~qCfqQN zcFgR;9p)&}@eB>0kW1*x@i8jGu(^}e{$V&)N+L&uVt-05gebZ_Sf5i|NFJ--#Lg4N z*qZoV22YDA!08ErrF^;LXQVrex%%|^nF3C;#$GUs_d~- z{OunUXdd%@5|;62z)oP6^XtB!e#>P}Pl ztEsGhz5XIyIZrjpsoX|^%zSM1?gA+u8u-q6Px2UwOH-dZ{zXc->N7Ja%mfDMxiR7^ za;~7`B$evVw$1t-22!(Obm6Ll2n*&nW3?=NBIVSCTUe@=Dk8;UQRCO!A-i|w6I#c{ z&Xdk3J}G4$=?uwpgk#+-xx#~hweUvD_OYwFBuzWMPF zE^TdXF9l`I~Ixhi`d+uJI(U`(x|j+;BBp? zXV2nTt_Tn5`>m3>d*)oonO8q18P+(;Dr~sz7H|Ga|NAwOf&ay5fr^8h*rStK^NPN? z*DiNIrf|w{+m=yL9GVd7EY7~Pek=GIu~KqUQY#2{6v9g`Ccepg=xJ0ga>$JSGw4t) znUTqwDg#s98p;;qQ5Ww|^X783pQxIBoDi|l#YEP~2vO?{OB*t66;=5lO*2V_U;YmJ zUAMGMq}iznXM7x&AVBvph|Jq*IT|Wy5vtSqgBEuh9z*f<@O}cFn%)I zx+`Y&jPmyxq?httHj6LGG1HsZ`9cjYT)(x9b$to*LorV4z0wfG%tu|0Mx+?wnlNIr z_-jB?+Wda>lu2-Ku;FK%)obgo;M%dlFV6|+k2ZzfOS*OX4hz+Wj2}cN=u@poI(HIg z)3_J0FTS4Y0A@UzWvhnxEEVeRwi7u5^~=IJ{8C>+N2$1fq;Ij+t1(YuN5m;XYe#ix zR?zH=U5v!?Bsnx#8${ZC-k>QZ`W=%le@)A=#r=Rj2RM`_@D!cWmOn`8WYPI}VI;K~ z=e0!1a_H;Av?rH3P2VvTC#DqFK0gN6bNpBh0Kd-3xQ}U_$`t#<+OP0t;(KPBZ_Nnv zM#gUJcsmKH;B=ci+_uR&FE?>n9q&<}B@4+?aOae;CuMjJMo5a(5I8_)jiVq@($P4w zfqP!XtL`+jDBoCXXY3vy`dH`iWncow#cU3_eSD++nxZe=`v+_$paxZZO$)53kuDH+ z7bFqxAG#GWF#&v}@+V$5EX>sg6LSkU?)#aqxc)K#+~dy`h4@Pffs4Gp%hiS`_UYE zet>YR9ppnQ{5B~#y|{Gm!2$aa-9&vF9#7m5$Z@WHnf0LY!j_KC*l7zrYz|F$*YO9V z{)F|^)NUy0JoL(7eJP&!C7(6!0fy+OemJ0b%+0smS`9gh$8g7U+`Y7mzp!EsD>q_zKoV zY0-czc)!Mdzk7x7vV;jC8>c0w!X40x7A z$X}|Gmh*wtuEuoc&z4#-)SP$o4di%j^cH?%(UwbIGC`%Yy^$-5=`G%T%wqPSiOG}E zUO17K4DE(9N-8CM)XZL$=YfJI8nlQ}oML-7px}q`_16A(XZfOKVzS*daD>5w;FCZk zO*J7Vn(rBe9ijpjD`1+nvgOC{WcTk9zR~YS5BZL0HBMjMN*vlX69PXeXhR+c_V0+* z`hU8gcOZRYnMe$s^K#-J;r|m e0-P%5FUbE#Oy263V%dKun7+1&R+Yy6*#7|uEv35v literal 0 HcmV?d00001 diff --git a/weapp/package/AIOTOverview/AIOTOverview.js b/weapp/package/AIOTOverview/AIOTOverview.js index a231e6b..8f44190 100644 --- a/weapp/package/AIOTOverview/AIOTOverview.js +++ b/weapp/package/AIOTOverview/AIOTOverview.js @@ -1,5 +1,5 @@ // package/AIOTOverview/AIOTOverview.js -import { getThingsDeploy, getThingsStatus, getCardInfo,getRelationList} from "../../utils/getApiUrl"; +import { getThingsDeploy, getThingsStatus, getCardInfo,getRelationList,getNetworks} from "../../utils/getApiUrl"; import { Request } from "../../common"; const moment = require("../../utils/moment"); @@ -9,6 +9,7 @@ Page({ * 页面的初始数据 */ data: { + count:{abnormal:0,normal:0},//宽带专网正常与欠费 data: [],//用电设备数据 normal: 0,//正常 abnormal: 0,//异常 @@ -32,6 +33,12 @@ Page({ url: `/package/AIOTOverview/electricityMonitoring/electricityMonitoring?data2=${encodeURIComponent(jsonData2)}` }) }, + //跳转宽带专网 + navigatorToNet() { + wx.navigateTo({ + url: `/package/AIOTOverview/network/network` + }) + }, /** * 生命周期函数--监听页面加载 */ @@ -106,7 +113,23 @@ Page({ abnormal: data?.filter(item => item.status == 0)?.length }) } - + Request.get(getNetworks()).then(res=>{ + if(res.rows.length){ + let normal=0 + let abnormal=0 + res.rows.forEach(q => { + if (moment(q.indate).isBefore(moment())) { + abnormal += 1; + } else { + normal += 1; + } + }); + that.setData({ + count:{normal,abnormal} + }) + } + + }) wx.hideLoading() }, diff --git a/weapp/package/AIOTOverview/AIOTOverview.wxml b/weapp/package/AIOTOverview/AIOTOverview.wxml index aaeb148..2c2442f 100644 --- a/weapp/package/AIOTOverview/AIOTOverview.wxml +++ b/weapp/package/AIOTOverview/AIOTOverview.wxml @@ -58,5 +58,30 @@ {{iotCardHalt+'个'}} + + + + + + 宽带专网总览 + + + 查看详情 + + + + + 专网条数 + {{(count.normal+count.abnormal)+'个'}} + + + 正常 + {{count.normal+'个'}} + + + 欠费 + {{count.abnormal+'个'}} + + \ No newline at end of file diff --git a/weapp/package/AIOTOverview/network/network.js b/weapp/package/AIOTOverview/network/network.js new file mode 100644 index 0000000..10ce83e --- /dev/null +++ b/weapp/package/AIOTOverview/network/network.js @@ -0,0 +1,139 @@ +// package/AIOTOverview/network/network.js +import { getNetworks,getProjectList} from "../../../utils/getApiUrl"; +import { Request } from "../../../common"; +import moment from "../../../utils/moment"; +Page({ + networkDataCopy:[], + /** + * 页面的初始数据 + */ + data: { + limit: 10, //条数 + page: 0, //当前页 + count: 0, //总条数 + networkData:[], + structList:[], + // networkDataCopy:[], + curStruId: 'all', // 选中结构物id + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.queryData() + this.obtainStruc() + }, + obtainStruc(){ + let promiseArr=[] + promiseArr.push(Request.get(getProjectList())) + if(res[0].rows.length){ + const filterData=res[0].rows.filter(s => s.type==='管廊' ) + sdatas=filterData?.map(item=>( { value: item.id, text:item.name })) + sdatas.unshift({ text: '全部', value: 'all' }) + } + this.setData({ + structList:sdatas + }) + }, +queryData(){ + const {limit,page}=this.data + let promiseArr=[] + promiseArr.push(Request.get(getNetworks(),{limit,page})) + Promise.all(promiseArr).then(res=>{ + let datas=[]//宽带的数据 + let sdatas=[]//结构物 + if(res[0].rows.length){ + datas=res[0].rows.filter(s => s.project.type==='管廊')?.map(q=>({ + ...q, + indate:moment(q.indate).format('YYYY-MM-DD'), + status:moment(q.indate).isBefore(moment())?1:0 + })) + } + + this.networkDataCopy=datas + this.setData({ + networkData:datas, + }) + + + + }) +}, +onStruChange(e){ + if (e.detail) { + let data = [] + if (e.detail === 'all') { + data = this.networkDataCopy + } else { + data = this.networkDataCopy.filter(item => item.projectId === e.detail) + } + this.setData({ + curStruId: e.detail, + networkData: data + }) + } +}, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + let _that=this + let page = _that.data.page + 1; //获取当前页数并+1 + let { networkData, count } = _that.data; + if (networkData.length == count) { + wx.showToast({ + title: '没有更多数据了...', + icon: 'none', + }) + return; + } + _that.setData({ + page: page, //更新当前页数 + }) + _that.queryData() + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/weapp/package/AIOTOverview/network/network.json b/weapp/package/AIOTOverview/network/network.json new file mode 100644 index 0000000..6f12d5c --- /dev/null +++ b/weapp/package/AIOTOverview/network/network.json @@ -0,0 +1,8 @@ +{ +"navigationBarTitleText": "专网监控", + "usingComponents": { + "van-dropdown-menu": "@vant/weapp/dropdown-menu/index", + "van-dropdown-item": "@vant/weapp/dropdown-item/index", + "van-empty": "@vant/weapp/empty/index" + } +} \ No newline at end of file diff --git a/weapp/package/AIOTOverview/network/network.wxml b/weapp/package/AIOTOverview/network/network.wxml new file mode 100644 index 0000000..000a3d5 --- /dev/null +++ b/weapp/package/AIOTOverview/network/network.wxml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + {{item.project.name}} + + + + + + + 账号:{{item.account}} + 专网类型:专网 + 专网类型:内网 + + + + 专网名称:{{item.name}} + 卡状态:正常 + 卡状态:异常 + + + 有效期:{{item.indate}} + + + + + + + + + \ No newline at end of file diff --git a/weapp/package/AIOTOverview/network/network.wxss b/weapp/package/AIOTOverview/network/network.wxss new file mode 100644 index 0000000..d8e5380 --- /dev/null +++ b/weapp/package/AIOTOverview/network/network.wxss @@ -0,0 +1,69 @@ +/* package/AIOTOverview/network/network.wxss */ + +.select { + width: 50%; +} + +.select .van-dropdown-menu { + box-shadow: none +} + +/* package/AIOTOverview/AIOTOverview.wxss */ + + +.card { + position: relative; + background-color: #fff; + border: 1px solid #ddd; + border-radius: 8px; + /* padding: 10px; */ + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); + margin: 12px 12px; +} + +.top { + display: flex; + justify-content: space-between; + padding: 10px; + + /* background-position: bottom; */ +} + +.card-content { + padding: 0 10px; +} + +.card-left { + margin-left: 23px; + margin-bottom: 10px; + font-weight: 500; + font-size: 16px; + color: #000000d9; +} + +.detail { + margin: 10px 0 +} + +.card-right { + margin-right: 18px; + margin-bottom: 10px; + color: #1684FF; +} + +.fontStyle { + font-family: PingFangSC-Medium; + font-weight: bold; +} + +.content-left { + font-size: 12px; + width: 60%; + } + + .content-right { + font-size: 12px; + text-align: left; + width: 40%; + + } \ No newline at end of file diff --git a/weapp/package/advisoryNotice/advisoryNotice.js b/weapp/package/advisoryNotice/advisoryNotice.js new file mode 100644 index 0000000..33f5456 --- /dev/null +++ b/weapp/package/advisoryNotice/advisoryNotice.js @@ -0,0 +1,108 @@ +// package/advisoryNotice/advisoryNotice.js +import { getAdvisoryNotices } from "../../utils/getApiUrl"; +import { Request } from "../../common"; +const moment = require("../../utils/moment"); +Page({ + + /** + * 页面的初始数据 + */ + data: { + limit: 10, //条数 + page: 0, //当前页 + count: '', //总条数 + dataList:[],//公告列表 + }, + navToDetail:function(e){ + const { item } = e.currentTarget.dataset + const res = JSON.stringify(item) + wx.navigateTo({ + url: `/package/advisoryNotice/detail/detail?detailData=${encodeURIComponent(res)}`, + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + const {windowHeight}=wx.getSystemInfoSync() + const pageHeight=windowHeight - 48 + this.getAdvisoryNotices() + }, + getAdvisoryNotices: function () { + const {limit,page}=this.data + wx.showLoading({ + title: '加载中' + }) + Request.get(getAdvisoryNotices({home:false}),{limit, page}).then(res=>{ + if(res.rows.length){ + this.setData({ + dataList:res.rows, + count:res.count + },()=>{ + wx.hideLoading() + }) + } + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + let _that = this; + let page = _that.data.page + 1; //获取当前页数并+1 + let { dataList, count } = _that.data; + if (dataList.length == count) { + wx.showToast({ + title: '没有更多数据了...', + icon: 'none', + }) + return; + } + _that.setData({ + page: page, //更新当前页数 + }) + _that.getAdvisoryNotices() + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/weapp/package/advisoryNotice/advisoryNotice.json b/weapp/package/advisoryNotice/advisoryNotice.json new file mode 100644 index 0000000..8a9a4bb --- /dev/null +++ b/weapp/package/advisoryNotice/advisoryNotice.json @@ -0,0 +1,6 @@ +{ + "navigationBarBackgroundColor": "#1979ff", + "navigationBarTextStyle": "white", + "navigationBarTitleText": "资讯公告", + "enablePullDownRefresh": false + } \ No newline at end of file diff --git a/weapp/package/advisoryNotice/advisoryNotice.wxml b/weapp/package/advisoryNotice/advisoryNotice.wxml new file mode 100644 index 0000000..96480a9 --- /dev/null +++ b/weapp/package/advisoryNotice/advisoryNotice.wxml @@ -0,0 +1,14 @@ + + + + + {{item.title}} + + + + + + + + 暂无数据 + \ No newline at end of file diff --git a/weapp/package/advisoryNotice/advisoryNotice.wxss b/weapp/package/advisoryNotice/advisoryNotice.wxss new file mode 100644 index 0000000..19d4300 --- /dev/null +++ b/weapp/package/advisoryNotice/advisoryNotice.wxss @@ -0,0 +1,41 @@ +/* package/advisoryNotice/advisoryNotice.wxss */ + + +.right { + width: 32rpx; + height: 32rpx; + display: block; + float: right; + margin: 38rpx 40rpx; +} + + +.body-item { + height: 110rpx; + flex-direction: row; + display: flex; + justify-content: space-between; + align-items: center; + padding: 0 30rpx; + border-bottom: 1px solid #EFEFF4; +} + +.body-info { + font-size: 32rpx; + font-family: "PingFang SC"; + font-weight: 600; +} + +.noData { + width: 254rpx; + height: 298rpx; + display: block; + margin: 0rpx auto 16rpx; +} + +.noTxt { + font-size: 30rpx; + color: #999; + font-weight: bold; + text-align: center; +} \ No newline at end of file diff --git a/weapp/package/advisoryNotice/detail/detail.js b/weapp/package/advisoryNotice/detail/detail.js new file mode 100644 index 0000000..9baf6cf --- /dev/null +++ b/weapp/package/advisoryNotice/detail/detail.js @@ -0,0 +1,76 @@ +// package/advisoryNotice/detail/detail.js +const moment = require("../../../utils/moment"); + +Page({ + + /** + * 页面的初始数据 + */ + data: { + detailData:{},//一條詳細記錄 + time:'',//发布时间 + imgList:[],//图片数组 + imgUrl: getApp().globalData.imgUrl, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + const data= JSON.parse(decodeURIComponent(options.detailData)) + this.setData({ + detailData:data, + imgList:data.attachments, + time:moment(data.publishTime).format('YYYY年MM月DD日'), + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/weapp/package/advisoryNotice/detail/detail.json b/weapp/package/advisoryNotice/detail/detail.json new file mode 100644 index 0000000..1828292 --- /dev/null +++ b/weapp/package/advisoryNotice/detail/detail.json @@ -0,0 +1,6 @@ +{ + "navigationBarBackgroundColor": "#1979ff", + "navigationBarTextStyle": "white", + "navigationBarTitleText": "资讯公告明细", + "enablePullDownRefresh": false + } \ No newline at end of file diff --git a/weapp/package/advisoryNotice/detail/detail.wxml b/weapp/package/advisoryNotice/detail/detail.wxml new file mode 100644 index 0000000..fe21df3 --- /dev/null +++ b/weapp/package/advisoryNotice/detail/detail.wxml @@ -0,0 +1,11 @@ + + + {{detailData.title}} + {{detailData.content}} + 发布时间:{{time}} + + + + + + diff --git a/weapp/package/advisoryNotice/detail/detail.wxss b/weapp/package/advisoryNotice/detail/detail.wxss new file mode 100644 index 0000000..8b4cbcc --- /dev/null +++ b/weapp/package/advisoryNotice/detail/detail.wxss @@ -0,0 +1,16 @@ +/* package/advisoryNotice/detail/detail.wxss */ + +.card { + background-color: #fff; + border: 1px solid #ddd; + border-radius: 8px; + padding: 20rpx; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); + margin: 20rpx; + position: relative; +} +/* .img { + width: 100px; + height: 100px; + margin-right: 10px; +} */ \ No newline at end of file diff --git a/weapp/package/polling/inspectionRecordDetail/inspectionRecordDetail.js b/weapp/package/polling/inspectionRecordDetail/inspectionRecordDetail.js index bf5d903..07b4387 100644 --- a/weapp/package/polling/inspectionRecordDetail/inspectionRecordDetail.js +++ b/weapp/package/polling/inspectionRecordDetail/inspectionRecordDetail.js @@ -47,6 +47,9 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad(options) { + wx.showLoading({ + title: '加载中' + }) const that = this; const data = JSON.parse(decodeURIComponent(options.data)) const priorToV1_1 = moment(data.inspectionTime).isBefore(moment('2023-10-18')) @@ -58,7 +61,10 @@ Page({ dataList: data, priorToV1_1, nextMultiActiveValues, + },()=>{ + wx.hideLoading() }) + }, /** diff --git a/weapp/package/riskManagement/riskCalendar/riskCalendar.js b/weapp/package/riskManagement/riskCalendar/riskCalendar.js index ffadbf8..7e4a471 100644 --- a/weapp/package/riskManagement/riskCalendar/riskCalendar.js +++ b/weapp/package/riskManagement/riskCalendar/riskCalendar.js @@ -11,23 +11,43 @@ Page({ show: false, level: ['全部', '轻微', '中度', '严重'], curLevel: '全部', - minDate: moment().startOf('day').subtract(6, 'days').valueOf(), - maxDate: moment().endOf('day').valueOf(), - curDate: moment().format('YYYY-MM-DD'), + minDate: moment().startOf('month').valueOf(), + maxDate: moment().endOf('month').valueOf(), + curDate: moment().format('YYYY-MM'), showList: [], formatter(day) { return day; }, + datePickerShow:false, + datePickerMin:1640966400000,//2022-01-01 00:00:00 + end:moment().endOf('month').valueOf() }, dayData: [], // 每天的异常数据 onDateSelect(e) { - this.setData({ curDate: moment(e.detail).format('YYYY-MM-DD') }) + this.setData({ curDate: moment(e.detail).format('YYYY-MM') }) this.calcShowList(this.data.curLevel, moment(e.detail).format('YYYY-MM-DD')) }, - + onDateChange(e){ + // this.queryData(e.detail,) + const begin=e.detail + const end =moment(e.detail).endOf('month').valueOf() + this.queryData(begin,end) + this.setData({curDate:moment(e.detail).format('YYYY-MM'), + end:end,minDate:begin + +}) + }, showPopup() { this.setData({ show: true }) }, + closeDatePickerPopup(){ + this.setData({datePickerShow:false}) + }, + datePickerPopup() { + this.setData({ + datePickerShow: true + }) +}, onCancel() { this.setData({ show: false }) }, @@ -63,9 +83,13 @@ Page({ */ onLoad(options) { const { minDate, maxDate } = this.data; + this.queryData(minDate,maxDate) + }, +queryData(minDate,maxDate){ Request.get(getPatrolRecord('all', moment(minDate).format('YYYY-MM-DD HH:mm:ss'), moment(maxDate).format('YYYY-MM-DD HH:mm:ss'), true, 'null',{home:false})).then(res => { - let dayData = new Array(7) - for (let i = 6; i >= 0; i--) { + const daysInMonth = moment(maxDate).daysInMonth(); + let dayData = new Array(daysInMonth) + for (let i = daysInMonth-1; i >= 0; i--) { const month = moment().subtract(i, 'day').month(); const date = moment().subtract(i, 'day').date(); let data = []; @@ -91,7 +115,7 @@ Page({ }) } }) - dayData[6 - i] = { month, date, formatDate: moment().subtract(i, 'day').format('YYYY-MM-DD'), data } + dayData[ daysInMonth- i-1] = { month, date, formatDate: moment().subtract(i, 'day').format('YYYY-MM-DD'), data } } const formatter = (day) => { const month = day.date.getMonth(); @@ -103,12 +127,11 @@ Page({ }) return day; } - this.setData({ formatter }); + this.setData({ formatter, datePickerShow:false }); this.dayData = dayData; this.calcShowList(); }) - }, - +}, /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/weapp/package/riskManagement/riskCalendar/riskCalendar.json b/weapp/package/riskManagement/riskCalendar/riskCalendar.json index 16fa6f0..7f72cb6 100644 --- a/weapp/package/riskManagement/riskCalendar/riskCalendar.json +++ b/weapp/package/riskManagement/riskCalendar/riskCalendar.json @@ -6,6 +6,9 @@ "usingComponents": { "van-calendar": "@vant/weapp/calendar/index", "van-picker": "@vant/weapp/picker/index", - "van-popup": "@vant/weapp/popup/index" + "van-popup": "@vant/weapp/popup/index", + "van-icon": "@vant/weapp/icon/index", + "van-datetime-picker": "@vant/weapp/datetime-picker/index" + } } \ No newline at end of file diff --git a/weapp/package/riskManagement/riskCalendar/riskCalendar.wxml b/weapp/package/riskManagement/riskCalendar/riskCalendar.wxml index 009032a..06beb1b 100644 --- a/weapp/package/riskManagement/riskCalendar/riskCalendar.wxml +++ b/weapp/package/riskManagement/riskCalendar/riskCalendar.wxml @@ -6,8 +6,21 @@ 巡检日历 - {{curDate}} + + {{curDate}} + + + + + + + + + { this.setData({ + doneLength:res.length, dataList: res.map(r => { return { ...r, @@ -56,6 +60,22 @@ Page({ }) }) }) + Request.get(getPatrolRecordIssueHandle(), { + ...params,type:'backlog' + }).then(res => { + this.setData({ + willLength:res.length, + dataList: res.map(r => { + return { + ...r, + createTime: r.createTime ? moment(r.createTime).format('YYYY-MM-DD HH:mm:ss') : '--' + } + }) + }) + }) + + + }, // 筛选选择 @@ -148,8 +168,8 @@ Page({ onDropDownClose () { const { currentTab, startTime, endTime, pointList, structResult } = this.data - this.getData({ - type: currentTab === 0 ? 'backlog' : 'haveDone', + let params={ + // type: currentTab === 0 ? 'backlog' : 'haveDone', startTime, endTime, pointId: pointList.length ? (() => { @@ -164,7 +184,9 @@ Page({ } return sendPointId.join(',') })() : structResult.length ? '-1' : '' - }) + } + this.getData(params) + // this.getCount(params) }, // 页面跳转 @@ -174,12 +196,46 @@ Page({ url: '/package/troubleshooting/shootingForm/index?shootingid=' + shootingid + '&tabIndex=' + this.data.currentTab, }) }, - + //求未办和已办数量 + // getCount(data){ + // Request.get(getPatrolRecordIssueHandle(), {...data,type: 'haveDone'}).then(res=>{ + // console.log('res',res) + // if(res.length){ + // this.setData({ + // doneLength:res.length + // }) + // }else{ + // this.setData({ + // doneLength:0 + // }) + // } + // }) + // Request.get(getPatrolRecordIssueHandle(), {...data,type: 'backlog'}).then(res=>{ + // if(res.length){ + // this.setData({ + // willLength:res.length + // }) + // }else{ + // this.setData({ + // willLength:0 + // }) + // } + // }) + // }, /** * 生命周期函数--监听页面加载 */ onLoad (options) { - + // this.getCount() + const userInfo = wx.getStorageSync('userInfo'); + let bool=false + console.log('userInfo',userInfo) + if(userInfo?.role.includes('管理')){ + bool=true + } + this.setData({ + isEdit:bool + }) }, /** @@ -198,9 +254,7 @@ Page({ structList: res }) }) - this.getData({ - type: this.data.currentTab === 0 ? 'backlog' : 'haveDone' - }); + this.getData({ }) setTimeout(() => { this.setData({ timeSelectedUnrealFlag: false diff --git a/weapp/package/troubleshooting/index.wxml b/weapp/package/troubleshooting/index.wxml index e95343f..487d9d1 100644 --- a/weapp/package/troubleshooting/index.wxml +++ b/weapp/package/troubleshooting/index.wxml @@ -2,8 +2,8 @@ - - + + @@ -61,7 +61,7 @@ 任务下发时间:{{item.createTime}} - + {{ currentTab == 0? item.state == 1 ?'制定计划': diff --git a/weapp/pages/home/home.js b/weapp/pages/home/home.js index 009bdc5..16dd116 100644 --- a/weapp/pages/home/home.js +++ b/weapp/pages/home/home.js @@ -1,5 +1,5 @@ // pages/home/home.js -import { getPatrolRecord } from "../../utils/getApiUrl"; +import { getPatrolRecord,getAdvisoryNotices } from "../../utils/getApiUrl"; import { Request } from "../../common"; const moment = require("../../utils/moment"); @@ -29,6 +29,8 @@ Page({ markers: [], pageHeight:0,//屏幕高度 isShowCallout: false, + advisoryNoticeList:[],//咨询公告 + time:'',//最新公告时间 itemList:[ { picPath:'/images/gas.png', @@ -72,7 +74,12 @@ Page({ } ], }, - +//跳转资讯公告页 +toDetail(){ + wx.navigateTo({ + url: '/package/advisoryNotice/advisoryNotice', + }) +}, /** * 生命周期函数--监听页面加载 */ @@ -97,6 +104,7 @@ Page({ wx.showLoading({ title: '加载中' }) const date1 = new Date('1970-01-01 00:00:00'); promiseArr.push(Request.get(getPatrolRecord('all', moment(date1).format('YYYY-MM-DD') + ' 00:00:00', moment('2099-12-31').format('YYYY-MM-DD') + ' 23:59:59', 'null', 'null',{home:true}))); + promiseArr.push(Request.get(getAdvisoryNotices({home:true}))) Promise.all(promiseArr).then(res => { wx.hideLoading() //与自己相关的所有巡检记录 @@ -114,6 +122,8 @@ Page({ } )||[] that.setData({ + advisoryNoticeList:res[1].rows, + time:moment(res[1].rows[0].publishTime).format('YYYY年MM月DD日'), allCount:list.length || 0, allQuestionCount:list?.filter(i=>i.patrolRecordIssueHandles.length>0)?.length || 0, allHandleCount:list?.filter(i => i?.patrolRecordIssueHandles[0]?.yanshoushijian && parseInt(moment(i?.patrolRecordIssueHandles[0]?.yanshoushijian).format('YYYYMMDD')) === parseInt(moment().format('YYYYMMDD'))).length || 0, diff --git a/weapp/pages/home/home.wxml b/weapp/pages/home/home.wxml index 5901160..93d66f9 100644 --- a/weapp/pages/home/home.wxml +++ b/weapp/pages/home/home.wxml @@ -12,6 +12,16 @@ + + + + {{advisoryNoticeList[0].content}} + + + + {{time}} + 更多 + diff --git a/weapp/pages/home/home.wxss b/weapp/pages/home/home.wxss index 1e99ee9..430047e 100644 --- a/weapp/pages/home/home.wxss +++ b/weapp/pages/home/home.wxss @@ -97,4 +97,13 @@ color: #333333; letter-spacing: 0; text-align: center; -} \ No newline at end of file +} + +.ellipsis { + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 4; + -webkit-box-orient: vertical; +} + \ No newline at end of file diff --git a/weapp/pages/myInfo/myInfo.js b/weapp/pages/myInfo/myInfo.js index 877d215..f6ae1fa 100644 --- a/weapp/pages/myInfo/myInfo.js +++ b/weapp/pages/myInfo/myInfo.js @@ -16,7 +16,12 @@ Page({ url: '/package/basic/basic', }) }, - +//跳转资讯公告页 +toDetail(){ + wx.navigateTo({ + url: '/package/advisoryNotice/advisoryNotice', + }) +}, // 登出 logout () { wx.showModal({ diff --git a/weapp/pages/myInfo/myInfo.wxml b/weapp/pages/myInfo/myInfo.wxml index 7df8dff..c850055 100644 --- a/weapp/pages/myInfo/myInfo.wxml +++ b/weapp/pages/myInfo/myInfo.wxml @@ -38,10 +38,10 @@ - + diff --git a/weapp/pages/workbench/workbench.js b/weapp/pages/workbench/workbench.js index 60ac87e..9707e2d 100644 --- a/weapp/pages/workbench/workbench.js +++ b/weapp/pages/workbench/workbench.js @@ -38,8 +38,13 @@ Page({ }, { iconPath: '/images/workbench/expert_systems.png', - text: 'AIOT总览', + text: 'AIOT运维', page: '/package/AIOTOverview/AIOTOverview' + }, + { + iconPath: '/images/workbench/issues.png', + text: '维修台账', + page: '/package/troubleshooting/index' } ] }, diff --git a/weapp/pages/workbench/workbench.wxml b/weapp/pages/workbench/workbench.wxml index e99926b..0e5daa7 100644 --- a/weapp/pages/workbench/workbench.wxml +++ b/weapp/pages/workbench/workbench.wxml @@ -5,8 +5,8 @@ {{item.text}} - + \ No newline at end of file diff --git a/weapp/utils/getApiUrl.js b/weapp/utils/getApiUrl.js index 7cb308b..186ea79 100644 --- a/weapp/utils/getApiUrl.js +++ b/weapp/utils/getApiUrl.js @@ -150,4 +150,14 @@ exports.getRelationList= () => { exports.createInvoke= () => { return `/capabilities/invoke` } +//获取资讯公告接口 +exports.getAdvisoryNotices= (query) => { + const { home } = query; + return `/advisoryNotices/list?home=${home}` +} + + +exports.getNetworks= () => { + return `/network` +} diff --git a/web/client/src/app.js b/web/client/src/app.js index c9c35ae..36929ed 100644 --- a/web/client/src/app.js +++ b/web/client/src/app.js @@ -11,6 +11,7 @@ import IssueHandle from './sections/issueHandle' import Shouye from './sections/shouye'; import DeviceManage from './sections/deviceManage'; import ProjectBinding from './sections/projectBinding' +import AdvisoryNotice from './sections/advisoryNotice' import { Func } from '$utils'; const App = props => { const { projectName } = props @@ -22,7 +23,7 @@ const App = props => { return ( ) diff --git a/web/client/src/sections/advisoryNotice/actions/advisoryNotice.js b/web/client/src/sections/advisoryNotice/actions/advisoryNotice.js new file mode 100644 index 0000000..cbd7375 --- /dev/null +++ b/web/client/src/sections/advisoryNotice/actions/advisoryNotice.js @@ -0,0 +1,60 @@ +'use strict'; +import { basicAction } from '@peace/utils' +import { ApiTable } from '$utils' + +export function getAdvisoryNotices(query) { + return dispatch => basicAction({ + type: 'get', + dispatch: dispatch, + query, + actionType: 'GET_ADVISORY_NOTICES', + url: `${ApiTable.getAdvisoryNotices}`, + msg: { error: '获取资讯公告失败' }, + reducer: { name: 'advisoryNotice'} + }) +} + +export function addOrUpdateAdvisoryNotice(data) { + return dispatch => basicAction({ + type: 'post', + dispatch: dispatch, + data, + actionType: 'ADD_OR_UPDATE_ADVISORY_NOTICE', + url: `${ApiTable.addOrUpdateAdvisoryNotice}`, + msg: { option: data?.id?'编辑资讯公告':'新增资讯公告' }, + }) +} +export function delAdvisoryNotice(id) { + return dispatch => basicAction({ + type: 'delete', + dispatch: dispatch, + actionType: 'DEL_ADVISORY_NOTICE', + url: ApiTable.delAdvisoryNotice.replace('{id}', id), + msg: { option: '删除资讯公告' }, + }) +} + + +export function updateAdvisoryNoticeState(id,data) { + return dispatch => basicAction({ + type: 'post', + dispatch: dispatch, + data, + actionType: 'UPDATE_ADVISORY_NOTICE_STATE', + url: ApiTable.updateAdvisoryNoticeState.replace('{id}', id), + msg: { option: data?.msg?.includes('发布')?'发布资讯公告':'下架资讯公告' }, + }) +} + + + + + + + +export default{ + getAdvisoryNotices, + addOrUpdateAdvisoryNotice, + delAdvisoryNotice, + updateAdvisoryNoticeState +} \ No newline at end of file diff --git a/web/client/src/sections/advisoryNotice/actions/index.js b/web/client/src/sections/advisoryNotice/actions/index.js new file mode 100644 index 0000000..c0af547 --- /dev/null +++ b/web/client/src/sections/advisoryNotice/actions/index.js @@ -0,0 +1,6 @@ + +'use strict'; +import advisoryNotice from './advisoryNotice' +export default { + ...advisoryNotice +} \ No newline at end of file diff --git a/web/client/src/sections/advisoryNotice/components/addAdvisoryNoticeModal.js b/web/client/src/sections/advisoryNotice/components/addAdvisoryNoticeModal.js new file mode 100644 index 0000000..ce4de34 --- /dev/null +++ b/web/client/src/sections/advisoryNotice/components/addAdvisoryNoticeModal.js @@ -0,0 +1,108 @@ +import React, { useRef, useState, useEffect } from 'react' +import { Button, Form } from 'antd' +import { connect } from 'react-redux' +import { InfoCircleOutlined } from '@ant-design/icons' +import { ModalForm, ProFormSelect, ProFormText, ProFormDatePicker, ProFormTextArea,ProForm } from '@ant-design/pro-form' +import moment from 'moment' +import Uploads from '$components/Uploads' + +function AddAdvisoryNoticeModal(props) { + const { + title, + triggerRender, + editData = null, + onFinish, + devices, + actions, + dispatch, + disabled, + } = props + const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 16 } } + const initialValues = editData ? { ...editData } : {} + const [form] = Form.useForm() + const formRef = useRef() + + return ( + {title || ''}} + layout='horizontal' + grid={true} + {...formItemLayout} + modalProps={{ + destroyOnClose: true, + onCancel: () => {}, + }} + onFinish={async values => { + let value = { + title: values?.title, + content: values?.content, + id: initialValues ? initialValues.id : null, + attachments:values?.attachments?.length? + values?.attachments[0]?.name ? values?.attachments.map(u => u.storageUrl) : editData?.attachments:[], + } + if(disabled){ + return true + } + return onFinish && (await onFinish(value)) + // return true; + }}> + + +
+ + { + let nextV = [] + for (let s of editData?.attachments || []) { + if (s) { + nextV.push({ + storageUrl: s, + }) + } + } + return nextV + })()} + /> + +
+
+ ) +} +function mapStateToProps(state) { + const { auth, global, device } = state + return { + loading: device.isRequesting, + clientHeight: global.clientHeight, + actions: global.actions, + } +} + +export default connect(mapStateToProps)(AddAdvisoryNoticeModal) diff --git a/web/client/src/sections/advisoryNotice/containers/advisoryNotice.js b/web/client/src/sections/advisoryNotice/containers/advisoryNotice.js new file mode 100644 index 0000000..2544173 --- /dev/null +++ b/web/client/src/sections/advisoryNotice/containers/advisoryNotice.js @@ -0,0 +1,208 @@ +import React, { useEffect, useState, useRef, useMemo } from 'react' +import { Spin, Popconfirm, message, Button, Input, Select } from 'antd' +import { connect } from 'react-redux' +import ProTable from '@ant-design/pro-table' +import moment from 'moment' +import AddAdvisoryNoticeModal from '../components/addAdvisoryNoticeModal' +function AdvisorNotice(props) { + const { loading, clientHeight, actions, dispatch } = props + const { advisorNotice } = actions + const tableRef = useRef() + const proTableFormRef = useRef() + const [tableParams, setTableParams] = useState({}) + const [dataSource, setDataSource] = useState([]) + + const queryData = () => { + dispatch(advisorNotice.getAdvisoryNotices()).then(res => { + if (res.success) { + const list = res?.payload?.data?.rows + setDataSource(list) + } + }) + } + //初始化 + useEffect(() => { + queryData() + }, []) + + //新增或编辑 + const onFinish = async values => { + const dataToSave = { title: values?.title, content: values?.content,attachments:values?.attachments,id: values?.id } + return dispatch(advisorNotice.addOrUpdateAdvisoryNotice(dataToSave)).then(res => { + if (res.success) { + queryData() + // tableRef.current.reload() + return true + } else { + return false + } + }) + } + //删除 + const handleDelete = id => { + dispatch(advisorNotice.delAdvisoryNotice(id)).then(res => { + if (res.success) { + queryData() + } + }) + } + + //查询公告(搜索按钮) + const tableDatas = useMemo(() => { + const { title } = tableParams + let rslt = dataSource + rslt = rslt.filter(s => (title ? (s.title ? s.title === title : false) : true)) + return rslt + }) + //上架下架处理 + const publishHandler=(record)=>{ + const msg=record.state===2?'下架':'发布' + const publishTime=record.state===2?moment(record.publishTime).format('YYYY-MM-DD HH:mm:ss'):null + dispatch(advisorNotice.updateAdvisoryNoticeState(record.id,{msg,publishTime})).then(res => { + if (res.success) { + queryData() + } + }) + } + + const columns = [ + { + title: '序号', + dataIndex: 'id', + width: '12%', + render: (text, record, index) => { + return index + 1 + }, + search: false, + + }, + { + title: '公告标题', + dataIndex: 'title', + ellipsis: true, + }, + { + title: '发布时间', + dataIndex: 'publishTime', + ellipsis: true, + search: false, + render: (text, record, index) => { + return record?.publishTime?moment(record?.publishTime).format('YYYY-MM-DD HH:mm:ss'):'--' + }, + }, + { + title: '当前状态', + dataIndex: 'state', + ellipsis: true, + search: false, + render: (text, record, index) => { + return record?.state===1?'草稿':record?.state===2?'已发布':'已下架' + }, + }, + { + title: '操作', + width: 300, + key: 'option', + valueType: 'option', + render: (text, record) => { + const options = [] + options.push( + 查看详情} + editData={record} + disabled={true} + title='查看详情' + onFinish={onFinish} + key='lookModel' + /> + ) + options.push( + {publishHandler(record)}}>{record?.state===2?'下架':'发布'} + ) + record.state ===1||record.state ===3? options.push( + 编辑} + editData={record} + title='编辑资讯' + onFinish={onFinish} + key='editModel' + /> + ):'' + + record.state ===1||record.state ===3?options.push( + handleDelete(record.id)} + okText='是' + cancelText='否'> + 删除 + + ):'' + + return options + }, + }, + ] + + return ( + +
+ {/* */} +
+
+
+ + 咨讯公告 +  ADVISORYNOTICE +
+
+
+
+ 新增} + title='新增资讯' + onFinish={onFinish} + key='addModel' + /> + { + setTableParams(params) + return { + data: [], + success: true, + } + }} + actionRef={tableRef} + columns={columns} + pagination={{ pageSize: 10, size: 'default', className: 'global-pagination' }} + dataSource={tableDatas || []} + // search={{ + // labelWidth: 100, + // }} + // search={{ + // optionRender: ({searchText, resetText}, {form}, dom) => [ + // , + // ] + // }} + > + {/*
*/} +
+
+ ) +} + +function mapStateToProps(state) { + const { auth, global, advisoryNotice } = state + return { + loading: advisoryNotice.isRequesting, + clientHeight: global.clientHeight, + actions: global.actions, + } +} + +export default connect(mapStateToProps)(AdvisorNotice) diff --git a/web/client/src/sections/advisoryNotice/containers/index.js b/web/client/src/sections/advisoryNotice/containers/index.js new file mode 100644 index 0000000..7c1c341 --- /dev/null +++ b/web/client/src/sections/advisoryNotice/containers/index.js @@ -0,0 +1,5 @@ +'use strict'; + +import AdvisoryNotice from './advisoryNotice' + +export { AdvisoryNotice } diff --git a/web/client/src/sections/advisoryNotice/containers/style.less b/web/client/src/sections/advisoryNotice/containers/style.less new file mode 100644 index 0000000..e69de29 diff --git a/web/client/src/sections/advisoryNotice/index.js b/web/client/src/sections/advisoryNotice/index.js new file mode 100644 index 0000000..1853f8d --- /dev/null +++ b/web/client/src/sections/advisoryNotice/index.js @@ -0,0 +1,15 @@ +'use strict'; + +import reducers from './reducers'; +import routes from './routes'; +import actions from './actions'; +import { getNavItem } from './nav-item'; + +export default { + key: 'advisorNotice', + name: '资讯广告', + reducers: reducers, + routes: routes, + actions: actions, + getNavItem: getNavItem +}; \ No newline at end of file diff --git a/web/client/src/sections/advisoryNotice/nav-item.js b/web/client/src/sections/advisoryNotice/nav-item.js new file mode 100644 index 0000000..ba51163 --- /dev/null +++ b/web/client/src/sections/advisoryNotice/nav-item.js @@ -0,0 +1,14 @@ +import React from 'react'; +import { Link } from 'react-router-dom'; +import { Menu } from 'antd'; +import { HomeOutlined } from '@ant-design/icons'; +import { Func } from '$utils'; +const SubMenu = Menu.SubMenu; + +export function getNavItem (user, dispatch) { + + return }> + 咨讯公告 + + +} \ No newline at end of file diff --git a/web/client/src/sections/advisoryNotice/reducers/index.js b/web/client/src/sections/advisoryNotice/reducers/index.js new file mode 100644 index 0000000..7ed1088 --- /dev/null +++ b/web/client/src/sections/advisoryNotice/reducers/index.js @@ -0,0 +1,5 @@ +'use strict'; + +export default { + +} \ No newline at end of file diff --git a/web/client/src/sections/advisoryNotice/routes.js b/web/client/src/sections/advisoryNotice/routes.js new file mode 100644 index 0000000..3bccd2b --- /dev/null +++ b/web/client/src/sections/advisoryNotice/routes.js @@ -0,0 +1,12 @@ +'use strict'; +import { AdvisoryNotice } from './containers'; + +export default [{ + type: 'inner', + route: { + path: '/advisoryNotice', + key: 'advisoryNotice', + breadcrumb: '咨询公告', + component: AdvisoryNotice, + } +}]; \ No newline at end of file diff --git a/web/client/src/sections/deviceManage/actions/index.js b/web/client/src/sections/deviceManage/actions/index.js index 7ae21d1..a2cbf49 100644 --- a/web/client/src/sections/deviceManage/actions/index.js +++ b/web/client/src/sections/deviceManage/actions/index.js @@ -1,7 +1,8 @@ 'use strict'; import * as device from './device' +import * as network from './network' export default { - ...device + ...device,...network } \ No newline at end of file diff --git a/web/client/src/sections/deviceManage/actions/network.js b/web/client/src/sections/deviceManage/actions/network.js new file mode 100644 index 0000000..169185d --- /dev/null +++ b/web/client/src/sections/deviceManage/actions/network.js @@ -0,0 +1,50 @@ +'use strict'; +import { basicAction } from '@peace/utils' +import { ApiTable } from '$utils' + +export function getNetworks(query) { + return dispatch => basicAction({ + type: 'get', + dispatch: dispatch, + query, + actionType: 'GET_NETWORKS', + url: `${ApiTable.getNetworks}`, + msg: { error: '获取宽带专网失败' }, + reducer: { name: 'networks'} + }) +} + +export function addOrUpdateNetwork(data) { + return dispatch => basicAction({ + type: 'post', + dispatch: dispatch, + data, + actionType: 'ADD_OR_UPDATE_NETWORK', + url: `${ApiTable.addOrUpdateNetwork}`, + msg: { option: data?.id?'编辑宽带专网':'新增宽带专网' }, + }) +} +export function delNetwork(id) { + return dispatch => basicAction({ + type: 'delete', + dispatch: dispatch, + actionType: 'DEL_NETWORK', + url: ApiTable.delNetwork.replace('{id}', id), + msg: { option: '删除宽带专网' }, + }) +} + + + + + + + + + + +export default{ + getNetworks, + addOrUpdateNetwork, + delNetwork, +} \ No newline at end of file diff --git a/web/client/src/sections/deviceManage/components/addNetworkModal.js b/web/client/src/sections/deviceManage/components/addNetworkModal.js new file mode 100644 index 0000000..eb5f042 --- /dev/null +++ b/web/client/src/sections/deviceManage/components/addNetworkModal.js @@ -0,0 +1,103 @@ +import React, { useRef, useState, useEffect } from 'react' +import { Button, Form } from 'antd' +import { connect } from 'react-redux' +import { InfoCircleOutlined } from '@ant-design/icons' +import { ModalForm, ProFormSelect, ProFormText, ProFormDatePicker, ProFormTextArea,ProForm, ProFormTimePicker } from '@ant-design/pro-form' +import moment from 'moment' + +function addNetworkModal(props) { + const { + title, + structureListOpt, + triggerRender, + editData = null, + onFinish, + devices, + actions, + dispatch, + type + } = props + const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 16 } } + const initialValues = editData ? { ...editData } : {} + const [form] = Form.useForm() + const formRef = useRef() + + return ( + {title || ''}} + layout='horizontal' + grid={true} + {...formItemLayout} + modalProps={{ + destroyOnClose: true, + onCancel: () => {}, + }} + + onFinish={async values => { + console.log('x111',values) + let value = { + name: values?.name, + type:values?.type, + account:values?.account, + indate: values?.indate, + id: initialValues ? initialValues.id : null, + projectId:values?.projectId + } + + return onFinish && (await onFinish(value)) + // return true; + }}> + + { + return { label: s.label, value: s.id } + })} + name='type' + label='专网类型' + /> + + + { + return { label: s.label, value: s.id } + })} + name='projectId' + label='关联结构物' + /> + + ) +} +function mapStateToProps(state) { + const { auth, global } = state + return { + clientHeight: global.clientHeight, + actions: global.actions, + } +} + +export default connect(mapStateToProps)(addNetworkModal) diff --git a/web/client/src/sections/deviceManage/containers/index.js b/web/client/src/sections/deviceManage/containers/index.js index 4577014..d5225eb 100644 --- a/web/client/src/sections/deviceManage/containers/index.js +++ b/web/client/src/sections/deviceManage/containers/index.js @@ -1,5 +1,5 @@ 'use strict'; import DeviceManage from './deviceManage' - -export { DeviceManage }; +import Network from './network' +export { DeviceManage,Network}; diff --git a/web/client/src/sections/deviceManage/containers/network.js b/web/client/src/sections/deviceManage/containers/network.js new file mode 100644 index 0000000..469e143 --- /dev/null +++ b/web/client/src/sections/deviceManage/containers/network.js @@ -0,0 +1,213 @@ +import React, { useEffect, useState, useRef, useMemo } from 'react' +import { Spin, Popconfirm, message, Button, Input, Select } from 'antd' +import { connect } from 'react-redux' +import ProTable from '@ant-design/pro-table' +import moment from 'moment' +import AddNetworkModal from '../components/addNetworkModal'; + + + +const type=[{id:1,label:'专网'},{id:2,label:'公网'}] +function Network(props) { + const { loading, clientHeight, actions, dispatch, } = props + const { deviceManage,projectRegime} = actions + const tableRef = useRef() + const proTableFormRef = useRef() + const [tableParams, setTableParams] = useState({}) + const [dataSource, setDataSource] = useState([]) + const [structureListOpt, setStructureListOpt] = useState([])//巡检结构物 + const queryData = () => { + dispatch(deviceManage.getNetworks()).then(res => { + if (res.success) { + const list = res?.payload?.data?.rows + setDataSource(list) + } + }) + } + //初始化 + useEffect(() => { + dispatch(projectRegime.getProjectList()).then(res => { + if (res.success) { + const dp = res.payload.data?.rows?.map(item => { + return { + label: item?.name, + id: item?.id, + } + }) + setStructureListOpt(dp) + } + }) + queryData() + }, []) + + //新增或编辑 + const onFinish = async values => { + const dataToSave = { + name: values?.name, + type:values?.type, + account:values?.account, + indate: values?.indate, + id: values.id , + projectId:values?.projectId + } + return dispatch(deviceManage.addOrUpdateNetwork(dataToSave)).then(res => { + if (res.success) { + queryData() + // tableRef.current.reload() + return true + } else { + return false + } + }) + } + //删除 + const handleDelete = id => { + dispatch(deviceManage.delNetwork(id)).then(res => { + if (res.success) { + queryData() + } + }) + } + + //查询宽带名字(搜索按钮) + const tableDatas = useMemo(() => { + const { name } = tableParams + let rslt = dataSource + rslt = rslt.filter(s => (name ? (s.name ? s.name.includes(name) : false) : true)) + return rslt + }) + + + const columns = [ + { + title: '专网名称', + dataIndex: 'name', + ellipsis: true, + }, + { + title: '专网类型', + dataIndex: 'type', + ellipsis: true, + search: false, + valueEnum: type.reduce((enumObj, { id, label }) => { + enumObj[id] = { text: label }; + return enumObj; + }, {}), + + }, + { + title: '账号', + dataIndex: 'account', + ellipsis: true, + search: false, + }, + { + title: '有效期', + dataIndex: 'indate', + ellipsis: true, + search: false, + render: (text, record, index) => { + return record?.indate?moment(record?.indate).format('YYYY-MM-DD'):'--' + }, + }, + { + title: '关联结构物', + dataIndex: 'projectId', + ellipsis: true, + search: false, + valueEnum: structureListOpt.reduce((enumObj, { id, label }) => { + enumObj[id] = { text: label }; + return enumObj; + }, {}), + }, + { + title: '操作', + width: 300, + key: 'option', + valueType: 'option', + render: (text, record) => { + const options = [] + options + .push( 编辑} + editData={record} + title='编辑宽带专网' + onFinish={onFinish} + key='editModel' + /> + ) + + + options.push( + handleDelete(record.id)} + okText='是' + cancelText='否'> + 删除 + + ) + + return options + }, + }, + ] + + return ( + +
+ {/* */} +
+
+
+ + 宽带专网 +  NETWORK +
+
+
+
+ 新增} + title='新增宽带宽带' + onFinish={onFinish} + key='addModel' + /> + { + setTableParams(params) + return { + data: [], + success: true, + } + }} + actionRef={tableRef} + columns={columns} + pagination={{ pageSize: 10, size: 'default', className: 'global-pagination' }} + dataSource={tableDatas || []} + > + {/*
*/} +
+
+ ) +} + +function mapStateToProps(state) { + const { auth, global, networks } = state + return { + loading: networks.isRequesting, + clientHeight: global.clientHeight, + actions: global.actions, + } +} + +export default connect(mapStateToProps)(Network) diff --git a/web/client/src/sections/deviceManage/nav-item.js b/web/client/src/sections/deviceManage/nav-item.js index 607aa65..e5ba994 100644 --- a/web/client/src/sections/deviceManage/nav-item.js +++ b/web/client/src/sections/deviceManage/nav-item.js @@ -2,12 +2,21 @@ import React from 'react'; import { Link } from 'react-router-dom'; import { Menu } from 'antd'; import { Func } from '$utils'; +const SubMenu = Menu.SubMenu; + export function getNavItem(user, dispatch) { return ( - } - key="deviceManage"> - 设备管理 + } title={'设备管理'}> + } + key="deviceCheck"> + 设备查看 - + } + key="network"> + 宽带专网 + + ); } \ No newline at end of file diff --git a/web/client/src/sections/deviceManage/routes.js b/web/client/src/sections/deviceManage/routes.js index b57a687..cb3ad27 100644 --- a/web/client/src/sections/deviceManage/routes.js +++ b/web/client/src/sections/deviceManage/routes.js @@ -1,13 +1,24 @@ 'use strict'; -import { DeviceManage } from './containers'; +import { DeviceManage,Network } from './containers'; export default [{ type: 'inner', route: { path: '/deviceManage', key: 'deviceManage', - breadcrumb: '设备管理', - component: DeviceManage, - + breadcrumb: '巡检管理', + childRoutes: [{ + path: '/deviceCheck', + key: 'deviceCheck', + component: DeviceManage, + breadcrumb: '设备查看', + }, + { + path: '/netWork', + key: 'netWork', + component: Network, + breadcrumb: '宽带专网', + } + ] } }]; \ No newline at end of file diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js index 66389fc..4f45702 100644 --- a/web/client/src/utils/webapi.js +++ b/web/client/src/utils/webapi.js @@ -159,8 +159,16 @@ export const ApiTable = { delRelation:'anxinyun/project/relation/{id}', getRelation:'anxinyun/project/relation/list', - - + //资讯公告 + getAdvisoryNotices:'advisoryNotices/list', + addOrUpdateAdvisoryNotice:'advisoryNotices/addOrUpdate', + delAdvisoryNotice:'advisoryNotices/{id}', + updateAdvisoryNoticeState:'updateAdvisoryNotices/{id}', + + //宽带专网 + getNetworks:'network', + addOrUpdateNetwork:'network', + delNetwork:'network/{id}', }; export const RouteTable = {