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

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

parent 07f4fb30
{
"name": "panda-xform",
"version": "6.11.08",
"description": "6.11.08 关联表单行内支持数据复制、多选支持搜索",
"version": "6.11.14",
"description": "6.11.14 区域到位组件新增默认范围",
"keywords": [
"panda-xform"
],
......
......@@ -5,6 +5,7 @@ const { REACT_APP_ENV } = process.env;
/** @Tips: 新版接口,逐步替换老版接口 2021年12月1日 */
const BASE = '/PandaWorkFlow/WorkFlow';
const BASEGIS = '/PandaGIS/MapServer';
const BASEURL = '/PandaWorkFlow/WorkFlow/AccountManage';
const YOURSELFER_SERVER = 'http://127.0.0.1:8181';
const url = (REACT_APP_ENV || 'dev') !== 'dev' ? `${YOURSELFER_SERVER}/${BASEURL}` : `${window.location.origin}${BASEURL}`;// 新版的链接
......@@ -867,3 +868,23 @@ export function GetFieldValueByTableName({params, 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 = {
name: '自定义地图',
type: 'GIS控件',
},
'PunchInMap': {
name: '区域到位',
type: 'GIS控件',
},
'RelationForm': {
name: '关联表单',
type: '高级控件',
......
......@@ -290,7 +290,7 @@ const ValueEdit = (props) => {
if (v.fields.includes(fieldName)) {
let values = v.fields.map(s => {
if (s === fieldName) {
filedFormulas = v.filedFormulas.map(x => x)
filedFormulas = v.filedFormulas
return { fieldName, fieldValue: value }
}
return { fieldName: s, fieldValue: record?.[s] || '' }
......@@ -331,7 +331,7 @@ const ValueEdit = (props) => {
if (v.fields.includes(fieldName)) {
let values = v.fields.map(s => {
if (s === fieldName) {
filedFormulas = v.filedFormulas.map(x => x)
filedFormulas = v.filedFormulas
return { fieldName, fieldValue: value !== null ? `${value}` : '' }
}
return { fieldName: s, fieldValue: record?.[s] || '' }
......
......@@ -30,7 +30,7 @@ const TablePack = (props, ref) => {
}))
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 [filteredInfo, setFilteredInfo] = useState({})
const [sortedInfo, setSortedInfo] = useState({})
......@@ -57,6 +57,11 @@ const TablePack = (props, ref) => {
let searchProps = {}
if (accurateSearch) {
if (['CheckBox', 'ComboBox', 'RadioButton'].includes(widget)) {
if(sourceType === '表数据' && filterObj[fieldName]){
searchProps = {
filters: filterObj[fieldName].map(v => { return { text: v, value: v, } }),
}
}
if (sourceType === '手动输入') {
searchProps = {
filters: options.map(v => { return { text: v.value, value: v.value, } }),
......@@ -390,6 +395,7 @@ const TablePack = (props, ref) => {
filedFormulas: [
{
fieldName: key,
widget: item.widget,
formula: item.calculateRule
}
]
......
......@@ -24,14 +24,14 @@ import {
DeleteTableDataInfo,
ExportAccountData,
ExportAccountModel,
GetFieldValueFromTable
} from '../../apis/process';
import { isJson, isObject } from '../../utils/index';
import { isJson, isObject, getFieldInfo } from '../../utils/index';
import exportStyle from './components/ExportTemplate/receipt.less';
import html2canvas from 'html2canvas';
import jsPDF from 'jspdf';
import { saveAs } from 'file-saver';
import FormRender from '../FormRender';
const initConfig = {
accountFieids: [],
formJson: {},
......@@ -324,11 +324,30 @@ const Account = (props, ref) => {
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 }) => {
setConfigLoading(true);
const { code, data, msg } = await GetAccountConfigInfo(accountName);
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);
setParams({ ...params, pageSize: data.pageSize || 20, accountName });
//如果传入该值
......
......@@ -359,6 +359,11 @@ const baseWidgets = [
hidden: "{{formData.isHidden}}",
dependencies: ['isHidden'],
},
calculateRule: {
title: '计算规则',
type: 'string',
widget: 'CalculateRule',
},
presetValue: {
title: '默认值',
type: 'string',
......@@ -4024,7 +4029,74 @@ const mapWidgets = [
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 = [
......
......@@ -124,6 +124,7 @@ const getFieldName = (configs, tableName) => {
}
const formAutomatic = async (params) => {
console.log('触发自动计算', params);
if ((new Date().getTime() - params.startTime) < 2000) return
let param = {
tableName: params.tableName,
......@@ -249,7 +250,7 @@ export const getWatch = ({ schema, form, startTime, initField, firstCall }) => {
let formValue = form?.getValues()
let { relationForm } = formValue
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 RelevanceSelect = getWidgetInfo(schema, ['RelevanceSelect'])
if (Array.isArray(AutoCalculate)) {
......
......@@ -403,13 +403,14 @@ const RelationForm = (props) => {
let autoArray = [];
Object.keys(json).forEach(key => {
let item = json[key];
if (item.widget === 'NumberInput' && item.calculateRule) {
if ((item.widget === 'NumberInput' || item.widget === 'DateTime') && item.calculateRule) {
let params = {
fields: item?.rules[0]?.fields,
tableName: item.tableNameParent,
filedFormulas: [
{
fieldName: key,
widget: item.widget,
formula: item.calculateRule
}
]
......
......@@ -28,6 +28,7 @@ const DrawArea = (props) => {
const viewRef = useRef(null)
const layers = useRef(null)
console.log('props区域绘制', props)
const createPaths = (view) => {
setTimeout(() => {
if (isJson(value)) {
......@@ -85,6 +86,13 @@ const DrawArea = (props) => {
getPoints(viewRef.current)
}
const clear = ()=>{
if(viewRef.current){
viewRef.current.map.remove(layers.current)
setRings('')
}
}
const showMap = () => {
setVisible(true)
}
......@@ -94,7 +102,7 @@ const DrawArea = (props) => {
}
const onOk = () => {
onChange(JSON.stringify(rings))
onChange(isObject(rings) ? JSON.stringify(rings) : '')
setVisible(false)
}
......@@ -178,12 +186,20 @@ const DrawArea = (props) => {
>
<div style={{ height: '90%' }}>
<Button
style={{ position: 'absolute', zIndex: '99', right: '10px', top: '10px' }}
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={[]}
......
This diff is collapsed.
......@@ -5,6 +5,7 @@ import DrawArea from './DrawArea'
import AreaTask from './AreaTask'
import CustomMap from "./CustomMap";
import DataTable from "./DataTable";
import PunchInMap from "./PunchInMap";
const coord = {
Coordinate,
......@@ -14,6 +15,7 @@ const coord = {
AreaTask,
CustomMap,
DataTable,
PunchInMap,
}
export default coord
......@@ -6,9 +6,10 @@ import { urlRegExp } from '../../../../utils'
const TextArea = (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(() => {
if (addons) {
addons.setValueByPath(addons.dataPath, presetValue)
} else {
......@@ -16,6 +17,13 @@ const TextArea = (props) => {
}
}, [presetValue])
useEffect(() => {
if (otherValue) {
onChange(otherValue)
}
}, [otherValue])
const handleChange = (e) => {
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