From db8b368c5fd611732e26425c974dddd16ae09a82 Mon Sep 17 00:00:00 2001
From: liuwh <964324856@qq.com>
Date: Sat, 14 Sep 2024 10:03:22 +0800
Subject: [PATCH] 修改提交
---
gz-customerSystem/src/components/SelectObjModal/selectPerson.jsx | 61 +++++++++++++++++-------------
1 files changed, 35 insertions(+), 26 deletions(-)
diff --git a/gz-customerSystem/src/components/SelectObjModal/selectPerson.jsx b/gz-customerSystem/src/components/SelectObjModal/selectPerson.jsx
index 7f92877..ac564e7 100644
--- a/gz-customerSystem/src/components/SelectObjModal/selectPerson.jsx
+++ b/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,27 +201,29 @@
<Search placeholder={`查询${nameStr}名称`} onChange={(e) => handleSearch(e.target.value, dataList)} />
</div>
<div className="selectObjModal-left-main">
- {data.length > 0 ? (
- <Tree
- checkable
- checkStrictly
- defaultExpandAll
- onExpand={(newExpandedKeys) => {
- setExpandedKeys(newExpandedKeys);
- setAutoExpandParent(false);
- }}
- expandedKeys={expandedKeys}
- autoExpandParent={autoExpandParent}
- selectable={false}
- onCheck={(checkedKeys, e) => handleCheck(checkedKeys, e)}
- checkedKeys={checkedKeys.keys}
- treeData={treeData}
- fieldNames={{ title: 'label', key: 'value' }}
- height={400}
- />
- ) : (
- $$.MyEmpty()
- )}
+ <Spin loading={loading} style={{ width: '100%', height: '100%' }}>
+ {data.length > 0 ? (
+ <Tree
+ checkable
+ checkStrictly
+ defaultExpandAll
+ onExpand={(newExpandedKeys) => {
+ setExpandedKeys(newExpandedKeys);
+ setAutoExpandParent(false);
+ }}
+ expandedKeys={expandedKeys}
+ autoExpandParent={autoExpandParent}
+ selectable={false}
+ onCheck={(checkedKeys, e) => handleCheck(checkedKeys, e)}
+ checkedKeys={checkedKeys.keys}
+ treeData={treeData}
+ fieldNames={{ title: 'label', key: 'value' }}
+ height={400}
+ />
+ ) : (
+ $$.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)}>
--
Gitblit v1.8.0