forked from gzzfw/frontEnd/gzDyh

zhangyongtian
2024-09-13 b731548e050c727c4e05db660dfb64eabc94dbdd
gz-customerSystem/src/components/SelectObjModal/selectPerson.jsx
@@ -12,9 +12,15 @@
import { CloseOutlined } from '@ant-design/icons';
import './index.less';
import * as $$ from '../../utils/utility';
import { Modal } from '@arco-design/web-react';
import { Modal, Spin } from '@arco-design/web-react';
const { Search } = Input;
const txtMap = {
   dept: '部门',
   person: '人',
   unit: '组织'
}
// 获取人员,组织,部门数据
function getDataApi(type, searchData) {
@@ -45,7 +51,7 @@
 * onOk, // 点击确定的回调
 */
const SelectObjModal = ({ visible = false, checkKeys = [], type = 'dept', isCheckbox = false, searchData = {}, onClose, onOk, }) => {
   const nameStr = type === 'person' ? '人员' : type === 'unit' ? '组织' : '部门';
   const nameStr = txtMap[type];
   // 默认调解员查询'22_00024-4'
   const searchRole = type === 'person' ? { roleCode: '22_00024-4' } : {};
   const [data, setData] = useState([]);
@@ -54,14 +60,15 @@
   const [searchValue, setSearchValue] = useState('');
   const [autoExpandParent, setAutoExpandParent] = useState(true);
   const [dataList, setDataList] = useState([]);
   const [loading, setLoading] = useState(false);
   useEffect(() => {
      if (!visible) return;
      // 获取数据
      async function getData() {
         // global.setSpinning(true);
         setLoading(true)
         const res = await getDataApi(type, { ...searchRole, ...searchData });
         // global.setSpinning(false);
         setLoading(false)
         if (res.type) {
            setData(res.data || []);
         }
@@ -194,6 +201,7 @@
                  <Search placeholder={`查询${nameStr}名称`} onChange={(e) => handleSearch(e.target.value, dataList)} />
               </div>
               <div className="selectObjModal-left-main">
                  <Spin loading={loading} style={{ width: '100%', height: '100%' }}>
                  {data.length > 0 ? (
                     <Tree
                        checkable
@@ -215,6 +223,7 @@
                  ) : (
                     $$.MyEmpty()
                  )}
                  </Spin>
               </div>
            </div>
            <div className="selectObjModal-right">
@@ -228,7 +237,7 @@
            </div>
         </div>
         <div className="selectObjModal-footer">
            <div>已选中:{checkedKeys.keys.length}人</div>
            <div>已选中:{checkedKeys.keys.length}{txtMap[type]}</div>
            <Space size="middle">
               <Button onClick={onClose}>取消</Button>
               <Button type="primary" onClick={() => onOk && onOk(checkedKeys)}>