Commit 41eb0505 authored by 皮倩雯's avatar 皮倩雯

fix: '修改台账管理新增编辑分组可以选的全部的bug'

parent 13f218bc
Pipeline #50872 skipped with stages
/* eslint-disable no-lonely-if */
/* eslint-disable no-else-return */ /* eslint-disable no-else-return */
/* eslint-disable prefer-promise-reject-errors */ /* eslint-disable prefer-promise-reject-errors */
/* eslint-disable camelcase */ /* eslint-disable camelcase */
...@@ -21,7 +22,9 @@ const BookConfig = props => { ...@@ -21,7 +22,9 @@ const BookConfig = props => {
formObj, formObj,
visible, visible,
tableData, tableData,
pickItem1,
onCancel, onCancel,
data,
maxLength, maxLength,
keepTableData, keepTableData,
} = props; } = props;
...@@ -89,6 +92,8 @@ const BookConfig = props => { ...@@ -89,6 +92,8 @@ const BookConfig = props => {
}); });
}; };
useEffect(() => { useEffect(() => {
console.log(pickItem1);
console.log(data[0]);
if (visible) { if (visible) {
// 获取台账表 // 获取台账表
getTableData(); getTableData();
...@@ -100,6 +105,12 @@ const BookConfig = props => { ...@@ -100,6 +105,12 @@ const BookConfig = props => {
changTable(res.data.root.TableName); changTable(res.data.root.TableName);
} }
}); });
} else {
if (!pickItem1 || pickItem1 == '全部') {
form.setFieldsValue({ Type: data[0] });
} else {
form.setFieldsValue({ Type: pickItem1 });
}
} }
} else { } else {
setFiled({}); setFiled({});
...@@ -253,7 +264,7 @@ const BookConfig = props => { ...@@ -253,7 +264,7 @@ const BookConfig = props => {
placeholder="请输入分组名称" placeholder="请输入分组名称"
allowClear allowClear
> >
{tableData.map((item, index) => ( {data.map((item, index) => (
<Option value={item} key={index}> <Option value={item} key={index}>
{item} {item}
</Option> </Option>
......
...@@ -48,6 +48,7 @@ const StandingBook = props => { ...@@ -48,6 +48,7 @@ const StandingBook = props => {
const [searchFlag, setSearchFlag] = useState(0); const [searchFlag, setSearchFlag] = useState(0);
const [currentPage, setCurrentPage] = useState(1); const [currentPage, setCurrentPage] = useState(1);
const [currentPageSize, setCurrentPageSize] = useState(20); const [currentPageSize, setCurrentPageSize] = useState(20);
const [data, setData] = useState([]);
const { Item } = Form; const { Item } = Form;
const { Search } = Input; const { Search } = Input;
...@@ -179,9 +180,11 @@ const StandingBook = props => { ...@@ -179,9 +180,11 @@ const StandingBook = props => {
setMaxLength(res.data.root.length + 1); setMaxLength(res.data.root.length + 1);
let arr = formateArrDataA(res.data.root, 'type'); let arr = formateArrDataA(res.data.root, 'type');
let newArr = []; let newArr = [];
let dataList = [];
newArr.push('全部'); newArr.push('全部');
Object.keys(arr).map((item, index) => { Object.keys(arr).map((item, index) => {
newArr.push(item); newArr.push(item);
dataList.push(item);
}); });
console.log(arr); console.log(arr);
arr.全部 = res.data.root; arr.全部 = res.data.root;
...@@ -195,6 +198,7 @@ const StandingBook = props => { ...@@ -195,6 +198,7 @@ const StandingBook = props => {
console.log(newArr, 'newArr'); console.log(newArr, 'newArr');
// newArr.push('全部'); // newArr.push('全部');
setTableData(newArr); setTableData(newArr);
setData(dataList);
if (searchFlag === 1) { if (searchFlag === 1) {
onSearch(); onSearch();
} }
...@@ -495,6 +499,8 @@ const StandingBook = props => { ...@@ -495,6 +499,8 @@ const StandingBook = props => {
<AddModal <AddModal
visible={isVisible} visible={isVisible}
type={isType} type={isType}
data={data}
pickItem1={pickItem}
formObj={formObj} formObj={formObj}
maxLength={maxLength} maxLength={maxLength}
callBackSubmit={onSubmit} callBackSubmit={onSubmit}
......
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