From b5a56d53e44c426fa188ba3e4e1db3eb779e2fd9 Mon Sep 17 00:00:00 2001
From: WXL <1785969728@qq.com>
Date: 星期三, 11 九月 2024 21:49:21 +0800
Subject: [PATCH] 测试完成
---
src/views/knowledge/questionnaire/compilequer/index.vue | 637 ++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 449 insertions(+), 188 deletions(-)
diff --git a/src/views/knowledge/questionnaire/compilequer/index.vue b/src/views/knowledge/questionnaire/compilequer/index.vue
index 6d02685..7d0fc22 100644
--- a/src/views/knowledge/questionnaire/compilequer/index.vue
+++ b/src/views/knowledge/questionnaire/compilequer/index.vue
@@ -41,7 +41,7 @@
>
<el-row :gutter="10">
<el-col :span="10">
- <el-form-item label="闂嵎鍒嗙被" prop="region">
+ <el-form-item label="闂嵎鍒嗙被" prop="categoryid">
<el-select
v-model="ruleForm.categoryid"
size="medium"
@@ -65,7 +65,7 @@
</el-form-item>
</el-col>
<el-col :span="10">
- <el-form-item label="璇勪环绫诲瀷">
+ <el-form-item label="璇勪环绫诲瀷" prop="scoreType">
<el-select
v-model="ruleForm.scoreType"
placeholder="璇烽�夋嫨鍒嗙被"
@@ -81,12 +81,12 @@
</el-form-item>
</el-col>
</el-row>
- <el-form-item label="闂嵎鏍囬" prop="name">
+ <el-form-item label="闂嵎鏍囬" prop="svyname">
<div style="width: 30%">
<el-input v-model="ruleForm.svyname"></el-input>
</div>
</el-form-item>
- <el-form-item label="闂嵎鎻忚堪">
+ <el-form-item label="闂嵎鎻忚堪" prop="description">
<el-input
style="width: 40vw"
type="textarea"
@@ -98,7 +98,19 @@
></el-form-item>
<el-row>
- <el-form-item label="鏍囩" prop="desc">
+ <el-form-item prop="dynamicTags" >
+ <template #label>
+ 鏍囩
+ <el-tooltip
+ class="item"
+ effect="light"
+ content="鍑嗙‘銆佹壖瑕併�佸閲嶇殑鏍囩锛屽彲浠ヨ鎮ㄥ湪绯荤粺浣跨敤涓柟渚跨殑鏌ユ壘鍒拌妯$増銆�"
+ placement="top-start"
+ >
+ <i class="el-icon-warning-outline"></i>
+ </el-tooltip>
+ <!-- 鍦ㄦ爣绛惧悗鎻掑叆绾㈣壊鏄熷彿 -->
+ </template>
<div class="xinz-inf">
<el-tag
:key="tag.tagname"
@@ -142,7 +154,18 @@
</el-form-item>
</el-row>
<div class="xinz-infs">
- <el-form-item label="閫傜敤鐤剧梾" prop="region">
+ <el-form-item >
+ <template #label>
+ 閫傜敤鐤剧梾
+ <el-tooltip
+ class="item"
+ effect="light"
+ content="閫夋嫨濂介�傜敤鐤剧梾鍚庯紝鍙互鏂逛究鎮ㄩ�氳繃鐤剧梾璇婃柇鏌ユ壘鍒板搴旂殑鐥呬汉!"
+ placement="top-start"
+ >
+ <i class="el-icon-warning-outline"></i>
+ </el-tooltip>
+ </template>
<el-tag
v-for="tag in displayedTags"
:key="tag.icdid"
@@ -168,7 +191,7 @@
></el-input> </el-form-item
></el-col>
<el-col :span="9">
- <el-form-item label="鍙敤鐘舵��" prop="region">
+ <el-form-item label="鍙敤鐘舵��" prop="isAvailable">
<el-radio-group v-model="ruleForm.isAvailable">
<el-radio
v-for="(item, index) in usable"
@@ -179,7 +202,7 @@
</el-form-item></el-col
>
</el-row>
- <el-form-item label="闂嵎鏂瑰紡" prop="region">
+ <el-form-item label="闂嵎鏂瑰紡" prop="suitway">
<el-select
v-model="ruleForm.suitway"
size="medium"
@@ -198,37 +221,56 @@
</el-select>
</el-form-item>
- <el-form-item label="閫傜敤闄㈠尯" prop="region">
- <el-select
- v-model="ruleForm.campus"
- size="medium"
- filterable
- placeholder="璇烽�夋嫨鍒嗙被"
+ <el-row>
+ <el-col :span="10"
+ ><el-form-item label="閫傜敤闄㈠尯" prop="region">
+ <el-select
+ v-model="ruleForm.campus"
+ size="medium"
+ filterable
+ placeholder="璇烽�夋嫨鍒嗙被"
+ >
+ <el-option
+ class="ruleFormaa"
+ v-for="item in courtyardlist"
+ :key="item.label"
+ :label="item.label"
+ :value="item.label"
+ >
+ </el-option>
+ </el-select> </el-form-item
+ ></el-col>
+ <el-col :span="12"
+ ><el-form-item label="閫傜敤绉戝" prop="region">
+ <el-cascader
+ style="width: 400px;"
+ v-model="tempDetpRelevanceslist"
+ :options="deptList"
+ :props="props"
+ :show-all-levels="false"
+ clearable
+ >
+ <template slot-scope="{ node, data }">
+ <span>{{ data.deptName }}</span>
+ <span v-if="!node.isLeaf">
+ ({{ data.children.length }})
+ </span>
+ </template>
+ </el-cascader>
+ </el-form-item></el-col
>
- <el-option
- class="ruleFormaa"
- v-for="item in courtyardlist"
- :key="item.label"
- :label="item.label"
- :value="item.label"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="閫傜敤绉戝" prop="region">
- <el-cascader
- v-model="tempDetpRelevanceslist"
- :options="deptList"
- :props="props"
- :show-all-levels="false"
- clearable
+ </el-row>
+ <el-form-item label="闂嵎缁撴潫璇�" prop="conclusion">
+ <el-input
+ style="width: 40vw"
+ type="textarea"
+ autosize
+ placeholder="璇疯緭鍏ュ唴瀹�"
+ v-model="ruleForm.conclusion"
>
- <template slot-scope="{ node, data }">
- <span>{{ data.deptName }}</span>
- <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
- </template>
- </el-cascader>
- </el-form-item>
+ </el-input
+ ></el-form-item>
+
<el-form-item>
<el-button type="success" @click="nextstep('ruleForm')"
>涓嬩竴姝�</el-button
@@ -242,7 +284,18 @@
</div>
<!-- 闂嵎璁剧疆 -->
<div v-if="Editprogress == 2">
- <div class="leftvlue-jbxx">闂嵎棰樼洰璁剧疆</div>
+ <div class="leftvlue-jbxx">
+ 闂嵎棰樼洰璁剧疆
+ <span style=""
+ ><el-button
+ type="warning"
+ icon="el-icon-finished"
+ round
+ @click="test"
+ >棰樼洰瑙勫垯鏁堥獙</el-button
+ ></span
+ >
+ </div>
<el-divider></el-divider>
<div style="display: flex; justify-content: space-between">
<div>
@@ -349,7 +402,15 @@
key="nextScriptno"
prop="nextScriptno"
:show-overflow-tooltip="true"
- />
+ >
+ <template slot-scope="scope">
+ <span>{{
+ scope.row.nextScriptno == 0
+ ? "宸叉槸鏈�鍚庝竴棰�"
+ : scope.row.nextScriptno
+ }}</span>
+ </template>
+ </el-table-column>
<el-table-column
v-if="Operateit"
@@ -405,7 +466,7 @@
></el-input> </el-form-item
></el-col>
<el-col :span="12">
- <el-form-item label="涓嬮璺宠浆" v-if="!topicobj.branchFlag">
+ <el-form-item label="涓嬮璺宠浆">
<el-input
v-model="topicobj.nextScriptno"
placeholder="璇疯緭鍏ラ鍙�"
@@ -433,12 +494,16 @@
</el-option> </el-select></el-form-item
></el-col>
<el-col :span="12">
- <el-form-item label="棰樼洰鍒嗘暟">
+ <el-form-item
+ label="棰樼洰鍒嗗��"
+ v-if="topicobj.scoretype == 1"
+ >
<el-input
- v-model="topicobj.scriptTopic"
- placeholder="璇疯緭鍏ユ爣棰�"
- ></el-input> </el-form-item
- ></el-col>
+ v-model="topicobj.score"
+ placeholder="璇疯緭鍏ラ鍙�"
+ ></el-input>
+ </el-form-item>
+ </el-col>
</el-row>
<el-row :gutter="10">
@@ -465,25 +530,25 @@
</el-form-item></el-col
>
</el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item
- label="棰樼洰鍒嗗��"
- v-if="topicobj.scoretype == 1"
- >
- <el-input
- v-model="topicobj.score"
- placeholder="璇疯緭鍏ラ鍙�"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-form-item label="鏄惁鐢遍�夐」閰嶇疆璺宠浆">
+ <el-form-item
+ label="鏄惁鐢遍�夐」閰嶇疆璺宠浆"
+ v-if="topicobj.scriptType == 1"
+ >
<el-radio-group v-model="topicobj.branchFlag">
<el-radio :label="1">鏄�</el-radio>
<el-radio :label="0">鍚�</el-radio>
</el-radio-group>
</el-form-item>
+ <el-form-item label="閫変腑鎻愮ず" v-if="topicobj.scriptType != 1">
+ <el-input
+ style="width: 24vw"
+ type="textarea"
+ autosize
+ placeholder="璇疯緭鍏ュ唴瀹�"
+ v-model="topicobj.prompt"
+ >
+ </el-input
+ ></el-form-item>
<div
v-if="topicobj.scriptType == 1 || topicobj.scriptType == 2"
>
@@ -506,7 +571,7 @@
<el-col :span="8">
<el-form-item
v-if="topicobj.scoretype == 1"
- label="鍒嗗��"
+ label="閫夐」鍒嗗��"
>
<el-input
class="custom-width"
@@ -539,11 +604,12 @@
</el-form-item>
</el-col>
</el-row>
- <el-row :gutter="10">
+ <el-row :gutter="10" v-if="topicobj.branchFlag == 1">
<el-col :span="20"
><el-form-item label="涓嬮璺宠浆(搴忓彿)">
<el-input
type="text"
+ @blur="branchFlagfn"
placeholder="璇疯緭鍏ラ鍙�"
v-model="item.nextQuestion"
show-word-limit
@@ -551,10 +617,10 @@
</el-input> </el-form-item
></el-col>
</el-row>
- <el-row :gutter="10">
+ <el-row :gutter="10" v-if="topicobj.scriptType == 1">
<el-form-item label="閫変腑鎻愮ず">
<el-input
- style="width: 20vw"
+ style="width: 24vw"
type="textarea"
autosize
placeholder="璇疯緭鍏ュ唴瀹�"
@@ -635,62 +701,61 @@
<div class="leftvlue-jbxx">闂嵎棰勮</div>
<el-divider></el-divider>
<div class="preview-left">
- <!-- 鍗曢�� -->
- <div
- class="scriptTopic-dev"
- v-for="item in ruleForm.svyTemplateLibScripts"
- :key="item.sort"
- v-if="item.scriptType == 1"
- >
- <div class="dev-text">
- {{ item.sort }}銆乕鍗曢�塢<span>{{ item.scriptContent }}</span>
+ <div v-for="item in ruleForm.svyTemplateLibScripts">
+ <!-- 鍗曢�� -->
+ <div
+ class="scriptTopic-dev"
+ :key="item.sort"
+ v-if="item.scriptType == 1"
+ >
+ <div class="dev-text">
+ {{ item.sort }}銆乕鍗曢�塢<span>{{ item.scriptContent }}</span>
+ </div>
+ <div class="dev-xx">
+ <el-radio-group v-model="item.remark">
+ <el-radio
+ v-for="(items, index) in item.svyLibTemplateTargetoptions"
+ :key="index"
+ :label="index"
+ >{{ items.optioncontent }}</el-radio
+ >
+ </el-radio-group>
+ </div>
</div>
- <div class="dev-xx">
- <el-radio-group v-model="item.remark">
- <el-radio
- v-for="(items, index) in item.svyLibTemplateTargetoptions"
- :key="index"
- :label="index"
- >{{ items.optioncontent }}</el-radio
- >
- </el-radio-group>
+ <!-- 澶氶�� -->
+ <div
+ class="scriptTopic-dev"
+ :key="item.sort"
+ v-if="item.scriptType == 2"
+ >
+ <div class="dev-text">
+ {{ item.sort }}銆乕澶氶�塢<span>{{ item.scriptContent }}</span>
+ </div>
+ <div class="dev-xx">
+ <el-checkbox-group v-model="qremark">
+ <el-checkbox
+ v-for="(items, index) in item.svyLibTemplateTargetoptions"
+ :key="index"
+ :label="index"
+ >
+ {{ items.optioncontent }}
+ </el-checkbox>
+ </el-checkbox-group>
+ </div>
</div>
- </div>
- <!-- 澶氶�� -->
- <div
- class="scriptTopic-dev"
- v-for="item in ruleForm.svyTemplateLibScripts"
- :key="item.sort"
- v-if="item.scriptType == 2"
- >
- <div class="dev-text">
- {{ item.sort }}銆乕澶氶�塢<span>{{ item.scriptContent }}</span>
- </div>
- <div class="dev-xx">
- <el-checkbox-group v-model="qremark">
- <el-checkbox
- v-for="(items, index) in item.svyLibTemplateTargetoptions"
- :key="index"
- :label="index"
- >
- {{ items.optioncontent }}
- </el-checkbox>
- </el-checkbox-group>
- </div>
- </div>
- <!-- 濉┖ -->
- <div
- class="scriptTopic-dev"
- v-for="item in ruleForm.svyTemplateLibScripts"
- :key="item.sort"
- v-if="item.scriptType == 3"
- >
- <div class="dev-text">
- {{ item.sort }}銆乕濉┖]<span>{{ item.scriptContent }}</span>
- </div>
- <div class="dev-xx">
- <el-input placeholder="璇疯緭鍏ョ瓟妗�" v-model="radioas" clearable>
- </el-input>
+ <!-- 濉┖ -->
+ <div
+ class="scriptTopic-dev"
+ :key="item.sort"
+ v-if="item.scriptType == 4"
+ >
+ <div class="dev-text">
+ {{ item.sort }}銆乕濉┖]<span>{{ item.scriptContent }}</span>
+ </div>
+ <div class="dev-xx">
+ <el-input placeholder="璇疯緭鍏ョ瓟妗�" v-model="radioas" clearable>
+ </el-input>
+ </div>
</div>
</div>
</div>
@@ -1056,7 +1121,7 @@
</el-radio-group>
</el-form-item>
</el-row>
- <el-row :gutter="10">
+ <el-row :gutter="10" v-if="item.scriptType == 1">
<el-form-item label="閫変腑鎻愮ず">
<el-input
style="width: 400px"
@@ -1136,7 +1201,7 @@
import { getToken } from "@/utils/auth";
export default {
- name: "Qcompilequer",
+ name: "Questionnaireinfo",
components: { OptionalForm },
@@ -1166,11 +1231,42 @@
svyTemplateLibScripts: [],
tempDetpRelevances: [],
svyLibTemplateTagList: [],
+ scoreType:'4',
+ isAvailable:'0'
},
indexform: {
svyLibTemplateTargetoptions: [],
},
- rules: {},
+ // 琛ㄥ崟鏍¢獙
+ rules: {
+ categoryid: [
+ { required: true, message: "闂嵎鍒嗙被涓嶈兘涓虹┖", trigger: "blur" },
+ ],
+ scoreType: [
+ { required: true, message: "璇勪环绫诲瀷涓嶈兘涓虹┖", trigger: "blur" },
+ ],
+ svyname: [
+ { required: true, message: "闂嵎鏍囬涓嶈兘涓虹┖", trigger: "blur" },
+ ],
+ isAvailable: [
+ { required: true, message: "鍙敤鐘舵�佷笉鑳戒负绌�", trigger: "blur" },
+ ],
+ scriptTopic: [
+ { required: true, message: "棰樼洰鏍囬涓嶈兘涓虹┖", trigger: "blur" },
+ ],
+ ismandatory: [
+ { required: true, message: "鏄惁蹇呭~涓嶈兘涓虹┖", trigger: "blur" },
+ ],
+ scriptType: [
+ { required: true, message: "棰樼洰绫诲瀷涓嶈兘涓虹┖", trigger: "blur" },
+ ],
+ suitway: [
+ { required: true, message: "闂嵎鏂瑰紡涓嶈兘涓虹┖", trigger: "blur" },
+ ],
+ conclusion: [
+ { required: true, message: "闂嵎缁撴潫璇笉鑳戒负绌�", trigger: "blur" },
+ ],
+ },
rulesa: {},
optionsclass: [], //鍒嗙被鍒楄〃
optionlist: [
@@ -1263,10 +1359,29 @@
],
};
},
+ activated() {
+ console.log(this.id);
+ if (this.id != this.$route.query.id) {
+ this.getissueinfo();
+ this.gettabList();
+ } else {
+ this.ruleForm.svyTemplateLibScripts =
+ this.ruleForm.svyTemplateLibScripts.filter(
+ (item) => item.isoperation != 3
+ );
+ this.ruleForm.svyLibTemplateTagList =
+ this.ruleForm.svyLibTemplateTagList.filter(
+ (item) => item.isoperation != 3
+ );
+ this.delScriptVOList = [];
+ this.$forceUpdate();
+ console.log(this.ruleForm.svyTemplateLibScripts);
+ }
+ },
created() {
- this.gettabList();
this.getissueinfo();
+ this.gettabList();
this.mode = store.getters.Askmode;
this.languagelist = store.getters.languagelist;
this.usable = store.getters.usable;
@@ -1319,6 +1434,15 @@
// 鑾峰彇鏁版嵁
getissueinfo() {
this.id = this.$route.query.id;
+ this.ruleForm= {
+ svyTemplateLibScripts: [],
+ tempDetpRelevances: [],
+ svyLibTemplateTagList: [],
+ scoreType:'4',
+ isAvailable:'0'
+ },
+ this.topicobj = {};
+
if (this.id) {
getQtemplateobj({ svyid: this.id }).then((res) => {
this.ruleForm = res.rows[0];
@@ -1347,9 +1471,13 @@
});
},
submitForm(formName) {
- this.$modal.loading("姝e湪涓婁紶鏁版嵁锛岃绋嶅��...");
- this.ruleForm.suitway = this.ruleForm.suitway.join(",");
-
+ this.$modal.loading("姝e湪淇淇濆瓨鏁版嵁锛岃绋嶅��...");
+ if (Array.isArray(this.ruleForm.suitway)) {
+ this.ruleForm.suitway = this.ruleForm.suitway.join(",");
+ }
+ if (!this.ruleForm.categoryid) {
+ this.ruleForm.categoryid = -1;
+ }
if (this.id) {
this.ruleForm.isoperation = 2;
compileQtemplate(this.ruleForm).then((res) => {
@@ -1445,7 +1573,6 @@
// 鏂板棰樼洰
addtopic(row) {
row.isoperation = 1;
- console.log(row, "row");
row.svyLibScriptOptions.forEach((item) => {
item.isoperation = 1;
});
@@ -1464,7 +1591,6 @@
handleUpdate(row) {
this.topicobj = row;
this.radioas = "";
- console.log(this.topicobj, "鐪嬫暟鎹�");
// getissuelist({ svyid: row.svyid }).then((res) => {
// });
},
@@ -1487,13 +1613,10 @@
this.sortFn();
},
sortFn() {
- console.log(this.ruleForm.svyTemplateLibScripts, "搴忓墠鍊�");
this.ruleForm.svyTemplateLibScripts.forEach((item, index) => {
item.sort = Number(index) + 1;
- console.log(this.ruleForm.svyTemplateLibScripts.length, "length");
-
if (item.sort == this.ruleForm.svyTemplateLibScripts.length) {
- item.nextScriptno = "宸叉槸鏈�鍚庝竴棰�";
+ item.nextScriptno = 0;
} else {
item.nextScriptno = item.sort + 1;
}
@@ -1522,7 +1645,7 @@
this.drawer = false;
this.sortFn();
- this.$modal.msgSuccess("棰樼洰鏂板鎴愬姛锛屼繚瀛樻ā鐗堝け鏁�");
+ this.$modal.msgSuccess("棰樼洰鏂板鎴愬姛锛屼繚瀛樻ā鏉垮け鏁�");
});
},
// 鏂板鍙橀噺
@@ -1626,14 +1749,12 @@
this.illnessVisible = false;
this.$modal.msgSuccess("缂栬緫鎴愬姛");
},
- // --------------------------
resetQuery() {
this.queryParams = { pageNum: 1, pageSize: 10 };
this.getaddtopiclist();
},
- resetForm(formName) {
- this.$refs[formName].resetFields();
- },
+
+ // --------------------------
// 闂嵎鍒嗘暟闄愬埗绠楁硶
// 娣峰悎璺嚎
generateCombinations(arrays, currentIndex = 0, currentCombination = []) {
@@ -1657,16 +1778,13 @@
},
// 鎵ц
test() {
- const arrays = [
- ["2", "3", "4", "5"],
- ["1", "2", "5", "6"],
- ["3", "4", "5", "3"],
- ["3", "2", "5", "7"],
- ];
+ console.log(this.ruleForm.svyTemplateLibScripts);
+
const arraysa = [
{
id: 1,
- grade: "5",
+ Topicjump: "2",
+ branchFlag: "0",
arr: [
{ name: "涓嶉敊", skip: 2 },
{ name: "涓�鑸�", skip: 2 },
@@ -1677,86 +1795,220 @@
{
id: 2,
- grade: "5",
+ Topicjump: "4",
+ branchFlag: "1",
arr: [
- { name: "浼樼", skip: 3 },
+ { name: "浼樼", skip: 4 },
{ name: "鑹ソ", skip: 3 },
{ name: "涓�鑸�", skip: 3 },
- { name: "杈冨樊", skip: 4 },
+ { name: "杈冨樊", skip: 3 },
],
},
{
id: 3,
- grade: "5",
+ Topicjump: "4",
+ branchFlag: "1",
arr: [
{ name: "鏄殑", skip: 4 },
- { name: "涓嶆竻妤�", skip: 4 },
+ { name: "涓嶆竻妤�", skip: 5 },
{ name: "杩樺彲", skip: 4 },
{ name: "涓�鑸�", skip: 4 },
],
},
{
id: 4,
- grade: "5",
+ Topicjump: "5",
+ branchFlag: "0",
+ bac: null,
+ },
+ {
+ id: 5,
+ Topicjump: "0",
+ branchFlag: "0",
arr: [
- { name: "鐪熶笉閿�", skip: null },
- { name: "杩樺彲浠�", skip: null },
- { name: "涓�鑸埇", skip: null },
- { name: "涓嶆竻妤�", skip: null },
+ { name: "鐪熶笉閿�", skip: 0 },
+ { name: "杩樺彲浠�", skip: 0 },
+ { name: "涓�鑸埇", skip: 0 },
+ { name: "涓嶆竻妤�", skip: 0 },
],
},
];
- // const newMixArray = this.generateCombinations(arrays);
- const newMixArray = this.getExecutionOrders(arraysa);
-
+ const csnewMixArray = this.csgetExecutionOrders(arraysa);
+ console.log(csnewMixArray, "娴嬭瘯鍏ㄩ儴璺嚎");
+ const newMixArray = this.getExecutionOrders(
+ this.ruleForm.svyTemplateLibScripts
+ );
console.log(newMixArray, "鍏ㄩ儴璺嚎");
- this.screen(newMixArray);
+ this.sumArray(newMixArray);
},
- getExecutionOrders(data) {
- let orders = [];
+ // 閬嶅巻鏂规硶
+ csgetExecutionOrders(arrays) {
+ const allPaths = [];
+ const findPath = (currentId, path) => {
+ const current = arrays.find((item) => item.id.toString() === currentId);
+ if (!current) return;
+ path.push(current);
- const explore = (currentOrder, id) => {
- console.log(currentOrder, "currentOrder", id);
- const currentQuestion = data[currentOrder[currentOrder.length - 1]];
- if (
- currentQuestion.arr.some(
- (option) =>
- option.skip !== null && !currentOrder.includes(option.skip)
- )
- ) {
- currentQuestion.arr.forEach((option) => {
- if (option.skip !== null && !currentOrder.includes(option.skip)) {
- explore([...currentOrder, option.skip]);
- }
+ if (current.branchFlag === "1") {
+ current.arr.forEach((option) => {
+ findPath(option.skip.toString(), path.slice());
});
} else {
- orders.push(
- currentOrder.map((id) => ({
- id: data[id].id,
- grade: data[id].grade,
- }))
- );
+ const nextId = parseInt(current.Topicjump);
+ if (nextId !== 0) {
+ findPath(nextId.toString(), path.slice());
+ } else {
+ allPaths.push(path.slice());
+ }
}
};
- console.log(data, "data");
- data.forEach((entry) => {
- explore([entry.id], entry.id);
- });
- return orders;
+ findPath("1", []);
+ return allPaths;
+ },
+ // 閬嶅巻鏂规硶
+ getExecutionOrders(arrays) {
+ const allPaths = [];
+ const findPath = (currentId, path) => {
+ const current = arrays.find(
+ (item) => item.sort.toString() === currentId
+ );
+ if (!current) return;
+ path.push(current);
+
+ if (current.branchFlag == "1") {
+ current.svyLibTemplateTargetoptions.forEach((option) => {
+ findPath(option.nextQuestion.toString(), path.slice());
+ });
+ } else {
+ const nextId = parseInt(current.nextScriptno);
+ if (nextId !== 0) {
+ findPath(nextId.toString(), path.slice());
+ } else {
+ allPaths.push(path.slice());
+ }
+ }
+ };
+
+ findPath("1", []);
+ return allPaths;
},
// 鏁扮粍姹傚拰
sumArray(arr) {
- return arr.reduce((acc, curr) => acc + parseInt(curr), 0);
- },
- // 绛涢�夐敊璇矾绾�
- screen(data) {
- const arraysGreaterThan10 = data.filter((arr) => this.sumArray(arr) > 21);
+ // const arrsum = arr;
+ // arrsum.forEach((item) => {
+ // // 鍒ゆ柇棰樼洰鍜屾ā鏉垮眰绾�
+ // console.log(item, "涓�鏉¢摼璺�");
- console.log(arraysGreaterThan10, "绛涢�夐敊璇矾绾垮ぇ浜�13鍒�");
+ // const totalScore = item.reduce((accumulator, current) => {
+ // return accumulator + Number(current.score);
+ // }, 0);
+ // console.log(totalScore);
+ // console.log(this.ruleForm.scriptScore);
+
+ // if (totalScore == this.ruleForm.scriptScore) {
+ // this.ClaimNofn(arr);
+ // this.$modal.msgSuccess("鍒嗘暟鏍搁獙鎴愬姛");
+ // }
+ // });
+
+ const allGreaterThanTen = arr.every((array) => {
+ const totalScore = array.reduce((accumulator, current) => {
+ return accumulator + Number(current.score);
+ }, 0);
+ console.log(totalScore);
+ console.log(this.ruleForm.scriptScore);
+
+ return totalScore == this.ruleForm.scriptScore;
+ });
+ if (allGreaterThanTen) {
+ this.$modal.msgSuccess("鍒嗗�兼牎楠屾垚鍔�");
+ } else {
+ this.$modal.msgError("棰樼洰鍒嗗�肩疮鍔犲拰妯℃澘鍒嗗�间笉绗�");
+ }
},
+
+ // 閬嶅巻鏄惁閲嶅鏄惁閮界敤涓�
+ ClaimNofn(arr) {
+ arr.forEach((item) => {
+ const Aarr = item;
+ const Barr = this.ruleForm.svyTemplateLibScripts;
+ const notInB = A.filter(
+ (itemA) => !B.some((itemB) => itemB.id === itemA.id)
+ );
+
+ if (notInB.length) {
+ this.$modal.msgError("棰樼洰鏈叏閮ㄤ娇鐢�");
+ } else {
+ this.$modal.msgSuccess("棰樼洰鍏ㄩ儴浣跨敤");
+ }
+ });
+ arr.forEach((item) => {
+ const idCount = arr.reduce((acc, item) => {
+ acc[item.id] = (acc[item.id] || 0) + 1;
+ return acc;
+ }, {});
+ const whether = item.values(idCount).some((count) => count > 1); // 濡傛灉鏈変换浣� id 鐨勮鏁板ぇ浜� 1 灏辫繑鍥� true
+ if (!whether) this.$modal.msgError("閰嶇疆椤规湁棰樼洰閲嶅");
+ });
+ },
+ // 棰樼洰鍜岄�夐」闂寸殑鍒嗗�煎垽鏂�
+ Scorejudgment() {
+ let scorearr = this.topicobj.svyLibScriptOptions;
+ let isValid = scorearr.every((score, index) => {
+ if (this.topicobj.scriptType == 1) {
+ if (score.score) {
+ if (
+ Number(score.score) < 0 ||
+ Number(score.score) > Number(this.topicobj.score)
+ ) {
+ console.log(score, "閿欒鍒嗗��");
+ this.$message({
+ message: "閫夐」鍒嗗�煎繀椤诲湪0鍒�" + this.topicobj.score + "鍒嗕箣闂�",
+ type: "warning",
+ });
+ return false;
+ }
+ return true;
+ } else {
+ this.$message({
+ message: "閫夐」鍒嗗�兼湭璁剧疆",
+ type: "warning",
+ });
+ return false;
+ }
+ } else if (this.topicobj.scriptType == 2) {
+ // 绱姞鍒嗗��
+ const totalScore = scorearr.reduce((acc, score) => {
+ if (score.score) {
+ return acc + Number(score.score);
+ }
+ return acc; // 濡傛灉 score.score 涓嶅瓨鍦紝涓嶇疮鍔�
+ }, 0);
+
+ // 妫�鏌ョ疮鍔犵殑鍒嗗�兼槸鍚︾瓑浜� this.topicobj.score
+ if (totalScore !== Number(this.topicobj.score)) {
+ this.$message({
+ message:
+ "澶氶�夐閫夐」鍒嗗�兼�诲拰蹇呴』绛変簬 " + this.topicobj.score + " 鍒�",
+ type: "warning",
+ });
+ return false;
+ }
+ return true; // 濡傛灉鎬诲垎姝g‘锛岃繑鍥� true
+ } else if (this.topicobj.scriptType == 4) {
+ return true;
+ }
+ });
+
+ if (isValid) {
+ this.compileissue();
+ }
+ },
+
+ // ---------------------------------------------------------
// 鏂伴棶棰樻柊澧�
addoption() {
if (!this.indexform.svyLibTemplateTargetoptions) {
@@ -1783,6 +2035,13 @@
this.$forceUpdate();
} else {
this.$message.error("鍥剧墖鎻掑叆澶辫触");
+ }
+ },
+ branchFlagfn(row) {
+ console.log(row);
+ if (this.topicobj.branchFlag == 1 && this.topicobj.nextScriptno != 0) {
+ this.topicobj.nextScriptno =
+ this.topicobj.svyLibTemplateTargetoptions[0].nextQuestion;
}
},
},
@@ -1818,6 +2077,8 @@
font-size: 20px;
}
.leftvlue-jbxx {
+ display: flex; /* 浣跨敤 Flexbox 甯冨眬 */
+ justify-content: space-between;
font-size: 24px;
border-left: 5px solid #41a1be;
padding-left: 5px;
--
Gitblit v1.9.3