|
@@ -4,7 +4,7 @@
|
|
|
* @Author: code4eat awesomedema@gmail.com
|
|
|
* @Date: 2022-12-16 09:42:52
|
|
|
* @LastEditors: code4eat awesomedema@gmail.com
|
|
|
- * @LastEditTime: 2023-08-03 15:36:29
|
|
|
+ * @LastEditTime: 2023-08-11 11:30:07
|
|
|
* @FilePath: /BudgetManaSystem/src/pages/budgetMana/monthlySet/index.tsx
|
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
|
*/
|
|
@@ -19,12 +19,14 @@ import './style.less';
|
|
|
import { TreeProps, Input, Modal, message, Popover, Table, Switch, Tooltip } from 'antd';
|
|
|
import { DataNode } from 'antd/es/tree';
|
|
|
|
|
|
+import { TransferItem, TransferProps } from 'antd/es/transfer';
|
|
|
+
|
|
|
import expandedIcon from '../../../../static/treenode_open.png';
|
|
|
import closeIcon from '../../../../static/treenode_collapse.png';
|
|
|
import { BMSTable } from '@/components/BMSTable';
|
|
|
-import { ActionType, ModalForm, ProColumns, ProFormDatePicker, ProFormDigit, ProFormInstance, ProFormSelect, ProFormText } from '@ant-design/pro-components';
|
|
|
+import { ActionType, ModalForm, ProColumns, ProFormDigit, ProFormSelect } from '@ant-design/pro-components';
|
|
|
import { createFromIconfontCN } from '@ant-design/icons';
|
|
|
-import { checkCurrentRequest, checkRequest, commitRequest, downloadTemplateReq, getCurrentCheckStatusReq, getCurrentCommitStatusReq, getCurrentUnitCheckStatusReq, getData, getSecondaryDistriComputeTableData, getTreeData, getTreeDataRespType, importExcelData, save } from './service';
|
|
|
+import { commitRequest, downloadTemplateReq, getCurrentCommitStatusReq, getDataByBtn, getPingjiListByCode, getSecondaryDistriComputeTableData, getTreeData, getTreeDataRespType, importExcelData, save, saveWorkLang } from './service';
|
|
|
import FormItem from 'antd/es/form/FormItem';
|
|
|
|
|
|
import { getComputeDate } from '@/pages/Home/service';
|
|
@@ -46,6 +48,7 @@ import moment from 'moment';
|
|
|
import { getJiezhuanStatus } from '@/pages/budgetMana/monthlySet/service';
|
|
|
import '../../../utils/zhongtaiA';
|
|
|
import BMSUpload from '@/components/BMSUpload';
|
|
|
+import { getWorkData } from '@/pages/setting/checkUnitSet/medicalGroupSet/service';
|
|
|
|
|
|
|
|
|
const SearchIcon = createFromIconfontCN({
|
|
@@ -62,13 +65,13 @@ export type TableListItem = {
|
|
|
name: string;
|
|
|
};
|
|
|
|
|
|
-let inputsRefKeys:string[] = [];
|
|
|
+let inputsRefKeys: string[] = [];
|
|
|
+
|
|
|
+let currentComputeEmp: undefined | any = undefined; //当前工作量计算人员
|
|
|
|
|
|
|
|
|
const UnitCheckProjectScore: React.FC = () => {
|
|
|
const location = useLocation();
|
|
|
- const access = useAccess();
|
|
|
- const userFunctionInThispage = access.whatCanIDoInThisPage(location.pathname);
|
|
|
const [ifCheckPage, set_ifCheckPage] = useState(false); //是否为二次分配审核页面
|
|
|
const [treeData, set_treeData] = useState<getTreeDataRespType[]>([]);
|
|
|
const [treeDataDefault, set_treeDataDefault] = useState<getTreeDataRespType[]>([]);
|
|
@@ -80,9 +83,6 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
const [ifShowTip, set_ifShowTip] = useState(false);
|
|
|
|
|
|
const [commitStatus, set_commitStatus] = useState('0'); //提交状态
|
|
|
-
|
|
|
- const [empFilterParams, set_empFilterParams] = useState<any | undefined>(undefined);
|
|
|
-
|
|
|
const [expandedKeys, setExpandedKeys] = useState<React.Key[]>([]);
|
|
|
const [searchValue, setSearchValue] = useState('');
|
|
|
const [autoExpandParent, setAutoExpandParent] = useState(true);
|
|
@@ -91,8 +91,6 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
|
|
|
const [auditType, set_auditType] = useState('0'); //审核状态
|
|
|
|
|
|
- const [currentUnitAuditType, set_currentUnitAuditType] = useState('0'); //当前单元审核状态
|
|
|
-
|
|
|
const tableRef = useRef<ActionType>();
|
|
|
|
|
|
const [needSaveData, set_needSaveData] = useState<any | undefined>(undefined);
|
|
@@ -105,12 +103,19 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
|
|
|
const [dataSource, set_dataSource] = useState([]);
|
|
|
|
|
|
+ const [tableData, set_tableData] = useState([]);
|
|
|
+
|
|
|
const [currentInputRefKeys, set_currentInputRefKeys] = useState<string | undefined>(undefined);
|
|
|
const [tableH, set_tableH] = useState(0);
|
|
|
const [currentTreeDataFilter, set_currentTreeDataFilter] = useState({ name: '全部单元', code: 0 });
|
|
|
const [treeFilterVisible, set_treeFilterVisible] = useState(false);
|
|
|
|
|
|
const [ifBanAllAction, set_ifBanAllAction] = useState(true); //是否掩藏所有操作
|
|
|
+ const [pingjiOptions, set_pingjiOptions] = useState<undefined | any>(undefined);
|
|
|
+
|
|
|
+ const tableSelecterRef = React.createRef<{ saveHandle: any; getSelectedKeys: any }>();
|
|
|
+
|
|
|
+ const [ifShowModal, set_ifShowModal] = useState(false);
|
|
|
|
|
|
|
|
|
const column: ProColumns[] = [
|
|
@@ -122,6 +127,131 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
},
|
|
|
];
|
|
|
|
|
|
+ const tableSelecterColumn: any[] = [
|
|
|
+ {
|
|
|
+ title: '核算日期',
|
|
|
+ dataIndex: 'calculateDate',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '项目数值',
|
|
|
+ dataIndex: 'indicatorValue',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '项目名称',
|
|
|
+ dataIndex: 'indicatorName',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '参考核算单元',
|
|
|
+ dataIndex: 'unitName',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '人员',
|
|
|
+ dataIndex: 'userName',
|
|
|
+ },
|
|
|
+ ];
|
|
|
+
|
|
|
+ interface TableSelecterProps extends TransferProps<TransferItem> {
|
|
|
+ tableSelecterColumn: any[];
|
|
|
+ record: any
|
|
|
+ }
|
|
|
+
|
|
|
+ const TableSelecter = React.forwardRef(({ tableSelecterColumn, record }: TableSelecterProps, ref) => {
|
|
|
+
|
|
|
+ const [datasource, set_datasource] = useState<any[]>([]);
|
|
|
+ const [selectedKeys, setSelectedKeys] = useState<React.Key[]>([]);
|
|
|
+ const [showList, set_showList] = useState<any[]>([]);
|
|
|
+
|
|
|
+ //获取表格数据
|
|
|
+ const getFuncList = async () => {
|
|
|
+ const resp = await getWorkData({
|
|
|
+ computeDate: currentComputeDate as string,
|
|
|
+ unitCode: currentSelectedTreeNode.code,
|
|
|
+ empNo: currentComputeEmp.empNo
|
|
|
+ });
|
|
|
+ if (resp) {
|
|
|
+ set_datasource(resp);
|
|
|
+ set_showList(resp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ const onSelectChange = (newSelectedRowKeys: React.Key[]) => {
|
|
|
+ setSelectedKeys([...newSelectedRowKeys]);
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+ const saveHandle = async () => {
|
|
|
+
|
|
|
+ const needData = datasource.filter(item => selectedKeys.includes(item.id));
|
|
|
+ const total = needData.reduce((prev: number, cur: any) => prev + cur.indicatorValue, 0);
|
|
|
+
|
|
|
+ const value = total.toFixed(4);
|
|
|
+
|
|
|
+ const resp = await saveWorkLang({
|
|
|
+ computeDate: currentComputeDate as string,
|
|
|
+ unitCode: currentSelectedTreeNode.code,
|
|
|
+ empNo:currentComputeEmp.empNo,
|
|
|
+ code:currentComputeEmp.colCode,
|
|
|
+ value:value
|
|
|
+ });
|
|
|
+
|
|
|
+ if (resp) {
|
|
|
+ message.success('操作成功!');
|
|
|
+ set_ifShowModal(false);
|
|
|
+ getTableData({});
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ getFuncList();
|
|
|
+ }, [])
|
|
|
+
|
|
|
+ return (
|
|
|
+ <div className='TableSelecter'>
|
|
|
+ <Input placeholder={'请输入项目名称'} allowClear
|
|
|
+ suffix={
|
|
|
+ <IconFont style={{ color: '#99A6BF' }} type="iconsousuo" />
|
|
|
+ }
|
|
|
+ style={{ marginBottom: 8 }}
|
|
|
+ onChange={(e) => {
|
|
|
+ if (e.target.value.length != 0) {
|
|
|
+ const result = datasource.filter(item => item.indicatorName.indexOf(e.target.value) != -1);
|
|
|
+ set_showList(result);
|
|
|
+ } else {
|
|
|
+ set_showList(datasource);
|
|
|
+ }
|
|
|
+
|
|
|
+ }}
|
|
|
+
|
|
|
+ />
|
|
|
+ <BMSTable columns={tableSelecterColumn}
|
|
|
+ options={{
|
|
|
+ density: true,
|
|
|
+ setting: {
|
|
|
+ listsHeight: 100,
|
|
|
+ },
|
|
|
+ }}
|
|
|
+ rowKey='id'
|
|
|
+ scroll={{y:400}}
|
|
|
+ tableAlertRender={false}
|
|
|
+ rowSelection={{
|
|
|
+ // 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom
|
|
|
+ // 注释该行则默认不显示下拉选项
|
|
|
+ // selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
|
|
|
+ onChange: onSelectChange,
|
|
|
+ }}
|
|
|
+ pagination={{ showTitle: false,showSizeChanger:true }}
|
|
|
+ dataSource={showList}
|
|
|
+ />
|
|
|
+ <div className='footer'>
|
|
|
+ <span className='cancel' onClick={() => set_ifShowModal(false)}>取消</span>
|
|
|
+ <span className='ok' onClick={() => saveHandle()}>{`确认(${selectedKeys.length > 0 && selectedKeys.length})`}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ )
|
|
|
+ });
|
|
|
+
|
|
|
|
|
|
const onSelect: TreeProps['onSelect'] = (selectedKeys, info: any) => {
|
|
|
// console.log('selected', selectedKeys, info);
|
|
@@ -177,7 +307,7 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
const resp = await importExcelData(formData);
|
|
|
|
|
|
if (resp) {
|
|
|
- tableRef.current?.reload();
|
|
|
+ getTableData({});
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -197,19 +327,6 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
set_currentComputeDate(resp);
|
|
|
}
|
|
|
|
|
|
- const getCheckStatus = async (computeDate: string) => {
|
|
|
-
|
|
|
- const resp = await getCurrentCheckStatusReq(computeDate);
|
|
|
- set_auditType(`${resp}`); //0 未审核 1 已审核
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- const getCurrentUnitCheckStatus = async () => {
|
|
|
- if (currentSelectedTreeNode) {
|
|
|
- const resp = await getCurrentUnitCheckStatusReq(currentComputeDate as string, currentSelectedTreeNode.code);
|
|
|
- set_currentUnitAuditType(`${resp}`); //0 未审核 1 已审核
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
const getCurrentCommitStatus = async () => {
|
|
|
if (currentSelectedTreeNode) {
|
|
@@ -221,25 +338,66 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ //工作量计算
|
|
|
+ const calcuHanle = (rowData: any) => {
|
|
|
+ currentComputeEmp = rowData;
|
|
|
+ set_ifShowModal(true);
|
|
|
+ }
|
|
|
+
|
|
|
const gennerateColumns = (data: { title: any; userList: any; }, inputsRefKeys?: string[]) => {
|
|
|
const { title } = data;
|
|
|
- const _title = title.filter((a:any)=>a.code != 'Employee');
|
|
|
+ const _title = title.filter((a: any) => a.code != 'Employee');
|
|
|
_title.sort((prev: any, next: any) => prev.sort - next.sort);
|
|
|
+
|
|
|
const _columns = _title.map((item: any, index: number) => {
|
|
|
return {
|
|
|
- title: item.name,
|
|
|
+ title: <div>{item.name}{item.source == 2 && <span style={{ display: 'inline-flex', marginLeft: 5, justifyContent: 'center', alignItems: 'center', width: 14, height: 14, borderRadius: 4, background: '#80BFFF', color: '#fff' }}>A</span>}</div>,
|
|
|
dataIndex: `${item.code}`,
|
|
|
width: 120,
|
|
|
renderText: (_: any, record: any) => {
|
|
|
if (ifEditMode) {
|
|
|
|
|
|
let _val = _;
|
|
|
-
|
|
|
if (item.evaluation == 2) {
|
|
|
|
|
|
return <ProFormSelect
|
|
|
noStyle
|
|
|
- options={item.level}
|
|
|
+ fieldProps={{
|
|
|
+ defaultValue: _,
|
|
|
+ onFocus: () => { currentComputeEmp = { ...record, colCode: item.code } },
|
|
|
+ onChange(value, option) {
|
|
|
+
|
|
|
+ const updatedList = needSaveData.secondValueVos.map((a: any) => {
|
|
|
+ if (a.empNo == record.empNo) {
|
|
|
+ //value里是否存在对应的code
|
|
|
+ const ifhasColCode = (a.value.filter((c: any) => c.code == currentComputeEmp.colCode)).length == 0 ? false : true;
|
|
|
+
|
|
|
+ if (!ifhasColCode) {
|
|
|
+ //当不存在对应的code时
|
|
|
+ let list = [...a.value];
|
|
|
+ list.push({ code: currentComputeEmp.colCode, value: value });
|
|
|
+ return { ...a, value: list }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ const arr = a.value.map((b: any) => {
|
|
|
+ if (b.code == item.code) {
|
|
|
+ return { ...b, value: value ? value : 0 } //value有为undefined的可能
|
|
|
+ } else {
|
|
|
+ return b
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return { ...a, value: arr }
|
|
|
+ } else {
|
|
|
+ return a
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ set_needSaveData({ ...needSaveData, secondValueVos: updatedList });
|
|
|
+ },
|
|
|
+ }}
|
|
|
+ options={pingjiOptions[`${item.code}`]}
|
|
|
/>
|
|
|
}
|
|
|
|
|
@@ -249,9 +407,20 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
inputsRefKeys?.push(`${record.empNo}-${item.code}`);
|
|
|
//console.log({ref});
|
|
|
},
|
|
|
+
|
|
|
onBlur: () => {
|
|
|
const updatedList = needSaveData.secondValueVos.map((a: any) => {
|
|
|
if (a.empNo == record.empNo) {
|
|
|
+
|
|
|
+ const ifhasColCode = (a.value.filter((c: any) => c.code == currentComputeEmp.colCode)).length == 0 ? false : true;
|
|
|
+
|
|
|
+ if (!ifhasColCode) {
|
|
|
+ //当不存在对应的code时
|
|
|
+ let list = [...a.value];
|
|
|
+ list.push({ code: currentComputeEmp.colCode, value: _val ? _val : 0 });
|
|
|
+ return { ...a, value: list }
|
|
|
+ }
|
|
|
+
|
|
|
const arr = a.value.map((b: any) => {
|
|
|
if (b.code == item.code) {
|
|
|
return { ...b, value: _val ? _val : 0 } //value有为undefined的可能
|
|
@@ -277,6 +446,17 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
const value = event.target.value ? Number(event.target.value) : 0;
|
|
|
const updatedList = needSaveData.secondValueVos.map((a: any) => {
|
|
|
if (a.empNo == record.empNo) {
|
|
|
+
|
|
|
+ const ifhasColCode = (a.value.filter((c: any) => c.code == currentComputeEmp.colCode)).length == 0 ? false : true;
|
|
|
+
|
|
|
+ if (!ifhasColCode) {
|
|
|
+ //当不存在对应的code时
|
|
|
+ let list = [...a.value];
|
|
|
+ list.push({ code: currentComputeEmp.colCode, value: value ? value : 0 });
|
|
|
+ return { ...a, value: list }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
const arr = a.value.map((b: any) => {
|
|
|
if (b.code == item.code) {
|
|
|
return { ...b, value: value ? value : 0 } //value有为undefined的可能
|
|
@@ -301,18 +481,18 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- onFocus: () => set_currentInputRefKeys(`${record.empNo}-${item.code}`),
|
|
|
+ onFocus: () => {set_currentInputRefKeys(`${record.empNo}-${item.code}`);currentComputeEmp = { ...record, colCode: item.code };},
|
|
|
defaultValue: _,
|
|
|
|
|
|
}} width={80} />
|
|
|
} else {
|
|
|
- return <span style={{ display: 'inline-block', width: 80 }}>{_}</span>
|
|
|
+ return <span style={{ display: 'block' }}>{_}{item.source == 3 && <img onClick={() => calcuHanle({ ...record, colCode: item.code })} style={{ width: 16, height: 16, cursor: 'pointer', marginLeft: 8 }} src={require('../../../../static/calcu.png')} />}</span>
|
|
|
}
|
|
|
},
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- set_tableColumn([...column,..._columns]);
|
|
|
+ set_tableColumn([...column, ..._columns]);
|
|
|
}
|
|
|
|
|
|
const getTableData = async (params: any) => {
|
|
@@ -324,6 +504,13 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
...params,
|
|
|
});
|
|
|
if (resp) {
|
|
|
+ const { title } = resp;
|
|
|
+ title.forEach((a: any) => {
|
|
|
+ if (a.evaluation == 2) {
|
|
|
+ getPingjiData(a.code);
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
set_needSaveData(resp);
|
|
|
//buildTableData(resp);
|
|
|
}
|
|
@@ -333,6 +520,15 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ const getPingjiData = async (code: string) => {
|
|
|
+ const resp = await getPingjiListByCode(code);
|
|
|
+ if (resp) {
|
|
|
+ const needData = resp.map((a: any) => ({ label: a.levelName, value: a.levelName }));
|
|
|
+ set_pingjiOptions({ ...pingjiOptions, [`${code}`]: needData })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
const buildTableData = (resp: any, inputsRefKeys?: string[]) => {
|
|
|
const { title, secondValueVos } = resp;
|
|
@@ -349,164 +545,39 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
total = total + b.value;
|
|
|
});
|
|
|
|
|
|
- return { ...item, ...rowData, id: Math.random(), _columns,Employee:item.empName}
|
|
|
+ return { ...item, ...rowData, id: Math.random(), _columns, Employee: item.empName }
|
|
|
});
|
|
|
|
|
|
const compeltedTotal = data.reduce((prev: any, cur: any) => prev + cur.totalScore, 0);
|
|
|
const leftTotal = resp.totalBonus - compeltedTotal;
|
|
|
set_pageData({ ...pageData, total: resp.totalBonus ? resp.totalBonus.toFixed(2) : 0, completedTotal: compeltedTotal.toFixed(2), leftTotal: Number(leftTotal.toFixed(2)) });
|
|
|
|
|
|
- set_dataSource(data)
|
|
|
+ set_dataSource(data);
|
|
|
+ set_tableData(data);
|
|
|
}
|
|
|
|
|
|
- const checkIfCommit = (type: number) => {
|
|
|
- // type 1 当前 2 全部
|
|
|
- //检查当前单元是否提交
|
|
|
- if (type == 1) {
|
|
|
- //currentUnitAuditType == 1 时是取消操作无需校验
|
|
|
- return currentUnitAuditType == '1' ? true : currentSelectedTreeNode.map
|
|
|
- }
|
|
|
- if (type == 2 && auditType == '0') {
|
|
|
- //auditType == 1 时是取消操作无需校验
|
|
|
- interface Node {
|
|
|
- map: boolean;
|
|
|
- child?: Node[];
|
|
|
- }
|
|
|
-
|
|
|
- function filterNodes(node: Node): Node | null {
|
|
|
- if (node.map === false && (!node.child || node.child.length === 0)) {
|
|
|
- return node; // 如果节点map为false并且是叶子节点,返回该节点
|
|
|
- }
|
|
|
-
|
|
|
- if (Array.isArray(node.child)) {
|
|
|
- // 对每个子节点递归执行此过程
|
|
|
- let child = node.child.map(filterNodes).filter((n): n is Node => n !== null);
|
|
|
- if (child.length > 0) {
|
|
|
- // 如果有任何子节点的map属性为false,返回包含这些子节点的新节点
|
|
|
- return { ...node, child: child };
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 如果节点map为true,或者所有子节点的map都为true,返回null
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- const result = treeData.map(a => {
|
|
|
- return filterNodes(a);
|
|
|
- });
|
|
|
-
|
|
|
- return result.length == 0
|
|
|
|
|
|
- } else {
|
|
|
- return true
|
|
|
- }
|
|
|
- }
|
|
|
+ const commitBtnhandle = async () => {
|
|
|
|
|
|
- const commitBtnhandle = async (type?: number) => {
|
|
|
- //console.log({type});
|
|
|
- /**
|
|
|
- * type 1 单个 2 全部
|
|
|
- * 提交界面不需要type
|
|
|
- */
|
|
|
-
|
|
|
- const handle = async (ifCheckCommit: string) => {
|
|
|
- if (type == 1) {
|
|
|
- //审核单个
|
|
|
- const resp = await checkCurrentRequest({
|
|
|
+ Modal.confirm({
|
|
|
+ title: '注意',
|
|
|
+ okText: '确定',
|
|
|
+ cancelText: '取消',
|
|
|
+ content: `${commitStatus == '1' ? '取消提交' : '提交'}当前选择的核算单元的数据?`,
|
|
|
+ onOk: async () => {
|
|
|
+ const resp = await commitRequest({
|
|
|
computeDate: currentComputeDate as string,
|
|
|
- auditType: currentUnitAuditType == '1' ? '0' : '1', //1 审核 0 取消审核
|
|
|
unitCode: currentSelectedTreeNode.code,
|
|
|
- type: ifCheckCommit
|
|
|
- });
|
|
|
- if (resp) {
|
|
|
- message.success('操作成功!');
|
|
|
- getTreeReqFunc(currentComputeDate as string, ifCheckPage ? '1' : '0');
|
|
|
- getCurrentUnitCheckStatus();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (type == 2) {
|
|
|
- const resp = await checkRequest({
|
|
|
- computeDate: currentComputeDate as string,
|
|
|
- auditType: auditType == '1' ? '0' : '1', //1 审核 0 取消审核
|
|
|
- type: ifCheckCommit
|
|
|
+ submit: commitStatus == '1' ? '0' : '1', //1 提交 0 取消
|
|
|
});
|
|
|
if (resp) {
|
|
|
- message.success('操作成功!');
|
|
|
+ message.success('提交成功!');
|
|
|
getTreeReqFunc(currentComputeDate as string, ifCheckPage ? '1' : '0');
|
|
|
- getCheckStatus(currentComputeDate as string);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (ifCheckPage && type) {
|
|
|
- const checkCondition = await getParamsData({ pageSize: 500 });
|
|
|
- if (checkCondition) {
|
|
|
- const needParamsVal = checkCondition.list.filter(a => a.code == '1664510428258115584'); //判断未提交是否可以审核
|
|
|
- if (needParamsVal.length > 0) {
|
|
|
- if (needParamsVal[0].value == '0') {
|
|
|
- handle(needParamsVal[0].value);
|
|
|
- } else {
|
|
|
- handle(needParamsVal[0].value);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
- if (commitStatus == '1') {
|
|
|
- Modal.confirm({
|
|
|
- title: '注意',
|
|
|
- okText: '确定',
|
|
|
- cancelText: '取消',
|
|
|
- content: `${commitStatus == '1' ? '取消提交' : '提交'}当前选择的核算单元的数据?`,
|
|
|
- onOk: async () => {
|
|
|
- const resp = await commitRequest({
|
|
|
- computeDate: currentComputeDate as string,
|
|
|
- unitCode: currentSelectedTreeNode.code,
|
|
|
- type: commitStatus == '1' ? '0' : '1', //1 提交 0 取消
|
|
|
- });
|
|
|
- if (resp) {
|
|
|
- message.success('提交成功!');
|
|
|
- getTreeReqFunc(currentComputeDate as string, ifCheckPage ? '1' : '0');
|
|
|
- getCurrentCommitStatus();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
- } else {
|
|
|
-
|
|
|
- if (pageData.leftTotal != 0) {
|
|
|
- Modal.confirm({
|
|
|
- title: '提交时需有单元的剩余分配金额必须是0',
|
|
|
- okText: '确定',
|
|
|
- cancelText: '取消',
|
|
|
- })
|
|
|
- } else {
|
|
|
- Modal.confirm({
|
|
|
- title: '注意',
|
|
|
- okText: '确定',
|
|
|
- cancelText: '取消',
|
|
|
- content: `${commitStatus == '1' ? '取消提交' : '提交'}当前选择的核算单元的数据?`,
|
|
|
- onOk: async () => {
|
|
|
- const resp = await commitRequest({
|
|
|
- computeDate: currentComputeDate as string,
|
|
|
- unitCode: currentSelectedTreeNode.code,
|
|
|
- type: commitStatus == '1' ? '0' : '1', //1 提交 0 取消
|
|
|
- });
|
|
|
- if (resp) {
|
|
|
- message.success('提交成功!');
|
|
|
- getTreeReqFunc(currentComputeDate as string, ifCheckPage ? '1' : '0');
|
|
|
- getCurrentCommitStatus();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
+ getCurrentCommitStatus();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
|
|
@@ -604,8 +675,8 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
- generateList(treeData as any);
|
|
|
|
|
|
+ generateList(treeData as any);
|
|
|
|
|
|
const getTreeReqFunc = async (computeDate: string, type: string) => {
|
|
|
const resp = await getTreeData(computeDate, type);
|
|
@@ -629,22 +700,20 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
}, 0)
|
|
|
}
|
|
|
|
|
|
- const getDataByBtn = async () => { //获取按钮获取数据
|
|
|
- const resp = await getData(currentComputeDate as string, currentSelectedTreeNode.code);
|
|
|
- if (resp) {
|
|
|
- message.success('数据获取成功!');
|
|
|
- tableRef.current?.reload();
|
|
|
- }
|
|
|
+ const getData = async () => { //获取按钮获取数据
|
|
|
+ const resp = await getDataByBtn(currentComputeDate as string, currentSelectedTreeNode.code);
|
|
|
+ message.success('数据获取成功!');
|
|
|
+ getTableData({});
|
|
|
|
|
|
}
|
|
|
|
|
|
const saveHandle = async () => {
|
|
|
-
|
|
|
+
|
|
|
const resp = await save({
|
|
|
- computeDate:currentComputeDate,
|
|
|
- unitCode:currentSelectedTreeNode.code,
|
|
|
- unitName:currentSelectedTreeNode.name,
|
|
|
- itemData:needSaveData.secondValueVos
|
|
|
+ computeDate: currentComputeDate,
|
|
|
+ unitCode: currentSelectedTreeNode.code,
|
|
|
+ unitName: currentSelectedTreeNode.name,
|
|
|
+ itemData: needSaveData.secondValueVos
|
|
|
});
|
|
|
if (resp) {
|
|
|
message.success('操作成功!');
|
|
@@ -665,7 +734,6 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
|
|
|
if (currentComputeDate) {
|
|
|
getTreeReqFunc(currentComputeDate, ifCheckPage ? '1' : '0');
|
|
|
- getCheckStatus(currentComputeDate);
|
|
|
getJiezhuanStatusHandle();
|
|
|
|
|
|
}
|
|
@@ -675,14 +743,7 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
//tableRef.current?.reload();
|
|
|
|
|
|
if (currentComputeDate && currentSelectedTreeNode) {
|
|
|
-
|
|
|
- if (!ifCheckPage) {
|
|
|
- getCurrentCommitStatus();
|
|
|
- }
|
|
|
- if (ifCheckPage) {
|
|
|
- getCurrentUnitCheckStatus();
|
|
|
- }
|
|
|
-
|
|
|
+ getCurrentCommitStatus();
|
|
|
getTableData({});
|
|
|
}
|
|
|
|
|
@@ -748,8 +809,6 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
// });
|
|
|
// set_inputsRefKeys(keys);
|
|
|
|
|
|
- console.log({inputsRefKeys});
|
|
|
-
|
|
|
}
|
|
|
|
|
|
if (needSaveData) {
|
|
@@ -769,7 +828,7 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
}, [ifEditMode]);
|
|
|
|
|
|
useEffect(() => {
|
|
|
- console.log({inputsRefKeys,inputsRef})
|
|
|
+ console.log({ inputsRefKeys, inputsRef })
|
|
|
// if (ifEditMode && Object.keys(inputsRef.current).length > 0 && inputsRefKeys.length > 0) {
|
|
|
|
|
|
// inputsRef.current[`${inputsRefKeys[0]}`].focus();
|
|
@@ -792,6 +851,20 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
return (
|
|
|
|
|
|
<div className='UnitCheckProjectScore'>
|
|
|
+
|
|
|
+ <ModalForm title={`选择属于本单元的记录(${currentSelectedTreeNode?.name})`} width={600} submitter={{
|
|
|
+ render: (props, defaultDoms) => []
|
|
|
+ }} open={ifShowModal} modalProps={{
|
|
|
+ closable: false,
|
|
|
+ }}>
|
|
|
+ <TableSelecter
|
|
|
+ ref={tableSelecterRef}
|
|
|
+ record={undefined}
|
|
|
+ tableSelecterColumn={tableSelecterColumn}
|
|
|
+ ></TableSelecter>
|
|
|
+ </ModalForm>
|
|
|
+
|
|
|
+
|
|
|
{
|
|
|
treeFilterVisible && (
|
|
|
<div className='selecterList'>
|
|
@@ -883,11 +956,17 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
<div className='tableToolbar'>
|
|
|
<div className='search'>
|
|
|
<span className='label'>检索:</span>
|
|
|
- <Input placeholder={'请输入项目名称'} allowClear
|
|
|
+ <Input placeholder={'请输入姓名'} allowClear
|
|
|
suffix={
|
|
|
<IconFont style={{ color: '#99A6BF' }} type="iconsousuo" />
|
|
|
}
|
|
|
onChange={(e) => {
|
|
|
+ if (e.target.value.length > 0) {
|
|
|
+ const result = tableData.filter((a: any) => a.Employee.indexOf(e.target.value) != -1);
|
|
|
+ set_dataSource(result);
|
|
|
+ } else {
|
|
|
+ set_dataSource(tableData);
|
|
|
+ }
|
|
|
|
|
|
}}
|
|
|
|
|
@@ -908,11 +987,11 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
onMouseEnter={() => auditType == '0' ? commitStatus == '1' ? set_ifShowTip(true) : set_ifShowTip(false) : set_ifShowTip(true)}
|
|
|
onMouseLeave={() => set_ifShowTip(false)}
|
|
|
>
|
|
|
- {!ifEditMode && <span className='compute cancel' onClick={commitStatus == '0' && auditType != '1' ? () => getDataByBtn() : () => { }}>获取</span>}
|
|
|
+ {!ifEditMode && <span className='compute cancel' onClick={commitStatus == '0' ? () => getData() : () => { }}>获取</span>}
|
|
|
{!ifEditMode && importData()}
|
|
|
- {!ifEditMode && <span className='cancel' onClick={commitStatus == '0' && auditType != '1' ? () => set_ifEditMode(true) : () => { }}>编辑</span>}
|
|
|
+ {!ifEditMode && <span className='cancel' onClick={commitStatus == '0' ? () => set_ifEditMode(true) : () => { }}>编辑</span>}
|
|
|
{ifEditMode && <span className='cancel' onClick={commitStatus == '0' ? () => set_ifEditMode(false) : () => { }}>取消</span>}
|
|
|
- {ifEditMode && <span className='editBtn' onClick={commitStatus == '0' && auditType != '1' ? () => saveHandle() : () => { }}>保存</span>}
|
|
|
+ {ifEditMode && <span className='editBtn' onClick={commitStatus == '0' ? () => saveHandle() : () => { }}>保存</span>}
|
|
|
|
|
|
</div>
|
|
|
</Popover>
|
|
@@ -920,15 +999,6 @@ const UnitCheckProjectScore: React.FC = () => {
|
|
|
</>
|
|
|
)
|
|
|
}
|
|
|
- {
|
|
|
- !ifBanAllAction && ifCheckPage && userFunctionInThispage && (userFunctionInThispage.findIndex((a: { code: string, name: string }) => a.code == 'audit') != -1) && (
|
|
|
- <>
|
|
|
- <div className={'commit gray'} onClick={() => commitBtnhandle(1)}>{currentUnitAuditType == '1' ? '取消审核单个' : '审核单个'}</div>
|
|
|
- <div className={'commit'} onClick={() => commitBtnhandle(2)}>{auditType == '1' ? '取消审核全部' : '审核全部'}</div>
|
|
|
- </>
|
|
|
- )
|
|
|
- }
|
|
|
-
|
|
|
</div>
|
|
|
|
|
|
</div>
|