From fb6076bb6f7ccecf0c5e7165c3a886fab9559737 Mon Sep 17 00:00:00 2001 From: wenlele Date: Mon, 14 Aug 2023 11:04:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=A8=E6=9C=9F=E8=AE=A1=E5=88=92=E5=92=8C?= =?UTF-8?q?=E5=93=8D=E5=BA=94=E8=AE=B0=E5=BD=95=E5=8A=9F=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/.vscode/launch.json | 10 +- .../lib/controllers/maintenancePlan/index.js | 30 +- api/app/lib/controllers/record/index.js | 56 +- api/app/lib/index.js | 3 +- api/app/lib/models/maintenance_plan.js | 176 ++++--- api/app/lib/models/maintenance_record.js | 157 +++--- api/app/lib/routes/record/index.js | 4 + .../0.29/schema/update_maintenance_plan.sql | 14 + .../means/containers/devOpsStandard.jsx | 84 +-- .../means/containers/faultInformation.jsx | 60 ++- .../means/containers/projectMeans.jsx | 65 ++- .../sections/means/containers/repairFQA.jsx | 61 ++- .../src/sections/means/containers/style.less | 2 +- web/client/src/sections/means/nav-item.jsx | 24 +- web/client/src/sections/means/routes.js | 32 +- web/client/src/sections/means/style.less | 4 +- .../src/sections/service/actions/record.js | 20 +- .../service/components/cycAddmodal.jsx | 172 +++--- .../service/components/planAddmodal.jsx | 87 ++++ .../service/components/recordModal.jsx | 282 +++++----- .../sections/service/containers/cyclePlan.jsx | 276 +++++----- .../service/containers/maintenanceRecords.jsx | 441 ++++++++-------- .../service/containers/serviceRecord.jsx | 492 +++++++++++------- web/client/src/utils/webapi.js | 5 +- 24 files changed, 1540 insertions(+), 1017 deletions(-) create mode 100644 script/0.29/schema/update_maintenance_plan.sql create mode 100644 web/client/src/sections/service/components/planAddmodal.jsx diff --git a/api/.vscode/launch.json b/api/.vscode/launch.json index f007490..0c90e89 100644 --- a/api/.vscode/launch.json +++ b/api/.vscode/launch.json @@ -42,13 +42,13 @@ // "--qndmn http://resources.anxinyun.cn", // "--qndmn http://rhvqdivo5.hn-bkt.clouddn.com", // click 开发 - // "--clickHouseUrl http://10.8.30.71", - // "--clickHousePort 8123", + "--clickHouseUrl http://10.8.30.71", + "--clickHousePort 30123", // click 测试 // "--clickHouseUrl http://10.8.30.161", // "--clickHousePort 30123", - "--clickHouseUrl http://10.8.30.156", - "--clickHousePort 8123", + // "--clickHouseUrl http://10.8.30.156", + // "--clickHousePort 8123", // "--clickHouseUrl https://clickhouse01.anxinyun.cn/play", // click 测试 @@ -66,7 +66,7 @@ // "--clickHouseDataAlarm default", // "--clickHouseIot iot", // 测试 - "--clickHouseAnxincloud anxinyun888", + "--clickHouseAnxincloud anxinyun1", "--clickHousePepEmis pepca8", "--clickHouseProjectManage peppm8", "--clickHouseVcmp video_access_dev", diff --git a/api/app/lib/controllers/maintenancePlan/index.js b/api/app/lib/controllers/maintenancePlan/index.js index de93934..cac4467 100644 --- a/api/app/lib/controllers/maintenancePlan/index.js +++ b/api/app/lib/controllers/maintenancePlan/index.js @@ -2,27 +2,34 @@ //维护计划 -async function getMaintenancePlan(ctx) { +async function getMaintenancePlan (ctx) { const query = ctx.query try { + const { models } = ctx.fs.dc const { clickHouse } = ctx.app.fs //console.log('11121', query) let resCount = await models.MaintenancePlan.count({ where: { type: query.type } }) - const res = await models.MaintenancePlan.findAndCount({ + let option = { order: [['id', 'DESC']], - offset: (query.pageIndex - 1) * query.pageSize, - - limit: query.pageSize, - attributes: ['id', 'missionName', 'remark', 'reason', 'planFinishTime', 'actualFinishTime', 'type', 'state'], + attributes: ['id', 'missionName', 'remark', 'reason', 'planFinishTime', 'actualFinishTime', 'type', 'state', 'recordId'], where: { type: query.type }, include: [{ attributes: ['id', 'maintenancePlanId', 'pepUserId'], model: models.MaintenancePlanExecuteUser }] - }) + } + if (query.pageIndex && query.pageSize) { + option.offset = (query.pageIndex - 1) * query.pageSize + option.limit = query.pageSize + } + + if (query.recordId) { + option.where.recordId = { $contains: [query.recordId] } + } + const res = await models.MaintenancePlan.findAndCount(option) //console.log('res1', res) const arrayUserId = [] if (res.rows.length > 0) { @@ -44,6 +51,7 @@ async function getMaintenancePlan(ctx) { actualFinishTime: item.actualFinishTime, type: item.type, state: item.state, + recordId: item.recordId, maintenancePlanExecuteUsers: item.maintenancePlanExecuteUsers.map((item1) => { const nameArr = userRes.find((ac) => { return ac.id == item1.pepUserId }) @@ -76,7 +84,7 @@ async function getMaintenancePlan(ctx) { } -async function delMaintenancePlan(ctx) { +async function delMaintenancePlan (ctx) { const transaction = await ctx.fs.dc.orm.transaction(); try { const { models } = ctx.fs.dc @@ -98,7 +106,7 @@ async function delMaintenancePlan(ctx) { } } -async function editMaintenancePlan(ctx) { +async function editMaintenancePlan (ctx) { const data = ctx.request.body const transaction = await ctx.fs.dc.orm.transaction(); try { @@ -112,6 +120,7 @@ async function editMaintenancePlan(ctx) { missionName: data.missionName, remark: data.remark, reason: data.reason, + recordId: data.recordId, planFinishTime: data.planFinishTime, state: data.state }, { where: { id: data.id } }) @@ -120,6 +129,7 @@ async function editMaintenancePlan(ctx) { actualFinishTime: data.actualFinishTime, missionName: data.missionName, remark: data.remark, + recordId: data.recordId, planFinishTime: data.planFinishTime, state: data.state }, { where: { id: data.id } }) @@ -143,6 +153,7 @@ async function editMaintenancePlan(ctx) { reason: data.reason, planFinishTime: data.planFinishTime, type: data.type, + recordId: data.recordId, state: data.state }) //console.log('data.manger',data.manger) @@ -159,6 +170,7 @@ async function editMaintenancePlan(ctx) { missionName: data.missionName, remark: data.remark, planFinishTime: data.planFinishTime, + recordId: data.recordId, type: data.type, state: data.state }) diff --git a/api/app/lib/controllers/record/index.js b/api/app/lib/controllers/record/index.js index 7f37144..480188c 100644 --- a/api/app/lib/controllers/record/index.js +++ b/api/app/lib/controllers/record/index.js @@ -1,11 +1,12 @@ 'use strict'; const moment = require('moment'); -async function getRecord(ctx) { +async function getRecord (ctx) { try { const { redis } = ctx.app const { models } = ctx.fs.dc; const sequelize = ctx.fs.dc.ORM; + const { clickHouse } = ctx.app.fs const { startTime, endTime, pageSize, pageIndex } = ctx.query console.log('queryz', ctx.query) @@ -19,7 +20,7 @@ async function getRecord(ctx) { }) let recordRes = await models.MaintenanceRecord.findAndCountAll({ order: [['id', 'DESC']], - attributes: ['id', 'sketch', 'occurrenceTime', 'solvingTime', 'interruptDuration', 'type', 'record'], + attributes: ['id', 'sketch', 'occurrenceTime', 'solvingTime', 'interruptDuration', 'type', 'record','files'], offset: (pageIndex - 1) * pageSize, limit: pageSize, where: { @@ -35,7 +36,11 @@ async function getRecord(ctx) { }) //console.log('recordRes', recordRes) const arrayUserId = [] - recordRes.rows.forEach((item) => { item.maintenanceRecordExecuteUsers.forEach((item1) => { arrayUserId.push(item1.pepUserId) }) }) + const recordId = [] + recordRes.rows.forEach((item) => { + recordId.push(item.id) + item.maintenanceRecordExecuteUsers.forEach((item1) => { arrayUserId.push(item1.pepUserId) }) + }) const arrayUserIdCopy = [...new Set(arrayUserId)] // console.log('(' + arrayUserIdCopy.toString() + ')', '22222') let userRes = await redis.get('allUser') @@ -44,7 +49,12 @@ async function getRecord(ctx) { return arrayUserIdCopy.some((children) => { return children == item.id }) }) //console.log('userRes', userRes) - const res = recordRes.rows.map((item) => { + let planList = await models.MaintenancePlan.findAll({ + where: { recordId: { $overlap: recordId } }, + }) + + + const res = await recordRes.rows.map((item) => { return { id: item.id, interruptDuration: item.interruptDuration, @@ -53,6 +63,8 @@ async function getRecord(ctx) { sketch: item.sketch, solvingTime: item.solvingTime, type: item.type, + files: item.files || null, + planList: planList.filter(v => v.recordId && v.recordId.includes(item.id)) || [], maintenanceRecordExecuteUsers: item.maintenanceRecordExecuteUsers.map((item1) => { const userArr = userRes.find((ac) => { return ac.id == item1.pepUserId }) @@ -67,7 +79,7 @@ async function getRecord(ctx) { } ) //console.log('res1', res) - ctx.body = { count: resCount, res } + ctx.body = { count: resCount, res: res } ctx.status = 200 } catch (error) { ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); @@ -78,18 +90,18 @@ async function getRecord(ctx) { } } //新增和编辑服务记录 -async function addRecord(ctx) { +async function addRecord (ctx) { const transaction = await ctx.fs.dc.orm.transaction(); const { models } = ctx.fs.dc const params = ctx.request.body - const { solvingTime, occurrencTime, sketch, record, settler, type, id, msg } = params + const { solvingTime, occurrencTime, sketch, record, settler, type, id, msg, files } = params const breakTime = (Date.parse(solvingTime) - Date.parse(occurrencTime)) / 1000 try { //中断时长 //console.log('resss1', Date.parse(solvingTime), occurrencTime) if (id) { await models.MaintenanceRecord.update({ - solvingTime, occurrenceTime: occurrencTime, sketch, record, settler, type, interruptDuration: breakTime + solvingTime, occurrenceTime: occurrencTime, sketch, record, settler, type, interruptDuration: breakTime, files: files }, { where: { id } }) await models.MaintenanceRecordExecuteUser.destroy({ where: { maintenanceRecordId: id } }) const resArry = settler.map((item) => { @@ -99,7 +111,7 @@ async function addRecord(ctx) { }) await models.MaintenanceRecordExecuteUser.bulkCreate(resArry) } else { - const aa = await models.MaintenanceRecord.create({ solvingTime, occurrenceTime: occurrencTime, sketch, record, settler, type, interruptDuration: breakTime }) + const aa = await models.MaintenanceRecord.create({ solvingTime, occurrenceTime: occurrencTime, sketch, record, settler, type, interruptDuration: breakTime,files: files }) const recordId = aa.id const resArry = settler.map((item) => { return { @@ -122,7 +134,7 @@ async function addRecord(ctx) { } } //删除服务记录 -async function delRecord(ctx) { +async function delRecord (ctx) { const transaction = await ctx.fs.dc.orm.transaction(); const { models } = ctx.fs.dc const params = ctx.params @@ -143,7 +155,29 @@ async function delRecord(ctx) { } +async function respondRecord (ctx) { + try { + const { models } = ctx.fs.dc; + let res = await models.MaintenanceRecord.findAll({ + order: [['id', 'DESC']], + attributes: ['id', 'sketch', 'occurrenceTime'], + }) + ctx.body = res + ctx.status = 200 + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { + message: '获取响应记录数据失败' + } + } +} + + module.exports = { - getRecord, addRecord, delRecord + getRecord, + addRecord, + delRecord, + respondRecord }; \ No newline at end of file diff --git a/api/app/lib/index.js b/api/app/lib/index.js index 1baeb69..8b12b65 100644 --- a/api/app/lib/index.js +++ b/api/app/lib/index.js @@ -61,7 +61,7 @@ module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Seq AppInspection, ProjectApp, ProjectCorrelation, AppAlarm, App, AlarmAppearRecord, AlarmConfirmLog, EmailSendLog, LatestDynamicList, AlarmPushConfig, MaintenanceRecord, MaintenanceRecordExecuteUser, MaintenancePlanExecuteUser, MaintenancePlan, EquipmentMaintenanceRecord, EquipmentMaintenanceRecordProject, EquipmentMaintenanceRecordExecuteUser, ServerMaintenanceRecordRepairman, ServerMaintenanceRecord, - AlarmDataContinuityType, AlarmDataContinuity + AlarmDataContinuityType, AlarmDataContinuity, } = dc.models; AppInspection.belongsTo(App, { foreignKey: 'projectAppId', targetKey: 'id' }); @@ -112,6 +112,7 @@ module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Seq MaintenanceRecordExecuteUser.belongsTo(MaintenanceRecord, { foreignKey: 'maintenanceRecordId', targetKey: 'id' }) MaintenanceRecord.hasMany(MaintenanceRecordExecuteUser, { foreignKey: 'maintenanceRecordId', targetKey: 'id' }) + MaintenanceRecord.hasMany(MaintenanceRecordExecuteUser, { foreignKey: 'maintenanceRecordId', targetKey: 'id' }) MaintenancePlanExecuteUser.belongsTo(MaintenancePlan, { foreignKey: 'maintenancePlanId', targetKey: 'id' }) MaintenancePlan.hasMany(MaintenancePlanExecuteUser, { foreignKey: 'maintenancePlanId', targetKey: 'id' }) diff --git a/api/app/lib/models/maintenance_plan.js b/api/app/lib/models/maintenance_plan.js index d5a381f..49d88b0 100644 --- a/api/app/lib/models/maintenance_plan.js +++ b/api/app/lib/models/maintenance_plan.js @@ -3,87 +3,97 @@ 'use strict'; module.exports = dc => { - const DataTypes = dc.ORM; - const sequelize = dc.orm; - const MaintenancePlan = sequelize.define("maintenancePlan", { - id: { - type: DataTypes.INTEGER, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: true, - field: "id", - autoIncrement: true, - unique: "maintenance_plan_id_uindex" - }, - missionName: { - type: DataTypes.STRING, - allowNull: false, - defaultValue: null, - comment: "任务名称", - primaryKey: false, - field: "mission_name", - autoIncrement: false - }, - remark: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: "备注", - primaryKey: false, - field: "remark", - autoIncrement: false - }, - reason: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: "操作/故障原因", - primaryKey: false, - field: "reason", - autoIncrement: false - }, - planFinishTime: { - type: DataTypes.DATE, - allowNull: true, - defaultValue: null, - comment: "计划完成时间", - primaryKey: false, - field: "plan_finish_time", - autoIncrement: false - }, - actualFinishTime: { - type: DataTypes.DATE, - allowNull: true, - defaultValue: null, - comment: "实际完成时间\n", - primaryKey: false, - field: "actual_finish_time", - autoIncrement: false - }, - type: { - type: DataTypes.STRING, - allowNull: false, - defaultValue: null, - comment: "分类 period 周期 / temp 临时", - primaryKey: false, - field: "type", - autoIncrement: false - }, - state: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: "完成状态 unfinished 未完成 / underway 进行中 / completed 已完成 / suspend 挂起暂停 / inspected 已检查", - primaryKey: false, - field: "state", - autoIncrement: false - } - }, { - tableName: "maintenance_plan", - comment: "", - indexes: [] - }); - dc.models.MaintenancePlan = MaintenancePlan; - return MaintenancePlan; + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const MaintenancePlan = sequelize.define("maintenancePlan", { + id: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: true, + field: "id", + autoIncrement: true, + unique: "maintenance_plan_id_uindex" + }, + missionName: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: "任务名称", + primaryKey: false, + field: "mission_name", + autoIncrement: false + }, + remark: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "备注", + primaryKey: false, + field: "remark", + autoIncrement: false + }, + reason: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "操作/故障原因", + primaryKey: false, + field: "reason", + autoIncrement: false + }, + planFinishTime: { + type: DataTypes.DATE, + allowNull: true, + defaultValue: null, + comment: "计划完成时间", + primaryKey: false, + field: "plan_finish_time", + autoIncrement: false + }, + actualFinishTime: { + type: DataTypes.DATE, + allowNull: true, + defaultValue: null, + comment: "实际完成时间\n", + primaryKey: false, + field: "actual_finish_time", + autoIncrement: false + }, + type: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: "分类 period 周期 / temp 临时", + primaryKey: false, + field: "type", + autoIncrement: false + }, + state: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "完成状态 unfinished 未完成 / underway 进行中 / completed 已完成 / suspend 挂起暂停 / inspected 已检查", + primaryKey: false, + field: "state", + autoIncrement: false + }, + recordId: { + type: DataTypes.ARRAY(DataTypes.INTEGER), + allowNull: true, + defaultValue: null, + comment: "响应记录id", + primaryKey: false, + field: "record_id", + autoIncrement: false + } + + }, { + tableName: "maintenance_plan", + comment: "", + indexes: [] + }); + dc.models.MaintenancePlan = MaintenancePlan; + return MaintenancePlan; }; \ No newline at end of file diff --git a/api/app/lib/models/maintenance_record.js b/api/app/lib/models/maintenance_record.js index c286827..c438a38 100644 --- a/api/app/lib/models/maintenance_record.js +++ b/api/app/lib/models/maintenance_record.js @@ -3,78 +3,87 @@ 'use strict'; module.exports = dc => { - const DataTypes = dc.ORM; - const sequelize = dc.orm; - const MaintenanceRecord = sequelize.define("maintenanceRecord", { - id: { - type: DataTypes.INTEGER, - allowNull: false, - defaultValue: null, - comment: null, - primaryKey: true, - field: "id", - autoIncrement: true, - unique: "maintenance_record_id_uindex" - }, - sketch: { - type: DataTypes.STRING, - allowNull: false, - defaultValue: null, - comment: "简述", - primaryKey: false, - field: "sketch", - autoIncrement: false - }, - occurrenceTime: { - type: DataTypes.DATE, - allowNull: true, - defaultValue: null, - comment: "发生时间", - primaryKey: false, - field: "occurrence_time", - autoIncrement: false - }, - solvingTime: { - type: DataTypes.DATE, - allowNull: true, - defaultValue: null, - comment: "解决时间", - primaryKey: false, - field: "solving_time", - autoIncrement: false - }, - interruptDuration: { - type: DataTypes.INTEGER, - allowNull: true, - defaultValue: null, - comment: "中断时长 / 秒", - primaryKey: false, - field: "interrupt_duration", - autoIncrement: false - }, - type: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: "故障类型", - primaryKey: false, - field: "type", - autoIncrement: false - }, - record: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: "故障记录", - primaryKey: false, - field: "record", - autoIncrement: false - } - }, { - tableName: "maintenance_record", - comment: "", - indexes: [] - }); - dc.models.MaintenanceRecord = MaintenanceRecord; - return MaintenanceRecord; + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const MaintenanceRecord = sequelize.define("maintenanceRecord", { + id: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: true, + field: "id", + autoIncrement: true, + unique: "maintenance_record_id_uindex" + }, + sketch: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: "简述", + primaryKey: false, + field: "sketch", + autoIncrement: false + }, + occurrenceTime: { + type: DataTypes.DATE, + allowNull: true, + defaultValue: null, + comment: "发生时间", + primaryKey: false, + field: "occurrence_time", + autoIncrement: false + }, + solvingTime: { + type: DataTypes.DATE, + allowNull: true, + defaultValue: null, + comment: "解决时间", + primaryKey: false, + field: "solving_time", + autoIncrement: false + }, + interruptDuration: { + type: DataTypes.INTEGER, + allowNull: true, + defaultValue: null, + comment: "中断时长 / 秒", + primaryKey: false, + field: "interrupt_duration", + autoIncrement: false + }, + type: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "故障类型", + primaryKey: false, + field: "type", + autoIncrement: false + }, + record: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: "故障记录", + primaryKey: false, + field: "record", + autoIncrement: false + }, + files: { + type: DataTypes.JSONB, + allowNull: true, + defaultValue: null, + comment: "文件", + primaryKey: false, + field: "files", + autoIncrement: false + }, + }, { + tableName: "maintenance_record", + comment: "", + indexes: [] + }); + dc.models.MaintenanceRecord = MaintenanceRecord; + return MaintenanceRecord; }; \ No newline at end of file diff --git a/api/app/lib/routes/record/index.js b/api/app/lib/routes/record/index.js index 14ecba6..a6121a6 100644 --- a/api/app/lib/routes/record/index.js +++ b/api/app/lib/routes/record/index.js @@ -12,4 +12,8 @@ module.exports = function (app, router, opts) { app.fs.api.logAttr['DEL/record/:id'] = { content: '删除服务记录', visible: true }; router.del('/record/:id', record.delRecord); + + app.fs.api.logAttr['GET/respond-record'] = { content: '获取响应记录数据', visible: true }; + router.get('/respond-record', record.respondRecord); + }; \ No newline at end of file diff --git a/script/0.29/schema/update_maintenance_plan.sql b/script/0.29/schema/update_maintenance_plan.sql new file mode 100644 index 0000000..bc068ef --- /dev/null +++ b/script/0.29/schema/update_maintenance_plan.sql @@ -0,0 +1,14 @@ +alter table maintenance_plan + add record_id integer[]; + +comment on column maintenance_plan.record_id is '响应记录id'; + + + +alter table maintenance_record + add files jsonb; + +comment on column maintenance_record.files is '文件'; + + + diff --git a/web/client/src/sections/means/containers/devOpsStandard.jsx b/web/client/src/sections/means/containers/devOpsStandard.jsx index 29c79e4..1c827cc 100644 --- a/web/client/src/sections/means/containers/devOpsStandard.jsx +++ b/web/client/src/sections/means/containers/devOpsStandard.jsx @@ -3,12 +3,15 @@ import { connect } from 'react-redux'; import { Input, Button, Tree, Modal, Table, Upload, Pagination, Popconfirm } from '@douyinfe/semi-ui'; import { IconDeleteStroked, IconEditStroked, IconUpload, IconAlertCircle, IconSearch } from '@douyinfe/semi-icons'; import SimpleBar from 'simplebar-react'; +import PerfectScrollbar from "perfect-scrollbar"; import FileModal from '../components/fileModal'; import moment from 'moment'; import './style.less' - +let itemList +let folderList +let tableList const Rest = (props) => { const { dispatch, actions, user, qiniu, loading, clientHeight, overallProjectId, apiRoot } = props const { install, means } = actions @@ -44,8 +47,42 @@ const Rest = (props) => { })) // setPepProjectId(data[0]?.pepProjectId) fileList(null) + + const domItem = document.getElementById("itemList"); + if (domItem) { + itemList = new PerfectScrollbar("#itemList", { + suppressScrollX: true, + }); + } + const domFolder = document.getElementById("folderList"); + if (domFolder) { + folderList = new PerfectScrollbar("#folderList", { + suppressScrollX: true, + }); + } + const domTable = document.getElementById("tableList"); + if (domTable) { + tableList = new PerfectScrollbar("#tableList", { + suppressScrollX: true, + }); + } }, []) + useEffect(() => { + const domItem = document.getElementById("itemList"); + if (domItem && itemList) { + itemList.update(); + } + const domFolder = document.getElementById("folderList"); + if (domFolder && folderList) { + folderList.update(); + } + const domTable = document.getElementById("tableList"); + if (domTable && tableList) { + tableList.update(); + } + }) + useEffect(() => { let data if (overallProjectId) { @@ -236,29 +273,6 @@ const Rest = (props) => { } }, ] - const data = [ - { - key: '1', - name: 'John Brown', - age: 32, - address: 'New York No. 1 Lake Park', - tags: ['nice', 'developer'], - }, - { - key: '2', - name: 'Jim Green', - age: 42, - address: 'London No. 1 Lake Park', - tags: ['loser'], - }, - { - key: '3', - name: 'Joe Black', - age: 32, - address: 'Sydney No. 1 Lake Park', - tags: ['cool', 'teacher'], - }, - ]; const preview = (url) => { let link = encodeURI(`${qiniu}/${url}`) @@ -278,7 +292,8 @@ const Rest = (props) => {
setProjectSearch(v)} /> - + {/* */} +
{ setPepProjectId(null) @@ -302,7 +317,9 @@ const Rest = (props) => {
})} - +
+ + {/*
*/}
@@ -330,7 +347,8 @@ const Rest = (props) => { }} /> : "" } - + {/* */} +
{ setFileSearch('') }} /> - +
+ + + {/*
*/}
{/* 表格 */} @@ -428,7 +449,9 @@ const Rest = (props) => { } - + {/* */} +
+ { // }, // }} /> - + + {/* */} {count > 0 ?
diff --git a/web/client/src/sections/means/containers/faultInformation.jsx b/web/client/src/sections/means/containers/faultInformation.jsx index d628805..3f1a1db 100644 --- a/web/client/src/sections/means/containers/faultInformation.jsx +++ b/web/client/src/sections/means/containers/faultInformation.jsx @@ -3,12 +3,15 @@ import { connect } from 'react-redux'; import { Input, Button, Tree, Modal, Table, Upload, Pagination, Popconfirm } from '@douyinfe/semi-ui'; import { IconDeleteStroked, IconEditStroked, IconUpload, IconAlertCircle, IconSearch } from '@douyinfe/semi-icons'; import SimpleBar from 'simplebar-react'; +import PerfectScrollbar from "perfect-scrollbar"; import FileModal from '../components/fileModal'; import moment from 'moment'; import './style.less' - +let itemList +let folderList +let tableList const Rest = (props) => { const { dispatch, actions, user, qiniu, loading, clientHeight, overallProjectId, apiRoot } = props const { install, means } = actions @@ -43,8 +46,42 @@ const Rest = (props) => { })) // setPepProjectId(data[0]?.pepProjectId) fileList(null) + + const domItem = document.getElementById("itemList"); + if (domItem) { + itemList = new PerfectScrollbar("#itemList", { + suppressScrollX: true, + }); + } + const domFolder = document.getElementById("folderList"); + if (domFolder) { + folderList = new PerfectScrollbar("#folderList", { + suppressScrollX: true, + }); + } + const domTable = document.getElementById("tableList"); + if (domTable) { + tableList = new PerfectScrollbar("#tableList", { + suppressScrollX: true, + }); + } }, []) + useEffect(() => { + const domItem = document.getElementById("itemList"); + if (domItem && itemList) { + itemList.update(); + } + const domFolder = document.getElementById("folderList"); + if (domFolder && folderList) { + folderList.update(); + } + const domTable = document.getElementById("tableList"); + if (domTable && tableList) { + tableList.update(); + } + }) + useEffect(() => { let data if (overallProjectId) { @@ -277,7 +314,9 @@ const Rest = (props) => {
setProjectSearch(v)} /> - + {/* */} +
+
{ setPepProjectId(null) @@ -301,7 +340,8 @@ const Rest = (props) => {
})} - + {/* */} +
@@ -329,7 +369,9 @@ const Rest = (props) => { }} /> : "" } - + {/* */} +
+ { setFileSearch('') }} /> - + {/* */} +
{/* 表格 */}
{ }
- + {/* */} +
+
{ // }, // }} /> - + {/* */} + {count > 0 ?
diff --git a/web/client/src/sections/means/containers/projectMeans.jsx b/web/client/src/sections/means/containers/projectMeans.jsx index ee3e773..4f83dad 100644 --- a/web/client/src/sections/means/containers/projectMeans.jsx +++ b/web/client/src/sections/means/containers/projectMeans.jsx @@ -3,14 +3,17 @@ import { connect } from 'react-redux'; import { Input, Button, Tree, Modal, Table, Upload, Pagination, Popconfirm } from '@douyinfe/semi-ui'; import { IconDeleteStroked, IconEditStroked, IconUpload, IconAlertCircle, IconSearch } from '@douyinfe/semi-icons'; import SimpleBar from 'simplebar-react'; +import PerfectScrollbar from "perfect-scrollbar"; import FileModal from '../components/fileModal'; import moment from 'moment'; import './style.less' - +let itemList +let folderList +let tableList const Rest = (props) => { - const { dispatch, actions, user, qiniu, loading, clientHeight, overallProjectId ,apiRoot} = props + const { dispatch, actions, user, qiniu, loading, clientHeight, overallProjectId, apiRoot } = props const { install, means } = actions const [pomsList, setPomsList] = useState([]); //项目 const [showPomsList, setShowPomsList] = useState([]); //项目 @@ -44,8 +47,43 @@ const Rest = (props) => { } })) + fileList(null) + + const domItem = document.getElementById("itemList"); + if (domItem) { + itemList = new PerfectScrollbar("#itemList", { + suppressScrollX: true, + }); + } + const domFolder = document.getElementById("folderList"); + if (domFolder) { + folderList = new PerfectScrollbar("#folderList", { + suppressScrollX: true, + }); + } + const domTable = document.getElementById("tableList"); + if (domTable) { + tableList = new PerfectScrollbar("#tableList", { + suppressScrollX: true, + }); + } }, []) + useEffect(() => { + const domItem = document.getElementById("itemList"); + if (domItem && itemList) { + itemList.update(); + } + const domFolder = document.getElementById("folderList"); + if (domFolder && folderList) { + folderList.update(); + } + const domTable = document.getElementById("tableList"); + if (domTable && tableList) { + tableList.update(); + } + }) + useEffect(() => { let data if (overallProjectId) { @@ -278,7 +316,8 @@ const Rest = (props) => {
setProjectSearch(v)} /> - + {/* */} +
{showPomsList?.map(v => { return
{ @@ -292,7 +331,8 @@ const Rest = (props) => {
})} - + {/* */} +
@@ -320,7 +360,9 @@ const Rest = (props) => { }} /> : "" } - + {/* */} +
+ { setFileSearch('') }} /> - - + {/* */} +
{/* 表格 */}
{ }
- + {/* */} +
+
{ // }, // }} /> - + + {/* */} {count > 0 ?
@@ -559,7 +604,7 @@ function mapStateToProps (state) { // socket: webSocket.socket clientHeight: global.clientHeight, qiniu: global.qiniu?.domain, - apiRoot:global.apiRoot + apiRoot: global.apiRoot }; } diff --git a/web/client/src/sections/means/containers/repairFQA.jsx b/web/client/src/sections/means/containers/repairFQA.jsx index 076caa4..c7040a5 100644 --- a/web/client/src/sections/means/containers/repairFQA.jsx +++ b/web/client/src/sections/means/containers/repairFQA.jsx @@ -3,12 +3,15 @@ import { connect } from 'react-redux'; import { Input, Button, Tree, Modal, Table, Upload, Pagination, Popconfirm } from '@douyinfe/semi-ui'; import { IconDeleteStroked, IconEditStroked, IconUpload, IconAlertCircle, IconSearch } from '@douyinfe/semi-icons'; import SimpleBar from 'simplebar-react'; +import PerfectScrollbar from "perfect-scrollbar"; import FileModal from '../components/fileModal'; import moment from 'moment'; import './style.less' - +let itemList +let folderList +let tableList const Rest = (props) => { const { dispatch, actions, user, qiniu, loading, clientHeight, overallProjectId, apiRoot } = props const { install, means } = actions @@ -43,8 +46,42 @@ const Rest = (props) => { })) // setPepProjectId(data[0]?.pepProjectId) fileList(null) + + const domItem = document.getElementById("itemList"); + if (domItem) { + itemList = new PerfectScrollbar("#itemList", { + suppressScrollX: true, + }); + } + const domFolder = document.getElementById("folderList"); + if (domFolder) { + folderList = new PerfectScrollbar("#folderList", { + suppressScrollX: true, + }); + } + const domTable = document.getElementById("tableList"); + if (domTable) { + tableList = new PerfectScrollbar("#tableList", { + suppressScrollX: true, + }); + } }, []) + useEffect(() => { + const domItem = document.getElementById("itemList"); + if (domItem && itemList) { + itemList.update(); + } + const domFolder = document.getElementById("folderList"); + if (domFolder && folderList) { + folderList.update(); + } + const domTable = document.getElementById("tableList"); + if (domTable && tableList) { + tableList.update(); + } + }) + useEffect(() => { let data if (overallProjectId) { @@ -277,7 +314,9 @@ const Rest = (props) => {
setProjectSearch(v)} /> - + {/* */} +
+
{ setPepProjectId(null) @@ -302,7 +341,8 @@ const Rest = (props) => {
})} - + {/* */} +
@@ -330,7 +370,9 @@ const Rest = (props) => { }} /> : "" } - + {/* */} +
+ { setFileSearch('') }} /> - - + {/* */} +
{/* 表格 */}
{ }
- + {/* */} +
+
{ // }, // }} /> - + + {/* */} {count > 0 ?
diff --git a/web/client/src/sections/means/containers/style.less b/web/client/src/sections/means/containers/style.less index 9b6c5f5..67aae48 100644 --- a/web/client/src/sections/means/containers/style.less +++ b/web/client/src/sections/means/containers/style.less @@ -6,4 +6,4 @@ .tip{ display: inline-block; } -} \ No newline at end of file +} diff --git a/web/client/src/sections/means/nav-item.jsx b/web/client/src/sections/means/nav-item.jsx index d03a462..3198b2d 100644 --- a/web/client/src/sections/means/nav-item.jsx +++ b/web/client/src/sections/means/nav-item.jsx @@ -10,36 +10,36 @@ export function getNavItem (user, dispatch) { icon: , items: [ { - itemKey: 'projectMeans', + itemKey: 'project', text: '项目资料', icon: , - to: '/means/projectMeans/projectMeans1', + to: '/means/project/projectMeans', items: [{ - itemKey: 'projectMeans1', to: '/means/projectMeans/projectMeans1', text: '项目资料' + itemKey: 'projectMeans', to: '/means/project/projectMeans', text: '项目资料' }] }, { - itemKey: 'repairFQA', + itemKey: 'repair', text: '维修FAQ', icon: , - to: '/means/repairFQA/repairFQA1', + to: '/means/repair/repairFQA', items: [{ - itemKey: 'repairFQA1', to: '/means/repairFQA/repairFQA1', text: '维修FAQ' + itemKey: 'repairFQA', to: '/means/repair/repairFQA', text: '维修FAQ' }] }, { - itemKey: 'faultInformation', + itemKey: 'fault', text: '故障资料', icon: , - to: '/means/faultInformation/faultInformation1', + to: '/means/fault/faultInformation', items: [{ - itemKey: 'faultInformation1', to: '/means/faultInformation/faultInformation1', text: '故障资料' + itemKey: 'faultInformation', to: '/means/fault/faultInformation', text: '故障资料' }] }, { - itemKey: 'devOpsStandard', + itemKey: 'standard', text: '运维规范', icon: , - to: '/means/devOpsStandard/devOpsStandard1', + to: '/means/standard/devOpsStandard', items: [{ - itemKey: 'devOpsStandard1', to: '/means/devOpsStandard/devOpsStandard1', text: '运维规范' + itemKey: 'devOpsStandard', to: '/means/standard/devOpsStandard', text: '运维规范' }] } ] diff --git a/web/client/src/sections/means/routes.js b/web/client/src/sections/means/routes.js index e17d047..0ee6c31 100644 --- a/web/client/src/sections/means/routes.js +++ b/web/client/src/sections/means/routes.js @@ -8,42 +8,42 @@ export default [{ breadcrumb: '资料', // 不设置 component 则面包屑禁止跳转 childRoutes: [{ - path: '/projectMeans', - key: 'projectMeans', + path: '/project', + key: 'project', breadcrumb: '项目资料', childRoutes: [{ - path: '/projectMeans1', - key: 'projectMeans1', + path: '/projectMeans', + key: 'projectMeans', component: ProjectMeans, breadcrumb: '项目资料', }] }, { - path: '/repairFQA', - key: 'repairFQA', + path: '/repair', + key: 'repair', breadcrumb: '维修FAQ', childRoutes: [{ - path: '/repairFQA1', - key: 'repairFQA1', + path: '/repairFQA', + key: 'repairFQA', component: RepairFQA, breadcrumb: '维修FAQ', }] }, { - path: '/faultInformation', - key: 'faultInformation', + path: '/fault', + key: 'fault', breadcrumb: '故障资料', childRoutes: [{ - path: '/faultInformation1', - key: 'faultInformation1', + path: '/faultInformation', + key: 'faultInformation', component: FaultInformation, breadcrumb: '故障资料', }] }, { - path: '/devOpsStandard', - key: 'devOpsStandard', + path: '/standard', + key: 'standard', breadcrumb: '运维规范', childRoutes: [{ - path: '/devOpsStandard1', - key: 'devOpsStandard1', + path: '/devOpsStandard', + key: 'devOpsStandard', component: DevOpsStandard, breadcrumb: '运维规范', }] diff --git a/web/client/src/sections/means/style.less b/web/client/src/sections/means/style.less index 75ecdb6..6287974 100644 --- a/web/client/src/sections/means/style.less +++ b/web/client/src/sections/means/style.less @@ -4,4 +4,6 @@ #example:hover { color: yellowgreen; -} \ No newline at end of file +} + + diff --git a/web/client/src/sections/service/actions/record.js b/web/client/src/sections/service/actions/record.js index 9f9e1fa..ba84b3e 100644 --- a/web/client/src/sections/service/actions/record.js +++ b/web/client/src/sections/service/actions/record.js @@ -17,6 +17,16 @@ export function getRecord(query) { //获取服务记录 }); } +export function respondRecord() { //获取服务记录 + return dispatch => basicAction({ + type: 'get', + dispatch: dispatch, + actionType: 'GET_RESPOND_RECORD', + url: `${ApiTable.respondRecord}`, + msg: { option: '获取响应记录数据' }, + }); +} + export function addRecord(query) { //新增服务记录和编辑 let msg = '' @@ -29,8 +39,11 @@ export function addRecord(query) { //新增服务记录和编辑 data: query, actionType: 'ADD_RECORD', url: `${ApiTable.addRecord}`, - msg: { option: msg } - + msg: { option: msg }, + reducer: { + name: "addRecord", + params: { noClear: true } + } }); } export function calculability(query) {//计算系统可用性 @@ -59,4 +72,5 @@ export function delRecord(query) {//删除服务记录 }); -} \ No newline at end of file +} + diff --git a/web/client/src/sections/service/components/cycAddmodal.jsx b/web/client/src/sections/service/components/cycAddmodal.jsx index 44f3ea3..54f5747 100644 --- a/web/client/src/sections/service/components/cycAddmodal.jsx +++ b/web/client/src/sections/service/components/cycAddmodal.jsx @@ -1,89 +1,107 @@ -import React,{useState,useEffect,useRef} from 'react' +import React, { useState, useEffect, useRef } from 'react' import { connect } from 'react-redux'; -import { Button,Table,Modal,Form } from '@douyinfe/semi-ui'; +import moment from 'moment' +import { Button, Table, Modal, Form } from '@douyinfe/semi-ui'; -const AddModal=(props)=>{ - const {visible,onClose,recordRow,pepList,actions,dispatch}=props - const{service}=actions - const api = useRef(); - useEffect(()=>{ - },[]) - //编辑和新增的逻辑 -const okHandler=()=>{ - //api.current.setValues({'manger':recordRow?.maintenancePlanExecuteUsers.map((item)=>{return item.id})},) - api.current.validate().then((res)=>{ - res.manger - recordRow?.maintenancePlanExecuteUsers - const query={ - id:recordRow?.id, - actualFinishTime:res.realityTime, - planFinishTime:res.planTime, - remark:res.notes, - state:res.status, - type:'period', - missionName:res.taskName, - manger:res.manger, - msg:recordRow?'编辑周期性计划':'添加周期性计划' - } - dispatch(service.editMaintenancePlan(query)).then((res)=>{ - if(res.success) onClose() ; api.current.reset() +const AddModal = (props) => { + const { visible, onClose, recordRow, pepList, actions, dispatch, respondRecordData } = props + const { service } = actions + const api = useRef(); + const [selectValue, setSelectValue] = useState([]) - - }) - - }) - } - return (
- {onClose()}} title={recordRow?'周期性计划编辑':'周期性计划添加'} - onOk={okHandler} - - > -
{return item.pepUserId}), - 'reason':recordRow?.reason, - 'status':recordRow?.state, - 'notes':recordRow?.remark, - 'planTime':recordRow?.planFinishTime, - 'realityTime':recordRow?.actualFinishTime}} + useEffect(() => { + }, []) + //编辑和新增的逻辑 + const okHandler = () => { + api.current.validate().then((res) => { + console.log(111, res, respondRecordData?.map(v => ({ value: v.id, label: v.sketch }))); + const query = { + id: recordRow?.id, + actualFinishTime: res.realityTime, + planFinishTime: res.planTime, + remark: res.notes, + state: res.status, + type: 'period', + missionName: res.taskName, + manger: res.manger, + recordId: res.recordId, + msg: recordRow ? '编辑周期性计划' : '添加周期性计划' + } + dispatch(service.editMaintenancePlan(query)).then((res) => { + if (res.success) onClose(); api.current.reset() - getFormApi={formApi => api.current = formApi} - labelCol={{ span: 6 }} - labelPosition='left' - > - - - {pepList?.map((item)=>{return ( - {item.users.map((item1)=>{ - return - })} - )})} - - - 未完成 - 进行中 - 已完成 - 挂起 - - - - - -
+ }) -
) + }) + } + return (
+ { onClose() }} title={recordRow ? '周期性计划编辑' : '周期性计划添加'} + onOk={okHandler} + + > +
{ return item.pepUserId }), + 'reason': recordRow?.reason, + 'status': recordRow?.state, + 'notes': recordRow?.remark, + 'planTime': recordRow?.planFinishTime, + 'realityTime': recordRow?.actualFinishTime, + 'recordId': recordRow?.recordId || [], + }} + + getFormApi={formApi => api.current = formApi} + labelCol={{ span: 6 }} + labelPosition='left' + > + + + {pepList?.map((item) => { + return ( + {item.users.map((item1) => { + return + })} + ) + })} + + + 未完成 + 进行中 + 已完成 + 挂起 + + + + + + ({ value: v.id, label: `${v.sketch} / ${moment(v.occurrenceTime).format('YYYY-MM-DD')}` }))} + multiple filter + > + {respondRecordData?.map((v) => { + return + + + })} + + +
+ +
) } function mapStateToProps (state) { - const { global } = state; - return { - actions: global.actions, - }; - } + const { global } = state; + return { + actions: global.actions, + }; +} export default connect(mapStateToProps)(AddModal) \ No newline at end of file diff --git a/web/client/src/sections/service/components/planAddmodal.jsx b/web/client/src/sections/service/components/planAddmodal.jsx new file mode 100644 index 0000000..7874167 --- /dev/null +++ b/web/client/src/sections/service/components/planAddmodal.jsx @@ -0,0 +1,87 @@ +import React, { useState, useEffect, useRef } from 'react' +import { connect } from 'react-redux'; +import moment from 'moment' +import { Button, Table, Modal, Form } from '@douyinfe/semi-ui'; + + +const PlanAddmodal = (props) => { + const { visible, onClose, recordRow, actions, dispatch } = props + const { service, install } = actions + const [pepList, setPepList] = useState([])//角色分配 + + const api = useRef(); + const [selectValue, setSelectValue] = useState([]) + + useEffect(() => { + dispatch(install.getOrganizationDeps()).then((res) => {//获取项企(PEP)全部部门及其下用户 + setPepList(res.payload.data) + }) + }, []) + //编辑和新增的逻辑 + const okHandler = () => { + api.current.validate().then((res) => { + const query = { + actualFinishTime: res.realityTime, + planFinishTime: res.planTime, + remark: res.notes, + state: res.status, + type: 'period', + missionName: res.taskName, + manger: res.manger, + recordId: [recordRow.id], + msg: '添加周期性计划' + } + dispatch(service.editMaintenancePlan(query)).then((res) => { + if (res.success) onClose(); api.current.reset() + + + }) + + }) + } + return (
+ { onClose() }} title={'添加周期性计划'} + onOk={okHandler} + + > +
api.current = formApi} + labelCol={{ span: 6 }} + labelPosition='left' + > + + + {pepList?.map((item) => { + return ( + {item.users.map((item1) => { + return + })} + ) + })} + + + 未完成 + 进行中 + 已完成 + 挂起 + + + + + +
+ +
) +} + + +function mapStateToProps (state) { + const { global } = state; + return { + actions: global.actions, + }; +} +export default connect(mapStateToProps)(PlanAddmodal) \ No newline at end of file diff --git a/web/client/src/sections/service/components/recordModal.jsx b/web/client/src/sections/service/components/recordModal.jsx index 2e919ef..dc9cb10 100644 --- a/web/client/src/sections/service/components/recordModal.jsx +++ b/web/client/src/sections/service/components/recordModal.jsx @@ -1,144 +1,178 @@ 'use strict'; -import React, { useEffect,useState,useRef } from 'react'; -import { Modal,Form,DatePicker,useFormApi,actions,Button } from '@douyinfe/semi-ui'; +import React, { useEffect, useState, useRef } from 'react'; +import { Modal, Form, DatePicker, Upload, actions, Button } from '@douyinfe/semi-ui'; import { connect } from 'react-redux'; import moment from 'moment' +import { IconDeleteStroked, IconEditStroked, IconUpload, IconAlertCircle, IconSearch } from '@douyinfe/semi-icons'; -const RecordModal =(props)=>{ - const{visible,onClose,dispatch,recordRow,pepList,actions}=props - const [startTime,setStartTime]=useState('') - const [endTime,setEndTime]=useState('') - const FormApi = useRef(); - const{service} =actions - // let t=0//天数 - // let h=0//小时数 - // let s=0//秒数 +const RecordModal = (props) => { + const { visible, onClose, dispatch, recordRow, pepList, actions, addRecord, qiniu, apiRoot } = props + const [startTime, setStartTime] = useState('') + const [endTime, setEndTime] = useState('') + const [uploadData, setUploadData] = useState({}) + const FormApi = useRef(); + const { service } = actions + // let t=0//天数 + // let h=0//小时数 + // let s=0//秒数 // console.log('endTimex',endTime) -useEffect(()=>{ - setEndTime(recordRow?.solvingTime) - setStartTime(recordRow?.occurrenceTime) - console.log('recordRow',recordRow) + useEffect(() => { + setEndTime(recordRow?.solvingTime) + setStartTime(recordRow?.occurrenceTime) + console.log('recordRow', recordRow) -},[recordRow]) -const cancelHandler=()=>{ - onClose() - setStartTime('') - setEndTime('') + }, [recordRow]) + const cancelHandler = () => { + onClose() + setStartTime('') + setEndTime('') -} -const okHandler=()=>{ - FormApi.current.validate().then((res)=>{ - console.log('recordRow',res) - const editVal={ - id:recordRow?.id, - solvingTime:res.endTime, - occurrencTime:res.startTime, - sketch:res.name, - record:res.record, - settler:res.settler, - type:res.type, - msg:recordRow?'编辑服务记录':'添加服务记录' - } - dispatch(service.addRecord(editVal)).then(res => { + } + const okHandler = () => { + FormApi.current.validate().then((res) => { + console.log('recordRow', res) + const editVal = { + id: recordRow?.id, + solvingTime: res.endTime, + occurrencTime: res.startTime, + sketch: res.name, + record: res.record, + settler: res.settler, + type: res.type, + msg: recordRow ? '编辑响应记录' : '添加响应记录', + files: [{ ...uploadData }] + } + + dispatch(service.addRecord(editVal)).then(res => { if (res.success) { - onClose() - FormApi.current.reset() - setStartTime('');setEndTime('') + onClose() + FormApi.current.reset() + setStartTime(''); setEndTime('') } - }) - }) -} - return 取消: -
- - -
} - onCancel={cancelHandler} - onOk={okHandler} - > -
{return item.pepUserId}), - 'type':recordRow?.type, - 'record':recordRow?.record, - 'breakTime':recordRow?parseInt(recordRow.interruptDuration/60/60/24)+'天'+ - parseInt(recordRow.interruptDuration/60/60%24)+'时'+ - parseInt(recordRow.interruptDuration/60%60)+'分':'0天0时0秒' + }) + }) + } + return 取消: +
+ + +
} + onCancel={cancelHandler} + // onOk={okHandler} + > + { return item.pepUserId }), + 'type': recordRow?.type, + 'record': recordRow?.record, + 'breakTime': recordRow ? parseInt(recordRow.interruptDuration / 60 / 60 / 24) + '天' + + parseInt(recordRow.interruptDuration / 60 / 60 % 24) + '时' + + parseInt(recordRow.interruptDuration / 60 % 60) + '分' : '0天0时0秒' + }} + getFormApi={formApi => FormApi.current = formApi} + labelPosition='left' + labelAlign='right'> + + { + const seconds = (moment(endTime).format('x') - moment(e).format('x')) / 1000//两个时间的秒数 + const tdd = e && endTime ? parseInt(seconds / 60 / 60 / 24) : 0//取整天 + const tdh = e && endTime ? parseInt(seconds / 60 / 60 % 24) : 0//取整时 + const tds = e && endTime ? parseInt(seconds / 60 % 60) : 0//取整分 + setStartTime(e) + FormApi.current.setValue('breakTime', `${tdd}天${tdh}时${tds}分`) }} - getFormApi={formApi => FormApi.current = formApi} - labelPosition='left' - labelAlign='right'> - - { - const seconds=(moment(endTime).format('x')-moment(e).format('x'))/1000//两个时间的秒数 - const tdd=e&&endTime?parseInt(seconds/60/60/24):0//取整天 - const tdh=e&&endTime?parseInt(seconds/60/60%24):0//取整时 - const tds=e&&endTime?parseInt(seconds/60%60):0//取整分 - setStartTime(e) - FormApi.current.setValue('breakTime',`${tdd}天${tdh}时${tds}分`) - }} - /> - { - const seconds=(moment(e).format('x')-moment(startTime).format('x'))/1000//两个时间的秒数 - const tdd=e&&startTime?parseInt(seconds/60/60/24):0//取整天 - const tdh=e&&startTime?parseInt(seconds/60/60%24):0//取整时 - const tds=e&&startTime?parseInt(seconds/60%60):0//取整分 - setEndTime(e);//console.log('sss',moment(endTime-startTime).format('DD天hh时mm分')) - FormApi.current.setValue('breakTime',`${tdd}天${tdh}时${tds}分`) + /> + { + const seconds = (moment(e).format('x') - moment(startTime).format('x')) / 1000//两个时间的秒数 + const tdd = e && startTime ? parseInt(seconds / 60 / 60 / 24) : 0//取整天 + const tdh = e && startTime ? parseInt(seconds / 60 / 60 % 24) : 0//取整时 + const tds = e && startTime ? parseInt(seconds / 60 % 60) : 0//取整分 + setEndTime(e);//console.log('sss',moment(endTime-startTime).format('DD天hh时mm分')) + FormApi.current.setValue('breakTime', `${tdd}天${tdh}时${tds}分`) - }} /> - - {/* 中断时间:{endTime&&startTime? {`${tdd}天${tdh}时${tds}分`}:recordRow?.interruptDuration} */} - - {pepList?.map((item)=>{return ( - {item.users.map((item1)=>{ - return + }} /> + + {/* 中断时间:{endTime&&startTime? {`${tdd}天${tdh}时${tds}分`}:recordRow?.interruptDuration} */} + + {pepList?.map((item) => { + return ( + {item.users.map((item1) => { + return - })} - )})} - - - es异常 - 数据库异常 - 应用异常 - kafka异常 - 服务器异常 - DAC进程异常 - K8S集群异常 - redis服务异常 - 其他 - - - - - + })} + ) + })} + + + es异常 + 数据库异常 + 应用异常 + kafka异常 + 服务器异常 + DAC进程异常 + K8S集群异常 + redis服务异常 + 其他 + + + +
+
文件:
+ { + setUploadData({}) + }} + onSuccess={(responseBody, file) => { + setUploadData({ + name: file.name, + size: file.size, + url: responseBody?.uploaded, + uploadTime: moment().format("YYYY-MM-DD HH:mm:ss") + }) + }} + > + + +
+ + -
+ +
} function mapStateToProps (state) { - const { auth, global, members, webSocket } = state; - return { - // loading: members.isRequesting, - // user: auth.user, - actions: global.actions, - // members: members.data, - // socket: webSocket.socket - }; - } + const { auth, global, members, webSocket, addRecord } = state; + console.log(addRecord); + return { + addRecord: addRecord.isRequesting, + // user: auth.user, + actions: global.actions, + qiniu: global.qiniu?.domain, + apiRoot: global.apiRoot + }; +} export default connect(mapStateToProps)(RecordModal); diff --git a/web/client/src/sections/service/containers/cyclePlan.jsx b/web/client/src/sections/service/containers/cyclePlan.jsx index e5f00ae..1859be1 100644 --- a/web/client/src/sections/service/containers/cyclePlan.jsx +++ b/web/client/src/sections/service/containers/cyclePlan.jsx @@ -1,156 +1,162 @@ -import React, { useEffect,useState} from 'react'; +import React, { useEffect, useState } from 'react'; import { connect } from 'react-redux'; -import { Button,Table,Popconfirm,Pagination } from '@douyinfe/semi-ui'; +import { Button, Table, Popconfirm, Pagination } from '@douyinfe/semi-ui'; import Addmodal from '../components/cycAddmodal' import moment from 'moment' const Server = (props) => { const { dispatch, actions, user, loading, socket } = props - const{service,install}=actions - const [addVis,setAddVis]=useState(false) - const [cycPlan,setCysPlan]=useState([]) - const [recordRow,setRecordRow]=useState(null) + const { service, install } = actions + const [addVis, setAddVis] = useState(false) + const [cycPlan, setCysPlan] = useState([]) + const [recordRow, setRecordRow] = useState(null) const [pepList, setPepList] = useState([])//角色分配 - const [pageSize,setPageSize]=useState(10) - const [pageIndex,setPageIndex]=useState(1) - const [total,setTotal]=useState() + const [pageSize, setPageSize] = useState(10) + const [pageIndex, setPageIndex] = useState(1) + const [total, setTotal] = useState() + const [respondRecordData, setRespondRecordData] = useState([]) - const getCycPlan=(query={type:'period',msg:'获取周期性计划',pageIndex,pageSize})=>{ - dispatch(service.getMaintenancePlan(query)).then((res)=>{ - setCysPlan(res?.payload.data.responseRes) - setTotal(res?.payload.data.count) - }) - } - useEffect(()=>{ - getCycPlan() - dispatch(install.getOrganizationDeps()).then((res) => {//获取项企(PEP)全部部门及其下用户 - setPepList(res.payload.data) - }) - },[]) - const delHandler=(record)=>{ - const query={ - responseId:record.id, - msg:'删除周期性计划' - } - dispatch(service.delMaintenancePlan(query)).then((res)=>{ - if(res.success) getCycPlan({type:'period',msg:'获取周期性计划',pageIndex:1,pageSize});setPageIndex(1) - }) - } - //配置分页 -// const pagination={ -// total:total, -// defaultCurrent: 1, -// pageSize:pageSize, -// showSizeChanger: true, -// currentPage:pageIndex, -// showQuickJumper: true, -// pageSizeOpts: ["5", "10", "15"], -// showTotal: function () { -// return `共有${total}条` -// }, -// onChange:(pageIndex,pageSize)=>{ -// console.log('pageIndex1',pageIndex,pageSize) -// setPageIndex(pageIndex) -// setPageSize(pageSize) -// const query={ -// pageIndex,pageSize,type:'temp',msg:'获取周期性计划' -// } -// getCycPlan(query) -// } -// } - //console.log('cycPlan',cycPlan) + const getCycPlan = (query = { type: 'period', msg: '获取周期性计划', pageIndex, pageSize }) => { + dispatch(service.getMaintenancePlan(query)).then((res) => { + setCysPlan(res?.payload.data.responseRes) + setTotal(res?.payload.data.count) + }) + } + useEffect(() => { + getCycPlan() + dispatch(install.getOrganizationDeps()).then((res) => {//获取项企(PEP)全部部门及其下用户 + setPepList(res.payload.data) + }) + dispatch(service.respondRecord({})).then((res) => { + if (res.success) { + setRespondRecordData(res?.payload.data) + } + }); + }, []) + const delHandler = (record) => { + const query = { + responseId: record.id, + msg: '删除周期性计划' + } + dispatch(service.delMaintenancePlan(query)).then((res) => { + if (res.success) getCycPlan({ type: 'period', msg: '获取周期性计划', pageIndex: 1, pageSize }); setPageIndex(1) + }) + } + //配置分页 + // const pagination={ + // total:total, + // defaultCurrent: 1, + // pageSize:pageSize, + // showSizeChanger: true, + // currentPage:pageIndex, + // showQuickJumper: true, + // pageSizeOpts: ["5", "10", "15"], + // showTotal: function () { + // return `共有${total}条` + // }, + // onChange:(pageIndex,pageSize)=>{ + // console.log('pageIndex1',pageIndex,pageSize) + // setPageIndex(pageIndex) + // setPageSize(pageSize) + // const query={ + // pageIndex,pageSize,type:'temp',msg:'获取周期性计划' + // } + // getCycPlan(query) + // } + // } + //console.log('cycPlan',cycPlan) const columns = [ - { - title: '序号', - render:(t, r, i) => { + { + title: '序号', + render: (t, r, i) => { return i + 1 - } - }, - { - title: '任务名称', - dataIndex: 'missionName', - }, - { - title: '责任人', - render:(record)=>{ - return - {record?.maintenancePlanExecuteUsers.map((item)=>{ - return item.name - }).toString() - } - - } - }, - { - title: '完成情况', - dataIndex: 'state', - }, - { - title: '备注', - dataIndex: 'remark', - }, - { - title: '计划完成时间', - render:(record)=>{ + } + }, + { + title: '任务名称', + dataIndex: 'missionName', + }, + { + title: '责任人', + render: (record) => { + return + {record?.maintenancePlanExecuteUsers.map((item) => { + return item.name + }).toString() + } + + } + }, + { + title: '完成情况', + dataIndex: 'state', + }, + { + title: '备注', + dataIndex: 'remark', + }, + { + title: '计划完成时间', + render: (record) => { return {moment(record.planFinishTime).format('YYYY-MM-DD')} - }, - }, - { - title: '实际完成时间', - render:(record)=>{ - return record.actualFinishTime?{moment(record.actualFinishTime).format('YYYY-MM-DD')}:'' - }, - }, - { - title: '操作', - render:(record)=>{ - return (
- - {delHandler(record)}}> -
) - } - }, + }, + }, + { + title: '实际完成时间', + render: (record) => { + return record.actualFinishTime ? {moment(record.actualFinishTime).format('YYYY-MM-DD')} : '' + }, + }, + { + title: '操作', + render: (record) => { + return (
+ + { delHandler(record) }}> +
) + } + }, ]; return ( -
-
- - {/* */} -
-
-
-
-
- - 共{total}条信息 - - { - console.log('pageIndex1',pageIndex,pageSize) - setPageIndex(pageIndex) - setPageSize(pageSize) - const query={ - pageIndex,pageSize,type:'period',msg:'获取周期性计划' - } - getCycPlan(query) - }}> +
+
+ + {/* */} +
+
+
+
+
+ + 共{total}条信息 + + { + console.log('pageIndex1', pageIndex, pageSize) + setPageIndex(pageIndex) + setPageSize(pageSize) + const query = { + pageIndex, pageSize, type: 'period', msg: '获取周期性计划' + } + getCycPlan(query) + }}> +
+ { setAddVis(false); setRecordRow(null); getCycPlan() }} recordRow={recordRow} pepList={pepList}>
- {setAddVis(false);setRecordRow(null);getCycPlan()}} recordRow={recordRow} pepList={pepList}> -
) } - function mapStateToProps (state) { - const { global } = state; - return { - actions: global.actions, - }; - } +function mapStateToProps (state) { + const { global } = state; + return { + actions: global.actions, + }; +} export default connect(mapStateToProps)(Server); diff --git a/web/client/src/sections/service/containers/maintenanceRecords.jsx b/web/client/src/sections/service/containers/maintenanceRecords.jsx index d719f20..bf21d31 100644 --- a/web/client/src/sections/service/containers/maintenanceRecords.jsx +++ b/web/client/src/sections/service/containers/maintenanceRecords.jsx @@ -5,236 +5,237 @@ import MaintenanceRecordModal from '../components/maintenanceRecordModal'; import moment from 'moment'; const MaintenanceRecords = (props) => { - const { dispatch, actions, user, loading, socket, projectList } = props; - const [addVis, setAddVis] = useState(false); - const [recordRow, setRecordRow] = useState(null); - const [equipmentList, setEquipmentList] = useState([]); - const [pepList, setPepList] = useState([]); - const [pageSize, setPageSize] = useState(10); - const [pageIndex, setPageIndex] = useState(1); - const [startTime, setStartTime] = useState('1970-1-1'); - const [endTime, setEndTime] = useState('2099-1-1'); - const { install, service } = actions; - const [total,setTotal]=useState() - const [projectId,setProjectId]=useState(null) - const getEquipment = (query = { startTime, endTime, pageIndex, pageSize }) => { - dispatch(service.getEquipment(query)).then((res) => { - // console.log() - if (res.success) setEquipmentList(res?.payload.data.result); setTotal(res?.payload.data.resCount) + const { dispatch, actions, user, loading, socket, projectList } = props; + const [addVis, setAddVis] = useState(false); + const [recordRow, setRecordRow] = useState(null); + const [equipmentList, setEquipmentList] = useState([]); + const [pepList, setPepList] = useState([]); + const [pageSize, setPageSize] = useState(10); + const [pageIndex, setPageIndex] = useState(1); + const [startTime, setStartTime] = useState('1970-1-1'); + const [endTime, setEndTime] = useState('2099-1-1'); + const { install, service } = actions; + const [total, setTotal] = useState() + const [projectId, setProjectId] = useState(null) - }); - }; + const getEquipment = (query = { startTime, endTime, pageIndex, pageSize }) => { + dispatch(service.getEquipment(query)).then((res) => { + // console.log() + if (res.success) setEquipmentList(res?.payload.data.result); setTotal(res?.payload.data.resCount) + + }); + }; // console.log('equipmentList', equipmentList); - const findHandler=()=>{ - const query={ - pageIndex,pageSize,msg:'获取维护记录',startTime, endTime,projectId - } - console.log('canshu',projectId,startTime, endTime) - getEquipment(query) - } - const timeHandler=(e)=>{ - setEndTime(e[1]+'') - setStartTime(e[0]+'') - } - useEffect(() => { - dispatch(install.getOrganizationDeps()).then((res) => { - //获取项企(PEP)全部部门及其下用户 - setPepList(res.payload.data); - }); - getEquipment(); - }, []) - const delHandler=(record)=>{ - dispatch(service.delEquipment(record.id)).then((res)=>{ - if(res.success) getEquipment({ - pageIndex:1,pageSize,msg:'获取维护记录',startTime, endTime,projectId - });setPageIndex(1) - }) - } - const columns = [ - { - title: '序号', - render: (t, r, i) => { - return i + 1; - } - }, - { - title: '项目名称', - render: (record) => { - const currentId = record.equipmentMaintenanceRecordProjects?.map((item1) => { - return item1.projectId; - })[0]; - //const currnetObj = projectList?.find((item) => item.id === record?.equipmentMaintenanceRecordProjects?.projectId)||{}; - const currnetObj = projectList?.find((item) => item.id === currentId)||{}; - const projectName = currnetObj.name ? currnetObj.name : currnetObj.pepProjectName; - return projectName?.length > 15 ? ( - {projectName}}> -
{projectName?.length > 15 ? `${projectName?.substr(0, 15)}...` : projectName}
-
- ) : ( - projectName - ); - } - }, - { - title: '设备类型', - dataIndex: 'equipmentCategory' - }, - { - title: '设备型号', - dataIndex: 'equipmentType' - }, - { - title: '维修原因', - dataIndex: 'maintenanceReason' - }, - { - title: '解决方案', - dataIndex: 'solution' - }, - { - title: '维修人', - render: (record) => { - return ( - - {record?.equipmentMaintenanceRecordExecuteUsers - .map((item) => { - return item.name; - }) - .toString()} - - ); - } - }, - { - title: '上报时间', - render: (record) => { - return {moment(record.reportTime).format('YYYY-MM-DD HH:mm:ss')}; - } - }, - { - title: '维修完成时间', - render: (record) => { - //('record',record.completedTime) - return (record.completedTime?({moment(record.reportTime).format('YYYY-MM-DD HH:mm:ss')}):'') - } - }, - { - title: '状态', - dataIndex: 'status' - }, - { - title: '操作', - render: (record) => { - return ( -
- - { - delHandler(record); - }} - > - - -
- ); - } - } - ]; + const findHandler = () => { + const query = { + pageIndex, pageSize, msg: '获取维护记录', startTime, endTime, projectId + } + console.log('canshu', projectId, startTime, endTime) + getEquipment(query) + } + const timeHandler = (e) => { + setEndTime(e[1] + '') + setStartTime(e[0] + '') + } + useEffect(() => { + dispatch(install.getOrganizationDeps()).then((res) => { + //获取项企(PEP)全部部门及其下用户 + setPepList(res.payload.data); + }); + getEquipment(); + }, []) + const delHandler = (record) => { + dispatch(service.delEquipment(record.id)).then((res) => { + if (res.success) getEquipment({ + pageIndex: 1, pageSize, msg: '获取维护记录', startTime, endTime, projectId + }); setPageIndex(1) + }) + } + const columns = [ + { + title: '序号', + render: (t, r, i) => { + return i + 1; + } + }, + { + title: '项目名称', + render: (record) => { + const currentId = record.equipmentMaintenanceRecordProjects?.map((item1) => { + return item1.projectId; + })[0]; + //const currnetObj = projectList?.find((item) => item.id === record?.equipmentMaintenanceRecordProjects?.projectId)||{}; + const currnetObj = projectList?.find((item) => item.id === currentId) || {}; + const projectName = currnetObj.name ? currnetObj.name : currnetObj.pepProjectName; + return projectName?.length > 15 ? ( + {projectName}}> +
{projectName?.length > 15 ? `${projectName?.substr(0, 15)}...` : projectName}
+
+ ) : ( + projectName + ); + } + }, + { + title: '设备类型', + dataIndex: 'equipmentCategory' + }, + { + title: '设备型号', + dataIndex: 'equipmentType' + }, + { + title: '维修原因', + dataIndex: 'maintenanceReason' + }, + { + title: '解决方案', + dataIndex: 'solution' + }, + { + title: '维修人', + render: (record) => { + return ( + + {record?.equipmentMaintenanceRecordExecuteUsers + .map((item) => { + return item.name; + }) + .toString()} + + ); + } + }, + { + title: '上报时间', + render: (record) => { + return {moment(record.reportTime).format('YYYY-MM-DD HH:mm:ss')}; + } + }, + { + title: '维修完成时间', + render: (record) => { + //('record',record.completedTime) + return (record.completedTime ? ({moment(record.reportTime).format('YYYY-MM-DD HH:mm:ss')}) : '') + } + }, + { + title: '状态', + dataIndex: 'status' + }, + { + title: '操作', + render: (record) => { + return ( +
+ + { + delHandler(record); + }} + > + + +
+ ); + } + } + ]; - return ( -
-
-
- {' '} - -
-
- {' '} - 项目名称 - -
-
- 上报时间 - {timeHandler(e)}} onClear={()=>{setStartTime('1970-1-1');setEndTime('2099-12-31')}}> -
-
- -
+ return ( +
+
+
+ {' '} + +
+
+ {' '} + 项目名称 + +
+
+ 上报时间 + { timeHandler(e) }} onClear={() => { setStartTime('1970-1-1'); setEndTime('2099-12-31') }}>
-
+
-
- - 共{total}条信息 - - { - //console.log('pageIndex1',pageIndex,pageSize) - setPageIndex(pageIndex) - setPageSize(pageSize) - const query={ - pageIndex,pageSize,msg:'获取维护记录',startTime, endTime,projectId - } - getEquipment(query) - }}> +
+
+
+
+
+ + 共{total}条信息 + + { + //console.log('pageIndex1',pageIndex,pageSize) + setPageIndex(pageIndex) + setPageSize(pageSize) + const query = { + pageIndex, pageSize, msg: '获取维护记录', startTime, endTime, projectId + } + getEquipment(query) + }}> +
+ { + setAddVis(false); + setRecordRow(null); + //getEquipment(); + findHandler() + }} + recordRow={recordRow} + pepList={pepList} + projectList={projectList} + >
- { - setAddVis(false); - setRecordRow(null); - //getEquipment(); - findHandler() - }} - recordRow={recordRow} - pepList={pepList} - projectList={projectList} - > -
- ); + ); }; -function mapStateToProps(state) { - const { auth, global, members, webSocket, ProjectPoms } = state; - return { - // loading: members.isRequesting, - // user: auth.user, - actions: global.actions, - // members: members.data, - // socket: webSocket.socket - projectList: ProjectPoms.data?.rows - }; +function mapStateToProps (state) { + const { auth, global, members, webSocket, ProjectPoms } = state; + return { + // loading: members.isRequesting, + // user: auth.user, + actions: global.actions, + // members: members.data, + // socket: webSocket.socket + projectList: ProjectPoms.data?.rows + }; } export default connect(mapStateToProps)(MaintenanceRecords); diff --git a/web/client/src/sections/service/containers/serviceRecord.jsx b/web/client/src/sections/service/containers/serviceRecord.jsx index 3003912..7217bef 100644 --- a/web/client/src/sections/service/containers/serviceRecord.jsx +++ b/web/client/src/sections/service/containers/serviceRecord.jsx @@ -1,248 +1,362 @@ 'use strict'; -import React, { useEffect,useState,useMemo } from 'react'; -import { Calendar,DatePicker,RadioGroup, Radio,Button,Table,Modal,Tooltip,Pagination, Popconfirm } from '@douyinfe/semi-ui'; +import React, { useEffect, useState, useMemo } from 'react'; +import { Calendar, DatePicker, RadioGroup, Radio, Button, Table, Modal, Tooltip, Pagination, Popconfirm } from '@douyinfe/semi-ui'; import moment from 'moment' import { connect } from 'react-redux'; import RecordModal from '../components/recordModal' +import PlanAddmodal from '../components/planAddmodal' const Server = (props) => { const { dispatch, actions, user, loading, socket } = props //console.log('actions',actions) - const {install,service}=actions - const [dateValue,setDateValue]=useState([]) - const [mode,setMode]=useState('month') - const [modalVis,setModalVis]=useState(false) - const [recordRow,setRecordRow]=useState(null) - const [recordList,setRecordList]=useState([]) + const { install, service } = actions + const [dateValue, setDateValue] = useState([]) + const [mode, setMode] = useState('month') + const [modalVis, setModalVis] = useState(false) + const [recordRow, setRecordRow] = useState(null) + const [recordList, setRecordList] = useState([]) const [pepList, setPepList] = useState([])//角色分配 - const [startTime,setStartTime]=useState('1970-1-1' ) - const [endTime,setEndTime]=useState('2099-1-1') - const [sTime,setStime]=useState(moment().startOf('month').format('YYYY-MM-DD HH:mm:ss')) - const [eTime,setEtime]=useState(moment().endOf('month').format('YYYY-MM-DD HH:mm:ss')) - const [calculability,setCalculability]=useState('') - const [pageSize,setPageSize]=useState(10) - const [pageIndex,setPageIndex]=useState(1) - const [total,setTotal]=useState() - const getRecordList=(query={ - startTime,endTime,pageIndex,pageSize - })=>{ - dispatch(service.getRecord(query)).then((res)=>{ - console.log('res1',res) + const [startTime, setStartTime] = useState('1970-1-1') + const [endTime, setEndTime] = useState('2099-1-1') + const [sTime, setStime] = useState(moment().startOf('month').format('YYYY-MM-DD HH:mm:ss')) + const [eTime, setEtime] = useState(moment().endOf('month').format('YYYY-MM-DD HH:mm:ss')) + const [calculability, setCalculability] = useState('') + const [pageSize, setPageSize] = useState(10) + const [pageIndex, setPageIndex] = useState(1) + const [total, setTotal] = useState() + const [addVis, setAddVis] = useState(false) + const [cycPlan, setCysPlan] = useState([]) + const [visible, setVisible] = useState(false) + + + const getRecordList = (query = { + startTime, endTime, pageIndex, pageSize + }) => { + dispatch(service.getRecord(query)).then((res) => { + // console.log('res1',res) setRecordList(res?.payload.data.res) setTotal(res?.payload.data.count) }) } - //('endTime',endTime) + //('endTime',endTime) useEffect(() => { getRecordList() dispatch(install.getOrganizationDeps()).then((res) => {//获取项企(PEP)全部部门及其下用户 - if(res.success) setPepList(res.payload.data) - }) + if (res.success) setPepList(res.payload.data) + }) + }, []) - const delHandler=(id)=>{ - dispatch(service.delRecord(id)).then((res)=>{ - if(res.success) { - getRecordList({startTime,endTime,pageIndex:1,pageSize}) + const delHandler = (id) => { + dispatch(service.delRecord(id)).then((res) => { + if (res.success) { + getRecordList({ startTime, endTime, pageIndex: 1, pageSize }) setPageIndex(1) } }) } + + const getCycPlan = (recordId) => { + dispatch(service.getMaintenancePlan({ type: 'period', msg: '获取周期性计划', recordId: recordId })).then((res) => { + setCysPlan(res?.payload.data.responseRes) + }) + } useEffect(() => { - const query={ + const query = { sTime, eTime - } - console.log('sTime',sTime,eTime) - dispatch(service.calculability(query)).then((res)=>{ - if(res.success) setCalculability((Math.round(res.payload.data * 10000)) / 100 + '%'); // console.log(res.payload.data,'dateee') + } + console.log('sTime', sTime, eTime) + dispatch(service.calculability(query)).then((res) => { + if (res.success) setCalculability((Math.round(res.payload.data * 10000)) / 100 + '%'); // console.log(res.payload.data,'dateee') }) - }, [sTime,eTime]) + }, [sTime, eTime]) + + const pagination = { - const pagination={ - - } + } //console.log(recordList,'11111111') - const columns = [ - { - title: '序号', - render:(t, r, i) => { - return i + 1 - } - }, - { - title: '故障描述', - dataIndex: 'sketch', - }, - { - title: '发生时间', - render:(record)=>{ + const columns = [ + { + title: '序号', + render: (t, r, i) => { + return i + 1 + } + }, + { + title: '故障描述', + dataIndex: 'sketch', + }, + { + title: '发生时间', + render: (record) => { return {moment(record.occurrenceTime).format('YYYY-MM-DD HH:mm:ss')} - }, - }, - { - title: '解决时间', - render:(record)=>{ - return {moment(record.solvingTime).format('YYYY-MM-DD HH:mm:ss')} - }, - }, - { - title: '恢复时间', - render:(record)=>{ - const tdd=parseInt((moment(record.solvingTime).format('x')-moment(record.occurrenceTime).format('x'))/1000/60/60/24)//取整天 - const tdh=parseInt((moment(record.solvingTime).format('x')-moment(record.occurrenceTime).format('x'))/1000/60/60%24)//取整时 - const tds=parseInt((moment(record.solvingTime).format('x')-moment(record.occurrenceTime).format('x'))/1000/60%60)//取整分 - return {`${tdd}天${tdh}时${tds}分`} - } - }, - { + }, + }, + { + title: '解决时间', + render: (record) => { + return {moment(record.solvingTime).format('YYYY-MM-DD HH:mm:ss')} + }, + }, + { + title: '恢复时间', + render: (record) => { + const tdd = parseInt((moment(record.solvingTime).format('x') - moment(record.occurrenceTime).format('x')) / 1000 / 60 / 60 / 24)//取整天 + const tdh = parseInt((moment(record.solvingTime).format('x') - moment(record.occurrenceTime).format('x')) / 1000 / 60 / 60 % 24)//取整时 + const tds = parseInt((moment(record.solvingTime).format('x') - moment(record.occurrenceTime).format('x')) / 1000 / 60 % 60)//取整分 + return {`${tdd}天${tdh}时${tds}分`} + } + }, + { title: '故障类型', dataIndex: 'type', - }, - { - title: '解决者', - //width:20, - render:(record)=>{ - // console.log('ressss',record) - return - {record?.maintenanceRecordExecuteUsers.map((item)=>{ - return item.name - }).toString() - } + }, + { + title: '解决者', + //width:20, + render: (record) => { + // console.log('ressss',record) + return + {record?.maintenanceRecordExecuteUsers.map((item) => { + return item.name + }).toString() + } - - } - }, - { - title: '操作', - render:(record)=>{ - return
- - { - delHandler(record.id); - }} - > - - -
- - }, -}, - ]; -const onChangeDate=(e)=> { - console.log('zzzz',e[0],e[1]) +
+ } + }, + { + title: '文件', + render: (record) => { + return record.files?.length > 0 && { + return
+ + { + delHandler(record.id); + }} + > + + + + + {record.planList?.length > 0 && } +
+ + }, + }, + ]; + const onChangeDate = (e) => { setMode('') setDateValue(e) setStime(moment(e[0]).format('YYYY-MM-DD HH:mm:ss')) setEtime(moment(e[1]).format('YYYY-MM-DD HH:mm:ss')) - const query={ + const query = { sTime, eTime - } - //console.log('sTime',sTime,eTime) - dispatch(service.calculability(query)).then((res)=>{ - if(res.success) setCalculability((Math.round(res.payload.data * 10000)) / 100 + '%'); // console.log(res.payload.data,'dateee') + } + //console.log('sTime',sTime,eTime) + dispatch(service.calculability(query)).then((res) => { + if (res.success) setCalculability((Math.round(res.payload.data * 10000)) / 100 + '%'); // console.log(res.payload.data,'dateee') }) - - } -const clearHandler=()=>{ -} -const addHandler=()=>{ - setModalVis(true) -} + } + const clearHandler = () => { + + } + const addHandler = () => { + setModalVis(true) + } - const onSelect=(e)=> { - if(e.target.value==='month'){ - setStime(moment().startOf('month').format('YYYY-MM-DD HH:mm:ss')); - setEtime(moment().endOf('month').format('YYYY-MM-DD HH:mm:ss')) + const onSelect = (e) => { + if (e.target.value === 'month') { + setStime(moment().startOf('month').format('YYYY-MM-DD HH:mm:ss')); + setEtime(moment().endOf('month').format('YYYY-MM-DD HH:mm:ss')) - }else{ - setStime(moment().startOf('year').format("YYYY-MM-DD HH:mm:ss")) - setEtime(moment().endOf('year').format('YYYY-MM-DD HH:mm:ss')) + } else { + setStime(moment().startOf('year').format("YYYY-MM-DD HH:mm:ss")) + setEtime(moment().endOf('year').format('YYYY-MM-DD HH:mm:ss')) + + } + setMode(e.target.value) + setDateValue([]) } - console.log('11111',moment().startOf('year').format('YYYY-MM-DD HH:mm:ss')) - setMode(e.target.value) - setDateValue([]) - -} + + const column = [ + { + title: '序号', + render: (t, r, i) => { + return i + 1 + } + }, + { + title: '任务名称', + dataIndex: 'missionName', + }, + { + title: '责任人', + render: (record) => { + return + {record?.maintenancePlanExecuteUsers.map((item) => { + return item.name + }).toString() + } + + } + }, + { + title: '完成情况', + dataIndex: 'state', + render: (t, record) => t || '--' + }, + { + title: '备注', + dataIndex: 'remark', + render: (t, record) => t || '--' + }, + { + title: '计划完成时间', + render: (record) => { + return {moment(record.planFinishTime).format('YYYY-MM-DD')} + }, + }, + { + title: '实际完成时间', + render: (record) => { + return record.actualFinishTime ? {moment(record.actualFinishTime).format('YYYY-MM-DD')} : '--' + }, + }, + ]; return ( -
-
-
-
系统可用性
-
- onSelect(e)} value={mode} type="button"> - 本月 - 全年 - - onChangeDate(e) } - density="compact" - style={{ width: 400 }} - value={dateValue} - onClear={()=>{clearHandler()}} +
+
+
+
系统可用性
+
+ onSelect(e)} value={mode} type="button"> + 本月 + 全年 + + onChangeDate(e)} + density="compact" + style={{ width: 400 }} + value={dateValue} + onClear={() => { clearHandler() }} />
-
-
- {`系统可用性=(平均故障间隔MTBF)/(平均故障间隔MTBF+故障恢复时间MTTR)*100%`} - {calculability} -
-
+
+
+ {`系统可用性=(平均故障间隔MTBF)/(平均故障间隔MTBF+故障恢复时间MTTR)*100%`} + {calculability} +
+
-
+
产生时间 - { - setStartTime((e[0])+'');setEndTime(e[1]+'') }} - onClear={()=>{setStartTime('1970-1-1');setEndTime('2099-12-31')}} /> -
-
-
- { + +
+
{ return { - background:'#000000', + background: '#000000', } - }}/> + }} /> -
- - 共{total}条信息 - - { - setPageIndex(pageIndex) - setPageSize(pageSize) - const query={ - startTime,endTime,pageIndex,pageSize - } - getRecordList(query) - }}> -
- { setModalVis(false);getRecordList();setRecordRow(null)}} recordRow={recordRow} pepList={pepList}> +
+ + 共{total}条信息 + + { + setPageIndex(pageIndex) + setPageSize(pageSize) + const query = { + startTime, endTime, pageIndex, pageSize + } + getRecordList(query) + }}>
- + { setModalVis(false); getRecordList(); setRecordRow(null) }} + recordRow={recordRow} pepList={pepList}> + { + setAddVis(false); + getRecordList() + setRecordRow(null) + }} + recordRow={recordRow} /> + { + setVisible(false) + }} + onCancel={() => { + setVisible(false) + }} + > +
{ + return { + background: '#000000', + } + }} /> + + + ) } @@ -251,7 +365,7 @@ function mapStateToProps (state) { return { // loading: members.isRequesting, // user: auth.user, - actions: global.actions, + actions: global.actions, // members: members.data, // socket: webSocket.socket }; diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js index 6a1428a..60f33ec 100644 --- a/web/client/src/utils/webapi.js +++ b/web/client/src/utils/webapi.js @@ -129,7 +129,10 @@ export const ApiTable = { //获取设备类型 getEquipmentCategory: 'equipmentCategory', //获取状态数据 - getMaintenanceStatus: 'maintenanceStatus' + getMaintenanceStatus: 'maintenanceStatus', + + + respondRecord: 'respond-record', }; // 项企的接口