This commit is contained in:
2021-07-08 14:22:39 +08:00
47 changed files with 966 additions and 168 deletions

View File

@@ -547,10 +547,13 @@
line-height: @layout-header-height - 16px;
height: @layout-header-height - 20px;
color: fade(@black, 35%);
.anticon {
color: fade(@black, 35%);
}
&:hover {
color: @icon-color-hover;
background-color: fade(@black, 5%);
.anticon {
color: @icon-color-hover;
@@ -596,10 +599,12 @@
}
.header-actions {
.header-action {
color: fade(@white, 60%);
.anticon {
color: fade(@white, 60%);
}
&:hover {
color: @white;
background-color: fade(@white, 20%);
.anticon {
color: @white;

View File

@@ -541,10 +541,13 @@
line-height: @layout-header-height - 16px;
height: @layout-header-height - 20px;
color: fade(@black, 35%);
.anticon {
color: fade(@black, 35%);
}
&:hover {
color: @icon-color-hover;
background-color: fade(@black, 5%);
.anticon {
color: @icon-color-hover;
@@ -590,10 +593,12 @@
}
.header-actions {
.header-action {
color: fade(@white, 60%);
.anticon {
color: fade(@white, 60%);
}
&:hover {
color: @white;
background-color: fade(@white, 20%);
.anticon {
color: @white;

View File

@@ -1,6 +1,7 @@
const urls = {
houseInfoGetByTaskId: ['/houseInfo/getByTaskId', 'get'],
houseInfoSave: ['houseInfo/save', 'post'],
houseInfoCheck: ['houseInfo/check', 'post'],
houseInfoSubmitToCheck: ['/houseInfo/submitToCheck', 'post']
}

View File

@@ -5,7 +5,8 @@ const urls = {
houseProejctDelete: ['/houseProjectInfo/delete', 'post'],
houseProejctDetail: ['/houseProjectInfo/detail', 'get'],
houseProjectNextSort: ['/houseProjectInfo/nextSort', 'get'],
houseProjectList: ['houseProjectInfo/list', 'get']
houseProjectList: ['houseProjectInfo/list', 'get'],
houseProjectGetById: ['houseProjectInfo/getById', 'get']
}
export default urls

View File

@@ -8,7 +8,8 @@ const urls = {
houseZoneList: '/houseZone/list',
houseZoneAutoIncrement: '/houseZone/autoIncrement',
houseZoneAdd: ['/houseZone/add', 'post'],
houseZoneEdit: ['/houseZone/edit', 'post']
houseZoneEdit: ['/houseZone/edit', 'post'],
houseZoneGetById: ['/houseZone/getById', 'get']
}
export default urls

View File

@@ -0,0 +1,72 @@
import React, { Component } from 'react'
import { Spin, Steps, Timeline } from 'antd'
import { AntIcon } from 'components'
import { api } from 'common/api'
import getDictData from 'util/dic'
import { toCamelCase } from 'util/format'
export default class houseLog extends Component {
state = {
loading: true,
codes: {
houseLogType: [],
},
data: [],
}
async componentDidMount() {
const { id, infoId, taskId } = this.props
const state = { loading: false }
state.codes = await getDictData('house_log_type')
if (id) {
} else if (infoId) {
} else if (taskId) {
const { data } = await api.houseLogListByTaskId({ id: taskId })
state.data = data
}
this.setState(state)
}
bindCodeValue(code, name) {
name = toCamelCase(name)
const codes = this.state.codes[name]
if (codes) {
const c = codes.find(p => p.code == code)
if (c) {
return c.value
}
}
return null
}
render() {
const { loading, codes, data } = this.state
return (
<Spin spinning={loading} indicator={<AntIcon type="loading" />}>
<Timeline mode="left">
{data.map((item, i) => (
<Timeline.Item
key={i}
dot={
[
,
<AntIcon type="clock-circle" />,
<AntIcon type="check-circle" />,
][item.status]
}
>
<h5 className="h5">
{this.bindCodeValue(item.type, 'house_log_type')}
</h5>
<p className="text-gray">{item.updatedTime}</p>
<p>{item.targetUserNames}</p>
</Timeline.Item>
))}
</Timeline>
</Spin>
)
}
}

View File

@@ -14,3 +14,5 @@ export { default as QueryList } from './query-list'
export { default as QueryTable } from './query-table'
export { default as QueryTableActions } from './query-table-actions'
export { default as QueryTreeLayout } from './query-tree-layout'
export { default as HouseLog } from './business/house-log'

View File

@@ -26,7 +26,7 @@ export default class QueryTableActions extends Component {
(series && node.className == className) ||
(!node.nextElementSibling && node.className == className)
) {
node.remove()
node.style.display = 'none'
series = false
} else if (node.className == className) {
series = true

View File

@@ -50,11 +50,11 @@ export default class index extends Component {
title: '房屋编码',
dataIndex: 'houseCode',
sorter: true,
width: 300,
width: 400,
render: (text, record) => (
<>
{`${record.areaName}-${record.roadName}-${record.commName}-${
record.note
record.fullProjName
}-${record.no.toString().padStart(3, '0')}`}
<br />
<Tag color="purple">{text}</Tag>
@@ -77,9 +77,9 @@ export default class index extends Component {
},
{
title: '登记时间',
width: 180,
dataIndex: 'createdTime',
sorter: true,
width: 150,
},
]

View File

@@ -1,7 +1,7 @@
import React, { Component } from 'react'
import { Form, Button, Input, Descriptions, message as Message, Modal, Spin, Tabs } from 'antd'
import { merge, isEqual, pickBy } from 'lodash'
import { AntIcon, ComponentDynamic, Container } from 'components'
import { AntIcon, ComponentDynamic, Container, Auth } from 'components'
import { api } from 'common/api'
const tabs = [
@@ -58,7 +58,7 @@ const actions = {
after: 'close',
},
check: {
action: 'houseInfoSave',
action: 'houseInfoCheck',
remark: '审核',
after: 'close',
},
@@ -222,41 +222,43 @@ export default class index extends Component {
<Container mode="fluid">
<div className="yo-form-page--bar-inner">
<span>
{this.state.taskStatus == 3 && (
<Form ref={this.checkForm} layout="inline">
<Form.Item
label="审核意见"
name={['taskCheckRecord', 'content']}
rules={[
{
required: true,
message: '请输入审核意见',
},
]}
>
<Input.TextArea
autoSize
autoComplete="off"
placeholder="请输入审核意见"
className="w-500"
/>
</Form.Item>
<Form.Item>
<Button
type="primary"
onClick={() => this.onCheck(6)}
<Auth auth={{ houseInfo: 'check' }}>
{this.state.taskStatus == 3 && (
<Form ref={this.checkForm} layout="inline">
<Form.Item
label="审核意见"
name={['taskCheckRecord', 'content']}
rules={[
{
required: true,
message: '请输入审核意见',
},
]}
>
通过
</Button>
<Button
type="primary"
onClick={() => this.onCheck(-1)}
>
退回
</Button>
</Form.Item>
</Form>
)}
<Input.TextArea
autoSize
autoComplete="off"
placeholder="请输入审核意见"
className="w-500"
/>
</Form.Item>
<Form.Item>
<Button
type="primary"
onClick={() => this.onCheck(6)}
>
通过
</Button>
<Button
type="primary"
onClick={() => this.onCheck(-1)}
>
退回
</Button>
</Form.Item>
</Form>
)}
</Auth>
</span>
<span>
{this.state.taskStatus >= -1 && this.state.taskStatus < 3 && (
@@ -302,7 +304,7 @@ export default class index extends Component {
`${record.houseCode.areaName}-${
record.houseCode.roadName
}-${record.houseCode.commName}-${
record.houseCode.projectFullName
record.houseCode.fullProjName
}-${record.houseCode.no.toString().padStart(3, '0')}`}
</Descriptions.Item>
<Descriptions.Item span="2" label="编码">

View File

@@ -48,9 +48,9 @@ export default class index extends Component {
sorter: true,
width: 300,
render: (text, record) =>
`${record.areaName}-${record.roadName}-${record.commName}-${record.note}-${record.no
.toString()
.padStart(3, '0')}`,
`${record.areaName}-${record.roadName}-${record.commName}-${
record.fullProjName
}-${record.no.toString().padStart(3, '0')}`,
},
{
title: '房屋性质及行业',

View File

@@ -48,9 +48,9 @@ export default class index extends Component {
sorter: true,
width: 300,
render: (text, record) =>
`${record.areaName}-${record.roadName}-${record.commName}-${record.note}-${record.no
.toString()
.padStart(3, '0')}`,
`${record.areaName}-${record.roadName}-${record.commName}-${
record.fullProjName
}-${record.no.toString().padStart(3, '0')}`,
},
{
title: '房屋性质及行业',

View File

@@ -41,19 +41,29 @@ export default class form extends Component {
* @param {*} params
*/
async fillData(params) {
const areaCodeDefault = params.record
? params.record.areaCode
: params.pid
? params.pid
: ''
let areaCodeDefault = params.pid ? params.pid : ''
this.houseType = params.record ? params.record.type : 1
this.record = cloneDeep(params.record)
if (params.id) {
this.setState({
loading: true,
})
api.houseProjectGetById({ projectId: params.id }).then(({ data }) => {
areaCodeDefault = data.areaCode
this.record = data
this.setState({
loading: false,
})
})
}
// this.record = cloneDeep(params.record)
this.initRecord = cloneDeep(params.record)
//#region 从后端转换成前段所需格式
const areaData = await this.loadAreaData()
this.setState({
exist: !!params.record,
exist: !!params.id,
options: { areaData },
})
@@ -81,7 +91,9 @@ export default class form extends Component {
if (areaCodeDefault) {
findCode(areaData)
this.areaCode = areaCodeDefault
this.nextSort(this.areaCode, this.houseType)
if (!this.state.exist) {
this.nextSort(this.areaCode, this.houseType)
}
}
this.record = {

View File

@@ -88,7 +88,7 @@ export default class index extends Component {
render: (text, record) => (
<QueryTableActions>
<Auth auth="houseProjectInfo:edit">
<a onClick={() => this.onOpen(this.editForm, record)}>编辑</a>
<a onClick={() => this.onOpen(this.editForm, record.id)}>编辑</a>
</Auth>
<Auth auth="houseProjectInfo:delete">
<Popconfirm
@@ -200,10 +200,11 @@ export default class index extends Component {
* @param {*} modal
* @param {*} record
*/
onOpen(modal, record) {
onOpen(modal, id) {
modal.current.open({
pid: this.selectCode,
record,
// record,
id,
})
}

View File

@@ -56,7 +56,7 @@ export default class index extends Component {
render: (text, record) => (
<>
{`${record.areaName}-${record.roadName}-${record.commName}-${
record.note
record.fullProjName
}-${record.no.toString().padStart(3, '0')}`}
<br />
<Tag color="purple">{text}</Tag>

View File

@@ -1,5 +1,5 @@
import React, { Component } from 'react'
import { Card, Form, Input, message as Message, Radio, Select, Tag } from 'antd'
import { Card, Checkbox, Form, Input, message as Message, Radio, Select, Tag } from 'antd'
import { Auth, Container, QueryTable, QueryTableActions } from 'components'
import { api } from 'common/api'
import auth from 'components/authorized/handler'
@@ -7,6 +7,7 @@ import { isEqual } from 'lodash'
import getDictData from 'util/dic'
import { toCamelCase } from 'util/format'
import { getSearchInfo } from 'util/query'
import { checkboxCheckedNone } from 'util/tool'
/**
* 注释段[\/**\/]为必须要改
@@ -49,11 +50,11 @@ export default class index extends Component {
title: '房屋编码',
dataIndex: 'houseCode',
sorter: true,
width: 300,
width: 400,
render: (text, record) => (
<>
{`${record.areaName}-${record.roadName}-${record.commName}-${
record.note
record.fullProjName
}-${record.no.toString().padStart(3, '0')}`}
<br />
<Tag color="purple">{text}</Tag>
@@ -245,12 +246,22 @@ export default class index extends Component {
columns={this.columns}
queryInitialValues={{
type: '',
state: 0,
state: [-1, 0, 1, 2],
}}
onQueryChange={values => {
if (values.hasOwnProperty('type')) {
this.setState({ type: values.type })
}
if (values.hasOwnProperty('state')) {
const value = checkboxCheckedNone({
value: values.state,
length: codes.houseStatus.length,
required: true,
})
return {
state: value,
}
}
}}
query={
<Auth auth={{ [authName]: 'page' }}>
@@ -286,14 +297,14 @@ export default class index extends Component {
<Input autoComplete="off" placeholder="请输入房屋唯一编码" />
</Form.Item>
<Form.Item label="建档状态" name="state">
<Select allowClear className="w-150" placeholder="建档状态">
<Select.Option value="">全部</Select.Option>
<Checkbox.Group>
<Checkbox value="">全部</Checkbox>
{codes.houseStatus.map(item => (
<Select.Option key={item.code} value={+item.code}>
<Checkbox key={item.code} value={+item.code}>
{item.value}
</Select.Option>
</Checkbox>
))}
</Select>
</Checkbox.Group>
</Form.Item>
</Auth>
}

View File

@@ -1,7 +1,7 @@
import React, { Component } from 'react'
import { Form, Input, InputNumber, Spin, TreeSelect } from 'antd'
import { AntIcon } from 'components'
import { cloneDeep } from 'lodash'
import { cloneDeep, pickBy } from 'lodash'
import { api } from 'common/api'
import { numberToChinese } from 'util/format'
import store from 'store'
@@ -54,12 +54,25 @@ export default class form extends Component {
*/
async fillData(params) {
const { user } = this.state
this.record = cloneDeep(params.record)
if (params.id) {
this.setState({
loading: true,
})
api.houseZoneGetById({ zoneId: params.id }).then(({ data }) => {
this.record = data
this.setState({
loading: false,
})
})
}
// this.record = cloneDeep(params.record)
//#region 从后端转换成前段所需格式
const orgData = await this.loadOrgData()
this.setState({
exist: !!params.record,
exist: !!params.id,
options: { orgData },
})
@@ -78,7 +91,7 @@ export default class form extends Component {
}
//#endregion
if (!params.record && !!params.orgId) {
if (!params.id && !!params.orgId) {
this.onOrgIdChanged(params.orgId)
}
this.form.current.setFieldsValue(this.record)

View File

@@ -80,7 +80,7 @@ export default class index extends Component {
render: (text, record) => (
<QueryTableActions>
<Auth auth="houseZone:edit">
<a onClick={() => this.onOpen(this.editForm, record)}>编辑</a>
<a onClick={() => this.onOpen(this.editForm, record.id)}>编辑</a>
</Auth>
<Auth auth="houseZone:delete">
<Popconfirm
@@ -180,10 +180,11 @@ export default class index extends Component {
* @param {*} modal
* @param {*} record
*/
onOpen(modal, record) {
onOpen(modal, id) {
modal.current.open({
orgId: this.selectId,
record,
// record,
id,
})
}

View File

@@ -139,7 +139,6 @@ export default class form extends Component {
*/
async getData() {
const form = this.form.current
console.log(this.record)
const valid = await form.validateFields()
if (valid) {
const postData = form.getFieldsValue()

View File

@@ -56,28 +56,38 @@ export default class index extends Component {
{
title: '标题',
dataIndex: 'title',
width: 300,
sorter: true,
},
{
title: '发布人',
dataIndex: 'publicUserName',
width: 120,
sorter: true,
},
{
title: '发布时间',
dataIndex: 'createdTime',
width: 150,
sorter: true,
},
{
title: '发布单位',
dataIndex: 'publicOrgName',
width: 200,
width: 150,
sorter: true,
},
{
title: '类型',
dataIndex: 'type',
width: 120,
sorter: true,
render: text => this.bindCodeValue(text, 'notice_type'),
},
{
title: '状态',
dataIndex: 'status',
width: 120,
render: text => this.bindCodeValue(text, 'notice_status'),
},
]
@@ -94,7 +104,7 @@ export default class index extends Component {
if (flag) {
this.columns.push({
title: '操作',
width: 150,
width: 200,
dataIndex: 'actions',
render: (text, record) => (
<QueryTableActions>
@@ -178,6 +188,7 @@ export default class index extends Component {
})
})
}
subUniqueKey(text, index) {
return text.substr(index, 5)
}
@@ -252,26 +263,23 @@ export default class index extends Component {
* @param {*} id
*/
onDelete(id) {
this.onAction(apiAction.Status({ id, Status: 3 }), '删除成功')
this.onAction(apiAction.Status({ id, status: 3 }), '删除成功')
}
/**
* 发布
* @param {*} id
*/
onPublish(id) {
this.onAction(apiAction.Status({ id, Status: 1 }), '发布成功')
this.onAction(apiAction.Status({ id, status: 1 }), '发布成功')
}
/**
* 撤回
* @param {*} id
*/
onGoBack(id) {
this.onAction(apiAction.Status({ id, Status: 2 }), '撤回成功')
this.onAction(apiAction.Status({ id, status: 2 }), '撤回成功')
} //
//#region 自定义方法
//#endregion
render() {
const { codes } = this.state
return (
@@ -280,7 +288,6 @@ export default class index extends Component {
<Card bordered={false}>
<QueryTable
ref={this.table}
rowkey={record => record.id}
autoLoad={false}
loadData={this.loadData}
columns={this.columns}

View File

@@ -1,15 +1,18 @@
import React, { Component } from 'react'
import { Spin, Divider, Modal, Row } from 'antd'
import { Spin, Divider, Modal, Row, Form, Upload } from 'antd'
import { api } from 'common/api'
import { AntIcon } from 'components'
import { BlobToBase64, GetFileName, PreviewFile } from 'util/file'
export default class form extends Component {
state = {
detailVisible: false,
detailLoading: false,
detailData: {},
fileValue: false,
}
filedu = React.createRef()
/**
* mount后回调
*/
@@ -20,12 +23,57 @@ export default class form extends Component {
async onOpenDetail(id) {
this.setState({ detailLoading: true, detailVisible: true })
const { data } = await api.sysNoticeDetail({ id })
this.setState({
detailLoading: false,
detailData: data,
fileValue: false,
})
if (data) {
const { attachments } = data
if (attachments) {
const fileValue = []
const fileList = attachments.split(',')
for (const fileId of fileList) {
try {
const file = await PreviewFile(fileId)
const base64 = await BlobToBase64(file)
fileValue.push({
uid: fileId,
response: fileId,
name: file.name,
url: base64,
status: 'done',
})
} catch {
const { data: file } = await api.sysFileInfoDetail({ id: fileId })
fileValue.push({
uid: fileId,
response: '文件已丢失',
name: file.fileOriginName,
status: 'error',
})
}
}
this.setState({
fileValue,
})
}
}
}
async onFileDownload(file) {
const { data, headers } = await api.sysFileInfoDownload({ id: file.response })
const url = window.URL.createObjectURL(data)
const fileName = GetFileName(headers['content-disposition'])
const a = document.createElement('a')
a.href = url
a.download = fileName
a.click()
window.URL.revokeObjectURL(url)
a.remove()
}
render() {
const { detailLoading, detailVisible, detailData } = this.state
return (
@@ -43,6 +91,21 @@ export default class form extends Component {
dangerouslySetInnerHTML={{ __html: detailData.content }}
></div>
<Divider />
{this.state.fileValue && (
<Row>
<span>
查看附件
<Upload
fileList={this.state.fileValue}
showUploadList={{
showDownloadIcon: true,
}}
onDownload={file => this.onFileDownload(file)}
></Upload>
</span>
</Row>
)}
<Divider />
<Row justify="space-between" className="text-gray">
<span>发布人{detailData.publicUserName}</span>
<span>发布时间{detailData.publicTime} </span>

View File

@@ -20,6 +20,7 @@ export default class index extends Component {
codes: {
noticeStatus: [],
noticeType: [],
readStatus: [],
},
}
@@ -33,25 +34,39 @@ export default class index extends Component {
{
title: '标题',
dataIndex: 'title',
width: 300,
sorter: true,
},
{
title: '发布人',
dataIndex: 'publicUserName',
width: 150,
sorter: true,
},
{
title: '发布时间',
dataIndex: 'createdTime',
width: 200,
sorter: true,
},
{
title: '发布单位',
dataIndex: 'publicOrgName',
width: 200,
sorter: true,
},
{
title: '类型',
dataIndex: 'type',
width: 120,
render: text => this.bindCodeValue(text, 'notice_type'),
},
{
title: '已读未读',
dataIndex: 'readStatus',
width: 120,
render: text => this.bindCodeValue(text, 'read_status'),
},
]
/**
@@ -94,33 +109,13 @@ export default class index extends Component {
componentDidMount() {
const { onLoading, onLoadData } = this.table.current
onLoading()
getDictData('notice_status', 'notice_type').then(codes => {
getDictData('notice_status', 'notice_type', 'read_status').then(codes => {
this.setState({ codes }, () => {
onLoadData()
})
})
}
/**
* 对表格上的操作进行统一处理
* [异步]
* @param {*} action
* @param {*} successMessage
*/
async onAction(action, successMessage) {
const { onLoading, onLoaded, onReloadData } = this.table.current
onLoading()
try {
if (action) {
await action
}
if (successMessage) {
Message.success(successMessage)
}
onReloadData()
} catch {
onLoaded()
}
}
/**
* 调用加载数据接口,可在调用前对query进行处理
* [异步,必要]
@@ -134,6 +129,7 @@ export default class index extends Component {
queryType: {
type: QueryType.Equal,
title: QueryType.Like,
readStatus: QueryType.Equal,
},
})
@@ -200,6 +196,19 @@ export default class index extends Component {
))}
</Select>
</Form.Item>
<Form.Item label="已读未读" name="readStatus">
<Select
placeholder="请选择是否已读"
className="w-200"
allowClear
>
{codes.readStatus.map(item => (
<Select.Option key={item.code} value={item.code}>
{item.value}
</Select.Option>
))}
</Select>
</Form.Item>
</Auth>
}
/>

View File

@@ -38,6 +38,11 @@ export const RSA_PUBLIC_KEY = '-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQU
*/
export const CITY = '黄石市'
/**
*
*/
export const AMAP_WEBAPI_KEY = 'ca01719fe09757131a1249c273619a17'
/**
* 响应式响应宽度
*/

View File

@@ -0,0 +1,23 @@
import { first, last } from "lodash"
export const checkboxCheckedNone = (arg) => {
let { value, length, noneValue, required } = arg
if (length === undefined) length = 2
if (noneValue === undefined) noneValue = ''
if (required === undefined) required = false
if (first(value) === noneValue && value.length > 1) {
// 在'无'之后选中其他值
value.shift()
} else if (
value.length >= length
||
(last(value) === noneValue && value.length > 1)
||
(!value.length && required)
) {
// 在其他值之后选中'无'
value = [noneValue]
}
return value
}

View File

@@ -6,6 +6,7 @@ import { api } from 'common/api'
import Logo from '../logo'
import Search from './search'
import Weather from './weather'
import Notice from './notice'
import User from './user'
@@ -53,6 +54,7 @@ export default class index extends Component {
<Search />
</div>
<div className="header-actions">
<Weather />
<Tooltip placement="bottom" title="重新加载框架">
<span
className="header-action"

View File

@@ -1,8 +1,9 @@
import React, { Component } from 'react'
import { Badge, Button, Divider, List, Menu, Modal, Popover, Row, Spin } from 'antd'
import { Badge, Button, Divider, List, Menu, Modal, Popover, Row, Spin, Upload, Tag } from 'antd'
import { AntIcon, Image } from 'components'
import { api } from 'common/api'
import InfiniteScroll from 'react-infinite-scroller'
import { BlobToBase64, GetFileName, PreviewFile } from 'util/file'
import moment from 'moment'
export default class notice extends Component {
@@ -16,6 +17,7 @@ export default class notice extends Component {
detailVisible: false,
detailLoading: false,
detailData: {},
fileValue: false,
}
async componentDidMount() {
@@ -42,7 +44,6 @@ export default class notice extends Component {
sortField: 'createdTime',
sortOrder: 'descend',
})
if (!items.length) {
return this.finish()
}
@@ -59,7 +60,51 @@ export default class notice extends Component {
this.setState({
detailLoading: false,
detailData: data,
fileValue: false,
})
if (data) {
const { attachments } = data
if (attachments) {
const fileValue = []
const fileList = attachments.split(',')
for (const fileId of fileList) {
try {
const file = await PreviewFile(fileId)
const base64 = await BlobToBase64(file)
fileValue.push({
uid: fileId,
response: fileId,
name: file.name,
url: base64,
status: 'done',
})
} catch {
const { data: file } = await api.sysFileInfoDetail({ id: fileId })
fileValue.push({
uid: fileId,
response: '文件已丢失',
name: file.fileOriginName,
status: 'error',
})
}
}
this.setState({
fileValue,
})
}
}
}
async onFileDownload(file) {
const { data, headers } = await api.sysFileInfoDownload({ id: file.response })
const url = window.URL.createObjectURL(data)
const fileName = GetFileName(headers['content-disposition'])
const a = document.createElement('a')
a.href = url
a.download = fileName
a.click()
window.URL.revokeObjectURL(url)
a.remove()
}
renderList() {
@@ -88,6 +133,13 @@ export default class notice extends Component {
</small>
</>
}
description={
item.readStatus == 0 ? (
<Tag color="#f50">未读</Tag>
) : (
<Tag color="#2db7f5">已读</Tag>
)
}
/>
<div className="ellipsis-3 text-gray">{item.content}</div>
</List.Item>
@@ -140,6 +192,21 @@ export default class notice extends Component {
dangerouslySetInnerHTML={{ __html: detailData.content }}
></div>
<Divider />
{this.state.fileValue && (
<Row className="text-gray">
<span>
查看附件
<Upload
fileList={this.state.fileValue}
showUploadList={{
showDownloadIcon: true,
}}
onDownload={file => this.onFileDownload(file)}
></Upload>
</span>
</Row>
)}
<Divider />
<Row justify="space-between" className="text-gray">
<span>发布人{detailData.publicUserName}</span>
<span>发布时间{detailData.publicTime} </span>

View File

@@ -0,0 +1,51 @@
import React, { Component } from 'react'
import { Space } from 'antd'
import AntIcon from 'components/ant-icon'
import { axios } from 'common/api'
import { AMAP_WEBAPI_KEY } from 'util/global'
export default class weather extends Component {
state = {
weather: '',
temperature: 0,
}
async componentDidMount() {
const {
data: { adcode },
} = await axios.get('https://restapi.amap.com/v3/ip', {
params: {
key: AMAP_WEBAPI_KEY,
},
})
const {
data: { lives },
} = await axios.get('http://restapi.amap.com/v3/weather/weatherInfo', {
params: {
key: AMAP_WEBAPI_KEY,
city: adcode,
},
})
if (Array.isArray(lives)) {
const { weather, temperature } = lives.shift()
this.setState({
weather,
temperature,
})
}
}
render() {
const { weather, temperature } = this.state
return (
<span className="header-action">
<Space align="center" style={{ lineHeight: 1 }}>
<AntIcon type="cloud" />
<span>{temperature}</span>
<span>{weather}</span>
</Space>
</span>
)
}
}