From a5cba9ab040f6f97558046885dce3017f9bab7e9 Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期二, 11 八月 2026 14:12:29 +0800
Subject: [PATCH] 提交
---
src/views/Satisfaction/configurationmyd/index.vue | 707 +++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 623 insertions(+), 84 deletions(-)
diff --git a/src/views/Satisfaction/configurationmyd/index.vue b/src/views/Satisfaction/configurationmyd/index.vue
index 7034876..dbc0df8 100644
--- a/src/views/Satisfaction/configurationmyd/index.vue
+++ b/src/views/Satisfaction/configurationmyd/index.vue
@@ -116,7 +116,7 @@
<span class="meta-item">
<i class="el-icon-s-order"></i>
妯℃澘绫诲瀷锛歿{
- templateForm.templateType === 1 ? "闂嵎妯℃澘" : "璇煶妯℃澘"
+ templateForm.templateType == 1 ? "闂嵎妯℃澘" : "璇煶妯℃澘"
}}
</span>
<span class="meta-item">
@@ -132,11 +132,11 @@
<div class="info-right">
<el-tag
:type="
- currentTemplateInfo.templateStatus === 1 ? 'success' : 'info'
+ currentTemplateInfo.templateStatus == 1 ? 'success' : 'info'
"
size="medium"
>
- {{ currentTemplateInfo.templateStatus === 1 ? "鍚敤" : "鍋滅敤" }}
+ {{ currentTemplateInfo.templateStatus == 1 ? "鍚敤" : "鍋滅敤" }}
</el-tag>
</div>
</div>
@@ -144,14 +144,13 @@
</div>
<!-- 鎼滅储鍖哄煙锛堥鐩瓫閫夛級 -->
- <div v-if="questionList.length > 0" class="search-section">
+ <div v-show="questionList.length > 0" class="search-section">
<el-card shadow="never" class="search-container">
- <el-form :model="queryParams" :inline="true" size="medium">
+ <el-form :model="queryParams" size="medium">
<el-form-item label="闂涓婚">
<el-input
v-model="queryParams.scriptTopic"
placeholder="璇疯緭鍏ラ棶棰樹富棰�"
- clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
@@ -159,7 +158,6 @@
<el-input
v-model="queryParams.scriptContent"
placeholder="璇疯緭鍏ラ棶棰樺唴瀹�"
- clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
@@ -213,13 +211,12 @@
</div>
<div
- v-else-if="questionList.length === 0 && templateForm.templateId"
+ v-else-if="questionList.length == 0 && templateForm.templateId"
class="empty-wrapper"
>
<el-empty description="璇ユā鏉夸腑鏆傛棤婊℃剰搴﹂鐩�">
<p class="empty-tip">
- 璇烽�夋嫨鍏朵粬妯℃澘鎴栨鏌ユā鏉夸腑鏄惁鍖呭惈婊℃剰搴︾被鍨嬮鐩紙鍒嗙被ID:
- 404,405,406锛�
+ 璇烽�夋嫨鍏朵粬妯℃澘鎴栨鏌ユā鏉夸腑鏄惁鍖呭惈婊℃剰搴︾被鍨嬮鐩�
</p>
</el-empty>
</div>
@@ -272,6 +269,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 +315,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>
@@ -327,7 +377,15 @@
</div>
</el-form-item>
</div>
-
+ <div class="config-field">
+ <el-form-item label="璐d换浜哄伐鍙�">
+ <el-input
+ v-model="question.exceptionConfig.dutyDeptPersonCode"
+ placeholder="璇疯緭鍏ヨ矗浠讳汉宸ュ彿"
+ @input="handleConfigChange(question)"
+ />
+ </el-form-item>
+ </div>
<!-- 鎶ュ绉戝锛堝閫夛級 -->
<div class="config-field">
<el-form-item
@@ -393,9 +451,7 @@
:closable="false"
show-icon
:effect="
- question.saveStatus.type === 'success'
- ? 'dark'
- : 'light'
+ question.saveStatus.type == 'success' ? 'dark' : 'light'
"
size="small"
/>
@@ -428,7 +484,112 @@
</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"> 淇濆瓨閰嶇疆 </el-button>
+ </span>
+ </el-dialog>
<!-- 棰樼洰棰勮瀵硅瘽妗� -->
<el-dialog
title="棰樼洰棰勮"
@@ -573,7 +734,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: [], // 璇煶妯℃澘鍒楄〃
@@ -585,8 +764,8 @@
// 鏌ヨ鍙傛暟
queryParams: {
- scriptTopic: "",
- scriptContent: "",
+ scriptTopic: null,
+ scriptContent: null,
},
// 鏁版嵁鍒楄〃
@@ -612,8 +791,9 @@
changedCount: 0,
// 婊℃剰搴﹀垎绫籌D
- satisfactionCategoryIds: ["404", "405", "406"],
-
+ satisfactionCategoryIds: ["404", "405", "406", "10039", "10041", "10042"],
+ questionnaireCategorys: [],
+ voiceCategories: [],
// 琛ㄥ崟楠岃瘉瑙勫垯
configRules: {
responsibilityDept: [
@@ -624,7 +804,7 @@
},
{
validator: (rule, value, callback) => {
- if (!value || value.length === 0) {
+ if (!value || value.length == 0) {
callback(new Error("璇疯嚦灏戦�夋嫨涓�涓矗浠荤瀹�"));
} else {
callback();
@@ -641,7 +821,7 @@
},
{
validator: (rule, value, callback) => {
- if (!value || value.length === 0) {
+ if (!value || value.length == 0) {
callback(new Error("璇疯嚦灏戦�夋嫨涓�涓姤澶囩瀹�"));
} else {
callback();
@@ -656,9 +836,9 @@
computed: {
// 鏍规嵁妯℃澘绫诲瀷杩囨护妯℃澘閫夐」
filteredTemplateOptions() {
- if (this.templateForm.templateType === 1) {
+ if (this.templateForm.templateType == 1) {
return this.questionnaireTemplates;
- } else if (this.templateForm.templateType === 2) {
+ } else if (this.templateForm.templateType == 2) {
return this.followupTemplates;
}
return [];
@@ -666,9 +846,16 @@
// 婊℃剰搴﹂鐩暟閲�
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;
+ }
+ return 0;
},
// 绛涢�夊悗鐨勯鐩垪琛�
@@ -676,9 +863,15 @@
let filtered = this.questionList;
// 绛涢�夋弧鎰忓害棰樼洰
- 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 +893,19 @@
},
},
created() {
+ if (store.getters.satisfactionCategories) {
+ // this.questionnaireCategorys = [404, 405, 406, 10039, 10041, 10042];
+ // console.log(1);
+
+ this.questionnaireCategorys =
+ store.getters.satisfactionCategories.questionnaireCategorys.map(
+ (item) => item.categoryid
+ );
+ this.voiceCategories =
+ store.getters.satisfactionCategories.voiceCategories.map(
+ (item) => item.categoryid
+ );
+ }
this.getDeptOptions();
this.loadAllTemplates();
},
@@ -750,13 +956,13 @@
/** 鏍规嵁绉戝缂栫爜鑾峰彇绉戝鍚嶇О */
getDeptName(deptCode) {
if (!deptCode) return "";
- const dept = this.deptOptions.find((d) => d.deptCode === deptCode);
+ const dept = this.deptOptions.find((d) => d.deptCode == deptCode);
return dept ? dept.label : deptCode;
},
/** 鏍规嵁绉戝缂栫爜鏁扮粍鑾峰彇绉戝鍚嶇О鏁扮粍 */
getDeptNames(deptCodes) {
- if (!Array.isArray(deptCodes) || deptCodes.length === 0) return [];
+ if (!Array.isArray(deptCodes) || deptCodes.length == 0) return [];
return deptCodes
.map((code) => this.getDeptName(code))
.filter((name) => name && name.trim());
@@ -774,12 +980,15 @@
return new Promise((resolve) => {
getQtemplatelist({ pageSize: 1000 })
.then((res) => {
- if (res.code === 200) {
+ console.log(res.rows, "res.rows");
+ if (res.code == 200) {
+ console.log(res.rows, 2);
this.questionnaireTemplates = (res.rows || []).map((item) => ({
id: item.svyid,
templateName: item.svyname,
isavailable: item.isavailable,
}));
+ console.log(this.followupTemplates, 3);
} else {
this.$message.error(res.msg || "鍔犺浇闂嵎妯℃澘澶辫触");
}
@@ -798,12 +1007,16 @@
return new Promise((resolve) => {
getFollowuplist({ pageSize: 1000 })
.then((res) => {
- if (res.code === 200) {
+ console.log(res.rows, "res.rows");
+ if (res.code == 200) {
+ console.log(res.rows, 2);
+
this.followupTemplates = (res.rows || []).map((item) => ({
id: item.id,
templateName: item.templateName,
isavailable: item.isavailable,
}));
+ console.log(this.followupTemplates, 3);
} else {
this.$message.error(res.msg || "鍔犺浇璇煶妯℃澘澶辫触");
}
@@ -821,7 +1034,7 @@
handleTemplateChange(templateId) {
if (templateId) {
const selectedTemplate = this.filteredTemplateOptions.find(
- (t) => t.id === templateId
+ (t) => t.id == templateId
);
if (selectedTemplate) {
this.currentTemplateInfo = {
@@ -830,14 +1043,14 @@
questionCount: 0,
};
}
-// 鍔犺浇妯℃澘璇︽儏鏁版嵁
+ // 鍔犺浇妯℃澘璇︽儏鏁版嵁
this.templateLoading = true;
this.loading = true;
this.questionList = [];
- if (this.templateForm.templateType === 1) {
+ if (this.templateForm.templateType == 1) {
this.loadQuestionnaireTemplateDetail();
- } else if (this.templateForm.templateType === 2) {
+ } else if (this.templateForm.templateType == 2) {
this.loadFollowupTemplateDetail();
}
} else {
@@ -858,9 +1071,9 @@
this.loading = true;
this.questionList = [];
- if (this.templateForm.templateType === 1) {
+ if (this.templateForm.templateType == 1) {
this.loadQuestionnaireTemplateDetail();
- } else if (this.templateForm.templateType === 2) {
+ } else if (this.templateForm.templateType == 2) {
this.loadFollowupTemplateDetail();
}
});
@@ -873,7 +1086,7 @@
this.templateLoading = false;
this.loading = false;
- if (res.code === 200 && res.rows && res.rows.length > 0) {
+ if (res.code == 200 && res.rows && res.rows.length > 0) {
const templateDetail = res.rows[0];
// 鏇存柊妯℃澘淇℃伅
@@ -908,7 +1121,7 @@
this.templateLoading = false;
this.loading = false;
- if (res.code === 200) {
+ if (res.code == 200) {
const templateDetail = res.data;
// 鏇存柊妯℃澘淇℃伅
@@ -944,6 +1157,7 @@
let exceptionConfig = {
responsibilityDept: [], // 璐d换绉戝缂栫爜鏁扮粍
reportDept: [], // 鎶ュ绉戝缂栫爜鏁扮粍
+ dutyDeptPersonCode: question.dutyDeptPersonCode || "", // 璐d换浜哄伐鍙�
};
// 浠庨鐩《灞傚瓧娈佃鍙栨暟鎹�
@@ -997,23 +1211,12 @@
/** 閰嶇疆鍙樻洿澶勭悊 */
handleConfigChange(question) {
- this.$nextTick(() => {
- const index = this.questionList.findIndex((q) => q.id === question.id);
- if (index !== -1) {
- const formRef = this.$refs.configForm && this.$refs.configForm[index];
- if (formRef) {
- formRef.validate((valid) => {
- if (valid) {
- question.hasChanges = !this.isConfigEqual(
- question.exceptionConfig,
- question.originalConfig
- );
- this.updateChangedStatus();
- }
- });
- }
- }
- });
+ // 鐩存帴瀵规瘮閰嶇疆鏄惁鍙樺寲锛屼笉渚濊禆琛ㄥ崟鏍¢獙锛堥伩鍏嶅彧鏀逛竴涓瓧娈垫椂鏍¢獙涓嶉�氳繃瀵艰嚧 hasChanges 鏃犳硶鏇存柊锛�
+ question.hasChanges = !this.isConfigEqual(
+ question.exceptionConfig,
+ question.originalConfig
+ );
+ this.updateChangedStatus();
},
/** 姣旇緝閰嶇疆鏄惁鏀瑰彉 */
@@ -1036,8 +1239,12 @@
.sort()
.join(",")
.toLowerCase();
+ const person1 = (config1.dutyDeptPersonCode || "").trim();
+ const person2 = (config2.dutyDeptPersonCode || "").trim();
- return responsibility1 === responsibility2 && report1 === report2;
+ return responsibility1 == responsibility2
+ && report1 == report2
+ && person1 == person2;
},
/** 鏇存柊鍙樻洿鐘舵�� */
@@ -1045,20 +1252,61 @@
const changedItems = this.questionList.filter((q) => q.hasChanges);
this.changedCount = changedItems.length;
this.hasChanges = changedItems.length > 0;
+
+ // 寮哄埗鏇存柊瑙嗗浘
+ this.$forceUpdate();
+ },
+
+ /** 妫�鏌ラ鐩槸鍚︽湁寮傚父閫夐」 */
+ 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;
},
/** 淇濆瓨鍗曚釜棰樼洰閰嶇疆 */
- async saveSingleConfig(question) {
- if (!question.hasChanges) return;
+ async saveSingleConfig(question, skipAbnormalCheck = false) {
+ // 妫�鏌ユ槸鍚︽湁鍙樻洿
+ if (!question.hasChanges && !skipAbnormalCheck) {
+ this.$message.info("褰撳墠閰嶇疆鏃犲彉鍖�");
+ return;
+ }
- const index = this.questionList.findIndex((q) => q.id === question.id);
- if (index === -1) return;
+ // 妫�鏌ユ槸鍚︽湁寮傚父閫夐」
+ if (!skipAbnormalCheck && !this.checkHasAbnormalOptions(question)) {
+ this.$confirm(
+ "璇ラ鐩病鏈夎缃紓甯搁�夐」锛屽繀椤诲厛閰嶇疆寮傚父閫夐」鎵嶈兘淇濆瓨銆傛槸鍚︾珛鍗抽厤缃紵",
+ "鎻愮ず",
+ {
+ confirmButtonText: "鍘婚厤缃�",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ }
+ )
+ .then(() => {
+ this.openOptionDialog(question);
+ })
+ .catch(() => {});
+ return;
+ }
+
+ const index = this.questionList.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) {
+ // 楠岃瘉琛ㄥ崟
+ try {
+ await formRef.validate();
+ } catch (error) {
this.$message.warning("璇峰厛瀹屾垚蹇呭~椤�");
return;
}
@@ -1069,16 +1317,16 @@
try {
// 鑾峰彇褰撳墠妯℃澘璇︽儏
let templateDetail;
- if (this.templateForm.templateType === 1) {
+ if (this.templateForm.templateType == 1) {
// 闂嵎妯℃澘
const res = await getQtemplateobj({
svyid: this.templateForm.templateId,
});
- if (res.code !== 200 || !res.rows || res.rows.length === 0) {
+ if (res.code !== 200 || !res.rows || res.rows.length == 0) {
throw new Error(res.msg || "鑾峰彇妯℃澘璇︽儏澶辫触");
}
templateDetail = res.rows[0];
- } else if (this.templateForm.templateType === 2) {
+ } else if (this.templateForm.templateType == 2) {
// 璇煶妯℃澘
const res = await getvFollowup({ id: this.templateForm.templateId });
if (res.code !== 200) {
@@ -1090,14 +1338,14 @@
// 鏇存柊棰樼洰閰嶇疆
let updatedTemplateDetail = { ...templateDetail };
let questionsField =
- this.templateForm.templateType === 1
+ this.templateForm.templateType == 1
? "svyTemplateLibScripts"
: "ivrLibaTemplateScriptVOList";
const questions = updatedTemplateDetail[questionsField] || [];
- const questionIndex = questions.findIndex((q) => q.id === question.id);
+ const questionIndex = questions.findIndex((q) => q.id == question.id);
- if (questionIndex === -1) {
+ if (questionIndex == -1) {
throw new Error("鏈壘鍒伴鐩�");
}
@@ -1117,14 +1365,24 @@
dutyDeptName: responsibilityDeptNames.join(","),
reportDeptCode: question.exceptionConfig.reportDept.join(","),
reportDeptName: reportDeptNames.join(","),
+ dutyDeptPersonCode: question.exceptionConfig.dutyDeptPersonCode || "",
};
+
+ // 濡傛灉闇�瑕侊紝涔熸洿鏂伴�夐」鏁版嵁
+ if (question.hasChanges && this.templateForm.templateType == 1) {
+ questions[questionIndex].svyLibTemplateTargetoptions =
+ question.svyLibTemplateTargetoptions || [];
+ } else if (question.hasChanges && this.templateForm.templateType == 2) {
+ questions[questionIndex].ivrLibaScriptTargetoptionList =
+ question.ivrLibaScriptTargetoptionList || [];
+ }
// 鏇存柊妯℃澘
updatedTemplateDetail[questionsField] = questions;
// 淇濆瓨妯℃澘
let response;
- if (this.templateForm.templateType === 1) {
+ if (this.templateForm.templateType == 1) {
response = await compileQtemplate({
...updatedTemplateDetail,
id: this.templateForm.templateId,
@@ -1138,7 +1396,7 @@
});
}
- if (response.code === 200) {
+ if (response.code == 200) {
this.handleSaveSuccess(question);
} else {
throw new Error(response.msg || "淇濆瓨澶辫触");
@@ -1156,7 +1414,6 @@
},
/** 澶勭悊淇濆瓨鎴愬姛 */
- /** 澶勭悊淇濆瓨鎴愬姛 */
handleSaveSuccess(question) {
// 鍚屾椂鏇存柊棰樼洰椤跺眰瀛楁
const responsibilityDeptNames = this.getDeptNames(
@@ -1172,6 +1429,7 @@
question.dutyDeptName = responsibilityDeptNames.join(",");
question.reportDeptCode = question.exceptionConfig.reportDept.join(",");
question.reportDeptName = reportDeptNames.join(",");
+ question.dutyDeptPersonCode = question.exceptionConfig.dutyDeptPersonCode || "";
// 鏇存柊鍘熷閰嶇疆
question.originalConfig = JSON.parse(
@@ -1192,7 +1450,6 @@
}, 5000);
},
- /** 閲嶇疆鍗曚釜棰樼洰閰嶇疆 */
/** 閲嶇疆鍗曚釜棰樼洰閰嶇疆 */
resetSingleConfig(question) {
this.$confirm("纭畾瑕侀噸缃綋鍓嶉鐩殑閰嶇疆鍚楋紵", "鎻愮ず", {
@@ -1231,6 +1488,36 @@
async handleBatchSave() {
if (!this.hasChanges || this.batchSaving) return;
+ // 鑾峰彇鏈夊彉鏇寸殑棰樼洰
+ const changedQuestions = this.questionList.filter((q) => q.hasChanges);
+ if (changedQuestions.length == 0) {
+ this.$message.info("娌℃湁闇�瑕佷繚瀛樼殑閰嶇疆鍙樻洿");
+ return;
+ }
+
+ // 妫�鏌ユ槸鍚︽湁棰樼洰缂哄皯寮傚父閫夐」
+ const questionsWithoutAbnormal = changedQuestions.filter(
+ (q) => !this.checkHasAbnormalOptions(q)
+ );
+
+ if (questionsWithoutAbnormal.length > 0) {
+ this.$confirm(
+ `鏈� ${questionsWithoutAbnormal.length} 涓鐩病鏈夎缃紓甯搁�夐」锛屽繀椤婚厤缃紓甯搁�夐」鍚庢墠鑳戒繚瀛樸�傛槸鍚﹀厛鍘婚厤缃紵`,
+ "鎻愮ず",
+ {
+ confirmButtonText: "鍘婚厤缃�",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ }
+ )
+ .then(() => {
+ // 鎵撳紑绗竴涓病鏈夊紓甯搁�夐」鐨勯鐩殑閰嶇疆瀵硅瘽妗�
+ this.openOptionDialog(questionsWithoutAbnormal[0]);
+ })
+ .catch(() => {});
+ return;
+ }
+
this.$confirm("纭畾瑕佷繚瀛樻墍鏈変慨鏀硅繃鐨勯厤缃悧锛�", "鎵归噺淇濆瓨", {
confirmButtonText: "纭畾",
cancelButtonText: "鍙栨秷",
@@ -1239,24 +1526,20 @@
.then(async () => {
this.batchSaving = true;
- const changedQuestions = this.questionList.filter(
- (q) => q.hasChanges
- );
const results = [];
-
for (const question of changedQuestions) {
try {
- await this.saveSingleConfig(question);
+ // 璺宠繃寮傚父妫�鏌ワ紝鍥犱负鍦ㄤ笂闈㈠凡缁忔鏌ヨ繃浜�
+ await this.saveSingleConfig(question, true);
results.push({
id: question.id,
- success:
- !question.hasChanges &&
- question.saveStatus?.type === "success",
+ success: !question.hasChanges,
});
} catch (error) {
results.push({
id: question.id,
success: false,
+ error: error.message,
});
}
}
@@ -1266,13 +1549,18 @@
const successCount = results.filter((r) => r.success).length;
const failCount = results.length - successCount;
- if (failCount === 0) {
+ if (failCount == 0) {
this.saveSuccessVisible = true;
this.$message.success(`鎴愬姛淇濆瓨 ${successCount} 涓厤缃甡);
} else {
this.$message.warning(
`鎴愬姛淇濆瓨 ${successCount} 涓紝澶辫触 ${failCount} 涓猔
);
+ // 鍙互鏄剧ず鍏蜂綋鍝簺澶辫触浜�
+ const failedQuestions = results
+ .filter((r) => !r.success)
+ .map((r) => r.id);
+ console.error("淇濆瓨澶辫触鐨勯鐩甀D:", failedQuestions);
}
})
.catch(() => {
@@ -1285,6 +1573,199 @@
this.currentPreview = { ...question };
this.previewAnswer = "";
this.previewVisible = true;
+ },
+
+ /** 淇敼閫夐」绠$悊瀵硅瘽妗嗙殑鎵撳紑鏂规硶锛屼繚瀛樺師濮嬮�夐」 */
+ openOptionDialog(question) {
+ this.editingQuestion = question;
+
+ // 淇濆瓨鍘熷閫夐」鐨勫揩鐓�
+ if (this.templateForm.templateType == 1) {
+ this.editingQuestion.originalOptions = JSON.parse(
+ JSON.stringify(question.svyLibTemplateTargetoptions || [])
+ );
+ } else if (this.templateForm.templateType == 2) {
+ this.editingQuestion.originalOptions = JSON.parse(
+ JSON.stringify(question.ivrLibaScriptTargetoptionList || [])
+ );
+ }
+
+ // 澶嶅埗閫夐」鏁版嵁
+ if (this.templateForm.templateType == 1) {
+ this.currentOptions = JSON.parse(
+ JSON.stringify(question.svyLibTemplateTargetoptions || [])
+ ).map((opt, index) => ({
+ ...opt,
+ id: opt.id || `temp_${Date.now()}_${index}`,
+ targetvalue: opt.optioncontent || "",
+ isabnormal: opt.isabnormal || 0,
+ }));
+ } else if (this.templateForm.templateType == 2) {
+ this.currentOptions = JSON.parse(
+ JSON.stringify(question.ivrLibaScriptTargetoptionList || [])
+ ).map((opt, index) => ({
+ ...opt,
+ id: opt.id || `temp_${Date.now()}_${index}`,
+ targetvalue: opt.targetvalue || "",
+ isabnormal: opt.isabnormal || 0,
+ }));
+ }
+
+ this.optionDialogVisible = true;
+ },
+
+ /** 娣诲姞鏂伴�夐」 */
+ addNewOption() {
+ this.currentOptions.push({
+ id: `temp_${Date.now()}_${this.currentOptions.length}`,
+ targetvalue: "",
+ isabnormal: 0,
+ isNew: true,
+ });
+ },
+
+ /** 鍒犻櫎閫夐」 */
+ removeOption(index) {
+ this.$confirm("纭畾瑕佸垹闄よ繖涓�夐」鍚楋紵", "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ this.currentOptions.splice(index, 1);
+ })
+ .catch(() => {});
+ },
+
+ /** 淇濆瓨閫夐」閰嶇疆 */
+ async saveOptions() {
+ try {
+ // 楠岃瘉蹇呭~椤�
+ for (let i = 0; i < this.currentOptions.length; i++) {
+ const option = this.currentOptions[i];
+ if (!option.targetvalue || option.targetvalue.trim() == "") {
+ this.$message.warning(`绗� ${i + 1} 涓�夐」鍐呭涓嶈兘涓虹┖`);
+ return;
+ }
+ }
+
+ // 妫�鏌ユ槸鍚︽湁寮傚父閫夐」
+ const hasAbnormal = this.currentOptions.some(
+ (opt) => opt.isabnormal == 1
+ );
+
+ if (!hasAbnormal) {
+ this.$message.warning("璇疯嚦灏戣缃竴涓紓甯搁�夐」锛坕sabnormal=1锛�");
+ return;
+ }
+
+ // 鍒ゆ柇閫夐」鏄惁鍙戠敓鍙樺寲
+ let isOptionsChanged = false;
+
+ if (this.templateForm.templateType == 1) {
+ const originalOptions =
+ this.editingQuestion.svyLibTemplateTargetoptions || [];
+ isOptionsChanged = this.checkOptionsChanged(
+ originalOptions,
+ this.currentOptions,
+ "questionnaire"
+ );
+ } else if (this.templateForm.templateType == 2) {
+ const originalOptions =
+ this.editingQuestion.ivrLibaScriptTargetoptionList || [];
+ isOptionsChanged = this.checkOptionsChanged(
+ originalOptions,
+ this.currentOptions,
+ "voice"
+ );
+ }
+
+ // 淇濆瓨閫昏緫 - 鏇存柊棰樼洰瀵硅薄鐨勯�夐」鏁版嵁
+ if (this.templateForm.templateType == 1) {
+ this.editingQuestion.svyLibTemplateTargetoptions =
+ this.currentOptions.map((opt) => ({
+ ...opt,
+ optioncontent: opt.targetvalue,
+ isabnormal: opt.isabnormal,
+ // 娓呴櫎涓存椂瀛楁
+ targetvalue: undefined,
+ isNew: undefined,
+ }));
+ } else if (this.templateForm.templateType == 2) {
+ this.editingQuestion.ivrLibaScriptTargetoptionList =
+ this.currentOptions.map((opt) => ({
+ ...opt,
+ // 娓呴櫎涓存椂瀛楁
+ isNew: undefined,
+ }));
+ }
+
+ // 濡傛灉閫夐」鏈夊彉鍖栵紝鍒欒缃鐩负鏈夊彉鏇寸姸鎬�
+ if (isOptionsChanged) {
+ this.editingQuestion.hasChanges = true;
+ this.updateChangedStatus();
+ }
+
+ this.$message.success("閫夐」閰嶇疆淇濆瓨鎴愬姛");
+ this.optionDialogVisible = false;
+ } catch (error) {
+ console.error("淇濆瓨閫夐」澶辫触:", error);
+ this.$message.error("淇濆瓨閫夐」澶辫触");
+ }
+ },
+ /** 妫�鏌ラ�夐」鏄惁鍙戠敓鍙樺寲 */
+ checkOptionsChanged(originalOptions, newOptions, templateType) {
+ // 濡傛灉鏁伴噺涓嶅悓锛屽垯涓�瀹氬彉鍖栦簡
+ if (originalOptions.length !== newOptions.length) {
+ return true;
+ }
+
+ // 姣旇緝姣忎釜閫夐」鐨勫唴瀹瑰拰寮傚父鐘舵��
+ for (let i = 0; i < originalOptions.length; i++) {
+ const original = originalOptions[i];
+ const current = newOptions[i];
+
+ if (templateType == "questionnaire") {
+ // 闂嵎妯℃澘姣旇緝
+ if (
+ original.optioncontent !== current.targetvalue ||
+ original.isabnormal !== current.isabnormal
+ ) {
+ return true;
+ }
+ } else if (templateType == "voice") {
+ // 璇煶妯℃澘姣旇緝
+ if (
+ original.targetvalue !== current.targetvalue ||
+ original.isabnormal !== current.isabnormal
+ ) {
+ return true;
+ }
+ }
+ }
+
+ return 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 };
},
/** 鎼滅储 */
@@ -1581,7 +2062,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 +2269,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