张延森 4 anos atrás
pai
commit
fb9a38ef3f

+ 1
- 1
src/pages/property/building/BatchImport.jsx Ver arquivo

@@ -18,7 +18,7 @@ export default props => {
18 18
 
19 19
   const downloadExcel = () => {
20 20
     const link = document.createElement('a')
21
-    link.href = "http://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/%E6%A5%BC%E6%A0%8B%E5%BA%93%E6%A8%A1%E6%9D%BF.xlsx"
21
+    link.href = "https://zhiyun-image.oss-cn-shanghai.aliyuncs.com/xiangsong/%E6%A5%BC%E6%A0%8B%E5%BA%93%E6%A8%A1%E6%9D%BF.xlsx"
22 22
     link.setAttribute('download', '楼栋库模板.xlsx')
23 23
     link.click()
24 24
   }

+ 22
- 1
src/pages/property/news/Edit.jsx Ver arquivo

@@ -1,5 +1,5 @@
1 1
 import React, { useEffect, useState } from 'react'
2
-import { Form, Input, Button, Radio, InputNumber, notification } from 'antd'
2
+import { Form, Input, Button, Radio, InputNumber, notification, Select } from 'antd'
3 3
 import router from 'umi/router'
4 4
 import { fetch, apis } from '@/utils/request'
5 5
 import ImageUpload from '@/components/uploadImage/ImageUpload'
@@ -32,10 +32,12 @@ const tailFormItemLayout = {
32 32
 const getNewsDetail = fetch(apis.propNews.getNewsDetail)
33 33
 const addNews = fetch(apis.propNews.addNews)
34 34
 const updateNews = fetch(apis.propNews.updateNews)
35
+const getTypeList = fetch(apis.propNews.newsType.list)
35 36
 
36 37
 export default Form.create()(props => {
37 38
   const [loading, setLoading] = useState(false)
38 39
   const [newsData, setNewsData] = useState({})
40
+  const [typeList, setTypeList] = useState([])
39 41
 
40 42
   const { id } = props.location.query
41 43
   
@@ -72,10 +74,29 @@ export default Form.create()(props => {
72 74
       })
73 75
     }
74 76
   }, [id])
77
+
78
+  useEffect(() => {
79
+    getTypeList({pageSize: 999}).then(res => setTypeList(res.records))
80
+  }, [])
75 81
   
76 82
   return (
77 83
     <div>
78 84
       <Form {...formItemLayout} onSubmit={handleSubmit}>
85
+        <Form.Item label="分类">
86
+          {
87
+            props.form.getFieldDecorator('newsTypeId', {
88
+              rules: [
89
+                { required: true, message: '请选择分类' },
90
+              ],
91
+            })(
92
+              <Select>
93
+                {
94
+                  (typeList || []).map(x => <Select.Option key={x.newsTypeId} value={x.newsTypeId}>{x.newsTypeName}</Select.Option>)
95
+                }
96
+              </Select>
97
+            )
98
+          }
99
+        </Form.Item>
79 100
         <Form.Item label="标题">
80 101
           {
81 102
             props.form.getFieldDecorator('newsName', {

+ 26
- 1
src/pages/property/news/index.jsx Ver arquivo

@@ -8,6 +8,7 @@ import List from '../components/List'
8 8
 const getNewsList = fetchList(apis.propNews.getNewsList)
9 9
 const updateNews = fetch(apis.propNews.updateNews)
10 10
 const deleteNews = fetch(apis.propNews.deleteNews)
11
+const getTypeList = fetch(apis.propNews.newsType.list)
11 12
 
12 13
 const Condition = props => {
13 14
   return (
@@ -19,6 +20,17 @@ const Condition = props => {
19 20
         
20 21
         return (
21 22
           <>
23
+            <Form.Item label="分类">
24
+            {
25
+              getFieldDecorator('newsTypeId')(
26
+                <Select style={{width: '160px'}} placeholder="请选择分类">
27
+                  {
28
+                  (props.typeList || []).map(x => <Select.Option key={x.newsTypeId} value={x.newsTypeId}>{x.newsTypeName}</Select.Option>)
29
+                  }
30
+                </Select>
31
+              )
32
+            }
33
+            </Form.Item>
22 34
             <Form.Item label="标题">
23 35
             {
24 36
               getFieldDecorator('newsName')(<Input placeholder="标题" />)
@@ -41,6 +53,7 @@ export default props => {
41 53
   const [listData, setListData] = useState([])
42 54
   const [pagination, setPagination] = useState({})
43 55
   const [queryParams, setQueryParams] = useState({ pageNum: 1, pageSize: 10 })
56
+  const [typeList, setTypeList] = useState([])
44 57
 
45 58
   const handleSearch = vals => {
46 59
     setQueryParams({
@@ -82,6 +95,8 @@ export default props => {
82 95
     })
83 96
   }
84 97
 
98
+  const getNewsTypeName = newsTypeId => ((typeList || []).filter(x => x.newsTypeId === newsTypeId)[0] || {}).newsTypeName || ''
99
+
85 100
   useEffect(() => {
86 101
     setLoading(true)
87 102
     getNewsList(queryParams).then(res => {
@@ -92,9 +107,13 @@ export default props => {
92 107
     }).catch(() => setLoading(false))
93 108
   }, [queryParams])
94 109
 
110
+  useEffect(() => {
111
+    getTypeList({pageSize: 999}).then(res => setTypeList(res.records))
112
+  }, [])
113
+
95 114
   return (
96 115
     <div>
97
-      <Condition onSearch={handleSearch} onReset={handleSearch} />
116
+      <Condition onSearch={handleSearch} typeList={typeList} onReset={handleSearch} />
98 117
       <div style={{ margin: '24px 0' }}>
99 118
         <NavLink to={`/property/news/edit`}>
100 119
           <Button type="primary">添加</Button>
@@ -102,6 +121,12 @@ export default props => {
102 121
       </div>
103 122
       <List dataSource={listData} loading={loading} pagination={pagination} onPageChange={handlePageChange} rowKey="newsId">
104 123
         <Table.Column title="#ID" dataIndex="newsId" key="newsId" />
124
+        <Table.Column
125
+          title="分类"
126
+          dataIndex="newsTypeId"
127
+          key="newsTypeId"
128
+          render={x => getNewsTypeName(x)}
129
+        />
105 130
         <Table.Column
106 131
           title="标题"
107 132
           dataIndex="newsName"