Commit 2f6f368f authored by 彭俊龙's avatar 彭俊龙

feat:代码提交

parent e51a9e27
{
"name": "panda-xform",
"version": "6.11.14",
"description": "6.11.14 区域到位组件新增默认范围",
"version": "6.11.48",
"description": "6.11.48 设备选择组件支持有默认值时自动映射属性字段值",
"keywords": [
"panda-xform"
],
......
......@@ -610,6 +610,15 @@ export function placeAroundRelay(url) {
})
}
export function identify(url) {
return request({
url: `/PandaGIS/MapServer/Query/Data/Identify`,
method: 'get',
params: url
})
}
//获取表字段
export function LoadTableFields(paramas) {
return request({
......@@ -682,6 +691,20 @@ export function GetAreaLayerTaskData(data) {
})
}
//获取图层区域数据(多图层查询)
export function GetLayerDataAndMedia(data) {
return request({
headers: {
'Content-Type': 'application/json',
accept: 'text/plain',
'Server-Name': data?.mapServerName || localStorage.getItem('PipenetLayer') || '',
},
url: `/PandaGIS/MapServer/GIS/Query/GetLayerDataAndMedia`,
method: 'get',
params: data.params,
})
}
//获取多图层区域数据
export function GetManyLayerAreaData(data) {
return request({
......
......@@ -17,13 +17,13 @@ const SearchGroup = forwardRef((props, ref) => {
getQueryInfo,
}))
const { accountName, config, notUse, checkName, btnsClick, keys, fieldSearch } = props
const { accountName, config, notUse, checkName, btnsClick, keys, fieldSearch, defaultSearchInfo } = props
const { enableBatchOperation, enableImportExport, exportTemplateName, enablePrint, enableQuickSearch, enableTimeFilter, parent, accountFieids } = config
const [form] = Form.useForm()
const [searchLabel, setSearchLabel] = useState('快捷搜索')
const [dateArray, setDateArray] = useState([])
const [formatterStr, setFormatterStr] = useState('YYYY-MM-DD HH:mm:ss')
const [queryInfo, setQueryInfo] = useState({ info: '', timeFrom: '', timeTo: '' })
const [queryInfo, setQueryInfo] = useState({ info: defaultSearchInfo || '', timeFrom: '', timeTo: '' })
const searchShow = useMemo(() => {
return accountFieids.some(v => v.likeSearch)
}, [accountFieids])
......@@ -354,7 +354,10 @@ const SearchGroup = forwardRef((props, ref) => {
useEffect(() => {
setSearchLabel('快捷搜索')
}, [accountName])
if(defaultSearchInfo){
form.setFieldsValue({ info: defaultSearchInfo })
}
}, [accountName, defaultSearchInfo])
return (
<Row className={styles.controlRow}>
......
......@@ -63,10 +63,12 @@ const Account = (props, ref) => {
timeLimit,
getDeleted,
accountId,
defaultSearchInfo,
defaultType,
pageSizes,
isExportRelationForm,
isExportImage
isExportImage,
showDetailCallBack
} = props;
const userID = window?.globalConfig?.userInfo?.OID || 1;
let initParams = {
......@@ -78,7 +80,7 @@ const Account = (props, ref) => {
pageSize: 100,
timeFrom: '',
timeTo: '',
info: '',
info: defaultSearchInfo || '',
queryForm: [],
queryTable: [],
queryWheres: [],
......@@ -414,10 +416,18 @@ const Account = (props, ref) => {
};
const tableChange = (page, filters, sorter) => {
console.log(page, filters, sorter, 'tableChange');
let queryWheres = [];
let json = getFieldInfo(config.formJson)
let getType = (value, schema)=>{
if(schema && schema.sourceType === '表数据'){
return value.length > 1 ? '包括' : '等于'
}
return '模糊查询'
}
Object.keys(filters).forEach(k => {
if (filters[k]?.[0]) {
queryWheres.push({ field: k, type: '模糊查询', value: filters[k].join(',') });
queryWheres.push({ field: k, type: getType(filters[k], json[k]), value: filters[k].join(',') });
}
});
let param = {
......@@ -467,6 +477,10 @@ const Account = (props, ref) => {
}
}, []);
useEffect(() => {
showDetailCallBack && showDetailCallBack(detailShow)
},[detailShow])
const items = (
<Menu>
<Menu.Item onClick={() => toExcel('content', '单据')} icon={<FileExcelOutlined />}>
......@@ -641,6 +655,7 @@ const Account = (props, ref) => {
onChange={search}
btnsClick={btnsClick}
keys={keys}
defaultSearchInfo={defaultSearchInfo}
accountName={params.accountName}
config={config}
notUse={notUse}
......
......@@ -1948,6 +1948,15 @@ const baseWidgets = [
title: '字段说明',
type: 'string',
},
mobileShowType: {
title: '展示形式',
type: 'string',
description: '移动端展示专用',
widget: 'select',
enum: ['卡片', '列表'],
default: '',
enumNames: ['卡片', '列表'],
},
isHidden: {
title: '是否隐藏',
type: 'boolean',
......@@ -2008,14 +2017,14 @@ const baseWidgets = [
description: '开启后只显示自己所属站点数据',
},
autofill: {
title: '自动映射值',
title: '默认值自动映射',
name: '站点过滤',
type: 'boolean',
default: false,
displayType: 'row',
labelWidth: 110,
labelWidth: 160,
widget: 'BooleanSwitch',
description: '开启后会将台账中的值自动映射在表单中',
description: '开启后会将默认值作为台账查询条件将第一行数据映射到表单中',
},
isMultiple: {
title: '多选',
......@@ -3075,14 +3084,14 @@ const businessWidgets = [
description: '开启后只显示自己所属站点数据',
},
autofill: {
title: '自动映射值',
title: '默认值自动映射',
name: '站点过滤',
type: 'boolean',
default: false,
displayType: 'row',
labelWidth: 110,
labelWidth: 160,
widget: 'BooleanSwitch',
description: '开启后会将台账中的值自动映射在表单中',
description: '开启后会将默认值作为台账查询条件将第一行数据映射到表单中',
},
isMultiple: {
title: '多选',
......@@ -4071,7 +4080,7 @@ const mapWidgets = [
title: '到位区域',
type: 'string',
description: '默认边界范围或手绘到位范围',
widget: 'DrawArea'
widget: 'DrawMap'
},
allowedLimit: {
title: '允许偏差范围(米)',
......@@ -4085,6 +4094,28 @@ const mapWidgets = [
type: 'boolean',
widget: 'SwitchDefault'
},
required: {
title: '必填',
type: 'boolean',
default: false,
width: '50%',
},
isHidden: {
title: '是否隐藏',
type: 'boolean',
widget: 'IsHidden',
default: false,
displayType: 'row',
labelWidth: 80,
},
hiddenCondition: {
title: '隐藏条件',
type: 'string',
description: '所有形态默认显示',
widget: 'HiddenCondition',
hidden: "{{formData.isHidden}}",
dependencies: ['isHidden'],
},
groupStyle: {
title: '控件样式',
type: 'object',
......@@ -4341,7 +4372,8 @@ const advancedWidgets = [
props: {
options: [
{ label: '数据字典', value: '数据字典' },
{ label: '表数据', value: '表数据' }
{ label: '表数据', value: '表数据' },
{ label: '手动输入', value: '手动输入' },
]
}
},
......@@ -4350,7 +4382,7 @@ const advancedWidgets = [
type: 'string',
// required: true,
widget: 'FieldNames',
hidden: "{{formData.sourceType != '数据字典'}}",
hidden: "{{formData.sourceType != '数据字典' && formData.sourceType != '手动输入'}}",
dependencies: ['$id'],
},
dictionary: {
......@@ -4412,6 +4444,13 @@ const advancedWidgets = [
widget: 'FieldName',
dependencies: ['tableName'],
},
selectSource:{
title: '选择项',
hidden: '{{formData.sourceType !== "手动输入"}}',
type: 'string',
widget: 'DataSelect',
dependencies: ['fieldParent']
},
required: {
title: '必填',
type: 'boolean',
......@@ -4597,6 +4636,15 @@ const advancedWidgets = [
displayType: 'row',
labelWidth: 80,
},
mobileShowType: {
title: '展示形式',
type: 'string',
description: '移动端展示专用',
widget: 'select',
enum: ['卡片', '列表'],
default: '',
enumNames: ['卡片', '列表'],
},
hiddenCondition: {
title: '隐藏条件',
type: 'string',
......
......@@ -132,6 +132,8 @@ const FormDesigner = (props, ref) => {
if (data && typeof data === 'string' && Array.isArray(res.data.root)) {
setFieldName(res.data.root)
let json = getJSON(JSON.parse(data), res.data.root)
let { inError, outError, fields, newSchema } = getFields(json)
window.designer = fields
designerRef?.current?.setValue(json)
setSchema(json)
}
......@@ -335,8 +337,10 @@ const FormDesigner = (props, ref) => {
}
const onSchemaChange = (schema) => {
let { inError, outError, fields, newSchema } = getFields(schema)
window.designer = fields
console.log(schema, fields, 'schemaschema')
if (inError || outError) {
designerRef.current.setValue(newSchema)
}
......
......@@ -25,6 +25,7 @@ const getFormDataObj = (formData) => {
const RelationForm = (props) => {
console.log(props, '关联表单')
const userID = window?.globalConfig?.userInfo?.OID || 1
const fullName = window?.globalConfig?.userInfo?.fullName || ''
const codes = window?.pandaXform?.codes || { 工单编号: '', 事件编号: '', }
......
......@@ -229,6 +229,7 @@ const AccountSelector = (props) => {
}
const onOk = () => {
console.log(fieldshine, 'fieldshine');
if (fieldshine.length > 1) {
let row = dataSource.find(v => v.ID === keys[0]) || {};
Object.keys(addons.formData).forEach(child => {
......@@ -393,7 +394,10 @@ const AccountSelector = (props) => {
type: isMultiple && fieldshine.length === 1 ? 'checkbox' : 'radio',
selectedRowKeys: keys,
fixed: 'left',
onChange: (keys) => setKeys(keys)
onChange: (keys) => {
console.log(keys, 'keys');
setKeys(keys)
}
}}
onRow={record => ({
onClick: event => {
......
This diff is collapsed.
......@@ -8,19 +8,20 @@ import {
GraphicsLayer,
Graphic
} from '@wisdom-map/arcgismap'
import { getPipenetLayerAsync } from '@wisdom-map/basemap'
import point from './img/point.png'
import { isJson, isObject, mercatorToLngLat, lngmkt } from '../../../../utils'
import { getLocation, getLocationV5, GetAreaNameByCoordinate, placeAroundRelay } from '../../../../apis/process'
import { isJson, isObject, mercatorToLngLat, lngmkt, debounce } from '../../../../utils'
import { getLocation, getLocationV5, GetAreaNameByCoordinate, placeAroundRelay, identify, GetLayerList, GetLayerDataAndMedia } from '../../../../apis/process'
import Drag from '../../../components/Drag'
import styles from './index.less'
let geometrystr = ''
let geometrystr
let gisInfo = {}
let layer = 0
const Device = (props) => {
const { token, client } = window.globalConfig
const { token, client, mapsettings } = window.globalConfig
const { addons, value, onChange, schema } = props
const {
placeholder,
......@@ -41,8 +42,9 @@ const Device = (props) => {
const isSendQueryRef = useRef(false)
const getView = (mapObj, Map, extentInfos, layersInfo) => {
if (mapObj && layersInfo && !isSendQueryRef.current) {
setTimeout(() => {
if (mapObj && !isSendQueryRef.current) {
console.log(mapObj, Map, extentInfos, layersInfo, layerName, '地图方案信息');
setTimeout(async () => {
let gisCode = ''
let gisLayerName = ''
let values = addons?.getValues()
......@@ -60,7 +62,10 @@ const Device = (props) => {
}
})
}
if (mapObj) {
const mapInfo = await getPipenetLayerAsync({map: mapObj.map});
if(!mapInfo) return
view.current = mapObj
let arr = (value && value.split(',')) || []
let obj = (arr.length === 2) ? { point: { x: Number(arr[0]), y: Number(arr[1]) } } : {}
......@@ -74,6 +79,7 @@ const Device = (props) => {
clickref.current?.closetip()
clickref.current = null
}
clickref.current = new WorkFlowEquipmentQuery({
layerInfos: layersInfo,
view: view.current,
......@@ -121,11 +127,36 @@ const Device = (props) => {
}
})
}
}, 500)
}, 1000)
isSendQueryRef.current = true
}
}
const getGisData = ()=>{
let gisCode = ''
let gisLayerName = ''
let values = addons?.formData
console.log(values, 'sssss')
if (isObject(values)) {
Object.keys(values).forEach(key => {
if (isObject(values[key])) {
Object.keys(values[key]).forEach(k => {
if (k === 'GIS编码') {
gisCode = values[key][k] || ''
}
if (k === 'GIS图层') {
gisLayerName = values[key][k] || ''
}
})
}
})
}
return {
gisCode,
gisLayerName
}
}
const getMapInfo = (mapObj, Map) => {
let gisCode = ''
let gisLayerName = ''
......@@ -144,8 +175,10 @@ const Device = (props) => {
}
})
}
setTimeout(() => {
setTimeout(async () => {
if (mapObj) {
const mapInfo = await getPipenetLayerAsync({map: mapObj.map});
if(!mapInfo) return
view.current = mapObj
let arr = (value && value.split(',')) || []
let obj = (arr.length === 2) ? { point: { x: Number(arr[0]), y: Number(arr[1]) } } : {}
......@@ -204,7 +237,7 @@ const Device = (props) => {
}
})
}
}, 500)
}, 1000)
}
const iconClick = () => {
......@@ -311,41 +344,43 @@ const Device = (props) => {
}
const onOk = () => {
onChange(geometrystr)
let { paths } = addons.getSchemaByPath('#')
if (Array.isArray(paths)) {
paths.forEach(v => {
let values = addons.getValue(v)
if (isObject(values)) {
console.log(values, props, '设备选择')
for (let key in values) {
if (Array.isArray(fieldshine) && fieldshine.length) {
fieldshine.forEach(item => {
if (item.toField === key && gisInfo?.[item.fromField]) {
if (item.toField === key) {
const schema = addons.getSchemaByPath(`${v}.${key}`);
if (['FileUpload', 'TextInput'].includes(schema.widget)) {
addons.setSchemaByPath(`${v}.${key}`, { ...schema, otherValue: gisInfo?.[item?.fromField] });
addons.setSchemaByPath(`${v}.${key}`, { ...schema, otherValue: gisInfo?.[item?.fromField] || '' });
} else if (['NumberInput'].includes(schema.widget)) {
addons.setValueByPath(`${v}.${key}`, gisInfo?.[item?.fromField] + '')
addons.setValueByPath(`${v}.${key}`, gisInfo?.[item?.fromField] || 0 + '')
} else {
addons.setValueByPath(`${v}.${key}`, gisInfo?.[item?.fromField])
addons.setValueByPath(`${v}.${key}`, gisInfo?.[item?.fromField] || '')
}
}
})
}
if (key === 'GIS编码' && gisInfo.gisCode) {
if (key === 'GIS编码') {
const schema = addons.getSchemaByPath(`${v}.${key}`);
if (['FileUpload', 'TextInput'].includes(schema.widget)) {
addons.setSchemaByPath(`${v}.${key}`, { ...schema, otherValue: gisInfo.gisCode });
addons.setSchemaByPath(`${v}.${key}`, { ...schema, otherValue: gisInfo.gisCode || '' });
} else {
addons.setValueByPath(`${v}.${key}`, gisInfo.gisCode)
addons.setValueByPath(`${v}.${key}`, gisInfo.gisCode || '')
}
}
if (key === 'GIS图层' && gisInfo.layerName) {
if (key === 'GIS图层') {
const schema = addons.getSchemaByPath(`${v}.${key}`);
if (['FileUpload', 'TextInput'].includes(schema.widget)) {
addons.setSchemaByPath(`${v}.${key}`, { ...schema, otherValue: gisInfo.layerName });
addons.setSchemaByPath(`${v}.${key}`, { ...schema, otherValue: gisInfo.layerName || '' });
} else {
addons.setValueByPath(`${v}.${key}`, gisInfo.layerName)
addons.setValueByPath(`${v}.${key}`, gisInfo.layerName || '')
}
}
}
......@@ -366,6 +401,9 @@ const Device = (props) => {
if (addons) {
if (presetValue) {
geometrystr = presetValue
setTimeout(() => {
renderData(presetValue)
}, 500);
}
addons.setValueByPath(addons.dataPath, presetValue)
} else {
......@@ -379,6 +417,28 @@ const Device = (props) => {
}
}, [disabled, screenShot])
const renderData = (val)=>{
const layer = mapsettings.layers.find(v=> v.layerType == 'PipenetLayer')
if(!layer) return;
const { id } = layer;
const { gisCode, gisLayerName } = getGisData();
console.log({ gisCode, gisLayerName }, props, '默认值映射阀门数据')
if(!gisCode || !gisLayerName) return;
GetLayerDataAndMedia({
mapServerName: id,
params: {
layerName:gisLayerName,
gisCode
}
}).then(res=> {
if(res.code == 0){
const { layerName, code, attrbutdata } = res.data.coordinate
gisInfo = { layerName: layerName, gisCode: code, ...attrbutdata }
onOk();
}
})
}
if (screenShot && disabled && addons) {
return (
<div className={styles.deviceShot}>
......@@ -395,7 +455,7 @@ const Device = (props) => {
</div>
<div className={styles.mapBox} style={{ height: put ? '208px' : '0px' }}>
<ArcGISSceneMap
getMapInfo={getMapInfo}
getMapInfo={debounce(getMapInfo)}
widgets={[]}
token={token}
client={token ? client : 'sandbox'}
......@@ -442,7 +502,7 @@ const Device = (props) => {
{...disabled ? { footer: null } : {}}
>
<ArcGISSceneMap
getMapInfo={getView}
getMapInfo={debounce(getView)}
widgets={[]}
token={token}
client={token ? client : 'sandbox'}
......
......@@ -30,7 +30,6 @@ const PunchInMap = props => {
const getView = viewObj => {
setView(viewObj);
};
console.log(customFlagRef, rings, 'customFlagRefcustomFlagRef')
useEffect(() => {
if (view) {
if (value) {
......
......@@ -35,7 +35,9 @@ const ComboBox = (props) => {
console.log(props, 'propssssss')
if (addons) {
if (sourceType === '站点') {
setTimeout(() => {
getStation(presetValue)
}, 10);
}
if(sourceType === '数据字典' && dictionary && saveVal){
getDictionaryItemList(dictionary)
......
import React, { useEffect, useRef, useState } from 'react';
import { Button, Select, message, Modal, Input, Space } from 'antd';
import { LoadTableV2, LoadTableFields, ReloadTableFields } from '../../../../../apis/process';
import { isArray, isObject } from '../../../../../utils';
const { TextArea } = Input;
const DataSelect = props => {
console.log(props, '关联选择数据导入');
const { value, onChange, addons } = props;
const { tableName, tableNameParent, fieldParent } = addons.formData;
const [options, setOptions] = useState([]);
const [parentOptions, setParentOptions] = useState([]);
const [showType, setShowType] = useState('');
const [visible, setVisible] = useState(false);
const [text, setText] = useState('');
const [pSelectVal, setPSelectVal] = useState('')
const [selectVal, setSelectVal] = useState([])
let currentVals = useRef([])
let parentVals = useRef([])
useEffect(()=>{
if(value){
const objList = JSON.parse(value)
currentVals.current = objList
setOptions(objList.map(v=> {
return {
label: v.value,
value: v.value
}
}))
setText(objList.map(v=> v.value).join('\n'))
}
}, [value])
useEffect(()=>{
if(fieldParent){
console.log(getParentSchema(fieldParent), 'getParentSchema(fieldParent)')
getParentSource(fieldParent)
}
}, [fieldParent])
const getParentSource = (fieldName)=>{
const schema = getParentSchema(fieldName)
if(schema){
const { selectSource } = schema;
const arr= JSON.parse(selectSource)
parentVals.current = arr
if(isArray(arr)){
setParentOptions(arr.map(v=> {
return {
label: v.value,
value: v.value
}
}))
}
}
}
const getParentSchema = (fieldName) => {
if(!window.designer) return null;
return window.designer.find(v=> v.fieldName === fieldName)
}
const handleClick = (type)=>{
if(type === 'config' && !fieldParent){
message.warn('请先选择父字段名!')
return;
}
setShowType(type)
setVisible(true)
}
const textInput = (e)=>{
setText(e.target.value)
}
const onOk = ()=>{
if(showType === 'import'){
const currentArr = text.split('\n')
const arr = currentArr.filter((item, index) => currentArr.indexOf(item) === index && item);
if(currentVals.current.length > 0){//如果已有值则追加
let objList= currentVals.current
objList = objList.filter(v=> arr.includes(v.value))
objList = [
...objList,
...(arr.filter(v=> !objList.map(x=> x.value).includes(v)).map(v=> {
return {
value: v,
parent: []
}
}))
]
currentVals.current = objList
onChange(JSON.stringify(objList))
}else{
const arr1 = arr.map(v=> {
return {
value: v,
parent: []
}
})
currentVals.current = arr1
onChange(JSON.stringify(arr1))
}
}else{
console.log(currentVals, 'currentVals')
onChange(JSON.stringify(currentVals.current))
}
setVisible(false)
setPSelectVal('')
setSelectVal([])
}
const handleSelect = (e)=>{
if(Array.isArray(e)){//子级
setSelectVal(e)
if(e.length > 0){
currentVals.current.forEach(v=> {
if(v.parent.includes(pSelectVal)){//找到关联了父级的子选项
if(!e.includes(v.value)){//如果子选项不存在则剔除父级
v.parent = v.parent.filter(x=> x !== pSelectVal)
}
}
if(e.includes(v.value)){
if(!v.parent.includes(pSelectVal)){
v.parent.push(pSelectVal)
}
}
})
}else{
currentVals.current.forEach(v=> {
if(v.parent.includes(pSelectVal)){
v.parent = v.parent.filter(x=> x !== pSelectVal)
}
})
}
}else{
setPSelectVal(e)
const vals = currentVals.current.filter(v=> v.parent.includes(e)).map(v=> v.value)
setSelectVal(vals)
}
}
const handleClose = ()=>{
setVisible(false)
setPSelectVal('')
setSelectVal([])
}
return (
<>
<Select options={options} placeholder={options.length ? '已配置' : ''}></Select>
<Button type={'link'} onClick={() => handleClick('import')}>
数据导入
</Button>
<Button type={'link'} onClick={() => handleClick('config')}>联动配置</Button>
<Modal title={showType === 'import' ? '数据导入' : '父子级联动'} visible={visible} onCancel={handleClose} onOk={onOk} destroyOnClose>
{showType === 'import' && (
<div>
<p>数据源批量导入,一条数据独占一行</p>
<TextArea value={text} rows={6} onChange={textInput}></TextArea>
</div>
)}
{showType === 'config' && (
<Space>
<span>父级选项:</span>
<Select value={pSelectVal} onChange={handleSelect} options={parentOptions} style={{ width: '120px' }}></Select>
<span>子级选项:</span>
<Select value={selectVal} mode={'multiple'} maxTagCount={2} onChange={handleSelect} style={{ width: '160px' }} options={pSelectVal.length && options}></Select>
</Space>
)}
</Modal>
</>
);
};
export default DataSelect;
import React, { useState, useEffect, useRef } from 'react'
import { Input, Button } from 'antd'
import { CompassOutlined, DownOutlined } 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 Drag from '../../../../components/Drag'
import { isJson, isObject, mercatorToLngLat } from '../../../../../utils'
const DrawMap = (props) => {
const { token, client } = window.globalConfig
const { value, onChange, schema, addons } = props
const { disabled, placeholder, presetValue, addressSync, screenShot } = schema
const [visible, setVisible] = useState(false)
const [rings, setRings] = useState({})
const [text, setText] = useState(presetValue ? '已绘制' : '(空)')
const [put, setPut] = useState(true)
const viewRef = useRef(null)
const layers = useRef(null)
console.log('props区域绘制111111', props)
const createPaths = (view) => {
setTimeout(() => {
if (isJson(value)) {
layers.current && view.map.remove(layers.current)
let layer = new Graphic({
geometry: geomUtils.toGeometry(JSON.parse(value)),
symbol: new SimpleFillSymbol({
}),
})
layers.current = new GraphicsLayer()
layers.current.add(layer)
view.map.add(layers.current)
}
}, 2000)
}
const getView = (viewObject) => {
setRings(isJson(value) ? JSON.parse(value) : '')
viewRef.current = viewObject
createPaths(viewObject)
}
const getMapInfo = (viewObject) => {
setRings(isJson(value) ? JSON.parse(value) : '')
viewRef.current = viewObject
createPaths(viewObject)
}
const getPoints = (view) => {
if (view) {
view.map.remove(layers.current)
drawTool.activate({
view,
action: 'polygon',
target: 'erroSendUpWidget',// 随便写
toolTip: '左键选择位置',
drawEnd: geometry => {
setRings({ rings: geometry.rings })
let layer = new Graphic({
geometry: geometry,
symbol: new SimpleFillSymbol({
}),
})
layers.current = new GraphicsLayer()
layers.current.add(layer)
view.map.add(layers.current)
},
// rightClick: () => { getPoints(view, coordGetLayer) }
})
}
}
const start = () => {
getPoints(viewRef.current)
}
const clear = ()=>{
if(viewRef.current){
viewRef.current.map.remove(layers.current)
setRings('')
}
}
const showMap = () => {
setVisible(true)
}
const onCancel = () => {
setVisible(false)
}
const onOk = () => {
onChange(isObject(rings) ? JSON.stringify(rings) : '')
setVisible(false)
}
useEffect(() => {
if (addons) {
addons.setValueByPath(addons.dataPath, presetValue)
} else {
onChange(presetValue)
}
}, [presetValue])
useEffect(()=>{
if(isObject){
if (addons) {
addons.setValueByPath(addons.dataPath, value)
} else {
onChange && onChange(value)
}
}
}, [value])
useEffect(() => {
if (disabled && screenShot) {
addons?.setSchemaByPath(addons.dataPath, { ...schema, width: '67%' })
}
}, [disabled, screenShot])
if (screenShot && disabled && addons) {
return (
<div className={styles.drawAreaShot}>
<div className={styles.content}>
<div className={styles.top}>
<div className={styles.text}>{text}</div>
<div
className={styles.icon}
onClick={() => setPut(!put)}
style={{ transform: `rotate(${put ? 0 : 180}deg)` }}
>
<DownOutlined />
</div>
</div>
<div className={styles.mapBox} style={{ height: put ? '208px' : '0px' }}>
<ArcGISSceneMap
getMapInfo={getMapInfo}
widgets={[]}
token={token}
client={token ? client : 'sandbox'}
/>
</div>
</div>
</div>
)
}
return (
<div>
{
!disabled ?
<Input
disabled={disabled}
placeholder={disabled ? (placeholder || '') : (placeholder || '点击绘制区域')}
value={isJson(value) ? '已绘制' : ''}
addonAfter={disabled ? null : <CompassOutlined style={{ color: 'rgba(0, 0, 0, 0.25)' }} onClick={showMap} />}
style={{ width: '100%' }}
onClick={showMap}
/>
:
<Button
icon={<CompassOutlined style={{ color: value ? '#0092fe' : 'rgba(0, 0, 0, 0.25)' }} />}
onClick={() => {
if (value) {
showMap()
}
}}
>
{value ? '查看区域' : '无区域信息'}
</Button>
}
<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%' }}>
<Button
style={{ position: 'absolute', zIndex: '99', right: '120px', top: '10px' }}
type='primary'
onClick={start}
>
开始绘制
</Button>
<Button
style={{ position: 'absolute', zIndex: '99', right: '10px', top: '10px' }}
type='primary'
danger
onClick={clear}
>
清除绘制
</Button>
<ArcGISSceneMap
getMapInfo={getView}
widgets={[]}
token={token}
client={token ? client : 'sandbox'}
/>
</div>
</Drag>
</div >
)
}
export default DrawMap
\ No newline at end of file
.drawAreaShot {
width: 100%;
border: 1px solid #ccc;
.content {
width: 100%;
.top {
padding: 0 10px;
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
height: 40px;
color: #727272;
.icon {
transition: all 0.5s ease-in-out;
&:hover {
cursor: pointer;
}
}
}
.mapBox {
position: relative;
width: 100%;
height: 208px;
overflow: hidden;
transition: all 0.5s ease-in-out;
}
}
}
\ No newline at end of file
......@@ -25,7 +25,8 @@ import TimeInterval from "./TimeInterval";
import DeviceType from "./DeviceType";
import OptionRender from "./OptionRender";
import StatusOption from "./StatusOption";
import DrawMap from './DrawMap'
import DataSelect from './DataSelect'
const groupSource = {
Dictionary,
AccountName,
......@@ -53,7 +54,9 @@ const groupSource = {
TimeInterval,
DeviceType,
OptionRender,
StatusOption
StatusOption,
DrawMap,
DataSelect
}
export default groupSource
......@@ -7,7 +7,6 @@ const TextArea = (props) => {
const { value, onChange, schema, addons } = props
const { disabled, placeholder, presetValue, maxLength, rows, otherValue } = schema
console.log(props, 'asdasdasdasd')
useEffect(() => {
if (addons) {
......
......@@ -29,7 +29,6 @@ const debounce = (fn) => {
}
const TextInput = (props) => {
const preview = sessionStorage.getItem('FormRender')
const userInfo = preview === 'preview' ? initUserInfo : window?.globalConfig?.userInfo || initUserInfo
const { value, onChange, schema, addons } = props
......@@ -108,7 +107,7 @@ const TextInput = (props) => {
}
}
//编辑状态下需要被覆盖
if (loaclPaths.includes(textDefalut) && !disabled) {
if (loaclPaths.includes(textDefalut) && !disabled && !presetValue) {
valueNext = getValueNext()
}
addons.setValue(addons.dataPath, valueNext || '')
......@@ -150,7 +149,7 @@ const TextInput = (props) => {
}, [uniqueVerify, tableName, fieldName])
useEffect(() => {
if (otherValue) {
if (otherValue || (!otherValue && otherValue !== showValue)) {
setShowValue(otherValue)
onChange(otherValue)
}
......
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