From a2c10da81668de1f5b7d38f5962d46d795e3cc7e Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期二, 07 四月 2026 14:56:06 +0800
Subject: [PATCH] 测试完成
---
src/views/Satisfaction/configurationmyd/index.vue | 543 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 530 insertions(+), 13 deletions(-)
diff --git a/src/views/Satisfaction/configurationmyd/index.vue b/src/views/Satisfaction/configurationmyd/index.vue
index 7034876..b92dfd9 100644
--- a/src/views/Satisfaction/configurationmyd/index.vue
+++ b/src/views/Satisfaction/configurationmyd/index.vue
@@ -272,6 +272,45 @@
</div>
</div>
<div class="header-right">
+ <!-- 寮傚父閫夐」鐘舵�� -->
+ <div
+ class="option-status"
+ v-if="
+ templateForm.templateType != 3 &&
+ templateForm.templateType != 4
+ "
+ >
+ <el-tooltip
+ :content="
+ checkHasAbnormalOptions(question)
+ ? '宸叉湁寮傚父閫夐」'
+ : '鏆傛棤寮傚父閫夐」'
+ "
+ placement="top"
+ >
+ <el-tag
+ :type="
+ checkHasAbnormalOptions(question) ? 'success' : 'danger'
+ "
+ size="small"
+ class="status-tag"
+ >
+ <i
+ :class="
+ checkHasAbnormalOptions(question)
+ ? 'el-icon-success'
+ : 'el-icon-warning'
+ "
+ ></i>
+ {{
+ checkHasAbnormalOptions(question)
+ ? "寮傚父閫夐」宸查厤缃�"
+ : "鏃犲紓甯搁�夐」"
+ }}
+ </el-tag>
+ </el-tooltip>
+ </div>
+
<el-button
type="text"
icon="el-icon-view"
@@ -279,6 +318,20 @@
size="small"
>
棰勮
+ </el-button>
+
+ <!-- 娣诲姞閰嶇疆閫夐」鎸夐挳 -->
+ <el-button
+ v-if="
+ templateForm.templateType != 3 &&
+ templateForm.templateType != 4
+ "
+ type="text"
+ icon="el-icon-setting"
+ @click="openOptionDialog(question)"
+ size="small"
+ >
+ 閰嶇疆閫夐」
</el-button>
</div>
</div>
@@ -428,7 +481,108 @@
</div>
</div>
</div>
+<!-- 閫夐」閰嶇疆瀵硅瘽妗� -->
+<el-dialog
+ title="閫夐」寮傚父鐘舵�侀厤缃�"
+ :visible.sync="optionDialogVisible"
+ width="700px"
+ center
+ :close-on-click-modal="false"
+>
+ <div v-if="editingQuestion" class="option-config-wrapper">
+ <div class="dialog-header">
+ <h4>{{ editingQuestion.scriptTopic || '鏃犱富棰�' }}</h4>
+ <p class="dialog-subtitle">{{ editingQuestion.scriptContent }}</p>
+ </div>
+ <div class="option-list">
+ <el-alert
+ v-if="!currentOptions.some(opt => opt.isabnormal === 1)"
+ title="璇疯嚦灏戣缃竴涓紓甯搁�夐」锛堟爣璁颁负寮傚父锛�"
+ type="warning"
+ :closable="false"
+ show-icon
+ style="margin-bottom: 20px;"
+ />
+
+ <div v-for="(option, index) in currentOptions" :key="index" class="option-item">
+ <el-form
+ :model="option"
+ :rules="optionRules"
+ ref="optionForm"
+ size="small"
+ class="option-form"
+ >
+ <el-row :gutter="12" align="middle">
+ <el-col :span="2">
+ <div class="option-index">#{{ index + 1 }}</div>
+ </el-col>
+
+ <el-col :span="12">
+ <el-form-item prop="targetvalue">
+ <el-input
+ v-model="option.targetvalue"
+ placeholder="璇疯緭鍏ラ�夐」鍐呭"
+ clearable
+ maxlength="200"
+ show-word-limit
+ />
+ </el-form-item>
+ </el-col>
+
+ <el-col :span="6">
+ <el-form-item prop="isabnormal">
+ <el-select
+ v-model="option.isabnormal"
+ placeholder="閫夋嫨鐘舵��"
+ style="width: 100%"
+ >
+ <el-option
+ v-for="status in abnormalOptions"
+ :key="status.value"
+ :label="status.label"
+ :value="status.value"
+ >
+ <el-tag :type="status.type" size="small">{{ status.label }}</el-tag>
+ </el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+
+ <el-col :span="4">
+ <el-button
+ type="danger"
+ icon="el-icon-delete"
+ @click="removeOption(index)"
+ size="small"
+ circle
+ plain
+ />
+ </el-col>
+ </el-row>
+ </el-form>
+ </div>
+
+ <!-- <el-button
+ type="primary"
+ icon="el-icon-plus"
+ @click="addNewOption"
+ size="small"
+ plain
+ style="width: 100%; margin-top: 10px;"
+ >
+ 娣诲姞閫夐」
+ </el-button> -->
+ </div>
+ </div>
+
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="optionDialogVisible = false">鍙栨秷</el-button>
+ <el-button type="primary" @click="saveOptions" :loading="savingOptions">
+ 淇濆瓨閰嶇疆
+ </el-button>
+ </span>
+</el-dialog>
<!-- 棰樼洰棰勮瀵硅瘽妗� -->
<el-dialog
title="棰樼洰棰勮"
@@ -573,7 +727,25 @@
{ required: true, message: "璇烽�夋嫨妯℃澘绫诲瀷", trigger: "change" },
],
},
+ // 閫夐」绠$悊鐩稿叧
+ optionDialogVisible: false,
+ currentOptions: [],
+ editingQuestion: null,
+ optionRules: {
+ targetvalue: [
+ { required: true, message: "璇疯緭鍏ラ�夐」鍐呭", trigger: "blur" },
+ ],
+ isabnormal: [
+ { required: true, message: "璇烽�夋嫨寮傚父鐘舵��", trigger: "change" },
+ ],
+ },
+ // 寮傚父鐘舵�侀�夐」
+ abnormalOptions: [
+ { label: "姝e父", value: 0, type: "success" },
+ { label: "寮傚父", value: 1, type: "danger" },
+ { label: "璀﹀憡", value: 2, type: "warning" },
+ ],
// 妯℃澘閫夐」
questionnaireTemplates: [], // 闂嵎妯℃澘鍒楄〃
followupTemplates: [], // 璇煶妯℃澘鍒楄〃
@@ -612,8 +784,9 @@
changedCount: 0,
// 婊℃剰搴﹀垎绫籌D
- satisfactionCategoryIds: ["404", "405", "406"],
-
+ satisfactionCategoryIds: ["404", "405", "406", "10039", "10041", "10042"],
+ questionnaireCategorys: [],
+ voiceCategories: [],
// 琛ㄥ崟楠岃瘉瑙勫垯
configRules: {
responsibilityDept: [
@@ -666,19 +839,50 @@
// 婊℃剰搴﹂鐩暟閲�
satisfactionQuestionsCount() {
- return this.questionList.filter((q) =>
- this.satisfactionCategoryIds.includes(q.categoryid?.toString())
- ).length;
+ if (this.templateForm.templateType === 1) {
+ return this.questionList.filter((q) =>
+ this.questionnaireCategorys.includes(q.categoryid)
+ ).length;
+ } else if (this.templateForm.templateType === 2) {
+ return this.questionList.filter((q) =>
+ this.voiceCategories.includes(q.scriptAssortid)
+ ).length;
+ }
},
+ // 妫�鏌ラ鐩槸鍚︽湁寮傚父閫夐」
+ hasAbnormalOption(question) {
+ return (question) => {
+ if (!question) return false;
+ // 闂嵎妯℃澘
+ if (this.templateForm.templateType === 1) {
+ const options = question.svyLibTemplateTargetoptions || [];
+ return options.some((opt) => opt.isabnormal === 1);
+ }
+ // 璇煶妯℃澘
+ else if (this.templateForm.templateType === 2) {
+ const options = question.ivrLibaScriptTargetoptionList || [];
+ return options.some((opt) => opt.isabnormal === 1);
+ }
+
+ return false;
+ };
+ },
// 绛涢�夊悗鐨勯鐩垪琛�
filteredQuestionList() {
let filtered = this.questionList;
+ console.log(this.questionnaireCategorys);
// 绛涢�夋弧鎰忓害棰樼洰
- filtered = filtered.filter((q) =>
- this.satisfactionCategoryIds.includes(q.categoryid?.toString())
- );
+ if (this.templateForm.templateType === 1) {
+ filtered = filtered.filter((q) =>
+ this.questionnaireCategorys.includes(q.categoryid)
+ );
+ } else if (this.templateForm.templateType === 2) {
+ filtered = filtered.filter((q) =>
+ this.voiceCategories.includes(q.scriptAssortid)
+ );
+ }
// 搴旂敤鎼滅储鏉′欢
if (this.queryParams.scriptTopic) {
@@ -700,6 +904,16 @@
},
},
created() {
+ if (store.getters.satisfactionCategories) {
+ this.questionnaireCategorys =
+ store.getters.satisfactionCategories.questionnaireCategorys.map(
+ (item) => item.categoryid
+ );
+ this.voiceCategories =
+ store.getters.satisfactionCategories.voiceCategories.map(
+ (item) => item.categoryid
+ );
+ }
this.getDeptOptions();
this.loadAllTemplates();
},
@@ -830,7 +1044,7 @@
questionCount: 0,
};
}
-// 鍔犺浇妯℃澘璇︽儏鏁版嵁
+ // 鍔犺浇妯℃澘璇︽儏鏁版嵁
this.templateLoading = true;
this.loading = true;
this.questionList = [];
@@ -998,7 +1212,9 @@
/** 閰嶇疆鍙樻洿澶勭悊 */
handleConfigChange(question) {
this.$nextTick(() => {
- const index = this.questionList.findIndex((q) => q.id === question.id);
+ const index = this.filteredQuestionList.findIndex(
+ (q) => q.id === question.id
+ );
if (index !== -1) {
const formRef = this.$refs.configForm && this.$refs.configForm[index];
if (formRef) {
@@ -1051,7 +1267,11 @@
async saveSingleConfig(question) {
if (!question.hasChanges) return;
- const index = this.questionList.findIndex((q) => q.id === question.id);
+ const index = this.filteredQuestionList.findIndex(
+ (q) => q.id === question.id
+ );
+ console.log(index, "filteredQuestionList");
+
if (index === -1) return;
const formRef = this.$refs.configForm && this.$refs.configForm[index];
@@ -1193,7 +1413,6 @@
},
/** 閲嶇疆鍗曚釜棰樼洰閰嶇疆 */
- /** 閲嶇疆鍗曚釜棰樼洰閰嶇疆 */
resetSingleConfig(question) {
this.$confirm("纭畾瑕侀噸缃綋鍓嶉鐩殑閰嶇疆鍚楋紵", "鎻愮ず", {
confirmButtonText: "纭畾",
@@ -1286,7 +1505,247 @@
this.previewAnswer = "";
this.previewVisible = true;
},
+ /** 妫�鏌ラ鐩槸鍚︽湁寮傚父閫夐」 */
+ checkHasAbnormalOptions(question) {
+ if (this.templateForm.templateType === 1) {
+ return (question.svyLibTemplateTargetoptions || []).some(
+ (opt) => opt.isabnormal === 1
+ );
+ } else if (this.templateForm.templateType === 2) {
+ return (question.ivrLibaScriptTargetoptionList || []).some(
+ (opt) => opt.isabnormal === 1
+ );
+ }
+ return false;
+ },
+ /** 鎵撳紑閫夐」绠$悊瀵硅瘽妗� */
+ openOptionDialog(question) {
+ this.editingQuestion = question;
+
+ // 澶嶅埗閫夐」鏁版嵁
+ if (this.templateForm.templateType === 1) {
+ this.currentOptions = JSON.parse(
+ JSON.stringify(question.svyLibTemplateTargetoptions || [])
+ ).map((opt) => ({
+ ...opt,
+ id: opt.id,
+ targetvalue: opt.optioncontent || "",
+ isabnormal: opt.isabnormal || 0,
+ }));
+ } else if (this.templateForm.templateType === 2) {
+ this.currentOptions = JSON.parse(
+ JSON.stringify(question.ivrLibaScriptTargetoptionList || [])
+ ).map((opt) => ({
+ ...opt,
+ targetvalue: opt.targetvalue || "",
+ isabnormal: opt.isabnormal || 0,
+ }));
+ }
+
+ this.optionDialogVisible = true;
+ },
+
+ /** 娣诲姞鏂伴�夐」 */
+ addNewOption() {
+ this.currentOptions.push({
+ id: Date.now(), // 涓存椂ID
+ targetvalue: "",
+ isabnormal: 0,
+ isNew: true,
+ });
+ },
+
+ /** 鍒犻櫎閫夐」 */
+ removeOption(index) {
+ this.currentOptions.splice(index, 1);
+ },
+
+ /** 淇濆瓨閫夐」閰嶇疆 */
+ async saveOptions() {
+ try {
+ // 楠岃瘉蹇呭~椤�
+ for (const option of this.currentOptions) {
+ if (!option.targetvalue || option.targetvalue.trim() === "") {
+ this.$message.warning("璇峰~鍐欐墍鏈夐�夐」鍐呭");
+ return;
+ }
+ }
+
+ // 妫�鏌ユ槸鍚︽湁寮傚父閫夐」
+ const hasAbnormal = this.currentOptions.some(
+ (opt) => opt.isabnormal === 1
+ );
+
+ if (!hasAbnormal) {
+ this.$message.warning("璇疯嚦灏戣缃竴涓紓甯搁�夐」锛坕sabnormal=1锛�");
+ return;
+ }
+
+ // 淇濆瓨閫昏緫 - 鏇存柊棰樼洰瀵硅薄鐨勯�夐」鏁版嵁
+ if (this.templateForm.templateType === 1) {
+ this.editingQuestion.svyLibTemplateTargetoptions =
+ this.currentOptions.map((opt) => ({
+ ...opt,
+ optioncontent: opt.targetvalue,
+ isabnormal: opt.isabnormal,
+ }));
+ } else if (this.templateForm.templateType === 2) {
+ this.editingQuestion.ivrLibaScriptTargetoptionList =
+ this.currentOptions;
+ }
+
+ // 瑙﹀彂閰嶇疆鍙樻洿妫�鏌�
+ this.handleConfigChange(this.editingQuestion);
+
+ this.$message.success("閫夐」閰嶇疆淇濆瓨鎴愬姛");
+ this.optionDialogVisible = false;
+ } catch (error) {
+ console.error("淇濆瓨閫夐」澶辫触:", error);
+ this.$message.error("淇濆瓨閫夐」澶辫触");
+ }
+ },
+
+ /** 淇敼淇濆瓨鍗曚釜棰樼洰閰嶇疆鏂规硶锛屾坊鍔犲紓甯搁�夐」妫�鏌� */
+ async saveSingleConfig(question) {
+ // 妫�鏌ユ槸鍚︽湁寮傚父閫夐」
+ if (!this.checkHasAbnormalOptions(question)) {
+ this.$confirm("璇ラ鐩病鏈夎缃紓甯搁�夐」锛屾槸鍚﹀厛閰嶇疆閫夐」锛�", "鎻愮ず", {
+ confirmButtonText: "鍘婚厤缃�",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ this.openOptionDialog(question);
+ })
+ .catch(() => {});
+ return;
+ }
+
+ // 鍘熸湁鐨勪繚瀛橀�昏緫...
+ if (!question.hasChanges) return;
+
+ const index = this.filteredQuestionList.findIndex(
+ (q) => q.id === question.id
+ );
+
+ if (index === -1) return;
+
+ const formRef = this.$refs.configForm && this.$refs.configForm[index];
+ if (!formRef) return;
+
+ const valid = await formRef.validate();
+ if (!valid) {
+ this.$message.warning("璇峰厛瀹屾垚蹇呭~椤�");
+ return;
+ }
+
+ // 缁х画鍘熸湁鐨勪繚瀛橀�昏緫...
+ question.saving = true;
+ question.saveStatus = null;
+
+ try {
+ // ... 鍘熸湁鐨勪繚瀛橀�昏緫涓嶅彉
+ } catch (error) {
+ // ... 閿欒澶勭悊涓嶅彉
+ } finally {
+ question.saving = false;
+ }
+ },
+
+ /** 鎵归噺淇濆瓨鏃朵篃瑕佹鏌� */
+ async handleBatchSave() {
+ if (!this.hasChanges || this.batchSaving) return;
+
+ // 妫�鏌ユ墍鏈夋湁鍙樻洿鐨勯鐩槸鍚﹂兘鏈夊紓甯搁�夐」
+ const changedQuestions = this.questionList.filter((q) => q.hasChanges);
+ const questionsWithoutAbnormal = changedQuestions.filter(
+ (q) => !this.checkHasAbnormalOptions(q)
+ );
+
+ if (questionsWithoutAbnormal.length > 0) {
+ this.$confirm(
+ `鏈� ${questionsWithoutAbnormal.length} 涓鐩病鏈夎缃紓甯搁�夐」锛岃鍏堥厤缃�夐」銆傛槸鍚︾户缁紵`,
+ "鎻愮ず",
+ {
+ confirmButtonText: "缁х画",
+ cancelButtonText: "鍘婚厤缃�",
+ type: "warning",
+ }
+ )
+ .then(() => {
+ // 缁х画鎵ц鎵归噺淇濆瓨
+ this.executeBatchSave(changedQuestions);
+ })
+ .catch(() => {
+ // 鍙互鍦ㄨ繖閲岃烦杞埌绗竴涓病鏈夊紓甯搁�夐」鐨勯鐩�
+ if (questionsWithoutAbnormal.length > 0) {
+ this.openOptionDialog(questionsWithoutAbnormal[0]);
+ }
+ });
+ } else {
+ this.executeBatchSave(changedQuestions);
+ }
+ },
+
+ /** 鎵ц鎵归噺淇濆瓨 */
+ async executeBatchSave(changedQuestions) {
+ this.$confirm("纭畾瑕佷繚瀛樻墍鏈変慨鏀硅繃鐨勯厤缃悧锛�", "鎵归噺淇濆瓨", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(async () => {
+ this.batchSaving = true;
+
+ const results = [];
+ for (const question of changedQuestions) {
+ try {
+ // 杩欓噷璋冪敤淇敼鍚庣殑saveSingleConfig鏂规硶
+ await this.saveSingleConfig(question);
+ results.push({
+ id: question.id,
+ success:
+ !question.hasChanges &&
+ question.saveStatus?.type === "success",
+ });
+ } catch (error) {
+ results.push({
+ id: question.id,
+ success: false,
+ });
+ }
+ }
+
+ this.batchSaving = false;
+ // ... 鍚庣画澶勭悊涓嶅彉
+ })
+ .catch(() => {
+ this.batchSaving = false;
+ });
+ },
+
+ /** 鑾峰彇寮傚父閫夐」缁熻 */
+ getAbnormalStats(question) {
+ if (this.templateForm.templateType === 1) {
+ const options = question.svyLibTemplateTargetoptions || [];
+ return {
+ total: options.length,
+ abnormal: options.filter((opt) => opt.isabnormal === 1).length,
+ warning: options.filter((opt) => opt.isabnormal === 2).length,
+ normal: options.filter((opt) => opt.isabnormal === 0).length,
+ };
+ } else if (this.templateForm.templateType === 2) {
+ const options = question.ivrLibaScriptTargetoptionList || [];
+ return {
+ total: options.length,
+ abnormal: options.filter((opt) => opt.isabnormal === 1).length,
+ warning: options.filter((opt) => opt.isabnormal === 2).length,
+ normal: options.filter((opt) => opt.isabnormal === 0).length,
+ };
+ }
+ return { total: 0, abnormal: 0, warning: 0, normal: 0 };
+ },
/** 鎼滅储 */
handleQuery() {
// 浠呯瓫閫夋樉绀猴紝涓嶉渶瑕侀噸鏂板姞杞�
@@ -1581,7 +2040,20 @@
}
.header-right {
- flex-shrink: 0;
+ display: flex;
+ flex-direction: column;
+ align-items: flex-end;
+ gap: 8px;
+
+ .option-status {
+ .status-tag {
+ cursor: default;
+
+ i {
+ margin-right: 4px;
+ }
+ }
+ }
}
}
@@ -1775,7 +2247,52 @@
}
}
}
+.option-config-wrapper {
+ .dialog-header {
+ margin-bottom: 20px;
+ padding-bottom: 15px;
+ border-bottom: 1px solid #ebeef5;
+ h4 {
+ margin: 0 0 8px 0;
+ color: #303133;
+ font-size: 16px;
+ font-weight: 600;
+ }
+
+ .dialog-subtitle {
+ margin: 0;
+ color: #606266;
+ font-size: 13px;
+ line-height: 1.4;
+ }
+ }
+
+ .option-list {
+ .option-item {
+ margin-bottom: 12px;
+ padding: 12px;
+ background: #f8f9fa;
+ border-radius: 4px;
+ border: 1px solid #ebeef5;
+
+ &:hover {
+ border-color: #dcdfe6;
+ }
+
+ .option-form {
+ .option-index {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ height: 100%;
+ color: #909399;
+ font-weight: 500;
+ }
+ }
+ }
+ }
+}
@media (max-width: 768px) {
.satisfaction-exception-config {
padding: 12px;
--
Gitblit v1.9.3