Commit 39c16fac authored by 皮倩雯's avatar 皮倩雯

fix: '维保模板配置优化,全局分页切换'

parent ce438be4
Pipeline #75333 waiting for manual action with stages
/* eslint-disable no-else-return */
/* eslint-disable prefer-promise-reject-errors */ /* eslint-disable prefer-promise-reject-errors */
/* eslint-disable indent */ /* eslint-disable indent */
/* eslint-disable camelcase */ /* eslint-disable camelcase */
...@@ -153,6 +154,7 @@ const AddModal = props => { ...@@ -153,6 +154,7 @@ const AddModal = props => {
setType2(''); setType2('');
setFiled1({}); setFiled1({});
} else if (type === 'edit') { } else if (type === 'edit') {
onChangeFeed(formObj.feedbackName, '', JSON.parse(formObj.mappingFields));
CM_XWBPlan_DataList({ id: formObj.id }).then(res => { CM_XWBPlan_DataList({ id: formObj.id }).then(res => {
let data = res.data[0]; let data = res.data[0];
if (data.isSubmit === '是') { if (data.isSubmit === '是') {
...@@ -160,10 +162,8 @@ const AddModal = props => { ...@@ -160,10 +162,8 @@ const AddModal = props => {
} else { } else {
setAutoFlag(false); setAutoFlag(false);
} }
onChangeFeed(data.feedbackName);
setVisibleChecked(data.isSubmit === '是'); setVisibleChecked(data.isSubmit === '是');
setVisibleChecked1(data.autoAssign === '是'); setVisibleChecked1(data.autoAssign === '是');
console.log(data);
data && form.setFieldsValue({ ...data }); data && form.setFieldsValue({ ...data });
if (data.parentBusinessName) { if (data.parentBusinessName) {
form.setFieldsValue({ parentId: data.parentId }); form.setFieldsValue({ parentId: data.parentId });
...@@ -171,8 +171,6 @@ const AddModal = props => { ...@@ -171,8 +171,6 @@ const AddModal = props => {
form.setFieldsValue({ parentId: '' }); form.setFieldsValue({ parentId: '' });
} }
let mappingFields = JSON.parse(data.mappingFields); let mappingFields = JSON.parse(data.mappingFields);
getGetTaskSyncField(mappingFields); // 获取字段名数据
onChangeEvent(data.relationEvent, mappingFields); // 改变关联事件类型 onChangeEvent(data.relationEvent, mappingFields); // 改变关联事件类型
setType1(data.businessType); setType1(data.businessType);
...@@ -198,6 +196,8 @@ const AddModal = props => { ...@@ -198,6 +196,8 @@ const AddModal = props => {
getFeedbackTable(); getFeedbackTable();
}, []); }, []);
useEffect(() => {}, [keepData]);
const getParentList = () => { const getParentList = () => {
GetParentDeviceTemplate({ id: formObj.id }).then(res => { GetParentDeviceTemplate({ id: formObj.id }).then(res => {
if (res.code === 0) { if (res.code === 0) {
...@@ -239,15 +239,6 @@ const AddModal = props => { ...@@ -239,15 +239,6 @@ const AddModal = props => {
if (validate) { if (validate) {
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
let mappingFields = formAdd.getFieldValue('parmars'); let mappingFields = formAdd.getFieldValue('parmars');
// mappingFields &&
// mappingFields.forEach(i => {
// keep.forEach(j => {
// if (j === i.fromField) {
// i.fromField = j;
// }
// });
// });
mappingFields && mappingFields &&
mappingFields.forEach(i => { mappingFields.forEach(i => {
let data = i.fromField.split('%'); let data = i.fromField.split('%');
...@@ -279,10 +270,8 @@ const AddModal = props => { ...@@ -279,10 +270,8 @@ const AddModal = props => {
}); });
} }
if (type === 'edit') { if (type === 'edit') {
console.log(obj.isSubmit);
obj.isSubmit = visibleChecked === true ? '是' : '否'; obj.isSubmit = visibleChecked === true ? '是' : '否';
obj.autoAssign = visibleChecked1 === true ? '是' : '否'; obj.autoAssign = visibleChecked1 === true ? '是' : '否';
console.log(obj);
CM_XWBPlan_DataEditORAdd({ CM_XWBPlan_DataEditORAdd({
...obj, ...obj,
id: formObj.id, id: formObj.id,
...@@ -446,7 +435,6 @@ const AddModal = props => { ...@@ -446,7 +435,6 @@ const AddModal = props => {
}; };
const onOK1 = prop => { const onOK1 = prop => {
console.log(prop);
setIsVisible(false); setIsVisible(false);
let inputText = {}; let inputText = {};
inputText[prop.pickItem] = prop.str; inputText[prop.pickItem] = prop.str;
...@@ -464,13 +452,11 @@ const AddModal = props => { ...@@ -464,13 +452,11 @@ const AddModal = props => {
if (e === true) { if (e === true) {
setVisibleChecked1(false); setVisibleChecked1(false);
} }
console.log(e);
setVisibleChecked(e); setVisibleChecked(e);
setAutoFlag(e); setAutoFlag(e);
}; };
const change1 = e => { const change1 = e => {
console.log(e);
setVisibleChecked1(e); setVisibleChecked1(e);
}; };
...@@ -513,44 +499,42 @@ const AddModal = props => { ...@@ -513,44 +499,42 @@ const AddModal = props => {
}; };
// 获取字段名数据 // 获取字段名数据
const getGetTaskSyncField = e => { const getGetTaskSyncField = (e, newKeep) => {
// 编辑时处理数据为下拉框过滤调已选数据 // 编辑时初始处理数据为下拉框过滤调已选数据
let dataList = newKeep ? newKeep : keep;
if (e) { if (e) {
// 编辑时
let datalist = [...e]; let datalist = [...e];
// datalist.forEach(i => {
// keep.forEach(j => {
// if (j === i.fromField) {
// i.fromField = j;
// }
// });
// });
let arr = [];
datalist.forEach(i => {
if (i.fromTable) {
arr.push({ fromField: `${i.fromField}%${i.fromTable}`, toField: i.toField });
} else {
arr.push({ fromField: i.fromField, toField: i.toField });
}
});
formAdd.setFieldsValue({ parmars: arr }); // 处理数据让下拉框回显title值
let aa = e; let aa = e;
let from = []; let from = [];
aa.forEach(i => { aa.forEach(i => {
if (i && i.fromField) { if (i && i.fromField) {
from.push(i.fromField); from.push(`${i.fromField}%${i.fromTable}`);
} }
}); });
let lastFrom = []; let lastFrom = [];
keep.forEach(j => { dataList.forEach(j => {
if (from.indexOf(j) === -1) { if (from.indexOf(j) === -1) {
lastFrom.push(j); lastFrom.push(j);
} }
}); });
// let bb = detailData(dataList, from);
// setKeepData(lastFrom); // setKeepData(lastFrom);
// setKeep(lastFrom);
let arr = [];
datalist.forEach(i => {
if (i.fromTable) {
arr.push({ fromField: `${i.fromField}%${i.fromTable}`, toField: i.toField });
} else {
arr.push({ fromField: i.fromField, toField: i.toField });
}
});
setTimeout(() => {
formAdd.setFieldsValue({ parmars: arr }); // 处理数据让下拉框回显title值
}, 0);
} else { } else {
setKeepData(keep); setKeepData(dataList);
} }
// setKeep(res.data);
}; };
const changeValue = () => { const changeValue = () => {
...@@ -566,16 +550,15 @@ const AddModal = props => { ...@@ -566,16 +550,15 @@ const AddModal = props => {
to.push(i.toField); to.push(i.toField);
} }
}); });
let lastFrom = [];
let lastTo = []; let lastTo = [];
let lastFrom = [];
keep.forEach(j => { keep.forEach(j => {
if (from.indexOf(j) === -1) { if (from.indexOf(j) === -1) {
lastFrom.push(j); lastFrom.push(j);
} }
}); });
let bb = detailData(keep, from); // let bb = detailData(keep, from);
// setKeepData(lastFrom);
setKeepData(lastFrom);
keepAll.forEach(j => { keepAll.forEach(j => {
if (to.indexOf(j.name) === -1) { if (to.indexOf(j.name) === -1) {
lastTo.push(j); lastTo.push(j);
...@@ -597,12 +580,11 @@ const AddModal = props => { ...@@ -597,12 +580,11 @@ const AddModal = props => {
// newKeep[i.TableName].push(j); // newKeep[i.TableName].push(j);
// } // }
// } // }
if (from.indexOf(data) === -1) { if (from.indexOf(data) === -1) {
if (!newKeep[i.TableName]) { j.show = true;
newKeep[i.TableName] = [j]; } else {
} else { j.show = false;
newKeep[i.TableName].push(j);
}
} }
}); });
}); });
...@@ -611,7 +593,7 @@ const AddModal = props => { ...@@ -611,7 +593,7 @@ const AddModal = props => {
keys.forEach(item => { keys.forEach(item => {
arr.push({ TableName: item, TableFields: newKeep[item] }); arr.push({ TableName: item, TableFields: newKeep[item] });
}); });
return arr; return val;
}; };
// 改变关联事件类型 // 改变关联事件类型
...@@ -698,7 +680,7 @@ const AddModal = props => { ...@@ -698,7 +680,7 @@ const AddModal = props => {
return arr; return arr;
}; };
const onChangeFeed = val => { const onChangeFeed = (val, flag, str) => {
GetFeedbackTableFields({ feedbackName: val }).then(res => { GetFeedbackTableFields({ feedbackName: val }).then(res => {
if (res.code === 0) { if (res.code === 0) {
let newData = [res.data.DeviceData]; let newData = [res.data.DeviceData];
...@@ -707,7 +689,12 @@ const AddModal = props => { ...@@ -707,7 +689,12 @@ const AddModal = props => {
newData.push(i); newData.push(i);
}); });
setKeepData(newData); setKeepData(newData);
debugger;
setKeep(newData); setKeep(newData);
if (str) {
// 编辑初次回显处理过滤下拉款数据
getGetTaskSyncField(str, newData);
}
} }
}); });
GetAccountConfigInfo({ accountName: val }).then(res => { GetAccountConfigInfo({ accountName: val }).then(res => {
...@@ -718,6 +705,9 @@ const AddModal = props => { ...@@ -718,6 +705,9 @@ const AddModal = props => {
setFieldList(data); setFieldList(data);
} }
}); });
if (flag) {
formAdd.setFieldsValue({ parmars: [] });
}
}; };
const saveRule = e => { const saveRule = e => {
...@@ -898,7 +888,7 @@ const AddModal = props => { ...@@ -898,7 +888,7 @@ const AddModal = props => {
placeholder="请选择反馈名称" placeholder="请选择反馈名称"
showSearch showSearch
allowClear allowClear
onChange={e => onChangeFeed(e)} onChange={e => onChangeFeed(e, 1)}
> >
{filed {filed
? filed.map((item, index) => ( ? filed.map((item, index) => (
...@@ -1117,7 +1107,19 @@ const AddModal = props => { ...@@ -1117,7 +1107,19 @@ const AddModal = props => {
name={[name, 'fromField']} name={[name, 'fromField']}
fieldKey={[fieldKey, 'key']} fieldKey={[fieldKey, 'key']}
validateTrigger={['onChange', 'onBlur']} validateTrigger={['onChange', 'onBlur']}
rules={[{ required: true, message: '请填写字段名' }]} rules={[
{ required: true, message: '请填写字段名' },
{
validator: (rule, value) => {
let filterValue = formAdd.getFieldsValue().parmars;
let num = filterValue.findIndex(i => i.fromField === value);
if (num !== undefined && num !== fieldKey) {
return Promise.reject('字段重复');
}
return Promise.resolve();
},
},
]}
> >
<TreeSelect <TreeSelect
showSearch showSearch
......
...@@ -549,7 +549,7 @@ const ChangeRoles = props => { ...@@ -549,7 +549,7 @@ const ChangeRoles = props => {
showTotal={item => `共 ${item} 条`} showTotal={item => `共 ${item} 条`}
defaultPageSize={pageSize} defaultPageSize={pageSize}
defaultCurrent={1} defaultCurrent={1}
pageSizeOptions={[10, 20, 40, 100]} pageSizeOptions={[10, 20, 50, 100]}
current={currentPage} current={currentPage}
onChange={paginationChange} onChange={paginationChange}
style={{ marginBottom: '10px' }} style={{ marginBottom: '10px' }}
......
...@@ -593,7 +593,7 @@ const ChangeAddFlows = props => { ...@@ -593,7 +593,7 @@ const ChangeAddFlows = props => {
defaultCurrent={1} defaultCurrent={1}
current={currentPage} current={currentPage}
onChange={paginationChange} onChange={paginationChange}
pageSizeOptions={[10, 20, 40, 100]} pageSizeOptions={[10, 20, 50, 100]}
style={{ marginBottom: '10px' }} style={{ marginBottom: '10px' }}
size="small" size="small"
showQuickJumper showQuickJumper
......
...@@ -384,7 +384,7 @@ const OmsLog = () => { ...@@ -384,7 +384,7 @@ const OmsLog = () => {
showTotal={(aa, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`} showTotal={(aa, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`}
defaultPageSize={pageSize} defaultPageSize={pageSize}
defaultCurrent={1} defaultCurrent={1}
pageSizeOptions={[10, 20, 40, 100]} pageSizeOptions={[10, 20, 50, 100]}
current={currentPage} current={currentPage}
onChange={paginationChange} onChange={paginationChange}
size="small" size="small"
......
...@@ -500,7 +500,7 @@ const ModelFileManage = () => { ...@@ -500,7 +500,7 @@ const ModelFileManage = () => {
showTotal={(aa, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`} showTotal={(aa, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`}
defaultPageSize={pageSize} defaultPageSize={pageSize}
defaultCurrent={1} defaultCurrent={1}
pageSizeOptions={[10, 20, 40, 100]} pageSizeOptions={[10, 20, 50, 100]}
current={currentPage} current={currentPage}
onChange={paginationChange} onChange={paginationChange}
size="small" size="small"
......
...@@ -302,13 +302,14 @@ const NewSelectUser = props => { ...@@ -302,13 +302,14 @@ const NewSelectUser = props => {
total={total} total={total}
showTotal={(totals, range) => `第${range[0]}-${range[1]} 条/共 ${totals} 条`} showTotal={(totals, range) => `第${range[0]}-${range[1]} 条/共 ${totals} 条`}
defaultPageSize={pageSize} defaultPageSize={pageSize}
pageSizeOptions={[10, 20]} pageSizeOptions={[10, 20, 50, 100]}
defaultCurrent={1} defaultCurrent={1}
current={currentPage} current={currentPage}
onChange={paginationChange} onChange={paginationChange}
style={{ marginBottom: '10px', width: '70%' }} style={{ marginBottom: '10px', width: '70%' }}
size="small" size="small"
showQuickJumper showQuickJumper
showSizeChanger
/> />
{/* </Modal> */} {/* </Modal> */}
......
...@@ -320,7 +320,8 @@ const UserModal = props => { ...@@ -320,7 +320,8 @@ const UserModal = props => {
current={page.pageNum} current={page.pageNum}
defaultPageSize="5" defaultPageSize="5"
onChange={handleChangePage} onChange={handleChangePage}
pageSizeOptions={['5']} // pageSizeOptions={['5']}
pageSizeOptions={[10, 20, 40, 100]}
/> />
</div> </div>
</Card> </Card>
......
...@@ -1844,7 +1844,7 @@ const UserManage = () => { ...@@ -1844,7 +1844,7 @@ const UserManage = () => {
defaultPageSize={pageSize} defaultPageSize={pageSize}
defaultCurrent={1} defaultCurrent={1}
showSizeChanger showSizeChanger
pageSizeOptions={[10, 20, 40, 100]} pageSizeOptions={[10, 20, 50, 100]}
current={currentPage} current={currentPage}
onChange={paginationChange} onChange={paginationChange}
style={{ marginBottom: '10px' }} style={{ marginBottom: '10px' }}
......
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