Commit 23b36a54 authored by 田翔's avatar 田翔

fix: 向字段生成分组名称数据

parent 16c6ea91
{
"name": "panda-xform",
"version": "1.6.5",
"description": "1.6.5: 防止出现重新取字段名问题",
"version": "1.6.7",
"description": "1.6.7: 向字段生成分组名称数据",
"keywords": [
"panda-xform"
],
......
......@@ -681,12 +681,12 @@ const textWidgets = [
displayType: 'row',
labelWidth: 80,
},
presetValue: {
title: '默认值',
type: 'string',
displayType: 'row',
labelWidth: 80,
},
// presetValue: {
// title: '默认值',
// type: 'string',
// displayType: 'row',
// labelWidth: 80,
// },
groupSetting: {
title: '控件设置',
type: 'object',
......@@ -703,13 +703,13 @@ const textWidgets = [
}
}
},
disabled: {
title: '只读',
type: 'boolean',
widget: 'checkbox',
default: true,
width: '30%',
},
// disabled: {
// title: '只读',
// type: 'boolean',
// widget: 'checkbox',
// default: true,
// width: '30%',
// },
hidden: {
title: '隐藏',
type: 'boolean',
......@@ -717,11 +717,28 @@ const textWidgets = [
default: false,
width: '30%',
},
prefixion: {
title: '前缀',
type: 'string',
displayType: 'row',
labelWidth: 90,
},
codingType: {
title: '编码方式',
type: 'string',
displayType: 'row',
labelWidth: 90,
widget: 'select',
enum: ['1', '2', '3'],
default: '3',
enumNames: ['前缀-年份-六位编码', '前缀-年份月份-六位编码', '前缀 -八位编码'],
description: '{{rootValue.codingType === "1" ?"示例:XJ-2019-000001" : (rootValue.codingType === "2" ? "示例: XJ-201909-000001" : "示例: XJ00000001")}}'
},
description: {
title: '说明',
type: 'string',
displayType: 'row',
labelWidth: 55,
labelWidth: 90,
},
groupStyle: {
title: '控件样式',
......
......@@ -25,7 +25,7 @@ const FormDesigner = (props, ref) => {
let settingsParent = []
settings.forEach(v => {
v.widgets.forEach(s => {
s.schema = { ...s.schema, tableNameParent: tableName }
s.schema.parent = { tableName }
})
settingsParent.push(v)
})
......@@ -35,11 +35,13 @@ const FormDesigner = (props, ref) => {
const getJSON = (json, tableName) => {
let parent = json?.properties
if (isObject(parent)) {
let paths = []
for (let v in parent) {
paths.push(v)
let child = parent[v]?.properties
if (isObject(child)) {
for (let s in child) {
child[s].tableNameParent = tableName
child[s].parent = { tableName, paths }
}
}
}
......@@ -100,14 +102,15 @@ const FormDesigner = (props, ref) => {
text: '预览',
onClick: (e) => {
setVisible(true)
setSchema(designerRef.current.getValue())
let json = getJSON(designerRef.current.getValue(), tableName)
setSchema(json)
}
},
{
text: '提交',
onClick: async (value) => {
const errors = designerRef.current.getErrorFields()
const json = designerRef.current.getValue()
let json = getJSON(designerRef.current.getValue(), tableName)
if (errors.length) {
return message.error('请按照提示完善表单内容')
}
......
......@@ -9,6 +9,7 @@ import {
Graphic
} from '@wisdom-map/arcgismap'
import point from './img/point.png'
import { isObject } from '../../../../utils'
let geometrystr = ''
let gisInfo = {}
......@@ -188,11 +189,11 @@ const initMapConfig = [
}
]
const Device = ({ addons, value, onChange, schema }) => {
const Device = (props) => {
const mapConfig = window.globalConfig?.mapsettings?.layers || initMapConfig
const { placeholder, disabled } = schema
const { addons, value, onChange, schema } = props
const { placeholder, disabled, parent } = schema
const [visible, setVisible] = useState(false)
const layersConifg = { layers: mapConfig }
let clickref = useRef(null)
......@@ -259,17 +260,22 @@ const Device = ({ addons, value, onChange, schema }) => {
}
const onOk = () => {
onChange(geometrystr)
// if (Array.isArray(paths)) {
// paths.forEach(v => {
// if (v.fileName === 'GIS编码' && gisInfo.layerName) {
// addons.setValue(v.path, gisInfo.gisCode)
// }
// if (v.fileName === 'GIS图层' && gisInfo.layerName) {
// addons.setValue(v.path, gisInfo.layerName)
// }
// })
// }
const { paths } = parent
if (Array.isArray(paths)) {
paths.forEach(v => {
let values = addons.getValue(v)
if (isObject(values)) {
for (let key in values) {
if (key === 'GIS编码' && gisInfo.gisCode) {
addons.setValue(`${v}.${key}`, gisInfo.gisCode)
}
if (key === 'GIS图层' && gisInfo.layerName) {
addons.setValue(`${v}.${key}`, gisInfo.layerName)
}
}
}
})
}
setVisible(false)
}
......
......@@ -7,7 +7,7 @@ const FieldNames = (props) => {
let fieldsStr = window.sessionStorage.getItem('designerRef') || ''
let fields = fieldsStr.split(',') || []
const { value, onChange, addons } = props
const { tableNameParent, name } = addons.formData
const { parent, name } = addons.formData
const [fieldName, setFieldName] = useState([])
const options = useMemo(() => {
......@@ -27,10 +27,10 @@ const FieldNames = (props) => {
}
const onFocus = async () => {
if (!tableNameParent) {
if (!parent.tableName) {
return message.info('缺少表名!')
}
const { data } = await ReloadTableFields({ tableName: tableNameParent })
const { data } = await ReloadTableFields({ tableName: parent.tableName })
if (Array.isArray(data.root)) {
setFieldName(data.root)
}
......
......@@ -9,7 +9,7 @@ const { TreeNode } = TreeSelect
const Fieldshine = (props) => {
const { addons, onChange, value } = props
const { $id, accountName, tableNameParent } = addons.formData
const { $id, accountName, parent } = addons.formData
const [form] = Form.useForm()
const [visible, setVisible] = useState(false)
......@@ -40,7 +40,7 @@ const Fieldshine = (props) => {
return message.info('请选择台账名称')
}
const req1 = QueryFields(accountName)
const req2 = ReloadTableFields({ tableName: tableNameParent })
const req2 = ReloadTableFields({ tableName: parent.tableName })
const [res1, res2] = await Promise.all([req1, req2])
if (res1.code === 0) {
if (Array.isArray(res1.data)) {
......
......@@ -9,7 +9,7 @@ const { TreeNode } = TreeSelect
const MappedField = (props) => {
const { value, onChange, schema, addons } = props
const { accountName, tableNameParent } = addons.formData
const { accountName, parent } = addons.formData
const [form] = Form.useForm()
const [visible, setVisible] = useState(false)
const [fromField, setFromField] = useState([])
......@@ -20,7 +20,7 @@ const MappedField = (props) => {
message.info('请选择台账名称')
}
const req1 = QueryFields(accountName)
const req2 = ReloadTableFields({ tableName: tableNameParent })
const req2 = ReloadTableFields({ tableName: parent.tableName })
const [res1, res2] = await Promise.all([req1, req2])
if (res1.code === 0) {
setToField(res1.data)
......
......@@ -3,19 +3,46 @@ import { Input, Popover, ConfigProvider } from 'antd'
import { QrcodeOutlined } from '@ant-design/icons'
import QRcode from 'qrcode.react'
import './index.less'
import moment from 'moment'
function toUtf8(str) {
let out = ''
for (let i = 0; i < str.length; i++) {
let c = str.charCodeAt(i)
if (c >= 0x0001 && c <= 0x007f) {
out += str.charAt(i);
} else if (c > 0x07ff) {
out += String.fromCharCode(0xe0 | ((c >> 12) & 0x0f));
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3f));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3f));
} else {
out += String.fromCharCode(0xc0 | ((c >> 6) & 0x1f));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3f));
}
}
console.log('out', out)
return out;
}
const Coding = (props) => {
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext)
const prefixCls = getPrefixCls('pandaXform')
const { value, onChange, schema, addons } = props
const { disabled } = schema
const { value, onChange, schema } = props
const { disabled, prefixion, codingType } = schema
const inputChange = (e) => {
if (addons) {
onChange(e.target.value)
}
}
// useEffect(() => {
// let date = ''
// if (codingType === '1') {
// date = moment().format('YYYY')
// } else if (codingType === '2') {
// date = moment().format('YYYYMM')
// }
// let code = toUtf8(tableNameParent)
// let codeValue = `${prefixion ? `${prefixion}-` : ''}${date ? `${date}-` : date}${code}`
// console.log('value', value, code)
// onChange(codeValue)
// }, [prefixion, codingType])
const content = (
<div>
......@@ -26,7 +53,8 @@ const Coding = (props) => {
return (
<div className={`${prefixCls}-input`} isdisabled={JSON.stringify(disabled)}>
<Input
onChange={inputChange}
// onChange={inputChange}
value={value}
disabled={disabled}
addonAfter={
<Popover content={content}>
......
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