update
This commit is contained in:
parent
4dee3cbed6
commit
536f978f5b
@ -6,6 +6,7 @@ import { Col, FormInstance, message, Modal, Row } from "antd";
|
||||
import { useRef, useState } from "react";
|
||||
import { connect } from "umi";
|
||||
import { handleGetServerpartTree, handleGetSERVERPARTTYPEList } from "../service";
|
||||
import { encryptAES } from "@/utils/handleAes";
|
||||
|
||||
type DetailProps = {
|
||||
onRef: any,
|
||||
@ -102,7 +103,15 @@ const RectificationStatusInfoModal = ({ onRef, currentRowInfo, onShow, setOnShow
|
||||
request={async () => {
|
||||
if (currentRowInfo) {
|
||||
console.log('currentRowInfocurrentRowInfocurrentRowInfo', currentRowInfo);
|
||||
|
||||
console.log('parentRowparentRowparentRow', parentRow);
|
||||
handleGetServerPartList(parentRow?.SPREGIONTYPE_ID)
|
||||
return {
|
||||
...parentRow,
|
||||
belongAreaCode: parentRow?.SPREGIONTYPE_ID,
|
||||
belongArea: parentRow?.SPREGIONTYPE_NAME,
|
||||
SACode: parentRow?.SERVERPART_ID,
|
||||
SAName: parentRow?.SERVERPART_NAME,
|
||||
}
|
||||
} else if (parentRow) {
|
||||
console.log('parentRowparentRowparentRow', parentRow);
|
||||
handleGetServerPartList(parentRow?.belongAreaCode)
|
||||
@ -161,7 +170,7 @@ const RectificationStatusInfoModal = ({ onRef, currentRowInfo, onShow, setOnShow
|
||||
}
|
||||
}
|
||||
}}
|
||||
disabled={parentRow}
|
||||
// disabled={parentRow}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={12} style={{ display: 'none' }}>
|
||||
@ -186,7 +195,7 @@ const RectificationStatusInfoModal = ({ onRef, currentRowInfo, onShow, setOnShow
|
||||
}
|
||||
}}
|
||||
rules={[{ required: true, message: '请选择服务区!' }]}
|
||||
disabled={parentRow}
|
||||
// disabled={parentRow}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={12} style={{ display: 'none' }}>
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
import { connect } from "umi";
|
||||
import { ConnectState } from "@/models/global";
|
||||
import './style.less'
|
||||
import { ActionType, FormInstance, ProForm, ProFormDatePicker, ProFormSelect, ProFormText, ProFormTimePicker, ProTable } from "@ant-design/pro-components";
|
||||
import { ActionType, FormInstance, ProForm, ProFormDatePicker, ProFormSelect, ProFormText, ProFormTimePicker, ProFormUploadButton, ProTable } from "@ant-design/pro-components";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { Button, Col, Divider, message, Row, Image } from "antd";
|
||||
import { Button, Col, Divider, message, Row, Image, Modal } from "antd";
|
||||
import { handleGetPATROLList, handleGetSERVERPARTDetail, handleGetServerpartTree, handleGetSERVERPARTTYPEList, handleSynchroPATROL, handleSynchroRECTIFICATION } from "./service";
|
||||
import { handleGetPassportInfoById } from "../DigitalElectronics/service";
|
||||
import moment from "moment";
|
||||
@ -14,16 +14,28 @@ import AddInspectionContent from "./components/AddInspectionContent";
|
||||
import normalIcon from '../../assets/normalIcon.png'
|
||||
import errorIcon from '../../assets/errorIcon.png'
|
||||
import RectificationStatusInfoModal from "./components/RectificationStatusInfoModal";
|
||||
import { handleGetServerpartInfo } from "../serverpartAssets/service";
|
||||
import { handleGetServerpartInfo, uploadAHYDPicture } from "../serverpartAssets/service";
|
||||
import { ExclamationCircleOutlined } from "@ant-design/icons";
|
||||
|
||||
|
||||
type DetailProps = {
|
||||
PATROLID: string; //巡检id
|
||||
currentUser?: any;// 用户明细
|
||||
}
|
||||
|
||||
const beforeUpload = (file: any) => {
|
||||
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
|
||||
if (!isJpgOrPng) {
|
||||
message.error('请上传JPEG、jpg、png格式的图片文件!');
|
||||
}
|
||||
const isLt2M = file.size / 1024 / 1024 < 2;
|
||||
if (!isLt2M) {
|
||||
message.error('图片大小不超过 2MB!');
|
||||
}
|
||||
return isJpgOrPng && isLt2M;
|
||||
}
|
||||
|
||||
const OperationReport = ({ PATROLID }: DetailProps) => {
|
||||
const { confirm } = Modal;
|
||||
const actionRef = useRef<ActionType>();
|
||||
const AddInspectionItemsRef = useRef<any>();
|
||||
const AddInspectionContentRef = useRef<any>();
|
||||
@ -46,6 +58,8 @@ const OperationReport = ({ PATROLID }: DetailProps) => {
|
||||
const [addContentModal, setAddContentModal] = useState<boolean>(false)
|
||||
// 根据当前的巡检项目的id 里面包含的巡检内容
|
||||
const [inspectionItemObj, setInspectionItemObj] = useState<any>()
|
||||
// 根据当前的巡检项目的id 里面包含的现场照片
|
||||
const [inspectionItemPhoto, setInspectionItemPhoto] = useState<any>()
|
||||
// 巡检内容 显示的列表
|
||||
const [inspectionContentList, setInspectionContentList] = useState<any>()
|
||||
// 页面的数据类型 区分日常巡检 和 现场巡检
|
||||
@ -56,8 +70,16 @@ const OperationReport = ({ PATROLID }: DetailProps) => {
|
||||
const [currentRecord, setCurrentRecord] = useState<any>()
|
||||
// 整改情况的行数据
|
||||
const [currentRectification, setCurrentRectification] = useState<any>()
|
||||
// 文件列表
|
||||
const [fileList, setFileList] = useState<any>([])
|
||||
// 预览图片
|
||||
const [imagePreviewVisible, setImagePreviewVisible] = useState<boolean>(false)
|
||||
|
||||
|
||||
// 预览上传后的图片
|
||||
const handlePreview = async () => {
|
||||
setFileList(fileList)
|
||||
setImagePreviewVisible(true)
|
||||
};
|
||||
// 表格字段
|
||||
const columns: any = [
|
||||
{
|
||||
@ -105,7 +127,7 @@ const OperationReport = ({ PATROLID }: DetailProps) => {
|
||||
},
|
||||
{
|
||||
title: "检查人",
|
||||
dataIndex: 'PATROL_POSITION',
|
||||
dataIndex: 'INSPECTION_PERSON',
|
||||
hideInSearch: true,
|
||||
align: 'center',
|
||||
width: 150,
|
||||
@ -139,9 +161,27 @@ const OperationReport = ({ PATROLID }: DetailProps) => {
|
||||
if (inspectionItemsTableData && inspectionItemsTableData.length > 0) {
|
||||
list = JSON.parse(JSON.stringify(inspectionItemsTableData))
|
||||
list.forEach((item: any) => {
|
||||
if (inspectionItemObj[`${item?.PATROL_ID}-${item?.rowIndex || item?.PATROLDETAIL_ID}`] && inspectionItemObj[`${item?.PATROL_ID}-${item?.rowIndex || item?.PATROLDETAIL_ID}`].length > 0) {
|
||||
if (inspectionItemObj && inspectionItemObj[`${item?.PATROL_ID}-${item?.rowIndex || item?.PATROLDETAIL_ID}`] && inspectionItemObj[`${item?.PATROL_ID}-${item?.rowIndex || item?.PATROLDETAIL_ID}`].length > 0) {
|
||||
item.PATROLCONTENTList = inspectionItemObj[`${item?.PATROL_ID}-${item?.rowIndex || item?.PATROLDETAIL_ID}`]
|
||||
}
|
||||
|
||||
if (inspectionItemPhoto && inspectionItemPhoto[`${item?.PATROL_ID}-${item?.rowIndex || item?.PATROLDETAIL_ID}`] && inspectionItemPhoto[`${item?.PATROL_ID}-${item?.rowIndex || item?.PATROLDETAIL_ID}`].length > 0) {
|
||||
// item.PATROLCONTENTList = inspectionItemPhoto[`${item?.PATROL_ID}-${item?.rowIndex || item?.PATROLDETAIL_ID}`]
|
||||
// 保存现场照片的路径
|
||||
|
||||
let url: string = ""
|
||||
let list: any = inspectionItemPhoto[`${item?.PATROL_ID}-${item?.rowIndex || item?.PATROLDETAIL_ID}`]
|
||||
if (list && list.length > 0) {
|
||||
list.forEach((item: any) => {
|
||||
if (url) {
|
||||
url += `,${item.url}`
|
||||
} else {
|
||||
url = item.url
|
||||
}
|
||||
})
|
||||
}
|
||||
item.ONSITEPHOTO_URL = url
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -158,8 +198,10 @@ const OperationReport = ({ PATROLID }: DetailProps) => {
|
||||
STAFF_NAME: userInfoDetail.Name,
|
||||
OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),
|
||||
PATROL_TYPE: pageDataType || 1000,
|
||||
PATROL_STATE: 1000,
|
||||
PATROLDETAILList: list
|
||||
}
|
||||
console.log('reqreq', req);
|
||||
|
||||
if (req.PATROLDETAILList && req.PATROLDETAILList.length > 0) {
|
||||
// 只要有一个子集就是 true
|
||||
@ -171,10 +213,12 @@ const OperationReport = ({ PATROLID }: DetailProps) => {
|
||||
})
|
||||
if (!isOk) {
|
||||
message.error('巡检内容数据未录入!')
|
||||
setSaveLoading(false)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
message.error('巡检项目数据未录入!')
|
||||
setSaveLoading(false)
|
||||
return
|
||||
}
|
||||
|
||||
@ -183,6 +227,7 @@ const OperationReport = ({ PATROLID }: DetailProps) => {
|
||||
value: encryptAES(JSON.stringify(req))
|
||||
}
|
||||
const data = await handleSynchroPATROL(newReq)
|
||||
setSaveLoading(false)
|
||||
if (data.Result_Code === 100) {
|
||||
message.success('同步成功!')
|
||||
|
||||
@ -248,9 +293,6 @@ const OperationReport = ({ PATROLID }: DetailProps) => {
|
||||
|
||||
setInspectionItemObj(obj)
|
||||
setInspectionContentList(list)
|
||||
|
||||
// setInspectionItemObj
|
||||
// setInspectionContentList
|
||||
}
|
||||
|
||||
// 根据传入的行号 切换显示的巡检内容
|
||||
@ -260,6 +302,13 @@ const OperationReport = ({ PATROLID }: DetailProps) => {
|
||||
list = inspectionItemObj[id]
|
||||
}
|
||||
setInspectionContentList(list)
|
||||
|
||||
// 现场照片内容
|
||||
let photoList: any = []
|
||||
if (inspectionItemPhoto && inspectionItemPhoto[id] && inspectionItemPhoto[id].length > 0) {
|
||||
photoList = inspectionItemPhoto[id]
|
||||
}
|
||||
setFileList(photoList)
|
||||
}
|
||||
|
||||
// 拿到整改情况的录入数据
|
||||
@ -367,15 +416,31 @@ const OperationReport = ({ PATROLID }: DetailProps) => {
|
||||
let list: any = detail.PATROLDETAILList
|
||||
setInspectionItemsTableData(list)
|
||||
|
||||
let obj: any = {}
|
||||
console.log('listlistlist', list);
|
||||
|
||||
let obj: any = {}
|
||||
let photoObj: any = {}
|
||||
list.forEach((item: any, index: number) => {
|
||||
obj[`${item?.PATROL_ID}-${item?.rowIndex || item?.PATROLDETAIL_ID}`] = item.PATROLCONTENTList
|
||||
let photoList: any = item.ONSITEPHOTO_URL ? item.ONSITEPHOTO_URL.split(',') : []
|
||||
let list: any = []
|
||||
if (photoList && photoList.length > 0) {
|
||||
photoList.forEach((item: any, index: number) => {
|
||||
list.push({
|
||||
url: item,
|
||||
uid: index
|
||||
})
|
||||
})
|
||||
}
|
||||
photoObj[`${item?.PATROL_ID}-${item?.rowIndex || item?.PATROLDETAIL_ID}`] = list
|
||||
})
|
||||
|
||||
|
||||
setInspectionItemPhoto(photoObj)
|
||||
setInspectionItemObj(obj)
|
||||
setInspectionContentList(obj[`${list[0].PATROL_ID}-${list[0].rowIndex || list[0].PATROLDETAIL_ID}`])
|
||||
setSelectedRowKey(`${list[0].PATROL_ID}-${list[0].rowIndex || list[0].PATROLDETAIL_ID}`);
|
||||
setFileList(photoObj[`${list[0].PATROL_ID}-${list[0].rowIndex || list[0].PATROLDETAIL_ID}`])
|
||||
}
|
||||
|
||||
handleGetServerPartList(detail.SPREGIONTYPE_ID)
|
||||
@ -626,6 +691,24 @@ const OperationReport = ({ PATROLID }: DetailProps) => {
|
||||
</Row>
|
||||
</ProForm>
|
||||
|
||||
{fileList && fileList.length > 0 && <div style={{ display: 'none' }}>
|
||||
<Image.PreviewGroup
|
||||
preview={{
|
||||
visible: imagePreviewVisible,
|
||||
onVisibleChange: vis => {
|
||||
setImagePreviewVisible(vis)
|
||||
}
|
||||
|
||||
}}>
|
||||
{
|
||||
fileList.map((n) =>
|
||||
<Image src={n.url} key={n.url} />
|
||||
)
|
||||
}
|
||||
|
||||
</Image.PreviewGroup>
|
||||
</div>}
|
||||
|
||||
{/* 非表单内容 */}
|
||||
<Row gutter={8}>
|
||||
<Col span={12}>
|
||||
@ -726,9 +809,87 @@ const OperationReport = ({ PATROLID }: DetailProps) => {
|
||||
</div>
|
||||
}) : ""
|
||||
}
|
||||
{
|
||||
selectedRowKey ?
|
||||
<div className="inspectionContentItem" style={{ borderBottom: '0px dashed #dadada' }}>
|
||||
<div className="inspectionContentItemCenter">
|
||||
<ProFormUploadButton
|
||||
label={"现场照片"}
|
||||
name={"LOCALEPHOTO"}
|
||||
fileList={fileList}
|
||||
listType="picture-card"
|
||||
accept="image/*"
|
||||
fieldProps={{
|
||||
beforeUpload,
|
||||
maxCount: 9,
|
||||
onPreview: handlePreview,
|
||||
customRequest: async (info) => {
|
||||
const formData = new FormData();
|
||||
formData.append('files', info.file);
|
||||
formData.append('TableType', '1208');
|
||||
formData.append('ImageName', typeof info.file !== 'string' ? info.file?.name : '');
|
||||
if (info.filename) {
|
||||
const success = await uploadAHYDPicture(formData)
|
||||
|
||||
if (success) {
|
||||
let list: any = []
|
||||
if (fileList && fileList.length > 0) {
|
||||
list = JSON.parse(JSON.stringify(fileList))
|
||||
}
|
||||
list.push({
|
||||
name: success.Result_Data.ImageName,
|
||||
url: success.Result_Data.ImageUrl, // url 是展示在页面上的绝对链接
|
||||
})
|
||||
if (selectedRowKey) {
|
||||
let obj: any = inspectionItemPhoto ? JSON.parse(JSON.stringify(inspectionItemPhoto)) : {}
|
||||
|
||||
let newList: any = list
|
||||
|
||||
obj[selectedRowKey] = newList
|
||||
setInspectionItemPhoto(obj)
|
||||
}
|
||||
setFileList(list)
|
||||
}
|
||||
} else {
|
||||
message.error("您上传的图片不存在.")
|
||||
}
|
||||
},
|
||||
onChange: async (info: any) => {
|
||||
if (info.file.status === 'removed') {
|
||||
confirm({
|
||||
title: '确认删除该图片吗?',
|
||||
icon: <ExclamationCircleOutlined rev={undefined} />,
|
||||
async onOk() {
|
||||
let list: any = JSON.parse(JSON.stringify(fileList))
|
||||
let res: any = []
|
||||
if (list && list.length > 0) {
|
||||
list.forEach((item: any) => {
|
||||
if (item.url === info.file.url) {
|
||||
|
||||
} else {
|
||||
res.push(item)
|
||||
}
|
||||
})
|
||||
}
|
||||
setFileList(res)
|
||||
|
||||
if (selectedRowKey) {
|
||||
let obj: any = inspectionItemPhoto ? JSON.parse(JSON.stringify(inspectionItemPhoto)) : {}
|
||||
obj[selectedRowKey] = res
|
||||
setInspectionItemPhoto(obj)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}}
|
||||
disabled={PATROLID ? true : false}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
: ""
|
||||
}
|
||||
</div>
|
||||
|
||||
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
|
||||
@ -200,6 +200,7 @@ const onSiteInspection = () => {
|
||||
|
||||
const req: any = {
|
||||
SearchParameter: {
|
||||
PATROL_STATE: 1000,
|
||||
PATROL_TYPES: 3000,
|
||||
SERVERPART_IDS: selectedId,
|
||||
INSPECTION_STARTTIME_Start: params?.INSPECTION_STARTTIME_Start || "",
|
||||
|
||||
@ -229,6 +229,7 @@ const rectificationStatus = () => {
|
||||
request={async (params) => {
|
||||
const req: any = {
|
||||
SearchParameter: {
|
||||
PATROL_STATE: 1000,
|
||||
INSPECTIONDATE_Start: params?.INSPECTION_STARTTIME_Start || "",
|
||||
INSPECTIONDATE_End: params?.INSPECTION_STARTTIME_End || "",
|
||||
PATROLCONTENT_TYPE: params?.PATROLCONTENT_TYPE || ""
|
||||
|
||||
@ -4,10 +4,10 @@ import { connect } from "umi";
|
||||
import LeftSelectTree from "@/components/leftSelectTree/leftSelectTree";
|
||||
import { ActionType, FormInstance, ProTable } from "@ant-design/pro-components";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { handleGetPATROLList } from "./service";
|
||||
import { handlDeletePATROL, handleGetPATROLList } from "./service";
|
||||
import moment from 'moment'
|
||||
import { encryptAES } from "@/utils/handleAes";
|
||||
import { Drawer } from "antd";
|
||||
import { Button, Drawer, message, Popconfirm } from "antd";
|
||||
import OperationReport from './index'
|
||||
|
||||
|
||||
@ -202,6 +202,26 @@ const routineInspection = () => {
|
||||
}
|
||||
]
|
||||
|
||||
// 删除巡检记录
|
||||
const handleDeletePatrolid = async (PATROL_ID: string) => {
|
||||
const req: any = {
|
||||
PATROLId: PATROL_ID
|
||||
}
|
||||
let newReq: any = {
|
||||
name: "",
|
||||
value: encryptAES(JSON.stringify(req))
|
||||
}
|
||||
const data = await handlDeletePATROL(newReq)
|
||||
if (data.Result_Code === 100) {
|
||||
message.success(data.Result_Desc)
|
||||
setShowDetailDrawer(false);
|
||||
setCurrentRow(undefined);
|
||||
actionRef.current?.reload()
|
||||
} else {
|
||||
message.error(data.Result_Desc)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={{ height: 'calc(100vh - 100px)', backgroundColor: '#fff', display: 'flex' }}>
|
||||
<LeftSelectTree setSelectedId={setSelectedId} setCollapsible={setCollapsible} collapsible={collapsible} />
|
||||
@ -225,6 +245,7 @@ const routineInspection = () => {
|
||||
}
|
||||
const req: any = {
|
||||
SearchParameter: {
|
||||
PATROL_STATE: 1000,
|
||||
PATROL_TYPES: 1000,
|
||||
SERVERPART_IDS: selectedId,
|
||||
INSPECTION_STARTTIME_Start: params?.INSPECTION_STARTTIME_Start || "",
|
||||
@ -265,6 +286,13 @@ const routineInspection = () => {
|
||||
bodyStyle={{ padding: '0 24px 24px' }}
|
||||
destroyOnClose
|
||||
closable={false}
|
||||
// footer={<div>
|
||||
// <Popconfirm title="确定要删除吗?" onConfirm={() => {
|
||||
// handleDeletePatrolid(currentRow?.PATROL_ID)
|
||||
// }}>
|
||||
// <Button type="primary" danger >删除</Button>
|
||||
// </Popconfirm>
|
||||
// </div>}
|
||||
>
|
||||
<OperationReport PATROLID={currentRow?.PATROL_ID} />
|
||||
</Drawer>
|
||||
|
||||
@ -164,6 +164,7 @@ const securityIssueList = () => {
|
||||
|
||||
const req: any = {
|
||||
SearchParameter: {
|
||||
PATROL_STATE: 1000,
|
||||
SERVERPART_IDS: selectedId,
|
||||
PATROL_DATE_Start: params?.PATROL_DATE_Start || "",
|
||||
PATROL_DATE_End: params?.PATROL_DATE_End || "",
|
||||
|
||||
@ -215,3 +215,33 @@ export async function handlGetDeleteRENTCALCULATION(params: any) {
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
// 删除巡检记录
|
||||
export async function handlDeletePATROL(params: any) {
|
||||
const data = await requestOld(`/Examine/DeletePATROL`, {
|
||||
method: 'POST',
|
||||
data: params
|
||||
})
|
||||
|
||||
if (data.Result_Code !== 100) {
|
||||
return data
|
||||
}
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
// 获取巡检整改通知表明细
|
||||
export async function handlGetRECTIFICATIONDetail(params: any) {
|
||||
const data = await requestOld(`/Examine/GetRECTIFICATIONDetail`, {
|
||||
method: 'POST',
|
||||
data: params
|
||||
})
|
||||
|
||||
if (data.Result_Code !== 100) {
|
||||
return data
|
||||
}
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user