From ad70f145e8bea957b41043b4a1e37ce37cc5ed1e Mon Sep 17 00:00:00 2001 From: WXL <1785969728@qq.com> Date: 星期二, 16 一月 2024 18:39:24 +0800 Subject: [PATCH] 指标完成 --- src/views/knowledge/questionnaire/compilequer/index.vue | 94 +++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 78 insertions(+), 16 deletions(-) diff --git a/src/views/knowledge/questionnaire/compilequer/index.vue b/src/views/knowledge/questionnaire/compilequer/index.vue index d01a149..6a25a21 100644 --- a/src/views/knowledge/questionnaire/compilequer/index.vue +++ b/src/views/knowledge/questionnaire/compilequer/index.vue @@ -33,14 +33,19 @@ filterable placeholder="璇烽�夋嫨鍒嗙被" > - <el-option - class="ruleFormaa" - v-for="item in optionsclass" - :key="item.id" - :label="item.name" - :value="item.id" + <el-option-group + v-for="group in optionsclass" + :key="group.id" + :label="group.name" > - </el-option> + <el-option + v-for="item in group.svyLibTitleCategoryList" + :key="item.id" + :label="item.name" + :value="item.id" + > + </el-option> + </el-option-group> </el-select> </el-form-item> <el-form-item label="闂嵎鏍囬" prop="name"> @@ -265,8 +270,8 @@ <el-table-column label="搴忓彿" align="center" - key="topicid" - prop="topicid" + key="guid" + prop="guid" /> <el-table-column label="棰樼洰" @@ -286,22 +291,33 @@ <el-table-column label="鎿嶄綔" align="center" - width="200" + width="250" class-name="small-padding fixed-width" > <template slot-scope="scope"> <el-button icon="el-icon-edit" type="primary" - round + circle @click="handleUpdate(scope.row)" - >淇敼</el-button - > + ></el-button> <el-button type="danger" icon="el-icon-delete" circle @click="handleDelete(scope.row)" + ></el-button> + <el-button + @click="syioption(scope.row)" + type="success" + icon="el-icon-top" + circle + ></el-button> + <el-button + @click="xiayioption(scope.row)" + type="success" + icon="el-icon-bottom" + circle ></el-button> </template> </el-table-column> @@ -585,6 +601,7 @@ compileissue, delQtemplateinfo, Followupinfo, + issueinfo, getissuelist, deltargetillness, addtargetillness, @@ -597,7 +614,7 @@ data() { return { sidecolumnrabs: "left", //鏂瑰悜 - Editprogress: 2, //缂栬緫杩涘害 + Editprogress: 1, //缂栬緫杩涘害 currentVersion: "1.2.3", //褰撳墠鐗堟湰 loading: false, // 閬僵灞� drawer: false, //鎺у埗灞曞紑 @@ -687,9 +704,25 @@ }, methods: { + // 鍏叡鏂规硶--------------- getIndexInArray(arr, obj) { return arr.indexOf(obj); }, + // 閫掑綊鎵佸钩鍖� + flattenArray(arr) { + let result = []; + arr.forEach((item) => { + result.push(item); + if (item.svyLibTitleCategoryList) { + result = result.concat( + this.flattenArray(item.svyLibTitleCategoryList) + ); + delete item.svyLibTitleCategoryList; + } + }); + return result; + }, + // ----------------------------- // 鑾峰彇鏁版嵁 getissueinfo() { this.id = this.$route.query.id; @@ -712,7 +745,9 @@ listDept(this.queryParams).then((response) => { this.deptList = this.handleTree(response.data, "deptId"); }); + // 鍒嗙被 getQtemplateclassify({}).then((res) => { + // this.optionsclass = this.flattenArray(res.rows); this.optionsclass = res.rows; }); }, @@ -817,10 +852,37 @@ this.ruleForm.svyLibTopics.indexOf(row), 1 ); + this.sortFn(); }, handleUpdate(row) { - console.log(row); - this.topicobj = row; + getissuelist({ svyid: row.svyid }).then((res) => { + this.topicobj = res.rows[0]; + }); + }, + syioption(row) { + const index = this.getIndexInArray(this.ruleForm.svyLibTopics, row); + const item = this.ruleForm.svyLibTopics.splice(index, 1)[0]; // 绉婚櫎鎸囧畾绱㈠紩澶勭殑鍏冪礌锛屽苟淇濆瓨鍒癷tem鍙橀噺涓� + this.ruleForm.svyLibTopics.splice(index - 1, 0, item); // 灏唅tem鎻掑叆鍒扮储寮曚綅缃殑鍓嶄竴浣� + this.sortFn(); + }, + xiayioption(row) { + const index = this.getIndexInArray(this.ruleForm.svyLibTopics, row); + const item = this.ruleForm.svyLibTopics.splice(index, 1)[0]; // 绉婚櫎鎸囧畾绱㈠紩澶勭殑鍏冪礌锛屽苟淇濆瓨鍒癷tem鍙橀噺涓� + this.ruleForm.svyLibTopics.splice(index + 1, 0, item); // 灏唅tem鎻掑叆鍒扮储寮曚綅缃殑鍓嶄竴浣� + this.sortFn(); + }, + sortFn() { + this.ruleForm.svyLibTopics = this.ruleForm.svyLibTopics.map( + (item, index) => { + return { + guid: index + 1, + svyid: item.svyid, + topic: item.topic, + topicContent: item.topicContent, + }; + } + ); + console.log(this.ruleForm.svyLibTopics); }, // 淇敼棰樼洰淇℃伅 -- Gitblit v1.9.3