Commit e51a9e27 authored by 彭俊龙's avatar 彭俊龙

区域到位组件新增默认范围

parent 07f4fb30
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "6.11.08", "version": "6.11.14",
"description": "6.11.08 关联表单行内支持数据复制、多选支持搜索", "description": "6.11.14 区域到位组件新增默认范围",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -5,6 +5,7 @@ const { REACT_APP_ENV } = process.env; ...@@ -5,6 +5,7 @@ const { REACT_APP_ENV } = process.env;
/** @Tips: 新版接口,逐步替换老版接口 2021年12月1日 */ /** @Tips: 新版接口,逐步替换老版接口 2021年12月1日 */
const BASE = '/PandaWorkFlow/WorkFlow'; const BASE = '/PandaWorkFlow/WorkFlow';
const BASEGIS = '/PandaGIS/MapServer';
const BASEURL = '/PandaWorkFlow/WorkFlow/AccountManage'; const BASEURL = '/PandaWorkFlow/WorkFlow/AccountManage';
const YOURSELFER_SERVER = 'http://127.0.0.1:8181'; const YOURSELFER_SERVER = 'http://127.0.0.1:8181';
const url = (REACT_APP_ENV || 'dev') !== 'dev' ? `${YOURSELFER_SERVER}/${BASEURL}` : `${window.location.origin}${BASEURL}`;// 新版的链接 const url = (REACT_APP_ENV || 'dev') !== 'dev' ? `${YOURSELFER_SERVER}/${BASEURL}` : `${window.location.origin}${BASEURL}`;// 新版的链接
...@@ -867,3 +868,23 @@ export function GetFieldValueByTableName({params, data}) { ...@@ -867,3 +868,23 @@ export function GetFieldValueByTableName({params, data}) {
data data
}) })
} }
export function CalculatePointToSurfaceDistance(data) {
return request(`${BASE}/Common/CalculatePointToSurfaceDistance` , {
method: "POST",
data
})
}
export function LayerSetting() {
return request(`${BASEGIS}/MapLayer/LayerSetting?client=sandbox` , {
method: "get"
})
}
export function GetMapArea(params) {
return request(`${BASEGIS}/Export/GetMapArea` , {
method: "get",
params
})
}
...@@ -185,6 +185,10 @@ const widgetData = { ...@@ -185,6 +185,10 @@ const widgetData = {
name: '自定义地图', name: '自定义地图',
type: 'GIS控件', type: 'GIS控件',
}, },
'PunchInMap': {
name: '区域到位',
type: 'GIS控件',
},
'RelationForm': { 'RelationForm': {
name: '关联表单', name: '关联表单',
type: '高级控件', type: '高级控件',
......
...@@ -290,7 +290,7 @@ const ValueEdit = (props) => { ...@@ -290,7 +290,7 @@ const ValueEdit = (props) => {
if (v.fields.includes(fieldName)) { if (v.fields.includes(fieldName)) {
let values = v.fields.map(s => { let values = v.fields.map(s => {
if (s === fieldName) { if (s === fieldName) {
filedFormulas = v.filedFormulas.map(x => x) filedFormulas = v.filedFormulas
return { fieldName, fieldValue: value } return { fieldName, fieldValue: value }
} }
return { fieldName: s, fieldValue: record?.[s] || '' } return { fieldName: s, fieldValue: record?.[s] || '' }
...@@ -331,7 +331,7 @@ const ValueEdit = (props) => { ...@@ -331,7 +331,7 @@ const ValueEdit = (props) => {
if (v.fields.includes(fieldName)) { if (v.fields.includes(fieldName)) {
let values = v.fields.map(s => { let values = v.fields.map(s => {
if (s === fieldName) { if (s === fieldName) {
filedFormulas = v.filedFormulas.map(x => x) filedFormulas = v.filedFormulas
return { fieldName, fieldValue: value !== null ? `${value}` : '' } return { fieldName, fieldValue: value !== null ? `${value}` : '' }
} }
return { fieldName: s, fieldValue: record?.[s] || '' } return { fieldName: s, fieldValue: record?.[s] || '' }
......
...@@ -30,7 +30,7 @@ const TablePack = (props, ref) => { ...@@ -30,7 +30,7 @@ const TablePack = (props, ref) => {
})) }))
const { notUse, locale, config, fieldList, loading, dataSource, sourceChange, rowSelection, onRow, tableChange, btnsClick, isEdit } = props const { notUse, locale, config, fieldList, loading, dataSource, sourceChange, rowSelection, onRow, tableChange, btnsClick, isEdit } = props
const { accountFieids, webShowFieldGroup, formJson, parent } = config const { accountFieids, webShowFieldGroup, formJson, parent, filterObj } = config
const [fieldResize, setFieldResize] = useState({}) const [fieldResize, setFieldResize] = useState({})
const [filteredInfo, setFilteredInfo] = useState({}) const [filteredInfo, setFilteredInfo] = useState({})
const [sortedInfo, setSortedInfo] = useState({}) const [sortedInfo, setSortedInfo] = useState({})
...@@ -57,6 +57,11 @@ const TablePack = (props, ref) => { ...@@ -57,6 +57,11 @@ const TablePack = (props, ref) => {
let searchProps = {} let searchProps = {}
if (accurateSearch) { if (accurateSearch) {
if (['CheckBox', 'ComboBox', 'RadioButton'].includes(widget)) { if (['CheckBox', 'ComboBox', 'RadioButton'].includes(widget)) {
if(sourceType === '表数据' && filterObj[fieldName]){
searchProps = {
filters: filterObj[fieldName].map(v => { return { text: v, value: v, } }),
}
}
if (sourceType === '手动输入') { if (sourceType === '手动输入') {
searchProps = { searchProps = {
filters: options.map(v => { return { text: v.value, value: v.value, } }), filters: options.map(v => { return { text: v.value, value: v.value, } }),
...@@ -390,6 +395,7 @@ const TablePack = (props, ref) => { ...@@ -390,6 +395,7 @@ const TablePack = (props, ref) => {
filedFormulas: [ filedFormulas: [
{ {
fieldName: key, fieldName: key,
widget: item.widget,
formula: item.calculateRule formula: item.calculateRule
} }
] ]
......
...@@ -24,14 +24,14 @@ import { ...@@ -24,14 +24,14 @@ import {
DeleteTableDataInfo, DeleteTableDataInfo,
ExportAccountData, ExportAccountData,
ExportAccountModel, ExportAccountModel,
GetFieldValueFromTable
} from '../../apis/process'; } from '../../apis/process';
import { isJson, isObject } from '../../utils/index'; import { isJson, isObject, getFieldInfo } from '../../utils/index';
import exportStyle from './components/ExportTemplate/receipt.less'; import exportStyle from './components/ExportTemplate/receipt.less';
import html2canvas from 'html2canvas'; import html2canvas from 'html2canvas';
import jsPDF from 'jspdf'; import jsPDF from 'jspdf';
import { saveAs } from 'file-saver'; import { saveAs } from 'file-saver';
import FormRender from '../FormRender'; import FormRender from '../FormRender';
const initConfig = { const initConfig = {
accountFieids: [], accountFieids: [],
formJson: {}, formJson: {},
...@@ -324,11 +324,30 @@ const Account = (props, ref) => { ...@@ -324,11 +324,30 @@ const Account = (props, ref) => {
getDataSource({ ...values, pageIndex: 1, }); getDataSource({ ...values, pageIndex: 1, });
}; };
const getFilterObj = async (formJson, accountFieids) => {
let json = getFieldInfo(formJson)
let obj = {}
accountFieids.filter(v=> v.accurateSearch).forEach(async v => {
if (json[v.fieldName]) {
const { sourceType, fieldName, tableName } = json[v.fieldName]
if(sourceType === '表数据'){
const res = await GetFieldValueFromTable(tableName, fieldName)
if(res.code === 0){
obj[v.fieldName] = res.data
}
}
}
})
return obj
}
const getConfig = async ({ accountName }) => { const getConfig = async ({ accountName }) => {
setConfigLoading(true); setConfigLoading(true);
const { code, data, msg } = await GetAccountConfigInfo(accountName); const { code, data, msg } = await GetAccountConfigInfo(accountName);
if (code === 0) { if (code === 0) {
let config = { ...data, formJson: isJson(data.formJson) ? JSON.parse(data.formJson) : {} } let formJson = isJson(data.formJson) ? JSON.parse(data.formJson) : {};
const filterObj = await getFilterObj(formJson, data.accountFieids)
let config = { ...data, formJson, filterObj }
setConfig(config); setConfig(config);
setParams({ ...params, pageSize: data.pageSize || 20, accountName }); setParams({ ...params, pageSize: data.pageSize || 20, accountName });
//如果传入该值 //如果传入该值
......
...@@ -359,6 +359,11 @@ const baseWidgets = [ ...@@ -359,6 +359,11 @@ const baseWidgets = [
hidden: "{{formData.isHidden}}", hidden: "{{formData.isHidden}}",
dependencies: ['isHidden'], dependencies: ['isHidden'],
}, },
calculateRule: {
title: '计算规则',
type: 'string',
widget: 'CalculateRule',
},
presetValue: { presetValue: {
title: '默认值', title: '默认值',
type: 'string', type: 'string',
...@@ -4024,7 +4029,74 @@ const mapWidgets = [ ...@@ -4024,7 +4029,74 @@ const mapWidgets = [
default: "100%" default: "100%"
}, },
}, },
} },
{
text: '区域到位',
name: '区域到位',
icon: <IconPack.AreaTask />,
schema: {
title: '区域到位',
type: 'string',
widget: 'PunchInMap',
placeholder: '',
},
setting: {
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 75,
},
$id: {
title: '数据源',
type: 'string',
widget: 'FieldNames',
required: true,
},
title: {
title: '展示名称',
required: true,
type: 'string',
},
placeholder: {
title: '提示语',
type: 'string',
},
description: {
title: '字段说明',
type: 'string',
},
rings: {
title: '到位区域',
type: 'string',
description: '默认边界范围或手绘到位范围',
widget: 'DrawArea'
},
allowedLimit: {
title: '允许偏差范围(米)',
type: 'number',
description: '点位允许距离范围内的误差',
widget: 'number',
default: 0,
},
isValid: {
title: '开启距离校验',
type: 'boolean',
widget: 'SwitchDefault'
},
groupStyle: {
title: '控件样式',
type: 'object',
properties: {}
},
width: {
title: '控件占比',
type: 'string',
widget: 'RadioGroupW',
},
},
},
] ]
const advancedWidgets = [ const advancedWidgets = [
......
...@@ -124,6 +124,7 @@ const getFieldName = (configs, tableName) => { ...@@ -124,6 +124,7 @@ const getFieldName = (configs, tableName) => {
} }
const formAutomatic = async (params) => { const formAutomatic = async (params) => {
console.log('触发自动计算', params);
if ((new Date().getTime() - params.startTime) < 2000) return if ((new Date().getTime() - params.startTime) < 2000) return
let param = { let param = {
tableName: params.tableName, tableName: params.tableName,
...@@ -249,7 +250,7 @@ export const getWatch = ({ schema, form, startTime, initField, firstCall }) => { ...@@ -249,7 +250,7 @@ export const getWatch = ({ schema, form, startTime, initField, firstCall }) => {
let formValue = form?.getValues() let formValue = form?.getValues()
let { relationForm } = formValue let { relationForm } = formValue
const configs = relationForm?.configs || [] const configs = relationForm?.configs || []
const AutoCalculate = getWidgetInfo(schema, ['NumberInput', 'DateTime', 'Time', 'TextInput']) const AutoCalculate = getWidgetInfo(schema, ['NumberInput', 'DateTime', 'Time', 'TextInput', 'TextArea'])
const HiddenWidget = getHiddenWidget(schema) const HiddenWidget = getHiddenWidget(schema)
const RelevanceSelect = getWidgetInfo(schema, ['RelevanceSelect']) const RelevanceSelect = getWidgetInfo(schema, ['RelevanceSelect'])
if (Array.isArray(AutoCalculate)) { if (Array.isArray(AutoCalculate)) {
......
...@@ -403,13 +403,14 @@ const RelationForm = (props) => { ...@@ -403,13 +403,14 @@ const RelationForm = (props) => {
let autoArray = []; let autoArray = [];
Object.keys(json).forEach(key => { Object.keys(json).forEach(key => {
let item = json[key]; let item = json[key];
if (item.widget === 'NumberInput' && item.calculateRule) { if ((item.widget === 'NumberInput' || item.widget === 'DateTime') && item.calculateRule) {
let params = { let params = {
fields: item?.rules[0]?.fields, fields: item?.rules[0]?.fields,
tableName: item.tableNameParent, tableName: item.tableNameParent,
filedFormulas: [ filedFormulas: [
{ {
fieldName: key, fieldName: key,
widget: item.widget,
formula: item.calculateRule formula: item.calculateRule
} }
] ]
......
...@@ -28,6 +28,7 @@ const DrawArea = (props) => { ...@@ -28,6 +28,7 @@ const DrawArea = (props) => {
const viewRef = useRef(null) const viewRef = useRef(null)
const layers = useRef(null) const layers = useRef(null)
console.log('props区域绘制', props)
const createPaths = (view) => { const createPaths = (view) => {
setTimeout(() => { setTimeout(() => {
if (isJson(value)) { if (isJson(value)) {
...@@ -85,6 +86,13 @@ const DrawArea = (props) => { ...@@ -85,6 +86,13 @@ const DrawArea = (props) => {
getPoints(viewRef.current) getPoints(viewRef.current)
} }
const clear = ()=>{
if(viewRef.current){
viewRef.current.map.remove(layers.current)
setRings('')
}
}
const showMap = () => { const showMap = () => {
setVisible(true) setVisible(true)
} }
...@@ -94,7 +102,7 @@ const DrawArea = (props) => { ...@@ -94,7 +102,7 @@ const DrawArea = (props) => {
} }
const onOk = () => { const onOk = () => {
onChange(JSON.stringify(rings)) onChange(isObject(rings) ? JSON.stringify(rings) : '')
setVisible(false) setVisible(false)
} }
...@@ -178,12 +186,20 @@ const DrawArea = (props) => { ...@@ -178,12 +186,20 @@ const DrawArea = (props) => {
> >
<div style={{ height: '90%' }}> <div style={{ height: '90%' }}>
<Button <Button
style={{ position: 'absolute', zIndex: '99', right: '10px', top: '10px' }} style={{ position: 'absolute', zIndex: '99', right: '120px', top: '10px' }}
type='primary' type='primary'
onClick={start} onClick={start}
> >
开始绘制 开始绘制
</Button> </Button>
<Button
style={{ position: 'absolute', zIndex: '99', right: '10px', top: '10px' }}
type='primary'
danger
onClick={clear}
>
清除绘制
</Button>
<ArcGISSceneMap <ArcGISSceneMap
getMapInfo={getView} getMapInfo={getView}
widgets={[]} widgets={[]}
......
import React, { useState, useEffect, useRef } from 'react';
import { Input, Button, message } from 'antd';
import { CompassOutlined, DownOutlined, GlobalOutlined } from '@ant-design/icons';
import styles from './index.less';
import {
ArcGISSceneMap,
AutoCompleteSearch,
Drawtool as drawTool,
Graphic,
GraphicsLayer,
Point,
geomUtils,
SimpleLineSymbol,
SimpleFillSymbol,
} from '@wisdom-map/arcgismap';
import { cityCode } from '@wisdom-map/basemap'
import Drag from '../../../components/Drag';
import { CalculatePointToSurfaceDistance, GetMapArea, LayerSetting } from '../../../../apis/process';
import { isJson, isObject, mercatorToLngLat } from '../../../../utils';
const PunchInMap = props => {
const { schema, value, onChange, addons } = props;
const { rings, allowedLimit, disabled } = schema;
const [view, setView] = useState(null);
const [visible, setvisible] = useState(false);
const [currentInfo, setCurrentInfo] = useState(null);
let customFlagRef = useRef(null)
const layers = useRef(null);
const { token, client } = window.globalConfig;
//12734033.364702286,3560690.747976473
const getView = viewObj => {
setView(viewObj);
};
console.log(customFlagRef, rings, 'customFlagRefcustomFlagRef')
useEffect(() => {
if (view) {
if (value) {
renderLocaiton(value);
}
createPaths(view);
}
return () => {
if (view) {
layers.current && view.map.remove(layers.current);
layers.current = null;
let coordGetLayer = view.map.layers.find(layer => layer.id == 'coordGet');
coordGetLayer && view.map.remove(coordGetLayer);
}
};
}, [view]);
useEffect(() => {
console.log(rings, 'customFlagRef')
if (isJson(rings) && value) {
if(value){
calculatePointToSurfaceDistanceHandle(rings, value);
}
}
}, [rings]);
useEffect(()=>{
getLayerSetting()
}, [])
const getLayerSetting = async () => {
const { code, msg, data } = await LayerSetting();
if(code == 0){
const { areaName, customFlag, customPointExtent } = data.find(l => l.layerType = 'PipenetLayer');
customFlagRef.current = customFlag
if(!isJson(rings)){
if(customFlag && isJson(customPointExtent)){
const { geometry } = JSON.parse(customPointExtent);
const arr = geometry.map(v=> [v.x, v.y])
const jsonObj = {
rings: [arr]
}
addons.setSchemaByPath(addons.dataPath, { ...schema, rings: JSON.stringify(jsonObj) });
}else{
const adcode = cityCode.find(v => v.name == areaName)?.adcode;
if(adcode){
const res = await GetMapArea({ requestMap: 'pd_map', areaName: `${adcode}.json`, state: true, usage: 'gismap' });
const arr = res.features[0].geometry.coordinates;
const jsonObj = {
rings: arr
}
addons.setSchemaByPath(addons.dataPath, { ...schema, rings: JSON.stringify(jsonObj) });
}
}
}
}else{
message.error(msg);
}
}
const createGraphic = geometry => {
return new Graphic({
geometry: geometry,
symbol: {
type: 'picture-marker', // autocasts as new PictureMarkerSymbol()
url:
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAhCAYAAAA2/OAtAAAACXBIWXMAAArrAAAK6wGCiw1aAAAGlmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgNzkuZWRhMmIzZiwgMjAyMS8xMS8xNC0xMjozMDo0MiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8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0ije0C1jvA8sBbZ2tp2JeiQD9Ts9iL7kxhJjLTuq/rAYhXGO9ZjI/36C5J7gBbV4sOiD1zfVBk3nUJVQAyIB1hEPLS9bbAZr/SNAa5sqLQWeZI5RY2pn7vEMRsqAFekkPEM8Osh0WOpgzzYHaoqlFRuAcdNEFkHnCup4OC+zAKlOMpzQWSdAQgiew24XFbB1gcdxMox8O06p6X1pYCvHhB9JnWAtDdVqMIccLKedVuTHgVudAsD3j6ANWBTuQ1MBZFdafhb+m8Q2SJwtqJ7p1wHVoGXmoFtkTZF/I4Hr3sdqqGmUDXm/JvZk5eb3A5widO+PJxJDVQ2vvbQIGkrcUDVmGsXnn72lYrf9i26xEf3V+5E38Dmxo0j5ehVAV+JP6qGWWR1ZnT8zG/9A1tA1w7zE/c0VTWfjU8ur/T0XUyqyzvpzIWFo2MVVU3vsG5VXUuE5vP5Nedc5aPJqatbxhSbgVvGFD+cnFpwzqWbrNc5V3LOLebz+cqulROG4T9Hxx/rGVsvyeHKRs4hCPD7gw998N3g8B9N6d4Fbs3MzJTCMFSAjuUYhuFq7ang7+nlO6dQekRk7f3jU+9WxXiqWlbVn2dnZ5fCMGzp8Xtu65Hn/7jc3fv5kXL5zFJv38K65xtUi/Pz8zf3mttRFx8dmf4+4+kbk8dey+VyI/8J1lA2m03NDfR8m81mH/lfgA29N/pwbr9j77ctd/pn419SR9UArKBoRwAAAABJRU5ErkJggg==',
width: '20px',
height: '30px',
},
});
};
const renderLocaiton = value => {
let coordGetLayer = view.map.layers.find(layer => layer.id == 'coordGet');
if (coordGetLayer) {
view.map.remove(coordGetLayer);
} else {
coordGetLayer = new GraphicsLayer({
id: 'coordGet',
});
}
view.map.add(coordGetLayer);
coordGetLayer.removeAll();
const newVal = value.split(',');
const defalutGraphic = createGraphic(
new Point({
x: newVal[0],
y: newVal[1],
spatialReference: {
wkid: 3857,
},
}),
);
coordGetLayer.add(defalutGraphic);
setTimeout(() => {
view.goTo({
center: geomUtils.toGeometry({ x: Number(newVal[0]), y: Number(newVal[1]) }),
scale: view.scale - 1,
});
}, 2000);
};
const calculatePointToSurfaceDistanceHandle = (r, v) => {
const point = v.split(',');
const rings = JSON.parse(r).rings;
let data = {
point: { x: Number(point[0]), y: Number(point[1]) },
polygon: rings[0].map(xy => {
return {
x: Number(xy[0]),
y: Number(xy[1]),
};
}),
};
CalculatePointToSurfaceDistance(data).then(res => {
const { code, msg, data } = res;
if (code == 0) {
setCurrentInfo(data);
} else {
message.error(msg);
}
});
};
const createPaths = view => {
setTimeout(() => {
//customFlagRef.current = 1自定义绘制或者手绘customFlagRef.current = null 则渲染,否则行政边界坐标过多渲染影响性能
if (isJson(rings) && (!customFlagRef.current || customFlagRef.current == 1)) {
let layer = new Graphic({
geometry: geomUtils.toGeometry(JSON.parse(rings)),
symbol: new SimpleFillSymbol({}),
});
layers.current = new GraphicsLayer();
layers.current.add(layer);
view.map.add(layers.current);
}
}, 2000);
};
const cancelHandle = () => {
setvisible(false);
if (view && layers.current) {
view.map.remove(layers.current);
layers.current = null;
}
};
const getDistance = info => {
const { distance, isInPolygon } = info;
if (isInPolygon || (allowedLimit > 0 && distance <= allowedLimit)) {
return '已到位';
} else {
let num = 0;
if (distance > 1000) {
num = distance / 1000;
return `未到位,距离${num.toFixed(2)}千米`;
}
return `未到位,距离${distance.toFixed(2)}米`;
}
};
return (
<div>
<Input
disabled={disabled}
value={currentInfo ? getDistance(currentInfo) : ''}
placeholder="点击查看位置"
addonAfter={<GlobalOutlined onClick={()=> setvisible(true)}/>}
onClick={() => setvisible(true)}
/>
<Drag
visible={visible}
title="到位区域查看"
width={'80%'}
onCancel={cancelHandle}
cancelText={'取消'}
okText={'确定'}
bodyStyle={{ height: 600, overflowY: 'auto', position: 'relative' }}
destroyOnClose
footer={null}
>
<ArcGISSceneMap getMapInfo={getView} widgets={[]} token={token} client={token ? client : 'sandbox'} />
</Drag>
</div>
);
};
export default PunchInMap;
...@@ -5,6 +5,7 @@ import DrawArea from './DrawArea' ...@@ -5,6 +5,7 @@ import DrawArea from './DrawArea'
import AreaTask from './AreaTask' import AreaTask from './AreaTask'
import CustomMap from "./CustomMap"; import CustomMap from "./CustomMap";
import DataTable from "./DataTable"; import DataTable from "./DataTable";
import PunchInMap from "./PunchInMap";
const coord = { const coord = {
Coordinate, Coordinate,
...@@ -14,6 +15,7 @@ const coord = { ...@@ -14,6 +15,7 @@ const coord = {
AreaTask, AreaTask,
CustomMap, CustomMap,
DataTable, DataTable,
PunchInMap,
} }
export default coord export default coord
...@@ -6,15 +6,23 @@ import { urlRegExp } from '../../../../utils' ...@@ -6,15 +6,23 @@ import { urlRegExp } from '../../../../utils'
const TextArea = (props) => { const TextArea = (props) => {
const { value, onChange, schema, addons } = props const { value, onChange, schema, addons } = props
const { disabled, placeholder, presetValue, maxLength, rows } = schema const { disabled, placeholder, presetValue, maxLength, rows, otherValue } = schema
console.log(props, 'asdasdasdasd')
useEffect(() => { useEffect(() => {
if (addons) { if (addons) {
addons.setValueByPath(addons.dataPath, presetValue) addons.setValueByPath(addons.dataPath, presetValue)
} else { } else {
onChange(presetValue) onChange(presetValue)
} }
}, [presetValue]) }, [presetValue])
useEffect(() => {
if (otherValue) {
onChange(otherValue)
}
}, [otherValue])
const handleChange = (e) => { const handleChange = (e) => {
onChange(e.target.value) onChange(e.target.value)
......
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