Commit 8b70e2ac authored by 田翔's avatar 田翔

feat: 新增选中巡检对象

parent d704a540
...@@ -639,6 +639,14 @@ export function GetLayersShareField({ mapServer, layerNames }) { ...@@ -639,6 +639,14 @@ export function GetLayersShareField({ mapServer, layerNames }) {
}) })
} }
//获取巡检方案
export function GetAreaTaskProgramme() {
return request({
url: `PandaOMS/OMS/WorkOrderCenter/GetAreaTaskProgramme`,
method: 'get'
})
}
//获取分区 //获取分区
export function FetchAreaList({ userID, sourceType }) { export function FetchAreaList({ userID, sourceType }) {
return request({ return request({
......
...@@ -2445,8 +2445,8 @@ const mapWidgets = [ ...@@ -2445,8 +2445,8 @@ const mapWidgets = [
widget: 'HiddenCondition' widget: 'HiddenCondition'
}, },
areaTaskShine: { areaTaskShine: {
title: '映射字段', title: '巡检对象',
name: '映射字段', name: '巡检对象',
type: 'array', type: 'array',
widget: 'AreaTaskShine', widget: 'AreaTaskShine',
default: [], default: [],
......
...@@ -9,7 +9,8 @@ import { ...@@ -9,7 +9,8 @@ import {
getMaplayerByTerminalType, getMaplayerByTerminalType,
GetLayerList, GetLayerList,
GetLayerFields, GetLayerFields,
GetLayersShareField GetLayersShareField,
GetAreaTaskProgramme
} from '../../../../../apis/process' } from '../../../../../apis/process'
import Drag from '../../../../components/Drag' import Drag from '../../../../components/Drag'
...@@ -30,6 +31,7 @@ const AreaTaskShine = (props) => { ...@@ -30,6 +31,7 @@ const AreaTaskShine = (props) => {
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const [tableName, setTableName] = useState(formData?.tableName) const [tableName, setTableName] = useState(formData?.tableName)
const [accountName, setAccountName] = useState(formData?.accountName) const [accountName, setAccountName] = useState(formData?.accountName)
const [taskList, setTaskList] = useState([])
const [accountList, setAccountList] = useState([]) const [accountList, setAccountList] = useState([])
const [mapServers, setMapServers] = useState([]) const [mapServers, setMapServers] = useState([])
const [service, setService] = useState(formData?.service) const [service, setService] = useState(formData?.service)
...@@ -43,12 +45,12 @@ const AreaTaskShine = (props) => { ...@@ -43,12 +45,12 @@ const AreaTaskShine = (props) => {
.validateFields() .validateFields()
.then((values) => { .then((values) => {
const { field, accountName, service, layerName } = form.getFieldsValue() const { field, accountName, service, layerName } = form.getFieldsValue()
if (!toField.some(v => v.name === '工单编号')) { // if (!toField.some(v => v.name === '工单编号')) {
return message.error(`【${accountName}】台账不存在工单编号字段`) // return message.error(`【${accountName}】台账不存在工单编号字段`)
} // }
if (!toField.some(v => v.name === '反馈状态')) { // if (!toField.some(v => v.name === '反馈状态')) {
return message.error(`【${accountName}】台账不存在反馈状态字段`) // return message.error(`【${accountName}】台账不存在反馈状态字段`)
} // }
addons.setValue('accountName', accountName) addons.setValue('accountName', accountName)
addons.setValue('service', service) addons.setValue('service', service)
addons.setValue('layerName', layerName) addons.setValue('layerName', layerName)
...@@ -127,6 +129,13 @@ const AreaTaskShine = (props) => { ...@@ -127,6 +129,13 @@ const AreaTaskShine = (props) => {
form.setFieldsValue({ field: values, service, layerName }) form.setFieldsValue({ field: values, service, layerName })
} }
const taskNameChange = (value) => {
let item = taskList.find(v => v.Name === value)
if (item) {
form.setFieldsValue({ accountName: item.FeedbackAccountName, tableName: item.FeedbackTableName, service: item.MapServerName, layerName: item?.LayerName.split(',') || [] })
}
}
const clear = () => { const clear = () => {
addons.setValue('tableName', '') addons.setValue('tableName', '')
addons.setValue('accountName', '') addons.setValue('accountName', '')
...@@ -136,14 +145,22 @@ const AreaTaskShine = (props) => { ...@@ -136,14 +145,22 @@ const AreaTaskShine = (props) => {
setVisible(false) setVisible(false)
} }
const getProgramme = async () => {
const { code, data } = await GetAreaTaskProgramme()
if (code === 0) {
setTaskList(data)
}
}
useEffect(() => { useEffect(() => {
if (visible) { if (visible) {
if (service && layerName) { // if (service && layerName) {
getFromField() // getFromField()
} // }
if (tableName) { // if (tableName) {
getToField() // getToField()
} // }
getProgramme()
} }
}, [visible, service, layerName, tableName]) }, [visible, service, layerName, tableName])
...@@ -156,7 +173,7 @@ const AreaTaskShine = (props) => { ...@@ -156,7 +173,7 @@ const AreaTaskShine = (props) => {
<Drag <Drag
getContainer={false} getContainer={false}
width='500px' width='500px'
title='字段映射' title='巡检对象'
bodyStyle={{ maxHeight: 500, overflow: 'auto' }} bodyStyle={{ maxHeight: 500, overflow: 'auto' }}
visible={visible} visible={visible}
footer={ footer={
...@@ -168,9 +185,22 @@ const AreaTaskShine = (props) => { ...@@ -168,9 +185,22 @@ const AreaTaskShine = (props) => {
} }
onCancel={() => setVisible(false)} onCancel={() => setVisible(false)}
> >
<Form name="dynamic_form_nest_item" form={form} autoComplete="off" labelCol={{ span: 5 }}> <Form
name="dynamic_form_nest_item"
form={form}
autoComplete="off"
labelCol={{ span: 5 }}
>
<Form.Item label='巡检对象' name='taskName' rules={[{ required: true, message: 'gis反馈台账必填', }]}>
<Select
showSearch
options={taskList.map(v => ({ label: v.Name, value: v.Name }))}
onChange={taskNameChange}
/>
</Form.Item>
<Form.Item label='GIS反馈台账' name='accountName' rules={[{ required: true, message: 'gis反馈台账必填', }]}> <Form.Item label='GIS反馈台账' name='accountName' rules={[{ required: true, message: 'gis反馈台账必填', }]}>
<Select <Select
disabled
showSearch showSearch
options={accountList.map(v => ({ label: v.name, value: v.name }))} options={accountList.map(v => ({ label: v.name, value: v.name }))}
onChange={(value) => { onChange={(value) => {
...@@ -184,7 +214,7 @@ const AreaTaskShine = (props) => { ...@@ -184,7 +214,7 @@ const AreaTaskShine = (props) => {
/> />
</Form.Item> </Form.Item>
<Form.Item label='方案名称' name='service' rules={[{ required: true, message: '方案名称必填', },]}> <Form.Item label='方案名称' name='service' rules={[{ required: true, message: '方案名称必填', },]}>
<Select options={mapServers} onChange={(value) => setService(value)} /> <Select disabled options={mapServers} onChange={(value) => setService(value)} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label='图层名称' label='图层名称'
...@@ -202,6 +232,7 @@ const AreaTaskShine = (props) => { ...@@ -202,6 +232,7 @@ const AreaTaskShine = (props) => {
onChange={(value) => { onChange={(value) => {
setlayerName(value) setlayerName(value)
}} }}
disabled
> >
{ {
layers.map(v => <Select.Option value={v.layerName}>{v.layerName}</Select.Option>) layers.map(v => <Select.Option value={v.layerName}>{v.layerName}</Select.Option>)
......
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