|
@@ -1,27 +1,31 @@
|
|
|
/*
|
|
|
* @Author: your name
|
|
|
* @Date: 2021-07-26 10:13:13
|
|
|
- * @LastEditTime: 2021-08-03 17:10:11
|
|
|
+ * @LastEditTime: 2021-08-20 11:05:55
|
|
|
* @LastEditors: Please set LastEditors
|
|
|
* @Description: In User Settings Edit
|
|
|
* @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
|
|
|
*/
|
|
|
|
|
|
import { PlusOutlined } from '@ant-design/icons';
|
|
|
-import { Button, Popconfirm, Cascader} from 'antd';
|
|
|
+import { Button, Popconfirm,Tag } from 'antd';
|
|
|
import React, { useState, useRef, useEffect } from 'react';
|
|
|
-import { PageContainer} from '@ant-design/pro-layout';
|
|
|
+import { PageContainer } from '@ant-design/pro-layout';
|
|
|
import ProTable from '@ant-design/pro-table';
|
|
|
-import ProForm, { ModalForm, DrawerForm, ProFormSelect, ProFormTextArea, ProFormDigit } from '@ant-design/pro-form';
|
|
|
+import ProForm, { ModalForm, DrawerForm, ProFormSelect, ProFormTextArea, ProFormDigit, ProFormText } from '@ant-design/pro-form';
|
|
|
import UpdateForm from './updateForm';
|
|
|
import UpdateFormDrawer from './updateForm_drawer';
|
|
|
// import CAUpload from '@/components/CAUpload';
|
|
|
+import DrawerContent from './selectCopyDrawer';
|
|
|
+import { getAccountingSubjectList } from '../accountingSubject/service';
|
|
|
import {
|
|
|
getCostshareparamConnectList, editCostshareparamConnectList, delCostshareparamConnect,
|
|
|
addCostshareparamConnect, getResponsibilityCenterSelecterList, getAccountingSubjectForSelecter,
|
|
|
- getHasSetParamsList, getParamsSelectableList, saveParamsList
|
|
|
+ getHasSetParamsList, getParamsSelectableList, saveParamsList, copyParamsList,getCopyableToList
|
|
|
} from './service';
|
|
|
|
|
|
+import {deepGetAllParents} from '@/utils';
|
|
|
+
|
|
|
|
|
|
const DepartmentMana = () => {
|
|
|
const columns = [
|
|
@@ -43,19 +47,29 @@ const DepartmentMana = () => {
|
|
|
dataIndex: 'responsibilityName',
|
|
|
key: 'responsibilityName',
|
|
|
hideInSearch: false,
|
|
|
+ render:(_,record) => {
|
|
|
+ const {isShareCost,responsibilityName} = record;
|
|
|
+ return isShareCost==1?<Tag color="default">{`${responsibilityName}(含)`}</Tag>:`${responsibilityName}`
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
- title: '成本项目名称',
|
|
|
- dataIndex: 'accountingName',
|
|
|
+ title: '会计科目名称',
|
|
|
+ dataIndex: 'accountingNames',
|
|
|
key: 'accountingName',
|
|
|
hideInSearch: true,
|
|
|
},
|
|
|
{
|
|
|
- title: '成本项目编码',
|
|
|
- dataIndex: 'accountingCode',
|
|
|
+ title: '会计科目编码',
|
|
|
+ dataIndex: 'accountingCodes',
|
|
|
key: 'accountingCode',
|
|
|
hideInSearch: true,
|
|
|
},
|
|
|
+ {
|
|
|
+ title: '别名',
|
|
|
+ dataIndex: 'alias',
|
|
|
+ key: 'alias',
|
|
|
+ hideInSearch: true,
|
|
|
+ },
|
|
|
{
|
|
|
title: '备注',
|
|
|
dataIndex: 'costNode',
|
|
@@ -63,7 +77,7 @@ const DepartmentMana = () => {
|
|
|
hideInSearch: true,
|
|
|
},
|
|
|
{
|
|
|
- title:'操作',
|
|
|
+ title: '操作',
|
|
|
dataIndex: 'option',
|
|
|
valueType: 'option',
|
|
|
render: (_, record) => [
|
|
@@ -77,9 +91,20 @@ const DepartmentMana = () => {
|
|
|
>
|
|
|
分摊参数设置
|
|
|
</a>,
|
|
|
+ <a
|
|
|
+ key="config1"
|
|
|
+ onClick={() => {
|
|
|
+ setCurrentRow(record);
|
|
|
+ setDrawerType(1);
|
|
|
+ setCopySelectDrawerVisible(true);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 复制
|
|
|
+ </a>,
|
|
|
<a
|
|
|
key="config2"
|
|
|
onClick={() => {
|
|
|
+ setEdit(true);
|
|
|
handleUpdateModalVisible(true);
|
|
|
setCurrentRow(record);
|
|
|
}}
|
|
@@ -121,7 +146,7 @@ const DepartmentMana = () => {
|
|
|
hideInSearch: false,
|
|
|
},
|
|
|
{
|
|
|
- title:'操作',
|
|
|
+ title: '操作',
|
|
|
dataIndex: 'option',
|
|
|
valueType: 'option',
|
|
|
render: (_, record) => [
|
|
@@ -149,16 +174,55 @@ const DepartmentMana = () => {
|
|
|
|
|
|
];
|
|
|
|
|
|
+
|
|
|
+ const responsibilityColumns = [
|
|
|
+ {
|
|
|
+ title: '责任中心Id',
|
|
|
+ dataIndex: 'id',
|
|
|
+ key: 'id',
|
|
|
+ hideInSearch: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '责任中心名',
|
|
|
+ dataIndex: 'responsibilityName',
|
|
|
+ key: 'responsibilityName',
|
|
|
+ hideInSearch: false,
|
|
|
+ }
|
|
|
+ ]
|
|
|
+
|
|
|
+ const accountSubjectColumns = [
|
|
|
+ {
|
|
|
+ title: '会计科目Id',
|
|
|
+ dataIndex: 'id',
|
|
|
+ key: 'id',
|
|
|
+ hideInSearch: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '会计科目名名',
|
|
|
+ dataIndex: 'accountingName',
|
|
|
+ key: 'accountingName',
|
|
|
+ hideInSearch: false,
|
|
|
+ }
|
|
|
+ ]
|
|
|
+
|
|
|
const [createModalVisible, handleModalVisible] = useState(false);
|
|
|
const [updateModalVisible, handleUpdateModalVisible] = useState(false);
|
|
|
const [cascaderOptions, setCascaderOptions] = useState([]);
|
|
|
const actionRef = useRef(); //表格
|
|
|
const ref = useRef(); //新增表单
|
|
|
const [currentResponsibilityRow, setCurrentResponsibilityRow] = useState({});
|
|
|
- const [selectedCascader, setSelectedCascader] = useState(null);
|
|
|
- const [currentRow, setCurrentRow] = useState({});
|
|
|
+
|
|
|
+ const [currentRow, setCurrentRow] = useState(undefined);
|
|
|
const [ifDisable, setIfDisable] = useState(false);
|
|
|
const [selectedResponsibilityId, setSelectedResponsibilityId] = useState(null);
|
|
|
+ const [selectedResponsibility, setSelectedResponsibility] = useState(null);
|
|
|
+
|
|
|
+ const [copySelectDrawerVisible, setCopySelectDrawerVisible] = useState(false);
|
|
|
+
|
|
|
+ const [drawerType, setDrawerType] = useState(0); //1 复制数据 2 新增选择会计科目
|
|
|
+ const [accountType, setAccountType] = useState(2); // 1 收入 2 支出
|
|
|
+
|
|
|
+ const [edit,setEdit] = useState(false);
|
|
|
|
|
|
|
|
|
const drawerFormRef = useRef(); //DrawerForm
|
|
@@ -170,7 +234,12 @@ const DepartmentMana = () => {
|
|
|
const [selectedParam, setSelectedParam] = useState(null);
|
|
|
const [newAddParamList, setNewAddParamList] = useState([]);
|
|
|
|
|
|
- const [drawerUpdateModalVisible,setDrawerUpdateModalVisible] = useState(false);
|
|
|
+ const [drawerUpdateModalVisible, setDrawerUpdateModalVisible] = useState(false);
|
|
|
+
|
|
|
+ const [expandedRowKeys,setexpandedRowKeys] = useState([]);
|
|
|
+
|
|
|
+ const [selectedAccountSubjects,setSelectedAccountSubjects] = useState([]);
|
|
|
+ const updateFormRef = useRef();
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -182,7 +251,7 @@ const DepartmentMana = () => {
|
|
|
if (!bool) setCurrentRow(undefined);
|
|
|
};
|
|
|
|
|
|
- const drawerUpdateModalVisibleChange = (bool)=>{
|
|
|
+ const drawerUpdateModalVisibleChange = (bool) => {
|
|
|
setDrawerUpdateModalVisible(bool);
|
|
|
if (!bool) setCurrentRow(undefined);
|
|
|
}
|
|
@@ -214,25 +283,17 @@ const DepartmentMana = () => {
|
|
|
*
|
|
|
* @param {Object} record 表格行数据
|
|
|
*/
|
|
|
- const delParamsListHandler = (record)=>{
|
|
|
- const {id} = record;
|
|
|
- const arr = hasSetParamsList;
|
|
|
- arr.splice(arr.findIndex(item => item.id === id), 1);
|
|
|
- setHasSetParamsList([].concat(arr));
|
|
|
- if (actionDrawertableRef.current) {
|
|
|
- actionDrawertableRef.current.reload();
|
|
|
- }
|
|
|
+ const delParamsListHandler = (record) => {
|
|
|
+ const { id } = record;
|
|
|
+ const arr = hasSetParamsList;
|
|
|
+ arr.splice(arr.findIndex(item => item.id === id), 1);
|
|
|
+ setHasSetParamsList([].concat(arr));
|
|
|
+ if (actionDrawertableRef.current) {
|
|
|
+ actionDrawertableRef.current.reload();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- //级联回调
|
|
|
|
|
|
- /**
|
|
|
- *
|
|
|
- * @param {Object} value
|
|
|
- */
|
|
|
- const cascaderChangeHandle = (value) => {
|
|
|
- setSelectedCascader(value[value.length - 1]);
|
|
|
- }
|
|
|
//分摊参数回调
|
|
|
/**
|
|
|
*
|
|
@@ -247,7 +308,7 @@ const DepartmentMana = () => {
|
|
|
const { data, msg, status } = resp;
|
|
|
// console.log({data, msg, status});
|
|
|
if (status == 200) {
|
|
|
- setHasSetParamsList(data?data:[]);
|
|
|
+ setHasSetParamsList(data ? data : []);
|
|
|
|
|
|
if (actionDrawertableRef.current) {
|
|
|
actionDrawertableRef.current.reload();
|
|
@@ -256,7 +317,7 @@ const DepartmentMana = () => {
|
|
|
}
|
|
|
setDrawerVisible(bool);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
*
|
|
@@ -267,6 +328,47 @@ const DepartmentMana = () => {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ const getCopyableTableList = async () => {
|
|
|
+ const {id:accountShareId} = currentRow;
|
|
|
+ const resp = await getCopyableToList({accountShareId});
|
|
|
+ const { status, data} = resp;
|
|
|
+ if (status == 200) {
|
|
|
+ return {
|
|
|
+ data: data,
|
|
|
+ total:data.length ,
|
|
|
+ success: true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const getAccountingSubjects = async (params = {}, sort, filter) => {
|
|
|
+ const resp = await getAccountingSubjectList({...params,accountType });
|
|
|
+ const { status, data: { list, totalCount } } = resp;
|
|
|
+
|
|
|
+ let accountingIdList=undefined;
|
|
|
+
|
|
|
+ currentRow&&(accountingIdList = currentRow.accountingIdList)
|
|
|
+
|
|
|
+ const defaultSelected = accountingIdList?accountingIdList.map(item=>Number(item)):[];
|
|
|
+ // console.log({defaultSelected});
|
|
|
+ setSelectedAccountSubjects(defaultSelected);
|
|
|
+ const allParents = deepGetAllParents(list,'children');
|
|
|
+ const ids = allParents.map(item=>item.id);
|
|
|
+ setexpandedRowKeys(ids);
|
|
|
+ if (status == 200) {
|
|
|
+ return {
|
|
|
+ data: list,
|
|
|
+ total: totalCount,
|
|
|
+ success: true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const selectAccountSubjecthandle = () => {
|
|
|
+ setDrawerType(2);
|
|
|
+ setCopySelectDrawerVisible(true);
|
|
|
+ }
|
|
|
+
|
|
|
useEffect(async () => {
|
|
|
const respForSelecter = await getAccountingSubjectForSelecter();
|
|
|
if (respForSelecter.status == 200) {
|
|
@@ -287,6 +389,7 @@ const DepartmentMana = () => {
|
|
|
icon={<PlusOutlined />}
|
|
|
type="primary"
|
|
|
onClick={() => {
|
|
|
+ setEdit(false);
|
|
|
handleModalVisible(true);
|
|
|
}}
|
|
|
>
|
|
@@ -311,22 +414,26 @@ const DepartmentMana = () => {
|
|
|
formRef={ref}
|
|
|
onVisibleChange={(bool) => {
|
|
|
if (ref.current) {
|
|
|
+ setIfDisable(false);
|
|
|
ref.current.resetFields();
|
|
|
}
|
|
|
handleModalVisible(bool);
|
|
|
}}
|
|
|
onFinish={async (value) => {
|
|
|
- const { costNode } = value;
|
|
|
+ // console.log({value});
|
|
|
+ const { costNode,isShareCost=1,alias} = value;
|
|
|
+ const { accountingIds } = ref.current.getFieldsValue(true);
|
|
|
+ const { responsibilityCode, responsibilityId, responsibilityName, shareLevel } = selectedResponsibility;
|
|
|
+
|
|
|
const success = await addCostshareparamConnect({
|
|
|
responsibilityId: selectedResponsibilityId,
|
|
|
- accountingId: selectedCascader > 0 ? selectedCascader : 0,
|
|
|
- costNode
|
|
|
-
|
|
|
+ accountingIds: accountingIds,isShareCost,alias,
|
|
|
+ costNode, responsibilityName, shareLevel, responsibilityCode
|
|
|
});
|
|
|
// console.log({ success });
|
|
|
if (success) {
|
|
|
handleModalVisible(false);
|
|
|
-
|
|
|
+
|
|
|
if (actionRef.current) {
|
|
|
actionRef.current.reload();
|
|
|
}
|
|
@@ -337,7 +444,7 @@ const DepartmentMana = () => {
|
|
|
rules={[
|
|
|
{
|
|
|
required: true,
|
|
|
- message:'请选择责任中心',
|
|
|
+ message: '请选择责任中心',
|
|
|
},
|
|
|
]}
|
|
|
fieldProps={{//这里使用了select的onChange方法,必须使用这样的写法来进行调用onChange方法
|
|
@@ -347,10 +454,11 @@ const DepartmentMana = () => {
|
|
|
const { data, msg, status } = resp;
|
|
|
if (status == 200) {
|
|
|
const selected = data.filter(item => item.id == val);
|
|
|
- if (selected && selected[0].calcType == 0) {
|
|
|
- setIfDisable(true);
|
|
|
- } else {
|
|
|
+ setSelectedResponsibility(selected[0]);
|
|
|
+ if (selected && selected[0].calcType == 1) {
|
|
|
setIfDisable(false);
|
|
|
+ } else {
|
|
|
+ setIfDisable(true);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -369,11 +477,42 @@ const DepartmentMana = () => {
|
|
|
name="responsibilityId"
|
|
|
label="请选择责任中心"
|
|
|
/>
|
|
|
- <ProForm.Group style={{ marginBottom: 20 }}>
|
|
|
- <div style={{ marginLeft: 115 }}>请选择成本科目:</div>
|
|
|
- <Cascader disabled={ifDisable} options={cascaderOptions} onChange={cascaderChangeHandle} placeholder="请选择成本科目" />
|
|
|
- </ProForm.Group>
|
|
|
-
|
|
|
+ <ProFormText
|
|
|
+ disabled={ifDisable}
|
|
|
+ rules={[
|
|
|
+ {
|
|
|
+ required: ifDisable?false:true,
|
|
|
+ message: '请选择会计科目',
|
|
|
+ },
|
|
|
+ ]}
|
|
|
+ fieldProps={{
|
|
|
+ onClick: () => selectAccountSubjecthandle()
|
|
|
+ }}
|
|
|
+ width="sm"
|
|
|
+ name="accountingName"
|
|
|
+ label="选择会计科目"
|
|
|
+ />
|
|
|
+ <ProFormSelect
|
|
|
+ disabled={ifDisable}
|
|
|
+ rules={[
|
|
|
+ {
|
|
|
+ required: ifDisable?false:true,
|
|
|
+ message: '请选择',
|
|
|
+ },
|
|
|
+ ]}
|
|
|
+ width="sm"
|
|
|
+ request={async () => [
|
|
|
+ { label: '不包含分摊成本', value: 0 },
|
|
|
+ { label: '包含分摊成本', value: 1 }
|
|
|
+ ]}
|
|
|
+ name="isShareCost"
|
|
|
+ label="是否包含分摊成本"
|
|
|
+ />
|
|
|
+ <ProFormText
|
|
|
+ width="sm"
|
|
|
+ name="alias"
|
|
|
+ label="别名"
|
|
|
+ />
|
|
|
<ProFormTextArea
|
|
|
name="costNode"
|
|
|
label="备注"
|
|
@@ -390,27 +529,26 @@ const DepartmentMana = () => {
|
|
|
onVisibleChange={(visible) => drawerVisibleChange(visible)}
|
|
|
// onFinish={(value) => onSubmit({ ...values, ...value })}
|
|
|
onFinish={async () => {
|
|
|
- if(true){
|
|
|
+ if (true) {
|
|
|
const { id } = currentResponsibilityRow;
|
|
|
-
|
|
|
+
|
|
|
const resp = await saveParamsList({
|
|
|
id,
|
|
|
shareParamProportionVOList: hasSetParamsList
|
|
|
});
|
|
|
- const {status} = resp;
|
|
|
- if(status == 200){
|
|
|
+ const { status } = resp;
|
|
|
+ if (status == 200) {
|
|
|
setDrawerVisible(false);
|
|
|
if (actionRef.current) {
|
|
|
actionRef.current.reload();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}}
|
|
|
>
|
|
|
<ProTable
|
|
|
columns={drawerTableColumns}
|
|
|
- // request={[]}
|
|
|
rowKey="id"
|
|
|
actionRef={actionDrawertableRef}
|
|
|
toolBarRender={() => [
|
|
@@ -427,15 +565,13 @@ const DepartmentMana = () => {
|
|
|
</Button>
|
|
|
]}
|
|
|
request={async (params = {}, sort, filter) => {
|
|
|
- console.log({ hasSetParamsList });
|
|
|
+ // console.log({ hasSetParamsList });
|
|
|
return {
|
|
|
data: hasSetParamsList,
|
|
|
success: true
|
|
|
};
|
|
|
}}
|
|
|
- pagination={{
|
|
|
- pageSize: 10,
|
|
|
- }}
|
|
|
+ pagination={false}
|
|
|
search={false}
|
|
|
/>
|
|
|
<ModalForm
|
|
@@ -453,7 +589,7 @@ const DepartmentMana = () => {
|
|
|
}}
|
|
|
|
|
|
onFinish={async (value) => {
|
|
|
- console.log({ '新增分摊参数': value, selectedParam,hasSetParamsList});
|
|
|
+ // console.log({ '新增分摊参数': value, selectedParam,hasSetParamsList});
|
|
|
const { shareParamPopout } = value;
|
|
|
const { id, shareParamCode, shareParamName } = selectedParam;
|
|
|
|
|
@@ -476,7 +612,7 @@ const DepartmentMana = () => {
|
|
|
rules={[
|
|
|
{
|
|
|
required: true,
|
|
|
- message:'请选择责任中心',
|
|
|
+ message: '请选择责任中心',
|
|
|
},
|
|
|
]}
|
|
|
|
|
@@ -487,7 +623,7 @@ const DepartmentMana = () => {
|
|
|
// console.log({currentResponsibilityRow});
|
|
|
const resp = await getParamsSelectableList({ id });
|
|
|
const { data, status } = resp;
|
|
|
- console.log({resp});
|
|
|
+ // console.log({resp});
|
|
|
if (status == 200) {
|
|
|
const selected = data.list.filter(item => item.id == val);
|
|
|
console.log({ selected });
|
|
@@ -500,7 +636,7 @@ const DepartmentMana = () => {
|
|
|
const { id } = currentResponsibilityRow;
|
|
|
const resp = await getParamsSelectableList({ id });
|
|
|
const { data, status } = resp;
|
|
|
- console.log({ resp });
|
|
|
+ // console.log({ resp });
|
|
|
if (status == 200) {
|
|
|
const temp = data.list.map(item => ({
|
|
|
label: item.shareParamName,
|
|
@@ -522,17 +658,23 @@ const DepartmentMana = () => {
|
|
|
{/* 分摊更新 */}
|
|
|
<UpdateFormDrawer
|
|
|
onSubmit={async (value) => {
|
|
|
-
|
|
|
- const {id} = value;
|
|
|
- const index = hasSetParamsList.findIndex(item=>item.id == id);
|
|
|
- const temp = hasSetParamsList;
|
|
|
- temp[index] = value;
|
|
|
- console.log({value,temp});
|
|
|
- setHasSetParamsList([].concat(temp));
|
|
|
- setDrawerUpdateModalVisible(false);
|
|
|
- if (actionDrawertableRef.current) {
|
|
|
- actionDrawertableRef.current.reload();
|
|
|
- }
|
|
|
+
|
|
|
+ const {id,selectedParam} = value;
|
|
|
+ const index = hasSetParamsList.findIndex(item=>item.id == id);
|
|
|
+ let temp = hasSetParamsList;
|
|
|
+ temp[index] = value;
|
|
|
+ if(selectedParam){
|
|
|
+ //修改了分摊参数名
|
|
|
+ const {shareParamCode,shareParamName} = selectedParam;
|
|
|
+ temp[index] = {...temp[index],shareParamCode,shareParamName}
|
|
|
+ // console.log({shareParamCode,shareParamName,'temp[index]':temp[index]});
|
|
|
+ }
|
|
|
+ setHasSetParamsList([].concat(temp));
|
|
|
+ setDrawerUpdateModalVisible(false);
|
|
|
+ if (actionDrawertableRef.current) {
|
|
|
+ actionDrawertableRef.current.reload();
|
|
|
+ }
|
|
|
+
|
|
|
}}
|
|
|
onCancel={() => {
|
|
|
drawerUpdateModalVisible(false);
|
|
@@ -542,22 +684,95 @@ const DepartmentMana = () => {
|
|
|
drawerUpdateModalVisible={drawerUpdateModalVisible}
|
|
|
drawerUpdateModalVisibleChange={drawerUpdateModalVisibleChange}
|
|
|
values={currentRow || {}}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
/>
|
|
|
</DrawerForm>
|
|
|
|
|
|
|
|
|
+ {/* 选择复制抽屉 */}
|
|
|
+ {
|
|
|
+ drawerType != 0 && (
|
|
|
+ <DrawerContent
|
|
|
+ columns={drawerType == 1 ? responsibilityColumns : accountSubjectColumns}
|
|
|
+ visible={copySelectDrawerVisible}
|
|
|
+ currentRow={currentRow}
|
|
|
+ title={drawerType == 1 ? '选择复制目标' : '选择会计科目'}
|
|
|
+ defaultSelected={drawerType == 1?[]:selectedAccountSubjects}
|
|
|
+ pageContainerConfig={(tableRef) => {
|
|
|
+
|
|
|
+ return {
|
|
|
+ header: {
|
|
|
+ title: ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ onVisibleChange={(bool) => setCopySelectDrawerVisible(bool)}
|
|
|
+ renderListFunc={drawerType == 1 ? getCopyableTableList : getAccountingSubjects}
|
|
|
+ config={{ rowKeys: 'id', tableSearch: false }}
|
|
|
+ tableSearch={false}
|
|
|
+ expandable={{
|
|
|
+ expandedRowKeys:expandedRowKeys
|
|
|
+ }}
|
|
|
+ onFinishFunc={async (value, selectedRowKeys, selectedRows) => {
|
|
|
+ // console.log({ value, selectedRowKeys, selectedRows,drawerType });
|
|
|
+ if (drawerType == 1) {
|
|
|
+ const { id } = currentRow;
|
|
|
+ const resp = await copyParamsList({ id, responsibilityIds: selectedRowKeys });
|
|
|
+ const { status } = resp;
|
|
|
+ if (status == 200) {
|
|
|
+ setCurrentRow(undefined);
|
|
|
+ setCopySelectDrawerVisible(false);
|
|
|
+ if (actionRef.current) {
|
|
|
+ actionRef.current.reload();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (drawerType == 2) {
|
|
|
+
|
|
|
+ //selectedRows为空标识没有编辑
|
|
|
+ let selectedItemNames = selectedRows.map(item => item.accountingName);
|
|
|
+
|
|
|
+ if(edit){
|
|
|
+ if(selectedRows.length>0){
|
|
|
+ if (updateFormRef.current) {
|
|
|
+ updateFormRef.current.setFieldsValue({ accountingNames: selectedItemNames.join(','), accountingIds: selectedRowKeys.join(',') })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!edit){
|
|
|
+
|
|
|
+ if (ref.current) {
|
|
|
+ ref.current.setFieldsValue({ accountingName:selectedItemNames.join(','), accountingIds: selectedRowKeys.join(',') })
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ setCopySelectDrawerVisible(false);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ setDrawerType(0);
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
{/* 更新 */}
|
|
|
<UpdateForm
|
|
|
onSubmit={async (value) => {
|
|
|
- console.log({ '编辑': value });
|
|
|
- const { responsibilityId, ifDisable, accountingId, costNode, id } = value;
|
|
|
+ // console.log({ '编辑': value });
|
|
|
+ // // return;
|
|
|
+ // console.log(updateFormRef.current.getFieldsValue(true));
|
|
|
+ const { accountingIds } = updateFormRef.current.getFieldsValue(true);
|
|
|
+ const { responsibilityId,responsibilityName,responsibilityCode,shareLevel,ifDisable, costNode,alias, id,isShareCost=1 } = value;
|
|
|
|
|
|
const success = await editCostshareparamConnectList(ifDisable ? {
|
|
|
- responsibilityId, costNode, id
|
|
|
- } : { responsibilityId, accountingId, costNode, id });
|
|
|
+ responsibilityId, costNode, id,responsibilityName,responsibilityCode,shareLevel,isShareCost,alias
|
|
|
+ } : { responsibilityId,accountingIds, costNode, id,responsibilityName,responsibilityCode,shareLevel,isShareCost });
|
|
|
|
|
|
if (success) {
|
|
|
handleUpdateModalVisible(false);
|
|
@@ -567,6 +782,7 @@ const DepartmentMana = () => {
|
|
|
actionRef.current.reload();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}}
|
|
|
onCancel={() => {
|
|
|
handleUpdateModalVisible(false);
|
|
@@ -575,8 +791,8 @@ const DepartmentMana = () => {
|
|
|
updateModalVisible={updateModalVisible}
|
|
|
updateModalVisibleChange={updateModalVisibleChange}
|
|
|
values={currentRow || {}}
|
|
|
- cascaderOptions={cascaderOptions}
|
|
|
- cascaderChangeHandle={cascaderChangeHandle}
|
|
|
+ updateFormRef={updateFormRef}
|
|
|
+ selectAccountSubjecthandle={selectAccountSubjecthandle}
|
|
|
|
|
|
/>
|
|
|
</PageContainer>
|