💥 feat(模块): 添加了个很棒的功能
This commit is contained in:
parent
b021eff28f
commit
e94956b778
@ -7,7 +7,7 @@ import request from "@/utils/requestJava"
|
|||||||
export async function handleGetExamineTypeList(params?: any) {
|
export async function handleGetExamineTypeList(params?: any) {
|
||||||
const data = await request.get('/question-categories/getList', { params })
|
const data = await request.get('/question-categories/getList', { params })
|
||||||
if (data.Result_Code === 100) {
|
if (data.Result_Code === 100) {
|
||||||
return data.Result_Data.list
|
return data.Result_Data.List
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
@ -16,7 +16,7 @@ export async function handleGetExamineTypeList(params?: any) {
|
|||||||
export async function handleGetExamineTypeTreeList(params?: any) {
|
export async function handleGetExamineTypeTreeList(params?: any) {
|
||||||
const data = await request.get('/question-categories/tree', params)
|
const data = await request.get('/question-categories/tree', params)
|
||||||
if (data.Result_Code === 100) {
|
if (data.Result_Code === 100) {
|
||||||
return data.Result_Data.list
|
return data.Result_Data.List
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,17 +1,18 @@
|
|||||||
import LeftSelectTree from "@/components/leftSelectTree/leftSelectTree";
|
import LeftSelectTree from "@/components/leftSelectTree/leftSelectTree";
|
||||||
import { handleGetServerpartDDL } from "@/components/leftSelectTree/service";
|
import { handleGetServerpartDDL } from "@/components/leftSelectTree/service";
|
||||||
import { ActionType, FormInstance, ProCard, ProForm, ProFormList, ProFormSelect, ProFormSwitch, ProFormText, ProFormTextArea, ProTable } from "@ant-design/pro-components";
|
import { ActionType, FormInstance, ProCard, ProForm, ProFormDigit, ProFormList, ProFormSelect, ProFormSwitch, ProFormText, ProFormTextArea, ProTable } from "@ant-design/pro-components";
|
||||||
import { Button, Col, message, Modal, Popconfirm, Row, Space, Image, Drawer } from "antd";
|
import { Button, Col, message, Modal, Popconfirm, Row, Space, Image, Drawer } from "antd";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import { connect } from "umi";
|
import { connect } from "umi";
|
||||||
import { handleAddTemplates, handleDeleteTemplates, handleGetQuestionList, handleGetTemplatesList, handleSearchModalTree, handleUpdateTemplates, handleUploadFile } from "./service";
|
import { handleAddTemplates, handleBatchService, handleDeleteTemplates, handleGetQuestionList, handleGetTemplatesList, handleSearchModalTree, handleUpdateTemplates, handleUploadFile } from "./service";
|
||||||
import { handleGetExamineTypeTreeList } from "../index/service";
|
import { handleGetExamineTypeTreeList } from "../index/service";
|
||||||
import QRCode from 'qrcode';
|
import QRCode from 'qrcode';
|
||||||
import { base64ToFile } from "@/utils/publicMethods";
|
import { base64ToFile } from "@/utils/publicMethods";
|
||||||
import RecordDetail from "../record/components/recordDetail";
|
import RecordDetail from "../record/components/recordDetail";
|
||||||
import AddBigType from "../index/components/addBigType";
|
import AddBigType from "../index/components/addBigType";
|
||||||
import AddQuestion from "../question/components/addQuestion";
|
import AddQuestion from "../question/components/addQuestion";
|
||||||
|
import { ArrowDownOutlined, ArrowUpOutlined } from "@ant-design/icons";
|
||||||
|
|
||||||
|
|
||||||
const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
||||||
@ -24,10 +25,11 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
const modalFormRef = useRef<FormInstance>();
|
const modalFormRef = useRef<FormInstance>();
|
||||||
|
|
||||||
const cloneFormRef = useRef<FormInstance>();
|
const cloneFormRef = useRef<FormInstance>();
|
||||||
|
const batchCloneForm = useRef<FormInstance>();
|
||||||
|
|
||||||
|
|
||||||
// 弹出框的表单实例
|
// 弹出框的表单实例
|
||||||
const modalRef = useRef<FormInstance>()
|
const modalRef = useRef<any>()
|
||||||
// 树相关的属性和方法
|
// 树相关的属性和方法
|
||||||
const [selectedId, setSelectedId] = useState<string[]>()
|
const [selectedId, setSelectedId] = useState<string[]>()
|
||||||
const [collapsible, setCollapsible] = useState<boolean>(false)
|
const [collapsible, setCollapsible] = useState<boolean>(false)
|
||||||
@ -75,9 +77,10 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
const [selectedCloneDetail, setSelectedCloneDetail] = useState<any>()
|
const [selectedCloneDetail, setSelectedCloneDetail] = useState<any>()
|
||||||
// 默认展开行的id
|
// 默认展开行的id
|
||||||
const [defaultExpandRow, setDefaultExpandRow] = useState<any>()
|
const [defaultExpandRow, setDefaultExpandRow] = useState<any>()
|
||||||
|
// 点位克隆的悬浮框
|
||||||
|
const [showBatchCloneModal, setshowBatchCloneModal] = useState<boolean>(false)
|
||||||
|
// 批量克隆的loading效果
|
||||||
|
const [batchLoading, setBatchLoading] = useState<boolean>(false)
|
||||||
|
|
||||||
const columns: any = [
|
const columns: any = [
|
||||||
// {
|
// {
|
||||||
@ -209,11 +212,11 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
fixed: "right",
|
fixed: "right",
|
||||||
width: 120,
|
width: 150,
|
||||||
render: (_: any, record: any) => {
|
render: (_: any, record: any) => {
|
||||||
return record?.type === 'district' || record?.type === 'servicePart' ? '' : <Space>
|
return record?.type === 'district' || record?.type === 'servicePart' ? '' : <Space>
|
||||||
<a onClick={() => {
|
<a onClick={() => {
|
||||||
console.log('record', record);
|
console.log('currentRow', record);
|
||||||
setCurrentRow(record)
|
setCurrentRow(record)
|
||||||
setShowPlaceModal(true)
|
setShowPlaceModal(true)
|
||||||
}}>编辑</a>
|
}}>编辑</a>
|
||||||
@ -229,6 +232,13 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
>
|
>
|
||||||
<a>删除</a>
|
<a>删除</a>
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
|
<a onClick={() => {
|
||||||
|
console.log('currentRow', record);
|
||||||
|
setCurrentRow(record)
|
||||||
|
setshowBatchCloneModal(true)
|
||||||
|
}}>
|
||||||
|
点位克隆
|
||||||
|
</a>
|
||||||
|
|
||||||
</Space>
|
</Space>
|
||||||
}
|
}
|
||||||
@ -430,32 +440,43 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// 判断是否有改动 一样 说明没改动 那么把老的拿进去就行
|
// 判断是否有改动 一样 说明没改动 那么把老的拿进去就行
|
||||||
if (currentRow?.questionnaireTemplateQuestions.length === res.questions.length) {
|
// if (currentRow?.questionnaireTemplateQuestions.length === res.questions.length) {
|
||||||
if (currentRow?.questionnaireTemplateQuestions && currentRow?.questionnaireTemplateQuestions.length > 0) {
|
// if (currentRow?.questionnaireTemplateQuestions && currentRow?.questionnaireTemplateQuestions.length > 0) {
|
||||||
currentRow?.questionnaireTemplateQuestions.forEach((item) => {
|
// currentRow?.questionnaireTemplateQuestions.forEach((item) => {
|
||||||
questions.push({
|
// questions.push({
|
||||||
questionId: item.question.id,
|
// questionId: item.question.id,
|
||||||
isRequired: item.question.required,
|
// isRequired: item.question.required,
|
||||||
sortOrder: item.question.sortOrder
|
// sortOrder: item.question.sortOrder
|
||||||
})
|
// })
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// // 不一样 说明有删除 不然走的是第一个
|
||||||
|
// if (res.questions && res.questions.length > 0) {
|
||||||
|
// res.questions.forEach((item) => {
|
||||||
|
// questions.push({
|
||||||
|
// questionId: item.id,
|
||||||
|
// isRequired: item.required,
|
||||||
|
// sortOrder: item.sortOrder
|
||||||
|
// })
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
if (res.questions && res.questions.length > 0) {
|
||||||
|
res.questions.forEach((item: any) => {
|
||||||
|
questions.push({
|
||||||
|
questionId: item.questionId,
|
||||||
|
isRequired: item.isRequired,
|
||||||
|
sortOrder: item.sortOrder
|
||||||
})
|
})
|
||||||
}
|
})
|
||||||
} else {
|
|
||||||
// 不一样 说明有删除 不然走的是第一个
|
|
||||||
if (res.questions && res.questions.length > 0) {
|
|
||||||
res.questions.forEach((item) => {
|
|
||||||
questions.push({
|
|
||||||
questionId: item.id,
|
|
||||||
isRequired: item.required,
|
|
||||||
sortOrder: item.sortOrder
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
req = {
|
req = {
|
||||||
...currentRow,
|
...currentRow,
|
||||||
|
deadlineType: res.deadlineType,
|
||||||
|
deadlineFrequency: res.deadlineFrequency,
|
||||||
title: res.title,
|
title: res.title,
|
||||||
serverPartName: serviceObj ? serviceObj[res.serverPartId] : "",
|
serverPartName: serviceObj ? serviceObj[res.serverPartId] : "",
|
||||||
serverPartId: res.serverPartId,
|
serverPartId: res.serverPartId,
|
||||||
@ -464,21 +485,24 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
status: res.status,
|
status: res.status,
|
||||||
description: res.description
|
description: res.description
|
||||||
}
|
}
|
||||||
|
console.log('req', req);
|
||||||
data = await handleUpdateTemplates(req)
|
data = await handleUpdateTemplates(req)
|
||||||
} else {
|
} else {
|
||||||
let questions: any = []
|
let questions: any = []
|
||||||
if (selectedQuestionDetail && selectedQuestionDetail.length > 0) {
|
if (selectedQuestionDetail && selectedQuestionDetail.length > 0) {
|
||||||
selectedQuestionDetail.forEach((item) => {
|
selectedQuestionDetail.forEach((item: any, index: number) => {
|
||||||
questions.push({
|
questions.push({
|
||||||
questionId: item.questionId,
|
questionId: item.id,
|
||||||
isRequired: item.required,
|
isRequired: item.required,
|
||||||
sortOrder: item.sortOrder
|
sortOrder: index + 1
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
req = {
|
req = {
|
||||||
title: res.title,
|
title: res.title,
|
||||||
|
deadlineType: res.deadlineType,
|
||||||
|
deadlineFrequency: res.deadlineFrequency,
|
||||||
placeName: "",
|
placeName: "",
|
||||||
placeId: 0,
|
placeId: 0,
|
||||||
serverPartName: serviceObj ? serviceObj[res.serverPartId] : "",
|
serverPartName: serviceObj ? serviceObj[res.serverPartId] : "",
|
||||||
@ -489,8 +513,10 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
status: res.status,
|
status: res.status,
|
||||||
description: res.description
|
description: res.description
|
||||||
}
|
}
|
||||||
|
console.log('reqreqreqreqreq', req);
|
||||||
data = await handleAddTemplates(req)
|
data = await handleAddTemplates(req)
|
||||||
console.log('datadsadsa1', data);
|
console.log('datadsadsa1', data);
|
||||||
|
|
||||||
const myQRCodeDataUrl = await QRCode.toDataURL(`pages/walkAroundManager/index?id=${data.Result_Data.id}`);
|
const myQRCodeDataUrl = await QRCode.toDataURL(`pages/walkAroundManager/index?id=${data.Result_Data.id}`);
|
||||||
const file = base64ToFile(myQRCodeDataUrl, `wenjuan${data.Result_Data.id}.png`);
|
const file = base64ToFile(myQRCodeDataUrl, `wenjuan${data.Result_Data.id}.png`);
|
||||||
console.log('file', file);
|
console.log('file', file);
|
||||||
@ -528,37 +554,58 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
setQrCodeUrl(undefined)
|
setQrCodeUrl(undefined)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ProForm formRef={modalRef} submitter={false} request={() => {
|
<ProForm formRef={modalRef} submitter={false} request={async () => {
|
||||||
console.log('currentRow', currentRow);
|
console.log('currentRow', currentRow);
|
||||||
|
|
||||||
let questionsList: any = []
|
let questionsList: any = []
|
||||||
let keyList: any = []
|
let keyList: any = []
|
||||||
if (currentRow?.questionnaireTemplateQuestions && currentRow?.questionnaireTemplateQuestions.length > 0) {
|
if (currentRow?.questionnaireTemplateQuestions && currentRow?.questionnaireTemplateQuestions.length > 0) {
|
||||||
console.log('1');
|
currentRow?.questionnaireTemplateQuestions.forEach((item: any) => {
|
||||||
|
|
||||||
currentRow?.questionnaireTemplateQuestions.forEach((item) => {
|
|
||||||
console.log('2');
|
|
||||||
if (item.question) {
|
if (item.question) {
|
||||||
let obj = JSON.parse(JSON.stringify(item.question))
|
let obj = JSON.parse(JSON.stringify(item.question))
|
||||||
|
|
||||||
let str: string = ''
|
// let str: string = ''
|
||||||
if (obj.options && obj?.options.length > 0) {
|
// if (obj.options && obj?.options.length > 0) {
|
||||||
obj.options.forEach((subItem: any, index: number) => {
|
// obj.options.forEach((subItem: any, index: number) => {
|
||||||
str += `${index > 0 ? ',' : ''}选项${index + 1}:${subItem.text}`
|
// str += `${index > 0 ? ',' : ''}选项${index + 1}:${subItem.text}`
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
|
||||||
|
// obj.text = obj.title
|
||||||
|
// obj.mark = JSON.stringify(obj.options)
|
||||||
|
// obj.showText = str
|
||||||
|
keyList.push(obj.id)
|
||||||
|
// questionsList.push(obj)
|
||||||
|
|
||||||
|
|
||||||
|
let markStr: string = JSON.stringify(item.question.options)
|
||||||
|
let showText: string = ''
|
||||||
|
if (item.question.options && item.question.options.length > 0) {
|
||||||
|
item.question.options.forEach((subItem: any, subIndex: number) => {
|
||||||
|
if (showText) {
|
||||||
|
showText += `,选项${subIndex + 1}:${subItem.text}`
|
||||||
|
} else {
|
||||||
|
showText = `选项${subIndex + 1}:${subItem.text}`
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.text = obj.title
|
questionsList.push({
|
||||||
obj.mark = JSON.stringify(obj.options)
|
questionId: item.questionId,
|
||||||
obj.showText = str
|
isRequired: item.isRequired,
|
||||||
keyList.push(obj.id)
|
sortOrder: item.sortOrder,
|
||||||
questionsList.push(obj)
|
text: item.question.title,
|
||||||
|
mark: markStr,
|
||||||
|
showText: showText
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// setSelectedQuestionDetail
|
|
||||||
setSelectedQuestionId(keyList)
|
setSelectedQuestionId(keyList)
|
||||||
|
console.log('questionsList', questionsList);
|
||||||
return {
|
return {
|
||||||
...currentRow,
|
...currentRow,
|
||||||
serverPartId: currentRow.serverPartId.toString(),
|
serverPartId: currentRow.serverPartId.toString(),
|
||||||
@ -618,6 +665,26 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
handleShowCloneModal(true)
|
handleShowCloneModal(true)
|
||||||
}}>克隆点位</Button>
|
}}>克隆点位</Button>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
|
<Col span={8}>
|
||||||
|
<ProFormSelect
|
||||||
|
label={"任务时限类型"}
|
||||||
|
name={"deadlineType"}
|
||||||
|
options={[
|
||||||
|
{ label: "每日任务", value: 1 },
|
||||||
|
{ label: "每月任务", value: 2 }
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col span={8}>
|
||||||
|
<ProFormDigit
|
||||||
|
label={"巡查频次"}
|
||||||
|
name={"deadlineFrequency"}
|
||||||
|
initialValue={1}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col span={8}></Col>
|
||||||
|
|
||||||
<Col span={20}>
|
<Col span={20}>
|
||||||
<ProFormList
|
<ProFormList
|
||||||
name="questions"
|
name="questions"
|
||||||
@ -626,20 +693,90 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
creatorButtonProps={{
|
creatorButtonProps={{
|
||||||
position: 'bottom',
|
position: 'bottom',
|
||||||
creatorButtonText: '添加选项',
|
creatorButtonText: '添加选项',
|
||||||
style: { display: 'none' },
|
style: { display: 'none' }
|
||||||
onClick: (e) => {
|
|
||||||
console.log('e', e);
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
copyIconProps={false}
|
copyIconProps={false}
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
itemContainerStyle={{ width: '100%' }}
|
itemContainerStyle={{ width: '100%' }}
|
||||||
itemRender={({ listDom, action }, { record, index }) => (
|
itemRender={({ listDom, action }, { record, index, move }) => {
|
||||||
<div style={{ width: '100%', display: 'flex', alignItems: 'flex-start', marginBottom: '10px' }}>
|
// console.log('modalRef', modalRef);
|
||||||
<div style={{ flex: 1, width: '100%' }}>{listDom}</div>
|
// let list: any = modalRef?.current?.getFieldValue("questions") || []
|
||||||
<div style={{ marginLeft: '8px', marginTop: '30px' }}>{action}</div>
|
// console.log('newidas2', list);
|
||||||
</div>
|
return (
|
||||||
)}
|
<div style={{
|
||||||
|
width: '100%',
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'flex-start',
|
||||||
|
marginBottom: '10px',
|
||||||
|
padding: '12px',
|
||||||
|
backgroundColor: '#fafafa',
|
||||||
|
borderRadius: '4px'
|
||||||
|
}}>
|
||||||
|
<div style={{ flex: 1, width: '100%' }}>{listDom}</div>
|
||||||
|
<div style={{
|
||||||
|
marginLeft: '8px',
|
||||||
|
display: 'flex',
|
||||||
|
gap: '8px'
|
||||||
|
}}>
|
||||||
|
{/* 上移按钮 */}
|
||||||
|
<Button
|
||||||
|
icon={<ArrowUpOutlined />}
|
||||||
|
disabled={index === 0}
|
||||||
|
onClick={() => {
|
||||||
|
const currentList = modalRef?.current?.getFieldValue("questions") || []
|
||||||
|
console.log('currentList', currentList);
|
||||||
|
|
||||||
|
if (index > 0) {
|
||||||
|
// 交换位置
|
||||||
|
[currentList[index], currentList[index - 1]] =
|
||||||
|
[currentList[index - 1], currentList[index]];
|
||||||
|
// 更新 sortOrder
|
||||||
|
currentList.forEach((item, i) => {
|
||||||
|
item.sortOrder = i + 1;
|
||||||
|
});
|
||||||
|
console.log('currentList', currentList);
|
||||||
|
|
||||||
|
modalRef.current?.setFieldsValue({
|
||||||
|
questions: currentList
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* 下移按钮 */}
|
||||||
|
<Button
|
||||||
|
icon={<ArrowDownOutlined />}
|
||||||
|
disabled={index === currentRow?.questionnaireTemplateQuestions.length - 1}
|
||||||
|
onClick={() => {
|
||||||
|
const currentList = modalRef?.current?.getFieldValue("questions") || []
|
||||||
|
if (index < currentList.length - 1) {
|
||||||
|
// 交换位置
|
||||||
|
[currentList[index], currentList[index + 1]] =
|
||||||
|
[currentList[index + 1], currentList[index]];
|
||||||
|
// 更新 sortOrder
|
||||||
|
currentList.forEach((item, i) => {
|
||||||
|
item.sortOrder = i + 1;
|
||||||
|
});
|
||||||
|
modalRef.current?.setFieldsValue({
|
||||||
|
questions: currentList
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* 删除按钮(保留原有) */}
|
||||||
|
{action}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
|
||||||
|
// itemRender={({ listDom, action }, { record, index }) => (
|
||||||
|
// <div style={{ width: '100%', display: 'flex', alignItems: 'flex-start', marginBottom: '10px' }}>
|
||||||
|
// <div style={{ flex: 1, width: '100%' }}>{listDom}</div>
|
||||||
|
// <div style={{ marginLeft: '8px', marginTop: '30px' }}>{action}</div>
|
||||||
|
// </div>
|
||||||
|
// )}
|
||||||
>
|
>
|
||||||
<Row gutter={6} style={{ width: '100%', margin: 0 }}>
|
<Row gutter={6} style={{ width: '100%', margin: 0 }}>
|
||||||
<Col span={8}>
|
<Col span={8}>
|
||||||
@ -711,6 +848,8 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
showQuestion.push({ text: item.title, showText: str, mark: item.options ? JSON.stringify(item.options) : "" })
|
showQuestion.push({ text: item.title, showText: str, mark: item.options ? JSON.stringify(item.options) : "" })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
console.log('showQuestion', showQuestion);
|
||||||
|
|
||||||
modalRef.current?.setFieldsValue({
|
modalRef.current?.setFieldsValue({
|
||||||
questions: showQuestion
|
questions: showQuestion
|
||||||
})
|
})
|
||||||
@ -926,7 +1065,6 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
</Modal>
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<Drawer
|
<Drawer
|
||||||
title={false}
|
title={false}
|
||||||
closeIcon={false}
|
closeIcon={false}
|
||||||
@ -945,7 +1083,115 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
|
|
||||||
<AddQuestion showQuestionModal={openAddQuestion} setShowQuestionModal={setOpenAddQuestion} afterAdd={handleReloadSearchList} />
|
<AddQuestion showQuestionModal={openAddQuestion} setShowQuestionModal={setOpenAddQuestion} afterAdd={handleReloadSearchList} />
|
||||||
|
|
||||||
|
{/* 批量克隆点位 */}
|
||||||
|
<Modal
|
||||||
|
width={400}
|
||||||
|
title={"批量克隆"}
|
||||||
|
open={showBatchCloneModal}
|
||||||
|
confirmLoading={batchLoading}
|
||||||
|
onOk={() => {
|
||||||
|
batchCloneForm.current?.validateFields().then(async (res: any) => {
|
||||||
|
console.log('res', res);
|
||||||
|
console.log('currentRow', currentRow);
|
||||||
|
console.log('currentUser', currentUser);
|
||||||
|
console.log('serviceObj', serviceObj);
|
||||||
|
|
||||||
|
|
||||||
|
let list: any = res.serviceList
|
||||||
|
let serverParts: any = []
|
||||||
|
if (list && list.length > 0) {
|
||||||
|
list.forEach((item: any) => {
|
||||||
|
serverParts.push({
|
||||||
|
serverPartName: serviceObj[item],
|
||||||
|
serverPartId: item
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let question: any = []
|
||||||
|
if (currentRow?.questionnaireTemplateQuestions && currentRow?.questionnaireTemplateQuestions.length > 0) {
|
||||||
|
currentRow.questionnaireTemplateQuestions.forEach((item: any) => {
|
||||||
|
question.push({
|
||||||
|
questionId: item.questionId,
|
||||||
|
isRequired: item.isRequired,
|
||||||
|
sortOrder: item.sortOrder
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
let req: any = {
|
||||||
|
title: currentRow?.title,
|
||||||
|
placeName: currentRow?.placeName,
|
||||||
|
placeId: currentRow?.placeId,
|
||||||
|
serverParts: serverParts,
|
||||||
|
questions: question,
|
||||||
|
operator: currentUser?.operator,
|
||||||
|
status: currentRow?.status,
|
||||||
|
description: currentRow?.description
|
||||||
|
}
|
||||||
|
console.log('req', req);
|
||||||
|
const data = await handleBatchService(req)
|
||||||
|
console.log('datadatadatadata', data);
|
||||||
|
if (data.Result_Code === 100) {
|
||||||
|
message.success('批量克隆成功!')
|
||||||
|
actionRef.current?.reload()
|
||||||
|
batchCloneForm.current?.resetFields()
|
||||||
|
setshowBatchCloneModal(false)
|
||||||
|
setCurrentRow(undefined)
|
||||||
|
} else {
|
||||||
|
message.error(data.Result_Desc)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// setshowBatchCloneModal(false)
|
||||||
|
}}
|
||||||
|
onCancel={() => {
|
||||||
|
setshowBatchCloneModal(false)
|
||||||
|
batchCloneForm.current?.resetFields()
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ProForm
|
||||||
|
formRef={batchCloneForm}
|
||||||
|
submitter={false}
|
||||||
|
>
|
||||||
|
<Row>
|
||||||
|
<Col span={24}>
|
||||||
|
<ProFormSelect
|
||||||
|
label={"服务区"}
|
||||||
|
name={"serviceList"}
|
||||||
|
fieldProps={{
|
||||||
|
mode: "multiple",
|
||||||
|
showSearch: true,
|
||||||
|
filterOption: (input, option) => {
|
||||||
|
return (option?.label ?? '').toLowerCase().includes(input.toLowerCase());
|
||||||
|
},
|
||||||
|
optionFilterProp: "label"
|
||||||
|
}}
|
||||||
|
request={async () => {
|
||||||
|
const req = {
|
||||||
|
ProvinceCode: currentUser?.provinceCode,
|
||||||
|
StatisticsType: 1000
|
||||||
|
}
|
||||||
|
const data = await handleGetServerpartDDL(req)
|
||||||
|
let obj: any = {}
|
||||||
|
if (data && data.length > 0) {
|
||||||
|
data.forEach((item: any) => {
|
||||||
|
obj[item.value] = item.label
|
||||||
|
})
|
||||||
|
}
|
||||||
|
setAllServiceList(data)
|
||||||
|
setServiceObj(obj)
|
||||||
|
return data
|
||||||
|
}}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请选择目标服务区"
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</ProForm>
|
||||||
|
</Modal>
|
||||||
</div >
|
</div >
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import request from "@/utils/requestJava"
|
|||||||
export async function handleGetTemplatesList(params?: any) {
|
export async function handleGetTemplatesList(params?: any) {
|
||||||
const data = await request.get('/questionnaire-templates', { params })
|
const data = await request.get('/questionnaire-templates', { params })
|
||||||
if (data.Result_Code === 200) {
|
if (data.Result_Code === 200) {
|
||||||
return data.Result_Data.list
|
return data.Result_Data.List
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ export async function handleUpdateTemplates(params?: any) {
|
|||||||
|
|
||||||
// 删除模版
|
// 删除模版
|
||||||
export async function handleDeleteTemplates(params?: any) {
|
export async function handleDeleteTemplates(params?: any) {
|
||||||
const data = await request.get(`/questionnaire-templates/delete`,{params})
|
const data = await request.get(`/questionnaire-templates/delete`, { params })
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ export async function handleDeleteTemplates(params?: any) {
|
|||||||
export async function handleGetQuestionList(params?: any) {
|
export async function handleGetQuestionList(params?: any) {
|
||||||
const data = await request.get('/questions/getList', params)
|
const data = await request.get('/questions/getList', params)
|
||||||
if (data.Result_Code === 100) {
|
if (data.Result_Code === 100) {
|
||||||
return data.Result_Data.list
|
return data.Result_Data.List
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
@ -49,7 +49,13 @@ export async function handleUploadFile(params?: any) {
|
|||||||
export async function handleSearchModalTree(params?: any) {
|
export async function handleSearchModalTree(params?: any) {
|
||||||
const data = await request.post(`/questionnaire-templates/search/tree`, params)
|
const data = await request.post(`/questionnaire-templates/search/tree`, params)
|
||||||
if (data.Result_Code === 100) {
|
if (data.Result_Code === 100) {
|
||||||
return data.Result_Data.list
|
return data.Result_Data.List
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 批量克隆服务区
|
||||||
|
export async function handleBatchService(params?: any) {
|
||||||
|
const data = await request.post(`/questionnaire-templates/batchSave`, params)
|
||||||
|
return data
|
||||||
|
}
|
||||||
@ -5,7 +5,7 @@ import request from "@/utils/requestJava"
|
|||||||
export async function handleGetQuestionList(params?: any) {
|
export async function handleGetQuestionList(params?: any) {
|
||||||
const data = await request.post('/questions/search/many', params)
|
const data = await request.post('/questions/search/many', params)
|
||||||
if (data.Result_Code === 100) {
|
if (data.Result_Code === 100) {
|
||||||
return data.Result_Data.list
|
return data.Result_Data.List
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import requestMap from '@/utils/requestMap'
|
|||||||
export async function handleGetRecordList(params?: any) {
|
export async function handleGetRecordList(params?: any) {
|
||||||
const data = await request.post('/questionnaire-responses/search/many', params)
|
const data = await request.post('/questionnaire-responses/search/many', params)
|
||||||
if (data.Result_Code === 100) {
|
if (data.Result_Code === 100) {
|
||||||
return data.Result_Data.list
|
return data.Result_Data.List
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
@ -15,7 +15,7 @@ export async function handleGetRecordList(params?: any) {
|
|||||||
export async function handleGetRecordTreeList(params?: any) {
|
export async function handleGetRecordTreeList(params?: any) {
|
||||||
const data = await request.post('/questionnaire-responses/tree', params)
|
const data = await request.post('/questionnaire-responses/tree', params)
|
||||||
if (data.Result_Code === 100) {
|
if (data.Result_Code === 100) {
|
||||||
return data.Result_Data.list
|
return data.Result_Data.List
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
@ -47,4 +47,14 @@ export async function handleUploadFile(params?: any) {
|
|||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 拿到考核记录的汇总数据
|
||||||
|
export async function handleGetResponsesSummary(params?: any) {
|
||||||
|
const data = await request.post(`/questionnaire-responses/statistic`, params)
|
||||||
|
if (data.Result_Code === 100) {
|
||||||
|
return data.Result_Data.List
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { connect } from "umi";
|
|||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { Button, Drawer, Image, message, Popconfirm, Space } from "antd";
|
import { Button, Drawer, Image, message, Popconfirm, Space } from "antd";
|
||||||
import LeftSelectTree from "@/components/leftSelectTree/leftSelectTree";
|
import LeftSelectTree from "@/components/leftSelectTree/leftSelectTree";
|
||||||
import { handleGetRecordTreeList } from "../record/service";
|
import { handleGetRecordTreeList, handleGetResponsesSummary } from "../record/service";
|
||||||
|
|
||||||
const recordSummary: React.FC<{ currentUser: any }> = (props) => {
|
const recordSummary: React.FC<{ currentUser: any }> = (props) => {
|
||||||
const { currentUser } = props
|
const { currentUser } = props
|
||||||
@ -72,7 +72,7 @@ const recordSummary: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: <div style={{ textAlign: 'center' }}>巡查次数</div>,
|
title: <div style={{ textAlign: 'center' }}>巡查天数</div>,
|
||||||
dataIndex: "inspectionNumber",
|
dataIndex: "inspectionNumber",
|
||||||
align: 'center',
|
align: 'center',
|
||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
@ -373,8 +373,8 @@ const recordSummary: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
|
|
||||||
const req: any = {
|
const req: any = {
|
||||||
serverPartIds: selectedId && selectedId.length > 0 ? selectedId : [],
|
serverPartIds: selectedId && selectedId.length > 0 ? selectedId : [],
|
||||||
startTime: params?.startTime ? `${params?.startTime}T00:00:00` : "",
|
startTime: params?.startTime ? `${params?.startTime}` : "",
|
||||||
endTime: params?.endTime ? `${params?.endTime}T23:59:59` : "",
|
endTime: params?.endTime ? `${params?.endTime}` : "",
|
||||||
// serverPartId: params?.serverPartId ? params?.serverPartId : undefined,
|
// serverPartId: params?.serverPartId ? params?.serverPartId : undefined,
|
||||||
extend: params?.inspectionType ? [{
|
extend: params?.inspectionType ? [{
|
||||||
key: "situation",
|
key: "situation",
|
||||||
@ -389,7 +389,8 @@ const recordSummary: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
setSearchParams(params)
|
setSearchParams(params)
|
||||||
|
|
||||||
console.log('req', req);
|
console.log('req', req);
|
||||||
const data = await handleGetRecordTreeList(req)
|
// const data = await handleGetRecordTreeList(req)
|
||||||
|
const data = await handleGetResponsesSummary(req)
|
||||||
console.log('dat3a333', data);
|
console.log('dat3a333', data);
|
||||||
|
|
||||||
// 处理一下 根据第三层的实际巡查记录 汇总到第二层来
|
// 处理一下 根据第三层的实际巡查记录 汇总到第二层来
|
||||||
@ -454,53 +455,6 @@ const recordSummary: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
dateObj[moment(thirdItem.createdAt).format('YYYY-MM-DD')] = [thirdItem.template.id]
|
dateObj[moment(thirdItem.createdAt).format('YYYY-MM-DD')] = [thirdItem.template.id]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (templateIdList.indexOf(thirdItem.template.id) === -1) {
|
|
||||||
// templateIdList.push(thirdItem.template.id)
|
|
||||||
// // 没有过的点位数据 就给他默认值
|
|
||||||
// newChildren.push({
|
|
||||||
// template: thirdItem.template,
|
|
||||||
// inspectionNumber: 1,
|
|
||||||
// normalNumber: extendObj?.situation === 0 ? 1 : 0,
|
|
||||||
// errorNumber: extendObj?.situation === 1 ? 1 : 0,
|
|
||||||
// pendingProcessNumber: extendObj?.errorStatus === 0 ? 1 : 0,
|
|
||||||
// processingNumber: extendObj?.errorStatus === 1 ? 1 : 0,
|
|
||||||
// processedNumber: extendObj?.errorStatus === 2 ? 1 : 0,
|
|
||||||
// })
|
|
||||||
// } else {
|
|
||||||
// // 如果已经有过了的点位 给他加当前的状态就好
|
|
||||||
// let nowDayData = dateObj[moment(thirdItem.createdAt).format('YYYY-MM-DD')]
|
|
||||||
// // 判断这一天 这个点位 是否已经有过了
|
|
||||||
// let isHave: boolean = false
|
|
||||||
// if (nowDayData && nowDayData.length > 0) {
|
|
||||||
// if (nowDayData.indexOf(thirdItem.template.id) !== -1) {
|
|
||||||
// isHave = true
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if (!isHave) {
|
|
||||||
// if (newChildren && newChildren.length > 0) {
|
|
||||||
// newChildren.forEach((fourthItem: any) => {
|
|
||||||
// if (fourthItem.template.id === thirdItem.template.id) {
|
|
||||||
|
|
||||||
// fourthItem.inspectionNumber += 1
|
|
||||||
// if (extendObj?.situation === 0) {
|
|
||||||
// fourthItem.normalNumber += 1
|
|
||||||
// } else if (extendObj?.situation === 1) {
|
|
||||||
// fourthItem.errorNumber += 1
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (extendObj?.errorStatus === 0) {
|
|
||||||
// fourthItem.pendingProcessNumber += 1
|
|
||||||
// } else if (extendObj?.errorStatus === 1) {
|
|
||||||
// fourthItem.processingNumber += 1
|
|
||||||
// } else if (extendObj?.errorStatus === 2) {
|
|
||||||
// fourthItem.processedNumber += 1
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
console.log('dateObj', dateObj);
|
console.log('dateObj', dateObj);
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user