update 文档对比

This commit is contained in:
赵霄
2023-09-20 09:38:51 +08:00
parent aab24bc7e7
commit 02385bd805
6 changed files with 58 additions and 56 deletions
@@ -1,127 +0,0 @@
<template>
<a-modal
:title="title"
:width="600"
:visible="visible"
:confirm-loading="confirmLoading"
:maskClosable="false"
@cancel="visible = false"
>
<template slot="footer">
<a-button key="back" @click="visible = false">
{{$t('cancel')}}
</a-button>
<a-button type="primary" :loading="confirmLoading" @click="fullTextCommentsSubmit">
{{$t('submit')}}
</a-button>
</template>
<a-form-model :model="formInlineText" class="formAdd" :rules="rulesText" ref="ruleFormText">
<div class="box-title-text" v-if="title === $t('docTool.comparison.fullTextComments')">
<div class="title-text" :title="$t('docTool.comparison.fullTextComments')">
<span class="title-text-text">{{$t('docTool.comparison.fullTextComments')}}</span>
</div>
<a-form-model-item class="item-model" style="width: calc(100% - 113px)" prop="comment">
<a-textarea :placeholder="$t('pleaseEnter') + $t('docTool.comparison.fullTextComments')"
v-model.trim="formInlineText.comment"
:maxLength="500"
:rows="4"/>
</a-form-model-item>
</div>
<div class="box-title-text" v-if="title === $t('docTool.comparison.comparativeComments')">
<div class="title-text" :title="$t('docTool.comparison.comparativeComments')">
<span class="title-text-text">{{$t('docTool.comparison.comparativeComments')}}</span>
</div>
<a-form-model-item class="item-model" style="width: calc(100% - 113px)" prop="comment">
<a-textarea :placeholder="$t('pleaseEnter')+$t('docTool.comparison.comparativeComments')"
v-model.trim="formInlineText.comment"
:maxLength="500"
:rows="4"/>
</a-form-model-item>
</div>
</a-form-model>
</a-modal>
</template>
<script>
import { putAction } from '@/api/manage'
export default {
name: 'ComparisonResultEditModal',
data () {
return {
title: '',
visible: false,
confirmLoading: false,
formInlineText: {},
rulesText: {}
}
},
methods: {
open (form) {
this.initData()
this.visible = true
this.formInlineText = Object.assign({}, form)
},
initData () {
this.$nextTick(() => {
this.$refs.ruleFormText.clearValidate()
})
},
// 发表评论弹框的提交按钮点击
fullTextCommentsSubmit () {
this.$refs.ruleFormText.validate(valid => {
if (valid) {
if (this.title === this.$t('docTool.comparison.fullTextComments')) {
this.fullTextComments()
} else {
this.comparaComments()
}
}
})
},
// 全文评论提交
fullTextComments () {
this.confirmLoading = true
const query = {
id: this.$route.query.id,
comments: this.formInlineText.comment
}
putAction('/compare/sarFileCompareInfo/editComments', query).then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.visible = false
this.$emit('ok')
} else {
this.$message.warning(this.$t('operationFailed'))
}
}).finally(() => {
this.confirmLoading = false
})
},
// 发表评论提交
comparaComments () {
this.confirmLoading = true
const query = {
infoId: this.$route.query.id,
id: this.formInlineText.id,
comment: this.formInlineText.comment
}
putAction('/compare/sarFileCompareItemComment/edit', query).then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.visible = false
this.$emit('ok')
} else {
this.$message.warning(this.$t('operationFailed'))
}
}).finally(() => {
this.confirmLoading = false
})
}
}
}
</script>
<style scoped lang="less">
@import'~@assets/less/common.less';
</style>