fix: 添加评论功能 - 100%

This commit is contained in:
weifashi 2023-05-24 11:04:39 +08:00
parent 61e958d757
commit 003186edd9
13 changed files with 252 additions and 42 deletions

View File

@ -1219,4 +1219,9 @@ Markdown 格式发送
申请类型 申请类型
请选择申请类型 请选择申请类型
请选择申请类型! 请选择申请类型!
添加流程 添加流程
全文评论
评论
内容
添加评论
请输入内容!

View File

@ -16630,5 +16630,60 @@
"de": "Schleifen lassen", "de": "Schleifen lassen",
"fr": "Ajouter un processus", "fr": "Ajouter un processus",
"id": "Tambahkan alur" "id": "Tambahkan alur"
},
{
"key": "全文评论",
"zh": "",
"zh-CHT": "全文評論",
"en": "Full text review",
"ko": "전문 평론",
"ja": "全文コメントです。",
"de": "Whistler whistler?",
"fr": "Commentaires complets",
"id": "Ulasan lengkap"
},
{
"key": "评论",
"zh": "",
"zh-CHT": "評論",
"en": "Comment",
"ko": "논평",
"ja": "レビューです",
"de": "Kommentar.",
"fr": "Commentaires",
"id": "Komentar"
},
{
"key": "内容",
"zh": "",
"zh-CHT": "內容",
"en": "Content",
"ko": "내용",
"ja": "中身です",
"de": "Inhalt.",
"fr": "Le contenu",
"id": "Isi"
},
{
"key": "添加评论",
"zh": "",
"zh-CHT": "添加評論",
"en": "Add a comment",
"ko": "코멘트 더하기",
"ja": "コメントを書きます。",
"de": "Geben sie mir ein zitat.",
"fr": "Ajouter un commentaire",
"id": "Tambahkan komentar"
},
{
"key": "请输入内容!",
"zh": "",
"zh-CHT": "請輸入內容!",
"en": "Please enter the content!",
"ko": "내용을 입력하십시오!",
"ja": "内容の入力をお願いします!",
"de": "Bitte geben sie den inhalt ein!",
"fr": "Veuillez entrer le contenu!",
"id": "Silahkan isi!"
} }
] ]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
if(typeof window.LANGUAGE_DATA==="undefined")window.LANGUAGE_DATA={};window.LANGUAGE_DATA["zh"]=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""] if(typeof window.LANGUAGE_DATA==="undefined")window.LANGUAGE_DATA={};window.LANGUAGE_DATA["zh"]=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]

View File

@ -11,7 +11,9 @@
</h2> </h2>
<h3 class="review-details-subtitle"><Avatar :src="datas.userimg" size="24"/><span>{{datas.start_user_name}}</span></h3> <h3 class="review-details-subtitle"><Avatar :src="datas.userimg" size="24"/><span>{{datas.start_user_name}}</span></h3>
<h3 class="review-details-subtitle"><span>{{$L('提交于')}} {{datas.start_time}}</span></h3> <h3 class="review-details-subtitle"><span>{{$L('提交于')}} {{datas.start_time}}</span></h3>
<Divider/> <Divider/>
<div class="review-details-text" v-if="(datas.proc_def_name || '').indexOf('班') == -1"> <div class="review-details-text" v-if="(datas.proc_def_name || '').indexOf('班') == -1">
<h4>{{$L('假期类型')}}</h4> <h4>{{$L('假期类型')}}</h4>
<p>{{$L(datas.var?.type)}}</p> <p>{{$L(datas.var?.type)}}</p>
@ -34,23 +36,25 @@
</div> </div>
<div class="review-details-text" v-if="datas.var?.other"> <div class="review-details-text" v-if="datas.var?.other">
<h4>{{$L('图片')}}</h4> <h4>{{$L('图片')}}</h4>
<div style="display: flex;gap: 10px;margin-top: 3px;"> <div class="img-body">
<div v-for="(src,key) in (datas.var.other).split(',') " @click="onViewPicture(src)"> <div v-for="(src,key) in (datas.var.other).split(',') " @click="onViewPicture(src)">
<ImgView :src="src" :key="key" style="max-width: 60px;border-radius: 5px;"/> <ImgView :src="src" :key="key" class="img-view"/>
</div> </div>
</div> </div>
</div> </div>
<Divider/> <Divider/>
<h3 class="review-details-subtitle">{{$L('审批记录')}}</h3> <h3 class="review-details-subtitle">{{$L('审批记录')}}</h3>
<Timeline style="margin-top: 20px;"> <Timeline class="review-record-timeline">
<template v-for="(item,key) in datas.node_infos"> <template v-for="(item,key) in datas.node_infos">
<!-- 提交 --> <!-- 提交 -->
<TimelineItem :key="key" v-if="item.type == 'starter'" color="green"> <TimelineItem :key="key" v-if="item.type == 'starter'" color="green">
<p class="timeline-title">{{$L('提交')}}</p> <p class="timeline-title">{{$L('提交')}}</p>
<div style="display: flex;"> <div class="timeline-body">
<Avatar :src="data.userimg || datas.userimg" size="38"/> <Avatar :src="data.userimg || datas.userimg" size="38"/>
<div style="margin-left: 10px;flex: 1;"> <div class="review-process-left">
<p class="review-process-name">{{data.start_user_name || datas.start_user_name}}</p> <p class="review-process-name">{{data.start_user_name || datas.start_user_name}}</p>
<p class="review-process-state">{{$L('已提交')}}</p> <p class="review-process-state">{{$L('已提交')}}</p>
</div> </div>
@ -66,9 +70,9 @@
:color="item.identitylink ? (item.identitylink?.state > 1 ? '#f03f3f' :'green') : '#ccc'" :color="item.identitylink ? (item.identitylink?.state > 1 ? '#f03f3f' :'green') : '#ccc'"
> >
<p class="timeline-title">{{$L('审批')}}</p> <p class="timeline-title">{{$L('审批')}}</p>
<div style="display: flex;"> <div class="timeline-body">
<Avatar :src="(item.node_user_list && item.node_user_list[0]?.userimg) || item.userimg" size="38"/> <Avatar :src="(item.node_user_list && item.node_user_list[0]?.userimg) || item.userimg" size="38"/>
<div style="margin-left: 10px;flex: 1;"> <div class="review-process-left">
<p class="review-process-name">{{item.approver}}</p> <p class="review-process-name">{{item.approver}}</p>
<p class="review-process-state" style="color: #6d6d6d;" v-if="!item.identitylink">待审批</p> <p class="review-process-state" style="color: #6d6d6d;" v-if="!item.identitylink">待审批</p>
<p class="review-process-state" v-if="item.identitylink"> <p class="review-process-state" v-if="item.identitylink">
@ -94,9 +98,9 @@
<!-- 抄送 --> <!-- 抄送 -->
<TimelineItem :key="key" :color="item.is_finished ? 'green' : '#ccc'" v-if="item.type == 'notifier' && item._show"> <TimelineItem :key="key" :color="item.is_finished ? 'green' : '#ccc'" v-if="item.type == 'notifier' && item._show">
<p class="timeline-title">{{$L('抄送')}}</p> <p class="timeline-title">{{$L('抄送')}}</p>
<div style="display: flex;"> <div class="timeline-body">
<Avatar :src="'/images/avatar/default_bot.png'" size="38"/> <Avatar :src="'/images/avatar/default_bot.png'" size="38"/>
<div style="margin-left: 10px;flex: 1;"> <div class="review-process-left">
<p class="review-process-name">{{$L('系统')}}</p> <p class="review-process-name">{{$L('系统')}}</p>
<p style="font-size: 12px;">{{$L('自动抄送')}} <p style="font-size: 12px;">{{$L('自动抄送')}}
<span style="color: #486fed;"> <span style="color: #486fed;">
@ -111,9 +115,9 @@
<!-- 结束 --> <!-- 结束 -->
<TimelineItem :key="key" :color="item.is_finished ? 'green' : '#ccc'" v-if="item.aprover_type == 'end'"> <TimelineItem :key="key" :color="item.is_finished ? 'green' : '#ccc'" v-if="item.aprover_type == 'end'">
<p class="timeline-title">{{$L('结束')}}</p> <p class="timeline-title">{{$L('结束')}}</p>
<div style="display: flex;"> <div class="timeline-body">
<Avatar :src="'/images/avatar/default_bot.png'" size="38"/> <Avatar :src="'/images/avatar/default_bot.png'" size="38"/>
<div style="margin-left: 10px;flex: 1;"> <div class="review-process-left">
<p class="review-process-name">{{$L('系统')}}</p> <p class="review-process-name">{{$L('系统')}}</p>
<p style="font-size: 12px;"> {{ datas.is_finished ? $L('已结束') : $L('未结束') }}</p> <p style="font-size: 12px;"> {{ datas.is_finished ? $L('已结束') : $L('未结束') }}</p>
</div> </div>
@ -121,25 +125,72 @@
</TimelineItem> </TimelineItem>
</template> </template>
</Timeline> </Timeline>
<template v-if="datas.global_comment">
<Divider/>
<h3 class="review-details-subtitle">{{$L('全文评论')}}</h3>
<div class="review-record-comment">
<List :split="false" :border="false">
<ListItem v-for="(item,key) in datas.global_comments" :key="key">
<div>
<div class="top">
<Avatar :src="item.userimg" size="38"/>
<div>
<p>{{item.nickname}}</p>
<p class="time">{{item.created_at}}</p>
</div>
<span>{{ getTimeAgo(item.created_at ,2) }}</span>
</div>
<div class="content">
{{ getContent(item.content) }}
</div>
<div class="content" style="display: flex; gap: 10px;">
<div v-for="(src,k) in getPictures(item.content)" :key="k" @click="onViewPicture(src)">
<ImgView :src="src" class="img-view"/>
</div>
</div>
</div>
</ListItem>
</List>
</div>
</template>
</div> </div>
<div class="review-operation" v-if="datas.state<=1"> <div class="review-operation">
<div style="flex: 1;"></div> <div style="flex: 1;"></div>
<Button type="success" v-if="(datas.candidate || '').split(',').indexOf(userId + '') != -1" @click="approve(1)">{{$L('同意')}}</Button> <Button type="success" v-if="(datas.candidate || '').split(',').indexOf(userId + '') != -1" @click="approve(1)">{{$L('同意')}}</Button>
<Button type="error" v-if="(datas.candidate || '').split(',').indexOf(userId + '') != -1" @click="approve(2)">{{$L('拒绝')}}</Button> <Button type="error" v-if="(datas.candidate || '').split(',').indexOf(userId + '') != -1" @click="approve(2)">{{$L('拒绝')}}</Button>
<Button type="warning" v-if="isShowWarningBtn" @click="revocation">{{$L('撤销')}}</Button> <Button type="warning" v-if="isShowWarningBtn" @click="revocation">{{$L('撤销')}}</Button>
<Button @click="comment" type="success" ghost>+{{$L('添加评论')}}</Button>
</div> </div>
<!--评论-->
<Modal v-model="commentShow" :title="$L('评论')" :mask-closable="false" class="page-review-initiate">
<Form ref="initiateRef" :model="commentData" :rules="commentRule" label-width="auto" @submit.native.prevent>
<FormItem prop="content" :label="$L('内容')">
<Input type="textarea" v-model="commentData.content"></Input>
</FormItem>
<FormItem prop="pictures" :label="$L('图片')">
<ImgUpload v-model="commentData.pictures" :num="3" :width="512" :height="512" :whcut="1"></ImgUpload>
</FormItem>
</Form>
<div slot="footer" class="adaption">
<Button type="default" @click="commentShow=false">{{$L('取消')}}</Button>
<Button type="primary" :loading="loadIng > 0" @click="confirmComment">{{$L('确认')}}</Button>
</div>
</Modal>
</div> </div>
</template> </template>
<script> <script>
import ImgView from "../../../components/ImgView"; import ImgView from "../../../components/ImgView";
import ImgUpload from "../../../components/ImgUpload";
export default { export default {
name: "details", name: "details",
components:{ImgView}, components:{ImgView,ImgUpload},
props: { props: {
data: { data: {
type: Object, type: Object,
@ -153,7 +204,16 @@ export default {
return { return {
modalTransferIndex:window.modalTransferIndex, modalTransferIndex:window.modalTransferIndex,
datas:{}, datas:{},
showTimeNum:24 showTimeNum:24,
commentShow:false,
loadIng:0,
commentData: {
content:"",
pictures:[]
},
commentRule: {
content: { type: 'string',required: true, message: this.$L('请输入内容!'), trigger: 'change' },
}
} }
}, },
watch: { watch: {
@ -173,9 +233,9 @@ export default {
}, },
computed: { computed: {
isShowWarningBtn(){ isShowWarningBtn(){
let is = this.userId == this.datas.start_user_id; let is = (this.userId == this.datas.start_user_id);
(this.datas.node_infos || []).map(h=>{ (this.datas.node_infos || []).map(h=>{
if(h.type != 'starter' && h.is_finished == true && h.identitylink.userid != this.userId) { if(h.type != 'starter' && h.is_finished == true && h.identitylink?.userid != this.userId) {
is = false; is = false;
} }
}) })
@ -314,6 +374,53 @@ export default {
}, },
}); });
}, },
//
comment(){
this.commentShow = true;
},
//
confirmComment(){
this.loadIng++;
this.$store.dispatch("call", {
method: 'post',
url: 'workflow/process/addGlobalComment',
data: {
proc_inst_id:this.data.id,
content:JSON.stringify({
'content': this.commentData.content,
'pictures': this.commentData.pictures.map(h =>{ return h.path; })
})
}
}).then(({msg}) => {
$A.messageSuccess("添加成功");
if(this.$route.name=='manage-review-details' || this.$route.name=='manage-messenger'){
this.getInfo()
}else{
this.$emit('approve')
}
this.commentShow = false;
}).catch(({msg}) => {
$A.modalError(msg);
}).finally(_ => {
this.loadIng--;
});
},
//
getContent(content){
try {
return JSON.parse(content).content || ''
} catch (error) {
return ''
}
},
//
getPictures(content){
try {
return JSON.parse(content).pictures || []
} catch (error) {
return ''
}
},
// //
onViewPicture(currentUrl) { onViewPicture(currentUrl) {
this.$store.dispatch("previewImage", '/' +currentUrl) this.$store.dispatch("previewImage", '/' +currentUrl)
@ -323,5 +430,5 @@ export default {
</script> </script>
<style scoped> <style scoped>
</style> </style>

View File

@ -142,6 +142,7 @@
flex: 1 1 auto; flex: 1 1 auto;
padding: 24px; padding: 24px;
overflow-y: scroll; overflow-y: scroll;
.review-details-title{ .review-details-title{
display: flex; display: flex;
align-items: center; align-items: center;
@ -149,6 +150,7 @@
margin-left: 8px; margin-left: 8px;
} }
} }
.review-details-subtitle{ .review-details-subtitle{
margin-top: 8px; margin-top: 8px;
display: flex; display: flex;
@ -165,20 +167,6 @@
padding-bottom: 10px; padding-bottom: 10px;
} }
// .review-process-name{
// margin-bottom: 4px;
// }
.review-process-state{
font-size: 12px;
color: #19be6b;
}
.review-process-right{
text-align: right;
}
.review-details-text{ .review-details-text{
margin-bottom: 12px; margin-bottom: 12px;
> h4{ > h4{
@ -189,10 +177,61 @@
margin-top: 2px; margin-top: 2px;
font-weight: 500; font-weight: 500;
} }
.img-body{
display: flex;
gap: 10px;
margin-top: 3px;
}
} }
.review-record-timeline{
margin-top: 20px;
.timeline-body{
display: flex;
}
.review-process-state{
font-size: 12px;
color: #19be6b;
}
.review-process-left{
margin-left: 10px;
flex: 1;
}
.review-process-right{
text-align: right;
}
}
.review-record-comment{
padding: 10px;
margin-bottom: 30px;
.top{
display: flex;
gap: 8px;
}
.time{
font-size: 12px;
color: #a2a2a2;
}
.content{
margin-top: 3px;
padding-left: 45px;
}
}
.review-details-text:nth-last-child(1){ .review-details-text:nth-last-child(1){
margin-bottom: 0; margin-bottom: 0;
} }
.img-view{
max-width: 60px;
border-radius: 5px;
}
.review-copy{ .review-copy{
margin-top: 8px; margin-top: 8px;
display: flex; display: flex;
@ -211,6 +250,10 @@
.review-details-box::-webkit-scrollbar { .review-details-box::-webkit-scrollbar {
display: none; display: none;
} }
.review-operation{ .review-operation{
flex: 0 0 auto; flex: 0 0 auto;
padding: 0 24px; padding: 0 24px;