Commit 99c0f515 authored by 皮倩雯's avatar 皮倩雯

新增数据字典导入数据格式验证

parent 275a8c80
Pipeline #39913 skipped with stages
/* eslint-disable no-shadow */
import React, { useState, useEffect } from 'react';
import {
Table,
......@@ -694,20 +695,31 @@ const WebDic = () => {
},
beforeUpload: file => {
console.log('filee', file);
// setFiles(file.file)
setFiles(file.file);
},
onChange(info) {
let data;
let mse;
console.log(info, 'info');
setFiles(info.file);
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList);
}
if (info.file.status === 'done') {
console.log(1);
message.success(`${info.file.name} 导入成功`);
setFirst(true);
} else if (info.file.status === 'error') {
message.error(`${info.file.name} 导入失败.`);
info.fileList.map(item => {
console.log(item.response);
data = item.response.code;
mse = item.response.msg;
});
console.log(data);
if (data === 0) {
console.log(1);
message.success(`${info.file.name} 导入成功`);
setFirst(true);
} else {
console.log(2);
notification.error({
message: '导入失败',
description: mse,
});
}
}
},
};
......@@ -1182,9 +1194,7 @@ const WebDic = () => {
title="导入数据"
visible={InPutVisible}
onOk={input1}
onCancel={() => {
setInPutVisible(false);
}}
onCancel={input1}
okText="确认"
cancelText="取消"
>
......
......@@ -130,7 +130,7 @@ const AddFlowsModal = props => {
let a1 = [];
let a2;
let a3 = [];
initialArr.map(i => {
initialArr.data.map(i => {
// console.log(i.groupType)
a2 = i.groupType;
// console.log(a2)
......
......@@ -796,7 +796,7 @@ const AddModal = props => {
let a1 = [];
let a2;
let a3 = [];
initialArr.map(i => {
initialArr.data.map(i => {
// console.log(i.groupType)
a2 = i.groupType;
// console.log(a2)
......
......@@ -75,55 +75,56 @@ const AddModal = props => {
let oldArr = [];
let addArr = [];
let newArr = [];
if (flagg == 0) {
arrValue.map((item, index) => {
oldArr = oldArr.concat(item);
});
// if (flagg == 0) {
arrValue.map((item, index) => {
oldArr = oldArr.concat(item);
});
console.log(oldArr);
// 将第一次打开回显数据存入已选择数组里
oldArr.map(item => {
newArr.push(item);
});
console.log(newArr);
// 获取本次新增数据后的数组
let objArr = [];
checkedListArr.map(item => {
objArr = objArr.concat(item);
});
console.log(objArr); // 本次增加数据后数组
console.log(arrValue); // 上次数组
// 获取新增数据
objArr.map((item1, index1) => {
if (arrValue.indexOf(item1) == -1) {
addArr.push(item1);
}
});
} else {
arrValue.map((item, index) => {
oldArr = oldArr.concat(item);
});
console.log(oldArr);
// 将第一次打开回显数据存入已选择数组里
oldArr.map(item => {
newArr.push(item);
});
console.log(newArr);
// 获取本次新增数据后的数组
let objArr = [];
checkedListArr.map(item => {
objArr = objArr.concat(item);
});
console.log(checkedListArr);
console.log(objArr); // 本次增加数据后数组
console.log(arrValue); // 上次数组
// 获取新增数据
objArr.map((item1, index1) => {
if (arrValue.indexOf(item1) == -1) {
addArr.push(item1);
}
});
// } else {
// arrValue.map((item, index) => {
// oldArr = oldArr.concat(item);
// });
console.log(oldArr);
// 将第一次打开回显数据存入已选择数组里
oldArr.map(item => {
newArr.push(item);
});
console.log(newArr);
// 获取本次新增数据后的数组
let objArr = [];
checkedListArr.map(item => {
objArr = objArr.concat(item);
});
console.log(objArr); // 本次增加数据后数组
console.log(oldArr); // 上次数组
// 获取新增数据
objArr.map((item1, index1) => {
if (oldArr.indexOf(item1) == -1) {
addArr.push(item1);
}
});
}
// console.log(oldArr);
// // 将第一次打开回显数据存入已选择数组里
// oldArr.map(item => {
// newArr.push(item);
// });
// console.log(newArr);
// // 获取本次新增数据后的数组
// let objArr = [];
// checkedListArr.map(item => {
// objArr = objArr.concat(item);
// });
// console.log(objArr); // 本次增加数据后数组
// console.log(oldArr); // 上次数组
// // 获取新增数据
// objArr.map((item1, index1) => {
// if (oldArr.indexOf(item1) == -1) {
// addArr.push(item1);
// }
// });
// }
// 将每次新增数据从尾部写入已选择数组里
console.log(addArr);
if (addArr.length != 0) {
......@@ -319,9 +320,11 @@ const AddModal = props => {
setCheckAll(checkAllArr);
};
useEffect(() => {
// 不是第一次
if (flagg == 0) {
selectAll();
}
// 是否是全选
if (data == 1) {
selectAll();
}
......@@ -405,7 +408,6 @@ const AddModal = props => {
};
useEffect(() => {
// getRoles();
setRoleValue(filed1);
if (visible) {
setFlagg(1);
......@@ -430,6 +432,9 @@ const AddModal = props => {
);
checkAllArr.push(checkArr[index].length === filed[item].length);
});
console.log(checkArr);
console.log(indeterminateArr);
console.log(checkAllArr);
setCheckedList(checkArr);
setIndeterminate(indeterminateArr);
setCheckAll(checkAllArr);
......@@ -485,6 +490,9 @@ const AddModal = props => {
}
}, [visible]);
// useEffect(() => {
// setCurrentPage(1);
// }, [visible]);
const dragCallBack = arr => {
console.log(arr);
if (arr) {
......@@ -592,6 +600,21 @@ const AddModal = props => {
},
];
const handleParChange = key => {
console.log(key);
let value;
if (key == 0) {
value = '角色';
}
if (key == 1) {
value = '部门';
}
if (key == 2) {
value = '站点';
}
console.log(value);
// getRoles();
};
if (isType != 'app') {
return (
<Modal
......@@ -613,13 +636,6 @@ const AddModal = props => {
className={styles.cardItem}
style={{ borderRight: '1px solid #99bbe8' }}
>
{/* <Divider
orientation="left"
style={{ margin: '0 0 10px 0', backgroundColor: '#dfe8f6' }}
>
待选字段列表
</Divider> */}
{flag === 0 ? (
<>
<div className={styles.cardContent}>
......@@ -687,12 +703,6 @@ const AddModal = props => {
)}
</div>
<div className={styles.cardItem}>
{/* <Divider
orientation="left"
style={{ margin: '0 0 10px 0', backgroundColor: '#dfe8f6' }}
>
已选字段列表
</Divider> */}
<div className={styles.cardContent}>
<div className={styles.doctorTable}>
<DragTable
......@@ -730,7 +740,7 @@ const AddModal = props => {
forceRender
getContainer={false}
>
{/* <Search
<Search
style={{
width: 260,
marginRight: '20px',
......@@ -752,12 +762,16 @@ const AddModal = props => {
// }}
>
重置
</Button> */}
</Button>
{visible && (
<div className={styles.listCard1}>
<div className={styles.cardItem1}>
<div className={styles.cardContent1}>
<Tabs defaultActiveKey="0" className={styles.tab}>
<Tabs
defaultActiveKey="0"
className={styles.tab}
onChange={handleParChange}
>
{title.map((item, index) => (
<TabPane tab={item} key={index}>
<div className={styles.cardItemData1} key={index}>
......@@ -805,7 +819,7 @@ const AddModal = props => {
</div>
</div>
)}
{/* <Pagination
<Pagination
total={total}
showTotal={item => `共 ${item} 条`}
defaultPageSize={pageSize}
......@@ -815,7 +829,7 @@ const AddModal = props => {
style={{ marginBottom: '10px' }}
size="small"
showQuickJumper
/> */}
/>
</Modal>
);
}
......
......@@ -78,7 +78,7 @@ const SiteManage = props => {
.then(res => {
handleShowModal('spinLoading', false);
let arr = [];
if (code===0) {
if (code === 0) {
arr.push(res.find(item => item.id === 'Web4StationRoot'));
}
if (arr[0]) {
......@@ -348,7 +348,7 @@ const SiteManage = props => {
.then(res => {
handleShowModal('btnLoading', false);
if (res.code===0) {
if (res.code === 0) {
setSelectList([]);
setUpdate1(update1 + 1);
notification.success({
......
import { post, get, PUBLISH_SERVICE } from '../index';
export const GetDataDictionaryList = params =>
get(`${PUBLISH_SERVICE}/DataManger/GetDataDictionaryList`, params);
get(`${PUBLISH_SERVICE}/DataManger/GetDataDictionaryList`, params);
export const AddDataDictionary = params =>
get(`${PUBLISH_SERVICE}/DataManger/AddDataDictionary`, params);
get(`${PUBLISH_SERVICE}/DataManger/AddDataDictionary`, params);
export const DeleteDataDictionary = params =>
get(`${PUBLISH_SERVICE}/DataManger/DeleteDataDictionary`, params);
get(`${PUBLISH_SERVICE}/DataManger/DeleteDataDictionary`, params);
export const EditDataDictionary = params =>
get(`${PUBLISH_SERVICE}/DataManger/EditDataDictionary`, params);
get(`${PUBLISH_SERVICE}/DataManger/EditDataDictionary`, params);
export const AddDataDictionaryList = params =>
post(`${PUBLISH_SERVICE}/DataManger/AddDataDictionaryList`, params);
post(`${PUBLISH_SERVICE}/DataManger/AddDataDictionaryList`, params);
export const SearchDataDictionaryList = params =>
get(`${PUBLISH_SERVICE}/DataManger/SearchDataDictionaryList`, params);
//获取数据字典
get(`${PUBLISH_SERVICE}/DataManger/SearchDataDictionaryList`, params);
// 获取数据字典
export const GetKeyValue = params =>
get(`${PUBLISH_SERVICE}/DataManger/GetKeyValue`, params);
get(`${PUBLISH_SERVICE}/DataManger/GetKeyValue`, params);
export const AddKeyValue = params =>
get(`${PUBLISH_SERVICE}/DataManger/AddKeyValue`, params);
get(`${PUBLISH_SERVICE}/DataManger/AddKeyValue`, params);
export const EditKeyValue = params =>
get(`${PUBLISH_SERVICE}/DataManger/EditKeyValue`, params);
get(`${PUBLISH_SERVICE}/DataManger/EditKeyValue`, params);
export const DeleteKeyValue = params =>
get(`${PUBLISH_SERVICE}/DataManger/DeleteKeyValue`, params);
//导出文件
get(`${PUBLISH_SERVICE}/DataManger/DeleteKeyValue`, params);
// 导出文件
export const ExportDataDictionary = params =>
get(`${PUBLISH_SERVICE}/DataManger/ExportDataDictionary`, params,{
responseType:'blob'
});
//导入文件
get(`${PUBLISH_SERVICE}/DataManger/ExportDataDictionary`, params, {
responseType: 'blob',
});
// 导入文件
export const ImportDataDictionary = params =>
post(`${PUBLISH_SERVICE}/DataManger/ImportDataDictionary`, params);
//拖拽组件
post(`${PUBLISH_SERVICE}/DataManger/ImportDataDictionary`, params, {
headers: {
authorization: 'authorization-text',
},
name: 'file',
});
// 拖拽组件
export const DataDictionaryChangeOrder = params =>
post(`${PUBLISH_SERVICE}/DataManger/DataDictionaryChangeOrder`, params);
\ No newline at end of file
post(`${PUBLISH_SERVICE}/DataManger/DataDictionaryChangeOrder`, params);
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