diff --git a/api/.vscode/launch.json b/api/.vscode/launch.json index 0e5cef4..daf8ebb 100644 --- a/api/.vscode/launch.json +++ b/api/.vscode/launch.json @@ -15,7 +15,8 @@ "args": [ "-p 4900", // 研发 - "-g postgres://FashionAdmin:123456@10.8.30.39:5432/Inspection", + // "-g postgres://FashionAdmin:123456@10.8.30.39:5432/Inspection", + "-g postgres://postgres:123456@10.8.16.184:5432/XunJian", // "-g postgres://FashionAdmin:123456@10.8.30.156:5432/inspection", // 测试 // "--apiEmisUrl http://10.8.30.161:1111", diff --git a/api/app/lib/controllers/organization/user.js b/api/app/lib/controllers/organization/user.js index 14e0577..66c1c2b 100644 --- a/api/app/lib/controllers/organization/user.js +++ b/api/app/lib/controllers/organization/user.js @@ -172,7 +172,7 @@ async function getUser (ctx, next) { const models = ctx.fs.dc.models; const { depId } = ctx.params; let userRes = null; - if (depId !== 'null') { + if (depId !== 'undefined') { userRes = await models.User.findAll({ where: { departmentId: parseInt(depId), diff --git a/api/app/lib/controllers/patrolManage/patrolRecord.js b/api/app/lib/controllers/patrolManage/patrolRecord.js index e0bcca3..185adbd 100644 --- a/api/app/lib/controllers/patrolManage/patrolRecord.js +++ b/api/app/lib/controllers/patrolManage/patrolRecord.js @@ -169,26 +169,38 @@ async function addPatrolRecord (ctx, next) { try { const models = ctx.fs.dc.models; const data = ctx.request.body; - let { patrolPlanId, inspectionTime, points, alarm, pointId } = data + let { patrolPlanId, inspectionTime, points, alarm, pointId, projectId } = data const pointRecord = await models.PatrolRecord.findAll({ where: { pointId: pointId }, order: [['inspectionTime', 'desc']], attributes: ['inspectionTime'], }); const lastInspectionTime = pointRecord.length ? pointRecord[0].dataValues.inspectionTime : null; - let record = { patrolPlanId, lastInspectionTime, inspectionTime, points, alarm, pointId } - const recordRes = await models.PatrolRecord.create(record, transaction); + const recordRes = await models.PatrolRecord.create( + // record + { + patrolPlanId: patrolPlanId, + lastInspectionTime, + inspectionTime, + points, + alarm, + pointId: pointId, + projectId + } + , { + transaction + }); if (alarm) { - await models.PatrolRecord.create({ + await models.PatrolRecordIssueHandle.create({ patrolRecordId: recordRes.id, state: 1, - }, transaction); + }, { transaction }); } // 更新巡检次数统计 const curPlanRecord = await models.PatrolRecord.findAndCountAll({ - where: { patrolPlanId } + where: { patrolPlanId: patrolPlanId } }); const patrolCount = curPlanRecord.count; diff --git a/api/app/lib/controllers/patrolManage/yujingguanli.js b/api/app/lib/controllers/patrolManage/yujingguanli.js new file mode 100644 index 0000000..2b39b8b --- /dev/null +++ b/api/app/lib/controllers/patrolManage/yujingguanli.js @@ -0,0 +1,64 @@ +'use strict'; +async function varfiyCode(ctx) { + try { + const { models } = ctx.fs.dc; + const { pushBySms, pushByEmail } = ctx.app.fs.utils + const { phone, type ,email} = ctx.request.body + + // 伪造的请求可能由相同的sig参数组成 + // const checkSigUsed = await models.PhoneValidateCode.findOne({ + // where: { sig: sig } + // }); + // if (checkSigUsed) { + // throw '参数错误!' + // } + + // // 验证sig正确性 + // const checkSig = Hex.stringify(SHA1(phone + r)); + // if (!r || !sig || sig != checkSig) { + // throw '参数错误!' + // } + + let varifyCode = '' + for (let i = 0; i < 6; i++) { + varifyCode += Math.floor(Math.random() * 10) + } + + if(type.includes(1)){ + await pushBySms({ + phone: phone, + templateCode: 'SMS_261950020', + templateParam: { + code: varifyCode + }, + }) + } + if(type.includes(2)){ + await pushByEmail({ + email: email, + title: '测试', + text:'你知道吗' + }) + } + + // await models.PhoneValidateCode.create({ + // phone: phone, + // code: varifyCode, + // sig: sig, + // expired: moment().add(10, 'minutes').format('YYYY-MM-DD HH:mm:ss') + // }) + + ctx.status = 204; + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { + message: typeof error == 'string' ? error : '获取验证码失败' + } + } +} + + module.exports = { + varfiyCode, + // pushByEmail +} \ No newline at end of file diff --git a/api/app/lib/models/patrol_record.js b/api/app/lib/models/patrol_record.js index a71d7ca..c13af6e 100644 --- a/api/app/lib/models/patrol_record.js +++ b/api/app/lib/models/patrol_record.js @@ -45,6 +45,11 @@ module.exports = dc => { type: DataTypes.INTEGER, allowNull: false, }, + projectId: { + field: "project_id", + type: DataTypes.INTEGER, + allowNull: true, + }, }, { tableName: "patrol_record", comment: "", diff --git a/api/app/lib/models/patrol_record_issue_handle.js b/api/app/lib/models/patrol_record_issue_handle.js index 99bb99c..f2926ab 100644 --- a/api/app/lib/models/patrol_record_issue_handle.js +++ b/api/app/lib/models/patrol_record_issue_handle.js @@ -168,6 +168,51 @@ module.exports = dc => { field: "check_image", autoIncrement: false }, + yanshoushijian: { + type: DataTypes.DATE, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "yanshoushijian", + autoIncrement: false + }, + yanshoucishu: { + type: DataTypes.INTEGER, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "yanshoucishu", + autoIncrement: false + }, + yujingshijian: { + type: DataTypes.DATE, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "yujingshijian", + autoIncrement: false + }, + isgaojing: { + type: DataTypes.BOOLEAN, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "isgaojing", + autoIncrement: false + }, + cost: { + type: DataTypes.DECIMAL(11, 2), + allowNull: true, + defaultValue: null, + comment: '成本', + primaryKey: false, + field: "cost", + autoIncrement: false + }, }, { tableName: "patrol_record_issue_handle", comment: "", diff --git a/api/app/lib/routes/patrolManage/yujingguanli.js b/api/app/lib/routes/patrolManage/yujingguanli.js new file mode 100644 index 0000000..b968474 --- /dev/null +++ b/api/app/lib/routes/patrolManage/yujingguanli.js @@ -0,0 +1,11 @@ +'use strict'; + +const yujingguanli = require('../../controllers/patrolManage/yujingguanli'); + +module.exports = function (app, router, opts) { + + + app.fs.api.logAttr['POST/yujingguanli'] = { content: '下发预警邮件', visible: true }; + router.post('/yujingguanli', yujingguanli.varfiyCode); + +}; \ No newline at end of file diff --git a/api/config.js b/api/config.js index b752ec8..3aa9876 100644 --- a/api/config.js +++ b/api/config.js @@ -94,7 +94,7 @@ const product = { host: 'smtp.exmail.qq.com', port: 465, sender: { - name: '中鼎服务', + name: '运维服务', address: 'fsiot@free-sun.com.cn', password: 'Fs2689' } diff --git a/api/log/development.log b/api/log/development.log index 5394c5f..f052f00 100644 --- a/api/log/development.log +++ b/api/log/development.log @@ -4194,3 +4194,129 @@ notNull Violation: PatrolPlan.patrolCount cannot be null 2023-02-21 17:02:47.295 - error: path: /patrolTemplate, error: ReferenceError: createUser is not defined 2023-02-21 17:08:28.472 - error: path: /patrolTemplate, error: ReferenceError: createUser is not defined 2023-02-21 17:08:39.999 - error: path: /patrolTemplate, error: ReferenceError: createUser is not defined +2023-03-03 08:50:15.221 - debug: [FS-LOGGER] Init. +2023-03-03 08:50:16.170 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2023-03-03 08:50:16.171 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment) +2023-03-03 08:50:16.171 - info: [FS-AUTH] Inject auth and api mv into router. +2023-03-03 08:52:27.130 - error: [FS-ERRHD] +{ + message: 'transaction is not defined', + stack: 'ReferenceError: transaction is not defined\n' + + ' at login (d:\\前端学习\\巡检\\Inspection\\api\\app\\lib\\controllers\\auth\\index.js:78:9)' +} +2023-03-03 08:52:27.133 - error: [FS-ERRHD] +{ + message: 'transaction is not defined', + stack: 'ReferenceError: transaction is not defined\n' + + ' at login (d:\\前端学习\\巡检\\Inspection\\api\\app\\lib\\controllers\\auth\\index.js:78:9)' +} +2023-03-03 08:52:27.133 - error: [FS-ERRHD] +{ + message: 'transaction is not defined', + stack: 'ReferenceError: transaction is not defined\n' + + ' at login (d:\\前端学习\\巡检\\Inspection\\api\\app\\lib\\controllers\\auth\\index.js:78:9)' +} +2023-03-03 08:52:27.134 - error: [FS-ERRHD] +{ + message: 'transaction is not defined', + stack: 'ReferenceError: transaction is not defined\n' + + ' at login (d:\\前端学习\\巡检\\Inspection\\api\\app\\lib\\controllers\\auth\\index.js:78:9)' +} +2023-03-03 08:52:27.134 - error: [FS-ERRHD] +{ + message: 'transaction is not defined', + stack: 'ReferenceError: transaction is not defined\n' + + ' at login (d:\\前端学习\\巡检\\Inspection\\api\\app\\lib\\controllers\\auth\\index.js:78:9)' +} +2023-03-03 08:52:27.135 - error: [FS-ERRHD] +{ + message: 'transaction is not defined', + stack: 'ReferenceError: transaction is not defined\n' + + ' at login (d:\\前端学习\\巡检\\Inspection\\api\\app\\lib\\controllers\\auth\\index.js:78:9)' +} +2023-03-03 08:52:48.235 - error: [FS-ERRHD] +{ + message: 'transaction is not defined', + stack: 'ReferenceError: transaction is not defined\n' + + ' at login (d:\\前端学习\\巡检\\Inspection\\api\\app\\lib\\controllers\\auth\\index.js:78:9)' +} +2023-03-03 08:52:48.236 - error: [FS-ERRHD] +{ + message: 'transaction is not defined', + stack: 'ReferenceError: transaction is not defined\n' + + ' at login (d:\\前端学习\\巡检\\Inspection\\api\\app\\lib\\controllers\\auth\\index.js:78:9)' +} +2023-03-03 08:52:48.237 - error: [FS-ERRHD] +{ + message: 'transaction is not defined', + stack: 'ReferenceError: transaction is not defined\n' + + ' at login (d:\\前端学习\\巡检\\Inspection\\api\\app\\lib\\controllers\\auth\\index.js:78:9)' +} +2023-03-03 08:52:48.238 - error: [FS-ERRHD] +{ + message: 'transaction is not defined', + stack: 'ReferenceError: transaction is not defined\n' + + ' at login (d:\\前端学习\\巡检\\Inspection\\api\\app\\lib\\controllers\\auth\\index.js:78:9)' +} +2023-03-03 08:52:48.238 - error: [FS-ERRHD] +{ + message: 'transaction is not defined', + stack: 'ReferenceError: transaction is not defined\n' + + ' at login (d:\\前端学习\\巡检\\Inspection\\api\\app\\lib\\controllers\\auth\\index.js:78:9)' +} +2023-03-03 08:52:48.239 - error: [FS-ERRHD] +{ + message: 'transaction is not defined', + stack: 'ReferenceError: transaction is not defined\n' + + ' at login (d:\\前端学习\\巡检\\Inspection\\api\\app\\lib\\controllers\\auth\\index.js:78:9)' +} +2023-03-03 08:53:09.296 - error: [FS-ERRHD] +{ + message: 'transaction is not defined', + stack: 'ReferenceError: transaction is not defined\n' + + ' at login (d:\\前端学习\\巡检\\Inspection\\api\\app\\lib\\controllers\\auth\\index.js:78:9)' +} +2023-03-03 08:53:09.296 - error: [FS-ERRHD] +{ + message: 'transaction is not defined', + stack: 'ReferenceError: transaction is not defined\n' + + ' at login (d:\\前端学习\\巡检\\Inspection\\api\\app\\lib\\controllers\\auth\\index.js:78:9)' +} +2023-03-03 08:53:09.296 - error: [FS-ERRHD] +{ + message: 'transaction is not defined', + stack: 'ReferenceError: transaction is not defined\n' + + ' at login (d:\\前端学习\\巡检\\Inspection\\api\\app\\lib\\controllers\\auth\\index.js:78:9)' +} +2023-03-03 08:55:19.376 - debug: [FS-LOGGER] Init. +2023-03-03 08:55:19.504 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2023-03-03 08:55:19.505 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment) +2023-03-03 08:55:19.505 - info: [FS-AUTH] Inject auth and api mv into router. +2023-03-04 15:30:48.068 - debug: [FS-LOGGER] Init. +2023-03-04 15:30:49.010 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2023-03-04 15:30:49.011 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment) +2023-03-04 15:30:49.011 - info: [FS-AUTH] Inject auth and api mv into router. +2023-03-04 17:42:25.123 - debug: [FS-LOGGER] Init. +2023-03-04 17:42:25.236 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2023-03-04 17:42:25.236 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment) +2023-03-04 17:42:25.236 - info: [FS-AUTH] Inject auth and api mv into router. +2023-03-04 18:22:09.556 - debug: [FS-LOGGER] Init. +2023-03-04 18:22:09.675 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2023-03-04 18:22:09.676 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment) +2023-03-04 18:22:09.676 - info: [FS-AUTH] Inject auth and api mv into router. +2023-03-06 08:51:30.658 - debug: [FS-LOGGER] Init. +2023-03-06 08:51:31.673 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2023-03-06 08:51:31.674 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment) +2023-03-06 08:51:31.674 - info: [FS-AUTH] Inject auth and api mv into router. +2023-03-06 10:16:04.533 - debug: [FS-LOGGER] Init. +2023-03-06 10:16:04.663 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2023-03-06 10:16:04.663 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment) +2023-03-06 10:16:04.663 - info: [FS-AUTH] Inject auth and api mv into router. +2023-03-06 14:30:39.123 - debug: [FS-LOGGER] Init. +2023-03-06 14:30:39.248 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2023-03-06 14:30:39.248 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment) +2023-03-06 14:30:39.248 - info: [FS-AUTH] Inject auth and api mv into router. +2023-03-06 14:32:05.704 - debug: [FS-LOGGER] Init. +2023-03-06 14:32:05.817 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2023-03-06 14:32:05.817 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment) +2023-03-06 14:32:05.818 - info: [FS-AUTH] Inject auth and api mv into router. diff --git a/script/1.0.4/schema/3.updata_resource.sql b/script/1.0.4/schema/3.updata_resource.sql new file mode 100644 index 0000000..54bc14f --- /dev/null +++ b/script/1.0.4/schema/3.updata_resource.sql @@ -0,0 +1,2 @@ +DELETE FROM public.resource WHERE code = 'REPAIR_MANAGE'; +DELETE FROM public.resource WHERE parent_resource = 'REPAIR_MANAGE'; \ No newline at end of file diff --git a/script/1.0.4/schema/4.updata_patrol_record_issue__handle.sql b/script/1.0.4/schema/4.updata_patrol_record_issue__handle.sql new file mode 100644 index 0000000..e10d398 --- /dev/null +++ b/script/1.0.4/schema/4.updata_patrol_record_issue__handle.sql @@ -0,0 +1,5 @@ +ALTER TABLE patrol_record_issue_handle ADD yanshoushijian timestamp(6); +ALTER TABLE patrol_record_issue_handle ADD yanshoucishu integer; +ALTER TABLE patrol_record_issue_handle ADD yujingshijian timestamp(6); +ALTER TABLE patrol_record_issue_handle ADD yujingafchishu integer; +ALTER TABLE patrol_record_issue_handle ADD isgaojing bool; diff --git a/script/1.0.5/schema/2.update_patrol_record.sql b/script/1.0.5/schema/2.update_patrol_record.sql new file mode 100644 index 0000000..dfe4b62 --- /dev/null +++ b/script/1.0.5/schema/2.update_patrol_record.sql @@ -0,0 +1,4 @@ +ALTER TABLE "public"."patrol_record" + ADD COLUMN "project_id" int4; + +COMMENT ON COLUMN "public"."patrol_record"."project_id" IS '结构物id'; \ No newline at end of file diff --git a/script/1.0.5/schema/3.update_patrol_record_issue_handle.sql b/script/1.0.5/schema/3.update_patrol_record_issue_handle.sql new file mode 100644 index 0000000..8f1541a --- /dev/null +++ b/script/1.0.5/schema/3.update_patrol_record_issue_handle.sql @@ -0,0 +1,4 @@ +ALTER TABLE "public"."patrol_record_issue_handle" + ADD COLUMN "cost" decimal(11,2); + +COMMENT ON COLUMN "public"."patrol_record_issue_handle"."cost" IS '成本'; \ No newline at end of file diff --git a/weapp/app.json b/weapp/app.json index c143865..8f0f3f8 100644 --- a/weapp/app.json +++ b/weapp/app.json @@ -16,7 +16,8 @@ "inspectionInput/inspectionInput", "troubleshooting/index", "troubleshooting/shootingForm/index", - "inspectionReport/inspectionReport" + "inspectionReport/inspectionReport", + "pointsStatus/pointsStatus" ] } ], diff --git a/weapp/images/circle.png b/weapp/images/circle.png new file mode 100644 index 0000000..108dbd4 Binary files /dev/null and b/weapp/images/circle.png differ diff --git a/weapp/images/refresh.svg b/weapp/images/refresh.svg new file mode 100644 index 0000000..55c4c77 --- /dev/null +++ b/weapp/images/refresh.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/weapp/package/inspectionInput/inspectionInput.js b/weapp/package/inspectionInput/inspectionInput.js index a226ef2..fc22884 100644 --- a/weapp/package/inspectionInput/inspectionInput.js +++ b/weapp/package/inspectionInput/inspectionInput.js @@ -83,7 +83,6 @@ Page({ onPickerChange (e) { const { key } = e.currentTarget.dataset; const { value } = e.detail; - this.setData({ [`${key}Visible`]: false, [`${key}Value`]: value, @@ -131,7 +130,6 @@ Page({ }) }, fail: (res) => { - console.log(res) wx.hideLoading(); wx.showToast({ title: res.errMsg, @@ -233,7 +231,6 @@ Page({ success++; let str = JSON.parse(resp.data) // 返回的结果,可能不同项目结果不一样 str = str.uploaded - console.log(str); if (imgs.length >= 20) { const inspectContent = that.data.inspectContent; inspectContent[itemName].imgs = imgs; @@ -359,7 +356,8 @@ Page({ inspectContent, address: address }, - alarm + alarm, + projectId: dataList.project.id } wx.showLoading({ title: '提交中...' }); that.setData({ isCommitting: true }); diff --git a/weapp/package/pointsStatus/pointsStatus.js b/weapp/package/pointsStatus/pointsStatus.js new file mode 100644 index 0000000..358ec28 --- /dev/null +++ b/weapp/package/pointsStatus/pointsStatus.js @@ -0,0 +1,66 @@ +// package/pointsStatus/pointsStatus.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + console.log(options, 'options') + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/weapp/package/pointsStatus/pointsStatus.json b/weapp/package/pointsStatus/pointsStatus.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/weapp/package/pointsStatus/pointsStatus.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/weapp/package/pointsStatus/pointsStatus.wxml b/weapp/package/pointsStatus/pointsStatus.wxml new file mode 100644 index 0000000..c9f4651 --- /dev/null +++ b/weapp/package/pointsStatus/pointsStatus.wxml @@ -0,0 +1,2 @@ + +package/pointsStatus/pointsStatus.wxml diff --git a/weapp/package/pointsStatus/pointsStatus.wxss b/weapp/package/pointsStatus/pointsStatus.wxss new file mode 100644 index 0000000..6d831ae --- /dev/null +++ b/weapp/package/pointsStatus/pointsStatus.wxss @@ -0,0 +1 @@ +/* package/pointsStatus/pointsStatus.wxss */ \ No newline at end of file diff --git a/weapp/package/troubleshooting/index.js b/weapp/package/troubleshooting/index.js index 4b0a680..6abd359 100644 --- a/weapp/package/troubleshooting/index.js +++ b/weapp/package/troubleshooting/index.js @@ -3,6 +3,8 @@ import { getPatrolRecordIssueHandle, getStructuresUsers } from "../../utils/getA import { Request } from "../../common"; const moment = require("../../utils/moment"); +let setFilterStartTime = 0 +let setFilterEndTime = 0 Page({ /** @@ -106,7 +108,7 @@ Page({ pointToggle (event) { const { index, id } = event.currentTarget.dataset; - const checkbox = this.selectComponent(`.checkboxes-point-${id}`); + // const checkbox = this.selectComponent(`.checkboxes-point-${id}`); // checkbox.toggle(); const { pointList } = this.data let pointList_ = JSON.parse(JSON.stringify(pointList)) @@ -123,6 +125,10 @@ Page({ if (timeSelectedUnrealFlag && event.detail == 1640966400000) { return } + if(new Date().getTime() - setFilterStartTime < 100){ + return + } + setFilterStartTime = new Date().getTime() this.setData({ startTime: event.detail, endTime: endTime ? endTime : 1640966400000 @@ -130,13 +136,19 @@ Page({ }, onEndTimeChange (event) { const { timeSelectedUnrealFlag, startTime, endTime } = this.data + console.log('结束时间', timeSelectedUnrealFlag, event, new Date().getTime()); if (timeSelectedUnrealFlag && event.detail == 1640966400000) { return } + if(new Date().getTime() - setFilterEndTime < 100){ + return + } + setFilterEndTime = new Date().getTime() this.setData({ startTime: startTime ? startTime : 1640966400000, endTime: event.detail, }); + return }, onDropDownClose () { diff --git a/weapp/package/troubleshooting/index.json b/weapp/package/troubleshooting/index.json index d8f06e3..af35bd8 100644 --- a/weapp/package/troubleshooting/index.json +++ b/weapp/package/troubleshooting/index.json @@ -12,6 +12,7 @@ "van-checkbox": "@vant/weapp/checkbox/index", "van-checkbox-group": "@vant/weapp/checkbox-group/index", "van-datetime-picker": "@vant/weapp/datetime-picker/index", - "timePicker": "/components/timePicker/index" + "timePicker": "/components/timePicker/index", + "t-date-time-picker": "tdesign-miniprogram/date-time-picker/date-time-picker" } } \ No newline at end of file diff --git a/weapp/package/troubleshooting/index.wxml b/weapp/package/troubleshooting/index.wxml index 27dd5fa..b078981 100644 --- a/weapp/package/troubleshooting/index.wxml +++ b/weapp/package/troubleshooting/index.wxml @@ -25,20 +25,26 @@ - - - - - + + + + + + + + - + - + diff --git a/weapp/package/troubleshooting/shootingForm/index.js b/weapp/package/troubleshooting/shootingForm/index.js index f1b50bd..c75beda 100644 --- a/weapp/package/troubleshooting/shootingForm/index.js +++ b/weapp/package/troubleshooting/shootingForm/index.js @@ -34,6 +34,7 @@ Page({ repair: '', repairImgs: [], checkDesc: '', + cost: '', checkImgs: [], // 表单控制 @@ -103,8 +104,8 @@ Page({ maintenancePersonDepartmentShow: maintenancePersonIndex >= 0 ? focusPerson[maintenancePersonIndex].department.name : '', qualityPersonIndex: focusPerson.findIndex(f => f.id == issue.checkPerson.id), planStartTime: moment(issue.startTime).unix(), - planStartTimeShow: moment(issue.startTime).format('YYYY-MM-DD HH:mm:ss'), - planEndTimeShow: moment(issue.endTime).format('YYYY-MM-DD HH:mm:ss'), + planStartTimeShow: moment(issue.startTime).format('YYYY-MM-DD'), + planEndTimeShow: moment(issue.endTime).format('YYYY-MM-DD'), maintenanceRequirement: issue.repairAsk }) } @@ -124,6 +125,7 @@ Page({ if (issue.state > 4) { this.setData({ checkDesc: issue.checkOpinion, + cost: issue.cost, checkImgs: issue.checkImage || [], }) } @@ -165,7 +167,7 @@ Page({ // this.setData({ planStartTime: '' }) } else if (e.target.dataset.option == 'confirmed') { this.setData({ - planStartTimeShow: this.data.planStartTime ? moment(this.data.planStartTime).format('YYYY-MM-DD HH:mm') : '' + planStartTimeShow: this.data.planStartTime ? moment(this.data.planStartTime).format('YYYY-MM-DD') : '' }) } }, @@ -186,7 +188,7 @@ Page({ this.setData({ planEndTimePopupShow: false }) if (e.target.dataset.option == 'confirmed') { this.setData({ - planEndTimeShow: this.data.planEndTime ? moment(this.data.planEndTime).format('YYYY-MM-DD HH:mm') : '' + planEndTimeShow: this.data.planEndTime ? moment(this.data.planEndTime).format('YYYY-MM-DD') : '' }) } }, @@ -198,8 +200,16 @@ Page({ }, onInputChange (e) { + let value = e.detail.value + if (e.target.dataset.type === 'cost' && !/^(\d?)+(\.\d{0,2})?$/.test(e.detail.value)) { + wx.showToast({ + title: '只能输入两位小数', + icon: 'none' + }) + value = value.substring(0, value.length - 1); + } this.setData({ - [e.target.dataset.type]: e.detail.value + [e.target.dataset.type]: value }) }, @@ -228,15 +238,15 @@ Page({ return; } wx.chooseMedia({ - count: 20, // 基础库2.25.0前,最多可支持9个文件,2.25.0及以后最多可支持20个文件 + count: 20, // 基础库2.25.0前,最多可支持9个文件,2.25.0及以后最多可支持20个文件 mediaType: ['image'], // 文件类型 - sizeType: ['original', 'compressed'], // original 原图,compressed 压缩图,默认二者都有 - sourceType: ['album', 'camera'], // album 从相册选图,camera 使用相机,默认二者都有 + sizeType: ['original', 'compressed'], // original 原图,compressed 压缩图,默认二者都有 + sourceType: ['album', 'camera'], // album 从相册选图,camera 使用相机,默认二者都有 success: function (res) { const imgs = res.tempFiles; for (let i = 0; i < imgs.length; i++) { if (res.tempFiles[i].size > 15728640) { - wx.showToast({ title: '图片大于15M,不可上传', icon: 'none' }); + wx.showToast({ title: '图片大于15M,不可上传', icon: 'none' }); return; } const fileNameArr = res.tempFiles[i].tempFilePath.split('.'); @@ -273,7 +283,7 @@ Page({ success: (resp) => { wx.hideLoading(); success++; - let str = JSON.parse(resp.data) // 返回的结果,可能不同项目结果不一样 + let str = JSON.parse(resp.data) // 返回的结果,可能不同项目结果不一样 str = str.uploaded if (imgs.length >= 20) { return false; @@ -291,14 +301,14 @@ Page({ }, complete: () => { i++; - if (i == data.path.length) { // 当图片传完时,停止调用 + if (i == data.path.length) { // 当图片传完时,停止调用 console.log('执行完毕'); - console.log('成功:' + success + " 失败:" + fail); - } else { // 若图片还没有传完,则继续调用函数 + console.log('成功:' + success + " 失败:" + fail); + } else { // 若图片还没有传完,则继续调用函数 data.i = i; data.success = success; data.fail = fail; - that.uploadimg(data, itemName); // 递归,回调自己 + that.uploadimg(data, itemName); // 递归,回调自己 } } }); @@ -322,7 +332,7 @@ Page({ maintenancePersonIndex, maintenancePersonDepartmentShow, qualityPersonIndex, planStartTime, planEndTime, planStartTimeShow, planEndTimeShow, maintenanceRequirement, userInfo, planApproval, repair, repairImgs, - checkDesc, checkImgs + checkDesc, cost, checkImgs } = this.data let nextState = '' let confirmData = {} @@ -372,7 +382,9 @@ Page({ confirmData = { ...confirmData, checkOpinion: checkDesc, - checkImage: checkImgs + cost, + checkImage: checkImgs, + checkPerson: { id: userInfo.id, name: userInfo.name } } if (approve == 'agree') { nextState = 6 diff --git a/weapp/package/troubleshooting/shootingForm/index.wxml b/weapp/package/troubleshooting/shootingForm/index.wxml index d40318a..6937e1e 100644 --- a/weapp/package/troubleshooting/shootingForm/index.wxml +++ b/weapp/package/troubleshooting/shootingForm/index.wxml @@ -14,13 +14,13 @@ - + - - + + 现场照片 @@ -75,7 +75,7 @@ 确定 - + @@ -93,7 +93,7 @@ 确定 - + @@ -137,6 +137,7 @@ 质检验收 + 现场图片 diff --git a/weapp/pages/index/index.js b/weapp/pages/index/index.js index 5d84a7a..0775da1 100644 --- a/weapp/pages/index/index.js +++ b/weapp/pages/index/index.js @@ -1,78 +1,81 @@ // pages/index/index.js -import { getProjectList } from "../../utils/getApiUrl"; +import { getProjectList, getPatrolRecord } from "../../utils/getApiUrl"; import { Request } from "../../common"; +const moment = require("../../utils/moment"); Page({ + /** * 页面的初始数据 */ data: { - dataList: [], - limit: 10, //条数 - page: 0, //当前页 - count: '', //总条数 - keyName: '', //结构物名称 - hidden: true, - imgUrl: getApp().globalData.imgUrl + project: [], + todayRecord: [], // 今日巡检记录 + markers: [], + isShowCallout: false, }, - // 输入框 - formInp(e) { - let that = this; - that.setData({ - keyName: e.detail.value + setMarkers(project, todayRecord) { + const markers = project.map(p => { + let todayCount = 0; + todayRecord.forEach(r => { + if (r.projectId === p.id) { todayCount += 1 } + }) + return { + id: p.id, + latitude: p.latitude, + longitude: p.longitude, + name: p.name, + iconPath: '/images/circle.png', + width: 15, + height: 15, + callout: { + content: `${p.name}\n今日巡检:${todayCount}次`, + padding: 10, + display: this.data.isShowCallout ? 'ALWAYS' : 'BYCLICK', + }, + } }) + this.setData({ markers }) }, - // 手机键盘点击完成按钮(回车事件) - bindconfirm() { - let that = this; - that.setData({ - page: 0, //当前页 - count: '', //总条数 - dataList: [] + // 获取结构物和今日巡检次数 + getData() { + const that = this; + wx.showLoading({ title: '加载中' }) + const promiseArr = []; + promiseArr.push(Request.get(getProjectList(), {})); + promiseArr.push(Request.get(getPatrolRecord('all', moment().format('YYYY-MM-DD') + ' 00:00:00', moment().format('YYYY-MM-DD') + ' 23:59:59', 'null', 'null'))); + Promise.all(promiseArr).then(res => { + wx.hideLoading() + that.setData({ + project: res[0].rows, + todayRecord: res[1] + }) + that.setMarkers(res[0].rows, res[1]); + // 缩放视野展示所有 markers + const mapCtx = wx.createMapContext('mapDom') + mapCtx.includePoints({ + points: res[0].rows, + padding: [40, 40, 40, 40] + }) }) - that.getProjectList(); }, - // 搜索表单 - goSearch() { - let that = this; - that.setData({ - page: 0, //当前页 - count: '', //总条数 - dataList: [] - }) - that.getProjectList(); + showCallout() { + this.setData( + { isShowCallout: !this.data.isShowCallout }, + () => { this.setMarkers(this.data.markers, this.data.todayRecord); } + ); }, - // 获取巡检总览列表 - getProjectList: function () { - let that = this; - let { page, limit, keyName } = that.data; - let data = keyName ? { limit, page, name: keyName } : { limit, page } - wx.showLoading({ - title: '加载中', - }) - Request.get(getProjectList(), data).then(res => { - if (res.rows.length == 0) { - that.setData({ - dataList: res.rows, - hidden: false - }) - wx.hideLoading() - return; - } - var arr1 = that.data.dataList; //从data获取当前dataList数组 - var arr2 = res.rows; //从此次请求返回的数据中获取新数组 - arr1 = arr1.concat(arr2); //合并数组 - that.setData({ - dataList: arr1, - count: res.count, //总条数 - hidden: true - }) - wx.hideLoading() - }) + onRefresh() { + this.getData(); + }, + + onMarkerTap(e) { + console.log(e.detail.markerId, 'e.detail.markerId') + wx.navigateTo({url: `/package/pointsStatus/pointsStatus?projectId=${e.detail.markerId}`}) }, /** @@ -104,7 +107,7 @@ Page({ url: '/pages/login/login' }); } else { - this.getProjectList(); + this.getData(); } }, @@ -112,60 +115,28 @@ Page({ * 生命周期函数--监听页面隐藏 */ onHide() { - this.setData({ - dataList: [], - keyName: '', - page: 0, //当前页 - count: '', //总条数 - }) + }, /** * 生命周期函数--监听页面卸载 */ onUnload() { - this.setData({ - dataList: [], - keyName: '', - page: 0, //当前页 - count: '', //总条数 - }) + }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { - let that = this; - that.setData({ - dataList: [], - keyName: '', - page: 0, //当前页 - count: '', //总条数 - }) - that.getProjectList() - // 手动控制回弹 - wx.stopPullDownRefresh(); + }, /** * 页面上拉触底事件的处理函数 */ 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.getProjectList() + }, /** diff --git a/weapp/pages/index/index.wxml b/weapp/pages/index/index.wxml index 5200184..347b757 100644 --- a/weapp/pages/index/index.wxml +++ b/weapp/pages/index/index.wxml @@ -1,32 +1,14 @@ - - - - - + + + 数据 + + - - - - - - 暂无图片 - - {{item.name}} - - 今日问题:12 - 未处理问题:12 - 已处理问题:12 - - - - - - - - - \ No newline at end of file + diff --git a/weapp/pages/index/index.wxss b/weapp/pages/index/index.wxss index df854bd..a84fb4a 100644 --- a/weapp/pages/index/index.wxss +++ b/weapp/pages/index/index.wxss @@ -1,70 +1,36 @@ /* pages/index/index.wxss */ -page { - background: #F7F7FA; +.flex-center { + display: flex; + justify-content: center; + align-items: center; } -.searchBoxs { - position: relative; - margin: 20rpx 0rpx; - height: 76rpx; +.map { + width: 100vw; + height: 100vh; } -.searchInps { - background-color: #fff; - width: 542rpx; - height: 76rpx; - border-radius: 8rpx; - padding-left: 32rpx; - padding-right: 144rpx; - border: 1px solid rgba(225, 225, 225, 0.44); - position: absolute; - top: -2rpx; - left: 16rpx; - font-size: 28rpx; +.action-box { + position: absolute; + bottom: 30px; + right: 10px; + width: 46px; + height: 80px; + display: flex; + flex-direction: column; + justify-content: space-evenly; } -.btnSearch { - width: 128rpx; - height: 68rpx; - line-height: 68rpx; - border-radius: 8rpx; - color: #fff; - font-size: 28rpx; - background: linear-gradient(180deg, #1979ff 0%, #1979ff 100%); - position: absolute; - top: 6rpx; - right: 28rpx; - z-index: 10; +.action-box .text { + background-color: white; + height: 30px; } -.searchFixed { - position: fixed; - top: 0; - width: 100%; - background-color: #fff; - box-shadow: 0rpx -4rpx 20rpx #c2c2c2; - z-index: 10; +.action-box .img { + background-color: white; } -.box { - padding: 20rpx; - box-shadow: 0rpx 10rpx 10rpx #ccc; - overflow: hidden; - line-height: 50rpx; - background: #fff; -} - -/* 暂无数据 */ -.noData { - width: 254rpx; - height: 298rpx; - display: block; - margin: 450rpx auto 16rpx; -} - -.noTxt { - font-size: 30rpx; - color: #999; - font-weight: bold; - text-align: center; +.action-box .img image { + width: 30px; + height: 30px; } \ No newline at end of file diff --git a/web/client/src/app.js b/web/client/src/app.js index 1597273..1541740 100644 --- a/web/client/src/app.js +++ b/web/client/src/app.js @@ -8,7 +8,8 @@ import ProjectRegime from './sections/projectRegime'; import Organization from './sections/organization'; import PatrolManage from './sections/patrolManage'; import IssueHandle from './sections/issueHandle' - +import Shouye from './sections/shouye'; +import { Func } from '$utils'; const App = props => { const { projectName } = props @@ -19,7 +20,7 @@ const App = props => { return ( ) diff --git a/web/client/src/sections/auth/containers/login.js b/web/client/src/sections/auth/containers/login.js index dcba5df..0fbb02b 100644 --- a/web/client/src/sections/auth/containers/login.js +++ b/web/client/src/sections/auth/containers/login.js @@ -11,7 +11,7 @@ import { login, LOGIN_ERROR } from '../actions/auth'; import { ExclamationCircleOutlined } from '@ant-design/icons'; import { Uploads } from '$components' import { LockOutlined, UserOutlined } from '@ant-design/icons'; - +import { Func } from '$utils'; import '../style.less'; const FormItem = Form.Item; @@ -29,6 +29,44 @@ const Login = props => { const [codCountDown, setCodeCountDown] = useState(60) const codCountDownRef = useRef(0) const [form] = Form.useForm(); + + const tourl = () => { + return '/shouye' + if (Func.isAuthorized("STRU_INFO_CONFIG")) { + return '/projectRegime/information' + } + if (Func.isAuthorized("QR_CODE_CONFIG")) { + return '/projectRegime/qrCode' + } + if (Func.isAuthorized("USER_CONFIG")) { + return '/organization/user' + } + if (Func.isAuthorized("AUTH_CONFIG")) { + return '/organization/authority' + } + if (Func.isAuthorized("PATROL_PLAN_CONFIG")) { + return '/patrolManage/patrolPlan' + } + if (Func.isAuthorized("PATROL_RECORD_VIEW")) { + return '/patrolManage/patrolRecord' + } + if (Func.isAuthorized("CHECKREPORT")) { + return '/patrolManage/patrolReport' + } + if (Func.isAuthorized("CHECKITEMSET")) { + return '/patrolManage/checkItems' +} +if (Func.isAuthorized("CHECKMOULD")) { + return '/patrolManage/patrolTemplate' +} +if (Func.isAuthorized("WENTICHULI")) { + return '/issueHandle' +} + else { + return message.warn('没有任何模块的查看权限') + } + } + useEffect(() => { }, []) @@ -36,7 +74,7 @@ const Login = props => { useEffect(() => { if (user && user.authorized) { - dispatch(push('/projectRegime/information')); + dispatch(push(tourl())); } }, [user]) diff --git a/web/client/src/sections/issueHandle/components/isuue-handle-mdal.js b/web/client/src/sections/issueHandle/components/isuue-handle-mdal.js index 9c356ee..94c5762 100644 --- a/web/client/src/sections/issueHandle/components/isuue-handle-mdal.js +++ b/web/client/src/sections/issueHandle/components/isuue-handle-mdal.js @@ -6,7 +6,8 @@ import { ProFormSelect, ProFormTextArea, ProFormDatePicker, - ProFormDateRangePicker + ProFormDateRangePicker, + ProFormDependency } from '@ant-design/pro-form'; import Uploads from '$components/Uploads'; import moment from 'moment'; @@ -14,7 +15,7 @@ const FormItem = Form.Item; //state: 1下发未上报 2已上报待审批 3整改完成 上报结果result: status 0 已上报未审批 1 审批通过 2 审批驳回 export default (props) => { const { title, triggerRender, editData = null, onFinish, readOnly, structsUsers, user } = props; - const users = structsUsers?.find(s => s.id == editData?.points?.project?.id)?.users?.map(v => { return { value: v.id, label: v.name } }) + const users = structsUsers?.find(s => s.id == editData?.points?.project?.id)?.users?.map(v => { return { value: v.id, label: v.name, ...v } }) const formItemLayout = { labelCol: { span: 7 }, wrapperCol: { span: 16 } }; const formRef = useRef(); @@ -174,7 +175,14 @@ export default (props) => { name="checkPerson1" label="验收人:" disabled={true} - value={ editData?.patrolRecordIssueHandles[0]?.checkPerson?.name} + value={editData?.patrolRecordIssueHandles[0]?.checkPerson?.name} + /> + + @@ -240,17 +248,18 @@ export default (props) => { approveHandle(values) return true; } else { + values.repairUnit = values?.repairUnits; values.startTime = values?.dateRange[0]; values.endTime = values?.dateRange[1]; - values.repairPerson = { id: users?.find(s => s.value == values.repairPerson)?.value, name: users?.find(s => s.id == values.value)?.label } - values.checkPerson = { id: users?.find(s => s.value == values.checkPerson)?.value, name: users?.find(s => s.id == values.value)?.label } + values.repairPerson = { id: users?.find(s => s.value == values.repairPerson)?.value, name: users?.find(s => s.id == values.repairPerson)?.label } + values.checkPerson = { id: users?.find(s => s.value == values.checkPerson)?.value, name: users?.find(s => s.id == values.checkPerson)?.label } onFinish && await onFinish(values, editData) //message.success('提交成功'); return true; } }} - submitter={editData?.patrolRecordIssueHandles[0]?.state === 2 && title != '修改计划' ? { + submitter={editData?.patrolRecordIssueHandles[0]?.state === 2 && title != '修改计划' && title != '查看详情' ? { render: (props, defaultDoms) => { return [ ]; } - } : !readOnly} + } : (!readOnly)} >
{/*问题记录信息*/} @@ -271,7 +280,7 @@ export default (props) => { {/*问题处理计划表单*/} { - ((editData?.patrolRecordIssueHandles?.length == 0 && !readOnly) || editData?.patrolRecordIssueHandles?.length > 0) && + ((editData?.patrolRecordIssueHandles[0]?.state == 1 && title != '查看详情') || editData?.patrolRecordIssueHandles[0]?.state > 1) && <>
{"维修计划信息"}
@@ -295,19 +304,28 @@ export default (props) => { } - + + {({ repairPerson }) => { + const department = users?.find(s => s.id == repairPerson)?.department?.name + + return ( + + ); + }} + + @@ -366,7 +384,7 @@ export default (props) => { } { - ((editData?.patrolRecordIssueHandles[0]?.state !== 1 || editData?.patrolRecordIssueHandles[0]?.state !== 3) && title != '修改计划' && editData?.patrolRecordIssueHandles?.length > 0) && + ((editData?.patrolRecordIssueHandles[0]?.state > 2) || title == '审核') && <>
{"维修计划审批"}
diff --git a/web/client/src/sections/issueHandle/containers/patrolRecord.js b/web/client/src/sections/issueHandle/containers/patrolRecord.js index fe33a80..16feb13 100644 --- a/web/client/src/sections/issueHandle/containers/patrolRecord.js +++ b/web/client/src/sections/issueHandle/containers/patrolRecord.js @@ -32,8 +32,8 @@ const PatrolRecord = (props) => { const queryData = () => { dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/true/null`)).then(res => { if (res.success) { - settableList(name != null ? res.payload.data?.filter(v => - (v.points.user.name.indexOf(name) != -1 || v.points.project.name.indexOf(name) != -1)) + settableList(name != null ? res.payload.data + ?.filter(v => (v.points.itemData.name.indexOf(name) != -1 || v.points.project.name.indexOf(name) != -1)) .filter(x => curState == '全部' || curState == renderOptionText(x?.patrolRecordIssueHandles[0]?.state)) .map(v => ({ ...v, key: v.id })) : res.payload.data?.map(v => ({ ...v, key: v.id }))) } @@ -153,7 +153,7 @@ const PatrolRecord = (props) => { key: 'operation', render: (text, record, index) => { const options = []; - if (Func.isAuthorized('ZHIDINGJIHUA') && (!record?.patrolRecordIssueHandles || record?.patrolRecordIssueHandles?.length == 0)) { + if (Func.isAuthorized('ZHIDINGJIHUA') && (!record?.patrolRecordIssueHandles || record?.patrolRecordIssueHandles?.length == 0 || record?.patrolRecordIssueHandles[0]?.state == 1)) { options.push( {
{ setName(e.target.value) }} - placeholder="请输入结构物名称或上报人" allowClear /> + placeholder="请输入结构物名称或点位名称" allowClear /> { - dispatch(positionList({ projectId: value })).then(res => { + ({value:i?.username,label:i?.name}))}> + + + + + + + ); +}; + +function mapStateToProps (state) { + const { auth, checkItemsGroup } = state + return { + user: auth.user, + checkItemsGroup: checkItemsGroup.data || [] + } +} +export default connect(mapStateToProps)(PlanModal); \ No newline at end of file diff --git a/web/client/src/sections/patrolManage/containers/index.js b/web/client/src/sections/patrolManage/containers/index.js index 8bcbd53..43a6ba5 100644 --- a/web/client/src/sections/patrolManage/containers/index.js +++ b/web/client/src/sections/patrolManage/containers/index.js @@ -5,5 +5,6 @@ import PatrolReocrd from './patrolRecord'; import PatrolReport from './patrolReport'; import CheckItems from './checkItems'; import PlanTemplate from './patrolTemplate'; +import YujingGuanli from './yujingguanli'; -export { PatrolPlan, PatrolReocrd, PatrolReport, CheckItems, PlanTemplate }; \ No newline at end of file +export { PatrolPlan, PatrolReocrd, PatrolReport, CheckItems, PlanTemplate,YujingGuanli }; \ No newline at end of file diff --git a/web/client/src/sections/patrolManage/containers/patrolRecord.js b/web/client/src/sections/patrolManage/containers/patrolRecord.js index aa9c869..f0a76d8 100644 --- a/web/client/src/sections/patrolManage/containers/patrolRecord.js +++ b/web/client/src/sections/patrolManage/containers/patrolRecord.js @@ -182,8 +182,8 @@ const PatrolRecord = (props) => { return {`共${Math.ceil(total / query?.limit)}页,${total}项`} }, onChange: (page, pageSize) => { - setQuery({ limit: pageSize, page: page - 1 }); - record({ limit: pageSize, page: page - 1, ...search, companyId: companyID || search?.companyId }) + setQuery({ limit: pageSize, page: page - 1 }); + record({ limit: pageSize, page: page - 1, ...search, companyId: search?.companyId }) } }} /> diff --git a/web/client/src/sections/patrolManage/containers/patrolReport.js b/web/client/src/sections/patrolManage/containers/patrolReport.js index 7984c5d..04b3510 100644 --- a/web/client/src/sections/patrolManage/containers/patrolReport.js +++ b/web/client/src/sections/patrolManage/containers/patrolReport.js @@ -10,7 +10,7 @@ function patrolReport(props) { const { dispatch } = props; const tableRef = useRef(); const [selectOpts, setSelectOpts] = useState([]); - const [date, setDate] = useState([moment(), moment()]); + const [date, setDate] = useState([moment().subtract(1, 'days'), moment()]); const [dataSource, setDataSource] = useState([]); const qnDomain = localStorage.getItem('qnDomain'); @@ -103,7 +103,7 @@ function patrolReport(props) { total: res.payload.data.count ? res.payload.data.count : 0, }; }} - onReset={() => { setDate([moment(), moment()]) }} + onReset={() => { setDate([moment().subtract(1, 'days'), moment()]) }} /> ) diff --git a/web/client/src/sections/patrolManage/containers/yujingguanli.js b/web/client/src/sections/patrolManage/containers/yujingguanli.js new file mode 100644 index 0000000..8abfafd --- /dev/null +++ b/web/client/src/sections/patrolManage/containers/yujingguanli.js @@ -0,0 +1,217 @@ +import React, { useState, useRef, useEffect } from 'react'; +import { connect } from 'react-redux'; +import { Button, Popconfirm, Tag,Tabs } from 'antd'; +import ProTable from '@ant-design/pro-table'; +import Xiafagaojin from '../components/xiafagaojin'; +import {getDepUser} from '../../organization/actions/user' +import { createPatrolTemplate, delPatrolTemplate, updatePatrolTemplate, getPatrolTemplate } from '../actions/template'; +import { getCheckItemsGroup } from '../actions/checkItems'; +import moment from 'moment'; +function YujingGuanli (props) { + const { dispatch, user,actions,depUser} = props; + const tableRef = useRef(); + const format = 'YYYY-MM-DD HH:mm:ss' + const { patrolManage } = actions + const [dataSource, setDataSource] = useState([{}]); + const [visible, setVisible] = useState(false); + const [type, setType] = useState(); + const [curRecord, setCurRecord] = useState(); + const [data,setdata]= useState([]) + const [tableList, settableList] = useState([]) + const [name, setName] = useState(''); + const [curState, setCurState] = useState('全部'); + const times = [moment().subtract(70, 'years').format(format), moment().format(format)] + const [search, setSearch] = useState({ name: null, time: [times[0], times[1]], state: 'null' }) + const STATE_TEXT = { 1: '待制定计划', 2: '待审核', 3: '计划驳回', 4: '待维修', 5: '待验收', 6: '验收通过', 7: '验收不通过', } + const onChange = (key) => { + console.log(key); + }; + const renderOptionText = (currentState) => { + let text = '待制定计划' + + return STATE_TEXT[currentState] || text + } + const queryData = () => { + dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/true/null`)).then(res => { + if (res.success) { + console.log(res,'水平') + let obj = {} + // res?.payload?.data?.map(i=>{ + // if(obj[i?.points?.project?.id]){ + // // if(obj[i?.points?.project?.id.toString()][i.pointId.toString()]){ + // // obj[i?.points?.project?.id.toString()][i.pointId.toString()].ponintname=i.points?.itemData?.name + // // obj[i?.points?.project?.id.toString()][i.pointId.toString()].num=obj[i?.points?.project?.id.toString()][i.pointId.toString()].num+i?.patrolRecordIssueHandles[0]?.state==6?1:0 + + // // }else{ + // // obj[i?.points?.project?.id.toString()][i.pointId.toString()].ponintname=i.points?.itemData?.name + // // obj[i?.points?.project?.id.toString()][i.pointId.toString()].num=i?.patrolRecordIssueHandles[0]?.state==6?1:0 + // // } + // obj[i?.points?.project?.id]?.push({pointId:i.pointId,pointname:i.points.itemData.name}) + // // i?patrolRecordIssueHandles[0]?.state==6 + // obj[i?.points?.project?.id].num= obj[i?.points?.project?.id].num + i?.patrolRecordIssueHandles[0]?.state==6 ?1:0 + // }else{ + // obj[i?.points?.project?.id]={name:i?.points?.project?.name,num:i?.patrolRecordIssueHandles[0]?.state==6 ?1:0 } + + // } + // console.log(obj,'obj') + // }) + + } + }) + } + console.log(depUser,'depUser') + useEffect(() => { + // dispatch(patrolManage.records(`patrolRecord/all/null/null/true/null`)).then(res=>{ + // let obj = {} + // res?.payload?.data?.map(i=>{ + // if(obj[i?.points?.project?.id]){ + // obj[i?.points?.project?.id].name=i?.points?.project?.name; + // obj[i?.points?.project?.id].num=obj[i?.points?.project?.id].num +1 + // }else{ + // obj[i?.points?.project?.id]={name:i?.points?.project?.name,num:1} + + // } + // }) + + // settableList(name != null ? res.payload.data?.filter(v => + // (v.points.user.name.indexOf(name) != -1 || v.points.project.name.indexOf(name) != -1)) + // .filter(x => curState == '全部' || curState == renderOptionText(x?.patrolRecordIssueHandles[0]?.state)) + // .map(v => ({ ...v, key: v.id })) : res.payload.data?.map(v => ({ ...v, key: v.id }))) + // const t1 = Object.keys(obj).map(i=>{ + // return {id:i,name:obj[i].name,num:obj[i].num} + // }) + // console.log(obj,'obj') + // console.log(res,'res') + // }) + dispatch(getDepUser()) + queryData() + dispatch(getCheckItemsGroup()) + }, []) +console.log(tableList,'tablist') + const columns = [{ + title: '结构物名称', + dataIndex: 'name', + key: 'name', + // search: false, + ellipsis: true, + }, { + title: '点位名称', + dataIndex: 'describe', + key: 'describe', + search: false, + ellipsis: true + }, { + title: '异常次数', + dataIndex: 'user.name', + key: 'user.name', + ellipsis: true, + search: false, + render: (t, r, i) => { + return r.user ? r.user.name : '-' + } + }, { + title: '产生时间', + dataIndex: 'checkItems', + key: 'checkItems', + ellipsis: true, + search: false, + render: (_, r) => { + return r?.checkItems ? r?.checkItems.map(c => {c.name}) : '-' + } + }, { + title: '更新时间', + dataIndex: 'checkItems', + key: 'checkItems', + search: false, + ellipsis: true, + render: (_, r) => { + return r?.checkItems ? r?.checkItems.map(c => {c.name}) : '-' + } + }, { + title: '操作', + dataIndex: 'action', + key: 'action', + search: false, + width: 200, + render: (_, record) => { + return <> + + + + }, + }]; + + return ( + <> + { + const res = await dispatch(getPatrolTemplate(params)); + setDataSource(res?.payload.data?.rows); + return { ...res }; + }} + + // toolBarRender={() => [ + // + // ]} + />, + }, + { + label: `已告警`, + key: '2', + children: `Content of Tab Pane 2`, + } + ]} + /> + { + visible &&depUser.filter(i=>i.username&&i.email).length!==0 ? + i.username&&i.email)} + onCancel={() => { + setVisible(false); + setCurRecord({}) + }} + tableRef={tableRef} + /> : null + } + + ) +} + +function mapStateToProps (state) { + const { auth, global ,depUser} = state + return { + user: auth.user, + actions: global.actions, + depUser: depUser.data || [], + } +} +export default connect(mapStateToProps)(YujingGuanli); diff --git a/web/client/src/sections/patrolManage/nav-item.js b/web/client/src/sections/patrolManage/nav-item.js index 4951534..8dc3592 100644 --- a/web/client/src/sections/patrolManage/nav-item.js +++ b/web/client/src/sections/patrolManage/nav-item.js @@ -26,6 +26,9 @@ export function getNavItem (user, dispatch) { {Func.isAuthorized('CHECKMOULD') && 巡检模板 } + { + 预警管理 + } ); } \ No newline at end of file diff --git a/web/client/src/sections/patrolManage/routes.js b/web/client/src/sections/patrolManage/routes.js index fd8190f..6e4df65 100644 --- a/web/client/src/sections/patrolManage/routes.js +++ b/web/client/src/sections/patrolManage/routes.js @@ -1,5 +1,5 @@ 'use strict'; -import { PatrolPlan, PatrolReocrd, PatrolReport, CheckItems, PlanTemplate } from './containers'; +import { PatrolPlan, PatrolReocrd, PatrolReport, CheckItems, PlanTemplate ,YujingGuanli} from './containers'; export default [{ type: 'inner', @@ -32,6 +32,13 @@ export default [{ key: 'patrolTemplate', component: PlanTemplate, breadcrumb: '巡检模板', - }] + }, + { + path: '/yujingguanli', + key: 'yujingguanli', + component: YujingGuanli, + breadcrumb: '预警管理', + } + ] } }]; \ No newline at end of file diff --git a/web/client/src/sections/shouye/actions/index.js b/web/client/src/sections/shouye/actions/index.js new file mode 100644 index 0000000..e603f22 --- /dev/null +++ b/web/client/src/sections/shouye/actions/index.js @@ -0,0 +1,9 @@ +'use strict'; + + + + +export default { + + +} \ No newline at end of file diff --git a/web/client/src/sections/shouye/containers/index.js b/web/client/src/sections/shouye/containers/index.js new file mode 100644 index 0000000..3923e11 --- /dev/null +++ b/web/client/src/sections/shouye/containers/index.js @@ -0,0 +1,9 @@ +'use strict'; + + + +import Shouye from './shouye' + + + +export { Shouye }; diff --git a/web/client/src/sections/shouye/containers/shouye.js b/web/client/src/sections/shouye/containers/shouye.js new file mode 100644 index 0000000..a07a517 --- /dev/null +++ b/web/client/src/sections/shouye/containers/shouye.js @@ -0,0 +1,62 @@ +import React, { useEffect, useState } from 'react'; +import { connect } from 'react-redux'; +import { Spin, Card, Form, Input, Select, Button, Table, Modal, Popconfirm, Tooltip } from 'antd'; +import moment from "moment"; +import '../style.less'; +import { push } from 'react-router-redux'; +import { Model } from 'echarts'; + + +const Information = (props) => { + const { dispatch, actions, user, loading } = props + const topdata =[] + + + + return ( + <> +
+
+
+
今日巡检
+
0
+
+
+
完成巡检:2个
+
巡检上报:2个
+
+
+
+
+
今日巡检
+
0
+
+
+
完成巡检:2个
+
巡检上报:2个
+
+
+
+
+
今日巡检
+
0
+
+
+
完成巡检:2个
+
巡检上报:2个
+
+
+
+ + ) +} + +function mapStateToProps (state) { + const { auth, global } = state; + return { + user: auth.user, + actions: global.actions, + }; +} + +export default connect(mapStateToProps)(Information); diff --git a/web/client/src/sections/shouye/index.js b/web/client/src/sections/shouye/index.js new file mode 100644 index 0000000..319442b --- /dev/null +++ b/web/client/src/sections/shouye/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: 'shouye', + name: '首页', + reducers: reducers, + routes: routes, + actions: actions, + getNavItem: getNavItem +}; \ No newline at end of file diff --git a/web/client/src/sections/shouye/nav-item.js b/web/client/src/sections/shouye/nav-item.js new file mode 100644 index 0000000..0de1336 --- /dev/null +++ b/web/client/src/sections/shouye/nav-item.js @@ -0,0 +1,21 @@ +import React from 'react'; +import { Link } from 'react-router-dom'; +import { Menu } from 'antd'; +import { SettingOutlined } from '@ant-design/icons'; +import { Func } from '$utils'; +const SubMenu = Menu.SubMenu; + +export function getNavItem (user, dispatch) { + // return } title={'首页'}> + // {/* {Func.isAuthorized('STRU_INFO_CONFIG') && + // 结构物基础信息管理 + // } + // {Func.isAuthorized('QR_CODE_CONFIG') && + // 二维码管理 + // } */} + // + return + 首页 + + +} \ No newline at end of file diff --git a/web/client/src/sections/shouye/reducers/index.js b/web/client/src/sections/shouye/reducers/index.js new file mode 100644 index 0000000..7ed1088 --- /dev/null +++ b/web/client/src/sections/shouye/reducers/index.js @@ -0,0 +1,5 @@ +'use strict'; + +export default { + +} \ No newline at end of file diff --git a/web/client/src/sections/shouye/routes.js b/web/client/src/sections/shouye/routes.js new file mode 100644 index 0000000..73ae24b --- /dev/null +++ b/web/client/src/sections/shouye/routes.js @@ -0,0 +1,32 @@ +'use strict'; +import { Shouye } from './containers'; + +export default [{ + type: 'inner', + route: { + path: '/shouye', + key: 'shouye', + breadcrumb: '首页', + component: Shouye, + // 不设置 component 则面包屑禁止跳转 + // childRoutes: [{ + // path: '/information', + // key: 'information', + // breadcrumb: '结构物基础信息管理', + // component: Information, + // childRoutes: [ { + // path: '/:id', + // key: ':id', + // component: Point, + // breadcrumb: '点位', + // }, + // ] + // }, { + // path: '/qrCode', + // key: 'qrCode', + // component: QrCode, + // breadcrumb: '二维码管理', + // }, + // ] + } +}]; \ No newline at end of file diff --git a/web/client/src/sections/shouye/style.less b/web/client/src/sections/shouye/style.less new file mode 100644 index 0000000..1e0398d --- /dev/null +++ b/web/client/src/sections/shouye/style.less @@ -0,0 +1,20 @@ +.shouyetop{ + display: flex; + justify-content: space-between; + .shouyetopitem{ + width: 25%; + display: flex; + justify-content: space-between; + box-shadow: 0 0 10px #F0F2F5; + border:1px solid #F0F2F5; + color: rgba(0, 0, 0, 0.45); + font-size: 1.875rem; + height: 7.125rem; + .shouyetopitem-left{ + width: 50%; + } + .shouyetopitem-right{ + width: 50%; + } + } +} \ No newline at end of file diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js index 79ad0a1..bcf1c7e 100644 --- a/web/client/src/utils/webapi.js +++ b/web/client/src/utils/webapi.js @@ -64,6 +64,7 @@ export const ApiTable = { delCheckTask: '/delcheckTask/:id', addPatrolRecordIssueHandle: 'patrolRecord/issue/handle', modifyPatrolRecordIssueHandle: 'patrolRecord/issue/handle/{id}', + yujingguanli:'/yujingguanli', //协调申请 getCoordinateList: 'risk/coordinate',