Commit 49e0265b authored by 田翔's avatar 田翔

feat: 区域任务优化

parent 991d2820
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "6.7.1", "version": "6.7.2",
"description": "6.7.1 区域任务增加前端显示字段配置", "description": "6.7.2 区域任务优化",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -650,6 +650,20 @@ export function GetAreaLayerTaskData(data) { ...@@ -650,6 +650,20 @@ export function GetAreaLayerTaskData(data) {
}) })
} }
//
export function GetCaseGISAreaData(data) {
return request({
headers: {
'Content-Type': 'application/json',
accept: 'text/plain',
'Server-Name': data?.mapServerName || localStorage.getItem('PipenetLayer') || '',
},
url: `PandaGIS/MapServer/GIS/Query/GetCaseGISAreaData`,
method: 'get',
params: data,
})
}
//通过图层获取字段 //通过图层获取字段
export function GetLayerFields({ mapServer, layerName }) { export function GetLayerFields({ mapServer, layerName }) {
return request({ return request({
......
...@@ -15,7 +15,13 @@ import { ...@@ -15,7 +15,13 @@ import {
} from '@wisdom-map/arcgismap' } from '@wisdom-map/arcgismap'
import Drag from '../../../components/Drag' import Drag from '../../../components/Drag'
import { isJson, isObject, getNanoid, mercatorToLngLat } from '../../../../utils' import { isJson, isObject, getNanoid, mercatorToLngLat } from '../../../../utils'
import { FetchAreaList, GetAreaLayerTaskData, GetAccountConfigInfo, GetAccountPageList } from '../../../../apis/process' import {
FetchAreaList,
GetAreaLayerTaskData,
GetAccountConfigInfo,
GetAccountPageList,
GetCaseGISAreaData,
} from '../../../../apis/process'
const getRings = (rings) => { const getRings = (rings) => {
rings = rings.map(ring => { rings = rings.map(ring => {
...@@ -31,6 +37,7 @@ const getRings = (rings) => { ...@@ -31,6 +37,7 @@ const getRings = (rings) => {
const AreaTask = (props) => { const AreaTask = (props) => {
console.log('props', props)
const codes = window?.pandaXform?.codes || { 工单编号: '', 事件编号: '', } const codes = window?.pandaXform?.codes || { 工单编号: '', 事件编号: '', }
const userID = window?.globalConfig?.userInfo?.OID || 1; const userID = window?.globalConfig?.userInfo?.OID || 1;
const { token, client } = window.globalConfig const { token, client } = window.globalConfig
...@@ -40,12 +47,15 @@ const AreaTask = (props) => { ...@@ -40,12 +47,15 @@ const AreaTask = (props) => {
disabled, disabled,
placeholder, placeholder,
presetValue, presetValue,
tableName,
tableNameParent,
addressSync, addressSync,
screenShot, screenShot,
service, service,
layerName, layerName,
areaTaskShine, areaTaskShine,
accountName, accountName,
fieldList,
} = schema } = schema
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const [rings, setRings] = useState({}) const [rings, setRings] = useState({})
...@@ -57,6 +67,7 @@ const AreaTask = (props) => { ...@@ -57,6 +67,7 @@ const AreaTask = (props) => {
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
const [config, setConfig] = useState({ accountFieids: [], formJson: '' }) const [config, setConfig] = useState({ accountFieids: [], formJson: '' })
const { accountFieids, formJson } = config const { accountFieids, formJson } = config
const [isGIS, setIsGIS] = useState(false)
const [dataSource, setDataSource] = useState([]) const [dataSource, setDataSource] = useState([])
const [layerCount, setLayerCount] = useState([]) const [layerCount, setLayerCount] = useState([])
const viewRef = useRef(null) const viewRef = useRef(null)
...@@ -100,19 +111,15 @@ const AreaTask = (props) => { ...@@ -100,19 +111,15 @@ const AreaTask = (props) => {
const columns = useMemo(() => { const columns = useMemo(() => {
let array = [] let array = []
if (accountFieids.length) { fieldList?.forEach(v => {
accountFieids.forEach(v => { array.push({
if (v.webDisplay === 1) { title: v.fieldAliasName,
array.push({ title: v.fieldName, dataIndex: v.fieldName, key: v.fieldName }) dataIndex: isGIS ? v.fieldName : `${v.fieldType}-${v.fieldName}`,
} key: isGIS ? v.fieldName : `${v.fieldType}-${v.fieldName}`,
})
} else {
areaTaskShine?.forEach(v => {
array.push({ title: v.toField, dataIndex: v.toField, key: v.toField })
}) })
} })
return array return array
}, [areaTaskShine, accountFieids]) }, [isGIS, fieldList])
const onSelect = (value, areaList) => { const onSelect = (value, areaList) => {
setSelectedKeys(value) setSelectedKeys(value)
...@@ -282,7 +289,7 @@ const AreaTask = (props) => { ...@@ -282,7 +289,7 @@ const AreaTask = (props) => {
} }
values.push({ fieldName: s.toField, fieldValue: obj[s.toField] }) values.push({ fieldName: s.toField, fieldValue: obj[s.toField] })
}) })
array.push(obj) array.push({ ...v, ...obj })
items.push({ items.push({
type: 'add', type: 'add',
accountTable: accountName, accountTable: accountName,
...@@ -292,6 +299,7 @@ const AreaTask = (props) => { ...@@ -292,6 +299,7 @@ const AreaTask = (props) => {
}) })
window.relationForm = { configs: [{ ...schema, '台账名称': schema.accountName, '映射字段': [{ fromField: '工单编号', toField: '工单编号' }] }], data: items } window.relationForm = { configs: [{ ...schema, '台账名称': schema.accountName, '映射字段': [{ fromField: '工单编号', toField: '工单编号' }] }], data: items }
setDataSource(array) setDataSource(array)
setIsGIS(true)
} else { } else {
message.error(msg) message.error(msg)
} }
...@@ -334,20 +342,22 @@ const AreaTask = (props) => { ...@@ -334,20 +342,22 @@ const AreaTask = (props) => {
const getDataSource = async (presetValue) => { const getDataSource = async (presetValue) => {
let params = { let params = {
user: userID, user: userID,
condition: '', mapServerName: service,
accountName: accountName, caseNo: codes['工单编号'],
sortFields: '录入时间', feedbackTableName: tableName,
direction: 'desc', caseTableName: tableNameParent,
timeField: '录入时间', // sortFields: '录入时间',
pageIndex: 0, // direction: 'desc',
pageSize: 0, // timeField: '录入时间',
queryWheres: [{ field: '工单编号', type: '等于', value: codes['工单编号'] }], // pageIndex: 0,
// pageSize: 0,
// queryWheres: [{ field: '工单编号', type: '等于', value: codes['工单编号'] }],
} }
if (!codes['工单编号']) return if (!codes['工单编号']) return
const { code, data, msg } = await GetAccountPageList(params) const { code, data, msg } = await GetCaseGISAreaData(params)
if (code === 0) { if (code === 0) {
let tableData = data?.jsonData ? JSON.parse(data?.jsonData) : [] setDataSource(data)
setDataSource(tableData) setIsGIS(false)
} }
} }
...@@ -399,31 +409,33 @@ const AreaTask = (props) => { ...@@ -399,31 +409,33 @@ const AreaTask = (props) => {
return ( return (
<div className={styles.AreaTask}> <div className={styles.AreaTask}>
<div className={styles.areaTitle}>{titleShow}</div>
<div className={styles.areaBox}> <div className={styles.areaBox}>
<div className={styles.areaInput}> <div className={styles.areaHeader}>
{ <div className={styles.areaTitle}>{titleShow}:</div>
!disabled ? <div className={styles.areaInput}>
<Input {
disabled={disabled} !disabled ?
placeholder={disabled ? (placeholder || '') : (placeholder || '点击绘制区域')} <Input
value={isJson(value) ? '已绘制' : (value ? '已选择' : '')} disabled={disabled}
addonAfter={disabled ? null : <CompassOutlined style={{ color: 'rgba(0, 0, 0, 0.25)' }} onClick={showMap} />} placeholder={disabled ? (placeholder || '') : (placeholder || '点击绘制区域')}
style={{ width: '100%' }} value={isJson(value) ? '已绘制' : (value ? '已选择' : '')}
onClick={() => showMap()} 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={() => { <Button
if (value) { icon={<CompassOutlined style={{ color: value ? '#0092fe' : 'rgba(0, 0, 0, 0.25)' }} />}
showMap() onClick={() => {
} if (value) {
}} showMap()
> }
{value ? '查看区域' : '无区域信息'} }}
</Button> >
} {value ? '查看区域' : '无区域信息'}
</Button>
}
</div>
</div> </div>
<div className={styles.areaTable}> <div className={styles.areaTable}>
<Table <Table
......
@import '~antd/es/style/themes/default.less';
.AreaTask { .AreaTask {
width: 100%; width: 100%;
.areaTitle {
text-align: center;
padding-bottom: 5px;
}
.areaBox { .areaBox {
width: 100%; width: 100%;
.areaInput { .areaHeader {
width: 100%; display: flex;
align-items: center;
.areaTitle {
padding-right: 10px;
}
.areaInput {
flex: 1;
}
} }
// .areaTable {} .areaTable {
.@{ant-prefix}-table-thead>tr {
height: 40px;
th {
font-weight: bold;
overflow: inherit;
user-select: none;
/* Chrome and Opera */
-webkit-user-select: none;
/* Safari */
-khtml-user-select: none;
/* Konqueror HTML */
-moz-user-select: none;
/* Firefox */
-ms-user-select: none;
/* Internet Explorer/Edge */
border-right: 1px solid #dbe7fb !important;
border-bottom: 1px solid #dbe7fb;
background: white;
}
th:last-child {
border-left: 1px solid #dbe7fb;
}
}
.@{ant-prefix}-table-tbody>tr {
&:nth-child(2n-1) {
td {
background: #f6f9fe;
}
}
td {
border-bottom: 1px solid #dbe7fb;
border-right: 1px solid #dbe7fb !important;
&:last-child {
border-left: 1px solid #dbe7fb;
}
}
&:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected) {
td {
background: rgb(237, 242, 255) !important;
}
}
}
.@{ant-prefix}-table-body {
overflow-x: scroll;
&::-webkit-scrollbar {
width: 0;
height: 12px;
}
&::-webkit-scrollbar {
width: 0;
height: 6px;
}
&::-webkit-scrollbar-thumb {
background: rgb(41, 166, 255);
}
&::-webkit-scrollbar-track {
background: #f7f4f5;
padding: 0 3px;
}
}
}
} }
} }
......
...@@ -40,7 +40,7 @@ const TaskFieldList = (props) => { ...@@ -40,7 +40,7 @@ const TaskFieldList = (props) => {
if (!service || !layerName || !tableName) { if (!service || !layerName || !tableName) {
return message.error('请配置字段映射中的配置') return message.error('请配置字段映射中的配置')
} }
setGISCheck(value?.filter(v => v.fieldType === 'GIS').map(v => v.fieldName) || []) setGISCheck(value?.filter(v => v.fieldType === 'gis').map(v => v.fieldName) || [])
setAccCheck(value?.filter(v => v.fieldType === '台账').map(v => v.fieldName) || []) setAccCheck(value?.filter(v => v.fieldType === '台账').map(v => v.fieldName) || [])
getGISField() getGISField()
getAccountField() getAccountField()
...@@ -59,7 +59,7 @@ const TaskFieldList = (props) => { ...@@ -59,7 +59,7 @@ const TaskFieldList = (props) => {
let array = [] let array = []
GISCheck?.forEach(v => { GISCheck?.forEach(v => {
let fieldAliasName = GISField.find(s => s.fieldName === v)?.fieldAliasName || v let fieldAliasName = GISField.find(s => s.fieldName === v)?.fieldAliasName || v
array.push({ fieldName: v, fieldAliasName: fieldAliasName, fieldType: 'GIS', }) array.push({ fieldName: v, fieldAliasName: fieldAliasName, fieldType: 'gis', })
}) })
AccCheck?.forEach(v => { AccCheck?.forEach(v => {
let fieldAliasName = AccountField.find(s => s.name === v)?.alias || v let fieldAliasName = AccountField.find(s => s.name === v)?.alias || v
...@@ -71,7 +71,7 @@ const TaskFieldList = (props) => { ...@@ -71,7 +71,7 @@ const TaskFieldList = (props) => {
return ( return (
<div> <div>
<Input value={value ? JSON.stringify(value) : ''} onClick={inputClick} /> <Input value={value?.map(v => v.fieldName)?.join(',')} onClick={inputClick} />
<Drag <Drag
title='前端显示字段' title='前端显示字段'
onOk={onOk} onOk={onOk}
......
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