Commit 6e98aa64 authored by 田翔's avatar 田翔

fix: 编码形态优化

parent 787da4bc
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "4.8.9", "version": "4.9.0",
"description": "4.8.9 手写签名标签长度优化", "description": "4.9.0 编码形态优化",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -375,6 +375,31 @@ export function LoadTableFields(paramas) { ...@@ -375,6 +375,31 @@ export function LoadTableFields(paramas) {
}) })
} }
//获取地图方案
export function getMaplayerByTerminalType() {
return request({
url: `PandaGIS/MapServer/Maplayer/GetMaplayerByTerminalType?terminalType=scheme&isBaseMap=false&v=1691659617`,
method: 'get'
})
}
//通过方案获取获图层
export function GetLayerList(serviceName) {
return request({
url: `PandaGIS/MapServer/MetaData/D_GetLayerList?serviceName=${serviceName}`,
method: 'get'
})
}
//通过图层获取字段
export function GetLayerFields({ mapServer, layerName }) {
return request({
url: `PandaGIS/MapServer/MetaData/GetLayerFields?mapServer=${mapServer}&layerName=${layerName}`,
method: 'get'
})
}
//获取表字段(无附加表) //获取表字段(无附加表)
export function ReloadTableFields(paramas) { export function ReloadTableFields(paramas) {
return request({ return request({
......
...@@ -2287,13 +2287,13 @@ const mapWidgets = [ ...@@ -2287,13 +2287,13 @@ const mapWidgets = [
default: false, default: false,
description: '只读情况下会显示缩略图' description: '只读情况下会显示缩略图'
}, },
// fieldshine: { fieldshine: {
// title: '映射字段', title: '映射字段',
// name: '映射字段', name: '映射字段',
// type: 'array', type: 'array',
// widget: 'DeviceFieldshine', widget: 'DeviceFieldshine',
// default: [], default: [],
// }, },
required: { required: {
title: '必填', title: '必填',
type: 'boolean', type: 'boolean',
......
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import { Form, Space, TreeSelect, Button, Input, Modal, message } from 'antd' import { Form, Space, TreeSelect, Button, Input, Modal, message, Select } from 'antd'
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons' import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'
import styles from './index.less' import styles from './index.less'
import { ReloadTableFields, QueryFields } from '../../../../../apis/process' import { ReloadTableFields, QueryFields, getMaplayerByTerminalType, GetLayerList, GetLayerFields } from '../../../../../apis/process'
import Drag from '../../../../components/Drag' import Drag from '../../../../components/Drag'
const { TreeNode } = TreeSelect const { TreeNode } = TreeSelect
...@@ -10,10 +10,14 @@ const { TreeNode } = TreeSelect ...@@ -10,10 +10,14 @@ const { TreeNode } = TreeSelect
const DeviceFieldshine = (props) => { const DeviceFieldshine = (props) => {
const { addons, onChange, value } = props const { addons, onChange, value } = props
const { $id, accountName, tableNameParent } = addons.formData const formData = addons.formData
const [form] = Form.useForm() const [form] = Form.useForm()
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const [mapServers, setMapServers] = useState([])
const [service, setService] = useState(formData?.service)
const [layers, setLayers] = useState([])
const [layerName, setlayerName] = useState(formData?.layerName)
const [fromField, setFromField] = useState([]) const [fromField, setFromField] = useState([])
const [toField, setToField] = useState([]) const [toField, setToField] = useState([])
...@@ -21,10 +25,9 @@ const DeviceFieldshine = (props) => { ...@@ -21,10 +25,9 @@ const DeviceFieldshine = (props) => {
form form
.validateFields() .validateFields()
.then((values) => { .then((values) => {
const { field } = form.getFieldsValue() const { field, service, layerName } = form.getFieldsValue()
if (field.length !== 1) { addons.setValue('service', service)
addons.setValue('isMultiple', false) addons.setValue('layerName', layerName)
}
onChange(field) onChange(field)
setVisible(false) setVisible(false)
}) })
...@@ -34,15 +37,43 @@ const DeviceFieldshine = (props) => { ...@@ -34,15 +37,43 @@ const DeviceFieldshine = (props) => {
} }
const inputClick = async () => { const inputClick = async () => {
const { code, data } = await ReloadTableFields({ tableName: tableNameParent }) const { code, data } = await ReloadTableFields({ tableName: formData?.tableNameParent })
if (code === 0) { if (code === 0) {
setToField(data.root) setToField(data.root)
} }
let field = value.length ? value : [{ fromField: 'GIS编码', toField: 'GIS编码' }, { fromField: 'GIS图层', toField: 'GIS图层' }] let field = value.length ? value : []
form.setFieldsValue({ field }) form.setFieldsValue({ field, service: formData?.service, layerName: formData?.layerName })
setVisible(true) setVisible(true)
} }
const serviceFocus = async () => {
const { code, data } = await getMaplayerByTerminalType()
if (code === '0') {
setMapServers(data)
}
}
const layerNameFocus = async () => {
let { success, root } = await GetLayerList(service)
if (success === true) {
let array = []
root.forEach(v => {
let values = v.layerName.split(':')
if (values.length === 2) {
array.push({ layerID: v.layerID, layerName: values[1] })
}
})
setLayers(array)
}
}
const fromFieldFocus = async (value) => {
const { code, data } = await GetLayerFields({ mapServer: service, layerName: layerName })
if (code === '0') {
setFromField(data)
}
}
return ( return (
<div className={styles.fieldshine}> <div className={styles.fieldshine}>
<Input <Input
...@@ -58,19 +89,57 @@ const DeviceFieldshine = (props) => { ...@@ -58,19 +89,57 @@ const DeviceFieldshine = (props) => {
onOk={onOk} onOk={onOk}
> >
<Form name="dynamic_form_nest_item" form={form} autoComplete="off"> <Form name="dynamic_form_nest_item" form={form} autoComplete="off">
<Form.List name="field"> <Form.Item
label='方案名称'
name='service'
rules={[
{
required: true,
message: '方案名称必填',
},
]}
>
<Select
onFocus={serviceFocus}
onChange={(value) => setService(value)}
>
{
mapServers.map(v => <Select.Option value={v.servicename}>{v.schemename}</Select.Option>)
}
</Select>
</Form.Item>
<Form.Item
label='图层名称'
name='layerName'
rules={[
{
required: true,
message: '图层名称必填',
},
]}
>
<Select
onFocus={layerNameFocus}
onChange={(value) => setlayerName(value)}
>
{
layers.map(v => <Select.Option value={v.layerName}>{v.layerName}</Select.Option>)
}
</Select>
</Form.Item>
<Form.List name="field" label='字段映射'>
{(value, { add, remove }) => ( {(value, { add, remove }) => (
<> <>
{value.map(({ key, name, ...restField }, index) => ( {value.map(({ key, name, ...restField }, index) => (
<Space <Space
key={key} key={key}
// style={{ style={{
// display: 'flex', display: 'flex',
// marginBottom: '5px ', marginBottom: '5px',
// justifyContent: 'center', justifyContent: 'center',
// position: 'relative', position: 'relative',
// left: index === 0 ? '-11px' : '', left: index === 0 ? '-11px' : '',
// }} }}
align="baseline" align="baseline"
> >
<Form.Item <Form.Item
...@@ -91,10 +160,9 @@ const DeviceFieldshine = (props) => { ...@@ -91,10 +160,9 @@ const DeviceFieldshine = (props) => {
allowClear allowClear
treeDefaultExpandAll treeDefaultExpandAll
showCheckedStrategy showCheckedStrategy
onFocus={fromFieldFocus}
> >
<TreeNode value={accountName} title={accountName} disabled> {fromField.map(s => <TreeNode value={s.field} title={s.fieldAlias} key={s.field} />)}
{fromField.map(s => <TreeNode value={s} title={s} key={s} />)}
</TreeNode>
</TreeSelect> </TreeSelect>
</Form.Item> </Form.Item>
<div className={styles.centerImg}></div> <div className={styles.centerImg}></div>
...@@ -127,19 +195,19 @@ const DeviceFieldshine = (props) => { ...@@ -127,19 +195,19 @@ const DeviceFieldshine = (props) => {
treeDefaultExpandAll treeDefaultExpandAll
showCheckedStrategy showCheckedStrategy
> >
<TreeNode value={tableNameParent} title={tableNameParent} disabled> <TreeNode value={formData?.tableNameParent} title={formData?.tableNameParent} disabled>
{toField.map(s => <TreeNode value={s.name} title={s.name} key={s.name} />)} {toField.map(s => <TreeNode value={s.name} title={s.name} key={s.name} />)}
</TreeNode> </TreeNode>
</TreeSelect> </TreeSelect>
</Form.Item> </Form.Item>
{/* {index !== 0 ? <MinusCircleOutlined onClick={() => remove(name)} /> : null} */} {index !== 0 ? <MinusCircleOutlined onClick={() => remove(name)} /> : null}
</Space> </Space>
))} ))}
{/* <Form.Item style={{ padding: '0 10px' }}> <Form.Item style={{ padding: '0 10px' }}>
<Button type="dashed" onClick={() => add()} block icon={<PlusOutlined />}> <Button type="dashed" onClick={() => add()} block icon={<PlusOutlined />}>
添加映射 添加映射
</Button> </Button>
</Form.Item> */} </Form.Item>
</> </>
)} )}
</Form.List> </Form.List>
......
...@@ -17,9 +17,9 @@ const Coding = (props) => { ...@@ -17,9 +17,9 @@ const Coding = (props) => {
useEffect(() => { useEffect(() => {
if (addons) { if (addons) {
addons.setValue(addons.dataPath, presetValue) addons.setValue(addons.dataPath, presetValue || '')
} else { } else {
onChange(presetValue) onChange(presetValue || '')
} }
}, []) }, [])
......
...@@ -64,9 +64,9 @@ const TextInput = (props) => { ...@@ -64,9 +64,9 @@ const TextInput = (props) => {
} }
} }
if (addons) { if (addons) {
addons.setValue(addons.dataPath, value) addons.setValue(addons.dataPath, value || '')
} else { } else {
onChange(value) onChange(value || '')
} }
}, [presetValue]) }, [presetValue])
......
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