Commit eb7aeced authored by 杨子龙's avatar 杨子龙

优化控件

parent 1786c99f
...@@ -4838,7 +4838,7 @@ const advancedWidgets = [ ...@@ -4838,7 +4838,7 @@ const advancedWidgets = [
widget: 'OptionRender', widget: 'OptionRender',
}, },
pagination: { pagination: {
title: '是否启用分页', title: '是否启用分页(关闭分页后,需要配制滚动)',
type: 'boolean', type: 'boolean',
widget: "switch", widget: "switch",
default: true, default: true,
...@@ -4848,12 +4848,14 @@ const advancedWidgets = [ ...@@ -4848,12 +4848,14 @@ const advancedWidgets = [
type: 'number', type: 'number',
widget: "inputNumber", widget: "inputNumber",
hidden: '{{formData.pagination}}', hidden: '{{formData.pagination}}',
required: true
}, },
scrollY: { scrollY: {
title: 'y轴滚动', title: 'y轴滚动',
type: 'number', type: 'number',
widget: "inputNumber", widget: "inputNumber",
hidden: '{{formData.pagination}}', hidden: '{{formData.pagination}}',
required: true
}, },
hiddenCondition: { hiddenCondition: {
title: '隐藏条件', title: '隐藏条件',
......
...@@ -57,7 +57,7 @@ const IndicatorCard = props => { ...@@ -57,7 +57,7 @@ const IndicatorCard = props => {
name: child.dName, name: child.dName,
value: child.pv, value: child.pv,
time: item.pt, time: item.pt,
unit: window._IndicatorType[child.dName] unit: schema._IndicatorType[child.dName]
}) })
} }
}) })
......
...@@ -173,8 +173,9 @@ const DataTable = props => { ...@@ -173,8 +173,9 @@ const DataTable = props => {
if (item.fieldType === '台账' && schema?.widget === 'FileUpload') { if (item.fieldType === '台账' && schema?.widget === 'FileUpload') {
arr.push({ arr.push({
title: item.fieldAliasName, title: item.fieldAliasName,
dataIndex: isGIS ? item.fieldName : `${item.fieldType}-${item.fieldName}`, dataIndex: !isGIS ? item.fieldName : `${item.fieldType}-${item.fieldName}`,
key: isGIS ? item.fieldName : `${item.fieldType}-${item.fieldName}`, key: !isGIS ? item.fieldName : `${item.fieldType}-${item.fieldName}`,
width: item.width || 120,
render: (_, row) => { render: (_, row) => {
return <FileView value={row[`${item.fieldType}-${item.fieldName}`]} {...schema} />; return <FileView value={row[`${item.fieldType}-${item.fieldName}`]} {...schema} />;
}, },
...@@ -182,12 +183,13 @@ const DataTable = props => { ...@@ -182,12 +183,13 @@ const DataTable = props => {
} else if (item.fieldType === '台账' && item.fieldName === '反馈状态') { } else if (item.fieldType === '台账' && item.fieldName === '反馈状态') {
//统一最后一行添加 //统一最后一行添加
} else { } else {
const dataIndex = isGIS ? item.fieldName : `${item.fieldType}-${item.fieldName}`; const dataIndex = !isGIS ? item.fieldName : `${item.fieldType}-${item.fieldName}`;
arr.push({ arr.push({
title: item.fieldAliasName, title: item.fieldAliasName,
dataIndex, dataIndex,
key: dataIndex, key: dataIndex,
width: item.width || 120,
render: (_, row , index) => { render: (_, row , index) => {
return ( return (
<Fragment> <Fragment>
...@@ -209,6 +211,7 @@ const DataTable = props => { ...@@ -209,6 +211,7 @@ const DataTable = props => {
title: '操作', title: '操作',
dataIndex: '', dataIndex: '',
key: '', key: '',
width: 120,
render: (_, row, index) => { render: (_, row, index) => {
return getOptionRender(_, row, index); return getOptionRender(_, row, index);
}, },
...@@ -250,10 +253,11 @@ const DataTable = props => { ...@@ -250,10 +253,11 @@ const DataTable = props => {
rowKey={disabled ? 'gis-设备编号' : 'ID'} rowKey={disabled ? 'gis-设备编号' : 'ID'}
bordered bordered
columns={columns} columns={columns}
pagination={!pagination ? { pagination={pagination}
scroll={!pagination && {
x: scrollX, x: scrollX,
y: scrollY y: scrollY
} : true} }}
dataSource={value} dataSource={value}
/> />
) : ( ) : (
......
...@@ -22,7 +22,7 @@ const IndicatorDevice = (props) => { ...@@ -22,7 +22,7 @@ const IndicatorDevice = (props) => {
if(ret.code === 0){ if(ret.code === 0){
ret.data.list.forEach(item => { ret.data.list.forEach(item => {
arr.push({ arr.push({
label: `${item.sName}${item.code})`, label: `${item.name}${item.code})`,
key: item.code, key: item.code,
value: item.code, value: item.code,
extra: item.dataList extra: item.dataList
...@@ -50,7 +50,7 @@ const IndicatorDevice = (props) => { ...@@ -50,7 +50,7 @@ const IndicatorDevice = (props) => {
optionFilterProp={"label"} optionFilterProp={"label"}
onChange={(value , option) => { onChange={(value , option) => {
if(value){ if(value){
window._IndicatorDeviceExtra = option.extra; addons.formData._IndicatorDeviceExtra = option.extra;
} }
onChange(value) onChange(value)
......
...@@ -3,14 +3,14 @@ import { GetSensorType } from "../../../../../apis/process"; ...@@ -3,14 +3,14 @@ import { GetSensorType } from "../../../../../apis/process";
import { Select } from 'antd'; import { Select } from 'antd';
const IndicatorType = (props) => { const IndicatorType = (props) => {
const { onChange , value , addons , schema} = props; const { onChange , value , addons , schema } = props;
const { deviceCode } = addons.formData; const { deviceCode } = addons.formData;
const [options, setOptions] = useState([]); const [options, setOptions] = useState([]);
const [loading , setLoading] = useState(false); const [loading , setLoading] = useState(false);
const {_IndicatorDeviceExtra: []} = window;
const getSensorList = async () => { const getSensorList = async () => {
setLoading(true); setLoading(true);
const _IndicatorDeviceExtra = addons.formData._IndicatorDeviceExtra || [];
const ret = await GetSensorType(); const ret = await GetSensorType();
const arr = [] , obj = {}; const arr = [] , obj = {};
...@@ -18,7 +18,7 @@ const IndicatorType = (props) => { ...@@ -18,7 +18,7 @@ const IndicatorType = (props) => {
if(ret.code === 0){ if(ret.code === 0){
const { data } = ret; const { data } = ret;
_IndicatorDeviceExtra.forEach((extraItem , index) => { _IndicatorDeviceExtra?.forEach((extraItem , index) => {
const currenItem = data.find(item => extraItem.typeID === item.id); const currenItem = data.find(item => extraItem.typeID === item.id);
let unit; let unit;
...@@ -36,7 +36,7 @@ const IndicatorType = (props) => { ...@@ -36,7 +36,7 @@ const IndicatorType = (props) => {
} }
setOptions(arr); setOptions(arr);
window._IndicatorType = obj; addons.formData._IndicatorType = obj;
setLoading(false); setLoading(false);
} }
......
import React, { useState, useEffect, useMemo, Fragment } from 'react' import React, { useState, useEffect, useMemo, Fragment } from 'react'
import styles from './index.less' import styles from './index.less'
import {Switch, Input, Popconfirm, Popover, Select , Button , Space} from 'antd' import {Switch, Input, Popconfirm, Popover, Select , Button , Space , InputNumber} from 'antd'
import DragTable from '../../../../components/DragTable' import DragTable from '../../../../components/DragTable'
import { CheckOutlined , SettingOutlined } from '@ant-design/icons'; import { CheckOutlined , SettingOutlined } from '@ant-design/icons';
import { colors } from '../../../../../constant' import { colors } from '../../../../../constant'
...@@ -8,21 +8,6 @@ import { getNanoid } from '../../../../../utils' ...@@ -8,21 +8,6 @@ import { getNanoid } from '../../../../../utils'
import { SketchPicker } from 'react-color' import { SketchPicker } from 'react-color'
import Drag from "../../../../components/Drag"; import Drag from "../../../../components/Drag";
function getSelectOption(list) {
if(list){
const arr = [...list];
arr?.forEach(item => {
item.label = item.fieldName;
item.value = item.fieldName;
})
return arr
} else {
return []
}
}
function getTableData(list) { function getTableData(list) {
if(list){ if(list){
const arr = [...list]; const arr = [...list];
...@@ -47,8 +32,6 @@ const StatusOption = (props) => { ...@@ -47,8 +32,6 @@ const StatusOption = (props) => {
const [visible , setVisible] = useState(false); const [visible , setVisible] = useState(false);
const [parseObj , setParseObj] = useState(`{"key": {"color": "" , "label": ""}}`); const [parseObj , setParseObj] = useState(`{"key": {"color": "" , "label": ""}}`);
const options = getSelectOption(fieldList);
const data = value?.length ? value : getTableData(fieldList); const data = value?.length ? value : getTableData(fieldList);
const initData = () => { const initData = () => {
...@@ -58,10 +41,12 @@ const StatusOption = (props) => { ...@@ -58,10 +41,12 @@ const StatusOption = (props) => {
if(currentItem){ if(currentItem){
item.color = currentItem.color; item.color = currentItem.color;
item.type = currentItem.type; item.type = currentItem.type;
item.width = currentItem.width;
} else { } else {
item.type = "text"; item.type = "text";
item.color = "rgb(65,68,69)"; item.color = "rgb(65,68,69)";
item.isMapped = false; item.isMapped = false;
item.width = 120;
} }
}); });
...@@ -145,13 +130,12 @@ const StatusOption = (props) => { ...@@ -145,13 +130,12 @@ const StatusOption = (props) => {
{ {
title: '字段', title: '字段',
dataIndex: 'fieldName', dataIndex: 'fieldName',
width: 60, width: 100,
render: (r, _, i) => { render: (r, _, i) => {
return ( return (
<Select options={options} <Input disabled
disabled value={r}
value={r} style={{
style={{
width: "100%" width: "100%"
}} /> }} />
) )
...@@ -181,6 +165,21 @@ const StatusOption = (props) => { ...@@ -181,6 +165,21 @@ const StatusOption = (props) => {
) )
} }
}, },
{
title: '表头宽度',
dataIndex: 'width',
width: 100,
render: (r, _, i) => {
return (
<InputNumber value={r || 120}
style={{
width: "100%"
}}
onPressEnter={() => onPressEnter(i)}
onChange={(e) => inputChange(e, i , "width" , _)} />
)
}
},
{ {
title: '样式映射', title: '样式映射',
dataIndex: 'isMapped', dataIndex: 'isMapped',
......
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