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

feat: 新增选中巡检对象

parent d704a540
......@@ -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 }) {
return request({
......
......@@ -2445,8 +2445,8 @@ const mapWidgets = [
widget: 'HiddenCondition'
},
areaTaskShine: {
title: '映射字段',
name: '映射字段',
title: '巡检对象',
name: '巡检对象',
type: 'array',
widget: 'AreaTaskShine',
default: [],
......
......@@ -9,7 +9,8 @@ import {
getMaplayerByTerminalType,
GetLayerList,
GetLayerFields,
GetLayersShareField
GetLayersShareField,
GetAreaTaskProgramme
} from '../../../../../apis/process'
import Drag from '../../../../components/Drag'
......@@ -30,6 +31,7 @@ const AreaTaskShine = (props) => {
const [visible, setVisible] = useState(false)
const [tableName, setTableName] = useState(formData?.tableName)
const [accountName, setAccountName] = useState(formData?.accountName)
const [taskList, setTaskList] = useState([])
const [accountList, setAccountList] = useState([])
const [mapServers, setMapServers] = useState([])
const [service, setService] = useState(formData?.service)
......@@ -43,12 +45,12 @@ const AreaTaskShine = (props) => {
.validateFields()
.then((values) => {
const { field, accountName, service, layerName } = form.getFieldsValue()
if (!toField.some(v => v.name === '工单编号')) {
return message.error(`【${accountName}】台账不存在工单编号字段`)
}
if (!toField.some(v => v.name === '反馈状态')) {
return message.error(`【${accountName}】台账不存在反馈状态字段`)
}
// if (!toField.some(v => v.name === '工单编号')) {
// return message.error(`【${accountName}】台账不存在工单编号字段`)
// }
// if (!toField.some(v => v.name === '反馈状态')) {
// return message.error(`【${accountName}】台账不存在反馈状态字段`)
// }
addons.setValue('accountName', accountName)
addons.setValue('service', service)
addons.setValue('layerName', layerName)
......@@ -127,6 +129,13 @@ const AreaTaskShine = (props) => {
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 = () => {
addons.setValue('tableName', '')
addons.setValue('accountName', '')
......@@ -136,14 +145,22 @@ const AreaTaskShine = (props) => {
setVisible(false)
}
const getProgramme = async () => {
const { code, data } = await GetAreaTaskProgramme()
if (code === 0) {
setTaskList(data)
}
}
useEffect(() => {
if (visible) {
if (service && layerName) {
getFromField()
}
if (tableName) {
getToField()
}
// if (service && layerName) {
// getFromField()
// }
// if (tableName) {
// getToField()
// }
getProgramme()
}
}, [visible, service, layerName, tableName])
......@@ -156,7 +173,7 @@ const AreaTaskShine = (props) => {
<Drag
getContainer={false}
width='500px'
title='字段映射'
title='巡检对象'
bodyStyle={{ maxHeight: 500, overflow: 'auto' }}
visible={visible}
footer={
......@@ -168,9 +185,22 @@ const AreaTaskShine = (props) => {
}
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反馈台账必填', }]}>
<Select
disabled
showSearch
options={accountList.map(v => ({ label: v.name, value: v.name }))}
onChange={(value) => {
......@@ -184,7 +214,7 @@ const AreaTaskShine = (props) => {
/>
</Form.Item>
<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
label='图层名称'
......@@ -202,6 +232,7 @@ const AreaTaskShine = (props) => {
onChange={(value) => {
setlayerName(value)
}}
disabled
>
{
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