张延森 před 4 roky
rodič
revize
fb9a38ef3f

+ 1
- 1
src/pages/property/building/BatchImport.jsx Zobrazit soubor

18
 
18
 
19
   const downloadExcel = () => {
19
   const downloadExcel = () => {
20
     const link = document.createElement('a')
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
     link.setAttribute('download', '楼栋库模板.xlsx')
22
     link.setAttribute('download', '楼栋库模板.xlsx')
23
     link.click()
23
     link.click()
24
   }
24
   }

+ 22
- 1
src/pages/property/news/Edit.jsx Zobrazit soubor

1
 import React, { useEffect, useState } from 'react'
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
 import router from 'umi/router'
3
 import router from 'umi/router'
4
 import { fetch, apis } from '@/utils/request'
4
 import { fetch, apis } from '@/utils/request'
5
 import ImageUpload from '@/components/uploadImage/ImageUpload'
5
 import ImageUpload from '@/components/uploadImage/ImageUpload'
32
 const getNewsDetail = fetch(apis.propNews.getNewsDetail)
32
 const getNewsDetail = fetch(apis.propNews.getNewsDetail)
33
 const addNews = fetch(apis.propNews.addNews)
33
 const addNews = fetch(apis.propNews.addNews)
34
 const updateNews = fetch(apis.propNews.updateNews)
34
 const updateNews = fetch(apis.propNews.updateNews)
35
+const getTypeList = fetch(apis.propNews.newsType.list)
35
 
36
 
36
 export default Form.create()(props => {
37
 export default Form.create()(props => {
37
   const [loading, setLoading] = useState(false)
38
   const [loading, setLoading] = useState(false)
38
   const [newsData, setNewsData] = useState({})
39
   const [newsData, setNewsData] = useState({})
40
+  const [typeList, setTypeList] = useState([])
39
 
41
 
40
   const { id } = props.location.query
42
   const { id } = props.location.query
41
   
43
   
72
       })
74
       })
73
     }
75
     }
74
   }, [id])
76
   }, [id])
77
+
78
+  useEffect(() => {
79
+    getTypeList({pageSize: 999}).then(res => setTypeList(res.records))
80
+  }, [])
75
   
81
   
76
   return (
82
   return (
77
     <div>
83
     <div>
78
       <Form {...formItemLayout} onSubmit={handleSubmit}>
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
         <Form.Item label="标题">
100
         <Form.Item label="标题">
80
           {
101
           {
81
             props.form.getFieldDecorator('newsName', {
102
             props.form.getFieldDecorator('newsName', {

+ 26
- 1
src/pages/property/news/index.jsx Zobrazit soubor

8
 const getNewsList = fetchList(apis.propNews.getNewsList)
8
 const getNewsList = fetchList(apis.propNews.getNewsList)
9
 const updateNews = fetch(apis.propNews.updateNews)
9
 const updateNews = fetch(apis.propNews.updateNews)
10
 const deleteNews = fetch(apis.propNews.deleteNews)
10
 const deleteNews = fetch(apis.propNews.deleteNews)
11
+const getTypeList = fetch(apis.propNews.newsType.list)
11
 
12
 
12
 const Condition = props => {
13
 const Condition = props => {
13
   return (
14
   return (
19
         
20
         
20
         return (
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
             <Form.Item label="标题">
34
             <Form.Item label="标题">
23
             {
35
             {
24
               getFieldDecorator('newsName')(<Input placeholder="标题" />)
36
               getFieldDecorator('newsName')(<Input placeholder="标题" />)
41
   const [listData, setListData] = useState([])
53
   const [listData, setListData] = useState([])
42
   const [pagination, setPagination] = useState({})
54
   const [pagination, setPagination] = useState({})
43
   const [queryParams, setQueryParams] = useState({ pageNum: 1, pageSize: 10 })
55
   const [queryParams, setQueryParams] = useState({ pageNum: 1, pageSize: 10 })
56
+  const [typeList, setTypeList] = useState([])
44
 
57
 
45
   const handleSearch = vals => {
58
   const handleSearch = vals => {
46
     setQueryParams({
59
     setQueryParams({
82
     })
95
     })
83
   }
96
   }
84
 
97
 
98
+  const getNewsTypeName = newsTypeId => ((typeList || []).filter(x => x.newsTypeId === newsTypeId)[0] || {}).newsTypeName || ''
99
+
85
   useEffect(() => {
100
   useEffect(() => {
86
     setLoading(true)
101
     setLoading(true)
87
     getNewsList(queryParams).then(res => {
102
     getNewsList(queryParams).then(res => {
92
     }).catch(() => setLoading(false))
107
     }).catch(() => setLoading(false))
93
   }, [queryParams])
108
   }, [queryParams])
94
 
109
 
110
+  useEffect(() => {
111
+    getTypeList({pageSize: 999}).then(res => setTypeList(res.records))
112
+  }, [])
113
+
95
   return (
114
   return (
96
     <div>
115
     <div>
97
-      <Condition onSearch={handleSearch} onReset={handleSearch} />
116
+      <Condition onSearch={handleSearch} typeList={typeList} onReset={handleSearch} />
98
       <div style={{ margin: '24px 0' }}>
117
       <div style={{ margin: '24px 0' }}>
99
         <NavLink to={`/property/news/edit`}>
118
         <NavLink to={`/property/news/edit`}>
100
           <Button type="primary">添加</Button>
119
           <Button type="primary">添加</Button>
102
       </div>
121
       </div>
103
       <List dataSource={listData} loading={loading} pagination={pagination} onPageChange={handlePageChange} rowKey="newsId">
122
       <List dataSource={listData} loading={loading} pagination={pagination} onPageChange={handlePageChange} rowKey="newsId">
104
         <Table.Column title="#ID" dataIndex="newsId" key="newsId" />
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
         <Table.Column
130
         <Table.Column
106
           title="标题"
131
           title="标题"
107
           dataIndex="newsName"
132
           dataIndex="newsName"