Commit dcb3c812 authored by 田翔's avatar 田翔

fix: bug修复

parent 1c3fa31e
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "4.7.5", "version": "4.7.6",
"description": "4.7.5 台账列表优化", "description": "4.7.6 关联表单,批量删除,关联选择BUG修复,新增表单内嵌地图",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -17,7 +17,7 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -17,7 +17,7 @@ const SearchGroup = forwardRef((props, ref) => {
getQueryInfo, getQueryInfo,
})) }))
const { accountName, config, notUse, checkName, btnsClick } = props const { accountName, config, notUse, checkName, btnsClick, keys } = props
const { enableBatchOperation, enableImportExport, enablePrint, enableQuickSearch, enableTimeFilter, parent } = config const { enableBatchOperation, enableImportExport, enablePrint, enableQuickSearch, enableTimeFilter, parent } = config
const [form] = Form.useForm() const [form] = Form.useForm()
const [dateArray, setDateArray] = useState([]) const [dateArray, setDateArray] = useState([])
...@@ -156,7 +156,7 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -156,7 +156,7 @@ const SearchGroup = forwardRef((props, ref) => {
}) })
} }
return array return array
}, [enableBatchOperation, notUse]) }, [enableBatchOperation, notUse, keys])
const uploadProps = { const uploadProps = {
action: `${window.location.origin}${'/PandaWorkFlow/WorkFlow/AccountManage/ImportAccountData'}`, action: `${window.location.origin}${'/PandaWorkFlow/WorkFlow/AccountManage/ImportAccountData'}`,
......
...@@ -320,6 +320,7 @@ const Account = (props, ref) => { ...@@ -320,6 +320,7 @@ const Account = (props, ref) => {
<SearchGroup <SearchGroup
onChange={search} onChange={search}
btnsClick={btnsClick} btnsClick={btnsClick}
keys={keys}
accountName={accountName} accountName={accountName}
config={config} config={config}
notUse={notUse} notUse={notUse}
......
...@@ -2191,7 +2191,14 @@ const mapWidgets = [ ...@@ -2191,7 +2191,14 @@ const mapWidgets = [
title: '地址同步', title: '地址同步',
type: 'string', type: 'string',
widget: 'AddressSync', widget: 'AddressSync',
description: '位置信息将会同步到下方字段中' description: '位置信息将会同步到下方字段中',
},
screenShot: {
title: '是否显示缩略图',
type: 'boolean',
widget: 'BooleanSwitch',
default: false,
description: '只读情况下会显示缩略图'
}, },
required: { required: {
title: '必填', title: '必填',
...@@ -2273,6 +2280,20 @@ const mapWidgets = [ ...@@ -2273,6 +2280,20 @@ const mapWidgets = [
description: '所有形态默认显示', description: '所有形态默认显示',
widget: 'HiddenCondition' widget: 'HiddenCondition'
}, },
screenShot: {
title: '是否显示缩略图',
type: 'boolean',
widget: 'BooleanSwitch',
default: false,
description: '只读情况下会显示缩略图'
},
// fieldshine: {
// title: '映射字段',
// name: '映射字段',
// type: 'array',
// widget: 'DeviceFieldshine',
// default: [],
// },
required: { required: {
title: '必填', title: '必填',
type: 'boolean', type: 'boolean',
...@@ -2353,6 +2374,13 @@ const mapWidgets = [ ...@@ -2353,6 +2374,13 @@ const mapWidgets = [
description: '所有形态默认显示', description: '所有形态默认显示',
widget: 'HiddenCondition' widget: 'HiddenCondition'
}, },
screenShot: {
title: '是否显示缩略图',
type: 'boolean',
widget: 'BooleanSwitch',
default: false,
description: '只读情况下会显示缩略图'
},
required: { required: {
title: '必填', title: '必填',
type: 'boolean', type: 'boolean',
...@@ -2433,6 +2461,13 @@ const mapWidgets = [ ...@@ -2433,6 +2461,13 @@ const mapWidgets = [
description: '所有形态默认显示', description: '所有形态默认显示',
widget: 'HiddenCondition' widget: 'HiddenCondition'
}, },
screenShot: {
title: '是否显示缩略图',
type: 'boolean',
widget: 'BooleanSwitch',
default: false,
description: '只读情况下会显示缩略图'
},
required: { required: {
title: '必填', title: '必填',
type: 'boolean', type: 'boolean',
......
...@@ -22,10 +22,6 @@ const FormDesigner = (props, ref) => { ...@@ -22,10 +22,6 @@ const FormDesigner = (props, ref) => {
)) ))
const { tableName, extra } = props const { tableName, extra } = props
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext)
const prefixCls = getPrefixCls('pandaXform')
const prefixClsPandaXform = getPrefixCls()
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const [schema, setSchema] = useState({}) const [schema, setSchema] = useState({})
const [fieldName, setFieldName] = useState([]) const [fieldName, setFieldName] = useState([])
......
...@@ -140,7 +140,7 @@ const RelationForm = (props) => { ...@@ -140,7 +140,7 @@ const RelationForm = (props) => {
} }
const deleteTableInfo = (r) => { const deleteTableInfo = (r) => {
let listItem = { type: 'delete', accountTable: accountName, id: r.ID, values: getItem('delete', r) } let listItem = { type: 'delete', accountTable: accountName, ID: r.ID, values: getItem('delete', r) }
let relationForm = addons.getValue('relationForm') || { configs: [], data: [] } let relationForm = addons.getValue('relationForm') || { configs: [], data: [] }
if (r.ID.includes('前端ID')) { if (r.ID.includes('前端ID')) {
let list = relationForm.data.filter(v => v.ID !== r.ID) let list = relationForm.data.filter(v => v.ID !== r.ID)
...@@ -238,7 +238,7 @@ const RelationForm = (props) => { ...@@ -238,7 +238,7 @@ const RelationForm = (props) => {
return message.error('请按照提示完善表单内容') return message.error('请按照提示完善表单内容')
} }
let type = row.ID.includes('前端ID') ? 'add' : 'edit' let type = row.ID.includes('前端ID') ? 'add' : 'edit'
let itemData = { type, accountTable: accountName, id: row.ID, values: formValue } let itemData = { type, accountTable: accountName, ID: row.ID, values: formValue }
if (formStateStr !== '添加') { if (formStateStr !== '添加') {
let array = [] let array = []
if (Array.isArray(dataSource)) { if (Array.isArray(dataSource)) {
...@@ -262,7 +262,7 @@ const RelationForm = (props) => { ...@@ -262,7 +262,7 @@ const RelationForm = (props) => {
}, 0) }, 0)
} }
let relationForm = addons.getValue('relationForm') || { configs: [], data: [] } let relationForm = addons.getValue('relationForm') || { configs: [], data: [] }
let listArray = relationForm.data.filter(v => v.id !== itemData.id) let listArray = relationForm.data.filter(v => v.ID !== itemData.ID)
listArray.push({ ...itemData }) listArray.push({ ...itemData })
addons.setValue('relationForm', { ...relationForm, data: listArray }) addons.setValue('relationForm', { ...relationForm, data: listArray })
setVisible(false) setVisible(false)
......
...@@ -19,18 +19,15 @@ const Coordinate = (props) => { ...@@ -19,18 +19,15 @@ const Coordinate = (props) => {
const { token, client } = window.globalConfig const { token, client } = window.globalConfig
const { value, onChange, schema, addons } = props const { value, onChange, schema, addons } = props
const { disabled, placeholder, presetValue, addressSync } = schema const { disabled, placeholder, presetValue, addressSync, screenShot } = schema
const [layersConifg, setLayersConifg] = useState(() => { const [layersConifg, setLayersConifg] = useState(() => {
const mapConfig = window.globalConfig.mapsettings?.layers || null const mapConfig = window.globalConfig.mapsettings?.layers || null
return { layers: mapConfig }; return { layers: mapConfig };
}); });
const [loading, setLoading] = useState(false)
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const [currentPointer, setCurrentPointer] = useState([])
const [initCoordinate, setInitCoordinate] = useState([]) const [initCoordinate, setInitCoordinate] = useState([])
const [currentPointerCoordinate, setCurrentPointerCoordinate] = useState([]) const [currentPointerCoordinate, setCurrentPointerCoordinate] = useState([])
const [view, setView] = useState(null) const [view, setView] = useState(null)
const [coordGetLayers, setCoordGetLayers] = useState(null)
const getView = (viewObject) => { const getView = (viewObject) => {
if (viewObject) { if (viewObject) {
...@@ -62,8 +59,9 @@ const Coordinate = (props) => { ...@@ -62,8 +59,9 @@ const Coordinate = (props) => {
}) })
}, 2000) }, 2000)
} }
setCoordGetLayers(coordGetLayer); if (!disabled) {
getPoints(viewObject, coordGetLayer); getPoints(viewObject, coordGetLayer);
}
} }
} }
...@@ -145,7 +143,7 @@ const Coordinate = (props) => { ...@@ -145,7 +143,7 @@ const Coordinate = (props) => {
useEffect(() => { useEffect(() => {
if (addons) { if (addons) {
addons.setValueByPath(addons.dataPath, presetValue) addons.setValueByPath(addons.dataPath, '12734143.782374073,3560622.6587929404')
} else { } else {
onChange(presetValue) onChange(presetValue)
} }
...@@ -178,43 +176,58 @@ const Coordinate = (props) => { ...@@ -178,43 +176,58 @@ const Coordinate = (props) => {
onClick={showMap} onClick={showMap}
/> />
: :
<Button !screenShot ? (
icon={<CompassOutlined style={{ color: value ? '#0092fe' : 'rgba(0, 0, 0, 0.25)' }} />} <Button
onClick={() => { icon={<CompassOutlined style={{ color: value ? '#0092fe' : 'rgba(0, 0, 0, 0.25)' }} />}
if (value) { onClick={() => {
showMap() if (value) {
} showMap()
}} }
}}
>
{value ? '查看位置' : '无位置信息'}
</Button>
) : null
}
{
screenShot && disabled ? (
<div style={{ width: '100%', height: '150px' }}>
<ArcGISSceneMap
getMapInfo={getView}
widgets={[]}
token={token}
client={token ? client : 'sandbox'}
/>
</div>
) : (
<Drag
width={'80%'}
title="选取坐标"
visible={visible}
onOk={onOk}
onCancel={onCancel}
cancelText={'取消'}
okText={'确定'}
bodyStyle={{ height: 600, overflowY: "auto", position: 'relative' }}
destroyOnClose={true}
{...disabled ? { footer: null } : {}}
> >
{value ? '查看位置' : '无位置信息'} <div style={{ height: '90%' }}>
</Button> <ArcGISSceneMap
getMapInfo={getView}
widgets={[]}
token={token}
client={token ? client : 'sandbox'}
/>
{
view ? <div style={{ width: '400px', position: 'absolute', right: '0', top: '25px' }}>
<AutoCompleteSearch areaName={getCityName()} view={view} />
</div> : ''
}
</div>
</Drag>
)
} }
<Drag
width={'80%'}
title="选取坐标"
visible={visible}
onOk={onOk}
onCancel={onCancel}
cancelText={'取消'}
okText={'确定'}
bodyStyle={{ height: 600, overflowY: "auto", position: 'relative' }}
destroyOnClose={true}
{...disabled ? { footer: null } : {}}
>
<div style={{ height: '90%' }}>
<ArcGISSceneMap
getMapInfo={getView}
widgets={[]}
token={token}
client={token ? client : 'sandbox'}
/>
{
view ? <div style={{ width: '400px', position: 'absolute', right: '0', top: '25px' }}>
<AutoCompleteSearch areaName={getCityName()} view={view} />
</div> : ''
}
</div>
</Drag>
</div> </div>
) )
......
...@@ -20,7 +20,7 @@ const Device = (props) => { ...@@ -20,7 +20,7 @@ const Device = (props) => {
const { token, client } = window.globalConfig const { token, client } = window.globalConfig
const { addons, value, onChange, schema } = props const { addons, value, onChange, schema } = props
const { placeholder, disabled, parent, presetValue } = schema const { placeholder, disabled, parent, presetValue, screenShot, fieldshine } = schema
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
let clickref = useRef(null) let clickref = useRef(null)
let view = useRef(null) let view = useRef(null)
...@@ -116,7 +116,7 @@ const Device = (props) => { ...@@ -116,7 +116,7 @@ const Device = (props) => {
if (presetValue) { if (presetValue) {
geometrystr = presetValue geometrystr = presetValue
} }
addons.setValueByPath(addons.dataPath, presetValue) addons.setValueByPath(addons.dataPath, '12734114.051643973,3560550.07264259')
} else { } else {
onChange(presetValue) onChange(presetValue)
} }
...@@ -134,7 +134,7 @@ const Device = (props) => { ...@@ -134,7 +134,7 @@ const Device = (props) => {
addonAfter={disabled ? null : <CompassOutlined style={{ color: 'rgba(0, 0, 0, 0.25)' }} onClick={iconClick} />} addonAfter={disabled ? null : <CompassOutlined style={{ color: 'rgba(0, 0, 0, 0.25)' }} onClick={iconClick} />}
style={{ width: '100%' }} style={{ width: '100%' }}
/> : /> :
<Button !screenShot ? <Button
icon={<CompassOutlined style={{ color: value ? '#0092fe' : 'rgba(0, 0, 0, 0.25)' }} />} icon={<CompassOutlined style={{ color: value ? '#0092fe' : 'rgba(0, 0, 0, 0.25)' }} />}
onClick={() => { onClick={() => {
if (value) { if (value) {
...@@ -143,28 +143,41 @@ const Device = (props) => { ...@@ -143,28 +143,41 @@ const Device = (props) => {
}} }}
> >
{value ? '查看设备' : '无设备信息'} {value ? '查看设备' : '无设备信息'}
</Button> </Button> : null
} }
<Drag {
visible={visible} screenShot && disabled ? (
title='设备选择' <div style={{ width: '100%', height: '120px' }}>
width={'80%'} <ArcGISSceneMap
onOk={onOk} getMapInfo={getMapInfo}
onCancel={onCancel} widgets={[]}
cancelText={'取消'} token={token}
okText={'确定'} client={token ? client : 'sandbox'}
bodyStyle={{ height: 600, overflowY: 'auto', position: 'relative' }} />
getContainer={true} </div>
{...disabled ? { footer: null } : {}} ) : (
> <Drag
<ArcGISSceneMap visible={visible}
getMapInfo={getMapInfo} title='设备选择'
widgets={[]} width={'80%'}
token={token} onOk={onOk}
client={token ? client : 'sandbox'} onCancel={onCancel}
/> cancelText={'取消'}
</Drag> okText={'确定'}
</div> bodyStyle={{ height: 600, overflowY: 'auto', position: 'relative' }}
getContainer={true}
{...disabled ? { footer: null } : {}}
>
<ArcGISSceneMap
getMapInfo={getMapInfo}
widgets={[]}
token={token}
client={token ? client : 'sandbox'}
/>
</Drag>
)
}
</div >
) )
} }
......
...@@ -21,7 +21,7 @@ const DrawArea = (props) => { ...@@ -21,7 +21,7 @@ const DrawArea = (props) => {
const { token, client } = window.globalConfig const { token, client } = window.globalConfig
const { value, onChange, schema, addons } = props const { value, onChange, schema, addons } = props
const { disabled, placeholder, presetValue, addressSync } = schema const { disabled, placeholder, presetValue, addressSync, screenShot } = schema
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const [rings, setRings] = useState({}) const [rings, setRings] = useState({})
const viewRef = useRef(null) const viewRef = useRef(null)
...@@ -31,7 +31,7 @@ const DrawArea = (props) => { ...@@ -31,7 +31,7 @@ const DrawArea = (props) => {
setTimeout(() => { setTimeout(() => {
if (isJson(value)) { if (isJson(value)) {
let layer = new Graphic({ let layer = new Graphic({
geometry: geomUtils.toGeometry(rings), geometry: geomUtils.toGeometry(JSON.parse(value)),
symbol: new SimpleFillSymbol({ symbol: new SimpleFillSymbol({
}), }),
...@@ -44,6 +44,7 @@ const DrawArea = (props) => { ...@@ -44,6 +44,7 @@ const DrawArea = (props) => {
} }
const getView = (viewObject) => { const getView = (viewObject) => {
setRings(isJson(value) ? JSON.parse(value) : '')
viewRef.current = viewObject viewRef.current = viewObject
createPaths(viewObject) createPaths(viewObject)
} }
...@@ -78,7 +79,6 @@ const DrawArea = (props) => { ...@@ -78,7 +79,6 @@ const DrawArea = (props) => {
} }
const showMap = () => { const showMap = () => {
setRings(isJson(value) ? JSON.parse(value) : '')
setVisible(true) setVisible(true)
} }
...@@ -93,7 +93,7 @@ const DrawArea = (props) => { ...@@ -93,7 +93,7 @@ const DrawArea = (props) => {
useEffect(() => { useEffect(() => {
if (addons) { if (addons) {
addons.setValueByPath(addons.dataPath, presetValue) addons.setValueByPath(addons.dataPath, "{\"rings\":[[[12734029.232350387,3560655.9516569674],[12734035.439494528,3560554.380207394],[12734178.203809762,3560611.373076321],[12734168.046664804,3560614.758791307]]]}")
} else { } else {
onChange(presetValue) onChange(presetValue)
} }
...@@ -112,7 +112,7 @@ const DrawArea = (props) => { ...@@ -112,7 +112,7 @@ const DrawArea = (props) => {
onClick={showMap} onClick={showMap}
/> />
: :
<Button !screenShot ? <Button
icon={<CompassOutlined style={{ color: value ? '#0092fe' : 'rgba(0, 0, 0, 0.25)' }} />} icon={<CompassOutlined style={{ color: value ? '#0092fe' : 'rgba(0, 0, 0, 0.25)' }} />}
onClick={() => { onClick={() => {
if (value) { if (value) {
...@@ -121,36 +121,49 @@ const DrawArea = (props) => { ...@@ -121,36 +121,49 @@ const DrawArea = (props) => {
}} }}
> >
{value ? '查看位置' : '无位置信息'} {value ? '查看位置' : '无位置信息'}
</Button> </Button> : null
} }
<Drag {
width={'80%'} screenShot && disabled ? (
title="选取坐标" <div style={{ width: '100%', height: '150px' }}>
visible={visible} <ArcGISSceneMap
onOk={onOk} getMapInfo={getView}
onCancel={onCancel} widgets={[]}
cancelText={'取消'} token={token}
okText={'确定'} client={token ? client : 'sandbox'}
bodyStyle={{ height: 600, overflowY: "auto", position: 'relative' }} />
destroyOnClose={true} </div>
{...disabled ? { footer: null } : {}} ) : (
> <Drag
<div style={{ height: '90%' }}> width={'80%'}
<Button title="选取坐标"
style={{ position: 'absolute', zIndex: '99', right: '10px', top: '10px' }} visible={visible}
type='primary' onOk={onOk}
onClick={start} onCancel={onCancel}
cancelText={'取消'}
okText={'确定'}
bodyStyle={{ height: 600, overflowY: "auto", position: 'relative' }}
destroyOnClose={true}
{...disabled ? { footer: null } : {}}
> >
开始绘制 <div style={{ height: '90%' }}>
</Button> <Button
<ArcGISSceneMap style={{ position: 'absolute', zIndex: '99', right: '10px', top: '10px' }}
getMapInfo={getView} type='primary'
widgets={[]} onClick={start}
token={token} >
client={token ? client : 'sandbox'} 开始绘制
/> </Button>
</div> <ArcGISSceneMap
</Drag > getMapInfo={getView}
widgets={[]}
token={token}
client={token ? client : 'sandbox'}
/>
</div>
</Drag >
)
}
</div > </div >
) )
......
...@@ -20,7 +20,7 @@ const DrawPath = (props) => { ...@@ -20,7 +20,7 @@ const DrawPath = (props) => {
const { token, client } = window.globalConfig const { token, client } = window.globalConfig
const { value, onChange, schema, addons } = props const { value, onChange, schema, addons } = props
const { disabled, placeholder, presetValue, addressSync } = schema const { disabled, placeholder, presetValue, addressSync, screenShot } = schema
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const [paths, setPaths] = useState({}) const [paths, setPaths] = useState({})
const viewRef = useRef(null) const viewRef = useRef(null)
...@@ -30,7 +30,7 @@ const DrawPath = (props) => { ...@@ -30,7 +30,7 @@ const DrawPath = (props) => {
setTimeout(() => { setTimeout(() => {
if (isJson(value)) { if (isJson(value)) {
let layer = new Graphic({ let layer = new Graphic({
geometry: geomUtils.toGeometry(paths), geometry: geomUtils.toGeometry(JSON.parse(value)),
symbol: new SimpleLineSymbol({ symbol: new SimpleLineSymbol({
}), }),
...@@ -43,6 +43,7 @@ const DrawPath = (props) => { ...@@ -43,6 +43,7 @@ const DrawPath = (props) => {
} }
const getView = (viewObject) => { const getView = (viewObject) => {
setPaths(isJson(value) ? JSON.parse(value) : '')
viewRef.current = viewObject viewRef.current = viewObject
createPaths(viewObject) createPaths(viewObject)
} }
...@@ -77,7 +78,6 @@ const DrawPath = (props) => { ...@@ -77,7 +78,6 @@ const DrawPath = (props) => {
} }
const showMap = () => { const showMap = () => {
setPaths(isJson(value) ? JSON.parse(value) : '')
setVisible(true) setVisible(true)
} }
...@@ -111,7 +111,7 @@ const DrawPath = (props) => { ...@@ -111,7 +111,7 @@ const DrawPath = (props) => {
onClick={showMap} onClick={showMap}
/> />
: :
<Button !screenShot ? <Button
icon={<CompassOutlined style={{ color: value ? '#0092fe' : 'rgba(0, 0, 0, 0.25)' }} />} icon={<CompassOutlined style={{ color: value ? '#0092fe' : 'rgba(0, 0, 0, 0.25)' }} />}
onClick={() => { onClick={() => {
if (value) { if (value) {
...@@ -120,36 +120,49 @@ const DrawPath = (props) => { ...@@ -120,36 +120,49 @@ const DrawPath = (props) => {
}} }}
> >
{value ? '查看位置' : '无位置信息'} {value ? '查看位置' : '无位置信息'}
</Button> </Button> : null
} }
<Drag {
width={'80%'} screenShot && disabled ? (
title="选取坐标" <div style={{ width: '100%', height: '150px' }}>
visible={visible} <ArcGISSceneMap
onOk={onOk} getMapInfo={getView}
onCancel={onCancel} widgets={[]}
cancelText={'取消'} token={token}
okText={'确定'} client={token ? client : 'sandbox'}
bodyStyle={{ height: 600, overflowY: "auto", position: 'relative' }} />
destroyOnClose={true} </div>
{...disabled ? { footer: null } : {}} ) : (
> <Drag
<div style={{ height: '90%' }}> width={'80%'}
<Button title="选取坐标"
style={{ position: 'absolute', zIndex: '99', right: '10px', top: '10px' }} visible={visible}
type='primary' onOk={onOk}
onClick={start} onCancel={onCancel}
cancelText={'取消'}
okText={'确定'}
bodyStyle={{ height: 600, overflowY: "auto", position: 'relative' }}
destroyOnClose={true}
{...disabled ? { footer: null } : {}}
> >
开始绘制 <div style={{ height: '90%' }}>
</Button> <Button
<ArcGISSceneMap style={{ position: 'absolute', zIndex: '99', right: '10px', top: '10px' }}
getMapInfo={getView} type='primary'
widgets={[]} onClick={start}
token={token} >
client={token ? client : 'sandbox'} 开始绘制
/> </Button>
</div> <ArcGISSceneMap
</Drag > getMapInfo={getView}
widgets={[]}
token={token}
client={token ? client : 'sandbox'}
/>
</div>
</Drag >
)
}
</div > </div >
) )
......
...@@ -179,8 +179,6 @@ const FileUpload = (props) => { ...@@ -179,8 +179,6 @@ const FileUpload = (props) => {
} }
}, [presetValue]) }, [presetValue])
console.log(imgVisible, showFile)
return ( return (
<div className={styles.uploadBox}> <div className={styles.uploadBox}>
<Upload <Upload
......
...@@ -84,7 +84,7 @@ const ComboBox = (props) => { ...@@ -84,7 +84,7 @@ const ComboBox = (props) => {
if (Array.isArray(data)) { if (Array.isArray(data)) {
let values = data.map(v => ({ stationID: v.stationID + '', stationName: v.stationName })) let values = data.map(v => ({ stationID: v.stationID + '', stationName: v.stationName }))
setSite(values) setSite(values)
if (!value && !presetValue) { if (!value && !presetValue && !disabled) {
onChange(values[0][isStoreID ? 'stationID' : 'stationName']) onChange(values[0][isStoreID ? 'stationID' : 'stationName'])
} }
} else { } else {
......
...@@ -12,7 +12,7 @@ const RelevanceSelect = (props) => { ...@@ -12,7 +12,7 @@ const RelevanceSelect = (props) => {
useEffect(() => { useEffect(() => {
if (addons) { if (addons) {
addons.setValue(addons.dataPath, presetValue) addons.setValue(addons.dataPath, presetValue || '')
} else { } else {
onChange(presetValue) onChange(presetValue)
} }
...@@ -20,7 +20,7 @@ const RelevanceSelect = (props) => { ...@@ -20,7 +20,7 @@ const RelevanceSelect = (props) => {
const selectChange = (value) => { const selectChange = (value) => {
if (addons) { if (addons) {
onChange(value) onChange(value || '')
} }
} }
......
import React, { useEffect, useState } from 'react'
import { Form, Space, TreeSelect, Button, Input, Modal, message } from 'antd'
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'
import styles from './index.less'
import { ReloadTableFields, QueryFields } from '../../../../../apis/process'
import Drag from '../../../../components/Drag'
const { TreeNode } = TreeSelect
const DeviceFieldshine = (props) => {
const { addons, onChange, value } = props
const { $id, accountName, tableNameParent } = addons.formData
const [form] = Form.useForm()
const [visible, setVisible] = useState(false)
const [fromField, setFromField] = useState([])
const [toField, setToField] = useState([])
const onOk = () => {
form
.validateFields()
.then((values) => {
const { field } = form.getFieldsValue()
if (field.length !== 1) {
addons.setValue('isMultiple', false)
}
onChange(field)
setVisible(false)
})
.catch((info) => {
console.log('Validate Failed:', info)
})
}
const inputClick = async () => {
const { code, data } = await ReloadTableFields({ tableName: tableNameParent })
if (code === 0) {
setToField(data.root)
}
let field = value.length ? value : [{ fromField: 'GIS编码', toField: 'GIS编码' }, { fromField: 'GIS图层', toField: 'GIS图层' }]
form.setFieldsValue({ field })
setVisible(true)
}
return (
<div className={styles.fieldshine}>
<Input
value={value && value.length ? JSON.stringify(value) : null}
onClick={inputClick}
/>
<Drag
getContainer={false}
width='450px'
title='字段映射'
visible={visible}
onCancel={() => setVisible(false)}
onOk={onOk}
>
<Form name="dynamic_form_nest_item" form={form} autoComplete="off">
<Form.List name="field">
{(value, { add, remove }) => (
<>
{value.map(({ key, name, ...restField }, index) => (
<Space
key={key}
// style={{
// display: 'flex',
// marginBottom: '5px ',
// justifyContent: 'center',
// position: 'relative',
// left: index === 0 ? '-11px' : '',
// }}
align="baseline"
>
<Form.Item
{...restField}
name={[name, 'fromField']}
rules={[
{
required: true,
message: '来源字段必填',
}
]}
>
<TreeSelect
showSearch
style={{ width: '180px' }}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
placeholder="请选择字段名 "
allowClear
treeDefaultExpandAll
showCheckedStrategy
>
<TreeNode value={accountName} title={accountName} disabled>
{fromField.map(s => <TreeNode value={s} title={s} key={s} />)}
</TreeNode>
</TreeSelect>
</Form.Item>
<div className={styles.centerImg}></div>
<Form.Item
{...restField}
name={[name, 'toField']}
rules={[
{
required: true,
message: '目标字段必填',
},
{
validator: (rules, value, callback) => {
const { field } = form.getFieldsValue()
let toFields = Array.from(new Set([...field.map(v => v.toField)]))
if (toFields.length !== field.length) {
return Promise.reject('目标字段不能重复!')
}
return Promise.resolve()
}
}
]}
>
<TreeSelect
showSearch
style={{ width: '180px' }}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
placeholder="请选择字段名 "
allowClear
treeDefaultExpandAll
showCheckedStrategy
>
<TreeNode value={tableNameParent} title={tableNameParent} disabled>
{toField.map(s => <TreeNode value={s.name} title={s.name} key={s.name} />)}
</TreeNode>
</TreeSelect>
</Form.Item>
{/* {index !== 0 ? <MinusCircleOutlined onClick={() => remove(name)} /> : null} */}
</Space>
))}
{/* <Form.Item style={{ padding: '0 10px' }}>
<Button type="dashed" onClick={() => add()} block icon={<PlusOutlined />}>
添加映射
</Button>
</Form.Item> */}
</>
)}
</Form.List>
</Form>
</Drag>
</div>
)
}
export default DeviceFieldshine
\ No newline at end of file
@imgSrc: '../../../../../assets/images/settting';
.fieldshine {
.centerImg {
width: 24px;
height: 24px;
background: url('@{imgSrc}/值映射.png');
background-size: 100% 100%;
position: relative;
top: 7px;
}
}
\ No newline at end of file
import Dictionary from './Dictionary' import Dictionary from './Dictionary'
import AccountName from './AccountName' import AccountName from './AccountName'
import Fieldshine from './Fieldshine' import Fieldshine from './Fieldshine'
import DeviceFieldshine from './DeviceFieldshine'
import GroupAndRole from './GroupAndRole' import GroupAndRole from './GroupAndRole'
import MappedField from './MappedField' import MappedField from './MappedField'
import ControlRules from './ControlRules' import ControlRules from './ControlRules'
...@@ -18,6 +19,7 @@ const groupSource = { ...@@ -18,6 +19,7 @@ const groupSource = {
Dictionary, Dictionary,
AccountName, AccountName,
Fieldshine, Fieldshine,
DeviceFieldshine,
GroupAndRole, GroupAndRole,
MappedField, MappedField,
ControlRules, ControlRules,
......
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