袁兴隆 3 сар өмнө
parent
commit
167e678f8d

+ 42 - 33
src/views/messageBoard/messageBoard.vue

@@ -35,23 +35,36 @@
                             <span v-if="scope.row.isDelete == 1" style="color: #f56c6c;">是</span>
                         </template>
                     </el-table-column>
-					<el-table-column prop="isDelete" label="是否采纳">
-                        <template slot-scope="scope">
-                            <span v-if="scope.row.status == 0">否</span>
-                            <span v-if="scope.row.status == 1" style="color: #f56c6c;">是</span>
+					<el-table-column prop="status" label="是否采纳">
+						<template slot-scope="scope">
+                            <span v-if="scope.row.status == 0">未处理</span>
+                            <span v-if="scope.row.status == 1" style="color: #67c23a;">已采纳</span>
+                            <span v-if="scope.row.status == 2" style="color: #f56c6c;">已拒绝</span>
                         </template>
                     </el-table-column>
                     <el-table-column prop="createTime" label="创建时间" width="200">
 					</el-table-column>
                     <el-table-column prop="updateTime" label="更新时间" width="200">
 					</el-table-column>
-					<el-table-column label="操作" prop="id" width="200" fixed='right' align="center">
+					<el-table-column label="操作" prop="id" width="220" fixed='right' align="center">
 						<template slot-scope="scope">
+							<!-- 采纳:已处理(1/2)则禁用 -->
+							<el-button size="mini" type="primary" style="margin: 5px;"
+								@click="messageUpdate(scope.row,1)"
+								:disabled="scope.row.status === 1 || scope.row.status === 2">
+								采纳
+							</el-button>
+							<!-- 拒绝:已处理(1/2)则禁用 -->
 							<el-button size="mini" type="primary" style="margin: 5px;"
-								@click="messageUpdate(scope.row)">采纳
+								@click="messageUpdate(scope.row,2)"
+								:disabled="scope.row.status === 1 || scope.row.status === 2">
+								拒绝
 							</el-button>
+							<!-- 删除:已删除(isDelete=1)则禁用 -->
 							<el-button size="mini" type="danger" style="margin: 5px;"
-								@click="messageDelete(scope.row)">删除
+								@click="messageDelete(scope.row)"
+								:disabled="scope.row.isDelete === 1">
+								删除
 							</el-button>
 						</template>
 					</el-table-column>
@@ -113,8 +126,6 @@
 							type: 'warning'
 						});
 					}
-
-
 				})
 			},
             // 查询
@@ -151,7 +162,6 @@
 								duration: 1500,
 								onClose: () => {
 										this.classSelect()
-									// this.dialogVisibleS = false
 								}
 							})
 						}else{
@@ -159,38 +169,41 @@
 								message: data.msg,
 								type: 'warning',
 								duration: 1500,
-								onClose: () => {
-								}
 							})
 						}
-
 					})
 				}).catch(() => {})
 			},
-			// 更新留言
-			messageUpdate(row) {
-				this.$confirm(`确定采纳此条留言?`, '提示', {
+			// 更新留言(带回复输入框)
+			messageUpdate(row,status) {
+				let title = status == 1 ? '采纳留言' : '拒绝留言';
+				let content = status == 1 ? '请输入回复内容(采纳):' : '请输入回复内容(拒绝):';
+				
+				// 弹出可输入文本的弹窗
+				this.$prompt(content, title, {
 					confirmButtonText: '确定',
 					cancelButtonText: '取消',
-					type: 'warning'
-				}).then(() => {
+					type: 'warning',
+					inputPlaceholder: '请输入回复内容',
+					inputType: 'textarea',
+					inputRows: 3,
+				}).then(({ value }) => {
 					this.$http({
 						url: this.$http.adornUrl('messageBoard/updateMessageBoardStatus'),
 						method: 'get',
 						params: this.$http.adornParams({
-							'messageBoardId': row.messageId
+							'messageBoardId': row.messageId,
+							'status': status,
+							'replyContent': value
 						})
-					}).then(({
-						data
-					}) => {
+					}).then(({ data }) => {
 						if(data.code==0){
 							this.$message({
-								message: '采纳成功',
+								message: '操作成功',
 								type: 'success',
 								duration: 1500,
 								onClose: () => {
-										this.classSelect()
-									// this.dialogVisibleS = false
+									this.classSelect()
 								}
 							})
 						}else{
@@ -198,20 +211,17 @@
 								message: data.msg,
 								type: 'warning',
 								duration: 1500,
-								onClose: () => {
-								}
 							})
 						}
-
 					})
-				}).catch(() => {})
+				}).catch(() => {
+					this.$message.info('已取消操作');
+				})
 			},
-
 		},
 		mounted() {
 			this.classSelect()
 		},
-    
 	}
 </script>
 
@@ -332,7 +342,6 @@
 	.bqList:hover .delss {
 		display: initial;
 		opacity: 0.5;
-
 	}
 
 	.tj {
@@ -342,4 +351,4 @@
 		border: 1px solid #ccc;
 		border-radius: 4px;
 	}
-</style>
+</style>