群众留言完成

This commit is contained in:
aixianling
2022-03-22 15:24:33 +08:00
parent 25fddf63db
commit 30ecf5b154
3 changed files with 61 additions and 14 deletions

View File

@@ -24,7 +24,7 @@ export default {
} }
}, },
created() { created() {
this.dict.load("leaveMessageType","yesOrNo") this.dict.load("leaveMessageType", "yesOrNo", "msgStatus")
} }
} }
</script> </script>

View File

@@ -1,10 +1,10 @@
<template> <template>
<section class="mmDetail"> <section class="mmDetail">
<ai-detail> <ai-detail>
<ai-title slot="title" title="留言详情" isShowBottomBorder isShowBack @onBackClick="$router.push({query:{}})"> <ai-title slot="title" title="留言详情" isShowBottomBorder isShowBack @onBackClick="back">
<template #rightBtn> <template #rightBtn v-if="!isClosed">
<el-button type="primary">回复留言</el-button> <el-button type="primary" @click="dialog=true">回复留言</el-button>
<el-button>关闭留言</el-button> <el-button @click="handleCloseMass(detail.id)">关闭留言</el-button>
</template> </template>
</ai-title> </ai-title>
<template #content> <template #content>
@@ -38,6 +38,13 @@
</el-form> </el-form>
</template> </template>
</ai-detail> </ai-detail>
<ai-dialog :visible.sync="dialog" title="回复留言" width="500px" @onConfirm="submit">
<el-form size="small" :model="form" :rules="rules" label-width="80px" ref="ReplyForm">
<el-form-item label="回复内容" prop="content">
<el-input type="textarea" v-model="form.content" rows="4" clearable placeholder="请输入回复内容"/>
</el-form-item>
</el-form>
</ai-dialog>
</section> </section>
</template> </template>
@@ -62,11 +69,19 @@ export default {
0: "留言", 0: "留言",
1: "回复" 1: "回复"
} }
},
isClosed() {
return this.detail.status == 2
} }
}, },
data() { data() {
return { return {
detail: {}, detail: {},
dialog: false,
form: {},
rules: {
content: [{required: true, message: "请输入回复内容"}]
}
} }
}, },
methods: { methods: {
@@ -80,6 +95,34 @@ export default {
} }
}) })
}, },
back() {
this.$router.push({})
},
handleCloseMass(id) {
this.$confirm("是否要关闭留言?").then(() => {
this.instance.post("/appleavemessage/close", null, {
params: {id}
}).then(res => {
if (res?.code == 0) {
this.$message.success("关闭成功")
this.back()
}
})
}).catch(() => 0)
},
submit() {
this.$refs.ReplyForm.validate(v => {
if (v) {
let {id: messageId} = this.detail
this.instance.post("/appleavemessagereply/addOrUpdate", {...this.form, messageId, userType: 1}).then(res => {
if (res?.code == 0) {
this.$message.success("提交成功!")
this.back()
}
})
}
})
}
}, },
created() { created() {
this.getDetail() this.getDetail()

View File

@@ -5,8 +5,10 @@
<template #content> <template #content>
<ai-search-bar> <ai-search-bar>
<template #left> <template #left>
<ai-select v-model="search.type" placeholder="留言状态"/> <ai-select v-model="search.status" placeholder="留言状态" :selectList="dict.getDict('msgStatus')"
<ai-select v-model="search.type" placeholder="留言类型"/> @change="page.current=1,getTableData()"/>
<ai-select v-model="search.type" placeholder="留言类型" :selectList="dict.getDict('leaveMessageType')"
@change="page.current=1,getTableData()"/>
</template> </template>
<template #right> <template #right>
<el-input size="small" placeholder="搜索企业名称、法人姓名、登录账号" v-model="search.enterpriseName" clearable <el-input size="small" placeholder="搜索企业名称、法人姓名、登录账号" v-model="search.enterpriseName" clearable
@@ -17,8 +19,8 @@
@getList="getTableData" :col-configs="colConfigs" :dict="dict"> @getList="getTableData" :col-configs="colConfigs" :dict="dict">
<el-table-column slot="options" label="操作" fixed="right" align="center"> <el-table-column slot="options" label="操作" fixed="right" align="center">
<template slot-scope="{row}"> <template slot-scope="{row}">
<el-button v-if="row.isPublic==0" type="text" @click="handleEnable(row)">公示</el-button> <el-button v-if="row.isOpen==0" type="text" @click="handleEnable(row)">公示</el-button>
<el-button v-else-if="row.isPublic==1" type="text" @click="handleEnable(row)">取消公示</el-button> <el-button v-else-if="row.isOpen==1" type="text" @click="handleEnable(row)">取消公示</el-button>
<el-button type="text" @click="showDetail(row.id)">详情</el-button> <el-button type="text" @click="showDetail(row.id)">详情</el-button>
</template> </template>
</el-table-column> </el-table-column>
@@ -53,7 +55,7 @@ export default {
{label: "留言人", prop: "leaveName"}, {label: "留言人", prop: "leaveName"},
{label: "留言提交时间", prop: "createTime"}, {label: "留言提交时间", prop: "createTime"},
{label: "最后回复时间", prop: "lastReplyTime"}, {label: "最后回复时间", prop: "lastReplyTime"},
{label: "是否公示", prop: "isPublic",dict:"yesOrNo"}, {label: "是否公示", prop: "isOpen", dict: "yesOrNo", align: 'center'},
{slot: "options"} {slot: "options"}
] ]
} }
@@ -73,11 +75,13 @@ export default {
this.$router.push({query: {id}}) this.$router.push({query: {id}})
}, },
handleEnable(row) { handleEnable(row) {
let status = (Number(row.status) + 1) % 2 let openLabel = row.isOpen == 1 ? "取消公示" : "公示", isOpen = (Number(row.isOpen) + 1) % 2
this.$confirm(`是否要${this.dict.getLabel('portalUserStatus', status)}留言?`).then(() => { this.$confirm(`是否要${openLabel}留言?`).then(() => {
this.instance.post("/appportaluser/addOrUpdate", {...row, status}).then(res => { this.instance.post("/appleavemessage/setIsOpen", null, {
params: {id: row.id, isOpen}
}).then(res => {
if (res?.code == 0) { if (res?.code == 0) {
this.$message.success(this.dict.getLabel('portalUserStatus', status) + "成功!") this.$message.success(openLabel + "成功!")
this.getTableData() this.getTableData()
} }
}) })