|
@@ -1,7 +1,7 @@
|
|
/*
|
|
/*
|
|
* @Author: your name
|
|
* @Author: your name
|
|
* @Date: 2021-07-26 10:13:13
|
|
* @Date: 2021-07-26 10:13:13
|
|
- * @LastEditTime: 2021-07-29 19:49:09
|
|
|
|
|
|
+ * @LastEditTime: 2021-08-02 19:00:33
|
|
* @LastEditors: Please set LastEditors
|
|
* @LastEditors: Please set LastEditors
|
|
* @Description: In User Settings Edit
|
|
* @Description: In User Settings Edit
|
|
* @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
|
|
* @FilePath: /TracerMethodology_PC/src/pages/UserMana/index.js
|
|
@@ -10,15 +10,15 @@
|
|
import { PlusOutlined } from '@ant-design/icons';
|
|
import { PlusOutlined } from '@ant-design/icons';
|
|
import { Button, Popconfirm, Cascader } from 'antd';
|
|
import { Button, Popconfirm, Cascader } from 'antd';
|
|
import React, { useState, useRef, useEffect } from 'react';
|
|
import React, { useState, useRef, useEffect } from 'react';
|
|
-import { useIntl, FormattedMessage } from 'umi';
|
|
|
|
|
|
+import { useIntl, FormattedMessage,useModel } from 'umi';
|
|
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
|
|
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
|
|
import ProTable from '@ant-design/pro-table';
|
|
import ProTable from '@ant-design/pro-table';
|
|
-import ProForm, { ModalForm, ProFormText, ProFormSelect,ProFormTextArea } from '@ant-design/pro-form';
|
|
|
|
|
|
+import ProForm, { ModalForm, ProFormText, ProFormSelect, ProFormTextArea } from '@ant-design/pro-form';
|
|
import UpdateForm from './updateForm';
|
|
import UpdateForm from './updateForm';
|
|
-// import CAUpload from '@/components/CAUpload';
|
|
|
|
|
|
+import CAUpload from '@/components/CAUpload';
|
|
import {
|
|
import {
|
|
getCostProjecttList, editCostProject, delCostProject,
|
|
getCostProjecttList, editCostProject, delCostProject,
|
|
- addCostProject
|
|
|
|
|
|
+ addCostProject,importExcel
|
|
} from './service';
|
|
} from './service';
|
|
|
|
|
|
const DepartmentMana = () => {
|
|
const DepartmentMana = () => {
|
|
@@ -72,12 +72,14 @@ const DepartmentMana = () => {
|
|
|
|
|
|
const [createModalVisible, handleModalVisible] = useState(false);
|
|
const [createModalVisible, handleModalVisible] = useState(false);
|
|
const [updateModalVisible, handleUpdateModalVisible] = useState(false);
|
|
const [updateModalVisible, handleUpdateModalVisible] = useState(false);
|
|
- const [cascaderOptions, setCascaderOptions] = useState([]);
|
|
|
|
|
|
+
|
|
const actionRef = useRef(); //表格
|
|
const actionRef = useRef(); //表格
|
|
const ref = useRef(); //新增表单
|
|
const ref = useRef(); //新增表单
|
|
- const [selectedCascader,setSelectedCascader] = useState(null);
|
|
|
|
const [currentRow, setCurrentRow] = useState({});
|
|
const [currentRow, setCurrentRow] = useState({});
|
|
|
|
|
|
|
|
+ const { initialState, setInitialState } = useModel('@@initialState');
|
|
|
|
+ const {currentUser:{token}} = initialState;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
*
|
|
*
|
|
* @param {Boolean} bool 弹窗展示状态
|
|
* @param {Boolean} bool 弹窗展示状态
|
|
@@ -110,6 +112,20 @@ const DepartmentMana = () => {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ //自定义上传回调
|
|
|
|
+ const customRequestCallback = async (formData)=>{
|
|
|
|
+ const resp = await importExcel({formData},{
|
|
|
|
+ // 'content-type': 'application/json'
|
|
|
|
+ 'content-type':'multipart/form-data',
|
|
|
|
+ })
|
|
|
|
+ const {status} = resp;
|
|
|
|
+ if(status==200){
|
|
|
|
+ if (actionRef.current) {
|
|
|
|
+ actionRef.current.reload();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
@@ -129,7 +145,14 @@ const DepartmentMana = () => {
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
新增
|
|
新增
|
|
- </Button>
|
|
|
|
|
|
+ </Button>,
|
|
|
|
+ <CAUpload
|
|
|
|
+ templateHref={'/costAccount/excel/getImportProductTemplate'}
|
|
|
|
+ url='/costAccount/excel/importProduct'
|
|
|
|
+ importSuccessCallback={() => { }}
|
|
|
|
+ token={token}
|
|
|
|
+ customRequestCallback={customRequestCallback}
|
|
|
|
+ />
|
|
]}
|
|
]}
|
|
pagination={{
|
|
pagination={{
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
@@ -154,7 +177,7 @@ const DepartmentMana = () => {
|
|
handleModalVisible(bool);
|
|
handleModalVisible(bool);
|
|
}}
|
|
}}
|
|
onFinish={async (value) => {
|
|
onFinish={async (value) => {
|
|
-
|
|
|
|
|
|
+
|
|
const success = await addCostProject(value);
|
|
const success = await addCostProject(value);
|
|
// console.log({ success });
|
|
// console.log({ success });
|
|
if (success) {
|
|
if (success) {
|
|
@@ -192,7 +215,7 @@ const DepartmentMana = () => {
|
|
width="sm"
|
|
width="sm"
|
|
name="productName"
|
|
name="productName"
|
|
/>
|
|
/>
|
|
-
|
|
|
|
|
|
+
|
|
</ModalForm>
|
|
</ModalForm>
|
|
|
|
|
|
{/* 更新 */}
|
|
{/* 更新 */}
|