张延森 4 년 전
부모
커밋
d6fe495e2d
3개의 변경된 파일18개의 추가작업 그리고 25개의 파일을 삭제
  1. 1
    1
      src/pages/property/news/type/NewsType.jsx
  2. 2
    1
      src/pages/property/notice/Edit.jsx
  3. 15
    23
      src/pages/property/notice/index.jsx

+ 1
- 1
src/pages/property/news/type/NewsType.jsx 파일 보기

@@ -58,7 +58,7 @@ function NewsType(props) {
58 58
 
59 59
 
60 60
   const changeNewsStatus = (row, newsId) => () => {
61
-    request({ ...propNews.newsType.put, urlData: { id: newsId }, data: { ...row, status: -1 } }).then((data) => {
61
+    request({ ...apis.propNews.newsType.put, urlData: { id: newsId }, data: { ...row, status: -1 } }).then((data) => {
62 62
       message.info('操作成功!')
63 63
       getList({ pageNum: 1, pageSize: 10 });
64 64
     }).catch((err) => {

+ 2
- 1
src/pages/property/notice/Edit.jsx 파일 보기

@@ -89,7 +89,8 @@ export default Form.create()(props => {
89 89
         <Form.Item label="类型">
90 90
         {
91 91
           getFieldDecorator('annType')(
92
-            <Select style={{}} allowClear>
92
+            <Select allowClear>
93
+              <Select.Option value={undefined}></Select.Option>
93 94
               <Select.Option value="notice">提醒</Select.Option>
94 95
             </Select>
95 96
           )

+ 15
- 23
src/pages/property/notice/index.jsx 파일 보기

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react'
2
-import { Select, Spin, Table, Button, Form, Input, Divider, Modal,Popconfirm } from 'antd'
2
+import { Select, Spin, Table, Button, Form, Input, Divider, Modal,Popconfirm, notification } from 'antd'
3 3
 import NavLink from 'umi/navlink'
4 4
 import { fetch, apis } from '@/utils/request'
5 5
 import Search from '../components/Search'
@@ -7,6 +7,7 @@ import List from '../components/List'
7 7
 
8 8
 const listAnnouncement = fetch(apis.announcement.listAnnouncement)
9 9
 const deleteAnnouncement = fetch(apis.announcement.deleteAnnouncement)
10
+const updateannouncement = fetch(apis.announcement.updateannouncement)
10 11
 
11 12
 const Condition = props => {
12 13
   return (
@@ -46,7 +47,7 @@ const Condition = props => {
46 47
 }
47 48
 
48 49
 const StatusDict = {
49
-  '0': '已作废',
50
+  '0': '未发布',
50 51
   '1': '已发布',
51 52
   '2': '草稿'
52 53
 }
@@ -65,15 +66,13 @@ export default props => {
65 66
     })
66 67
   }
67 68
 
68
-  const handleDeleteRow = row => {
69
-    deleteAnnouncement({ data: [row.id] }).then(res => {
70
-      Modal.success({
71
-        content: '删除内容成功',
72
-        onOk: () => {
73
-          // 触发数据刷新
74
-          setQueryParams({...queryParams})
75
-        }
76
-      })
69
+  const handleEditRow = row => {
70
+    updateannouncement({data: {
71
+      ...row,
72
+      status: Math.abs(row.status - 1)
73
+    }}).then(res => {
74
+      notification.success({message: '操作成功'})
75
+      setQueryParams({...queryParams})
77 76
     })
78 77
   }
79 78
 
@@ -88,7 +87,6 @@ export default props => {
88 87
   useEffect(() => {
89 88
     setLoading(true)
90 89
     listAnnouncement({ data: queryParams }).then(res => {
91
-      console.log(res,"222")
92 90
       const { list, ...pageInfo } = res || {}
93 91
       setListData(list)
94 92
       setPagination(pageInfo)
@@ -124,13 +122,7 @@ export default props => {
124 122
           title="状态"
125 123
           dataIndex="status"
126 124
           key="status"
127
-          render={(_, row) => {
128
-            if (row.status === '1' && (row.updateDate > row.createDate)) {
129
-              return '已修改'
130
-            }
131
-
132
-            return StatusDict[row.status]
133
-          }}
125
+          render={(_, row) => StatusDict[row.status]}
134 126
         />
135 127
         <Table.Column title="创建时间" dataIndex="createDate" key="createDate" />
136 128
         {/* <Table.Column title="发布人" dataIndex="createUserName" key="createUserName" />
@@ -143,12 +135,12 @@ export default props => {
143 135
             return (
144 136
               <>
145 137
                 <Popconfirm
146
-                  title="确认进行作废操作?"
147
-                  onConfirm={() => handleDeleteRow(row)}
148
-                  okText="作废"
138
+                  title="确认进行当前操作?"
139
+                  onConfirm={() => handleEditRow(row)}
140
+                  okText="确定"
149 141
                   cancelText="取消"
150 142
                 >
151
-                  <Button type="link">删除</Button>
143
+                  <Button type="link">{row.status === '1' ? '取消发布' : '发布'}</Button>
152 144
                 </Popconfirm>
153 145
                 <Divider type="vertical" />
154 146
                 <NavLink to={`/property/notice/edit?id=${row.id}`}>