唐简:提交新分支

This commit is contained in:
Jim__TT
2023-11-20 21:24:43 +08:00
parent c1ae6a9e31
commit f6889ac3df
12 changed files with 2090 additions and 137 deletions

View File

@@ -71,7 +71,6 @@ const fieldNames = {
let thisrole: any = {};
let treeIds: number[] = [];
export default function Role() {
const { confirm } = Modal;
const { RangePicker } = DatePicker;
//提示组件
@@ -94,7 +93,6 @@ export default function Role() {
const [expandedKeys, setExpandedKeys] = useState<React.Key[]>([]);
const [checkedKeys, setCheckedKeys] = useState<React.Key[]>([]);
const [selectedKeys, setSelectedKeys] = useState<React.Key[]>([]);
const [autoExpandParent, setAutoExpandParent] = useState<boolean>(true);
//Modal
const [isModalOpen, setIsModalOpen] = useState(false);
const [modalTitle, setModalTitle] = useState("");
@@ -194,11 +192,10 @@ export default function Role() {
pageNum: undefined,
pageSize: undefined,
});
const [allChecked,setAllChecked]=useState(false)
const [allChecked, setAllChecked] = useState(false);
const onTreeExpand = (expandedKeysValue: React.Key[]) => {
// console.log("onExpand", expandedKeysValue);
setExpandedKeys(expandedKeysValue);
setAutoExpandParent(false);
};
const onCheckExpand = (e: CheckboxChangeEvent) => {
console.log(`checked = ${e.target.checked}`);
@@ -209,7 +206,7 @@ export default function Role() {
};
const onCheckAll = (e: CheckboxChangeEvent) => {
console.log(`checked = ${e.target.checked}`);
setAllChecked(!allChecked)
setAllChecked(!allChecked);
if (!allChecked) setCheckedKeys(treeIds);
else setCheckedKeys([]);
};
@@ -220,13 +217,12 @@ export default function Role() {
const onTreeCheck = (checkedKeysValue: any) => {
// console.log("onCheck", checkedKeysValue.checked);
console.log("onCheck", checkedKeysValue);
console.log('treeIds',treeIds);
if(checkedKeysValue.length!=treeIds.length){
setAllChecked(false)
}
else {
setAllChecked(true)
console.log("treeIds", treeIds);
if (checkedKeysValue.length != treeIds.length) {
setAllChecked(false);
} else {
setAllChecked(true);
}
if (checkStrictly === false) {
form.setFieldsValue({ menuIds: checkedKeysValue });
@@ -269,19 +265,19 @@ export default function Role() {
};
const handleSerach = () => {
searchValue = formSearch.getFieldsValue();
if (typeof searchValue.dateTime !== "undefined") {
searchValue.startTime = (searchValue.dateTime as string[])[0];
searchValue.endTime = (searchValue.dateTime as string[])[1];
}
setSearchValue(searchValue)
}
setSearchValue(searchValue);
count = 1;
setQueryTableDataParams({ ...searchValue });
};
const handleReset = () => {
formSearch.resetFields();
searchValue =formSearch.getFieldsValue()
setSearchValue(searchValue)
searchValue = formSearch.getFieldsValue();
setSearchValue(searchValue);
setQueryTableDataParams({ ...searchValue });
// setSearchValue({ ...searchValue });
// setCount(1)
@@ -336,7 +332,7 @@ export default function Role() {
searchValue.startTime = dateString[0];
searchValue.endTime = dateString[1];
formSearch.setFieldsValue({ dateTime: [dateString[0], dateString[1]] });
setSearchValue(searchValue)
setSearchValue(searchValue);
// setSearchValue({ ...searchValue })
};
const filterOption = (
@@ -515,29 +511,35 @@ export default function Role() {
return (
<ConfigProvider locale={zh_CN}>
<div className="roleBox">
<Form
layout="inline"
initialValues={undefined}
form={formSearch}
onFinish={handleSerach}
style={{fontWeight:'700'}}
style={{ fontWeight: "700" }}
>
<Form.Item label="角色名称" name="roleName" style={{width:300+'px',marginTop:'10px'}}>
<Input
placeholder="请输入角色名称"
allowClear
/>
<Form.Item
label="角色名称"
name="roleName"
style={{ width: 300 + "px", marginTop: "10px" }}
>
<Input placeholder="请输入角色名称" allowClear />
</Form.Item>
<Form.Item label="权限字符" name="roleKey" style={{width:300+'px',marginTop:'10px'}}>
<Input
allowClear
placeholder="请输入权限字符"
/>
<Form.Item
label="权限字符"
name="roleKey"
style={{ width: 300 + "px", marginTop: "10px" }}
>
<Input allowClear placeholder="请输入权限字符" />
</Form.Item>
<Form.Item label="状态:" name="state" wrapperCol={{ span: 22 }} style={{marginTop:'10px'}}>
<Form.Item
label="状态:"
name="state"
wrapperCol={{ span: 22 }}
style={{ marginTop: "10px" }}
>
<Select
style={{ width: 300 + "px" ,textAlign:"left"}}
style={{ width: 300 + "px", textAlign: "left" }}
allowClear
showSearch
placeholder="请选择角色状态"
@@ -558,8 +560,12 @@ export default function Role() {
]}
/>
</Form.Item>
<Form.Item label="登陆时间" name="dateTime" style={{marginTop:'10px'}}>
<Space direction="vertical" style={{width:400+'px'}}>
<Form.Item
label="登陆时间"
name="dateTime"
style={{ marginTop: "10px" }}
>
<Space direction="vertical" style={{ width: 400 + "px" }}>
<RangePicker
locale={dataLocale}
showTime
@@ -568,18 +574,18 @@ export default function Role() {
/>
</Space>
</Form.Item>
<Form.Item style={{marginTop:'10px'}}>
<Form.Item style={{ marginTop: "10px" }}>
<Button
type="primary"
htmlType="submit"
style={{marginLeft:20+'px'}}
style={{ marginLeft: 20 + "px" }}
onClick={() => handleSerach()}
>
<SearchOutlined />
</Button>
</Form.Item>
<Form.Item style={{marginTop:'10px'}}>
<Form.Item style={{ marginTop: "10px" }}>
<Button onClick={() => handleReset()}>
<SyncOutlined />
@@ -660,10 +666,15 @@ export default function Role() {
{/* <input type="text" /> */}
<div className="checkBox">
<Checkbox onChange={onCheckExpand}></Checkbox>
<Checkbox onChange={onCheckAll} checked={allChecked}></Checkbox>
<Checkbox onChange={onCheckAll} checked={allChecked}>
</Checkbox>
<Checkbox onChange={onCheckFaSon}></Checkbox>
</div>
<div className="myTree" style={{maxHeight:'250px',overflowY:"auto"}}>
<div
className="myTree"
style={{ maxHeight: "250px", overflowY: "auto" }}
>
<Tree
fieldNames={fieldNames}
checkable