Commit ad4fee0a authored by 田翔's avatar 田翔

fix: 设备选择增图层与编码传参

parent d330e0a4
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "6.8.13", "version": "6.8.17",
"description": "6.8.13 关联表单数量问题", "description": "6.8.17 设备选择增加传入参数",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -63,6 +63,7 @@ const Account = (props, ref) => { ...@@ -63,6 +63,7 @@ const Account = (props, ref) => {
timeLimit, timeLimit,
getDeleted, getDeleted,
accountId, accountId,
defaultType,
} = props; } = props;
const userID = window?.globalConfig?.userInfo?.OID || 1; const userID = window?.globalConfig?.userInfo?.OID || 1;
let initParams = { let initParams = {
...@@ -279,6 +280,7 @@ const Account = (props, ref) => { ...@@ -279,6 +280,7 @@ const Account = (props, ref) => {
const back = () => { const back = () => {
setDetailShow(false); setDetailShow(false);
getDataSource(); getDataSource();
props?.goBack?.()
}; };
const submit = async () => { const submit = async () => {
...@@ -322,8 +324,16 @@ const Account = (props, ref) => { ...@@ -322,8 +324,16 @@ const Account = (props, ref) => {
setConfigLoading(true); setConfigLoading(true);
const { code, data, msg } = await GetAccountConfigInfo(accountName); const { code, data, msg } = await GetAccountConfigInfo(accountName);
if (code === 0) { if (code === 0) {
setConfig({ ...data, formJson: isJson(data.formJson) ? JSON.parse(data.formJson) : {} }); let config = { ...data, formJson: isJson(data.formJson) ? JSON.parse(data.formJson) : {} }
setConfig(config);
setParams({ ...params, pageSize: data.pageSize || 20, accountName }); setParams({ ...params, pageSize: data.pageSize || 20, accountName });
//如果传入该值
if (accountId && ['添加'].includes(defaultType)) {
const { accountFieids, formJson } = config
const addField = accountFieids.filter(v => v.isAdd).map(v => v.fieldName)
setOperation({ type: defaultType, id: null })
saveClick(addField, formJson, [], defaultType)
}
defaultParams = { defaultParams = {
sortFields: data?.defaultSortFields || '录入时间', sortFields: data?.defaultSortFields || '录入时间',
direction: data?.sortOrder || 'desc', direction: data?.sortOrder || 'desc',
...@@ -406,8 +416,9 @@ const Account = (props, ref) => { ...@@ -406,8 +416,9 @@ const Account = (props, ref) => {
getDataSource({ siteFilter: Boolean(parentConfig.enableSiteFilter) }); getDataSource({ siteFilter: Boolean(parentConfig.enableSiteFilter) });
} else { } else {
//如果传入该值 //如果传入该值
if (accountId) { console.log(1, accountId, defaultType, ['详情', '编辑'].includes(defaultType))
btnsClick({ type: notUse?.includes('edit') ? '详情' : '编辑', row: { ID: accountId } }) if (accountId && ['详情', '编辑'].includes(defaultType)) {
btnsClick({ type: defaultType, row: { ID: accountId } })
} }
getConfig({ accountName }); getConfig({ accountName });
} }
......
...@@ -21,7 +21,16 @@ const Device = (props) => { ...@@ -21,7 +21,16 @@ const Device = (props) => {
const { token, client } = window.globalConfig const { token, client } = window.globalConfig
const { addons, value, onChange, schema } = props const { addons, value, onChange, schema } = props
const { placeholder, disabled, parent, presetValue, screenShot, fieldshine } = schema const {
placeholder,
disabled,
parent,
presetValue,
service,
layerName,
screenShot,
fieldshine,
} = schema
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const [text, setText] = useState(presetValue ? presetValue : '(空)') const [text, setText] = useState(presetValue ? presetValue : '(空)')
const [put, setPut] = useState(true) const [put, setPut] = useState(true)
...@@ -30,7 +39,24 @@ const Device = (props) => { ...@@ -30,7 +39,24 @@ const Device = (props) => {
const getView = (mapObj, Map, extentInfos, layersInfo) => { const getView = (mapObj, Map, extentInfos, layersInfo) => {
setTimeout(() => { setTimeout(() => {
if (mapObj && layersInfo) { let gisCode = ''
let gisLayerName = ''
let values = addons?.getValues()
if (isObject(values)) {
Object.keys(values).forEach(key => {
if (isObject(values[key])) {
Object.keys(values[key]).forEach(k => {
if (k === 'GIS编码') {
gisCode = values[key][k] || ''
}
if (k === 'GIS图层') {
gisLayerName = values[key][k] || ''
}
})
}
})
}
if (mapObj) {
view.current = mapObj view.current = mapObj
let arr = (value && value.split(',')) || [] let arr = (value && value.split(',')) || []
let obj = (arr.length === 2) ? { point: { x: Number(arr[0]), y: Number(arr[1]) } } : {} let obj = (arr.length === 2) ? { point: { x: Number(arr[0]), y: Number(arr[1]) } } : {}
...@@ -46,6 +72,11 @@ const Device = (props) => { ...@@ -46,6 +72,11 @@ const Device = (props) => {
offsetX: -150, offsetX: -150,
offsetY: -310, offsetY: -310,
continuous: true, continuous: true,
// service: service,
parentName: '设备选择',
layerName: layerName,
code: gisCode,
gisLayerName: gisLayerName,
onlyWhatch: disabled, onlyWhatch: disabled,
...obj, ...obj,
callback: ({ clickPoint, matchPoint, data }) => { callback: ({ clickPoint, matchPoint, data }) => {
...@@ -85,6 +116,23 @@ const Device = (props) => { ...@@ -85,6 +116,23 @@ const Device = (props) => {
} }
const getMapInfo = (mapObj, Map) => { const getMapInfo = (mapObj, Map) => {
let gisCode = ''
let gisLayerName = ''
let values = addons?.getValues()
if (isObject(values)) {
Object.keys(values).forEach(key => {
if (isObject(values[key])) {
Object.keys(values[key]).forEach(k => {
if (k === 'GIS编码') {
gisCode = values[key][k] || ''
}
if (k === 'GIS图层') {
gisLayerName = values[key][k] || ''
}
})
}
})
}
setTimeout(() => { setTimeout(() => {
if (mapObj) { if (mapObj) {
view.current = mapObj view.current = mapObj
...@@ -101,6 +149,11 @@ const Device = (props) => { ...@@ -101,6 +149,11 @@ const Device = (props) => {
offsetX: -150, offsetX: -150,
offsetY: -310, offsetY: -310,
continuous: true, continuous: true,
// service: service,
parentName: '设备选择',
layerName: layerName,
code: gisCode,
gisLayerName: gisLayerName,
onlyWhatch: true, onlyWhatch: true,
...obj, ...obj,
callback: ({ clickPoint, matchPoint, data }) => { callback: ({ clickPoint, matchPoint, data }) => {
......
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