Commit 6544fc44 authored by 吴俊凯's avatar 吴俊凯

依赖修改提交

parent 9b1b1f01
...@@ -3,4 +3,5 @@ lib ...@@ -3,4 +3,5 @@ lib
libs libs
*.js *.js
*.md *.md
*.scss src/styles/**/*.scss
src/view/**/*.scss
...@@ -29,25 +29,25 @@ ...@@ -29,25 +29,25 @@
] ]
}, },
"dependencies": { "dependencies": {
"amos-3d": "^2.1.5", "amos-3d": "^2.x",
"amos-amap": "~1.0.9", "amos-amap": "~1.0.9",
"amos-antd": "^2.1.4", "amos-antd": "^2.x",
"amos-devgrid": "^1.0.10", "amos-devgrid": "^1.0.10",
"amos-dll": "^2.0.2", "amos-dll": "^3.x",
"amos-gojs": "^2.0.15", "amos-gojs": "^2.0.15",
"amos-icon": "^1.0.3", "amos-icon": "^1.x",
"amos-mqtt": "^1.0.1", "amos-mqtt": "^1.x",
"amos-pluggable": "^1.0.6", "amos-pluggable": "^1.x",
"amos-processor": "^2.x", "amos-processor": "^2.x",
"amos-richtext": "^1.0.1", "amos-richtext": "^1.0.1",
"amos-rules-config": "^1.0.6", "amos-rules-config": "^1.0.6",
"amos-security": "^2.1.1", "amos-security": "^3.x",
"amos-tool": "^1.x", "amos-tool": "^1.x",
"amos-viz": "^1.x", "amos-viz": "^1.x",
"amos-websocket": "^1.0.3", "amos-websocket": "^1.x",
"classnames": "^2.2.5", "classnames": "^2.2.5",
"dt2react": "^1.x", "dt2react": "^1.x",
"ray-code-split": "^1.0.1", "ray-code-split": "^2.x",
"ray-eventpool": "^1.0.0", "ray-eventpool": "^1.0.0",
"ray-mediaquery": "^1.0.0", "ray-mediaquery": "^1.0.0",
"ray-progress": "^1.0.0", "ray-progress": "^1.0.0",
...@@ -55,11 +55,11 @@ ...@@ -55,11 +55,11 @@
"react-dom": "~16.3.3" "react-dom": "~16.3.3"
}, },
"devDependencies": { "devDependencies": {
"amos-build": "3.1.4", "amos-build": "5.x",
"amos-designer": "^1.0.2", "amos-designer": "^1.x",
"amos-framework": "^1.2.2", "amos-framework": "^1.x",
"amos-iot-3dgraph": "^1.0.0", "amos-iot-3dgraph": "^1.0.8",
"amos-iot-webstudio": "1.0.4", "amos-iot-webstudio": "1.x",
"eslint-config-ray": "^1.0.26", "eslint-config-ray": "^1.0.26",
"mockjs": "^1.0.1-beta3", "mockjs": "^1.0.1-beta3",
"ray-build": "^2.0.2", "ray-build": "^2.0.2",
......
.tsts {
overflow: auto;
}
import * as utils from 'amos-processor/lib/utils'; import * as utils from 'amos-processor/lib/utils';
import * as bitUtils from './../view/bizview/common/tableComponent/tool';
const { renderSimpleTime } = utils.tool; const { renderSimpleTime } = utils.tool;
...@@ -23,6 +24,7 @@ const trimFormData = function(form) { ...@@ -23,6 +24,7 @@ const trimFormData = function(form) {
}; };
export default { export default {
tool: { ...bitUtils },
...utils, ...utils,
renderTimeValue, renderTimeValue,
trimFormData trimFormData
......
...@@ -8,7 +8,7 @@ import { fetchCheckDetailById, fetchCheckInputByIdNew, fetchShortByCheckIdAndChe ...@@ -8,7 +8,7 @@ import { fetchCheckDetailById, fetchCheckInputByIdNew, fetchShortByCheckIdAndChe
import CheckDetailTable from './CheckDetailTable'; import CheckDetailTable from './CheckDetailTable';
import CheckInputTable from './CheckInputTable'; import CheckInputTable from './CheckInputTable';
import { XJBaseURI } from './../../../../consts/urlConsts'; import { XJBaseURI } from './../../../../consts/urlConsts';
import { tool } from './../../../../utils/processor'; import { renderLongTime } from './../../../bizview/common/tableComponent/tool';
import Picture from './Picture'; import Picture from './Picture';
import { pathMapping } from './../../../../routes/customRoutes'; import { pathMapping } from './../../../../routes/customRoutes';
import { Table } from 'amos-antd/lib'; import { Table } from 'amos-antd/lib';
...@@ -16,7 +16,6 @@ import './cdn.scss'; ...@@ -16,7 +16,6 @@ import './cdn.scss';
const CheckListPath = () => pathMapping.checkDetail; const CheckListPath = () => pathMapping.checkDetail;
const { renderLongTime } = tool;
const checkDetailHeaderResult = checkDetail => { const checkDetailHeaderResult = checkDetail => {
let checkTime = '巡检时间'; let checkTime = '巡检时间';
......
...@@ -9,14 +9,14 @@ import CheckDetailTable from './CheckDetailTable'; ...@@ -9,14 +9,14 @@ import CheckDetailTable from './CheckDetailTable';
import CheckInputTable from './CheckInputTable'; import CheckInputTable from './CheckInputTable';
import './../../../../styles/view/biz/checkDetail/checkDetail.scss'; import './../../../../styles/view/biz/checkDetail/checkDetail.scss';
import { XJBaseURI } from './../../../../consts/urlConsts'; import { XJBaseURI } from './../../../../consts/urlConsts';
import { tool } from './../../../../utils/processor'; import { renderLongTime } from './../../../bizview/common/tableComponent/tool';
import Picture from '../../../3dview/points/maxcontent/Picture'; import Picture from '../../../3dview/points/maxcontent/Picture';
import { pathMapping } from './../../../../routes/customRoutes'; import { pathMapping } from './../../../../routes/customRoutes';
import BizIcon from './../../../common/icon/BizIcon'; import BizIcon from './../../../common/icon/BizIcon';
const CheckListPath = () => pathMapping.pointCheckList; const CheckListPath = () => pathMapping.pointCheckList;
const { renderLongTime } = tool;
const checkDetailHeaderResult = checkDetail => { const checkDetailHeaderResult = checkDetail => {
let checkTime; let checkTime;
......
...@@ -17,15 +17,15 @@ class AmosGridTable extends Component { ...@@ -17,15 +17,15 @@ class AmosGridTable extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
selectedRowKeys: [],//表格选择的行key值集合 selectedRowKeys: [], //表格选择的行key值集合
selectedRows: [],//表格选择的行数据集合 selectedRows: [], //表格选择的行数据集合
loading: false,//页面是否加载中,默认false loading: false, //页面是否加载中,默认false
dataList: [],//表格数据集合 dataList: [], //表格数据集合
size: 'middle',//表格大小 size: 'middle', //表格大小
current: props.defaultPageConfig ? props.defaultPageConfig.current : 1,//当前页初始索引0 current: props.defaultPageConfig ? props.defaultPageConfig.current : 1, //当前页初始索引0
pageSize: props.defaultPageConfig ? props.defaultPageConfig.pageSize : 10,//当前页数据量 pageSize: props.defaultPageConfig ? props.defaultPageConfig.pageSize : 10, //当前页数据量
filter: {},//表格过滤条件 filter: {}, //表格过滤条件
totals: 1,//所有数据总和 totals: 1, //所有数据总和
showFilter: true, showFilter: true,
otherFilter: props.otherFilter, otherFilter: props.otherFilter,
maxHeight: 450 maxHeight: 450
...@@ -42,17 +42,17 @@ class AmosGridTable extends Component { ...@@ -42,17 +42,17 @@ class AmosGridTable extends Component {
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
if (nextProps.url !== this.props.url){ if (nextProps.url !== this.props.url) {
this.reload(); this.reload();
} }
if (nextProps.otherFilter && nextProps.otherFilter !== this.props.otherFilter){ if (nextProps.otherFilter && nextProps.otherFilter !== this.props.otherFilter) {
this.setState({ otherFilter: nextProps.otherFilter }, this.reload); this.setState({ otherFilter: nextProps.otherFilter }, this.reload);
} }
let { current, pageSize } = this.state; let { current, pageSize } = this.state;
if (nextProps.totals > 0 && Math.ceil(nextProps.totals / pageSize) < current ) { if (nextProps.totals > 0 && Math.ceil(nextProps.totals / pageSize) < current) {
this.setState({ current: Math.ceil(nextProps.totals / pageSize) }); this.setState({ current: Math.ceil(nextProps.totals / pageSize) });
} }
if (nextProps.current === 0 && this.state.current !== 1 && (nextProps.current !== this.state.current)){ if (nextProps.current === 0 && this.state.current !== 1 && nextProps.current !== this.state.current) {
this.onPaginationChange(nextProps.current + 1); this.onPaginationChange(nextProps.current + 1);
} }
} }
...@@ -61,104 +61,111 @@ class AmosGridTable extends Component { ...@@ -61,104 +61,111 @@ class AmosGridTable extends Component {
window.removeEventListener('resize', this.onWindowResize); window.removeEventListener('resize', this.onWindowResize);
} }
onWindowResize = (e) => { onWindowResize = e => {
this.getHeightOffset(); this.getHeightOffset();
} };
/** /**
* 获取复选框选择的数据,并进行回调 * 获取复选框选择的数据,并进行回调
*/ */
onSelectChange = (selectedRowKeys,selectedRows) => { onSelectChange = (selectedRowKeys, selectedRows) => {
this.setState({ this.setState(
selectedRowKeys, {
selectedRows selectedRowKeys,
},this.props.getSelectedRows(selectedRows,selectedRowKeys)); selectedRows
} },
this.props.getSelectedRows(selectedRows, selectedRowKeys)
);
};
/** /**
* 设置页面数据大小事件 * 设置页面数据大小事件
*/ */
onSizeChange = (current, pageSize) => { onSizeChange = (current, pageSize) => {
let { setPageConfig } = this.props; let { setPageConfig } = this.props;
setPageConfig && setPageConfig({ current, pageSize }); setPageConfig && setPageConfig({ current, pageSize });
this.setState({ current, pageSize },this.reload); this.setState({ current, pageSize }, this.reload);
} };
/** /**
* 设置当前页事件 * 设置当前页事件
*/ */
onPaginationChange = (current) => { onPaginationChange = current => {
let { setPageConfig } = this.props; let { setPageConfig } = this.props;
setPageConfig && setPageConfig({ current }); setPageConfig && setPageConfig({ current });
this.setState({ current },this.reload); this.setState({ current }, this.reload);
} };
/** /**
* 获取表格所有的外部按钮封装成数组 * 获取表格所有的外部按钮封装成数组
*/ */
getbtns = () => { getbtns = () => {
let btns = []; let btns = [];
return <div key={`btntool`} className='amos-grid-oper-btn'>{this.props.operBtns}</div>; return (
} <div key={`btntool`} className="amos-grid-oper-btn">
{this.props.operBtns}
</div>
);
};
/** /**
* 获取表格数据的筛选条件,通过回调获得的,并通过该条件进行表格刷新获取 * 获取表格数据的筛选条件,通过回调获得的,并通过该条件进行表格刷新获取
*/ */
changeFilters = (obj) => { changeFilters = obj => {
let newobj = obj; let newobj = obj;
let res = {}; let res = {};
let list = Object.keys(newobj); let list = Object.keys(newobj);
list.map(e=>{ list.map(e => {
let varName = newobj[e]; let varName = newobj[e];
if (varName && varName !== ''){ if (varName && varName !== '') {
res[e] = varName; res[e] = varName;
if (e === 'enabled'){ if (e === 'enabled') {
res[e] = varName === '启用'; res[e] = varName === '启用';
} }
} }
}); });
this.setState({ filter: res },this.reload); this.setState({ filter: res }, this.reload);
} };
openFilter = () => { openFilter = () => {
let showFilter = this.state.showFilter; let showFilter = this.state.showFilter;
this.setState({ showFilter: !showFilter }); this.setState({ showFilter: !showFilter });
} };
/** /**
* 获取表格数据(刷新) * 获取表格数据(刷新)
*/ */
reload = () => { reload = () => {
let { current,pageSize,filter,otherFilter } = this.state; let { current, pageSize, filter, otherFilter } = this.state;
this.props.getTableDataAction({ current: current - 1, pageSize },JSON.stringify(filter),otherFilter); this.props.getTableDataAction({ current: current - 1, pageSize }, JSON.stringify(filter), otherFilter);
this.getHeightOffset(); this.getHeightOffset();
} };
/** /**
* 获取表格内部按钮 * 获取表格内部按钮
*/ */
addOperateCol =(text,record) =>{ addOperateCol = (text, record) => {
const { operateCol } = this.props; const { operateCol } = this.props;
let operBtns = operateCol(text,record); let operBtns = operateCol(text, record);
return (<div className='operation-buttons'>{operBtns}</div>); return <div className="operation-buttons">{operBtns}</div>;
} };
showTotal = (total) => { showTotal = total => {
return `共 ${total} 条`; return `共 ${total} 条`;
} };
generateRowkey = (record, index) => { generateRowkey = (record, index) => {
// return record.id ? record.id : UUID.uuidFast(); // return record.id ? record.id : UUID.uuidFast();
return record.id ? record.id : index + (this.state.current - 1) * this.state.pageSize; return record.id ? record.id : index + (this.state.current - 1) * this.state.pageSize;
// return index + (this.state.current - 1) * this.state.pageSize; // return index + (this.state.current - 1) * this.state.pageSize;
} };
getHeightOffset = () => { getHeightOffset = () => {
let { getPanelHeight } = this.props; let { getPanelHeight } = this.props;
let height = getPanelHeight ? getPanelHeight() : 450; let height = getPanelHeight ? getPanelHeight() : 450;
height && this.setState({ maxHeight: height }); height && this.setState({ maxHeight: height });
} };
isVisableSearch(columns){ isVisableSearch(columns) {
let list = columns; let list = columns;
let res = false; let res = false;
list.map((e)=>{ list.map(e => {
if (e.query){ if (e.query) {
res = true; res = true;
return true; return true;
} }
...@@ -167,8 +174,8 @@ class AmosGridTable extends Component { ...@@ -167,8 +174,8 @@ class AmosGridTable extends Component {
} }
render() { render() {
const { loading, selectedRowKeys,size,maxHeight } = this.state; const { loading, selectedRowKeys, size, maxHeight } = this.state;
let { columns, isChecked, operateCol, isTreeTable, isPageable, pagination, dataList, totals,rowClassName, onRowClick, onRowDoubleClick } = this.props; let { columns, isChecked, operateCol, isTreeTable, isPageable, pagination, dataList, totals, rowClassName, onRowClick, onRowDoubleClick } = this.props;
console.log(maxHeight); console.log(maxHeight);
//设置复选框参数 //设置复选框参数
let rowSelection = { let rowSelection = {
...@@ -178,43 +185,44 @@ class AmosGridTable extends Component { ...@@ -178,43 +185,44 @@ class AmosGridTable extends Component {
//设置是否添加复选框 //设置是否添加复选框
rowSelection = isChecked ? rowSelection : undefined; rowSelection = isChecked ? rowSelection : undefined;
//如果表格各行存在内部按钮,将各个按钮添加到表格列模型中 //如果表格各行存在内部按钮,将各个按钮添加到表格列模型中
if (operateCol){ if (operateCol) {
columns[columns.length - 1].render = (text,record) => this.addOperateCol(text,record); columns[columns.length - 1].render = (text, record) => this.addOperateCol(text, record);
} }
let tepmPage = Object.assign({ let tepmPage = Object.assign(
size: 'small', {
total: totals, size: 'small',
current: this.state.current, total: totals,
pageSize: this.state.pageSize, current: this.state.current,
onShowSizeChange: this.onSizeChange, pageSize: this.state.pageSize,
onChange: this.onPaginationChange, onShowSizeChange: this.onSizeChange,
maxSeries: 4, onChange: this.onPaginationChange,
showSizeChanger: true maxSeries: 4,
// style: { position: 'fixed', bottom: 0, right: 0 } showSizeChanger: true
// showTotal: this.showTotal // style: { position: 'fixed', bottom: 0, right: 0 }
}, pagination); // showTotal: this.showTotal
},
pagination
);
let _tempPagination = isPageable === false ? false : tepmPage; let _tempPagination = isPageable === false ? false : tepmPage;
let bordered = true; let bordered = true;
// 当为true 或 undefined时则分页 // 当为true 或 undefined时则分页
let _pagination = isPageable === false ? false : _tempPagination; let _pagination = isPageable === false ? false : _tempPagination;
let divStyle = this.state.showFilter ? 'other-table-bar' : 'table-bar'; let divStyle = this.state.showFilter ? 'other-table-bar' : 'table-bar';
let display = this.state.showFilter ? 'block' : 'none'; let display = this.state.showFilter ? 'block' : 'none';
let searchStyle = { display }; let searchStyle = { display };
console.log(_pagination); console.log(_pagination);
return ( return (
<div className='grid-content' style={{ height: '100%' }}> <div className="grid-content" style={{ height: '100%' }}>
<div className='oper-bar'> <div className="oper-bar">
<div className='amos-grid-oper-btns'> <div className="amos-grid-oper-btns">
{ {this.getbtns()}
this.getbtns()
}
{ {
// flag ? <SearchBtn className='search-upordown-btn' onclick={this.openFilter} /> : '' // flag ? <SearchBtn className='search-upordown-btn' onclick={this.openFilter} /> : ''
} }
</div> </div>
</div> </div>
<div className={divStyle} style={{ height: 'calc(100% - 50px)' }}> <div className={divStyle} style={{ height: 'calc(100% - 50px)' }}>
{ onRowClick ? {onRowClick ? (
<Table <Table
title={() => ( title={() => (
<div style={searchStyle}> <div style={searchStyle}>
...@@ -232,7 +240,8 @@ class AmosGridTable extends Component { ...@@ -232,7 +240,8 @@ class AmosGridTable extends Component {
scroll={{ y: maxHeight }} scroll={{ y: maxHeight }}
rowClassName={rowClassName} rowClassName={rowClassName}
onRowClick={onRowClick} onRowClick={onRowClick}
/> : />
) : (
<Table <Table
title={() => ( title={() => (
<div style={searchStyle}> <div style={searchStyle}>
...@@ -244,14 +253,14 @@ class AmosGridTable extends Component { ...@@ -244,14 +253,14 @@ class AmosGridTable extends Component {
rowSelection={rowSelection} rowSelection={rowSelection}
columns={columns} columns={columns}
dataSource={dataList} dataSource={dataList}
pagination={{ ..._pagination, style: { position: 'absolute', bottom: '-55px', right: '430px' } }} pagination={{ ..._pagination, style: {bottom: 0, right: 0 } }}
size={size} size={size}
bordered={bordered} bordered={bordered}
scroll={{ y: maxHeight }} scroll={{ y: maxHeight }}
rowClassName={rowClassName} rowClassName={rowClassName}
onRowDoubleClick={onRowDoubleClick} onRowDoubleClick={onRowDoubleClick}
/> />
} )}
</div> </div>
</div> </div>
); );
...@@ -259,14 +268,14 @@ class AmosGridTable extends Component { ...@@ -259,14 +268,14 @@ class AmosGridTable extends Component {
} }
AmosGridTable.propTypes = { AmosGridTable.propTypes = {
url: PropTypes.string,//请求表格数据的url不带参数的 url: PropTypes.string, //请求表格数据的url不带参数的
columns: PropTypes.array,//表格列模型 columns: PropTypes.array, //表格列模型
getSelectedRows: PropTypes.func,//获取选择的行数据,用于各个具体的表格回调获取数据。 getSelectedRows: PropTypes.func, //获取选择的行数据,用于各个具体的表格回调获取数据。
operBtns: PropTypes.array,//表格外部操作按钮,如'新增','编辑'等 operBtns: PropTypes.array, //表格外部操作按钮,如'新增','编辑'等
isChecked: PropTypes.bool,//表格是否包含复选框 isChecked: PropTypes.bool, //表格是否包含复选框
operateCol: PropTypes.func,//表格内部操作按钮,如'查看详情'等 operateCol: PropTypes.func, //表格内部操作按钮,如'查看详情'等
callBack: PropTypes.func,//获取表格刷新方法,用于各个具体的表格回调获取,方便各种操作后进行表格刷新。 callBack: PropTypes.func, //获取表格刷新方法,用于各个具体的表格回调获取,方便各种操作后进行表格刷新。
otherFilter: PropTypes.string,//其他查询条件 otherFilter: PropTypes.string, //其他查询条件
dataList: PropTypes.array, dataList: PropTypes.array,
getTableDataAction: PropTypes.func, getTableDataAction: PropTypes.func,
selectedRowKeys: PropTypes.array, selectedRowKeys: PropTypes.array,
......
...@@ -4,7 +4,7 @@ import dt2react from 'dt2react'; ...@@ -4,7 +4,7 @@ import dt2react from 'dt2react';
import { fetchTaskListAction } from './../../../services/checkInfoService'; import { fetchTaskListAction } from './../../../services/checkInfoService';
import AmosGridTable from './../common/tableComponent/table/AmosGridTable'; import AmosGridTable from './../common/tableComponent/table/AmosGridTable';
import { pathMapping } from './../../../routes/customRoutes'; import { pathMapping } from './../../../routes/customRoutes';
import {renderLongTime} from './../../bizview/common/tableComponent/tool'; import { renderLongTime } from './../../bizview/common/tableComponent/tool';
import TaskSearch from './taskSearch' import TaskSearch from './taskSearch'
// const CheckListPath = pathMapping.pointCheckList; // const CheckListPath = pathMapping.pointCheckList;
......
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