|
@@ -11,8 +11,8 @@
|
|
|
>
|
|
|
<div class="form-box">
|
|
|
<el-form :ref="formName" :model="formData" :rules="rules">
|
|
|
- <el-form-item prop="comment">
|
|
|
- <el-input v-model="formData.comment" type="textarea" :rows="5" clearable placeholder="请输入" />
|
|
|
+ <el-form-item prop="content">
|
|
|
+ <el-input v-model="formData.content" type="textarea" :rows="5" clearable placeholder="请输入" />
|
|
|
</el-form-item>
|
|
|
<el-form-item style="text-align: right">
|
|
|
<el-button type="primary" @click="saveItem">确定</el-button>
|
|
@@ -21,22 +21,23 @@
|
|
|
</div>
|
|
|
<div>
|
|
|
<el-input
|
|
|
- v-model="comment"
|
|
|
+ v-model="content"
|
|
|
suffix-icon="el-icon-search"
|
|
|
placeholder="搜索"
|
|
|
style="width:250px; margin-bottom:10px"
|
|
|
@change="searchTable"
|
|
|
/>
|
|
|
<div class="list-table">
|
|
|
- <el-table v-loading="loading" :data="tableData" border stripe height="500" style="width: 100%;">
|
|
|
+ <el-table v-loading="tableLoading" :data="tableData" border stripe height="500" style="width: 100%;">
|
|
|
<el-table-column type="index" label="序号" width="50" />
|
|
|
- <el-table-column prop="comment" label="留言内容" width="100" show-overflow-tooltip />
|
|
|
+ <el-table-column prop="content" label="留言内容" width="100" show-overflow-tooltip />
|
|
|
<el-table-column prop="createUser" label="发起人姓名" show-overflow-tooltip />
|
|
|
<el-table-column prop="createOrgName" label="发起人所属单位" width="160" show-overflow-tooltip />
|
|
|
<el-table-column prop="createTime" label="创建时间" width="160" />
|
|
|
+ <el-table-column prop="updateTime" label="更新时间" width="160" />
|
|
|
<el-table-column label="操作" align="center" width="160" class-name="action-column">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="text">详情回复</el-button>
|
|
|
+ <el-button type="text" @click="showDetail(scope.row.id)">详情回复</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -57,14 +58,19 @@
|
|
|
<el-button @click="close">取消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+ <comment-detail ref="commentDetail" />
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+import CommentDetail from './CommentDetail'
|
|
|
|
|
|
-// import { fetchCommentList, pushCommentAdd } from '@/api/comment'
|
|
|
+import { hasValidRecords } from '@/utils/convert'
|
|
|
+
|
|
|
+import { fetchCommentList, pushCommentAdd } from '@/api/comment'
|
|
|
|
|
|
export default {
|
|
|
name: 'CommentAdd',
|
|
|
+ components: { CommentDetail },
|
|
|
data() {
|
|
|
return {
|
|
|
// dialog
|
|
@@ -72,15 +78,15 @@ export default {
|
|
|
// form
|
|
|
formName: 'editForm',
|
|
|
formData: {
|
|
|
- comment: ''
|
|
|
+ content: ''
|
|
|
},
|
|
|
rules: {
|
|
|
- comment: [
|
|
|
+ content: [
|
|
|
{ required: true, message: '请输入留言', trigger: 'blur' }
|
|
|
]
|
|
|
},
|
|
|
// search
|
|
|
- comment: '',
|
|
|
+ content: '',
|
|
|
// table
|
|
|
current: 1,
|
|
|
size: 20,
|
|
@@ -89,7 +95,8 @@ export default {
|
|
|
tableData: [],
|
|
|
multipleSelection: [],
|
|
|
// others
|
|
|
- loading: false
|
|
|
+ loading: false,
|
|
|
+ tableLoading: false
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -119,66 +126,68 @@ export default {
|
|
|
},
|
|
|
// 获取table数据
|
|
|
getTablelist() {
|
|
|
- this.$message.info('开发中...')
|
|
|
- // this.loading = true
|
|
|
- // const params = {
|
|
|
- // current: this.current,
|
|
|
- // size: this.size,
|
|
|
- // orders: [{ column: 'create_time', asc: 0 }],
|
|
|
- // delFlag: 0,
|
|
|
- // comment: this.comment
|
|
|
- // }
|
|
|
- // fetchCommentList(params).then(response => {
|
|
|
- // this.loading = false
|
|
|
- // if (hasValidRecords(response)) {
|
|
|
- // this.tableData = response.data.records
|
|
|
- // this.total = response.data.total
|
|
|
- // } else {
|
|
|
- // this.tableData = []
|
|
|
- // this.total = 0
|
|
|
- // }
|
|
|
- // }).catch(error => {
|
|
|
- // console.log(error)
|
|
|
- // this.loading = false
|
|
|
- // this.$message({
|
|
|
- // type: 'error',
|
|
|
- // duration: 0,
|
|
|
- // showClose: true,
|
|
|
- // message: '获取留言列表出错: ' + error.message
|
|
|
- // })
|
|
|
- // })
|
|
|
+ this.tableLoading = true
|
|
|
+ const params = {
|
|
|
+ page: this.current,
|
|
|
+ size: this.size,
|
|
|
+ params: {
|
|
|
+ delFlag: 0,
|
|
|
+ content: this.content
|
|
|
+ }
|
|
|
+ }
|
|
|
+ fetchCommentList(params).then(response => {
|
|
|
+ this.tableLoading = false
|
|
|
+ if (hasValidRecords(response)) {
|
|
|
+ this.tableData = response.data.records
|
|
|
+ this.total = response.data.total
|
|
|
+ } else {
|
|
|
+ this.tableData = []
|
|
|
+ this.total = 0
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ console.log(error)
|
|
|
+ this.tableLoading = false
|
|
|
+ this.$message({
|
|
|
+ type: 'error',
|
|
|
+ duration: 0,
|
|
|
+ showClose: true,
|
|
|
+ message: '获取留言列表出错: ' + error.message
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
saveItem() {
|
|
|
this.$refs[this.formName].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- this.$message.info('开发中...')
|
|
|
- // this.loading = true
|
|
|
- // pushCommentAdd(this.formData).then(res => {
|
|
|
- // this.loading = false
|
|
|
- // this.visible = false
|
|
|
- // this.$emit('refreshData')
|
|
|
- // this.$message({
|
|
|
- // type: 'success',
|
|
|
- // message: '保存成功!'
|
|
|
- // })
|
|
|
- // }).catch(error => {
|
|
|
- // console.log(error)
|
|
|
- // this.loading = false
|
|
|
- // this.$message({
|
|
|
- // type: 'error',
|
|
|
- // duration: 0,
|
|
|
- // showClose: true,
|
|
|
- // message: '保存出错:' + error.message
|
|
|
- // })
|
|
|
- // })
|
|
|
+ this.loading = true
|
|
|
+ pushCommentAdd(this.formData).then(res => {
|
|
|
+ this.loading = false
|
|
|
+ this.searchTable()
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '保存成功!'
|
|
|
+ })
|
|
|
+ }).catch(error => {
|
|
|
+ console.log(error)
|
|
|
+ this.loading = false
|
|
|
+ this.$message({
|
|
|
+ type: 'error',
|
|
|
+ duration: 0,
|
|
|
+ showClose: true,
|
|
|
+ message: '保存出错:' + error.message
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ showDetail(id) {
|
|
|
+ this.$refs['commentDetail'].open(id)
|
|
|
+ },
|
|
|
/**
|
|
|
* 加载dialog
|
|
|
*/
|
|
|
open() {
|
|
|
this.visible = true
|
|
|
+ this.searchTable()
|
|
|
},
|
|
|
close() {
|
|
|
this.visible = false
|