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

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

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