Commit ad4fee0a authored by 田翔's avatar 田翔

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

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