Commit 0862891d authored by xinglei's avatar xinglei

*)调整代码

parent 1ed9691b
This diff is collapsed.
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Tabs, TagSelect, StdFormRow, CardPane, BorderRadius } from 'amos-framework';
import { Row, Col } from 'amos-framework';
import { Tabs, TagSelect, StdFormRow, CardPane, Row, Col } from 'amos-framework';
import { getSortSences } from './api';
import './index.scss'
import './index.scss';
const { TabList, Tab, TabPanel } = Tabs;
const categoryScene = ['全部', '新能源', '水利环境', '医疗健康', '智慧城市', '智慧园区', '企业运营', '物流仓库', '生产制造', '其他']
const miniSences = ['综合排序', '热门推荐', '最新发布']
const categoryScene = ['全部', '新能源', '水利环境', '医疗健康', '智慧城市', '智慧园区', '企业运营', '物流仓库', '生产制造', '其他'];
const miniSences = ['综合排序', '热门推荐', '最新发布'];
function ListCards({ cardItems }) {
const rows = [];
......@@ -22,19 +20,20 @@ function ListCards({ cardItems }) {
for (let i = 0; i < cardItems.length; i += 4) {
const rowItems = cardItems.slice(i, i + 4);
const cols = rowItems.map((cardItems, index) => (
<Col span={6} key={index}>
<div style={{ margin: 15, display: 'flex', justifyContent: 'center' }} >
<div style={{ margin: 15, display: 'flex', justifyContent: 'center' }}>
<button style={{ width: '100%', height: '100%', border: 0, padding: 0 }} onClick={handleClick.bind(cardItems.templateLink)}>
<CardPane style={{ width: '100%', height: 270, border: 0 }} bodyStyle={{ height: 270, padding: 0 }}>
<div style={{ height: '75%' }}>
<img alt="example" width="100%" height='100%' style={{ objectFit: 'cover', borderRadius: 10 }} src={cardItems.sketch} />
<img alt="example" width="100%" height="100%" style={{ objectFit: 'cover', borderRadius: 10 }} src={cardItems.sketch} />
</div>
<div style={{ padding: '10px 0px 10px 80px' }}>
<h2 style={{ textAlign: 'left', margin: 0 }}>{cardItems.templateName}</h2>
<div style={{ display: 'flex' }}>
<p style={{ textAlign: 'left', marginTop: '5px', fontSize: '16px' }}>{cardItems.agencyName} | 热度指数:{cardItems.viewTimes}</p>
<p style={{ textAlign: 'left', marginTop: '5px', fontSize: '16px' }}>
{cardItems.agencyName} | 热度指数:{cardItems.viewTimes}
</p>
</div>
</div>
</CardPane>
......@@ -44,17 +43,15 @@ function ListCards({ cardItems }) {
));
rows.push(
<Row gutter={16} key={(i + 1) / 4 | 0}>
<Row gutter={16} key={((i + 1) / 4) | 0}>
{cols}
</Row>
);
}
return <div>{rows}</div>
return <div>{rows}</div>;
}
class Shifting extends Component {
class Scene extends Component {
static propTypes = {
routeState: PropTypes.object,
onBack: PropTypes.func
......@@ -68,10 +65,6 @@ class Shifting extends Component {
routeState: {}
};
componentDidMount() {
this.getSenceLists();
}
constructor(props) {
super(props);
this.state = {
......@@ -84,6 +77,10 @@ class Shifting extends Component {
};
}
componentDidMount() {
this.getSenceLists();
}
handleBack = () => {
if (this.props.onBack) {
this.props.onBack();
......@@ -91,60 +88,63 @@ class Shifting extends Component {
this.context.browserHistory.goBack();
}
};
handleChange = (value) => {
handleChange = value => {
this.setState({
mode: value
});
}
};
getSenceLists = () => {
getSortSences(this.state.selectScene, this.state.selectMiniSence).then(response => {
this.setState({
cardItems: response
});
// console.log(this.state.cardItems);
})
}
handleSenecesSubmit = (value) => {
});
};
handleSenecesSubmit = value => {
if (value !== '') {
this.setState({
selectScene: value
},() => {this.componentDidMount();})
this.setState(
{
selectScene: value
},
() => {
this.getSenceLists();
}
);
}
}
handleMiniSenecesSubmit = (value) => {
};
handleMiniSenecesSubmit = value => {
if (value !== '') {
this.setState({
selectMiniSence: value
},() => {this.componentDidMount();})
this.setState(
{
selectMiniSence: value
},
() => {
this.getSenceLists();
}
);
}
}
};
render() {
const { mode } = this.state;
const Option = TagSelect.Option;
// this.getSenceLists();
return (
<div>
<Tabs mode={mode}>
<TabList style={{padding:10}} >
<TabList style={{ padding: 10 }}>
<span>&nbsp;&nbsp;</span>
<Tab>&nbsp;&nbsp;应用模板&nbsp;&nbsp;</Tab>
</TabList>
<TabPanel style={{padding:0}}>
<StdFormRow label="场景" block id='scene' style={{ padding: '10px 0px 10px 20px' ,marginBottom:0}}>
<TabPanel style={{ padding: 0 }}>
<StdFormRow label="场景" block id="scene" style={{ padding: '10px 0px 10px 20px', marginBottom: 0 }}>
<TagSelect defaultValue={categoryScene[0]} data={categoryScene} onChange={this.handleSenecesSubmit} expandable single />
</StdFormRow>
<StdFormRow block style={{ padding: '10px 0px 10px 20px' ,marginBottom:0}}>
<StdFormRow block style={{ padding: '10px 0px 10px 20px', marginBottom: 0 }}>
<TagSelect defaultValue={miniSences[0]} data={miniSences} onChange={this.handleMiniSenecesSubmit} expandable single />
</StdFormRow >
</StdFormRow>
<div style={{ overflowY: 'auto', height: '800px' }}>
<ListCards cardItems={this.state.cardItems} />
</div>
</TabPanel>
</Tabs>
</div>
......@@ -152,6 +152,4 @@ class Shifting extends Component {
}
}
export default Shifting;
export default Scene;
......@@ -12,15 +12,14 @@ const {
buildPageable,
} = request;
export const UrlConsts =
{
getSortSencesUrl: () => completePrefix()(gateWay.atl, 'scene/select/all'),
export const UrlConsts = {
getSortSencesUrl: () => completePrefix()(gateWay.atl, 'scene/select/all')
};
export const getSortSences = (categoryScene, miniSences) => {
const formData = new window.FormData();
formData.append('categoryScene', categoryScene)
formData.append('miniSences', miniSences)
return commonPost(UrlConsts.getSortSencesUrl(), formData );
};
formData.append('categoryScene', categoryScene);
formData.append('miniSences', miniSences);
return commonPost(UrlConsts.getSortSencesUrl(), formData );
};
......@@ -8,34 +8,10 @@ const baseURI = AmosConfig.httpURI.baseURI;
const fileServerURI = AmosConfig.httpURI.fileServerURI;
export const UrlConsts = {
getUtilListUrl: url => completePrefix(baseURI, 'iot/v1/iot/IotThingsTemplate/list/property/category'),
userInfoUrl: url => completePrefix(baseURI, 'privilege/v1/agencyuser/me'), // 根据字典标识获取字典列表 get
userInfoListUrl: url => completePrefix(baseURI, 'privilege/v1/agencyuser/list/users'), // 获取用户LIST get
dictListUrl: url => completePrefix(baseURI, 'systemctl/v1/dictionary/{dictCode}/values'), // 根据字典标识获取字典列表 get
uploadfileUrl: url => completePrefix(baseURI, 'precontrol/file/uploadfile'), // 文件服务器上传接口
platFormUploadfileUrl: url => completePrefix(baseURI, 'systemctl/v1/filestorage'), // 平台文件服务器上传接口
lookFileUrl: url => completePrefix('/fileURI/', url), // 查看图片 fileURI需要走转向代理
departmentListUrl: url => completePrefix(baseURI, 'privilege/v1/department/tree?companySeq={companySeq}'), // 部门列表
unitListUrl: url => completePrefix(baseURI, 'privilege/v1/company/tree?companyName='), // 单位列表
designPageUrl: url => completePrefix(baseURI, 'morphic/morphic/scene/{id}'), // 查询画布 get
companyTree: url => completePrefix(baseURI, 'privilege/v1/company/department/tree'), // 公司部门tree
roleListUrl: url => completePrefix(baseURI, 'privilege/v1/role/list'), // 角色列表};
getRegionUrl: url => completePrefix(baseURI, 'systemctl/v1/region/tree'), // 获取行政区划
ruleDetailsUrl: url => completePrefix(baseURI, 'urule/v1/packageeditor/knowledgepackage/ruleflow/image?project={project}&packageId={packageId}'), // 获取规则详情
listMaintenanceSpecUrl: url => completePrefix(baseURI, 'urule/v1/packageeditor/loadPackages?project={project}'), // 从规则获取维保规范列表
administrativeDivisionTreeUrl: () => completePrefix(baseURI, 'systemctl/v1/region/tree/parent'), // 获取全国行政区划树
accountListUrl: url => completePrefix()('precontrol/safe/unboundUser'), // 账户列表 get
applicationListUrl: url => completePrefix(baseURI, 'privilege/v1/application/page?current={current}&size={size}&appName='), // 应用列表 get
permissionListUrl: url => completePrefix(baseURI, 'privilege/v1/permission/list/me?menuAgent=WEB'), // 菜单列表 get
countByMsgTypesUrl: url => completePrefix(baseURI, 'systemctl/v1/message/countByMsgType/{msgTypes}?terminal=WEB&category=1,2'), // 根据消息类型查询未读数量(1:消息;2系统消息)get
msgListByMsgTypesUrl: url => completePrefix(baseURI, 'systemctl/v1/message/listByMsgType/{msgTypes}?terminal=WEB&category=1,2'), // 根据消息类型查询消息列表 get
msgUpdateIsReadUrl: url => completePrefix(baseURI, 'systemctl/v1/message/{sequenceNbr}'), // 修改数据为已读 put
msgUpdateBatchIsReadUrl: url => completePrefix(baseURI, 'systemctl/v1/message/updateBatch?terminal=WEB'), // 批量修改数据为已读 get
knowledgeListUrl: (url) => completePrefix(baseURI, 'knowledgebase/v1/doccontent/doclibrary/page?'
+ 'filterByCollection=false&directoryId={directoryId}&offset=0&end=99'),// 知识库列表
knowledgeContentUrl: (url) => completePrefix(baseURI, 'knowledgebase/v1/doccontent/{id}'),// 知识库详情
processListUrl: () => completePrefix(baseURI, 'workflow/processDefinition/list/all'), // 获取所有的的流程
getFlowUrl: () => completePrefix(baseURI, 'workflow/processDefinition/image?processDefinitionId={processDefinitionId}'), // 根据流程实例id获取流程图 get
remoteUrl: completePrefix(baseURI, 'morphic/biz/url'), // 请求第三方系统 api, post,需要传入第三方api 地址
generateSqlUrl: url => completePrefix(baseURI, 'studio/v1/dataApi/generateSQL') // 通用导出SQL脚本 get
};
......@@ -54,12 +30,6 @@ export const userInfoAction = () => {
};
/**
* 获取用户信息list
*/
export const userInfoListUrl = () => {
return commonGet(UrlConsts.userInfoListUrl());
};
/**
* 文件上传
* @param {*} file file对象
*/
......@@ -74,139 +44,6 @@ export const fileUploadAction = file => {
* @param {string} fileUrl
*/
export const filePrefixUrl = fileUrl => completePrefix(fileServerURI, fileUrl);
/**
* 获取部门列表
*/
export const departmentListAction = companySeq => {
return commonGet(formatUrl(UrlConsts.departmentListUrl(), { companySeq }));
};
/**
* 获取角色列表
*/
export const roleListAction = () => {
return commonGet(UrlConsts.roleListUrl());
};
/**
* 获取角色列表
*/
export const unitListAction = () => {
return commonGet(UrlConsts.unitListUrl());
};
/**
* 获取画布详情
*/
export const designPageAction = id => {
return commonGet(formatUrl(UrlConsts.designPageUrl(), { id }));
};
export const utilListAction = () => {
return commonGet(UrlConsts.getUtilListUrl());
};
/**
* 公司部门tree
*/
export const companyTree = () => {
return commonGet(UrlConsts.companyTree());
};
/**
* 获取行政区划
*/
export const getRegion = () => {
return commonGet(formatUrl(UrlConsts.getRegionUrl()));
};
/**
* 获取规范列表
*/
export const listMaintenanceSpec = project => {
return commonGet(formatUrl(UrlConsts.listMaintenanceSpecUrl(), { project }));
};
/**
* 获取规则详情
*/
export const ruleDetailsAction = (project, packageId) => {
return commonGet(formatUrl(UrlConsts.ruleDetailsUrl(), { project, packageId }));
};
export const administrativeDivisionTreeAction = () => {
return commonGet(UrlConsts.administrativeDivisionTreeUrl());
};
// 获取账户列表
export const accountListAction = data => {
return commonGet(UrlConsts.accountListUrl(), data);
};
// 获取应用列表
export const applicationListAction = (data) => {
return commonGet(formatUrl(UrlConsts.applicationListUrl(), data));
};
// 获取菜单列表
export const permissionListAction = () => {
return commonGet(UrlConsts.permissionListUrl());
};
/**
* 根据消息类型查询未读数量
*/
export const countByMsgTypesAction = (msgTypes) => {
return commonGet(formatUrl(UrlConsts.countByMsgTypesUrl(), { msgTypes }));
};
/**
* 根据消息类型查询消息列表
*/
export const msgListByMsgTypesAction = (msgTypes, filter) => {
return commonGet(formatObjUrl({ url: formatUrl(UrlConsts.msgListByMsgTypesUrl(), { msgTypes }), filter }));
};
/**
* 修改数据为已读
*/
export const msgUpdateIsReadAction = (sequenceNbr) => {
return commonPut(formatUrl(UrlConsts.msgUpdateIsReadUrl(), { sequenceNbr }));
};
/**
* 批量修改数据为已读
*/
export const msgUpdateBatchIsReadAction = () => {
return commonGet(UrlConsts.msgUpdateBatchIsReadUrl());
};
/**
* 知识库列表
*/
export const knowledgeListAction = (directoryId = '') => {
return commonGet(formatUrl(UrlConsts.knowledgeListUrl(), { directoryId }));
};
/**
* 知识库详情
*/
export const knowledgeContentAction = (id) => {
return commonGet(formatUrl(UrlConsts.knowledgeContentUrl(), { id }));
};
/**
* 获取所有的工作流
* @returns
*/
export const processListAction = () => {
return commonGet(UrlConsts.processListUrl());
};
/**
* 获取流程图
* @param {*} processDefinitionId 流程id
* @returns
*/
export const getFlowImgAction = (processDefinitionId) => {
return commonGet(formatUrl(UrlConsts.getFlowUrl(), { processDefinitionId }));
};
/**
* 图片文件路径补全
......
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