From 83efa8f1ebd3ad80dfb5078a10caf9fcc4499dc8 Mon Sep 17 00:00:00 2001 From: shikeying <pxzsky@163.com> Date: 星期一, 08 五月 2023 14:09:50 +0800 Subject: [PATCH] 题库测试页面,涉及组件树 --- src/views/etaa/question_bank/index.vue | 649 +++++++++---------- src/views/etaa/paper/index.vue | 254 +++++++ src/api/etaa/question_bank.js | 57 - src/views/etaa/question_bank/add.vue | 151 ++++ src/views/etaa/question_bank/index_old.vue | 459 ++++++++++++++ src/views/etaa/paper/add.vue | 277 ++++++++ src/views/components/myTableV3.vue | 2 src/api/etaa/paper.js | 19 8 files changed, 1,492 insertions(+), 376 deletions(-) diff --git a/src/api/etaa/paper.js b/src/api/etaa/paper.js new file mode 100644 index 0000000..203a21c --- /dev/null +++ b/src/api/etaa/paper.js @@ -0,0 +1,19 @@ + +// 鏂板 +import request from "@/utils/request"; + +export function add(data) { + return request({ + url: '/etaa/paper/add', + method: 'post', + data: data + }) +} + +// 鍒犻櫎璇曞嵎銆�2023-05-07 +export function deletePaper(id) { + return request({ + url: '/etaa/paper/remove/' + id, + method: 'get' + }) +} diff --git a/src/api/etaa/question_bank.js b/src/api/etaa/question_bank.js index 697d4a2..a8b445a 100644 --- a/src/api/etaa/question_bank.js +++ b/src/api/etaa/question_bank.js @@ -24,14 +24,14 @@ method: 'get' }) } -// -// // 鏌ヨ閮ㄩ棬璇︾粏 -// export function getDept(deptId) { -// return request({ -// url: '/system/dept/view/' + deptId, -// method: 'get' -// }) -// } + +// 鏌ヨ娣诲姞璇曢锛岄�夋嫨鐨勫垎绫讳俊鎭��2023-05-02 +export function getCatalogInfo(catalogId) { + return request({ + url: '/etaa/question_bank/select/catalogInfo/' + catalogId, + method: 'get' + }) +} // // // 鏌ヨ閮ㄩ棬涓嬫媺鏍戠粨鏋� // export function treeselect(deptId) { @@ -42,23 +42,22 @@ // }) // } // -// // 鏍规嵁瑙掕壊ID鏌ヨ閮ㄩ棬鏍戠粨鏋� -// export function roleDeptTreeselect(roleId) { -// return request({ -// url: '/system/dept/roleDeptTreeselect/' + roleId, -// method: 'get' -// }) -// } -// -// // 鏂板閮ㄩ棬 -// export function addDept(data) { -// return request({ -// url: '/system/dept/add', -// method: 'post', -// data: data -// }) -// } -// + +// 鏂板 +export function add(data) { + return request({ + url: '/etaa/question_bank/add', + method: 'post', + data: data + }) +} +// 娓呯┖棰樺簱锛屾祴璇曠敤 +export function clear() { + return request({ + url: '/etaa/question_bank/clear', + method: 'get' + }) +} // // 淇敼閮ㄩ棬 // export function updateDept(data) { // return request({ @@ -68,10 +67,4 @@ // }) // } // -// // 鍒犻櫎閮ㄩ棬 -// export function delDept(deptId) { -// return request({ -// url: '/system/dept/remove/' + deptId, -// method: 'get' -// }) -// } + diff --git a/src/views/components/myTableV3.vue b/src/views/components/myTableV3.vue index 6c38590..e695559 100644 --- a/src/views/components/myTableV3.vue +++ b/src/views/components/myTableV3.vue @@ -326,8 +326,6 @@ return function(row) { const arr = [] that.myTable.operation.attr.map(item => { - console.log(item) - console.log(!(item.hidden && item.hidden(row)) && item.checkPermission) if (!(item.hidden && item.hidden(row)) && item.checkPermission) { arr.push(item) } diff --git a/src/views/etaa/paper/add.vue b/src/views/etaa/paper/add.vue new file mode 100644 index 0000000..cdb72f0 --- /dev/null +++ b/src/views/etaa/paper/add.vue @@ -0,0 +1,277 @@ +<template> + <win :title="setting.title" width="1024px" @close="close"> + <el-form ref="form" :model="form" :rules="rules" label-width="120px" class="demo-ruleForm" label-position="right"> +<!-- <el-form-item label="棰樺簱澶х被" prop="rootCatalog">--> +<!-- <el-select v-model="form.rootCatalog" placeholder="棰樺簱澶х被">--> +<!-- <el-option :value="form.rootCatalog" :label="form.rootCatalogName" :key="form.rootCatalog"/>--> +<!-- </el-select>--> +<!-- </el-form-item>--> + <el-form-item label="棰樺簱澶х被" prop="rootCatalog"> + <el-select v-model="form.rootCatalog" placeholder="棰樺簱澶х被"> + <el-option + v-for="dict in dict.type.question_root_catalog" + :key="dict.value" + :label="dict.label" + :value="dict.value" + /> + </el-select> + </el-form-item> + <el-form-item label="浜岀骇鍒嗙被" prop="majorCatalog"> + <el-select v-model="form.majorCatalog" placeholder="浜岀骇鍒嗙被"> + <el-option :value="form.majorCatalog" :label="form.majorCatalogName"/> + </el-select> + </el-form-item> + <el-form-item label="璇曞嵎鍚嶇О" prop="name"> + <el-input v-model="form.name" placeholder="" /> + </el-form-item> + <el-form-item label="缁勫嵎绛栫暐" prop="paperPolicy"> + <el-radio-group v-model="form.paperPolicy" size="small" @input="onPaperPolicyChanged"> + <el-radio-button label="random">瀹屽叏闅忔満</el-radio-button> + <el-radio-button label="assign_type">鎸囧畾绫诲瀷</el-radio-button> + <el-radio-button label="manual">鎵嬪姩閫夋嫨</el-radio-button> + </el-radio-group> + </el-form-item> + <el-form-item label="鎸囧畾绫诲瀷" v-show="showPaperPolicyAssign"> + <el-row :gutter="20"> + <el-col :span="6"> + <el-form-item label="鍗曢�夋暟閲�"> + <el-input-number v-model="paperPolicyContent.selectSingleCount" :min="0" :max="200" size="small"></el-input-number> + </el-form-item> + </el-col> + <el-col :span="6"> + <el-form-item label="鍗曢�夋�诲垎"> + <el-input-number v-model="paperPolicyContent.selectSingleScore" :min="0" :max="200" size="small"></el-input-number> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="20"> + <el-col :span="6"> + <el-form-item label="澶氶�夋暟閲�"> + <el-input-number v-model="paperPolicyContent.selectMultipleCount" :min="0" :max="200" size="small"></el-input-number> + </el-form-item> + </el-col> + <el-col :span="6"> + <el-form-item label="澶氶�夋�诲垎"> + <el-input-number v-model="paperPolicyContent.selectMultipleScore" :min="0" :max="200" size="small"></el-input-number> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="20"> + <el-col :span="6"> + <el-form-item label="鍒ゆ柇鏁伴噺"> + <el-input-number v-model="paperPolicyContent.trueOrFalseCount" :min="0" :max="200" size="small"></el-input-number> + </el-form-item> + </el-col> + <el-col :span="6"> + <el-form-item label="鍒ゆ柇鎬诲垎"> + <el-input-number v-model="paperPolicyContent.trueOrFalseScore" :min="0" :max="200" size="small"></el-input-number> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="20"> + <el-col :span="6"> + <el-form-item label="濉┖鏁伴噺"> + <el-input-number v-model="paperPolicyContent.completionCount" :min="0" :max="200" size="small"></el-input-number> + </el-form-item> + </el-col> + <el-col :span="6"> + <el-form-item label="濉┖鎬诲垎"> + <el-input-number v-model="paperPolicyContent.completionScore" :min="0" :max="200" size="small"></el-input-number> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="20"> + <el-col :span="6"> + <el-form-item label="绠�绛旀暟閲�"> + <el-input-number v-model="paperPolicyContent.shortAnswerCount" :min="0" :max="200" size="small"></el-input-number> + </el-form-item> + </el-col> + <el-col :span="6"> + <el-form-item label="绠�绛旀�诲垎"> + <el-input-number v-model="paperPolicyContent.shortAnswerScore" :min="0" :max="200" size="small"></el-input-number> + </el-form-item> + </el-col> + </el-row> + </el-form-item> + <el-form-item label="鎵嬪姩閫夋嫨" v-show="showPaperPolicyManual"> + + </el-form-item> + <el-form-item label="璇曢鏁伴噺" prop="questionCount"> + <el-input-number v-model="form.questionCount" :min="2" :max="200" label="鎶藉彇璇曢鎬绘暟"></el-input-number> + </el-form-item> + <el-form-item label="鍗烽潰鎬诲垎" prop="scoreTotal"> + <el-input-number v-model="form.scoreTotal" :min="1" :max="500" label="璇曢鎬诲垎"></el-input-number> + </el-form-item> + <el-form-item label="璇曢闅惧害" prop="difficultLevel"> + <el-radio-group v-model="form.difficultLevel" size="small"> + <el-radio-button label="1">鏈�绠�鍗�</el-radio-button> + <el-radio-button label="2">绠�鍗�</el-radio-button> + <el-radio-button label="3">涓瓑</el-radio-button> + <el-radio-button label="4">杈冮毦</el-radio-button> + <el-radio-button label="5">鏈�闅�</el-radio-button> + </el-radio-group> + </el-form-item> + <el-form-item label="璇曞嵎鐘舵��" prop="dataStatus"> + <el-radio-group v-model="form.dataStatus" size="small"> + <el-radio-button label="0">姝e父</el-radio-button> + <el-radio-button label="1">绂佺敤</el-radio-button> + <el-radio-button label="2" disabled>宸插垹闄�</el-radio-button> + </el-radio-group> + </el-form-item> + <el-form-item label="澶囨敞" prop="summary"> + <el-input type="textarea" :rows="3" v-model="form.summary" placeholder="" /> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <my-button-v2 name="鍏抽棴" site="form" @click="close" /> + <my-button-v2 name="淇濆瓨" site="form" @click="save" /> + </div> + </win> +</template> + +<script> + import win from '@/views/components/win' + import myButtonV2 from '@/views/components/myButtonV2' + import {add} from "@/api/etaa/paper"; + + export default { + name: "", + components: { win, myButtonV2 }, + dicts: ['question_root_catalog'], + props: { + // setting 涓』鑷冲皯鍖呭惈鎺у埗dialog鏄剧ず鎴栭殣钘忕殑灞炴��,鍏朵綑灞炴�у彲鎷撳睍 + // 灏嗘坊鍔�/淇敼鐨勫ぇ閲忔暟鎹強閫昏緫浠庡垪琛ㄩ〉闈腑鍒嗙鍑烘潵,閬垮厤鍒楄〃椤甸潰浠g爜杩囧,瀹℃煡鍥伴毦 + // 鑻ユ椤甸潰椤诲洖浼犳暟鎹嚦鐖堕〉闈�,鍙湪寮曠敤缁勪欢鏃舵坊鍔犱簨浠�,鏈〉闈娇鐢╰his.$emit('浜嬩欢鍚�',鍙傛暟1,鍙傛暟2...)鍥炰紶鏁版嵁 + setting: { + type: Object, + default: () => { + } + } + }, + + data(){ + return { + // 鏄剧ず鎶藉彇绛栫暐鐨勫尯鍩� + showPaperPolicyAssign: false, + showPaperPolicyManual: false, + + // 鎸囧畾绫诲瀷绛栫暐鏃讹紝姣忕璇曢棰橀噺鍜屾�诲垎 + paperPolicyContent: { + selectSingleCount: 0, + selectMultipleCount: 0, + trueOrFalseCount: 0, + completionCount: 0, + shortAnswerCount: 0, + selectSingleScore: 0, + selectMultipleScore: 0, + trueOrFalseScore: 0, + completionScore: 0, + shortAnswerScore: 0, + }, + + form: { + id: null, + name: null, + orgId: this.setting.orgId, + rootCatalog: this.setting.rootCatalog, + majorCatalog: 0, // 鏆傛椂娌℃湁瀹炵幇閫夋嫨浜岀骇鍒嗙被鏍戯紝瑕佸姞涓婏紝2023-05-06 + paperPolicy: 'random', + policyContent: null, + questionCount: 10, + difficultLevel: 3, + scoreTotal: 0, + scorePolicy: null, + dataStatus: 0, + summary: null + }, + + rules: { + name: [ + { required: true, message: "璇疯緭鍏ヨ瘯鍗峰悕绉�", trigger: "blur" } + ], + rootCatalog: [ + { required: true, message: "閫夋嫨棰樺簱澶х被", trigger: "blur" } + ], + paperPolicy: [ + { required: true, message: "閫夋嫨缁勫嵎绛栫暐", trigger: "blur" } + ], + questionCount: [ + { required: true, message: "杈撳叆鎶藉彇璇曢鎬绘暟", trigger: "blur" } + ] + }, + } + }, + + created() { + + }, + + methods: { + close() { + this.$emit('close') + }, + + save(){ + this.$refs.form.validate(validate => { + if(validate){ + if(this.form.paperPolicy == 'assign_type'){ + // 妫�鏌ユ寚瀹氱殑璇曢绫诲瀷鎶藉彇鍙傛暟鏄惁瀹屾暣 + if(this.paperPolicyContent.selectSingleCount == 0 + && this.paperPolicyContent.selectMultipleCount == 0 + && this.paperPolicyContent.trueOrFalseCount == 0 + && this.paperPolicyContent.completionCount == 0 + && this.paperPolicyContent.shortAnswerCount == 0){ + this.$message.error('鎸囧畾绫诲瀷绛栫暐锛岄渶瑕佸綍鍏ユ瘡涓鍨嬫暟閲忋�佸垎鍊硷紝涓嶈兘鍏ㄩ儴涓虹┖!'); + return; + } + let scoreTotal = this.paperPolicyContent.selectSingleScore + + this.paperPolicyContent.selectMultipleScore + + this.paperPolicyContent.trueOrFalseScore + + this.paperPolicyContent.completionScore + + this.paperPolicyContent.shortAnswerScore; + if(scoreTotal != this.form.scoreTotal){ + this.$message.error('鎸囧畾绫诲瀷绛栫暐锛屽垎椤瑰垎鍊兼�诲拰涓庢�诲垎涓嶄竴鑷�!'); + return; + } + + // 鎶婇�夋嫨鐨勫悇椤归鍨嬩俊鎭暟鎹粍瑁呰捣鏉� + this.form.policyContent = JSON.stringify(this.paperPolicyContent); + } + + if(this.form.questionCount == 0){ + this.$message.error('璇曢鎬绘暟蹇呴』澶т簬0'); + return; + } + + add(this.form).then(response => { + // this.$modal.msgSuccess("淇敼鎴愬姛"); + // this.open = false; + // this.getList(); + this.$message.success('淇濆瓨鎴愬姛锛�') + this.$emit('search') + this.close() + }); + } + }); + }, + + onPaperPolicyChanged(val){ + console.log("閫変腑浜嗭細" + val); + if(val == 'assign_type'){ + this.showPaperPolicyAssign = true; + this.showPaperPolicyManual = false; + } else if(val == 'manual'){ + this.showPaperPolicyAssign = false; + this.showPaperPolicyManual = true; + } else { + this.showPaperPolicyAssign = false; + this.showPaperPolicyManual = false; + } + } + } + } +</script> + +<style scoped> + +</style> diff --git a/src/views/etaa/paper/index.vue b/src/views/etaa/paper/index.vue new file mode 100644 index 0000000..4ee86f4 --- /dev/null +++ b/src/views/etaa/paper/index.vue @@ -0,0 +1,254 @@ +<template> + <div class="app-main"> + <div class="base-container"> + <el-card shadow="never" class="box-card"> + <!--鎼滅储鏉′欢--> + <div class="filter-container"> + <el-form :inline="true" :model="filterForm" size="small"> + <el-form-item label="椤剁骇鍗曚綅"> + <el-select v-model="filterForm.orgId" placeholder="閫夋嫨椤剁骇鍗曚綅" @change="search(1)"> + <el-option + v-for="org in this.rootOrgList" :key="org.id" :label="org.dept_name" :value="org.id"/> + </el-select> + </el-form-item> + <!-- <el-form-item label="鍙戣捣鏃堕棿">--> + <!-- <el-date-picker v-model="filterFrom.startTime" type="date" placeholder="閫夋嫨寮�濮嬫棩鏈�" format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width: 177px" />--> + <!-- - <el-date-picker v-model="filterFrom.finishTime" style="width: 177px" type="date" placeholder="閫夋嫨缁撴潫鏃ユ湡" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />--> + <!-- </el-form-item>--> + <el-form-item label="棰樺簱澶х被"> + <el-select v-model="filterForm.rootCatalog" placeholder="棰樺簱澶х被" clearable> + <el-option + v-for="dict in dict.type.question_root_catalog" + :key="dict.value" + :label="dict.label" + :value="dict.value" + /> + </el-select> + </el-form-item> + <el-form-item label="璇曞嵎鍚嶇О"> + <el-input v-model="filterForm.content" placeholder="璇曞嵎鍚嶇О鍏抽敭璇�" clearable/> + </el-form-item> + <el-form-item> + <my-button-v2 site="filter" name="鎼滅储" @click="search(1)" /> + <my-button-v2 site="filter" name="閲嶇疆" @click="reset()" /> + </el-form-item> + </el-form> + </div> + </el-card> + <!--鍒楄〃--> + <my-table-v3 ref="myTable" :filter="filterForm" :table="table" /> + <!--娣诲姞/缂栬緫寮圭獥--> + <add v-if="editSetting.show" :setting="editSetting" @close="editSetting.show=false" @search="search" /> + </div> + </div> +</template> + +<script> + import { listOrgRoot } from '@/api/system/dept' + import {deletePaper} from "@/api/etaa/paper"; + import myTableV3 from '@/views/components/myTableV3'; + import myButtonV2 from '@/views/components/myButtonV2' + import {isEmptyValue} from "@/utils/StringUtils"; + import add from "./add"; + + export default { + name: "Paper", + components: {myTableV3, myButtonV2, add}, + dicts: ['question_root_catalog'], + data(){ + return { + /** 鎼滅储鏉′欢*/ + filterForm: { + orgId: null, + rootCatalog: null, + rootCatalogName: null, // 涓存椂瀛樻斁鍚嶅瓧 + majorCatalog: null, + content: null + }, + + table: { + autoLoad: false, + showIndex: false, // 鏄惁鏄剧ず搴忓彿 + expand: false, // 鏄惁鏄剧ず璇︽儏鏁版嵁 + checkBox: false, // 鏄惁鏄剧ず澶嶉�夋 + url: globalConf.baseUrl + '/etaa/paper/list', // 璇锋眰鍦板潃 + // 宸ュ叿鏉� + tools: { + columnsCtrl: {// 鍒楁帶鍒舵寜閽� + show: true + }, + generalExport: {// 閫氱敤瀵煎嚭鎸夐挳 + show: false + }, + custom: [ // 鑷畾涔夊伐鍏锋潯鎸夐挳 + { + name: '娣诲姞', + checkPermission: 'etaa:paper:add', + // myType: 'danger', + mySize: 'mini', + click: ()=> { + this.handleRAdd(); + } + }, + { + name: '瀵煎嚭鍙傛暟', + click: ()=> { + + } + } + ] + }, + columns: [ + { title: '鍚嶇О', field: 'name', align: 'left', width: 190 }, + { title: '澶х被', field: 'parameter.rootCatalogName', align: 'left', width: 100 }, + { title: '灏忕被', field: 'majorCatalogName', align: 'left', width: 80 }, + { title: '缁勫嵎绛栫暐', field: 'paperPolicy', align: 'left', width: 90 }, + { title: '绛栫暐璇︽儏', field: 'policyContent', align: 'left', width: 150 }, + { title: '棰橀噺', field: 'questionCount', align: 'left', width: 60 }, + { title: '鎬诲垎', field: 'scoreTotal', align: 'left', width: 60 }, + { title: '鍒嗗�艰鎯�', field: 'scorePolicy', align: 'left', width: 120 }, + { title: '闅惧害', field: 'difficultLevel', align: 'left', width: 70 }, + { title: '鐘舵��', field: 'dataStatus', align: 'left', width: 60, formatter: row => { + let title = ''; + let type = 'primary'; + switch (row.dataStatus) { + case 0: + title = '姝e父' + break + case 1: + title = '绂佺敤' + type = 'warn' + break + case 2: + title = '鍒犻櫎' + type = 'danger' + break + } + return { value: title, type: type } + } + }, + { title: '鍒涘缓鏃堕棿', field: 'parameter.createTimeName', align: 'left', width: 170 }, + { title: '鍒涘缓浜�', field: 'parameter.createUserName', align: 'left', width: 90 }, + { title: '澶囨敞', field: 'summary', align: 'left', width: 160 } + ], + // 鎿嶄綔淇℃伅 + operation: { + show: true, // 鏄剧ず鎿嶄綔鍒� + width: '100', // 鍒楀 + attr: [ + { + title: '缂栬緫', + checkPermission: 'etaa:paper:edit', + events: row => { + this.handleUpdate(row) + } + }, + { + title: '鍒犻櫎', + checkPermission: 'etaa:paper:remove:query', + events: row => { + this.handleDelete(row.id); + } + } + ] + }, + paging: { + show: true, // 鏄剧ず鍒嗛〉 + // 鍒嗛〉淇℃伅 + page: { + small: false, + pageNum: 1, + pageSize: platformPageSize, + total: 0 + } + } + }, + + // 娣诲姞&缂栬緫绐楀彛 + editSetting: { + id: null, + title: '', + show: false + }, + + // 2022-12-30 鏍规満鏋勫垪琛紝涓汉鍙兘鍒楀嚭鑷繁鎵�鍦ㄦ牴鏈烘瀯 + rootOrgList:[], + // 2022-12-30 瓒呯骇绠$悊鍛橀�夋嫨鐨勯《绾ф満鏋処D + selectedRootOrgId: undefined, + } + }, + + created() { + this.getRootOrgList(); + }, + + methods: { + /** 鑾峰彇椤剁骇鏈烘瀯鍒楄〃閫夋嫨妗� 2022-12-30 */ + getRootOrgList(){ + listOrgRoot().then(response => { + this.rootOrgList = response.data; + this.selectedRootOrgId = this.rootOrgList[0].id; + this.filterForm.orgId = this.selectedRootOrgId; + }).then(() => { + // this.listCatalogTree(); + this.search(1); + }).catch(function() { + }); + }, + + // 閲嶇疆 + reset() { + this.filterForm = { + orgId: this.selectedRootOrgId, + rootCatalog: null, + rootCatalogName: null, + majorCatalog: null, + content: null + } + this.search(1) + }, + + // 鏌ヨtable鍒楄〃 + search(pageNum) { + if(isEmptyValue(this.filterForm.orgId)){ + return; + } else { + if (pageNum != undefined) { + this.$refs.myTable.search({ pageNum: pageNum }) + } else { + this.$refs.myTable.search() + } + } + }, + + handleRAdd(){ + if(isEmptyValue(this.selectedRootOrgId)){ + this.$message.warning("璇峰厛閫夋嫨涓�涓《绾ф満鏋�"); + return; + } + // if(isEmptyValue(this.filterForm.rootCatalog)){ + // this.$message.warning("璇峰厛閫夋嫨棰樺簱澶х被"); + // return; + // } + this.editSetting.id = null; + this.editSetting.title = "娣诲姞璇曞嵎"; + this.editSetting.rootCatalog = this.filterForm.rootCatalog; + this.editSetting.orgId = this.selectedRootOrgId; + this.editSetting.show = true; + }, + + handleDelete(id){ + this.$modal.confirm("纭畾瑕佸垹闄よ瘯鍗峰悧锛熶粎鍦ㄦ祴璇曟椂鍙互锛屾寮忓彧鑳界鐢�").then(()=>{ + deletePaper(id).then(response => { + this.search(1); + this.$message.success("鍒犻櫎鎴愬姛!"); + }); + }).catch(() => {}); + } + } + } +</script> + +<style scoped> + +</style> diff --git a/src/views/etaa/question_bank/add.vue b/src/views/etaa/question_bank/add.vue new file mode 100644 index 0000000..69ffba0 --- /dev/null +++ b/src/views/etaa/question_bank/add.vue @@ -0,0 +1,151 @@ +<template> + <win :title="setting.title" width="800px" @close="close"> + <el-form ref="form" :model="form" :rules="rules" label-width="200px" class="demo-ruleForm" label-position="right"> + <el-form-item label="棰樺簱澶х被" prop="rootCatalog"> + <el-select v-model="form.rootCatalog" placeholder="棰樺簱澶х被"> + <el-option :value="form.rootCatalog" :label="form.rootCatalogName" :key="form.rootCatalog"/> + </el-select> + </el-form-item> + <el-form-item label="浜岀骇鍒嗙被" prop="majorCatalog"> + <el-select v-model="form.majorCatalog" placeholder="浜岀骇鍒嗙被"> + <el-option :value="form.majorCatalog" :label="form.majorCatalogName"/> + </el-select> + </el-form-item> + <el-form-item label="璇曢绫诲瀷" prop="questionType"> + <el-select v-model="form.questionType" placeholder="璇曢绫诲瀷"> + <el-option v-for="d in this.questionTypeList" :key="d.key" :label="d.value" :value="d.key"/> + </el-select> + </el-form-item> + <el-form-item label="璇曢闅惧害" prop="difficultLevel"> + <el-input v-model="form.difficultLevel" placeholder="1鍒�5,1琛ㄧず鏈�绠�鍗�" maxlength="1" value="3"/> + </el-form-item> + <el-form-item label="璇曢鍐呭" prop="content"> + <el-input type="textarea" :rows="5" v-model="form.content" placeholder="" /> + </el-form-item> + <el-form-item label="鍙傝�冪瓟妗�" prop="answer"> + <el-input v-model="form.answer" placeholder="鍒ゆ柇棰樿緭鍏ワ細瀵广�侀敊锛屽涓~绌虹敤鍒嗗彿鍒嗛殧锛岄�夋嫨棰樿緭鍏ワ細ABC绛�" /> + </el-form-item> + <el-form-item label="璁茶В鍒嗘瀽" prop="analysis"> + <el-input v-model="form.analysis" placeholder="鍙��" /> + </el-form-item> + + <el-form-item label="涓婁紶鍥剧墖锛堝彲閫夛級" prop="attachImg"> + <el-input v-model="form.attachImg" placeholder="鍐呭鏀寔鍥剧墖" /> + </el-form-item> + <el-form-item label="涓婁紶瑙嗛锛堝彲閫夛級" prop="attachVideo"> + <el-input v-model="form.attachVideo" placeholder="鍐呭鏀寔鐭棰�" /> + </el-form-item> + + </el-form> + <div slot="footer" class="dialog-footer"> + <my-button-v2 name="鍏抽棴" site="form" @click="close" /> + <my-button-v2 name="淇濆瓨" site="form" @click="save" /> + </div> + </win> +</template> + +<script> + import win from '@/views/components/win' + import myButtonV2 from '@/views/components/myButtonV2' + import {listQuestionType, add, getCatalogInfo} from "@/api/etaa/question_bank"; + + export default { + name: "", + components: { win, myButtonV2 }, + // dicts: ['question_difficult'], + props: { + // setting 涓』鑷冲皯鍖呭惈鎺у埗dialog鏄剧ず鎴栭殣钘忕殑灞炴��,鍏朵綑灞炴�у彲鎷撳睍 + // 灏嗘坊鍔�/淇敼鐨勫ぇ閲忔暟鎹強閫昏緫浠庡垪琛ㄩ〉闈腑鍒嗙鍑烘潵,閬垮厤鍒楄〃椤甸潰浠g爜杩囧,瀹℃煡鍥伴毦 + // 鑻ユ椤甸潰椤诲洖浼犳暟鎹嚦鐖堕〉闈�,鍙湪寮曠敤缁勪欢鏃舵坊鍔犱簨浠�,鏈〉闈娇鐢╰his.$emit('浜嬩欢鍚�',鍙傛暟1,鍙傛暟2...)鍥炰紶鏁版嵁 + setting: { + type: Object, + default: () => { + } + } + }, + data(){ + return { + form: { + id: null, + orgId: this.setting.orgId, + rootCatalog: null, + rootCatalogName: null, + majorCatalog: null, + majorCatalogName: null, + questionType: null, + difficultLevel: 3, + answer: null, + analysis: null, + attachImg: null, + attachVideo: null + }, + // 璇曢绫诲埆鍒楄〃锛�2023-03-11 + questionTypeList: [], + + rules: { + rootCatalog: [ + { required: true, message: "蹇呴』閫夋嫨棰樺簱鍒嗙被", trigger: "blur" } + ], + questionType: [ + { required: true, message: "閫夋嫨璇曢绫诲瀷", trigger: "blur" } + ], + answer: [ + { required: true, message: "杈撳叆鍙傝�冪瓟妗�", trigger: "blur" } + ], + content: [ + { required: true, message: "杈撳叆璇曢鍐呭", trigger: "blur" } + ] + }, + } + }, + + created() { + this.getQuestionTypeList(); + this.loadCatalogInfo(); + }, + + methods: { + /** 鑾峰彇璇曢绫诲埆闆嗗悎 2023-03-11 */ + getQuestionTypeList(){ + listQuestionType().then(response => { + // console.log(response.data); + this.questionTypeList = response.data; + }); + }, + + loadCatalogInfo(){ + console.log("catalogId = " + this.setting.catalogId); + getCatalogInfo(this.setting.catalogId).then(response => { + this.form.rootCatalog = response.data.rootCatalog; + this.form.rootCatalogName = response.data.parameter.rootCatalogName; + this.form.majorCatalog = response.data.majorCatalog; + this.form.majorCatalogName = response.data.parameter.majorCatalogName; + this.open = true; + }); + }, + + save(){ + this.$refs.form.validate(validate => { + if(validate){ + add(this.form).then(response => { + // this.$modal.msgSuccess("淇敼鎴愬姛"); + // this.open = false; + // this.getList(); + this.$message.success('淇濆瓨鎴愬姛锛�') + this.$emit('search') + this.close() + }); + } + }); + }, + + close() { + this.$emit('close') + }, + } + } +</script> + +<style scoped> + +</style> diff --git a/src/views/etaa/question_bank/index.vue b/src/views/etaa/question_bank/index.vue index 0b752d5..3928307 100644 --- a/src/views/etaa/question_bank/index.vue +++ b/src/views/etaa/question_bank/index.vue @@ -1,253 +1,166 @@ <template> - <div class="app-container"> + <div class="app-main info-main"> + <el-aside class="sidebar-box" style="padding: 0;"> + <div class="sidebar"> + <el-card class="box-card" shadow="never"> + <div slot="header" class="clearfix"> + <span> + <svg-icon icon-class="nested" style="margin-top: -2px;" />棰樺簱鍒嗙被 + </span> + <el-button style="float: right; padding: 3px 0" type="text" @click="expandedAll">鏀惰捣</el-button> + </div> + <el-input v-model="filterText" clearable placeholder="鍏抽敭瀛楄繃婊�" /> + <el-tree ref="treeRef" :data="treeData" :default-expanded-keys="defaultExpandedKeys" :filter-node-method="filterNode" :props="defaultProps" highlight-current node-key="id" @node-click="handleNodeClick" /> + </el-card> + </div> + </el-aside> - <el-row :gutter="10" class="mb8"> - <el-col :span="6" :xs="24"> - <div class="head-container"> - <el-tree - :data="catalogListOptions" - :props="defaultProps" - :expand-on-click-node="false" - :filter-node-method="filterNode" - ref="tree" - default-expand-all - highlight-current - @node-click="handleNodeClick" - /> + <div class="base-container flex-1"> + <el-card shadow="never" class="box-card"> + <!--鎼滅储鏉′欢--> + <div class="filter-container"> + <el-form :inline="true" :model="filterForm" size="small"> + <el-form-item label="椤剁骇鍗曚綅"> + <el-select v-model="filterForm.orgId" placeholder="閫夋嫨椤剁骇鍗曚綅" @change="search(1)"> + <el-option + v-for="org in this.rootOrgList" :key="org.id" :label="org.dept_name" :value="org.id"/> + </el-select> + </el-form-item> + <el-form-item label="璇曢绫诲瀷"> + <el-select v-model="filterForm.questionType" placeholder="璇曢绫诲瀷"> + <el-option v-for="d in this.questionTypeList" :key="d.key" :label="d.value" :value="d.key"/> + </el-select> + </el-form-item> + <el-form-item label="璇曢棰樼洰"> + <el-input v-model="filterForm.content" placeholder="璇曢鍐呭" clearable/> + </el-form-item> + <el-form-item> + <my-button-v2 site="filter" name="鎼滅储" @click="search(1)" /> + <my-button-v2 site="filter" name="閲嶇疆" @click="reset()" /> + </el-form-item> + </el-form> </div> - </el-col> - <el-col :span="18" :xs="24"> - <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> - <el-form-item label="椤剁骇鍗曚綅" prop="orgId"> - <el-select v-model="queryParams.orgId" placeholder="閫夋嫨椤剁骇鍗曚綅" @change="getList()"> - <el-option - v-for="org in this.rootOrgList" - :key="org.id" - :label="org.dept_name" - :value="org.id" - /> - </el-select> - </el-form-item> + </el-card> - <el-form-item label="璇曢绫诲瀷" prop="questionType"> - <el-select v-model="queryParams.questionType" placeholder="璇曢绫诲瀷"> - <el-option - v-for="d in this.questionTypeList" - :key="d.key" - :label="d.value" - :value="d.key" - /> - </el-select> - </el-form-item> - <el-form-item label="璇曢棰樼洰" prop="content"> - <el-input - v-model="queryParams.content" - placeholder="璇曢鍐呭" - clearable - @keyup.enter.native="handleQuery" - /> - </el-form-item> -<!-- <el-form-item label="涓撲笟鍒嗙被" prop="majorCode">--> -<!-- <el-select v-model="queryParams.majorCode" placeholder="璇烽�夋嫨涓撲笟鍒嗙被" clearable>--> -<!-- <el-option--> -<!-- v-for="dict in dict.type.sys_job_status"--> -<!-- :key="dict.value"--> -<!-- :label="dict.label"--> -<!-- :value="dict.value"--> -<!-- />--> -<!-- </el-select>--> -<!-- </el-form-item>--> - - <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> - <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> - </el-form-item> - </el-form> - - <el-row :gutter="10" class="mb8"> - <el-col :span="1.5"> - <el-button - type="primary" - plain - icon="el-icon-plus" - size="mini" - @click="handleAdd" - v-hasPermi="['exam:online:add']" - >娣诲姞</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="danger" - plain - icon="el-icon-delete" - size="mini" - :disabled="multiple" - @click="handleDelete" - v-hasPermi="['exam:online:delBatch']" - >鍒犻櫎</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="warning" - plain - icon="el-icon-search" - size="mini" - @click="handleExport" - v-hasPermi="['exam:online:exist']" - >鏌ラ噸</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="warning" - plain - icon="el-icon-upload2" - size="mini" - @click="handleExport" - v-hasPermi="['exam:online:upload']" - >瀵煎叆</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="info" - plain - icon="el-icon-download" - size="mini" - @click="" - v-hasPermi="['exam:online:download']" - >妯℃澘涓嬭浇</el-button> - </el-col> - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> - </el-row> - - <el-table v-loading="loading" :data="examList" @selection-change="handleSelectionChange"> - <el-table-column type="selection" width="55" align="left" /> - <el-table-column label="ID" align="left" prop="id" :show-overflow-tooltip="true" /> - <el-table-column label="褰掑睘" align="left" prop="parameter.orgName"/> - <el-table-column label="澶х被" align="left" prop="parameter.rootCatalogName"/> - <el-table-column label="瀛愬垎绫�" align="left" prop="parameter.majorCatalogName"/> - <el-table-column label="棰樼洰" align="left" prop="content" :show-overflow-tooltip="true" /> - <el-table-column label="璇曢绫诲瀷" align="left" prop="parameter.questionTypeName"/> - <el-table-column label="鍒涘缓浜�" align="left" prop="createUserId" :show-overflow-tooltip="true" /> - <el-table-column label="鍒涘缓鏃堕棿" align="left" prop="parameter.createTimeName" /> - <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> - <template slot-scope="scope"> - <el-button - size="mini" - type="text" - icon="el-icon-edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['exam:online:edit']" - >淇敼</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-delete" - @click="handleDelete(scope.row)" - v-hasPermi="['exam:online:del']" - >鍒犻櫎</el-button> - </template> - </el-table-column> - </el-table> - - <pagination - v-show="total>0" - :total="total" - :page.sync="queryParams.pageNum" - :limit.sync="queryParams.pageSize" - @pagination="getList" - /> - </el-col> - </el-row> - - <!-- 娣诲姞鎴栦慨鏀瑰畾鏃朵换鍔″璇濇 --> - <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body> - <el-form ref="form" :model="form" :rules="rules" label-width="120px"> - <el-row> - <el-col :span="24"> - <el-form-item label="鎵�灞炲垎绫�" prop="majorId"> - <el-select v-model="form.majorId" placeholder="璇烽�夋嫨鎵�灞炲垎绫�"> - <el-option - v-for="dict in dict.type.sys_job_group" - :key="dict.value" - :label="dict.label" - :value="dict.value" - ></el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :span="24"> - <el-form-item label="棰樼洰绫诲瀷" prop="type"> - <el-select v-model="form.type" placeholder="璇烽�夋嫨棰樼洰绫诲瀷"> - <el-option - v-for="dict in dict.type.sys_job_group" - :key="dict.value" - :label="dict.label" - :value="dict.value" - ></el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :span="24"> - <el-form-item label="棰樼洰" prop="content"> - <el-input v-model="form.content" placeholder="璇疯緭鍏ラ鐩�"/> - </el-form-item> - </el-col> - </el-row> - </el-form> - <div slot="footer" class="dialog-footer"> - <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> - <el-button @click="cancel">鍙� 娑�</el-button> - </div> - </el-dialog> - - <!-- 璇曢搴撹缁� --> - <el-dialog title="璇曢搴撹缁�" :visible.sync="openView" width="700px" append-to-body> - <el-form ref="form" :model="form" label-width="120px" size="mini"> - <el-row> - <el-col :span="12"> - <el-form-item label="鎵�灞炲垎绫伙細">{{ form.id }}</el-form-item> - <el-form-item label="棰樼洰绫诲瀷锛�">{{ form.jobName }}</el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="棰樼洰锛�">{{ "" }}</el-form-item> - <el-form-item label="绛旀锛�">{{ form.createTime }}</el-form-item> - </el-col> - </el-row> - </el-form> - <div slot="footer" class="dialog-footer"> - <el-button @click="openView = false">鍏� 闂�</el-button> - </div> - </el-dialog> + <!--鍒楄〃--> + <my-table-v3 ref="myTable" :filter="filterForm" :table="table" /> + </div> + <!--娣诲姞/缂栬緫寮圭獥--> + <add v-if="editSetting.show" :setting="editSetting" @search="search()" @close="editSetting.show=false"/> + <!-- 瀵煎叆绐楀彛--> + <my-import :import-setting="importSetting" :dialog-show="importSetting.dialogShow" :dialog-title="importSetting.dialogTitle"/> </div> </template> <script> - // import { listJob, getJob, delJob, addJob, updateJob, runJob, changeJobStatus } from "@/api/monitor/job"; - import { listOrgRoot, listOrgRootTree } from '@/api/system/dept' - import { listCatalogTreeList, listQuestion, listQuestionType } from '@/api/etaa/question_bank' + import { getToken } from '@/utils/auth' + import {listOrgRoot} from '@/api/system/dept' + import {clear, listCatalogTreeList, listQuestionType} from '@/api/etaa/question_bank' + import myTableV3 from '@/views/components/myTableV3'; + import myButtonV2 from '@/views/components/myButtonV2' + import myImport from '@/views/components/myImport' + import {isEmptyValue} from "@/utils/StringUtils"; + import add from './add' export default { - // components: { Crontab }, + components: {myTableV3, myButtonV2, add, myImport}, name: "questionBank", - dicts: ['sys_job_status'], data() { return { - // 鏃ユ湡鑼冨洿 - dateRange: [], - // 閬僵灞� - loading: true, - // 閫変腑鏁扮粍 - ids: [], - // 闈炲崟涓鐢� - single: true, - // 闈炲涓鐢� - multiple: true, - // 鏄剧ず鎼滅储鏉′欢 - showSearch: true, - // 鎬绘潯鏁� - total: 0, - // 琛ㄦ牸鏁版嵁 - examList: [], + /** 鏍戦厤缃�*/ + defaultExpandedKeys: [1], // 榛樿灞曞紑鐨刱ey + filterText: '', + treeData: [], + /** 鍒嗙被鏍戞暟鎹粨鏋� */ + defaultProps: { + children: "children", + label: "label" + }, + + /** 鎼滅储鏉′欢*/ + filterForm: { + orgId: null, + questionType: null, + content: null + }, + + table: { + // size: "small", + autoLoad: false, + showIndex: false, // 鏄惁鏄剧ず搴忓彿 + expand: false, // 鏄惁鏄剧ず璇︽儏鏁版嵁 + checkBox: false, // 鏄惁鏄剧ず澶嶉�夋 + url: globalConf.baseUrl + '/etaa/question_bank/list', // 璇锋眰鍦板潃 + // 宸ュ叿鏉� + tools: { + columnsCtrl: {// 鍒楁帶鍒舵寜閽� + show: true + }, + generalExport: {// 閫氱敤瀵煎嚭鎸夐挳 + show: false + }, + custom: [ // 鑷畾涔夊伐鍏锋潯鎸夐挳 + { + name: '娣诲姞璇曢', + // checkPermission: 'system:config:remove', + // myType: 'danger', + mySize: 'mini', + click: ()=> { + this.handleAdd(); + } + }, + { + name: '瀵煎叆', + click: ()=> { + this.handleImport(); + } + }, + { + name: '娓呯┖棰樺簱', + checkPermission: 'etaa:question_bank:clear', + myType: 'info', + mySize: 'mini', + click: ()=> { + this.handleClear(); + } + } + ] + }, + columns: [ + { title: 'ID', field: 'id', align: 'left', width: 80 }, + { title: '褰掑睘', field: 'parameter.orgName', align: 'left', width: 130 }, + { title: '澶х被', field: 'parameter.rootCatalogName', align: 'left', width: 150 }, + { title: '瀛愬垎绫�', field: 'parameter.majorCatalogName', align: 'left', width: 160}, + { title: '棰樼洰', field: 'content', align: 'left', width: 230 }, + { title: '棰樺瀷', field: 'parameter.questionTypeName', align: 'left', width: 80 }, + { title: '鍒涘缓浜�', field: 'createUserId', align: 'left', width: 80 }, + { title: '鍒涘缓鏃堕棿', field: 'parameter.createTimeName', align: 'left', width: 160 } + ], + // 鎿嶄綔淇℃伅 + operation: { + show: true, // 鏄剧ず鎿嶄綔鍒� + width: '100', // 鍒楀 + attr: [ + { + title: '缂栬緫', + checkPermission: 'system:config:edit', + events: row => { + this.handleUpdate(row) + } + } + ] + }, + paging: { + show: true, // 鏄剧ず鍒嗛〉 + // 鍒嗛〉淇℃伅 + page: { + small: false, + pageNum: 1, + pageSize: platformPageSize, + total: 0 + } + } + }, // 2022-12-30 鏍规満鏋勫垪琛紝涓汉鍙兘鍒楀嚭鑷繁鎵�鍦ㄦ牴鏈烘瀯 rootOrgList:[], @@ -255,48 +168,81 @@ selectedRootOrgId: undefined, // 璇曢绫诲埆鍒楄〃锛�2023-03-11 questionTypeList: [], - // 2023-03-13 璇曢绫诲埆鏍戞暟鎹�夐」 - catalogListOptions: undefined, - /** 鍒嗙被鏍戞暟鎹粨鏋� */ - defaultProps: { - children: "children", - label: "label" + + // 娣诲姞&缂栬緫绐楀彛 + editSetting: { + id: null, + title: '', + show: false }, - // 寮瑰嚭灞傛爣棰� - title: "", - // 鏄惁鏄剧ず寮瑰嚭灞� - open: false, - // 鏄惁鏄剧ず璇︾粏寮瑰嚭灞� - openView: false, - // 鏄惁鏄剧ずCron琛ㄨ揪寮忓脊鍑哄眰 - openCron: false, - // 浼犲叆鐨勮〃杈惧紡 - expression: "", - // 鏌ヨ鍙傛暟 - queryParams: { - pageNum: 1, - pageSize: 10, - content: undefined, - catalogId: undefined, - orgId: undefined, - questionType: undefined + // 瀵煎叆 + importSetting: { + dialogTitle: '瀵煎叆', + dialogShow: false, + fileSettings: { + uploadUrl: globalConf.baseUrl + "/etaa/question_bank/select/import?Authorization=" + getToken(), // 涓婁紶鍦板潃 + accept: '.xlsx,.csv', // 鏍煎紡 + type: 'text', // 鍥炴樉褰㈠紡 + loading: false // 瀵煎叆鏁堟灉 + }, + /* 妯℃澘涓嬭浇 */ + templateSettings: { + templateName: '棰樺簱瀵煎叆妯℃澘.xlsx', // 鍚嶇О + templateUrl: globalConf.baseUrl + '/etaa/question_bank/select/downloadTemplate?Authorization=' + getToken() // 涓嬭浇鍦板潃 + }, + onSuccess: null }, - // 琛ㄥ崟鍙傛暟 - form: {}, - // 琛ㄥ崟鏍¢獙 - rules: { - content: [ - { required: true, message: "棰樼洰涓嶈兘涓虹┖", trigger: "blur" } - ] - } }; }, + created() { this.getRootOrgList(); this.getQuestionTypeList(); }, methods: { + // 鏍戣妭鐐硅繃婊� + filterNode(value, data) { + if (!value) return true; + console.log("value = " + value + ", data = " + data); + return data.label.indexOf(value) !== -1; + }, + // 鏍戣妭鐐规敹璧� + expandedAll() { + const nodes = this.$refs.treeRef.store._getAllNodes() + for (let i = 0; i < nodes.length; i++) { + nodes[i].expanded = false + } + // 缂栬緫椤甸潰 + // this.editSetting.orgId = null + // this.editSetting.orgName = '鏃�' + this.reset() + }, + + // 閲嶇疆 + reset() { + this.filterForm = { + orgId: this.selectedRootOrgId, + questionType: null, + content: null + } + this.search(1) + }, + + // 鏌ヨtable鍒楄〃 + search(pageNum) { + if(isEmptyValue(this.filterForm.orgId)){ + return; + } else { + // console.log("-----------" + this.filterForm.orgId); + if (pageNum != undefined) { + this.$refs.myTable.search({ pageNum: pageNum }) + } else { + this.$refs.myTable.search() + } + } + }, + /** 鑾峰彇璇曢绫诲埆闆嗗悎 2023-03-11 */ getQuestionTypeList(){ listQuestionType().then(response => { @@ -306,95 +252,33 @@ }, /** 鑾峰彇椤剁骇鏈烘瀯鍒楄〃閫夋嫨妗� 2022-12-30 */ getRootOrgList(){ - this.loading = true; listOrgRoot().then(response => { this.rootOrgList = response.data; this.selectedRootOrgId = this.rootOrgList[0].id; - this.queryParams.orgId = this.selectedRootOrgId; - this.loading = false; + this.filterForm.orgId = this.selectedRootOrgId; }).then(() => { this.listCatalogTree(); - this.getList(); + this.search(1); }).catch(function() { - this.loading = false; }); }, // 璇曢绫诲埆鏍� listCatalogTree(){ listCatalogTreeList("question_root_catalog").then(response => { - console.log(response.data); - this.catalogListOptions = response.data; + // console.log(response.data); + this.treeData = response.data; }); }, - /** 鏌ヨ鍒楄〃 */ - getList() { - this.loading = true; - listQuestion(this.queryParams).then(response => { - this.examList = response.data; - this.total = response.total; - this.loading = false; - }); - }, - - // 绛涢�夎妭鐐� - filterNode(value, data) { - if (!value) return true; - console.log("value = " + value + ", data = " + data); - return data.label.indexOf(value) !== -1; - }, // 鑺傜偣鍗曞嚮浜嬩欢 handleNodeClick(data) { - this.queryParams.catalogId = data.id; - this.handleQuery(); + // 淇濇寔宸插睍寮�鐨勮彍鍗曞埛鏂板悗渚濇棫灞曞紑 + this.defaultExpandedKeys = [data.id]; + this.filterForm.catalogId = data.id; + this.search(1); }, - // 鍙栨秷鎸夐挳 - cancel() { - this.open = false; - this.reset(); - }, - // 琛ㄥ崟閲嶇疆 - reset() { - this.form = { - id: undefined, - content: undefined, - concurrent: 1, - status: "0" - }; - this.dateRange = [];// 鏃堕棿鑼冨洿 - this.resetForm("form"); - }, - /** 鎼滅储鎸夐挳鎿嶄綔 */ - handleQuery() { - this.queryParams.pageNum = 1; - this.getList(); - }, - /** 閲嶇疆鎸夐挳鎿嶄綔 */ - resetQuery() { - this.resetForm("queryForm"); - this.queryParams.orgId = this.selectedRootOrgId; - this.queryParams.questionType = undefined; - this.handleQuery(); - }, - // 澶氶�夋閫変腑鏁版嵁 - handleSelectionChange(selection) { - this.ids = selection.map(item => item.id); - this.single = selection.length != 1; - this.multiple = !selection.length; - }, - // 鐘舵�佷慨鏀� - handleStatusChange(row) { - let text = row.status === "0" ? "鍚敤" : "鍋滅敤"; - this.$modal.confirm('纭瑕�"' + text + '""' + row.name + '"浠诲姟鍚楋紵').then(function() { - return changeJobStatus(row.id, row.status); - }).then(() => { - this.$modal.msgSuccess(text + "鎴愬姛"); - }).catch(function() { - row.status = row.status === "0" ? "1" : "0"; - }); - }, /** 浠诲姟璇︾粏淇℃伅 */ handleView(row) { // getJob(row.id).then(response => { @@ -404,10 +288,21 @@ }, /** 鏂板鎸夐挳鎿嶄綔 */ handleAdd() { - this.reset(); - this.open = true; - this.title = "娣诲姞璇曢搴�"; + if(isEmptyValue(this.selectedRootOrgId)){ + this.$message.warning("璇峰厛閫夋嫨涓�涓《绾ф満鏋�"); + return; + } + if(isEmptyValue(this.filterForm.catalogId)){ + this.$message.warning("璇峰厛閫夋嫨棰樺簱鍒嗙被"); + return; + } + this.editSetting.id = null; + this.editSetting.title = "娣诲姞璇曢"; + this.editSetting.catalogId = this.filterForm.catalogId; + this.editSetting.orgId = this.selectedRootOrgId; + this.editSetting.show = true; }, + /** 淇敼鎸夐挳鎿嶄綔 */ handleUpdate(row) { this.reset(); @@ -418,6 +313,65 @@ this.title = "淇敼璇曢搴�"; }); }, + + handleClear(){ + this.$modal.confirm('瑕佹竻绌洪搴撳悧锛熼�氬父鍙湁娴嬭瘯闃舵闇�瑕佷娇鐢�!').then(function() { + return clear(); + }).then(() => { + this.search(1); + this.$modal.msgSuccess("鎿嶄綔鎴愬姛"); + }).catch(() => {}); + }, + + handleImport(){ + this.importSetting.dialogShow = true + this.importSetting.onSuccess = (response, callBack) => { + console.log(response); + if(response.code != 1){ + this.$message.error('瀵煎叆澶辫触' || response.msg); + callBack(); + return; + } + + if(isEmptyValue(response.data)){ + // 娌℃湁杩斿洖閿欒璁板綍鏂囦欢 + this.$message.success("瀵煎叆鎴愬姛"); + this.search(); + callBack(); + return; + } + + this.$confirm("璇锋煡鐪嬪鍏ラ敊璇紝鏂囦欢:" + response.data, '瀵煎叆瀹屾垚', { + confirmButtonText: '纭畾', + type: 'warning' + }).then(() => { + this.search() + }); + // user.importUser(response.data[0]).then(response => { + // if (response.code === 10000) { + // this.importSetting.dialogShow = false + // if (response.data.errorInfo.length === 0) { + // this.$message.success(response.data.info) + // this.search() + // } else { + // const errorInfoList = response.data.errorInfo + // var errorInfo = errorInfoList.join('') + // this.$confirm(errorInfo, '鎻愮ず', { + // confirmButtonText: '纭畾', + // type: 'warning' + // }).then(() => { + // this.search() + // }) + // } + // } else { + // this.$message.error('瀵煎叆澶辫触' || response.description) + // this.search() + // } + // callBack() + // }) + } + }, + /** 鎻愪氦鎸夐挳 */ submitForm: function() { this.$refs["form"].validate(valid => { @@ -457,3 +411,14 @@ } }; </script> +<style scope lang="scss"> + .info-main{ + display:-webkit-box; + display: -moz-box; + display: -0-box; + min-height: calc( 100vh - 50px); + } + .flex-1{ + flex:1; + } +</style> diff --git a/src/views/etaa/question_bank/index_old.vue b/src/views/etaa/question_bank/index_old.vue new file mode 100644 index 0000000..0b752d5 --- /dev/null +++ b/src/views/etaa/question_bank/index_old.vue @@ -0,0 +1,459 @@ +<template> + <div class="app-container"> + + <el-row :gutter="10" class="mb8"> + <el-col :span="6" :xs="24"> + <div class="head-container"> + <el-tree + :data="catalogListOptions" + :props="defaultProps" + :expand-on-click-node="false" + :filter-node-method="filterNode" + ref="tree" + default-expand-all + highlight-current + @node-click="handleNodeClick" + /> + </div> + </el-col> + <el-col :span="18" :xs="24"> + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> + <el-form-item label="椤剁骇鍗曚綅" prop="orgId"> + <el-select v-model="queryParams.orgId" placeholder="閫夋嫨椤剁骇鍗曚綅" @change="getList()"> + <el-option + v-for="org in this.rootOrgList" + :key="org.id" + :label="org.dept_name" + :value="org.id" + /> + </el-select> + </el-form-item> + + <el-form-item label="璇曢绫诲瀷" prop="questionType"> + <el-select v-model="queryParams.questionType" placeholder="璇曢绫诲瀷"> + <el-option + v-for="d in this.questionTypeList" + :key="d.key" + :label="d.value" + :value="d.key" + /> + </el-select> + </el-form-item> + <el-form-item label="璇曢棰樼洰" prop="content"> + <el-input + v-model="queryParams.content" + placeholder="璇曢鍐呭" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> +<!-- <el-form-item label="涓撲笟鍒嗙被" prop="majorCode">--> +<!-- <el-select v-model="queryParams.majorCode" placeholder="璇烽�夋嫨涓撲笟鍒嗙被" clearable>--> +<!-- <el-option--> +<!-- v-for="dict in dict.type.sys_job_status"--> +<!-- :key="dict.value"--> +<!-- :label="dict.label"--> +<!-- :value="dict.value"--> +<!-- />--> +<!-- </el-select>--> +<!-- </el-form-item>--> + + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['exam:online:add']" + >娣诲姞</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="mini" + :disabled="multiple" + @click="handleDelete" + v-hasPermi="['exam:online:delBatch']" + >鍒犻櫎</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="warning" + plain + icon="el-icon-search" + size="mini" + @click="handleExport" + v-hasPermi="['exam:online:exist']" + >鏌ラ噸</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="warning" + plain + icon="el-icon-upload2" + size="mini" + @click="handleExport" + v-hasPermi="['exam:online:upload']" + >瀵煎叆</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="info" + plain + icon="el-icon-download" + size="mini" + @click="" + v-hasPermi="['exam:online:download']" + >妯℃澘涓嬭浇</el-button> + </el-col> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <el-table v-loading="loading" :data="examList" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" align="left" /> + <el-table-column label="ID" align="left" prop="id" :show-overflow-tooltip="true" /> + <el-table-column label="褰掑睘" align="left" prop="parameter.orgName"/> + <el-table-column label="澶х被" align="left" prop="parameter.rootCatalogName"/> + <el-table-column label="瀛愬垎绫�" align="left" prop="parameter.majorCatalogName"/> + <el-table-column label="棰樼洰" align="left" prop="content" :show-overflow-tooltip="true" /> + <el-table-column label="璇曢绫诲瀷" align="left" prop="parameter.questionTypeName"/> + <el-table-column label="鍒涘缓浜�" align="left" prop="createUserId" :show-overflow-tooltip="true" /> + <el-table-column label="鍒涘缓鏃堕棿" align="left" prop="parameter.createTimeName" /> + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['exam:online:edit']" + >淇敼</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['exam:online:del']" + >鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + + <pagination + v-show="total>0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList" + /> + </el-col> + </el-row> + + <!-- 娣诲姞鎴栦慨鏀瑰畾鏃朵换鍔″璇濇 --> + <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body> + <el-form ref="form" :model="form" :rules="rules" label-width="120px"> + <el-row> + <el-col :span="24"> + <el-form-item label="鎵�灞炲垎绫�" prop="majorId"> + <el-select v-model="form.majorId" placeholder="璇烽�夋嫨鎵�灞炲垎绫�"> + <el-option + v-for="dict in dict.type.sys_job_group" + :key="dict.value" + :label="dict.label" + :value="dict.value" + ></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="棰樼洰绫诲瀷" prop="type"> + <el-select v-model="form.type" placeholder="璇烽�夋嫨棰樼洰绫诲瀷"> + <el-option + v-for="dict in dict.type.sys_job_group" + :key="dict.value" + :label="dict.label" + :value="dict.value" + ></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="棰樼洰" prop="content"> + <el-input v-model="form.content" placeholder="璇疯緭鍏ラ鐩�"/> + </el-form-item> + </el-col> + </el-row> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> + + <!-- 璇曢搴撹缁� --> + <el-dialog title="璇曢搴撹缁�" :visible.sync="openView" width="700px" append-to-body> + <el-form ref="form" :model="form" label-width="120px" size="mini"> + <el-row> + <el-col :span="12"> + <el-form-item label="鎵�灞炲垎绫伙細">{{ form.id }}</el-form-item> + <el-form-item label="棰樼洰绫诲瀷锛�">{{ form.jobName }}</el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="棰樼洰锛�">{{ "" }}</el-form-item> + <el-form-item label="绛旀锛�">{{ form.createTime }}</el-form-item> + </el-col> + </el-row> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button @click="openView = false">鍏� 闂�</el-button> + </div> + </el-dialog> + </div> +</template> + +<script> + // import { listJob, getJob, delJob, addJob, updateJob, runJob, changeJobStatus } from "@/api/monitor/job"; + import { listOrgRoot, listOrgRootTree } from '@/api/system/dept' + import { listCatalogTreeList, listQuestion, listQuestionType } from '@/api/etaa/question_bank' + + export default { + // components: { Crontab }, + name: "questionBank", + dicts: ['sys_job_status'], + data() { + return { + // 鏃ユ湡鑼冨洿 + dateRange: [], + // 閬僵灞� + loading: true, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // 琛ㄦ牸鏁版嵁 + examList: [], + + // 2022-12-30 鏍规満鏋勫垪琛紝涓汉鍙兘鍒楀嚭鑷繁鎵�鍦ㄦ牴鏈烘瀯 + rootOrgList:[], + // 2022-12-30 瓒呯骇绠$悊鍛橀�夋嫨鐨勯《绾ф満鏋処D + selectedRootOrgId: undefined, + // 璇曢绫诲埆鍒楄〃锛�2023-03-11 + questionTypeList: [], + // 2023-03-13 璇曢绫诲埆鏍戞暟鎹�夐」 + catalogListOptions: undefined, + /** 鍒嗙被鏍戞暟鎹粨鏋� */ + defaultProps: { + children: "children", + label: "label" + }, + + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 鏄惁鏄剧ず璇︾粏寮瑰嚭灞� + openView: false, + // 鏄惁鏄剧ずCron琛ㄨ揪寮忓脊鍑哄眰 + openCron: false, + // 浼犲叆鐨勮〃杈惧紡 + expression: "", + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + content: undefined, + catalogId: undefined, + orgId: undefined, + questionType: undefined + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + // 琛ㄥ崟鏍¢獙 + rules: { + content: [ + { required: true, message: "棰樼洰涓嶈兘涓虹┖", trigger: "blur" } + ] + } + }; + }, + created() { + this.getRootOrgList(); + this.getQuestionTypeList(); + }, + methods: { + /** 鑾峰彇璇曢绫诲埆闆嗗悎 2023-03-11 */ + getQuestionTypeList(){ + listQuestionType().then(response => { + // console.log(response.data); + this.questionTypeList = response.data; + }); + }, + /** 鑾峰彇椤剁骇鏈烘瀯鍒楄〃閫夋嫨妗� 2022-12-30 */ + getRootOrgList(){ + this.loading = true; + listOrgRoot().then(response => { + this.rootOrgList = response.data; + this.selectedRootOrgId = this.rootOrgList[0].id; + this.queryParams.orgId = this.selectedRootOrgId; + this.loading = false; + }).then(() => { + this.listCatalogTree(); + this.getList(); + }).catch(function() { + this.loading = false; + }); + }, + + // 璇曢绫诲埆鏍� + listCatalogTree(){ + listCatalogTreeList("question_root_catalog").then(response => { + console.log(response.data); + this.catalogListOptions = response.data; + }); + }, + + /** 鏌ヨ鍒楄〃 */ + getList() { + this.loading = true; + listQuestion(this.queryParams).then(response => { + this.examList = response.data; + this.total = response.total; + this.loading = false; + }); + }, + + // 绛涢�夎妭鐐� + filterNode(value, data) { + if (!value) return true; + console.log("value = " + value + ", data = " + data); + return data.label.indexOf(value) !== -1; + }, + // 鑺傜偣鍗曞嚮浜嬩欢 + handleNodeClick(data) { + this.queryParams.catalogId = data.id; + this.handleQuery(); + }, + + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + id: undefined, + content: undefined, + concurrent: 1, + status: "0" + }; + this.dateRange = [];// 鏃堕棿鑼冨洿 + this.resetForm("form"); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.resetForm("queryForm"); + this.queryParams.orgId = this.selectedRootOrgId; + this.queryParams.questionType = undefined; + this.handleQuery(); + }, + // 澶氶�夋閫変腑鏁版嵁 + handleSelectionChange(selection) { + this.ids = selection.map(item => item.id); + this.single = selection.length != 1; + this.multiple = !selection.length; + }, + // 鐘舵�佷慨鏀� + handleStatusChange(row) { + let text = row.status === "0" ? "鍚敤" : "鍋滅敤"; + this.$modal.confirm('纭瑕�"' + text + '""' + row.name + '"浠诲姟鍚楋紵').then(function() { + return changeJobStatus(row.id, row.status); + }).then(() => { + this.$modal.msgSuccess(text + "鎴愬姛"); + }).catch(function() { + row.status = row.status === "0" ? "1" : "0"; + }); + }, + /** 浠诲姟璇︾粏淇℃伅 */ + handleView(row) { + // getJob(row.id).then(response => { + // this.form = response.data; + // this.openView = true; + // }); + }, + /** 鏂板鎸夐挳鎿嶄綔 */ + handleAdd() { + this.reset(); + this.open = true; + this.title = "娣诲姞璇曢搴�"; + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate(row) { + this.reset(); + const id = row.id || this.ids; + getJob(id).then(response => { + this.form = response.data; + this.open = true; + this.title = "淇敼璇曢搴�"; + }); + }, + /** 鎻愪氦鎸夐挳 */ + submitForm: function() { + this.$refs["form"].validate(valid => { + if (valid) { + if (this.form.id != undefined) { + updateJob(this.form).then(response => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }); + } else { + addJob(this.form).then(response => { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }); + } + } + }); + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + const jobIds = row.id || this.ids; + this.$modal.confirm('鏄惁纭鍒犻櫎缂栧彿涓�"' + jobIds + '"鐨勬暟鎹」锛�').then(function() { + return delJob(jobIds); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => {}); + }, + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + this.download('monitor/job/export', { + ...this.queryParams + }, `job_${new Date().getTime()}.xlsx`) + } + } +}; +</script> -- Gitblit v1.9.1