This commit is contained in:
wangdan-fit2cloud 2023-12-14 18:00:01 +08:00
parent e0c95cf6b6
commit 8490aaf91d
4 changed files with 150 additions and 25 deletions

View File

@ -12,34 +12,25 @@
</el-button>
</el-tooltip>
<el-divider direction="vertical" />
<el-tooltip effect="dark" content="修改内容" placement="top">
<el-tooltip
v-if="data.improve_paragraph_id_list.length === 0"
effect="dark"
content="修改内容"
placement="top"
>
<el-button text @click="editContent(data)">
<el-icon><EditPen /></el-icon>
</el-button>
</el-tooltip>
<!-- <el-divider direction="vertical" />
<el-tooltip placement="bottom-start" effect="dark" content="修改内容">
<el-popover :width="580" trigger="click">
<template #reference>
<el-button text>
<el-icon><Document /></el-icon>
</el-button>
</template>
<h4>修改内容</h4>
<el-input
v-model="data.content"
placeholder="请输入内容"
maxlength="1024"
show-word-limit
:rows="8"
type="textarea"
>
</el-input>
</el-popover>
</el-tooltip> -->
<el-tooltip v-else effect="dark" content="修改标注" placement="top">
<el-button text @click="editContent(data)">
<AppIcon iconName="app-document-active" class="primary"></AppIcon>
</el-button>
</el-tooltip>
<el-divider direction="vertical" v-if="buttonData?.vote_status !== '-1'" />
<el-button text disabled>
<el-button text disabled v-if="buttonData?.vote_status === '0'">
<AppIcon iconName="app-like-color"></AppIcon>
</el-button>

View File

@ -427,11 +427,11 @@ export const iconMap: any = {
[
h('path', {
d: 'M2.00497 14.6608H2.00518C2.00511 14.6609 2.00504 14.6609 2.00497 14.6608H0.666612C0.666097 14.6874 0.666707 5.33317 0.666612 5.29087H2.00518C2.00006 5.33305 1.98026 14.6344 2.00497 14.6608Z',
fill: 'currentColor'
fill: '#FFC60A'
}),
h('path', {
d: 'M12.5717 5.28984H9.70096C10.1486 4.45673 10.3724 3.78809 10.3724 3.28394C10.3724 1.94718 9.40089 1.14037 8.5893 0.770777C8.04824 0.52438 7.5406 0.753754 7.35254 1.05296L4.5741 5.00545C4.44877 5.18374 4.24449 5.28984 4.02656 5.28984H3.33882C3.154 5.28984 3.00418 5.43966 3.00418 5.62448V14.3319C3.00418 14.5167 3.154 14.6665 3.33882 14.6665H11.1995C11.8409 14.6665 12.4029 14.2423 12.5717 13.6308L14.5687 8.37353C15.0274 7.05264 14.5687 5.28984 12.5717 5.28984Z',
fill: 'currentColor'
fill: '#FFC60A'
})
]
)

View File

@ -127,7 +127,7 @@ const paginationConfig = reactive({
watch(documentData, (list) => {
let interval
if (list.every((item) => item.status === '0')) {
if (list.length > 0 && list.every((item) => item.status === '0')) {
interval = setInterval(() => {
getList(true)
}, 6000)

View File

@ -0,0 +1,134 @@
<template>
<el-dialog title="修改标注" v-model="dialogVisible" width="600">
<template #footer>
<span class="dialog-footer">
<el-button @click.prevent="dialogVisible = false"> 取消 </el-button>
<el-button type="primary" @click="submitForm(formRef)" :loading="loading"> 保存 </el-button>
</span>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { ref, watch, reactive } from 'vue'
import { useRoute } from 'vue-router'
import type { FormInstance, FormRules } from 'element-plus'
import logApi from '@/api/log'
import type { CascaderProps } from 'element-plus'
import useStore from '@/stores'
const { application, document } = useStore()
const props = defineProps({
chartId: {
type: String,
default: ''
}
})
const route = useRoute()
const {
params: { id }
} = route as any
const formRef = ref()
const dialogVisible = ref<boolean>(false)
const loading = ref(false)
const form = ref<any>({
chat_id: '',
record_id: '',
problem_text: '',
title: '',
content: '',
document: []
})
const rules = reactive<FormRules>({
content: [{ required: true, message: '请输入内容', trigger: 'blur' }],
document: [{ type: 'array', required: true, message: '请选择文档', trigger: 'change' }]
})
const datasetList = ref([])
watch(dialogVisible, (bool) => {
if (!bool) {
form.value = {
chat_id: '',
record_id: '',
problem_text: '',
title: '',
content: '',
document: []
}
}
})
const LoadDocument: CascaderProps = {
lazy: true,
value: 'id',
label: 'name',
leaf: 'dataset_id',
lazyLoad(node, resolve: any) {
const { level, data } = node
if (data?.id) {
getDocument(data?.id as string, resolve)
} else {
getDataset(resolve)
}
}
}
function getDocument(id: string, resolve: any) {
document.asyncGetAllDocument(id, loading).then((res: any) => {
datasetList.value = res.data
resolve(datasetList.value)
})
}
function getDataset(resolve: any) {
application.asyncGetApplicationDataset(id, loading).then((res: any) => {
datasetList.value = res.data
resolve(datasetList.value)
})
}
const open = (data: any) => {
form.value.chat_id = data.chat
form.value.record_id = data.id
form.value.problem_text = data.problem_text
form.value.content = data.answer_text
dialogVisible.value = true
}
const submitForm = async (formEl: FormInstance | undefined) => {
if (!formEl) return
await formEl.validate((valid, fields) => {
if (valid) {
const obj = {
title: form.value.title,
content: form.value.content
}
logApi
.putChatRecordLog(
id,
form.value.chat_id,
form.value.record_id,
form.value.document[0],
form.value.document[1],
obj,
loading
)
.then((res: any) => {
dialogVisible.value = false
})
} else {
console.log('error submit!', fields)
}
})
}
defineExpose({ open })
</script>
<style lang="scss" scope></style>