From 8a8cbdb9366873aac26ef565f797100dd289d51e Mon Sep 17 00:00:00 2001 From: WXL (wul) <wl_5969728@163.com> Date: 星期四, 28 八月 2025 13:55:45 +0800 Subject: [PATCH] 满意度 --- src/views/satisfaction.vue | 219 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 189 insertions(+), 30 deletions(-) diff --git a/src/views/satisfaction.vue b/src/views/satisfaction.vue index cedc116..44b6314 100644 --- a/src/views/satisfaction.vue +++ b/src/views/satisfaction.vue @@ -8,6 +8,31 @@ {{ surveyDescription }} </div> </div> + <div v-if="showDeptSelect" class="dept-select-container"> + <el-form> + <el-form> + <el-form-item label="閫夋嫨绉戝"> + <el-select + v-model="selectedDept" + filterable + clearable + placeholder="璇烽�夋嫨绉戝鎴栬緭鍏ュ叧閿瘝鎼滅储" + @change="handleDeptChange" + popper-class="dept-select-dropdown" + > + <el-option + v-for="dept in filteredDeptList" + :key="dept.code" + :label="`${dept.name} (${dept.code})`" + :value="dept.name" + > + <span>{{ dept.name }}</span> + </el-option> + </el-select> + </el-form-item> + </el-form> + </el-form> + </div> <el-divider></el-divider> <!-- 鍗曢�夐 --> @@ -90,7 +115,7 @@ <el-input type="textarea" :rows="3" - placeholder="璇疯緭鍏ユ偍鐨勬剰瑙佹垨寤鸿" + placeholder="璇疯緭鍏�" v-model="item.scriptResult" clearable > @@ -113,7 +138,7 @@ <div class="CONTENT" v-else> <div class="preview-lefts"> <div class="completion-message"> - <div class="thank-you">{{ this.accomplish||'鎰熻阿鎮ㄧ殑閰嶅悎!' }}</div> + <div class="thank-you">{{ this.accomplish || "鎰熻阿鎮ㄧ殑閰嶅悎!" }}</div> <div class="feedback-message">{{ completionMessage }}</div> </div> </div> @@ -125,6 +150,7 @@ import { getScriptByCondition, saveMYDQuestionAnswer, + WLgetDept, } from "@/api/AiCentre/index"; export default { @@ -134,8 +160,14 @@ surveyTitle: "", surveyDescription: "", questionList: [], + deptList: [], completionMessage: "", accomplish: false, + showDeptSelect: false, + selectedDept: null, + deptSearchText: "", // 淇濈暀鐢ㄤ簬鏈湴杩囨护 + deptList: [], + filteredDeptList: [], // 鍔犲瘑鍚庣殑鍙傛暟 encryptedParams: { @@ -143,6 +175,8 @@ param2: "", param3: "", param4: "", + param5: "", + param6: "30001002", }, // 娴嬭瘯鏁版嵁 @@ -283,29 +317,75 @@ // 浠庤矾鐢卞弬鏁拌幏鍙栧姞瀵嗗悗鐨勫弬鏁� this.encryptedParams.param1 = this.$route.query.param1 || - "DBohZ1ARKfFmCdKrBKQ6JW3ddPTtDpgSaRZaKtxBMTJ4FngT06Vy-VskiwDYJJRwfvkHrPIZlkafgZybobGtKQ=="; + "WOAq2QZd43E-qg-96SvuIFsn-sdRVxQNH4M82XhpXp_Ux4PFrPaqSFXcKaeA6oxEgNhPisA86LvU9kTAEz4xvQ=="; this.encryptedParams.param2 = this.$route.query.param2 || - "WQXniB7BIlizOwOQ4KZqITNrqWpLU3SD5vXdHLeYaviA-1T5Dtk70IJWAHbtcDUuYz-2ObYuMj4YKHfWhlCLzw=="; - this.encryptedParams.param3 = this.$route.query.param3 || null; - this.encryptedParams.param4 = this.$route.query.param4 || "1"; // 榛樿涓洪棬璇� + "XWeBh42RLYlNsMcomgw9UXhUPySkRP5EneWSueSq8F84qwYznU9heXuSx4tUMUtDvRnuJ86moJivy-kWQX12Rg=="; + this.encryptedParams.param5 = this.$route.query.param3 || "2"; // 1=浣忛櫌, 2=闂ㄨ瘖, 3=鎶曡瘔寤鸿 + this.encryptedParams.param6 = this.$route.query.param4 || "30001002"; - this.surveyType = parseInt(this.encryptedParams.param4) || 1; + this.surveyType = parseInt(this.encryptedParams.param5) || 2; // 鍔犺浇闂嵎鏁版嵁 this.loadSurveyData(); + // 鑾峰彇绉戝鍒楄〃 + this.WLgetDept(); }, + WLgetDept() { + // 璋冪敤鎺ュ彛鑾峰彇绉戝鏁版嵁 + WLgetDept(this.encryptedParams.param6).then((res) => { + this.deptList = Object.entries(res.data).map(([code, name]) => ({ + code, + name, + })); + this.filteredDeptList = [...this.deptList]; - // 鍔犺浇璋冩煡鏁版嵁 + if (this.surveyType === 3) { + this.showDeptSelect = true; + } + }); + }, + filterDeptList() { + if (!this.deptSearchText) { + this.filteredDeptList = [...this.deptList]; + return; + } + + const searchText = this.deptSearchText.toLowerCase(); + this.filteredDeptList = this.deptList.filter( + (dept) => + dept.name.toLowerCase().includes(searchText) || + dept.code.toLowerCase().includes(searchText) + ); + }, // 鍔犺浇璋冩煡鏁版嵁 loadSurveyData() { // 璋冪敤鎺ュ彛鑾峰彇闂嵎鏁版嵁 - getScriptByCondition(this.encryptedParams) + // 鏍规嵁闂嵎绫诲瀷璁剧疆涓嶅悓鐨勫弬鏁� + let encryptedParams = { + param1: this.encryptedParams.param1, + }; + + // 鏍规嵁surveyType璁剧疆涓嶅悓鐨勫弬鏁� + switch (this.surveyType) { + case 1: // 浣忛櫌 + encryptedParams.param2 = this.encryptedParams.param2; + break; + case 2: // 闂ㄨ瘖 + encryptedParams.param3 = this.encryptedParams.param2; + break; + case 3: // 鎶曡瘔寤鸿 + encryptedParams.param4 = this.encryptedParams.param2; + break; + default: + encryptedParams.param3 = this.encryptedParams.param2; + } + getScriptByCondition(encryptedParams) .then((res) => { if (res.code === 200) { if (res.data.result) { this.accomplish = res.data.result; - return + return; } // 澶勭悊鎺ュ彛杩斿洖鐨勬暟鎹� this.questionList = res.data.svyLibTemplateScriptVOS.map((item) => { @@ -317,14 +397,14 @@ // 鏍规嵁surveyType璁剧疆鏍囬鍜屾弿杩� switch (this.surveyType) { - case 1: // 闂ㄨ瘖 + case 2: // 闂ㄨ瘖 this.surveyTitle = "闂ㄨ瘖婊℃剰搴﹁皟鏌�"; this.surveyDescription = "浜茬埍鐨勬偅鑰咃紝鎰熻阿鎮ㄩ�夋嫨鎴戜滑鐨勫尰鐤楁湇鍔°�備负浜嗕笉鏂彁鍗囨湇鍔¤川閲忥紝璇锋偍鑺卞嚑鍒嗛挓鏃堕棿濉啓姝ら棶鍗枫��"; this.completionMessage = "鎰熻阿鎮ㄥ疂璐电殑鎰忚锛佹垜浠皢涓嶆柇鏀硅繘闂ㄨ瘖鏈嶅姟璐ㄩ噺锛屼负鎮ㄦ彁渚涙洿濂界殑鍖荤枟鏈嶅姟浣撻獙銆�"; break; - case 2: // 浣忛櫌 + case 1: // 浣忛櫌 this.surveyTitle = "浣忛櫌婊℃剰搴﹁皟鏌�"; this.surveyDescription = "浜茬埍鐨勬偅鑰呭強瀹跺睘锛屾劅璋㈡偍閫夋嫨鍦ㄦ垜闄綇闄㈡不鐤椼�備负浜嗘彁鍗囦綇闄㈡湇鍔¤川閲忥紝璇锋偍濉啓姝ら棶鍗枫��"; @@ -351,7 +431,10 @@ this.useTestData(this.surveyType); }); }, - + handleDeptChange(value) { + this.selectedDept = value; + // 鍙互鍦ㄨ繖閲屾坊鍔犲叾浠栧鐞嗛�昏緫 + }, // 浣跨敤娴嬭瘯鏁版嵁 useTestData(surveyType) { const type = [1, 2, 3].includes(surveyType) ? surveyType : 1; @@ -376,7 +459,7 @@ const res = await saveMYDQuestionAnswer(submitData); if (res.code === 200) { - this.accomplish = false; + this.accomplish = "闂嵎宸叉彁浜�"; this.$message.success("鎻愪氦鎴愬姛锛佹劅璋㈡偍鐨勫弽棣堛��"); } else { this.$message.error(res.msg || "鎻愪氦澶辫触锛岃绋嶅悗鍐嶈瘯"); @@ -401,26 +484,39 @@ }, // 鍑嗗鎻愪氦鏁版嵁 - // 鍑嗗鎻愪氦鏁版嵁 prepareSubmitData() { + // 鍒涘缓绉戝閫夋嫨闂瀵硅薄 + const deptQuestion = { + scriptId: "dept_selection", // 鑷畾涔塈D + scriptType: 4, // 4琛ㄧず闂瓟绫诲瀷 + scriptContent: "閫夋嫨鐨勭瀹�", + scriptResult: this.selectedDept || "", // 瀛樺偍閫夋嫨鐨勭瀹ゅ悕绉� + required: false, // 闈炲繀濉� + sort: 999, + nextScriptno: "1", + }; + return { taskId: this.encryptedParams.param1, serialnum: this.encryptedParams.param2 || this.encryptedParams.param3, - mzzy: this.surveyType, // 1=闂ㄨ瘖, 2=浣忛櫌, 3=鎶曡瘔寤鸿 - svyLibTemplateScriptVOS: this.questionList.map((item) => { - return { - scriptId: item.scriptId, - scriptType: item.scriptType, - scriptResult: - item.scriptType === 2 - ? (item.scriptResult || []).join("&") - : item.scriptResult || "", - nextScriptno: item.nextScriptno, - score: item.score, - prompt: item.prompt, - ...item, - }; - }), + mzzy: this.surveyType, + svyLibTemplateScriptVOS: [ + deptQuestion, // 灏嗙瀹ら�夋嫨浣滀负绗竴涓棶棰� + ...this.questionList.map((item) => { + return { + scriptId: item.scriptId, + scriptType: item.scriptType, + scriptResult: + item.scriptType === 2 + ? (item.scriptResult || []).join("&") + : item.scriptResult || "", + nextScriptno: item.nextScriptno, + score: item.score, + prompt: item.prompt, + ...item, + }; + }), + ], excep: this.checkAbnormalOptions() ? 1 : 0, }; }, @@ -518,7 +614,70 @@ --theme-gradient: linear-gradient(135deg, #e53e3e, #f6ad55); } } +.dept-select-container { + margin: 20px 0; + padding: 20px; + background-color: #f8fafc; + border-radius: 8px; + border: 1px solid #e2e8f0; +} +/* 璋冩暣涓嬫媺閫夐」鏍峰紡 */ +.el-select-dropdown__item { + display: flex; + justify-content: space-between; +} +/* 涓嬫媺妗嗘牱寮忚皟鏁� */ +::v-deep .dept-select-dropdown { + max-height: 400px; /* 闄愬埗鏈�澶ч珮搴� */ + overflow-y: auto; /* 娣诲姞婊氬姩鏉� */ + + .el-select-dropdown__item { + display: flex; + justify-content: space-between; + padding: 0 20px; + height: auto; + line-height: 36px; + + span { + display: inline-block; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + /* 鍚嶇О閮ㄥ垎 */ + span:first-child { + width: 60%; + text-align: left; + } + + /* 缂栫爜閮ㄥ垎 */ + span:last-child { + width: 40%; + text-align: right; + } + } +} + +/* 绉诲姩绔�傞厤 */ +@media (max-width: 768px) { + ::v-deep .dept-select-dropdown { + max-width: 100vw; /* 闄愬埗鏈�澶у搴︿负瑙嗗彛瀹藉害 */ + width: auto !important; + left: 10px !important; + right: 10px !important; + + .el-select-dropdown__item { + span:first-child { + width: 50%; + } + span:last-child { + width: 50%; + } + } + } +} .CONTENT { max-width: 900px; margin: 0 auto; -- Gitblit v1.9.3