评论功能开发

This commit is contained in:
wuhongjian 2022-06-23 21:16:11 +08:00
parent 90b374c684
commit f21946644d
4 changed files with 167 additions and 29 deletions

View File

@ -0,0 +1,114 @@
<template>
<div class="wrapper">
<div>
<el-form
:model="dataForm"
ref="dataForm"
@keyup.enter.native="dataFormSubmitHandle()"
:label-width="$i18n.locale === 'en-US' ? '120px' : 'auto'"
>
<el-form-item label="评论内容">
<el-input
v-model="dataForm.comment"
:disabled="fieldDisabled"
placeholder="评论内容"
></el-input>
</el-form-item>
</el-form>
</div>
<!-- 流程综合组件 -->
<ren-process-multiple
v-if="processVisible"
updateInstanceIdUrl="/processForm/tabilityapplication/updateInstanceId"
saveFormUrl="/processForm/tabilityapplication"
dataFormName="dataForm"
ref="renProcessMultiple"
></ren-process-multiple>
</div>
</template>
<script>
import processModule from '@/mixins/process-module'
export default {
//
mixins: [processModule],
components: {},
props: {
// fromList: {
// // type: Array,
// // default: () => {
// // return []
// // }
// }
},
data () {
return {
// processVisible: true,
visible: false,
//
fieldDisabled: false,
dataForm: [],
id: '',
shifoushizujian: true
}
},
watch: {},
computed: {},
methods: {
init () {
this.visible = true
// this.getInfo(this.$router.currentRoute.params.params.params.resourceDTO.id)
// this.dataForm = this.$router.currentRoute.params.params.params.resourceDTO
// this.id=this.$router.currentRoute
this.$nextTick(() => {
this.$refs.dataForm.resetFields()
// if (this.dataForm.id) {
// KEY
this.fieldDisabled = true
// this.id = this.$router.currentRoute.businessKey
this.getInfo(this.$router.currentRoute.params.businessKey)
console.log('id', this.$router.currentRoute.params.businessKey)
// }
})
},
getInfo (id) {
this.$http.get('/resourceMountApply/' + id).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.dataForm = res.data.resourceDTO
if (this.dataForm.type != '应用资源') {
this.shifoushizujian = false
} else {
this.shifoushizujian = true
}
console.log('this.dataForm', this.dataForm)
})
}
},
created () {
// this.dataForm = this.$router.currentRoute.params.id
this.init()
console.log('fromList', this.$router.currentRoute.params.businessKey)
// this.dataForm = this.$router.currentRoute.params.params.params.resourceDTO
var callbacks = {
startProcessSuccessCallback: this.closeCurrentTab,
startProcessErrorCallback: this.startProcessErrorCallback,
taskHandleSuccessCallback: this.closeCurrentTab,
taskHandleErrorCallback: this.taskHandleErrorCallback,
formSaveSuccessCallback: null,
formSaveErrorCallback: null
}
//
this.initProcessMultiple(callbacks)
},
mounted () {}
}
</script>
<style lang="scss">
.kuandukuandukuandu{
max-width:1500px;
}
.wrapper {
}
</style>

View File

@ -2,7 +2,7 @@
* @Author: hisense.wuhongjian * @Author: hisense.wuhongjian
* @Date: 2022-04-27 19:34:30 * @Date: 2022-04-27 19:34:30
* @LastEditors: hisense.wuhongjian * @LastEditors: hisense.wuhongjian
* @LastEditTime: 2022-04-28 19:26:07 * @LastEditTime: 2022-06-23 21:08:01
* @Description: 告诉大家这是什么 * @Description: 告诉大家这是什么
--> -->
<template> <template>
@ -46,7 +46,8 @@
(scope.row.params && scope.row.params.user) || (scope.row.params && scope.row.params.user) ||
(scope.row.params && scope.row.params.applyUserName) || (scope.row.params && scope.row.params.applyUserName) ||
(scope.row.params && scope.row.params.userName) || (scope.row.params && scope.row.params.userName) ||
(scope.row.params && scope.row.params.undercarriageUserName) (scope.row.params && scope.row.params.undercarriageUserName)||
(scope.row.params && scope.row.params.name)
}}</span> }}</span>
</template> </template>
</el-table-column> </el-table-column>
@ -62,7 +63,8 @@
(scope.row.params && (scope.row.params &&
scope.row.params.resourceDTO && scope.row.params.resourceDTO &&
scope.row.params.resourceDTO.name) || scope.row.params.resourceDTO.name) ||
(scope.row.params && scope.row.params.undercarriageReason) (scope.row.params && scope.row.params.undercarriageReason)||
(scope.row.params && scope.row.params.comment)
}}</span> }}</span>
</template> </template>
</el-table-column> </el-table-column>
@ -126,41 +128,42 @@
</template> </template>
<script> <script>
import mixinViewModule from "@/mixins/view-module"; import mixinViewModule from '@/mixins/view-module'
import processModule from "@/mixins/process-module"; import processModule from '@/mixins/process-module'
export default { export default {
mixins: [mixinViewModule, processModule], mixins: [mixinViewModule, processModule],
data() { data () {
return { return {
mixinViewModuleOptions: { mixinViewModuleOptions: {
getDataListURL: "/act/task/myToDoTaskPage", getDataListURL: '/act/task/myToDoTaskPage',
getDataListIsPage: true, getDataListIsPage: true,
activatedIsNeed: true, activatedIsNeed: true,
deleteIsBatch: true, deleteIsBatch: true,
deleteIsBatchKey: "deploymentId", deleteIsBatchKey: 'deploymentId'
}, },
dataForm: { dataForm: {
taskName: "", taskName: '',
taskId: "", taskId: ''
}, },
processInstanceId: "", processInstanceId: ''
}; }
}, },
components: {}, components: {},
methods: { methods: {
// //
taskHandle(row) { taskHandle (row) {
console.log('row======================>', row, this.forwardHandleUrl)
if (!row.businessKey) { if (!row.businessKey) {
return this.$message.error(this.$t("task.businessKeyError")); return this.$message.error(this.$t('task.businessKeyError'))
} }
this.getProcDefRouteSet(row, this.forwardHandleUrl); this.getProcDefRouteSet(row, this.forwardHandleUrl)
}, },
taskDetail(row) { taskDetail (row) {
if (!row.businessKey) { if (!row.businessKey) {
return this.$message.error(this.$t("task.detailError")); return this.$message.error(this.$t('task.detailError'))
} }
this.getProcDefRouteSet(row, this.forwardTaskDetail); this.getProcDefRouteSet(row, this.forwardTaskDetail)
}, }
}, }
}; }
</script> </script>

View File

@ -1,3 +1,10 @@
/*
* @Author: hisense.wuhongjian
* @Date: 2022-06-14 09:43:30
* @LastEditors: hisense.wuhongjian
* @LastEditTime: 2022-06-23 20:04:39
* @Description: 告诉大家这是什么
*/
import request from '@/utils/request' import request from '@/utils/request'
export function demandComment(data) { export function demandComment(data) {
@ -7,6 +14,13 @@ export function demandComment(data) {
data, data,
}) })
} }
export function demandCommentApply(data) {
return request({
url: '/comment/center/apply',
method: 'post',
data,
})
}
export function demandCommentPage(params) { export function demandCommentPage(params) {
return request({ return request({

View File

@ -186,15 +186,14 @@
</div> </div>
<a-list <a-list
class="comment-list" class="comment-list"
:header="`全部${total} 评论`" :header="`全部${total || 0} 评论`"
item-layout="horizontal" item-layout="horizontal"
:data-source="evaluateData" :data-source="evaluateData"
> >
<template #renderItem="{ item }"> <template #renderItem="{ item }">
<a-list-item> <a-list-item>
<a-comment :author="item.name"> <a-comment :author="item.name">
<template v-if="item.name == user.applyUserName" #actions> <!-- <template v-if="item.name == user.applyUserName" #actions>
<!-- <span @click="evaluateUpdate">修改</span> -->
<a-popconfirm <a-popconfirm
title="确定删除评论?" title="确定删除评论?"
ok-text="确定" ok-text="确定"
@ -204,7 +203,7 @@
> >
<span>删除</span> <span>删除</span>
</a-popconfirm> </a-popconfirm>
</template> </template> -->
<template #content> <template #content>
<p v-if="!evaluateUpdateStatus"> <p v-if="!evaluateUpdateStatus">
{{ item.comment }} {{ item.comment }}
@ -250,6 +249,7 @@
demandComment, demandComment,
demandCommentPage, demandCommentPage,
demandCommentDelete, demandCommentDelete,
demandCommentApply,
} from '@/api/demandCenter' } from '@/api/demandCenter'
import { getUser, getUserInfo } from '@/api/home' import { getUser, getUserInfo } from '@/api/home'
import { getDemandForm } from '@/api/personalCenter' import { getDemandForm } from '@/api/personalCenter'
@ -293,10 +293,17 @@
createDeptName: user.applyUserDeptName, createDeptName: user.applyUserDeptName,
comment: myComment.value, comment: myComment.value,
name: user.applyUserName, name: user.applyUserName,
}).then(() => { }).then((res) => {
message.success('提交评价成功!') console.log(res)
myComment.value = '' if (res.data.code == '0') {
evaluateList() demandCommentApply({ id: res.data.data.id }).then((res1) => {
if (res1.data.code == '0') {
message.success('提交评价成功!')
myComment.value = ''
evaluateList()
}
})
}
}) })
} }
// const evaluateUpdateStatus = ref(false) // const evaluateUpdateStatus = ref(false)