From 6f5614466b231e5192f78fac410fc79ab8a26b54 Mon Sep 17 00:00:00 2001 From: "peng.peng" Date: Fri, 24 Feb 2023 17:04:11 +0800 Subject: [PATCH 1/8] 1 --- web/client/src/sections/auth/containers/login.js | 1 + web/log/development.txt | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/web/client/src/sections/auth/containers/login.js b/web/client/src/sections/auth/containers/login.js index 63bbe0c..dcba5df 100644 --- a/web/client/src/sections/auth/containers/login.js +++ b/web/client/src/sections/auth/containers/login.js @@ -11,6 +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 '../style.less'; const FormItem = Form.Item; diff --git a/web/log/development.txt b/web/log/development.txt index b661539..b52e885 100644 --- a/web/log/development.txt +++ b/web/log/development.txt @@ -5621,3 +5621,9 @@ 2023-01-31 15:24:19.135 - debug: [FS-LOGGER] Init. 2023-01-31 15:24:19.138 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment) 2023-01-31 15:24:19.487 - info: [Router] Inject api: attachment/index +2023-02-24 16:22:28.531 - debug: [FS-LOGGER] Init. +2023-02-24 16:22:28.534 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment) +2023-02-24 16:22:28.719 - info: [Router] Inject api: attachment/index +2023-02-24 16:56:08.557 - debug: [FS-LOGGER] Init. +2023-02-24 16:56:08.559 - debug: init fs.attachment and inject it into app(app.fs.attachment) and runtime ctx(ctx.fs.attachment) +2023-02-24 16:56:08.778 - info: [Router] Inject api: attachment/index From 0e7ed90898feb9cf99c02878abbb09e563e4c5c0 Mon Sep 17 00:00:00 2001 From: "peng.peng" Date: Mon, 27 Feb 2023 15:25:14 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/client/src/app.js | 3 +- .../issueHandle/actions/checkItems.js | 78 +++++++ .../src/sections/issueHandle/actions/index.js | 13 ++ .../src/sections/issueHandle/actions/plan.js | 80 +++++++ .../sections/issueHandle/actions/record.js | 17 ++ .../sections/issueHandle/actions/template.js | 47 ++++ .../components/isuue-handle-mdal.js | 207 +++++++++++++++++ .../sections/issueHandle/containers/index.js | 5 + .../issueHandle/containers/patrolRecord.js | 211 ++++++++++++++++++ web/client/src/sections/issueHandle/index.js | 15 ++ .../src/sections/issueHandle/nav-item.js | 18 ++ .../sections/issueHandle/reducers/index.js | 5 + .../sections/issueHandle/reducers/record.js | 32 +++ web/client/src/sections/issueHandle/routes.js | 13 ++ .../src/sections/issueHandle/style.less | 13 ++ 15 files changed, 756 insertions(+), 1 deletion(-) create mode 100644 web/client/src/sections/issueHandle/actions/checkItems.js create mode 100644 web/client/src/sections/issueHandle/actions/index.js create mode 100644 web/client/src/sections/issueHandle/actions/plan.js create mode 100644 web/client/src/sections/issueHandle/actions/record.js create mode 100644 web/client/src/sections/issueHandle/actions/template.js create mode 100644 web/client/src/sections/issueHandle/components/isuue-handle-mdal.js create mode 100644 web/client/src/sections/issueHandle/containers/index.js create mode 100644 web/client/src/sections/issueHandle/containers/patrolRecord.js create mode 100644 web/client/src/sections/issueHandle/index.js create mode 100644 web/client/src/sections/issueHandle/nav-item.js create mode 100644 web/client/src/sections/issueHandle/reducers/index.js create mode 100644 web/client/src/sections/issueHandle/reducers/record.js create mode 100644 web/client/src/sections/issueHandle/routes.js create mode 100644 web/client/src/sections/issueHandle/style.less diff --git a/web/client/src/app.js b/web/client/src/app.js index 98d351d..1597273 100644 --- a/web/client/src/app.js +++ b/web/client/src/app.js @@ -7,6 +7,7 @@ import Safetymanage from './sections/safetymanage'; import ProjectRegime from './sections/projectRegime'; import Organization from './sections/organization'; import PatrolManage from './sections/patrolManage'; +import IssueHandle from './sections/issueHandle' const App = props => { const { projectName } = props @@ -18,7 +19,7 @@ const App = props => { return ( ) diff --git a/web/client/src/sections/issueHandle/actions/checkItems.js b/web/client/src/sections/issueHandle/actions/checkItems.js new file mode 100644 index 0000000..f7a2666 --- /dev/null +++ b/web/client/src/sections/issueHandle/actions/checkItems.js @@ -0,0 +1,78 @@ +'use strict'; + +import { basicAction } from '@peace/utils' +import { ApiTable } from '$utils' + +export function getCheckItemsGroup() { + return dispatch => basicAction({ + type: 'get', + dispatch: dispatch, + actionType: 'GET_CHECK_ITEMS_GRROUP', + url: ApiTable.checkItemsGroup, + msg: { error: '获取检查项分组失败' }, + reducer:{name:'checkItemsGroup'} + }); +} + +export function createCheckItemsGroup(data) { + return dispatch => basicAction({ + type: 'post', + data, + dispatch: dispatch, + actionType: 'CREATE_CHECK_ITEMS_GRROUP', + url: ApiTable.checkItemsGroup, + msg: { option: '创建检查项分组' }, + }); +} + +export function getCheckItems(query) { + return dispatch => basicAction({ + type: 'get', + dispatch: dispatch, + query: query, + actionType: 'GET_CHECK_ITEMS', + url: ApiTable.checkItems, + msg: { error: '获取检查项失败' } + }); +} + +export function createCheckItems(data) { + return dispatch => basicAction({ + type: 'post', + data, + dispatch: dispatch, + actionType: 'CREATE_CHECK_ITEMS', + url: ApiTable.checkItems, + msg: { option: '新建检查项' }, + }); +} + +export function updateCheckItems(id, data) { + return dispatch => basicAction({ + type: 'put', + data, + dispatch: dispatch, + actionType: 'UPDATE_CHECK_ITEMS', + url: ApiTable.updateCheckItems.replace('{id}', id), + msg: { option: '修改检查项' }, + }); +} + +export function delCheckItems(ids) { + return dispatch => basicAction({ + type: 'del', + dispatch: dispatch, + actionType: 'DEL_CHECK_ITEMS', + url: ApiTable.delCheckItems.replace('{ids}', ids), + msg: { option: '删除检查项' }, + }); +} + +export default { + getCheckItemsGroup, + createCheckItemsGroup, + getCheckItems, + createCheckItems, + updateCheckItems, + delCheckItems, +} \ No newline at end of file diff --git a/web/client/src/sections/issueHandle/actions/index.js b/web/client/src/sections/issueHandle/actions/index.js new file mode 100644 index 0000000..d6e7974 --- /dev/null +++ b/web/client/src/sections/issueHandle/actions/index.js @@ -0,0 +1,13 @@ +'use strict'; + +import * as plan from './plan' +import * as record from './record' +import * as template from './template' +import * as checkItems from './checkItems' + +export default { + ...plan, + ...record, + ...template, + ...checkItems, +} \ No newline at end of file diff --git a/web/client/src/sections/issueHandle/actions/plan.js b/web/client/src/sections/issueHandle/actions/plan.js new file mode 100644 index 0000000..6b94bca --- /dev/null +++ b/web/client/src/sections/issueHandle/actions/plan.js @@ -0,0 +1,80 @@ +'use strict'; + +import { basicAction } from '@peace/utils' +import { ApiTable } from '$utils' + +export function getPatrolPlan() { + return dispatch => basicAction({ + type: 'get', + dispatch: dispatch, + actionType: 'GET_PATROL_PLAN', + url: ApiTable.patrolPlan, + msg: { error: '获取巡检计划失败' }, + }); +} + +export function createPatrolPlan(data) { + return dispatch => basicAction({ + type: 'post', + data, + dispatch: dispatch, + actionType: 'CREATE_PATROL_PLAN', + url: ApiTable.patrolPlan, + msg: { error: '新增巡检计划失败' }, + }); +} + +export function delPatrolPlan(id) { + return dispatch => basicAction({ + type: 'del', + dispatch: dispatch, + actionType: 'DEL_PATROL_PLAN', + url: ApiTable.delPatrolPlan.replace('{id}', id), + msg: { error: '删除巡检计划失败' }, + }); +} + +export function updatePatrolPlan(data) { + return dispatch => basicAction({ + type: 'put', + data, + dispatch: dispatch, + actionType: 'UPDATE_PATROL_PLAN', + url: ApiTable.patrolPlan, + msg: { error: '修改巡检计划失败' }, + }); +} + +export function getUserList() { + return dispatch => basicAction({ + type: 'get', + dispatch: dispatch, + actionType: 'GET_USER_LIST', + url: ApiTable.getDepUser.replace('{depId}', null), + msg: { error: '获取人员列表失败' }, + reducer: { name: 'userList' } + }); +} + +export function getProjectList(query) { + return (dispatch) => basicAction({ + type: 'get', + query, + dispatch, + actionType: 'GET_PROJEECT_LIST', + url: ApiTable.getProjectList, + msg: { error: '获取结构物列表失败', }, + reducer: { name: 'structureList' } + }); +} + +export function positionList(query) { + return (dispatch) => basicAction({ + type: 'get', + query, + dispatch, + actionType: 'POSITION_LIST', + url: ApiTable.position, + msg: { error: '获取点位列表失败', }, + }); +} \ No newline at end of file diff --git a/web/client/src/sections/issueHandle/actions/record.js b/web/client/src/sections/issueHandle/actions/record.js new file mode 100644 index 0000000..a6ae77e --- /dev/null +++ b/web/client/src/sections/issueHandle/actions/record.js @@ -0,0 +1,17 @@ +'use strict'; + +import { basicAction } from '@peace/utils' + +export const GET_PATROL_RECORD_LIST = 'GET_PATROL_RECORD_LIST'; +export const GET_PATROL_RECORD_LIST_SUCCESS = 'GET_PATROL_RECORD_LIST_SUCCESS'; +export const GET_PATROL_RECORD_LIST_ERROR = 'GET_PATROL_RECORD_LIST_ERROR'; +export function records(url) { + return (dispatch) => basicAction({ + type: 'get', + dispatch, + actionType: GET_PATROL_RECORD_LIST, + url: url, + msg: { error: '获取巡检记录失败', }, + reducer: { name: 'record' } + }); +} \ No newline at end of file diff --git a/web/client/src/sections/issueHandle/actions/template.js b/web/client/src/sections/issueHandle/actions/template.js new file mode 100644 index 0000000..0442191 --- /dev/null +++ b/web/client/src/sections/issueHandle/actions/template.js @@ -0,0 +1,47 @@ +'use strict'; + +import { basicAction } from '@peace/utils' +import { ApiTable } from '$utils' + +export function getPatrolTemplate () { + return dispatch => basicAction({ + type: 'get', + dispatch: dispatch, + actionType: 'GET_PATROL_TEMPLATE', + url: ApiTable.patrolTemplate, + msg: { error: '获取巡检模板失败' }, + reducer: { name: 'patrolTemplate' } + }); +} + +export function createPatrolTemplate (data) { + return dispatch => basicAction({ + type: 'post', + data, + dispatch: dispatch, + actionType: 'CREATE_PATROL_TEMPLATE', + url: ApiTable.patrolTemplate, + msg: { option: '新增巡检模板' }, + }); +} + +export function delPatrolTemplate (id) { + return dispatch => basicAction({ + type: 'del', + dispatch: dispatch, + actionType: 'DEL_PATROL_TEMPLATE', + url: ApiTable.delPatrolTemplate.replace('{id}', id), + msg: { option: '删除巡检模板' }, + }); +} + +export function updatePatrolTemplate (data) { + return dispatch => basicAction({ + type: 'put', + data, + dispatch: dispatch, + actionType: 'UPDATE_PATROL_TEMPLATE', + url: ApiTable.patrolTemplate, + msg: { option: '修改巡检模板' }, + }); +} \ No newline at end of file diff --git a/web/client/src/sections/issueHandle/components/isuue-handle-mdal.js b/web/client/src/sections/issueHandle/components/isuue-handle-mdal.js new file mode 100644 index 0000000..4c14b5b --- /dev/null +++ b/web/client/src/sections/issueHandle/components/isuue-handle-mdal.js @@ -0,0 +1,207 @@ +import React, { useState, useRef } from 'react'; +import { Button, Form, Row, Col, Table, Popconfirm, Input, message } from 'antd'; +import { + ModalForm, + ProFormText, + ProFormSelect, + ProFormTextArea, + ProFormDatePicker +} from '@ant-design/pro-form'; +import Uploads from '$components/Uploads'; +import moment from 'moment'; +const FormItem = Form.Item; +//state: 1下发未上报 2已上报待审批 3整改完成 上报结果result: status 0 已上报未审批 1 审批通过 2 审批驳回 +export default (props) => { + const { title, triggerRender, editData = null, onFinish, readOnly, companyList, user } = props; + const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 16 } }; + const initialValues = editData ? { + ...editData + } : {}; + const [reason, setReason] = useState('') + + + const columns = [ + { + title: '序号', + dataIndex: 'index', + key: 'index', + render: (text, record, index) => index + 1 + }, + { + title: '提交时间', + dataIndex: 'time', + key: 'time', + }, + { + title: '整改附件', + dataIndex: 'file', + key: 'file', + render: (text, record) => { + return + } + }, + { + title: '结论', + dataIndex: 'status', + key: 'status', + // 0 未审批 1 通过 2驳回 + render: (text, record) => { + return user?.departmentId != -1 && record?.status === 0 ? <> + 驳回原因: { + setReason(e.target.value) + }} />} + onConfirm={() => { + if (!reason) { + message.warning('未填写驳回原因'); + return; + } + handleResult(false) + }} > + + + + : record?.status === 1 ? "整改完成" : record?.reason + } + }, + ]; + + const handleResult = (approve) => { + const results = JSON.parse(JSON.stringify(editData?.result || [])) + results[results.length - 1] = { + ...results[results.length - 1], status: approve ? 1 : 2, + reason + } + onFinish && onFinish({ + msg: approve ? '任务审批' : '任务驳回', + state: approve ? 3 : 1, + result: results + }, editData) + } + + return ( + + {title || ''} + + } + width={1200} + layout="horizontal" + // grid={true} + {...formItemLayout} + modalProps={{ + destroyOnClose: true, + onCancel: () => { }, + bodyStyle: { height: 720, overflowY: 'auto' } + }} + onFinish={async (values) => { + + onFinish && await onFinish(values, editData) + //message.success('提交成功'); + return true; + }} + submitter={!readOnly} + > +
+ {/* */} +
{"巡检信息"}
+
+ + + + + + + + + + + + + + + + + + + +
+ +
{"问题详情"}
+ + + + + + + + + { + Object.keys(editData?.points?.inspectContent).map(key => { + if (editData?.points?.inspectContent[key]?.isNormal == false) { + return + + + + + + + + + + + + + + + { + let nextV = [] + for (let s of (editData?.points?.inspectContent[key].imgs || [])) { + if (s) { + nextV.push({ + storageUrl: s + }) + } + } + return nextV + })() + } + /> + + + + + } + }) + } + + + + +
{"维修计划信息"}
+
+ + + +
+ ); +}; \ No newline at end of file diff --git a/web/client/src/sections/issueHandle/containers/index.js b/web/client/src/sections/issueHandle/containers/index.js new file mode 100644 index 0000000..2a7741e --- /dev/null +++ b/web/client/src/sections/issueHandle/containers/index.js @@ -0,0 +1,5 @@ +'use strict'; + +import PatrolReocrd from './patrolRecord'; + +export { PatrolReocrd }; \ No newline at end of file diff --git a/web/client/src/sections/issueHandle/containers/patrolRecord.js b/web/client/src/sections/issueHandle/containers/patrolRecord.js new file mode 100644 index 0000000..938dae2 --- /dev/null +++ b/web/client/src/sections/issueHandle/containers/patrolRecord.js @@ -0,0 +1,211 @@ + +'use strict' + +import React, { useEffect, useState } from 'react'; +import { connect } from 'react-redux'; +import { Form, Input, Select, Button, Table, Modal, DatePicker, Checkbox, Row, Col, Collapse } from 'antd'; +import moment from "moment"; +import Uploads from '$components/Uploads'; +import IssueHandleModal from '../components/isuue-handle-mdal' +import '../style.less' + +const { Panel } = Collapse; + +const PatrolRecord = (props) => { + const { dispatch, actions, user } = props + const { patrolManage } = actions + const [tableList, settableList] = useState([]) + const [showDetailModal, setShowDetail] = useState(false) + const [modelData, setModelData] = useState({}) + const [query, setQuery] = useState({ limit: 10, page: 0 }) + const [limits, setLimits] = useState() + const format = 'YYYY-MM-DD HH:mm:ss' + const times = [moment().subtract(70, 'years').format(format), moment().format(format)] + const [search, setSearch] = useState({ name: null, time: [times[0], times[1]], state: 'null' }) + + useEffect(() => { + record(search) + }, []) + + const record = (params) => { + dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/null/null`)).then(res => { + if (res.success) { + settableList(params.name != null ? res.payload.data?.filter(v => + (v.points.user.name.indexOf(params.name) != -1 || v.points.project.name.indexOf(params.name) != -1)) + .map(v => ({ ...v, key: v.id })) : res.payload.data?.map(v => ({ ...v, key: v.id }))) + setLimits(res.payload.data?.length) + } + }) + } + + const onFinish = () => { + + } + + const renderOptionText = (currentState) => { + let text = '查看' + if (user?.departmentId == -1) { + if (currentState == 1) text = '整改' + } else { + if (currentState == 2) text = '审批' + } + + return text + } + + const columns = [{ + title: '结构物名称', + dataIndex: 'name', + key: 'name', + width: '10%', + showInDetail: true, + render: (text, record, index) => { + return !record.points?.project ? '' :
{record.points.project.name}
+ } + }, { + title: '巡检计划', + dataIndex: 'name', + key: 'name', + width: '10%', + showInDetail: true, + render: (text, record, index) => { + return !record.patrolPlan ? '' :
{record.patrolPlan.name}
+ } + }, { + title: '巡检点位', + dataIndex: 'type', + key: 'type', + showInDetail: true, + width: '10%', + render: (text, record, index) => { + return !record.points?.user ? '' :
{record.points.itemData.name}
+ } + }, { + title: '巡检人', + dataIndex: 'type', + key: 'type', + showInDetail: true, + width: '10%', + render: (text, record, index) => { + return !record.points?.user ? '' :
{record.points.user.name}
+ } + }, { + title: '巡检单位', + dataIndex: 'type', + showInDetail: true, + key: 'type', + width: '10%', + render: (text, record, index) => { + return !record.points?.user ? '' :
{record.points.user.department.name}
+ } + }, { + title: '巡检频次', + dataIndex: 'describe', + key: 'describe', + showInDetail: true, + width: '10%', + render: (text, record, index) => { + return !record.points ? '' :
{record.points.frequency}
+ } + }, { + title: '上次巡检日期', + dataIndex: 'describe', + showInDetail: true, + key: 'describe', + render: (text, record, index) => record.lastInspectionTime ? moment(record.lastInspectionTime).format('YYYY-MM-DD HH:mm:ss') : '--' + }, { + title: '本次巡检日期', + dataIndex: 'describe', + key: 'describe', + showInDetail: true, + render: (text, record, index) => moment(record.inspectionTime).format('YYYY-MM-DD HH:mm:ss') || '--' + }, { + title: '巡检结果', + dataIndex: 'describe', + key: 'describe', + render: (text, record, index) => !record.alarm ? '正常' : '异常' + }, { + title: '操作', + dataIndex: 'operation', + key: 'operation', + render: (text, record, index) => { + return ( + {renderOptionText(1)}} + user={{}} + onFinish={onFinish} /> + ) + } + } + ] + + return ( +
+
+
{ + record({ + name: r.name, + }) + }} + > + + + + + + + { pagination={{ showSizeChanger: true, pageSizeOptions: [10, 20, 50], - + }} /> - +
) } From e496857fcd6ccebe5f382960361c4ac940517248 Mon Sep 17 00:00:00 2001 From: "peng.peng" Date: Mon, 27 Feb 2023 16:41:03 +0800 Subject: [PATCH 4/8] =?UTF-8?q?(+)=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= =?UTF-8?q?=E8=A1=A8=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../8.create_patrol_record_issue_handle.sql | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 script/1.0.3/schema/8.create_patrol_record_issue_handle.sql diff --git a/script/1.0.3/schema/8.create_patrol_record_issue_handle.sql b/script/1.0.3/schema/8.create_patrol_record_issue_handle.sql new file mode 100644 index 0000000..296196c --- /dev/null +++ b/script/1.0.3/schema/8.create_patrol_record_issue_handle.sql @@ -0,0 +1,54 @@ +DROP TABLE IF EXISTS "public"."patrol_record_issue_handle"; +create table patrol_record_issue_handle +( + id serial + constraint patrol_record_issue_handle_pk + primary key, + patrol_record_id integer, + repair_person jsonb, + repair_unit varchar(255), + start_time timestamp(6) with time zone, + end_time timestamp(6) with time zone, + repair_ask integer, + check_person jsonb, + state integer, + approve_person jsonb, + approve_date timestamp(6) with time zone, + approve_opinion varchar(255), + repair_desc varchar(255), + repair_image jsonb +); + +comment on column patrol_record_issue_handle.patrol_record_id is '巡检记录id'; + +comment on column patrol_record_issue_handle.repair_person is '维修人'; + +comment on column patrol_record_issue_handle.repair_unit is '维修单位'; + +comment on column patrol_record_issue_handle.repair_ask is '维修要求'; + +comment on column patrol_record_issue_handle.check_person is '质检验收人'; + +comment on column patrol_record_issue_handle.state is '流程状态 +1 待制定计划 +2 待审核 +3 计划驳回 +4 待维修 +5 待验收 +6 验收通过 +7 验收不通过'; + +comment on column patrol_record_issue_handle.approve_person is '审批人'; + +comment on column patrol_record_issue_handle.approve_date is '审批日期'; + +comment on column patrol_record_issue_handle.approve_opinion is '审批意见'; + +comment on column patrol_record_issue_handle.repair_desc is '维修情况描述'; + +alter table patrol_record_issue_handle + owner to "FashionAdmin"; + +create unique index patrol_record_issue_handle_id_uindex + on patrol_record_issue_handle (id); + From 7f5875172b1f28eb899257f8dda676e3ef6c62ee Mon Sep 17 00:00:00 2001 From: "peng.peng" Date: Mon, 27 Feb 2023 16:48:06 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E5=A4=84=E7=90=86?= =?UTF-8?q?=E4=B8=8A=E6=8A=A5=20=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/patrolManage/patrolRecord.js | 45 +++++++++++++++++++ .../lib/routes/patrolManage/patrolRecord.js | 8 ++++ 2 files changed, 53 insertions(+) diff --git a/api/app/lib/controllers/patrolManage/patrolRecord.js b/api/app/lib/controllers/patrolManage/patrolRecord.js index 204177a..2f57216 100644 --- a/api/app/lib/controllers/patrolManage/patrolRecord.js +++ b/api/app/lib/controllers/patrolManage/patrolRecord.js @@ -169,7 +169,52 @@ async function addPatrolRecord(ctx, next) { } } +// 新建维修处理计划成功 +function addPatrolRecordIssueHandle(opts) { + return async function (ctx, next) { + + const models = ctx.fs.dc.models; + try { + let rslt = ctx.request.body; + await models.PatrolRecordIssueHandle.create(Object.assign({}, rslt)) + ctx.status = 204; + ctx.body = { message: '新建维修处理计划成功' } + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { message: '新建修处理计划失败' } + } + } +} + + +// 修改维修处理计划 +function editPatrolRecordIssueHandle(opts) { + return async function (ctx, next) { + + try { + const models = ctx.fs.dc.models; + const { id } = ctx.params; + const body = ctx.request.body; + await models.PatrolRecordIssueHandle.update( + body, + { where: { id: id, } } + ) + ctx.status = 204; + ctx.body = { message: '修改维修处理计划成功' } + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { message: '修改维修处理计划失败' } + } + } +} + + module.exports = { findPatrolRecord, addPatrolRecord, + addPatrolRecordIssueHandle, + editPatrolRecordIssueHandle + } \ No newline at end of file diff --git a/api/app/lib/routes/patrolManage/patrolRecord.js b/api/app/lib/routes/patrolManage/patrolRecord.js index 0e82885..376cad3 100644 --- a/api/app/lib/routes/patrolManage/patrolRecord.js +++ b/api/app/lib/routes/patrolManage/patrolRecord.js @@ -9,4 +9,12 @@ module.exports = function (app, router, opts) { app.fs.api.logAttr['POST/patrolRecord/add'] = { content: '新增巡检记录', visible: true } router.post('/patrolRecord/add', patrolRecord.addPatrolRecord); + + app.fs.api.logAttr['POST/patrolRecord/issue/handle'] = { content: '增加维修处理计划', visible: true }; + router.post('/patrolRecord/issue/handle', patrolRecord.addPatrolRecordIssueHandle(opts)) + + + // 修改维修处理计划 + app.fs.api.logAttr['PUT/patrolRecord/issue/handle/:id'] = { content: '修改维修处理计划', visible: true }; + router.put('/patrolRecord/issue/handle/:id', patrolRecord.editPatrolRecordIssueHandle(opts)) }; \ No newline at end of file From 8f936618b560d9fad625e07ae4eb5a736c1a8d21 Mon Sep 17 00:00:00 2001 From: "peng.peng" Date: Tue, 28 Feb 2023 10:46:01 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E7=B1=BB=E5=9E=8B=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/models/patrol_record_issue_handle.js | 2 +- script/1.0.3/schema/8.create_patrol_record_issue_handle.sql | 2 +- web/client/src/utils/webapi.js | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/api/app/lib/models/patrol_record_issue_handle.js b/api/app/lib/models/patrol_record_issue_handle.js index a46ddba..ec8e09b 100644 --- a/api/app/lib/models/patrol_record_issue_handle.js +++ b/api/app/lib/models/patrol_record_issue_handle.js @@ -62,7 +62,7 @@ module.exports = dc => { autoIncrement: false }, repairAsk: { - type: DataTypes.INTEGER, + type: DataTypes.STRING, allowNull: true, defaultValue: null, comment: "维修要求", diff --git a/script/1.0.3/schema/8.create_patrol_record_issue_handle.sql b/script/1.0.3/schema/8.create_patrol_record_issue_handle.sql index 296196c..b2e9548 100644 --- a/script/1.0.3/schema/8.create_patrol_record_issue_handle.sql +++ b/script/1.0.3/schema/8.create_patrol_record_issue_handle.sql @@ -9,7 +9,7 @@ create table patrol_record_issue_handle repair_unit varchar(255), start_time timestamp(6) with time zone, end_time timestamp(6) with time zone, - repair_ask integer, + repair_ask varchar(255), check_person jsonb, state integer, approve_person jsonb, diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js index b2005f4..a4ab9b4 100644 --- a/web/client/src/utils/webapi.js +++ b/web/client/src/utils/webapi.js @@ -59,6 +59,8 @@ export const ApiTable = { addCheckTask: '/addcheckTask', editCheckTask: '/editcheckTask', delCheckTask: '/delcheckTask/:id', + addPatrolRecordIssueHandle: 'patrolRecord/issue/handle', + modifyPatrolRecordIssueHandle: 'patrolRecord/issue/handle/{id}', //协调申请 getCoordinateList: 'risk/coordinate', @@ -115,7 +117,7 @@ export const ApiTable = { position: 'position', delPosition: 'delPosition/{id}', qrCodeShow: 'qrCodeShow', - q:'q', + q: 'q', //视频接入配置 siteList: 'siteList', From d8f71bf9f8f89d210fbefa18716bb7a0902fe9d3 Mon Sep 17 00:00:00 2001 From: "peng.peng" Date: Tue, 28 Feb 2023 11:16:48 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=B6=E5=AE=9A=E4=BA=BA=E5=88=B6=E5=AE=9A?= =?UTF-8?q?=E6=97=A5=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/models/patrol_record_issue_handle.js | 20 ++++++++++++++++++- .../8.create_patrol_record_issue_handle.sql | 8 +++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/api/app/lib/models/patrol_record_issue_handle.js b/api/app/lib/models/patrol_record_issue_handle.js index ec8e09b..7f592bd 100644 --- a/api/app/lib/models/patrol_record_issue_handle.js +++ b/api/app/lib/models/patrol_record_issue_handle.js @@ -132,7 +132,25 @@ module.exports = dc => { primaryKey: false, field: "repair_image", autoIncrement: false - } + }, + creator: { + type: DataTypes.JSONB, + allowNull: true, + defaultValue: null, + comment: "审批人", + primaryKey: false, + field: "creator", + autoIncrement: false + }, + createTime: { + type: DataTypes.DATE, + allowNull: true, + defaultValue: null, + comment: "制定日期", + primaryKey: false, + field: "approve_date", + autoIncrement: false + }, }, { tableName: "patrol_record_issue_handle", comment: "", diff --git a/script/1.0.3/schema/8.create_patrol_record_issue_handle.sql b/script/1.0.3/schema/8.create_patrol_record_issue_handle.sql index b2e9548..abf36fc 100644 --- a/script/1.0.3/schema/8.create_patrol_record_issue_handle.sql +++ b/script/1.0.3/schema/8.create_patrol_record_issue_handle.sql @@ -16,7 +16,9 @@ create table patrol_record_issue_handle approve_date timestamp(6) with time zone, approve_opinion varchar(255), repair_desc varchar(255), - repair_image jsonb + repair_image jsonb, + creator jsonb, + create_time timestamp(6) with time zone, ); comment on column patrol_record_issue_handle.patrol_record_id is '巡检记录id'; @@ -46,6 +48,10 @@ comment on column patrol_record_issue_handle.approve_opinion is '审批意见'; comment on column patrol_record_issue_handle.repair_desc is '维修情况描述'; +comment on column patrol_record_issue_handle.creator is '制定人'; + +comment on column patrol_record_issue_handle.create_time is '制定日期'; + alter table patrol_record_issue_handle owner to "FashionAdmin"; From 2d6927b941ee2568e4a13bb0341cb10539c484d5 Mon Sep 17 00:00:00 2001 From: "peng.peng" Date: Tue, 28 Feb 2023 15:04:06 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/patrolManage/patrolRecord.js | 1 + .../lib/models/patrol_record_issue_handle.js | 2 +- api/app/lib/models/user.js | 18 +- .../issueHandle/actions/checkItems.js | 78 ---- .../src/sections/issueHandle/actions/index.js | 10 +- .../src/sections/issueHandle/actions/plan.js | 80 ---- .../sections/issueHandle/actions/record.js | 35 +- .../sections/issueHandle/actions/template.js | 47 --- .../components/isuue-handle-mdal.js | 377 +++++++++++------- .../issueHandle/containers/patrolRecord.js | 226 +++++------ 10 files changed, 359 insertions(+), 515 deletions(-) delete mode 100644 web/client/src/sections/issueHandle/actions/checkItems.js delete mode 100644 web/client/src/sections/issueHandle/actions/plan.js delete mode 100644 web/client/src/sections/issueHandle/actions/template.js diff --git a/api/app/lib/controllers/patrolManage/patrolRecord.js b/api/app/lib/controllers/patrolManage/patrolRecord.js index 2f57216..f78d5f3 100644 --- a/api/app/lib/controllers/patrolManage/patrolRecord.js +++ b/api/app/lib/controllers/patrolManage/patrolRecord.js @@ -150,6 +150,7 @@ async function addPatrolRecord(ctx, next) { const curPlanRecord = await models.PatrolRecord.findAndCountAll({ where: { patrolPlanId } }); + const patrolCount = curPlanRecord.count; await models.PatrolPlan.update({ patrolCount }, { where: { id: patrolPlanId }, diff --git a/api/app/lib/models/patrol_record_issue_handle.js b/api/app/lib/models/patrol_record_issue_handle.js index 7f592bd..af565e1 100644 --- a/api/app/lib/models/patrol_record_issue_handle.js +++ b/api/app/lib/models/patrol_record_issue_handle.js @@ -148,7 +148,7 @@ module.exports = dc => { defaultValue: null, comment: "制定日期", primaryKey: false, - field: "approve_date", + field: "create_time", autoIncrement: false }, }, { diff --git a/api/app/lib/models/user.js b/api/app/lib/models/user.js index 9d7999a..0e1c4c6 100644 --- a/api/app/lib/models/user.js +++ b/api/app/lib/models/user.js @@ -96,15 +96,15 @@ module.exports = dc => { field: "post", autoIncrement: false }, - structure: { - type: DataTypes.STRING, - allowNull: true, - defaultValue: null, - comment: "结构物", - primaryKey: false, - field: "structure", - autoIncrement: false - } + // structure: { + // type: DataTypes.STRING, + // allowNull: true, + // defaultValue: null, + // comment: "结构物", + // primaryKey: false, + // field: "structure", + // autoIncrement: false + // } }, { tableName: "user", comment: "", diff --git a/web/client/src/sections/issueHandle/actions/checkItems.js b/web/client/src/sections/issueHandle/actions/checkItems.js deleted file mode 100644 index f7a2666..0000000 --- a/web/client/src/sections/issueHandle/actions/checkItems.js +++ /dev/null @@ -1,78 +0,0 @@ -'use strict'; - -import { basicAction } from '@peace/utils' -import { ApiTable } from '$utils' - -export function getCheckItemsGroup() { - return dispatch => basicAction({ - type: 'get', - dispatch: dispatch, - actionType: 'GET_CHECK_ITEMS_GRROUP', - url: ApiTable.checkItemsGroup, - msg: { error: '获取检查项分组失败' }, - reducer:{name:'checkItemsGroup'} - }); -} - -export function createCheckItemsGroup(data) { - return dispatch => basicAction({ - type: 'post', - data, - dispatch: dispatch, - actionType: 'CREATE_CHECK_ITEMS_GRROUP', - url: ApiTable.checkItemsGroup, - msg: { option: '创建检查项分组' }, - }); -} - -export function getCheckItems(query) { - return dispatch => basicAction({ - type: 'get', - dispatch: dispatch, - query: query, - actionType: 'GET_CHECK_ITEMS', - url: ApiTable.checkItems, - msg: { error: '获取检查项失败' } - }); -} - -export function createCheckItems(data) { - return dispatch => basicAction({ - type: 'post', - data, - dispatch: dispatch, - actionType: 'CREATE_CHECK_ITEMS', - url: ApiTable.checkItems, - msg: { option: '新建检查项' }, - }); -} - -export function updateCheckItems(id, data) { - return dispatch => basicAction({ - type: 'put', - data, - dispatch: dispatch, - actionType: 'UPDATE_CHECK_ITEMS', - url: ApiTable.updateCheckItems.replace('{id}', id), - msg: { option: '修改检查项' }, - }); -} - -export function delCheckItems(ids) { - return dispatch => basicAction({ - type: 'del', - dispatch: dispatch, - actionType: 'DEL_CHECK_ITEMS', - url: ApiTable.delCheckItems.replace('{ids}', ids), - msg: { option: '删除检查项' }, - }); -} - -export default { - getCheckItemsGroup, - createCheckItemsGroup, - getCheckItems, - createCheckItems, - updateCheckItems, - delCheckItems, -} \ No newline at end of file diff --git a/web/client/src/sections/issueHandle/actions/index.js b/web/client/src/sections/issueHandle/actions/index.js index d6e7974..c7277cb 100644 --- a/web/client/src/sections/issueHandle/actions/index.js +++ b/web/client/src/sections/issueHandle/actions/index.js @@ -1,13 +1,11 @@ 'use strict'; -import * as plan from './plan' + import * as record from './record' -import * as template from './template' -import * as checkItems from './checkItems' + export default { - ...plan, + ...record, - ...template, - ...checkItems, + } \ No newline at end of file diff --git a/web/client/src/sections/issueHandle/actions/plan.js b/web/client/src/sections/issueHandle/actions/plan.js deleted file mode 100644 index 6b94bca..0000000 --- a/web/client/src/sections/issueHandle/actions/plan.js +++ /dev/null @@ -1,80 +0,0 @@ -'use strict'; - -import { basicAction } from '@peace/utils' -import { ApiTable } from '$utils' - -export function getPatrolPlan() { - return dispatch => basicAction({ - type: 'get', - dispatch: dispatch, - actionType: 'GET_PATROL_PLAN', - url: ApiTable.patrolPlan, - msg: { error: '获取巡检计划失败' }, - }); -} - -export function createPatrolPlan(data) { - return dispatch => basicAction({ - type: 'post', - data, - dispatch: dispatch, - actionType: 'CREATE_PATROL_PLAN', - url: ApiTable.patrolPlan, - msg: { error: '新增巡检计划失败' }, - }); -} - -export function delPatrolPlan(id) { - return dispatch => basicAction({ - type: 'del', - dispatch: dispatch, - actionType: 'DEL_PATROL_PLAN', - url: ApiTable.delPatrolPlan.replace('{id}', id), - msg: { error: '删除巡检计划失败' }, - }); -} - -export function updatePatrolPlan(data) { - return dispatch => basicAction({ - type: 'put', - data, - dispatch: dispatch, - actionType: 'UPDATE_PATROL_PLAN', - url: ApiTable.patrolPlan, - msg: { error: '修改巡检计划失败' }, - }); -} - -export function getUserList() { - return dispatch => basicAction({ - type: 'get', - dispatch: dispatch, - actionType: 'GET_USER_LIST', - url: ApiTable.getDepUser.replace('{depId}', null), - msg: { error: '获取人员列表失败' }, - reducer: { name: 'userList' } - }); -} - -export function getProjectList(query) { - return (dispatch) => basicAction({ - type: 'get', - query, - dispatch, - actionType: 'GET_PROJEECT_LIST', - url: ApiTable.getProjectList, - msg: { error: '获取结构物列表失败', }, - reducer: { name: 'structureList' } - }); -} - -export function positionList(query) { - return (dispatch) => basicAction({ - type: 'get', - query, - dispatch, - actionType: 'POSITION_LIST', - url: ApiTable.position, - msg: { error: '获取点位列表失败', }, - }); -} \ No newline at end of file diff --git a/web/client/src/sections/issueHandle/actions/record.js b/web/client/src/sections/issueHandle/actions/record.js index a6ae77e..1a75b63 100644 --- a/web/client/src/sections/issueHandle/actions/record.js +++ b/web/client/src/sections/issueHandle/actions/record.js @@ -1,17 +1,32 @@ 'use strict'; import { basicAction } from '@peace/utils' +import { ApiTable } from '$utils' -export const GET_PATROL_RECORD_LIST = 'GET_PATROL_RECORD_LIST'; -export const GET_PATROL_RECORD_LIST_SUCCESS = 'GET_PATROL_RECORD_LIST_SUCCESS'; -export const GET_PATROL_RECORD_LIST_ERROR = 'GET_PATROL_RECORD_LIST_ERROR'; -export function records(url) { + +export function addPatrolRecordIssueHandle(params) { + return (dispatch) => basicAction({ + type: 'post', + data: params, + dispatch, + actionType: 'ADD_PatrolRecordIssueHandle_REPORT', + url: ApiTable.addPatrolRecordIssueHandle, + msg: { + option: '维修计划新增', + }, + }); +} + +export function modifyPatrolRecordIssueHandle(id, params, msg) { return (dispatch) => basicAction({ - type: 'get', + type: 'put', + data: params, dispatch, - actionType: GET_PATROL_RECORD_LIST, - url: url, - msg: { error: '获取巡检记录失败', }, - reducer: { name: 'record' } + actionType: 'MODIFY_PatrolRecordIssueHandle_REPORT', + url: ApiTable.modifyPatrolRecordIssueHandle.replace('{id}', id), + msg: { + option: msg || '维修计划审批', + }, }); -} \ No newline at end of file +} + diff --git a/web/client/src/sections/issueHandle/actions/template.js b/web/client/src/sections/issueHandle/actions/template.js deleted file mode 100644 index 0442191..0000000 --- a/web/client/src/sections/issueHandle/actions/template.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; - -import { basicAction } from '@peace/utils' -import { ApiTable } from '$utils' - -export function getPatrolTemplate () { - return dispatch => basicAction({ - type: 'get', - dispatch: dispatch, - actionType: 'GET_PATROL_TEMPLATE', - url: ApiTable.patrolTemplate, - msg: { error: '获取巡检模板失败' }, - reducer: { name: 'patrolTemplate' } - }); -} - -export function createPatrolTemplate (data) { - return dispatch => basicAction({ - type: 'post', - data, - dispatch: dispatch, - actionType: 'CREATE_PATROL_TEMPLATE', - url: ApiTable.patrolTemplate, - msg: { option: '新增巡检模板' }, - }); -} - -export function delPatrolTemplate (id) { - return dispatch => basicAction({ - type: 'del', - dispatch: dispatch, - actionType: 'DEL_PATROL_TEMPLATE', - url: ApiTable.delPatrolTemplate.replace('{id}', id), - msg: { option: '删除巡检模板' }, - }); -} - -export function updatePatrolTemplate (data) { - return dispatch => basicAction({ - type: 'put', - data, - dispatch: dispatch, - actionType: 'UPDATE_PATROL_TEMPLATE', - url: ApiTable.patrolTemplate, - msg: { option: '修改巡检模板' }, - }); -} \ No newline at end of file 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 4c14b5b..69c0613 100644 --- a/web/client/src/sections/issueHandle/components/isuue-handle-mdal.js +++ b/web/client/src/sections/issueHandle/components/isuue-handle-mdal.js @@ -5,7 +5,8 @@ import { ProFormText, ProFormSelect, ProFormTextArea, - ProFormDatePicker + ProFormDatePicker, + ProFormDateRangePicker } from '@ant-design/pro-form'; import Uploads from '$components/Uploads'; import moment from 'moment'; @@ -13,81 +14,129 @@ const FormItem = Form.Item; //state: 1下发未上报 2已上报待审批 3整改完成 上报结果result: status 0 已上报未审批 1 审批通过 2 审批驳回 export default (props) => { const { title, triggerRender, editData = null, onFinish, readOnly, companyList, user } = props; - const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 16 } }; + const formItemLayout = { labelCol: { span: 7 }, wrapperCol: { span: 16 } }; + const formRef = useRef(); + const initialValues = editData ? { - ...editData + ...editData, + ...editData?.patrolRecordIssueHandles[0], + } : {}; + if (editData?.patrolRecordIssueHandles?.length > 0) { + initialValues.dateRange = [editData?.patrolRecordIssueHandles[0]?.startTime, editData?.patrolRecordIssueHandles[0]?.endTime] + } const [reason, setReason] = useState('') - const columns = [ - { - title: '序号', - dataIndex: 'index', - key: 'index', - render: (text, record, index) => index + 1 - }, - { - title: '提交时间', - dataIndex: 'time', - key: 'time', - }, - { - title: '整改附件', - dataIndex: 'file', - key: 'file', - render: (text, record) => { - return - } - }, - { - title: '结论', - dataIndex: 'status', - key: 'status', - // 0 未审批 1 通过 2驳回 - render: (text, record) => { - return user?.departmentId != -1 && record?.status === 0 ? <> - 驳回原因: { - setReason(e.target.value) - }} />} - onConfirm={() => { - if (!reason) { - message.warning('未填写驳回原因'); - return; + const approve = async (approve) => { + formRef.current.validateFields().then(async (values) => { + + onFinish && await onFinish({ + msg: approve ? '计划同意' : '计划驳回', + state: approve ? 4 : 3, + approveOpinion: values?.approveOpinion, + approvePerson: user, + approveDate: moment() + }, editData) + return true; + }) + .catch((errors) => { + if (errors) { + + } + }); + + } + + const renderPlanInfo = () => { + return <> + {/* */} +
{"巡检信息"}
+ + + + + + + + + + + + + + + + + + + + + + +
{"问题详情"}
+ + + + + + + + + { + Object.keys(editData?.points?.inspectContent).map(key => { + if (editData?.points?.inspectContent[key]?.isNormal == false) { + return + + + + + + + + + + + + + + + { + let nextV = [] + for (let s of (editData?.points?.inspectContent[key].imgs || [])) { + if (s) { + nextV.push({ + storageUrl: s + }) + } + } + return nextV + })() + } + /> + + + + } - handleResult(false) - }} > - -
- - : record?.status === 1 ? "整改完成" : record?.reason - } - }, - ]; - - const handleResult = (approve) => { - const results = JSON.parse(JSON.stringify(editData?.result || [])) - results[results.length - 1] = { - ...results[results.length - 1], status: approve ? 1 : 2, - reason - } - onFinish && onFinish({ - msg: approve ? '任务审批' : '任务驳回', - state: approve ? 3 : 1, - result: results - }, editData) + }) + } + + } return ( { {...formItemLayout} modalProps={{ destroyOnClose: true, - onCancel: () => { }, + // onCancel: () => { }, bodyStyle: { height: 720, overflowY: 'auto' } }} onFinish={async (values) => { - + values.startTime = values?.dateRange[0]; + values.endTime = values?.dateRange[1]; onFinish && await onFinish(values, editData) //message.success('提交成功'); return true; }} - submitter={!readOnly} + + submitter={editData?.patrolRecordIssueHandles[0]?.state === 2 ? { + render: (props, defaultDoms) => { + return [ + , + + ]; + } + } : !readOnly} >
- {/* */} -
{"巡检信息"}
-
- - - - - - - - - - - - - - - - - - - -
- -
{"问题详情"}
- - - - - - + {/*问题记录信息*/} + {renderPlanInfo()} - - { - Object.keys(editData?.points?.inspectContent).map(key => { - if (editData?.points?.inspectContent[key]?.isNormal == false) { - return - - - - - - - - - - - - - - - { - let nextV = [] - for (let s of (editData?.points?.inspectContent[key].imgs || [])) { - if (s) { - nextV.push({ - storageUrl: s - }) - } - } - return nextV - })() - } - /> - - - - - } - }) - } - - + {/*维修处理计划表单*/} + { + ((editData?.patrolRecordIssueHandles?.length == 0 && !readOnly) || editData?.patrolRecordIssueHandles?.length > 0) && + <> +
{"维修计划信息"}
+ + + + + + + + + + + + + + + + + + + } -
{"维修计划信息"}
+ { + editData?.patrolRecordIssueHandles[0]?.state === 2 && + <> +
{"维修计划审批"}
+
+ +
+ + }
-
+ ); }; \ No newline at end of file diff --git a/web/client/src/sections/issueHandle/containers/patrolRecord.js b/web/client/src/sections/issueHandle/containers/patrolRecord.js index 9e84532..a7bb93f 100644 --- a/web/client/src/sections/issueHandle/containers/patrolRecord.js +++ b/web/client/src/sections/issueHandle/containers/patrolRecord.js @@ -10,47 +10,64 @@ import IssueHandleModal from '../components/isuue-handle-mdal' import '../style.less' const { Panel } = Collapse; +const ISSUEHANDLE_STATE = [1, 2, 3, 4, 5, 6, 7] +const STATE_TEXT = { 1: '待制定计划', 2: '待审核', 3: '计划驳回', 4: '待维修', 5: '待验收', 6: '验收通过', 7: '验收不通过', } const PatrolRecord = (props) => { const { dispatch, actions, user } = props - const { patrolManage } = actions + const { patrolManage, issueHandle } = actions const [tableList, settableList] = useState([]) - const [showDetailModal, setShowDetail] = useState(false) - const [modelData, setModelData] = useState({}) - const [query, setQuery] = useState({ limit: 10, page: 0 }) - const [limits, setLimits] = useState() + const [name, setName] = useState(''); + const [curState, setCurState] = useState('null'); const format = 'YYYY-MM-DD HH:mm:ss' const times = [moment().subtract(70, 'years').format(format), moment().format(format)] const [search, setSearch] = useState({ name: null, time: [times[0], times[1]], state: 'null' }) useEffect(() => { - record(search) + queryData() }, []) - const record = (params) => { + const queryData = () => { dispatch(patrolManage.records(`patrolRecord/all/${times[0]}/${times[1]}/true/null`)).then(res => { if (res.success) { - settableList(params.name != null ? res.payload.data?.filter(v => - (v.points.user.name.indexOf(params.name) != -1 || v.points.project.name.indexOf(params.name) != -1)) + settableList(name != null ? res.payload.data?.filter(v => + (v.points.user.name.indexOf(name) != -1 || v.points.project.name.indexOf(name) != -1)) .map(v => ({ ...v, key: v.id })) : res.payload.data?.map(v => ({ ...v, key: v.id }))) - setLimits(res.payload.data?.length) } }) } - - const onFinish = () => { - - } + const onFinish = async (values, editData) => { + const dataToSave = { ...values }; + if (editData?.patrolRecordIssueHandles?.length > 0) { + let msg = ''; + if (editData?.patrolRecordIssueHandles[0]?.state == 3) { + dataToSave.state = 2; + msg = '维修计划修改'; + } + return dispatch( + issueHandle.modifyPatrolRecordIssueHandle(editData?.patrolRecordIssueHandles[0]?.id, dataToSave, + values?.msg || msg), + ).then(() => { + queryData(); + }); + } + let state = ISSUEHANDLE_STATE[1]; + + return dispatch(issueHandle.addPatrolRecordIssueHandle({ + ...dataToSave, + state, + patrolRecordId: editData?.id, + creator: user, + createTime: moment() + })).then(() => { + queryData(); + }); + }; const renderOptionText = (currentState) => { let text = '查看' - if (user?.departmentId == -1) { - if (currentState == 1) text = '整改' - } else { - if (currentState == 2) text = '审批' - } - return text + return STATE_TEXT[currentState] || text } const columns = [ @@ -117,134 +134,79 @@ const PatrolRecord = (props) => { showInDetail: true, render: (text, record, index) => { return !record?.patrolRecordIssueHandles || record?.patrolRecordIssueHandles?.length == 0 ? '待制定计划' : - record?.patrolRecordIssueHandles[0]?.state + renderOptionText(record?.patrolRecordIssueHandles[0]?.state) } }, - - - // { - // title: '巡检计划', - // dataIndex: 'name', - // key: 'name', - // width: '10%', - // showInDetail: true, - // render: (text, record, index) => { - // return !record.patrolPlan ? '' :
{record.patrolPlan.name}
- // } - // }, { - // title: '巡检点位', - // dataIndex: 'type', - // key: 'type', - // showInDetail: true, - // width: '10%', - // render: (text, record, index) => { - // return !record.points?.user ? '' :
{record.points.itemData.name}
- // } - // }, { - // title: '巡检人', - // dataIndex: 'type', - // key: 'type', - // showInDetail: true, - // width: '10%', - // render: (text, record, index) => { - // return !record.points?.user ? '' :
{record.points.user.name}
- // } - // }, { - // title: '巡检单位', - // dataIndex: 'type', - // showInDetail: true, - // key: 'type', - // width: '10%', - // render: (text, record, index) => { - // return !record.points?.user ? '' :
{record.points.user.department.name}
- // } - // }, { - // title: '巡检频次', - // dataIndex: 'describe', - // key: 'describe', - // showInDetail: true, - // width: '10%', - // render: (text, record, index) => { - // return !record.points ? '' :
{record.points.frequency}
- // } - // }, { - // title: '上次巡检日期', - // dataIndex: 'describe', - // showInDetail: true, - // key: 'describe', - // render: (text, record, index) => record.lastInspectionTime ? moment(record.lastInspectionTime).format('YYYY-MM-DD HH:mm:ss') : '--' - // }, { - // title: '本次巡检日期', - // dataIndex: 'describe', - // key: 'describe', - // showInDetail: true, - // render: (text, record, index) => moment(record.inspectionTime).format('YYYY-MM-DD HH:mm:ss') || '--' - // }, { - // title: '巡检结果', - // dataIndex: 'describe', - // key: 'describe', - // render: (text, record, index) => !record.alarm ? '正常' : '异常' - // }, { title: '操作', dataIndex: 'operation', key: 'operation', render: (text, record, index) => { - return ( - {renderOptionText(1)}} + user={user} + onFinish={onFinish} />) + } + if (record?.patrolRecordIssueHandles[0]?.state == 2) { + options.push({renderOptionText(1)}} - user={{}} - onFinish={onFinish} /> - ) + title="审核" + triggerRender={{renderOptionText(2)}} + user={user} + onFinish={onFinish} />) + } + + if (record?.patrolRecordIssueHandles[0]?.state == 3) { + options.push(修改计划} + user={user} + onFinish={onFinish} />) + } + + options.push(查看详情} + user={user} + onFinish={onFinish} />) + + return options; } } ] return (
-
-
{ - record({ - name: r.name, - }) - }} - > - - - - - - { setName(e.target.value) }} + placeholder="请输入结构物名称或上报人" allowClear /> +