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

优化控件

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