Commit 316048f6 authored by shaoan123's avatar shaoan123

完善表字段中字段编辑模块逻辑

parent 4752b80a
Pipeline #29937 skipped with stages
......@@ -22,7 +22,7 @@ const AddModal = props => {
const [type, setType] = useState(''); // 弹窗类型
const [formObj, setFormObj] = useState({ rule: [], numerical: '' });
const [characterValue, setCharacterValue] = useState('')
const [pramData, setPramData] = useState({ Unit: '', ExceptionEvent: '', RowSpan: 1, ColSpan: 1, ReadOnly: false, EditableLater: false, ExceptionValue: '', Preset: '' })
const [pramData, setPramData] = useState({ Unit: '', ExceptionEvent: '', Group: '', RowSpan: 0, ColSpan: 0, ReadOnly: false, EditableLater: false, ExceptionValue: '', Preset: '' })
const [checkedList, setCheckedList] = useState([]);//选中的复选框内容
const { TextArea } = Input;
const [form] = Form.useForm();
......@@ -33,7 +33,7 @@ const AddModal = props => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
UpdateFields([{ Unit: pramData.Unit||'', ExceptionEvent: pramData.ExceptionEvent||'', RowSpan: pramData.RowSpan||1, ColSpan: pramData.ColSpan||1, ReadOnly: pramData.ReadOnly||false, EditableLater: pramData.EditableLater||false, ExceptionValue: pramData.ExceptionValue||'', Preset: pramData.Preset||'', ID: Number(itemData.ID), Name: obj.Name, SyncEvent: obj.SyncEvent, ValidationRule: obj.ValidationRule, ExceptionEventFields: characterValue,Config:obj.Config }]).then(res => {
UpdateFields([{ Unit: pramData.Unit || '', StoreType: "nvarchar(255)", Group: pramData.Group || '', ExceptionEvent: pramData.ExceptionEvent || '',RowSpan: pramData.RowSpan || 0, ColSpan: pramData.ColSpan || 0, ReadOnly: pramData.ReadOnly || false, EditableLater: pramData.EditableLater || false, ExceptionValue: pramData.ExceptionValue || '', Preset: pramData.Preset || '', ID: Number(itemData.ID), Name: obj.Name,Alias:obj.Alias, SyncEvent: obj.SyncEvent, ValidationRule: obj.ValidationRule, ExceptionEventFields: characterValue, Config: obj.Config }]).then(res => {
setLoading(false);
if (res.msg === "Ok" || res.msg === "") {
form.resetFields();
......@@ -60,15 +60,24 @@ const AddModal = props => {
useEffect(() => {
if (isType != '') {
setPramData({ ...itemData })
let req1 = getField({ fieldID: itemData.ID })
let req2 = loadTableFields({ tableName: formObj1.tableName })
let req3 = LoadEventType({})
Promise.all([req1, req2, req3]).then(res => {
res[0].msg === 'Ok' && form.setFieldsValue({ ...res[0].data.root, SyncEvent: 0 })
res[1].msg === 'Ok' && setFieldName(res[1].data.root)
res[2].msg === 'Ok' && setEventList(res[2].data.root)
form.setFieldsValue({ ExceptionEvent: res[2].data.root[0].Name || '无' })
if (res[0].msg === 'Ok') {
form.setFieldsValue({ ...res[0].data.root})
if (res[0].data.root.ExceptionEventFields === '') {
setIsShow(false)
} else {
setIsShow(true)
setCharacterValue(res[0].data.root.ExceptionEventFields)
}
setPramData({...res[0].data.root})
}
// form.setFieldsValue({ ExceptionEvent: res[2].data.root[0].Name || '无' })
})
}
......@@ -134,7 +143,6 @@ const AddModal = props => {
getFieldData(e.tablename)
setPramData(data)
} else {
console.log(122);
setIsShow(false)
setFiled({})
}
......
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