|
@@ -1,8 +1,7 @@
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import { reactive, onMounted } from 'vue';
|
|
import { reactive, onMounted } from 'vue';
|
|
|
import type { SatisfactionModel } from '@/model/satisfaction.model';
|
|
import type { SatisfactionModel } from '@/model/satisfaction.model';
|
|
|
-import { getSatisfactionDetailMethod } from '@/request/api/satisfaction.api';
|
|
|
|
|
-import { notification } from 'ant-design-vue';
|
|
|
|
|
|
|
+import { getSatisfactionDetailMethod,getSatisfactionContentBySendRecordIdMethod } from '@/request/api/satisfaction.api';
|
|
|
const props = defineProps<{
|
|
const props = defineProps<{
|
|
|
data?: any;
|
|
data?: any;
|
|
|
}>();
|
|
}>();
|
|
@@ -59,7 +58,10 @@ const initAnswers = () => {
|
|
|
form.satisfiesyContent.groups.forEach((group, groupIndex) => {
|
|
form.satisfiesyContent.groups.forEach((group, groupIndex) => {
|
|
|
group.items.forEach((question, questionIndex) => {
|
|
group.items.forEach((question, questionIndex) => {
|
|
|
const key = `group-${groupIndex}-question-${questionIndex}`;
|
|
const key = `group-${groupIndex}-question-${questionIndex}`;
|
|
|
- if (!(key in answers)) {
|
|
|
|
|
|
|
+ // 如果问题已有分数,则填充;否则默认为0
|
|
|
|
|
+ if (question.score) {
|
|
|
|
|
+ answers[key] = parseInt(question.score, 10) || 0;
|
|
|
|
|
+ } else if (!(key in answers)) {
|
|
|
answers[key] = 0;
|
|
answers[key] = 0;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -68,17 +70,31 @@ const initAnswers = () => {
|
|
|
|
|
|
|
|
// 初始化数据
|
|
// 初始化数据
|
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
|
|
|
+console.log(props.data.type,"传过来的参数");
|
|
|
|
|
+ if (props?.data?.type === 1) {
|
|
|
|
|
+ if (props.data.id) {
|
|
|
|
|
+ const res = await getSatisfactionContentBySendRecordIdMethod(props.data.id);
|
|
|
|
|
+ // console.log(res,"res======发送记录");
|
|
|
|
|
+ if (res && typeof res === 'object') {
|
|
|
|
|
+ Object.assign(form.satisfiesyContent, res);
|
|
|
|
|
+ initAnswers();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
if (props.data && props.data.id) {
|
|
if (props.data && props.data.id) {
|
|
|
try {
|
|
try {
|
|
|
const res = await getSatisfactionDetailMethod(props.data.id);
|
|
const res = await getSatisfactionDetailMethod(props.data.id);
|
|
|
|
|
+ // console.log(res,"res======满意度问卷");
|
|
|
if (res && typeof res === 'object') {
|
|
if (res && typeof res === 'object') {
|
|
|
Object.assign(form, res);
|
|
Object.assign(form, res);
|
|
|
initAnswers();
|
|
initAnswers();
|
|
|
}
|
|
}
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
- notification.error({ message: '获取满意度问卷详情失败', description: (error as Error).message });
|
|
|
|
|
|
|
+ console.log(error);
|
|
|
|
|
+ // notification.error({ message: '获取满意度问卷详情失败', description: (error as Error).message });
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+}
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
@@ -89,7 +105,7 @@ onMounted(async () => {
|
|
|
<a-form ref="formRef" :model="form" layout="vertical">
|
|
<a-form ref="formRef" :model="form" layout="vertical">
|
|
|
<!-- 问卷标题 -->
|
|
<!-- 问卷标题 -->
|
|
|
<h1 class="questionnaire-title-section">
|
|
<h1 class="questionnaire-title-section">
|
|
|
- {{ form.name }}
|
|
|
|
|
|
|
+ {{ form.satisfiesyContent.name }}
|
|
|
</h1>
|
|
</h1>
|
|
|
|
|
|
|
|
<!-- 介绍文字 -->
|
|
<!-- 介绍文字 -->
|
|
@@ -122,7 +138,7 @@ onMounted(async () => {
|
|
|
</div>
|
|
</div>
|
|
|
<!-- 评分选项(1-5分) -->
|
|
<!-- 评分选项(1-5分) -->
|
|
|
<div class="score-options">
|
|
<div class="score-options">
|
|
|
- <a-radio-group>
|
|
|
|
|
|
|
+ <a-radio-group :value="answers[`group-${groupIndex}-question-${questionIndex}`]">
|
|
|
<a-radio :value="1">1分</a-radio>
|
|
<a-radio :value="1">1分</a-radio>
|
|
|
<a-radio :value="2">2分</a-radio>
|
|
<a-radio :value="2">2分</a-radio>
|
|
|
<a-radio :value="3">3分</a-radio>
|
|
<a-radio :value="3">3分</a-radio>
|