Commit ad4583e4 authored by 皮倩雯's avatar 皮倩雯

fix: '表字段关联表单字段映射支持下拉选择,机构管理不允许删除和冻结panda和admin'

parent 1e9cbff9
Pipeline #63506 passed with stages
......@@ -41,6 +41,7 @@ import {
LoadEventFields,
LoadEventType,
UpdateFields,
reloadTableFields,
} from '@/services/tablemanager/tablemanager';
import {
PlusSquareOutlined,
......@@ -50,13 +51,16 @@ import {
MinusCircleOutlined,
PlusOutlined,
SwapOutlined,
CodeSandboxCircleFilled,
} from '@ant-design/icons';
import styles from './index.less';
import VerifyModal from './VerifyModal';
import Tree from '@/components/ExpendableTree';
import RuleConfig from '@/components/RuleConfig';
import Things from '../../../../../assets/images/icons/时间.svg';
import logo from '@/assets/images/icons/值映射.png';
import AddForm from '../../../../productCenter/webConfig/menuconfig/AddForm';
const AddModal = props => {
const {
callBackSubmit = () => {},
......@@ -69,6 +73,7 @@ const AddModal = props => {
keepTreeFirst,
keepStandingBook,
keepTreeData,
keepTree,
} = props;
const [loading, setLoading] = useState(false);
const [fieldName, setFieldName] = useState([]); // 弹窗
......@@ -195,6 +200,8 @@ const AddModal = props => {
const [formAdd] = Form.useForm();
const [showRule, setShowRule] = useState(false);
const [fieldList, setFieldList] = useState([]);
const [fieldValue, setFeildValue] = useState([]); // 保存关联表单形态,字段名下拉框数据
const [mapFieldValue, setMapFeildValue] = useState([]); // 保存关联表单形态,映射字段名下拉框数据
const change = e => {
console.log(e);
......@@ -279,7 +286,7 @@ const AddModal = props => {
data[0].Config = obj.Config;
}
break;
case '搜索选择器':
if (obj.Config.endsWith('.n')) {
data[0].Config = obj.Config;
......@@ -345,11 +352,11 @@ const AddModal = props => {
arrlist.toField = obj.eventOrder;
aalist.默认显示 = visibleChecked || false;
aalist.控制规则 = obj.configName;
console.log(formAdd.getFieldValue('parmars'))
console.log(formAdd.getFieldValue('parmars'));
let lii = [];
if(formAdd.getFieldValue('parmars')){
lii = [...formAdd.getFieldValue('parmars')]
if (formAdd.getFieldValue('parmars')) {
lii = [...formAdd.getFieldValue('parmars')];
}
console.log(lii);
lii.push(arrlist);
......@@ -461,12 +468,42 @@ const AddModal = props => {
});
}
});
}
};
const getData =()=>{
let last = [];
let aa = []; // 固定分组数据
keepTree.map((i,j)=>{
if(i=='工单编号'||i=='事件编号'){
aa.push(i)
}else{
let kk ={}
kk.name = i
kk.ID = j+1
last.push(kk)
}
})
let bb ={}// 固定分组对象
bb.name='固定分组';
bb.ID=0;
bb.children=aa;
console.log(bb);
let cc = [];
cc.push(bb)
console.log(cc.concat(last))
if(aa.length>0){
setFeildValue(cc.concat(last));
}else{
setFeildValue(last);
}
// 编辑时过滤下拉框初始数据
}
useEffect(() => {
if (isVisible) {
getData();
setFieldList(keepTreeData);
// 用于判断分组名与字段名重复时提示当前未选中字段
if (keepTreeFirst.indexOf(itemData.name) != -1 && itemData.children) {
......@@ -780,20 +817,25 @@ const AddModal = props => {
}
break;
case '关联表单':
console.log(keepStandingBook);
let data11 = JSON.parse(res[0].data.root.Config);
let rueslt = keepStandingBook.find(i => i.name == data11.台账名称);
console.log(rueslt.tableName);
getMapFelidValue(rueslt.tableName);
form.setFieldsValue({
standingBook: data11.台账名称,
workOrder: data11.映射字段[data11.映射字段.length-1].fromField,
eventOrder: data11.映射字段[data11.映射字段.length-1].toField,
workOrder: data11.映射字段[data11.映射字段.length - 1].fromField,
eventOrder: data11.映射字段[data11.映射字段.length - 1].toField,
configName: data11.控制规则,
});
let gg = [...data11.映射字段];
let a11=[]
gg.length>0&&gg.map((i,j)=>{
if(j!==gg.length-1){
a11.push(i)
}
})
let a11 = [];
gg.length > 0 &&
gg.map((i, j) => {
if (j !== gg.length - 1) {
a11.push(i);
}
});
formAdd.setFieldsValue({ parmars: a11 });
setVisibleChecked(data11.默认显示);
break;
......@@ -1051,6 +1093,27 @@ const AddModal = props => {
}
}, [isVisible]);
// 获取关联表单形态字段映射下拉框数据
const getMapFelidValue = e => {
console.log(e);
reloadTableFields({
tableName: e,
}).then(res => {
if (res.msg === 'Ok') {
console.log(res.data.root);
// 编辑时过滤下l拉框初始数据
setMapFeildValue(res.data.root);
}
});
};
const seach = e =>{
let rueslt = keepStandingBook.find(i => i.name == e);
getMapFelidValue(rueslt.tableName);
formAdd.resetFields();
form.setFieldsValue({workOrder:'',eventOrder:''})
}
const handleChange = value => {
form.setFieldsValue({ schemename: value });
};
......@@ -1201,7 +1264,7 @@ const AddModal = props => {
configName: '',
});
}
formAdd.resetFields()
formAdd.resetFields();
setVisibleChecked(true);
setView(true);
setPreView(true);
......@@ -1250,7 +1313,7 @@ const AddModal = props => {
value == '图片' ||
value == '可预览图片' ||
value == '录音' ||
value == '视频'||
value == '视频' ||
value == '关联表单'
) {
form.setFieldsValue({ RowSpan: 6 });
......@@ -1375,6 +1438,7 @@ const AddModal = props => {
const onSelect = (i, e) => {
console.log(i);
console.log(e);
setMapFeildValue([])
if (e.node.org.storeType && e.node.org.storeType == 'datetime') {
setCharacteristics1([
{
......@@ -1701,19 +1765,23 @@ const AddModal = props => {
break;
case '关联表单':
let data11 = JSON.parse(aa.Config);
let rueslt = keepStandingBook.find(i => i.name == data11.台账名称);
console.log(rueslt.tableName);
getMapFelidValue(rueslt.tableName);
form.setFieldsValue({
standingBook: data11.台账名称,
workOrder: data11.映射字段[data11.映射字段.length-1].fromField,
eventOrder: data11.映射字段[data11.映射字段.length-1].toField,
workOrder: data11.映射字段[data11.映射字段.length - 1].fromField,
eventOrder: data11.映射字段[data11.映射字段.length - 1].toField,
configName: data11.控制规则,
});
let gg = [...data11.映射字段];
let a11=[]
gg.length>0&&gg.map((i,j)=>{
if(j!==gg.length-1){
a11.push(i)
}
})
let a11 = [];
gg.length > 0 &&
gg.map((i, j) => {
if (j !== gg.length - 1) {
a11.push(i);
}
});
formAdd.setFieldsValue({ parmars: a11 });
setVisibleChecked(data11.默认显示);
break;
......@@ -2129,19 +2197,23 @@ const AddModal = props => {
case '关联表单':
let data11 = JSON.parse(res[0].data.root.Config);
let rueslt = keepStandingBook.find(i => i.name == data11.台账名称);
console.log(rueslt.tableName);
getMapFelidValue(rueslt.tableName);
form.setFieldsValue({
standingBook: data11.台账名称,
workOrder: data11.映射字段[data11.映射字段.length-1].fromField,
eventOrder: data11.映射字段[data11.映射字段.length-1].toField,
workOrder: data11.映射字段[data11.映射字段.length - 1].fromField,
eventOrder: data11.映射字段[data11.映射字段.length - 1].toField,
configName: data11.控制规则,
});
let gg = [...data11.映射字段];
let a11=[]
gg.length>0&&gg.map((i,j)=>{
if(j!==gg.length-1){
a11.push(i)
}
})
let a11 = [];
gg.length > 0 &&
gg.map((i, j) => {
if (j !== gg.length - 1) {
a11.push(i);
}
});
formAdd.setFieldsValue({ parmars: a11 });
setVisibleChecked(data11.默认显示);
break;
......@@ -2341,311 +2413,323 @@ const AddModal = props => {
}
// formAdd.validateFields().then(validate1 => {
// if(validate1){
form.validateFields().then(validate => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
let aa = '';
if (synchronization == true) {
aa = 1;
} else {
aa = 0;
}
console.log(obj);
let data = [
{
Unit: obj.Unit || '',
StoreType: pramData.StoreType,
Group: pramData.Group || '',
Shape,
ExceptionEvent: pramData.ExceptionEvent || '',
RowSpan: Number(obj.RowSpan) || 0,
ColSpan: pramData.ColSpan || 0,
ReadOnly: pramData.ReadOnly || false,
EditableLater: pramData.EditableLater || false,
ExceptionValue: pramData.ExceptionValue || '',
Preset: pramData.Preset || '',
ID: pramData.ID,
Order: pramData.Order,
Name: obj.Name,
Alias: obj.Alias,
SyncEvent: aa,
ValidationRule: obj.ValidationRule,
ExceptionEventFields: characterValue,
},
];
console.log(Shape);
if (Shape == '图片') {
if (view) {
data[0].Shape = '可预览图片';
} else {
data[0].Shape = '图片';
}
}
if (Shape == '附件') {
if (preView) {
data[0].Shape = '可预览附件';
} else {
data[0].Shape = '附件';
}
}
if (Shape == '值选择器') {
if (radiostyle == 0) {
if (!cho) {
data[0].Shape = '值选择器';
} else {
data[0].Shape = '值复选器';
}
} else {
data[0].Shape = '平铺值选择器';
}
}
switch (Shape) {
case '编码':
data[0].Config = `${obj.code}.${obj.prefix ? obj.prefix : ''}`;
break;
case '坐标控件':
pramData.coordinates ? (data[0].Config = '当前坐标') : (data[0].Config = '');
break;
case '图片':
case '可预览图片':
// data[0].Config = pramData.picture ? '拍照相册' : '';
data[0].Preset = pramData.picture ? '拍照相册' : '';
data[0].ValidationRule = pramData.must ? 'required' : '';
break;
case '搜索选择器':
if (obj.Config.endsWith('.n')) {
data[0].Config = obj.Config;
} else {
data[0].Config = radio == 0 ? `${obj.Config}` : `${obj.Config}.n`;
}
break;
case '唯一值文本':
data[0].Config = obj.fieldName
? `${obj.tableName}.${obj.fieldName}`
: `${obj.tableName}`;
break;
case '站点选择器':
data[0].Config = pep ? `本人${cho ? '.n' : ''}` : `全部${cho ? '.n' : ''}`;
break;
case '业务选择器':
if (obj.fieldName.endsWith('.n')) {
data[0].Config = obj.fieldName
? `${obj.tableName}.${obj.fieldName}`
: `${obj.tableName}`;
} else if (obj.fieldName) {
data[0].Config =
radio == 0
? `${obj.tableName}.${obj.fieldName}`
: `${obj.tableName}.${obj.fieldName}.n`;
} else {
data[0].Config = radio == 0 ? `${obj.tableName}` : `${obj.tableName}.n`;
}
break;
case '部门选择器':
if (obj.check == 0) {
data[0].Config = '';
} else {
data[0].Config = '.n';
}
break;
case '台账选择器':
if (obj.fieldName.endsWith('.n')) {
data[0].Config = `${obj.standingBook}.${obj.fieldName}`;
} else if (obj.fieldName) {
data[0].Config =
radio == 0
? `${obj.standingBook}.${obj.fieldName}`
: `${obj.standingBook}.${obj.fieldName}.n`;
} else {
data[0].Config = radio == 0 ? `${obj.standingBook}` : `${obj.standingBook}.n`;
}
if (obj.filterName) {
data[0].Config = `${data[0].Config}?${obj.filterName}`;
}
break;
case '关联表单':
let aalist = {};
let arrlist = {};
aalist.台账名称 = obj.standingBook;
arrlist.fromField = obj.workOrder;
arrlist.toField = obj.eventOrder;
aalist.默认显示 = visibleChecked || false;
aalist.控制规则 = obj.configName;
let lii = [];
if(formAdd.getFieldValue('parmars')){
lii = [...formAdd.getFieldValue('parmars')]
}
console.log(lii);
lii.push(arrlist);
let lia = [];
// if(validate1){
form.validateFields().then(validate => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
let aa = '';
if (synchronization == true) {
aa = 1;
} else {
aa = 0;
}
console.log(obj);
let data = [
{
Unit: obj.Unit || '',
StoreType: pramData.StoreType,
Group: pramData.Group || '',
Shape,
ExceptionEvent: pramData.ExceptionEvent || '',
RowSpan: Number(obj.RowSpan) || 0,
ColSpan: pramData.ColSpan || 0,
ReadOnly: pramData.ReadOnly || false,
EditableLater: pramData.EditableLater || false,
ExceptionValue: pramData.ExceptionValue || '',
Preset: pramData.Preset || '',
ID: pramData.ID,
Order: pramData.Order,
Name: obj.Name,
Alias: obj.Alias,
SyncEvent: aa,
ValidationRule: obj.ValidationRule,
ExceptionEventFields: characterValue,
},
];
console.log(Shape);
if (Shape == '图片') {
if (view) {
data[0].Shape = '可预览图片';
} else {
data[0].Shape = '图片';
}
}
if (Shape == '附件') {
if (preView) {
data[0].Shape = '可预览附件';
} else {
data[0].Shape = '附件';
}
}
lii.length>0 &&lii.map(i=>{
if(i){
if(i.fromField&&i.toField){
lia.push(i)
}
}
})
console.log(lia)
aalist.映射字段 = lia;
console.log(aalist);
data[0].Config = JSON.stringify(aalist);
break;
case '选择器':
if (cse) {
let str = cho
? `${obj.farter}.${obj.farterData}.n`
: `${obj.farter}.${obj.farterData}`;
data[0].Config = str;
} else {
let str = cho ? `${obj.Config}.n` : `${obj.Config}`;
data[0].Config = str;
}
break;
case '值选择器':
if (obj.Config.endsWith('.n')) {
data[0].Config = obj.Config;
} else if (radiostyle == 1) {
// 平铺值选择器
data[0].Config = cho ? `${obj.Config}.n` : `${obj.Config}`;
} else {
data[0].Config = obj.Config;
}
break;
case '人员选择器':
if (popeleShape == '分组模态') {
if (checkboxAllID1 == true) {
if (obj.ConfigName) {
let str = cho ? `全部ID.${obj.ConfigName}.n` : `全部ID.${obj.ConfigName}`;
data[0].Config = str;
} else {
let str = cho ? `全部ID.n` : `全部ID`;
data[0].Config = str;
}
} else if (obj.ConfigName) {
let str = cho ? `全部.${obj.ConfigName}.n` : `全部.${obj.ConfigName}`;
data[0].Config = str;
} else {
let str = cho ? `全部.n` : `全部`;
data[0].Config = str;
}
} else if (popeleShape == '下拉框') {
let str = cho ? `${obj.Config}.n` : `${obj.Config}`;
data[0].Config = str;
} else if (popeleShape == '树形模态') {
if (gl) {
let str = cho ? `tree.多选|站点` : `tree.单选|站点`;
data[0].Config = str;
} else {
let str = cho ? `tree.多选|非站点` : `tree.单选|非站点`;
data[0].Config = str;
}
if (Shape == '值选择器') {
if (radiostyle == 0) {
if (!cho) {
data[0].Shape = '值选择器';
} else {
data[0].Shape = '值复选器';
}
} else {
data[0].Shape = '平铺值选择器';
}
}
switch (Shape) {
case '编码':
data[0].Config = `${obj.code}.${obj.prefix ? obj.prefix : ''}`;
break;
case '坐标控件':
pramData.coordinates ? (data[0].Config = '当前坐标') : (data[0].Config = '');
break;
case '图片':
case '可预览图片':
// data[0].Config = pramData.picture ? '拍照相册' : '';
data[0].Preset = pramData.picture ? '拍照相册' : '';
data[0].ValidationRule = pramData.must ? 'required' : '';
break;
case '搜索选择器':
if (obj.Config.endsWith('.n')) {
data[0].Config = obj.Config;
} else {
data[0].Config = radio == 0 ? `${obj.Config}` : `${obj.Config}.n`;
}
break;
case '唯一值文本':
data[0].Config = obj.fieldName
? `${obj.tableName}.${obj.fieldName}`
: `${obj.tableName}`;
break;
case '站点选择器':
data[0].Config = pep ? `本人${cho ? '.n' : ''}` : `全部${cho ? '.n' : ''}`;
break;
case '业务选择器':
if (obj.fieldName.endsWith('.n')) {
data[0].Config = obj.fieldName
? `${obj.tableName}.${obj.fieldName}`
: `${obj.tableName}`;
} else if (obj.fieldName) {
data[0].Config =
radio == 0
? `${obj.tableName}.${obj.fieldName}`
: `${obj.tableName}.${obj.fieldName}.n`;
} else {
data[0].Config = radio == 0 ? `${obj.tableName}` : `${obj.tableName}.n`;
}
break;
case '部门选择器':
if (obj.check == 0) {
data[0].Config = '';
} else {
data[0].Config = '.n';
}
break;
case '台账选择器':
if (obj.fieldName.endsWith('.n')) {
data[0].Config = `${obj.standingBook}.${obj.fieldName}`;
} else if (obj.fieldName) {
data[0].Config =
radio == 0
? `${obj.standingBook}.${obj.fieldName}`
: `${obj.standingBook}.${obj.fieldName}.n`;
} else {
data[0].Config = radio == 0 ? `${obj.standingBook}` : `${obj.standingBook}.n`;
}
if (obj.filterName) {
data[0].Config = `${data[0].Config}?${obj.filterName}`;
}
break;
case '关联表单':
let aalist = {};
let arrlist = {};
aalist.台账名称 = obj.standingBook;
arrlist.fromField = obj.workOrder;
arrlist.toField = obj.eventOrder;
aalist.默认显示 = visibleChecked || false;
aalist.控制规则 = obj.configName;
let lii = [];
if (formAdd.getFieldValue('parmars')) {
lii = [...formAdd.getFieldValue('parmars')];
}
console.log(lii);
lii.push(arrlist);
let lia = [];
lii.length > 0 &&
lii.map(i => {
if (i) {
if (i.fromField && i.toField) {
lia.push(i);
}
break;
default:
data[0].Config = obj.Config;
}
console.log(data[0]);
let aadata = valueData;
console.log(keepTreeFirst);
// if (keepTreeFirst.indexOf(e.node.org.name) == -1) {
if (aadata.length > 0) {
let aa = [];
aadata.map(i => {
aa.push(i.ID);
});
if (aa.indexOf(data[0].ID) != -1) {
aadata.map((i, j) => {
if (i.ID == data[0].ID) {
aadata[j] = data[0];
}
});
}
});
console.log(lia);
aalist.映射字段 = lia;
console.log(aalist);
data[0].Config = JSON.stringify(aalist);
break;
case '选择器':
if (cse) {
let str = cho
? `${obj.farter}.${obj.farterData}.n`
: `${obj.farter}.${obj.farterData}`;
data[0].Config = str;
} else {
let str = cho ? `${obj.Config}.n` : `${obj.Config}`;
data[0].Config = str;
}
break;
case '值选择器':
if (obj.Config.endsWith('.n')) {
data[0].Config = obj.Config;
} else if (radiostyle == 1) {
// 平铺值选择器
data[0].Config = cho ? `${obj.Config}.n` : `${obj.Config}`;
} else {
data[0].Config = obj.Config;
}
break;
case '人员选择器':
if (popeleShape == '分组模态') {
if (checkboxAllID1 == true) {
if (obj.ConfigName) {
let str = cho ? `全部ID.${obj.ConfigName}.n` : `全部ID.${obj.ConfigName}`;
data[0].Config = str;
} else {
aadata.push(data[0]);
let str = cho ? `全部ID.n` : `全部ID`;
data[0].Config = str;
}
} else if (obj.ConfigName) {
let str = cho ? `全部.${obj.ConfigName}.n` : `全部.${obj.ConfigName}`;
data[0].Config = str;
} else {
aadata.push(data[0]);
let str = cho ? `全部.n` : `全部`;
data[0].Config = str;
}
// }
console.log(valueData);
console.log(aadata);
setValueData(aadata);
form.setFieldsValue({
Association: '',
Config: '',
guolv: '',
ConfigName: '',
tableName: '',
fieldName: '',
filterName: '',
filterValue: '',
standingBook: '',
check: 0,
AllID: '0',
All: '0',
AllID1: '',
All1: '',
ShowConfig: '',
pepole: '',
choose: '',
SyncEvent: '',
PeShape: '',
farter: '',
farterData: '',
workOrder: '',
eventOrder: '',
configName: '',
});
setVisibleChecked(true);
setCse('');
setPopeleShape('');
setRadio(0);
setRadiostyle(0);
setRadio3('0');
setRadio1('0');
setGl('');
setPep('');
setCho('');
setCheckboxAll1('');
setCheckboxAllID1('');
setSynchronization(false);
setFlag(false);
setPopeleShape('');
setHide(true);
if (i == 1.14) {
console.log(valueData);
UpdateFields(valueData).then(res => {
setLoading(false);
if (res.msg === 'Ok' || res.msg === '') {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: '修改成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
});
} else if (popeleShape == '下拉框') {
let str = cho ? `${obj.Config}.n` : `${obj.Config}`;
data[0].Config = str;
} else if (popeleShape == '树形模态') {
if (gl) {
let str = cho ? `tree.多选|站点` : `tree.单选|站点`;
data[0].Config = str;
} else {
let str = cho ? `tree.多选|非站点` : `tree.单选|非站点`;
data[0].Config = str;
}
}
break;
default:
data[0].Config = obj.Config;
}
console.log(data[0]);
let aadata = valueData;
console.log(keepTreeFirst);
// if (keepTreeFirst.indexOf(e.node.org.name) == -1) {
if (aadata.length > 0) {
let aa = [];
aadata.map(i => {
aa.push(i.ID);
});
if (aa.indexOf(data[0].ID) != -1) {
aadata.map((i, j) => {
if (i.ID == data[0].ID) {
aadata[j] = data[0];
}
});
} else {
aadata.push(data[0]);
}
} else {
aadata.push(data[0]);
}
// }
// });
console.log(valueData);
console.log(aadata);
setValueData(aadata);
form.setFieldsValue({
Association: '',
Config: '',
guolv: '',
ConfigName: '',
tableName: '',
fieldName: '',
filterName: '',
filterValue: '',
standingBook: '',
check: 0,
AllID: '0',
All: '0',
AllID1: '',
All1: '',
ShowConfig: '',
pepole: '',
choose: '',
SyncEvent: '',
PeShape: '',
farter: '',
farterData: '',
workOrder: '',
eventOrder: '',
configName: '',
});
setVisibleChecked(true);
setCse('');
setPopeleShape('');
setRadio(0);
setRadiostyle(0);
setRadio3('0');
setRadio1('0');
setGl('');
setPep('');
setCho('');
setCheckboxAll1('');
setCheckboxAllID1('');
setSynchronization(false);
setFlag(false);
setPopeleShape('');
setHide(true);
if (i == 1.14) {
console.log(valueData);
UpdateFields(valueData).then(res => {
setLoading(false);
if (res.msg === 'Ok' || res.msg === '') {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: '修改成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
});
}
}
});
// }
// });
};
const mapTree1 = org => {
if (org.children) {
return (
<TreeNode value={org.name} title={org.name} disabled>
{org.children.map(item => mapTreeSelect(item))}
</TreeNode>
);
}
if (org.name) {
return <TreeNode value={org.name} title={org.name} />;
}
return <TreeNode value={org} title={org} key={org} />;
};
const onChange2 = e => {
......@@ -2858,15 +2942,15 @@ const AddModal = props => {
setCse(e.target.checked);
};
const editRule = () =>{
const editRule = () => {
setShowRule(true);
}
};
const saveRule = e =>{
form.setFieldsValue({configName:e})
const saveRule = e => {
form.setFieldsValue({ configName: e });
setShowRule(false);
console.log(e);
}
console.log(e);
};
return (
<>
......@@ -3323,43 +3407,104 @@ const AddModal = props => {
labelCol={{ span: 4 }}
rules={[{ required: true, message: '请选择台账名' }]}
>
<Select showSearch>
<Select showSearch onChange={e=>seach(e)}>
{keepStandingBook
? keepStandingBook.map((item, index) => (
<Option key={index} value={item}>
{item}
</Option>
))
<Option key={index} value={item.name}>
{item.name}
</Option>
))
: ''}
</Select>
</Item>
{/* <Item
label="映射字段"
name="workOrder"
rules={[{ required: true, message: '请填写映射字段' }]}
<Item
style={{ marginBottom: '10px' }}
label={
<>
<span
style={{
color: 'red',
fontSize: '17px',
marginRight: '5px',
marginTop: '3px',
}}
>
*
</span>
<span>映射字段</span>
</>
}
labelCol={{ span: 4 }}
>
<Input placeholder="示例:工单编号:工单编号,事件编号:事件编号" />
</Item> */}
<Item style={{marginBottom:'10px'}} label={<><span style={{color:'red', fontSize:'17px',marginRight:'5px', marginTop:'3px'}}>*</span><span>映射字段</span></>} labelCol={{ span: 4 }}>
<Row>
<Col span={11}>
<Item
name="workOrder"
rules={[{ required: true, message: '请输入字段名' }]}
style={{ marginBottom:0}}
style={{ marginBottom: 0 }}
>
<Input placeholder="请输入字段名" style={{width:'208px'}}/>
{/* <Input placeholder="请输入字段名" style={{width:'208px'}}/> */}
{/* <Select
placeholder="选择字段名"
showSearch
style={{ width: '208px' }}
>
{fieldValue
? fieldValue.map((item, index) => (
<Option key={index} value={item}>
{item}
</Option>
))
: ''}
</Select> */}
<TreeSelect
showSearch
style={{ width: '208px' }}
// value={treeSelectValue}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
placeholder="请选择字段名 "
allowClear
treeDefaultExpandAll
showCheckedStrategy
// onChange={treeSelectOnchange}
>
{fieldValue ? (
fieldValue.map(i => mapTree1(i))
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
)}
</TreeSelect>
</Item>
</Col>
<Col span={1} style={{paddingTop:'3px'}}> <img src={logo} style={{ height: '24px', marginLeft:'-10px' }} alt="" /></Col>
<Col span={1} style={{ paddingTop: '3px' }}>
{' '}
<img
src={logo}
style={{ height: '24px', marginLeft: '-10px' }}
alt=""
/>
</Col>
<Col span={11}>
<Item
<Item
name="eventOrder"
rules={[{ required: true, message: '请输入映射字段名' }]}
style={{ marginBottom:0}}
style={{ marginBottom: 0 }}
>
<Input placeholder="请输入映射字段名" style={{ width:'208px'}}/>
<Select
placeholder="选择映射字段名"
showSearch
style={{ width: '208px' }}
>
{mapFieldValue.length > 0
? mapFieldValue.map((item, index) => (
<>
<Option key={item.name} value={item.name}>
{item.name}
</Option>
</>
))
: ''}
</Select>
</Item>
</Col>
</Row>
......@@ -3388,16 +3533,20 @@ const AddModal = props => {
{ required: true, message: '请填写字段名' },
{
validator: () => {
let aa = formAdd.getFieldsValue().parmars
let data =[];
aa.length >0 && aa.map(i=>{
if(i){
data.push(i.fromField)
}
})
let aa = formAdd.getFieldsValue().parmars;
let data = [];
aa.length > 0 &&
aa.map(i => {
if (i) {
data.push(i.fromField);
}
});
let list = new Set(data);
let ee = form.getFieldsValue().workOrder;
if (list.size !== data.length || data.indexOf(ee) != -1) {
if (
list.size !== data.length ||
data.indexOf(ee) != -1
) {
return Promise.reject(new Error('字段名重复'));
}
return Promise.resolve();
......@@ -3405,7 +3554,36 @@ const AddModal = props => {
},
]}
>
<Input placeholder="请填写字段名" style={{ width:'208px', marginLeft:'98px'}}/>
{/* <Select
placeholder="选择字段名"
showSearch
style={{ width: '208px', marginLeft: '98px' }}
>
{fieldValue
? fieldValue.map((item, index) => (
<Option key={index} value={item}>
{item}
</Option>
))
: ''}
</Select> */}
<TreeSelect
showSearch
style={{ width: '208px', marginLeft: '98px' }}
// value={treeSelectValue}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
placeholder="请选择字段名 "
allowClear
treeDefaultExpandAll
showCheckedStrategy
// onChange={treeSelectOnchange}
>
{fieldValue ? (
fieldValue.map(i => mapTree1(i))
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
)}
</TreeSelect>
</Form.Item>
{/* <SwapOutlined style={{marginLeft:'4px'}}/> */}
<img src={logo} style={{ height: '24px' }} alt="" />
......@@ -3414,9 +3592,23 @@ const AddModal = props => {
style={{ marginBottom: '5px' }}
name={[name, 'toField']}
fieldKey={[fieldKey, 'key']}
rules={[{ required: true, message: '请填写映射字段名'}]}
rules={[{ required: true, message: '请填写映射字段名' }]}
>
<Input placeholder="请填写映射字段名" style={{ width:'208px'}}/>
<Select
placeholder="选择映射字段名"
showSearch
style={{ width: '208px' }}
>
{mapFieldValue.length > 0
? mapFieldValue.map((item, index) => (
<>
<Option key={item.name} value={item.name}>
{item.name}
</Option>
</>
))
: ''}
</Select>
</Form.Item>
<MinusCircleOutlined
onClick={() => remove(name)}
......@@ -3452,10 +3644,20 @@ const AddModal = props => {
label="控制规则"
name="configName"
labelCol={{ span: 4 }}
rules={[{ required: true, message: '请输入控制规则' }]}
// rules={[{ required: true, message: '请输入控制规则' }]}
>
{/* <TextArea placeholder="示例:{表名.是否缴费} = ‘是’ and {表名.缴费金额} > 1000" /> */}
<div style={{border:'2px solid #6A98FA', minHeight:'34px', lineHeight:'34px', textAlign:'center'}} onClick={editRule}><span>{form.getFieldsValue().configName}</span></div>
<div
style={{
border: '2px solid #6A98FA',
minHeight: '34px',
lineHeight: '34px',
textAlign: 'center',
}}
onClick={editRule}
>
<span>{form.getFieldsValue().configName}</span>
</div>
</Item>
</>
);
......@@ -3474,10 +3676,10 @@ const AddModal = props => {
<Select showSearch style={{ width: '95%' }}>
{keepStandingBook
? keepStandingBook.map((item, index) => (
<Option key={index} value={item}>
{item}
</Option>
))
<Option key={index} value={item.name}>
{item.name}
</Option>
))
: ''}
</Select>
</Item>
......
......@@ -22,6 +22,7 @@ import {
SortDescendingOutlined,
PlusSquareOutlined,
RollbackOutlined,
ConsoleSqlOutlined,
} from '@ant-design/icons';
import {
reloadTableFields,
......@@ -64,6 +65,7 @@ const AddModal = props => {
const [selectGroup, setSelectGroup] = useState([]);
const [keepStandingBook, setKeepStandingBook] = useState([]);
const [keepTreeData, setKeepTreeData] = useState([]);
const [keepTree, setKeepTree] = useState([]); // 保存树字段名称
const editor = record => {
console.log(record);
......@@ -310,7 +312,7 @@ const AddModal = props => {
res.data.root.map(i => {
data.push(i.name);
});
setKeepStandingBook(data);
setKeepStandingBook(res.data.root);
}
});
}, []);
......@@ -335,6 +337,8 @@ const AddModal = props => {
res.data.root.map(i => {
arrlist.push(i.name);
});
console.log(arrlist);
setKeepTree(arrlist);
data.TableFieldNames = arrlist;
data.TableName = treeSelectValue.substring(0, treeSelectValue.lastIndexOf('@'));
listArr.push(data);
......@@ -374,6 +378,8 @@ const AddModal = props => {
res.data.root.map(i => {
arrlist.push(i.name);
});
console.log(arrlist);
setKeepTree(arrlist);
data.TableFieldNames = arrlist;
data.TableName = props.location.state.id;
listArr.push(data);
......@@ -590,6 +596,8 @@ const AddModal = props => {
res.data.root.map(i => {
arrlist.push(i.name);
});
console.log(arrlist);
setKeepTree(arrlist);
data.TableFieldNames = arrlist;
data.TableName = e.substring(0, e.lastIndexOf('@'));
listArr.push(data);
......@@ -761,6 +769,7 @@ const AddModal = props => {
</Modal>
<FieldEditor
isVisible={isVisible}
keepTree={keepTree}
keepTreeData={keepTreeData}
isType={isType}
itemData={itemData}
......
/* eslint-disable no-unused-expressions */
/* eslint-disable eqeqeq */
import React, { useState, useEffect, useRef } from 'react';
import {
......@@ -169,6 +170,7 @@ const UserManage = () => {
const flagRef = useRef(1);
const [searchWordOrg, setSearchWordOrg] = useState('');
const [keepDataList, setKeepDataList] = useState([]);
const setRowClassName = record =>
record.userID === selectColor.userID ? styles.clickRowStyle : '';
// 用户表列名
......@@ -274,24 +276,27 @@ const UserManage = () => {
</Tooltip>
{(record.state == 0 || record.state == null) && (
<>
{/* { console.log(record.state,'record.state')} */}
<Tooltip title="冻结用户">
<Popconfirm
placement="bottomRight"
title={
<p>
即将冻结用户{' '}
<span className={styles.redText}>{voca.stripTags(record.loginName)}</span>
,是否确认冻结?
</p>
}
okText="确认"
cancelText="取消"
onConfirm={() => freezeUser(record)}
>
<StopOutlined style={{ fontSize: '16px', color: '#e86060' }} />
</Popconfirm>
</Tooltip>
{record.loginName == 'panda' || record.loginName == 'admin' ? (
<StopOutlined style={{ fontSize: '16px' }} />
) : (
<Tooltip title="冻结用户">
<Popconfirm
placement="bottomRight"
title={
<p>
即将冻结用户{' '}
<span className={styles.redText}>{voca.stripTags(record.loginName)}</span>
,是否确认冻结?
</p>
}
okText="确认"
cancelText="取消"
onConfirm={() => freezeUser(record)}
>
<StopOutlined style={{ fontSize: '16px', color: '#e86060' }} />
</Popconfirm>
</Tooltip>
)}
</>
)}
{record.state == 1 && (
......@@ -345,24 +350,28 @@ const UserManage = () => {
/>
</Popconfirm>
</Tooltip> */}
<Tooltip title="删除用户">
<Popconfirm
placement="bottomRight"
title={
<p>
即将删除用户{' '}
<span className={styles.redText}>{voca.stripTags(record.loginName)}</span>
,是否确认删除?
</p>
}
// title={`确认删除用户${currentUser}`}
okText="确认"
cancelText="取消"
onConfirm={() => deleteUser(record)}
>
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }} />
</Popconfirm>
</Tooltip>
{record.loginName == 'panda' || record.loginName == 'admin' ? (
<DeleteOutlined style={{ fontSize: '16px' }} />
) : (
<Tooltip title="删除用户">
<Popconfirm
placement="bottomRight"
title={
<p>
即将删除用户{' '}
<span className={styles.redText}>{voca.stripTags(record.loginName)}</span>
,是否确认删除?
</p>
}
// title={`确认删除用户${currentUser}`}
okText="确认"
cancelText="取消"
onConfirm={() => deleteUser(record)}
>
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }} />
</Popconfirm>
</Tooltip>
)}
</Space>
),
},
......@@ -706,16 +715,27 @@ const UserManage = () => {
setOrgTitle(res.data.GroupName);
setDescription(res.data.Description);
// 返回用户表数据结构处理,扁平化
console.log(res.data);
const temp = flatten(getUsers(res.data));
console.log(temp);
// 设置过滤字段
let arr = temp.map(item => item.OUName);
console.log(arr);
arr = arr.filter((value, index) => arr.indexOf(value) === index);
console.log(arr);
setOrgFilters(arr.map(item => ({ text: item, value: item })));
setTableLength(temp.length);
let datalist = [];
const table = temp.map((item, index) => {
console.log(item);
if (item.loginName == 'panda' || item.loginName == 'admin') {
datalist.push(item.userID);
}
item.key = index;
return item;
});
console.log(datalist);
setKeepDataList(datalist);
setShowSearchStyle(false);
setTableData(table);
} else {
......@@ -901,6 +921,7 @@ const UserManage = () => {
};
// 冻结用户
const freezeUser = record => {
console.log(currentUser);
// setFreezeUserVisible(true);
setCurrentUser(record);
setSelectColor(record);
......@@ -1265,28 +1286,48 @@ const UserManage = () => {
};
// 提交-批量删除用户
const submitDeleteUsers = () => {
multiDeleteUsers(userIDs)
.then(res => {
if (res.code === 0) {
setDeleteUserVisible(false);
notification.success({
message: '提交成功',
duration: 2,
});
// 重新获取用户表,查找用户时currentSelectOrg为'-1',无需跳转
// eslint-disable-next-line no-unused-expressions
currentSelectOrg === '-1' ? submitSearchUser() : onSelect([currentSelectOrg]);
} else {
notification.error({
message: '提交失败',
description: res.msg,
});
console.log(userIDs);
console.log(keepDataList);
console.log(userIDs.split(','));
let data = [];
keepDataList.length > 0 &&
keepDataList.map(i => {
let aa = userIDs.split(',').indexOf(i);
console.log(aa);
if (aa !== -1) {
data.push(aa);
}
})
.catch(err => {
setTableLoading(false);
message.error(err);
});
console.log(data);
if (data.length > 0) {
notification.error({
message: '操作失败',
description: '选中项包含不可删除的用户panda或admin',
});
} else {
multiDeleteUsers(userIDs)
.then(res => {
if (res.code === 0) {
setDeleteUserVisible(false);
notification.success({
message: '提交成功',
duration: 2,
});
// 重新获取用户表,查找用户时currentSelectOrg为'-1',无需跳转
// eslint-disable-next-line no-unused-expressions
currentSelectOrg === '-1' ? submitSearchUser() : onSelect([currentSelectOrg]);
} else {
notification.error({
message: '提交失败',
description: res.msg,
});
}
})
.catch(err => {
setTableLoading(false);
message.error(err);
});
}
};
// 重置默认第一个
const handleReset = () => {
......
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