From 5239fb37d0946a2cbc939edf65345d14248c55c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BF=83=E5=AE=87?= Date: Thu, 20 Jul 2023 09:21:47 +0800 Subject: [PATCH] cont. --- src/military/iframe.jsx | 6 +- src/military/task/agreementManageNew/index.js | 179 ------------ .../task/agreementManageNew/index.jsx | 272 ++++++++++++++++++ .../task/agreementManageNew/index.scss | 21 ++ src/military/task/agreementSign/index.jsx | 98 ++----- src/military/task/api.js | 2 +- .../task/components/agreementModal/index.jsx | 28 +- 7 files changed, 341 insertions(+), 265 deletions(-) delete mode 100644 src/military/task/agreementManageNew/index.js create mode 100644 src/military/task/agreementManageNew/index.jsx create mode 100644 src/military/task/agreementManageNew/index.scss diff --git a/src/military/iframe.jsx b/src/military/iframe.jsx index 1dc4d15b2..f9feccb71 100644 --- a/src/military/iframe.jsx +++ b/src/military/iframe.jsx @@ -7,10 +7,10 @@ import { TPMIndexHOC } from "../modules/tpm/TPMIndexHOC"; const Iframe = (props) => { - console.log(props) + const history = props.history + const location = history.location function iframeLoad() { - console.log(1111) let myIframe = document.getElementById("iframe"); myIframe.height = `${document.documentElement.clientHeight - 300}px` } @@ -18,7 +18,7 @@ const Iframe = (props) => { return } diff --git a/src/military/task/agreementManageNew/index.js b/src/military/task/agreementManageNew/index.js deleted file mode 100644 index 9fa18360b..000000000 --- a/src/military/task/agreementManageNew/index.js +++ /dev/null @@ -1,179 +0,0 @@ -import React, { useCallback, useEffect, useState, useRef } from 'react'; -import { Input, Button, Form, Select } from 'antd'; - -import ItemAgreementManage from '../components/itemAgreementManage'; -import StatusNav from '../../components/statusNav'; -import { agreementArr } from '../static'; -import { agreementListNew } from '../api'; -import '../index.scss'; -const Option = Select.Option; - -const agreementOptionArr = agreementArr.slice(0, 2); -export default Form.create()(({ form, showNotification, match, history }) => { - - - const { getFieldDecorator, validateFields, setFieldsValue, } = form; - - const [approve, setApprove] = useState(1); - const [loading, setLoading] = useState(false); - const [searchObj, setSearchObj] = useState({}); - const [status, setStatus] = useState('2'); - const [curPage, setCurPage] = useState(1); - const [total, setTotal] = useState(0); - const [taskList, setTaskList] = useState([]); - - const [reload, setReload] = useState(0); - const iframe = useRef() - - - // 加载审核协议列表 - useEffect(() => { - const params = { - ...searchObj, - status, - currentPage: curPage, - pageSize: 10, - }; - setLoading(true); - agreementListNew(params).then(data => { - data = data.data - if (data) { - if((data.rows && data.rows.length<=0) && curPage>1){ - setCurPage(curPage-1); - } - setTaskList(data.rows); - setTotal(data.total); - } - setLoading(false); - }); - }, [reload, status, curPage, searchObj]); - - useEffect(() => { - if (iframe.current) { - if (!iframe.current.onload) { - iframe.current.onload = (e) => { - console.log(iframe.current) - console.log(e) - } - } - } - }, [iframe]) - - // form表单公共处理函数 - const helper = useCallback( - (name, rules, widget, initialValue) => ( - - {getFieldDecorator(name, { rules, initialValue, validateFirst: true, })(widget)} - - ), []); - - - function onSearch() { - validateFields((err, values) => { - if (!err) { - setSearchObj(values); - } - }); - } - - // 修改选项 - const changeOptionId = useCallback((option) => { - setStatus(option.dicItemCode.toString() || '0,1'); - setCurPage(1); - }, []); - - // 修改状态 - function changeApprove(approve) { - setApprove(approve); - setCurPage(1); - if (approve === 1) { - setStatus('2'); - } else { - setStatus('0,1'); - } - } - - // 清除查询内容 - function clearSearch() { - setFieldsValue({ - taskNumber: '', - taskName: '', - userName: '' - }); - setSearchObj({}); - } - - // 刷新数据 - const reloadList = useCallback(() => { - setReload(Math.random()); - }, []); - - - return ( -
-
-
- - -
- -
- {helper( - "taskNumber", - [{ max: 20, message: '长度不能超过20个字符' }], - - )} - - {helper( - "taskName", - [{ max: 20, message: '长度不能超过20个字符' }], - - )} - - {helper( - "userName", - [{ max: 20, message: '长度不能超过20个字符' }], - - )} - - - - -
-
- - -
- - { - approve === 2 && - } - { setCurPage(page) }} - loading={loading} - showNotification={showNotification} - reloadList={reloadList} - newFlag={ true } - /> - -
- - -
- ) -} -) \ No newline at end of file diff --git a/src/military/task/agreementManageNew/index.jsx b/src/military/task/agreementManageNew/index.jsx new file mode 100644 index 000000000..721485070 --- /dev/null +++ b/src/military/task/agreementManageNew/index.jsx @@ -0,0 +1,272 @@ +import React, { useCallback, useEffect, useState, useMemo } from 'react'; +import { Input, Radio, Select, Button, Form, Icon, Table, Pagination, Modal } from 'antd'; +import { Link } from "react-router-dom"; +import { Confirm } from '../../components/ModalFun'; +import { paperCheckStatusArr,taskStatusAllArr } from '../static'; +import { agreementListNew, adminCheckAgreementNew } from '../api'; +import '../index.scss'; +import './index.scss'; +const format = "YYYY-MM-DD HH:mm:ss"; +const Option = Select.Option; +const TextArea = Input.TextArea; + +const statusArr = []; +for (const item of taskStatusAllArr) { + statusArr[item.dicItemCode] = item.dicItemName; +} +const checkStatusArr = []; +for (const item of paperCheckStatusArr) { + checkStatusArr[item.dicItemCode] = item.dicItemName; +} +export default Form.create()(({ current_user, form, showNotification, match, history }) => { + + + const { getFieldDecorator, setFieldsValue, getFieldsValue, validateFields } = form; + + const [loading, setLoading] = useState(false); + const [searchObj, setSearchObj] = useState({ + firstDraftCheckStatus: '2', + }); + const [currentPage, setCurrentPage] = useState(1); + const [total, setTotal] = useState(0); + const [taskList, setTaskList] = useState([]); + + const [reload, setReload] = useState(0); + const [activeId, setActiveId] = useState(''); + + const [checkedItem, setCheckedItem] = useState({}); + const [visible, setVisible] = useState(false); + + + useEffect(() => { + const params = { + currentPage, + pageSize: 10, + ...searchObj, + }; + setLoading(true); + agreementListNew(params).then(data => { + data = data.data + if (data) { + if((data.rows && data.rows.length<=0) && currentPage>1){ + setCurrentPage(currentPage-1); + } + setTaskList(data.rows); + setTotal(data.total); + } + setLoading(false); + }) + }, [reload, currentPage, searchObj]); + + + const helper = useCallback( + (label, name, rules, widget, initialValue) => ( + + {getFieldDecorator(name, { rules, initialValue, validateFirst: true, })(widget)} + + ), []); + + + function onSearch() { + let values = getFieldsValue(['firstDraftCheckStatus', 'taskName']); + if (values.firstDraftCheckStatus === '0,1,2') values.firstDraftCheckStatus = ''; + setSearchObj(values); + } + + function clearSearch() { + setFieldsValue({ + firstDraftCheckStatus: '', + }); + setSearchObj({}); + } + + function agreeClick(item) { + Modal.confirm({ + title: '确认审批通过?', + onOk() { + adminCheckAgreementNew({ + taskOnlineSignId: item.id, + params: { + pass: 1, + } + }).then(res => { + if (res && res.message === 'success') { + showNotification('操作成功'); + setReload(Math.random()); + } + }) + } + }); + } + + function refuseClick(item) { + setCheckedItem(item); + setVisible(true); + } + + function dealAction() { + validateFields((error, values) => { + if (!error) { + adminCheckAgreementNew({ + taskOnlineSignId: checkedItem.id, + params: { + pass: 0, + message: values.message + } + }).then(res => { + if (res && res.message === 'success') { + showNotification('操作成功'); + setReload(Math.random()); + setVisible(false); + } + }); + } + }); + } + + + const columns = useMemo(() => { + return [ + { + title: '序号', + dataIndex: 'index', + render: (text, record, index) => { + return
{index + 1}
+ } + }, + { + title: '任务名称', + dataIndex: 'taskName', + }, + { + title: '胜出者', + dataIndex: 'winnerUserName', + }, + { + title: '签订表文件', + dataIndex: 'user', + render: (text, record) => { + return record.signatureFormUnsignedFile ? + { record.signatureFormUnsignedFile.fileName } + : '-' + } + }, + { + title: '协议文件文件', + dataIndex: 'user1', + render: (text, record) => { + return record.agreementFile ? + { record.agreementFile.fileName } + : '-' + } + }, + { + title: '发布时间', + dataIndex: 'createdAt', + }, + { + title: '操作', + key: 'action', + render: (text, record) => ( + + + {record.firstDraftCheckStatus === 1 && 已通过} + {record.firstDraftCheckStatus === 0 && 未通过} + + { + record.firstDraftCheckStatus === 2 && + + + + } + + + ), + }, + ] + }, []); + + function changeType(e) { + setSearchObj({ + ...searchObj, + firstDraftCheckStatus: e + }); + setCurrentPage(1); + } + + return ( +
+
+
+ {helper( + "审核状态", + "firstDraftCheckStatus", + [], + , + 2 + )} + + {helper( + "任务名称", + "taskName", + [{ max: 20, message: '长度不能超过20个字符' }], + + )} + + + + +
+
+ + +
+ + row.id} + dataSource={taskList} + columns={columns} + pagination={false} + className="mt10" + /> + {total > 10 && + { setCurrentPage(page) }} + current={currentPage} + total={total} + />} + + + { setVisible(false) }} + className="form-edit-modal" + > + { + helper('驳回原因', 'message', [{ required: visible, message: "请输入驳回的原因" }, { max: 200, message: '不能超过200字符' }], +