Commit 9ef02f96 authored by 皮倩雯's avatar 皮倩雯

fix: '修改表字段展示逻辑,记住状态,修改消息平台界面样式'

parent 09435272
Pipeline #42731 skipped with stages
......@@ -7,7 +7,11 @@ import {
PlusSquareOutlined,
RollbackOutlined,
} from '@ant-design/icons';
import { reloadTableFields, removeFields, loadUnattachedTables } from '@/services/tablemanager/tablemanager';
import {
reloadTableFields,
removeFields,
loadUnattachedTables,
} from '@/services/tablemanager/tablemanager';
import { useHistory } from 'react-router-dom';
import FieldEditor from './fieldEditor';
import styles from './index.less';
......@@ -29,6 +33,7 @@ const AddModal = props => {
const [pramFormObj, setPramFormObj] = useState({});
const [visible, setVisible] = useState(false); // 弹窗
const [type, setType] = useState(''); // 弹窗类型
const [chooseLine, setChooseLine] = useState('');
const editor = record => {
setIsType('edit');
setIsVisible(true);
......@@ -326,12 +331,15 @@ const AddModal = props => {
};
// 返回上一级
const back = () => {
let { template, tableScroll } = props.location.state;
console.log(props.location.state);
let { template, tableScroll, keepValue } = props.location.state;
console.log(keepValue);
history.push({
pathname: '/bsmanger/base/tablemanger',
query: {
template,
tableScroll,
keepValue,
},
});
};
......@@ -343,8 +351,14 @@ const AddModal = props => {
} else {
data.splice(index, 1);
}
console.log(data);
setSelect(data);
let arr = [];
arr.push(record.key);
if (expanded === true) {
setChooseLine(arr);
} else {
setChooseLine([]);
}
};
// 附加
const add = record => {
......@@ -387,8 +401,8 @@ const AddModal = props => {
expandable={{ expandedRowRender }}
size="small"
rowKey="id"
expandedRowKeys={select.map(item => item.key)} // 展开的行
defaultExpandedRowKeys={0} // 展开的行
expandedRowKeys={chooseLine} // 展开的行
defaultExpandedRowKeys={[0]} // 展开的行
expandRowByClick
pagination={false}
scroll={{ y: 'calc(100vh - 186px)' }}
......
......@@ -36,6 +36,7 @@ import AddTablelList from './components/Field/addTable';
import AffiliateAdd from './components/Field/affiliateAdd';
import LoadGroup from './components/Field/loadGroup';
import LoadGroupNew from './components/Field/loadGroupNew';
import { ChangedEvent } from 'gojs';
const { Search } = Input;
const { Option } = Select;
const placeholder = '请输入表名';
......@@ -55,6 +56,8 @@ const TableManager = props => {
const [select, setSelect] = useState([]);
const [selectTableName, setSelectTableName] = useState('');
const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式
const [chooseLine, setChooseLine] = useState([0]);
const [keepValue, setKeepValue] = useState([0]);
useEffect(
record => {
loadTable(searchValue);
......@@ -74,11 +77,13 @@ const TableManager = props => {
console.log(props.history.location.query, 'props.history.location.query');
if (arr.length > 0 && props.history.location.query && selectTableName == '') {
console.log(234534256342);
let { tableScroll, template } = props.history.location.query;
let { tableScroll, template, keepValue } = props.history.location.query;
setSelectTableName(template);
setTimeout(() => {
document.querySelector('.ant-table-body').scrollTop = tableScroll;
}, 0);
setChooseLine(keepValue);
setKeepValue(keepValue);
}
}, [allData]);
// 附加
......@@ -132,11 +137,13 @@ const TableManager = props => {
const fieldsConfig = (record, e) => {
e.stopPropagation();
setFormObj(record);
console.log(keepValue);
history.push({
pathname: `/bsmanger/base/filedConfig/${record.tableName}`,
state: {
template: record,
tableScroll: document.querySelector('.ant-table-body').scrollTop,
keepValue: keepValue,
},
});
// setType('config');
......@@ -182,7 +189,7 @@ const TableManager = props => {
Object.keys(groupData).map((item, index) => {
newArr.push({ type: item, key: index });
});
console.log(newArr);
setAllData(groupData);
setGroupArr(newArr);
setSelect(newArr);
......@@ -360,12 +367,14 @@ const TableManager = props => {
size="small"
onRow={record => ({
onDoubleClick: event => {
console.log(keepValue);
event.stopPropagation();
history.push({
pathname: `/bsmanger/base/filedConfig/${record.tableName}`,
state: {
template: record,
tableScroll: document.querySelector('.ant-table-body').scrollTop,
keepValue: keepValue,
},
});
},
......@@ -447,7 +456,18 @@ const TableManager = props => {
data.splice(index, 1);
}
setSelect(data);
let arr = [];
arr.push(record.key);
if (expanded === true) {
setChooseLine(arr);
console.log(arr);
setKeepValue(arr);
} else {
setChooseLine([]);
setKeepValue([]);
}
};
return (
<Spin tip="loading..." spinning={treeLoading}>
<PageContainer>
......@@ -511,9 +531,9 @@ const TableManager = props => {
className="components-table-demo-nested"
columns={columns}
expandable={{ expandedRowRender }}
expandedRowKeys={select.map(item => item.key)} // 展开的行
defaultExpandedRowKeys={[0]}
expandRowByClick
// defaultExpandedRowKeys={0}
expandedRowKeys={chooseLine}
dataSource={groupArr}
scroll={{ y: 'calc(100vh - 190px)' }}
size="small"
......
......@@ -20,6 +20,7 @@ const AddModal = props => {
form.resetFields();
};
useEffect(() => {
console.log(option);
if (option) {
setTemplateName(option.filter(item => item.Type === '公众号'));
form.setFieldsValue({
......@@ -177,7 +178,7 @@ const AddModal = props => {
]}
>
<Select
style={{ width: '12rem' }}
style={{ width: '120%' }}
onChange={value => onChangeType1(value)}
placeholder="请选择模板名称"
>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment