Commit 97e63a7e by fanyongjun

Apply

parent ffe4f6f1
......@@ -32,3 +32,11 @@ export function* saveQuestion(payload) {
export function* domains(payload) {
return yield call(service.domains, payload);
}
export function* listProcessByPage(payload) {
return yield call(service.listProcessByPage, payload);
}
export function* confirmProcess(payload){
return yield call(service.confirmProcess, payload);
}
......@@ -55,7 +55,11 @@ export const routes = [
// {
// name: 'question',
// text: '我的问题'
// }
// },
{
name: 'apply',
text: '我的申请'
}
]
},
];
......
......@@ -30,3 +30,12 @@ export async function saveQuestion(payload) {
export async function domains(payload) {
return GetJSON(`/authservice/users/${payload.userId}/domains`, payload);
}
export async function listProcessByPage(payload) {
return GetJSON("/datacatalog/front/listProcessByPage",payload)
}
export async function confirmProcess(payload) {
return PostJSON(`/datacatalog/front/confirmProcess?processId=${payload.processId}`)
}
\ No newline at end of file
......@@ -105,7 +105,7 @@ export class DataDetail extends Component {
return (
<Descriptions size="small" column={3}>
<Descriptions.Item label="资产名称">
<span dangerouslySetInnerHTML={{ __html: `资产名称:${tableModel.name}` }} />
<span dangerouslySetInnerHTML={{ __html: `${tableModel.name}` }} />
</Descriptions.Item>
<Descriptions.Item label="所属目录">{tableModel.topic}</Descriptions.Item>
<Descriptions.Item label="所属系统">{tableModel.system}</Descriptions.Item>
......
......@@ -50,19 +50,19 @@ export class SearchBar extends Component {
<Row>
<Col span={12} offset={6}>
<Search
placeholder="请输入关键字查询"
enterButton="搜索"
size="large"
value={keyword}
onChange={(e) => {
e.preventDefault();
this.setState({ keyword: e.target.value });
}}
onSearch={value => {
const { domain } = this.state;
onChange&&onChange(value,domain);
}}
/>
placeholder="请输入关键字查询"
enterButton="搜索"
size="large"
value={keyword}
onChange={(e) => {
e.preventDefault();
this.setState({ keyword: e.target.value });
}}
onSearch={value => {
const { domain } = this.state;
onChange&&onChange(value,domain);
}}
/>
</Col>
</Row>
<Row className={'pb-3'}>
......
......@@ -14,6 +14,7 @@ import Standard from '../Metadata/Standard';
import Subscrible from '../User/Subscrible';
import Authorized from '../User/Authorized';
import Question from '../User/Question';
import Apply from '../User/Apply';
class Manage extends Component {
constructor() {
......@@ -45,6 +46,7 @@ class Manage extends Component {
<Route path={`${match.path}/subscrible`} component={Subscrible} />
<Route path={`${match.path}/authorized`} component={Authorized} />
<Route path={`${match.path}/question`} component={Question} />
<Route path={`${match.path}/apply`} component={Apply} />
</Switch>
) : (
<GetSession {...this.props} />
......
import React, { Component, Fragment, useState } from 'react';
import { Descriptions, Tabs, Pagination, Table } from "antd"
import { CheckOutlined } from '@ant-design/icons';
import { paginate } from '../../../../util';
const { TabPane } = Tabs;
export const DetailBox = props =>{
const { tableModel, dataDesc, dataPreview, changeKey, tabKey, loading1, loading2 } = props;
console.log(tabKey)
return (
<div>
<Descriptions size="small" column={3}>
<Descriptions.Item label="资产名称">
<span dangerouslySetInnerHTML={{ __html: `${tableModel.name}` }} />
</Descriptions.Item>
<Descriptions.Item label="所属目录">{tableModel.topic}</Descriptions.Item>
<Descriptions.Item label="所属系统">{tableModel.system}</Descriptions.Item>
<Descriptions.Item label="发布时间">{tableModel.createTime_str}</Descriptions.Item>
<Descriptions.Item label="更新周期">{tableModel.updateCycle}</Descriptions.Item>
<Descriptions.Item label="数据周期">{tableModel.dataCycle}</Descriptions.Item>
<Descriptions.Item label="描述">
<span
dangerouslySetInnerHTML={{
__html: tableModel.remarks ? tableModel.remarks : '无',
}}
/>
</Descriptions.Item>
</Descriptions>
<Tabs defaultActiveKey="description"
activeKey={tabKey}
onChange={key => {
changeKey(key)
}}
>
<TabPane tab="数据概览" key="description">
<DataDesc dataDesc={dataDesc} loading={loading1}/>
</TabPane>
<TabPane tab="数据预览" key="preview">
<DataPreview dataPreview={dataPreview} loading={loading2} />
</TabPane>
</Tabs>
</div>
)
}
const despColumns = [
{
key: 'privileged',
title: '已授权',
render: (val) => (val.privileged === true ? <CheckOutlined className='text-primary' /> : <span></span>),
},
{ key: 'ordinalPosition', dataIndex: 'ordinalPosition', title: '序号' },
{ key: 'name', dataIndex: 'name', title: '名称' },
{ key: 'displayName', dataIndex: 'displayName', title: '显示名称' },
{ key: 'typeName', dataIndex: 'typeName', title: '数据格式' },
{ key: 'remarks', dataIndex: 'remarks', title: '备注' },
];
const DataDesc = props => {
const {dataDesc,loading} = props
const [{ pageNum, pageSize }, set_pagenation] = useState({ pageNum: 1, pageSize: 10 });
const showPage = dataDesc && dataDesc.columns && dataDesc.columns.length > 10;
let dataSource = dataDesc ? dataDesc.columns : [];
if (showPage) {
dataSource = paginate(dataDesc.columns, pageNum, pageSize);
}
return (
<Fragment>
<Table
size="small"
rowKey="ordinalPosition"
pagination={false}
columns={despColumns}
loading={loading}
dataSource={dataSource}
/>
{showPage && (
<Pagination
size="small"
className="text-center"
style={{ marginTop: 16 }}
showSizeChanger
showQuickJumper
onChange={(_pageNum, _pageSize) => {
set_pagenation({ pageNum: _pageNum, pageSize: _pageSize || 10 });
}}
onShowSizeChange={(_pageNum, _pageSize) => {
set_pagenation({ pageNum: _pageNum || 1, pageSize: _pageSize });
}}
current={pageNum}
pageSize={pageSize}
defaultCurrent={1}
total={dataDesc.columns.length}
showTotal={total => `共 ${total} 条`}
/>
)}
</Fragment>
);
}
class DataPreview extends Component {
render() {
const { dataPreview,loading } = this.props;
const columns = (dataPreview ? dataPreview.heading : []).map((col, i) => ({
key: i.toString(),
dataIndex: i,
title: col,
}));
const data = (dataPreview ? dataPreview.data : []).map((row) => {
const rowObj = {};
row.map((col, j) => {
rowObj[j] = col;
return null;
});
return rowObj;
});
return (
<Table
size="small"
rowKey="0"
pagination={false}
columns={columns}
loading={loading}
dataSource={data}
/>
);
}
}
\ No newline at end of file
import React, { Component } from "react";
import { Icon, Row, Col, Typography, Skeleton, List, Modal, Button, message } from 'antd';
import { dispatchLatest, dispatch } from '../../../../model';
import { DetailBox } from "./DetailBox";
const { Text } = Typography;
export default class ListBox extends Component {
constructor(props) {
super(props);
this.state = {
tableModel : null,
tabKey: 'description',
dataDesc: null,
dataPreview: null,
showModal:false,
loading1:false,
loading2:false,
};
}
componentDidUpdate(preProp,preState) {
const { tableModel, tabKey } = this.state;
if (preState.tableModel !== tableModel && tableModel !== null) {
this.setState({loading1:true})
dispatchLatest({
type: 'assets.listTableModelColumnsWithQuerySql',
payload: { tableModelId: tableModel.tableModelId },
callback: desc => {
this.setState({
dataDesc: desc,
loading1:false
});
}
});
if (tabKey !== 'description') {
this.setState({ tabKey: 'description' });
}
}
if (preState.tabKey !== tabKey && tabKey !== 'description' && tableModel) {
if (tabKey === 'preview') {
this.setState({loading2:true})
dispatchLatest({
type: 'assets.listTableModelSampleDatas',
payload: { tableModelId: tableModel.tableModelId },
callback: preview => {
this.setState({
dataPreview: preview,
loading2:false
});
}
});
}
}
}
onSubscribeModel(item, processId) {
const { updateItems } = this.props;
item.confirmState = true;
updateItems && updateItems();
dispatch({
type: 'user.confirmProcess',
payload: {'processId': processId},
callback: () => {
item.confirmState = true;
updateItems && updateItems();
message.success("确认成功!");
}
});
}
changeKey=(key)=>{
console.log(key)
this.setState({ tabKey: key },()=>{
console.log(this.state.tabKey)
});
}
render() {
const { tableModels, loading } = this.props
const { tableModel, dataDesc, dataPreview, showModal, tabKey, loading1, loading2 } = this.state
const IconText = ({ type, text }) => (
<span>
<Icon type={type} style={{ marginRight: 8 }} />
{text}
</span>
);
const getIcon = (type) => {
if (type === 'Table') return <Icon type="table" className="mr-2" />;
if (type === 'HanaView') return <Icon type="area-chart" className="mr-2" />;
return null;
};
const getActions = (item) => {
if (item.state=='approve') {
return [
<Button size="small" type="link" icon="book" disabled>已审核 </Button>,
item.confirmState=='toConfirm'? (
<Button size="small" type="link" icon="book"
onClick={this.onSubscribeModel.bind(this, item, item.processId)}
>待确认</Button>
) : (
<Button size="small" type="link" icon="book" disabled>已确认 </Button>
), <span></span>
];
}else if(item.state=='applying'){
return[
<Button size="small" type="link" icon="book" disabled>待审核</Button>,
<span></span>
]
}else if(item.state=='reject'){
return[
<Button size="small" type="link" icon="book" style={{color:'#ff4d4f'}} disabled>已驳回</Button>,
<span></span>
]
}
return []
};
const ListContent = ({ item }) => (
<React.Fragment>
<Row>
<Col md={6}> <Text>所属部门:</Text> {item.departMent} </Col>
<Col md={6}> <Text>更新周期:</Text> {item.updateCycle} </Col>
<Col md={6}> <Text>发布时间:</Text> {item.createTime_str} </Col>
<Col md={6}> <Text>所属系统:</Text> {item.system} </Col>
</Row>
<Row>
<Col md={18}> <Text>资产名称:</Text> <span dangerouslySetInnerHTML={{ __html: item.name }} /> </Col>
</Row>
<Row>
<Col md={18}> <Text>资产备注:</Text> <span dangerouslySetInnerHTML={{ __html: item.remarks }} /> </Col>
<Col md={6}>
{item.expireDate && <Text>失效时间:</Text>}
{item.expireDate}
</Col>
</Row>
</React.Fragment>
);
return (
<React.Fragment>
<List
className='asset-list'
loading={loading}
itemLayout="vertical"
dataSource={tableModels || []}
renderItem={item => (
<List.Item
actions={[
<IconText type="eye" text={item.visitCount} key="list-eye" />,
...getActions(item),
]}
>
<Skeleton title={false} loading={loading} active>
<List.Item.Meta
title={
<div className="pointer text-primary"
onClick={e => {
this.setState({ showModal: true, tableModel: item });
}}>
{getIcon(item.dbType)}
<span dangerouslySetInnerHTML={{ __html: item.displayName || '' }} />
</div>
}
description={<ListContent item={item} />}
/>
</Skeleton>
</List.Item>
)}
/>
{tableModel && (
<Modal
className="modal-lg"
title={<span>数据资产详情:{tableModel.displayName}</span>}
visible={showModal}
width="calc(100vw - 50px)"
onCancel={e => {
this.setState({ showModal: false });
}}
footer={
<div>
<Button type="primary" onClick={e => { this.setState({ showModal: false, }); }}>关闭</Button>
</div>
}
>
<DetailBox
tableModel={tableModel}
dataDesc={dataDesc}
dataPreview={dataPreview}
changeKey={this.changeKey}
tabKey={tabKey}
loading1={loading1}
loading2={loading2}
/>
</Modal>
)}
</React.Fragment>
);
}
}
import React, { Component } from "react";
import { Card, Table, Radio, Pagination, Input, Button, Modal } from 'antd';
import { dispatchLatest, dispatch } from '../../../model';
import { paginate } from '../../../util';
import PageHeaderWrapper from '../../../layout/PageHeaderWrapper';
import ListBox from './components/ListBox'
export default class index extends Component {
constructor(props) {
super(props);
this.state = {
loading: false,
total: 0,
pageNum: 1,
pageSize: 10,
tableModels:[]
};
}
componentDidMount() {
this.getList();
}
changeCurrent=(current,pagesize)=>{
this.setState({pageNum:current,pageSize:pagesize},()=>{
this.getList()
})
}
getList = () => {
const { pageNum, pageSize } = this.state
this.setState({ loading: true },() => {
const payload = {
page: pageNum,
pageSize: pageSize,
};
dispatchLatest({
type: 'user.listProcessByPage',
payload: payload,
callback: response => {
this.setState({
tableModels: response.data,
total: response.total,
loading: false
})
}
})
});
};
updateItems() {
const { tableModels } = this.state;
this.setState({ tableModels: tableModels });
}
render() {
const { tableModels, loading, pageNum, pageSize, total }= this.state
const _items = paginate(tableModels, pageNum, pageSize);
return (
<PageHeaderWrapper {...this.props}>
<Card bordered={false}>
<ListBox tableModels={_items} loading={loading} updateItems={this.updateItems.bind(this)}/>
<Pagination
className="text-center"
showSizeChanger
showQuickJumper
onChange={this.changeCurrent}
onShowSizeChange={this.changeCurrent}
current={pageNum}
pageSize={pageSize}
defaultCurrent={1}
total={total}
showTotal={total => `共 ${total} 条`}
/>
</Card>
</PageHeaderWrapper>
);
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
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