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={[]}
......
This diff is collapsed.
...@@ -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,9 +6,10 @@ import { urlRegExp } from '../../../../utils' ...@@ -6,9 +6,10 @@ 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 {
...@@ -16,6 +17,13 @@ const TextArea = (props) => { ...@@ -16,6 +17,13 @@ const TextArea = (props) => {
} }
}, [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