Commit f6d2db76a7095e594808b04618047b04fffdf80d

Authored by yangzhi
1 parent b441010d

超哥牛皮皮

src/App.vue
... ... @@ -9,3 +9,8 @@ export default {
9 9 name: 'App'
10 10 }
11 11 </script>
  12 +<style lang="scss" scoped>
  13 +.flex{
  14 + display: flex;
  15 +}
  16 +</style>
... ...
src/api/QuestionClass.js 0 → 100644
  1 +import request from '@/utils/request'
  2 +export default {
  3 + deleteQuestionClass(id) {
  4 + return request({
  5 + url: `/QuestionClass/Delete?ids=${id}`,
  6 + method: 'post'
  7 + });
  8 + },
  9 +}
0 10 \ No newline at end of file
... ...
src/api/QuestionDimension.js 0 → 100644
  1 +import request from '@/utils/request'
  2 +export default {
  3 + getQuestionDimension(data) {
  4 + return request({
  5 + url: `/EvaluationRules/List`,
  6 + method: 'get',
  7 + params: data
  8 + });
  9 + },
  10 + deleteQuestionDimension(id) {
  11 + return request({
  12 + url: `/EvaluationRules/Delete?ids=${id}`,
  13 + method: 'post',
  14 + });
  15 + },
  16 +}
0 17 \ No newline at end of file
... ...
src/api/all.js 0 → 100644
  1 +import QuestionClassApi from './QuestionClass'
  2 +import QuestionDimension from './QuestionDimension'
  3 +export default {
  4 + ...QuestionClassApi,
  5 + ...QuestionDimension,
  6 +}
0 7 \ No newline at end of file
... ...
src/main.js
... ... @@ -14,6 +14,10 @@ import router from &#39;./router&#39;
14 14 import bus from '@/common/bus.js'
15 15 Vue.prototype.$bus = bus;
16 16  
  17 +
  18 +import api from '@/api/all'
  19 +Vue.prototype.API = api;
  20 +
17 21 import '@/icons' // icon
18 22 import '@/permission' // permission control
19 23  
... ... @@ -26,8 +30,8 @@ import &#39;@/permission&#39; // permission control
26 30 * please remove it before going online ! ! !
27 31 */
28 32 if (process.env.NODE_ENV === 'production') {
29   - const { mockXHR } = require('../mock')
30   - mockXHR()
  33 + const { mockXHR } = require('../mock')
  34 + mockXHR()
31 35 }
32 36  
33 37 // set ElementUI lang to EN
... ... @@ -38,8 +42,8 @@ Vue.use(ElementUI)
38 42 Vue.config.productionTip = false
39 43  
40 44 new Vue({
41   - el: '#app',
42   - router,
43   - store,
44   - render: h => h(App)
45   -})
  45 + el: '#app',
  46 + router,
  47 + store,
  48 + render: h => h(App)
  49 +})
46 50 \ No newline at end of file
... ...
src/utils/routerList.js
... ... @@ -59,7 +59,7 @@ export function getRoutes() {
59 59 title: '题库',
60 60 icon: 'table'
61 61 }
62   - }]
  62 + }, ]
63 63 },
64 64 // {
65 65 // path: '/moduleIndex',
... ... @@ -188,7 +188,7 @@ export function getRoutes() {
188 188 component: () =>
189 189 import ('@/views/user/userlist'),
190 190 meta: {
191   - title: '普通用户列表',
  191 + title: '人才库',
192 192 }
193 193 },
194 194 {
... ... @@ -302,7 +302,7 @@ export function getRoutes() {
302 302 title: '题库',
303 303 icon: 'table'
304 304 }
305   - }]
  305 + }, ]
306 306 },
307 307 {
308 308 path: '/moduleIndex',
... ... @@ -441,7 +441,7 @@ export function getRoutes() {
441 441 component: () =>
442 442 import ('@/views/user/userlist'),
443 443 meta: {
444   - title: '普通用户列表',
  444 + title: '人才库',
445 445 }
446 446 },
447 447  
... ...
src/views/QuestionBank/QuestionClass.vue 0 → 100644
  1 +<template>
  2 + <div>题目分类</div>
  3 +</template>
0 4 \ No newline at end of file
... ...
src/views/QuestionBank/QuestionDimension.vue 0 → 100644
  1 +<template>
  2 + <div class="app-container">
  3 + <div class="seetingsDiv" style="">
  4 + <el-button type="primary" @click="dialogAddTestPaperVIsible = true"
  5 + >添加维度
  6 + </el-button>
  7 + </div>
  8 + <el-table
  9 + :data="list"
  10 + id="QuestionTable"
  11 + border
  12 + style="
  13 + width: 100%;
  14 + border-radius: 5px;
  15 + box-shadow: 0 0 10px #efefef;
  16 + margin-top: 10px;
  17 + "
  18 + :stripe="true"
  19 + >
  20 + <el-table-column prop="date" label="ID" width="50">
  21 + <template slot-scope="scope">
  22 + <span>{{ scope.row.id }}</span>
  23 + </template>
  24 + </el-table-column>
  25 + <el-table-column prop="date" label="试卷标题" width="250">
  26 + <template slot-scope="scope">
  27 + <span>{{ scope.row.TestPaperTitle }}</span>
  28 + </template>
  29 + </el-table-column>
  30 + <el-table-column prop="date" label="试卷总分" width="80">
  31 + <template slot-scope="scope">
  32 + <span>{{ scope.row.TotalScore }}</span>
  33 + </template>
  34 + </el-table-column>
  35 + <el-table-column prop="date" label="单选题数量" width="100">
  36 + <template slot-scope="scope">
  37 + <span>{{ scope.row.SingleNumber }}</span>
  38 + </template>
  39 + </el-table-column>
  40 + <el-table-column prop="date" label="多选题数量" width="100">
  41 + <template slot-scope="scope">
  42 + <span>{{ scope.row.MultipleNumber }}</span>
  43 + </template>
  44 + </el-table-column>
  45 + <el-table-column prop="date" label="主观题数量" width="100">
  46 + <template slot-scope="scope">
  47 + <span>{{ scope.row.SubjectiveNumber }}</span>
  48 + </template>
  49 + </el-table-column>
  50 + <el-table-column prop="TestPaperClassId" label="分类" width="100">
  51 + <template slot-scope="scope">
  52 + <span>{{ scope.row.TestPaperClassId | typeFilters }}</span>
  53 + </template>
  54 + </el-table-column>
  55 + <el-table-column prop="name" label="原价" width="80" v-show="false">
  56 + <template slot-scope="scope">
  57 + <span>{{ scope.row.OriginalPrice / 100 }}</span>
  58 + </template>
  59 + </el-table-column>
  60 + <el-table-column prop="name" label="现价" width="80">
  61 + <template slot-scope="scope">
  62 + <span>{{ scope.row.PresentPrice / 100 }}</span>
  63 + </template>
  64 + </el-table-column>
  65 + <el-table-column prop="name" label="会员价" width="80" v-show="false">
  66 + <template slot-scope="scope">
  67 + <span>{{ scope.row.MembershipPrice / 100 }}</span>
  68 + </template>
  69 + </el-table-column>
  70 + <el-table-column
  71 + prop="name"
  72 + label="试卷说明"
  73 + :show-overflow-tooltip="true"
  74 + >
  75 + <template slot-scope="scope">
  76 + <span>{{ scope.row.Describe }}</span>
  77 + </template>
  78 + </el-table-column>
  79 + <el-table-column fixed="right" label="操作" width="150">
  80 + <template slot-scope="scope">
  81 + <el-dropdown
  82 + @command="
  83 + (e) => {
  84 + handleCommand(e, scope.row);
  85 + }
  86 + "
  87 + >
  88 + <span class="el-dropdown-link">
  89 + 操作<i class="el-icon-arrow-down el-icon--right"></i>
  90 + </span>
  91 + <template #dropdown>
  92 + <el-dropdown-menu>
  93 + <el-dropdown-item command="addquestion"
  94 + >题目维护</el-dropdown-item
  95 + >
  96 + <el-dropdown-item command="update">编辑</el-dropdown-item>
  97 + <!-- <el-dropdown-item command="b">锁定</el-dropdown-item> -->
  98 + <el-dropdown-item command="del">删除</el-dropdown-item>
  99 + </el-dropdown-menu>
  100 + </template>
  101 + </el-dropdown>
  102 + </template>
  103 + </el-table-column>
  104 + </el-table>
  105 + <el-pagination
  106 + background
  107 + @current-change="currentchange"
  108 + style="position: static; bottom: 3px; text-align: center; margin-top: 5px"
  109 + :page-size="this.parameter.pageSize"
  110 + layout="total,prev, pager, next"
  111 + :total="Count"
  112 + >
  113 + </el-pagination>
  114 + <el-dialog
  115 + title="添加维度基本信息"
  116 + :visible.sync="dialogAddTestPaperVIsible"
  117 + @close="closeClassDialog"
  118 + width="600px"
  119 + :close-on-click-modal="false"
  120 + >
  121 + <div class="grid-content bg-purple">
  122 + <el-form
  123 + ref="form"
  124 + class="testPaper-manager"
  125 + :model="TestPaper"
  126 + label-width="100px"
  127 + >
  128 + <el-form-item label="试卷名称:" class="el-form-item-custom">
  129 + <el-input
  130 + v-model="TestPaper.TestPaperTitle"
  131 + placeholder="请输入试卷标题"
  132 + ></el-input>
  133 + </el-form-item>
  134 + <el-form-item label="分类" class="el-form-item-custom">
  135 + <el-cascader
  136 + class="testpaper-input"
  137 + v-model="TestPaper.TestPaperClassId"
  138 + style="width: 400px"
  139 + :props="{ emitPath: false }"
  140 + :clearable="true"
  141 + :options="QuestionClass"
  142 + >
  143 + </el-cascader>
  144 + </el-form-item>
  145 + <el-form-item label="板块分类" class="el-form-item-custom">
  146 + <el-select
  147 + v-model="TestPaper.PlateClass"
  148 + placeholder="请选择板块分类"
  149 + >
  150 + <el-option label="面试题" value="4"></el-option>
  151 + </el-select>
  152 + </el-form-item>
  153 + <el-form-item label="试卷原价:" prop="OriginalPrice" v-show="false">
  154 + <el-input
  155 + class="testpaper-input"
  156 + oninput="value=value.replace(/[^0-9.]/g,'')"
  157 + v-model="TestPaper.OriginalPrice"
  158 + :precision="0"
  159 + >
  160 + <template slot="append">元</template>
  161 + </el-input>
  162 + </el-form-item>
  163 + <el-form-item label="试卷价格:" prop="PresentPrice">
  164 + <el-input
  165 + class="testpaper-input"
  166 + oninput="value=value.replace(/[^0-9.]/g,'')"
  167 + v-model="TestPaper.PresentPrice"
  168 + >
  169 + <template slot="append">元</template>
  170 + </el-input>
  171 + </el-form-item>
  172 + <el-form-item label="会员价:" prop="MembershipPrice" v-show="false">
  173 + <el-input
  174 + class="testpaper-input"
  175 + oninput="value=value.replace(/[^0-9.]/g,'')"
  176 + v-model="TestPaper.MembershipPrice"
  177 + >
  178 + <template slot="append">元</template>
  179 + </el-input>
  180 + </el-form-item>
  181 + <el-form-item label="试卷简介:">
  182 + <el-input
  183 + class="testpaper-input"
  184 + :rows="10"
  185 + type="textarea"
  186 + v-model="TestPaper.Describe"
  187 + >
  188 + </el-input>
  189 + </el-form-item>
  190 + <el-button
  191 + type="primary"
  192 + style="float: right"
  193 + @click="SubmitTestPaper"
  194 + >保存
  195 + </el-button>
  196 + <div style="clear: both"></div>
  197 + </el-form>
  198 + </div>
  199 + </el-dialog>
  200 + <el-dialog> </el-dialog>
  201 + </div>
  202 +</template>
  203 +
  204 +<script>
  205 +import {
  206 + getTestPaperList,
  207 + GetToplevel,
  208 + EditTestPaper,
  209 + TestPaperUpdate,
  210 + getTestPaperClassList,
  211 +} from "@/api/TestPaper";
  212 +let that;
  213 +export default {
  214 + data() {
  215 + return {
  216 + parameter: {
  217 + pageIndex: 1,
  218 + pageSize: 12,
  219 + sort: "id",
  220 + sortOrder: 1,
  221 + keyword: "",
  222 + status: 1,
  223 + },
  224 + Count: 0,
  225 + testpaperlist: [],
  226 + dialogAddTestPaperVIsible: false,
  227 + dialogQuestionVlsible: false,
  228 + QuestionClass: [],
  229 + TestPaper: {
  230 + TestPaperTitle: "",
  231 + PlateClass: 4,
  232 + TestPaperClassId: 0,
  233 + TotalScore: 0,
  234 + Describe: "",
  235 + SingleNumber: 0,
  236 + MultipleNumber: 0,
  237 + SubjectiveNumber: 0,
  238 + OriginalPrice: "0",
  239 + PresentPrice: "0",
  240 + MembershipPrice: "0",
  241 + QuestionBankIds: [],
  242 + },
  243 + treeData: [
  244 + {
  245 + value: 0,
  246 + label: "全部",
  247 + },
  248 + ],
  249 + value: "",
  250 + };
  251 + },
  252 + computed: {},
  253 + created() {
  254 + this.getList();
  255 + },
  256 + filters: {
  257 + typeFilters(val) {
  258 + const data = that.list.filter((t) => t.id == val)[0];
  259 + if (data) {
  260 + return data.ClassTitle;
  261 + } else {
  262 + return "未知";
  263 + }
  264 + },
  265 + },
  266 + beforeCreate() {
  267 + that = this;
  268 + },
  269 + mounted() {
  270 + let ContentAreaHight =
  271 + window.innerHeight - document.getElementById("QuestionTable").offsetTop;
  272 + let lineNumber = ContentAreaHight - 50 - 40;
  273 + this.parameter.pageSize = Math.floor(lineNumber / 49);
  274 + this.getTestPaperListHeadler();
  275 + this.getQuestionClassListHeadler();
  276 + },
  277 + methods: {
  278 + getList() {
  279 + this.API.getQuestionDimension(this.query).then((res) => {
  280 + this.list = res.data;
  281 + this.Count = res.data.totalCount;
  282 + });
  283 + },
  284 +
  285 + closeClassDialog() {
  286 + this.dialogAddTestPaperVIsible = false;
  287 + this.TestPaper = {
  288 + TestPaperTitle: "",
  289 + PlateClass: "4",
  290 + TestPaperClassId: 0,
  291 + TotalScore: 0,
  292 + Describe: "",
  293 + SingleNumber: 0,
  294 + MultipleNumber: 0,
  295 + SubjectiveNumber: 0,
  296 + OriginalPrice: "0",
  297 + PresentPrice: "0",
  298 + MembershipPrice: "0",
  299 + QuestionBankIds: [],
  300 + };
  301 + },
  302 + //添加试卷基本信息
  303 + SubmitTestPaper() {
  304 + if (this.value == "") {
  305 + EditTestPaper(this.TestPaper).then((res) => {
  306 + if (res.data.code == 200) {
  307 + this.$confirm("添加试卷基本信息成功!", "消息");
  308 + this.getTestPaperListHeadler();
  309 + this.dialogAddTestPaperVIsible = false;
  310 + } else {
  311 + this.$confirm("添加试卷基本信息失败!", "消息");
  312 + }
  313 + });
  314 + } else if (this.value == "update") {
  315 + TestPaperUpdate(this.TestPaper).then((res) => {
  316 + if (res.data.code == 200) {
  317 + this.$confirm("编辑试卷基本信息成功!", "消息");
  318 + this.getTestPaperListHeadler();
  319 + this.dialogAddTestPaperVIsible = false;
  320 + } else {
  321 + this.$confirm("编辑试卷基本信息失败!", "消息");
  322 + }
  323 + });
  324 + }
  325 + },
  326 + getTestPaperListHeadler() {
  327 + getTestPaperList(this.parameter).then((res) => {
  328 + this.testpaperlist = res.data.data;
  329 + this.Count = res.data.totalCount;
  330 + });
  331 + },
  332 + currentchange(page) {
  333 + this.parameter.pageIndex = page;
  334 + this.getTestPaperListHeadler();
  335 + },
  336 + getQuestionClassListHeadler() {
  337 + let _this = this;
  338 + GetToplevel().then((res) => {
  339 + var gettree = function (titem) {
  340 + titem.children = [];
  341 + let childrenList = res.data.data.filter(
  342 + (u) => u.ParentId == titem.value
  343 + );
  344 + if (childrenList.length == 0) titem.children = undefined;
  345 + res.data.data
  346 + .filter((u) => u.ParentId == titem.value)
  347 + .forEach((item, i) => {
  348 + var model = {
  349 + value: item.id,
  350 + label: item.ClassTitle,
  351 + };
  352 + gettree(model);
  353 + titem.children.push(model);
  354 + });
  355 + };
  356 + res.data.data
  357 + .filter((u) => u.ParentId == 0)
  358 + .forEach((item, i) => {
  359 + var model = {
  360 + value: item.id,
  361 + label: item.ClassTitle,
  362 + };
  363 + gettree(model);
  364 + _this.QuestionClass.push(model);
  365 + _this.treeData.push(model);
  366 + });
  367 + });
  368 + },
  369 + handleCommand(value, val) {
  370 + this.value = value;
  371 + if (value == "addquestion") {
  372 + console.log(val);
  373 + this.$router.push({
  374 + path: "/moduleIndex/index",
  375 + query: {
  376 + val: val.id,
  377 + },
  378 + });
  379 + } else if (value == "update") {
  380 + this.dialogAddTestPaperVIsible = true;
  381 + this.TestPaper = val;
  382 + }
  383 + },
  384 + },
  385 +};
  386 +</script>
  387 +
  388 +<style>
  389 +.seetingsDiv {
  390 + width: 100%;
  391 + height: 60px;
  392 + background: #efefef;
  393 + line-height: 60px;
  394 + border-radius: 5px;
  395 + box-shadow: 0 0 5px #cdcdcd;
  396 +}
  397 +
  398 +.seetingsDiv button {
  399 + background-color: #304156;
  400 + border: 0px;
  401 + margin-left: 10px;
  402 + box-shadow: 0 0 5px #cdcdcd;
  403 + float: right;
  404 + margin-top: 12px;
  405 + margin-right: 10px;
  406 +}
  407 +</style>
... ...
src/views/QuestionBank/index.vue
1 1 <template>
2   - <div class="app-container">
3   -
4   - <el-row id="elRow">
5   - <el-col :span="4" :style="{'height':TreeColHeight+'px'}">
6   - <div style="margin-right: 10px;height: 100%;">
7   - <div class="TreeHeader">
8   - <label style="font-size: 18px;">题目分类</label>
9   - </div>
10   - <div :style="{'height':TableColHeight+'px'}" class="areadiv"
11   - style="margin:10px 0 0 0;padding: 5px 0 0 0;">
12   - <el-tree :data="treeData" :props="treeData" @node-click="handleNodeClick" class="eltree"
13   - :expand-on-click-node=false>
14   - <span class="custom-tree-node" slot-scope="{ node, data }">
15   - <span>{{ node.label }}</span>
16   - <span style="">
17   - <el-button type="text" size="mini" @click="showClassDialog(node)">
18   - 添加下级
19   - </el-button>
20   - <el-button type="text" size="mini" @click="() => remove(node, data)">
21   - 删除本级
22   - </el-button>
23   - </span>
24   - </span>
25   - </el-tree>
26   - </div>
27   - </div>
28   - </el-col>
29   - <el-col :span="20">
30   - <div class="grid-content bg-purple-light">
31   - <div class="seetingsDiv" style="">
32   - <el-button type="primary" @click="dialogsubjectlVisible=true">添加题目
33   - </el-button>
34   - </div>
35   - <div class="areadiv" :style="{'height':TableColHeight+'px'}">
36   - <el-table :data="QuestList" id="QuestionTable" border
37   - style="width: 100%;border-radius: 5px;box-shadow: 0 0 10px #efefef;margin-top: 10px;"
38   - :header-cell-class-name="headerStyle" :stripe=true>
39   - <el-table-column prop="date" label="ID" width="50">
40   - <template slot-scope="scope">
41   - <span>{{ scope.row.id }}</span>
42   - </template>
43   - </el-table-column>
44   - <el-table-column prop="date" label="题目类型" width="100">
45   - <template slot-scope="scope">
46   - <span style="padding-left: 10px;">{{ scope.row.subjectName }}</span>
47   - </template>
48   - </el-table-column>
49   - <el-table-column prop="QuestionClassName" label="分类" width="100">
50   - <template slot-scope="scope">
51   - <span style="padding-left: 10px;">{{ scope.row.QuestionClassName }}</span>
52   - </template>
53   - </el-table-column>
54   - <el-table-column prop="name" label="分数" width="80">
55   - <template slot-scope="scope">
56   - <span style="padding-left: 10px;">{{ scope.row.fraction }}</span>
57   - </template>
58   - </el-table-column>
59   - <el-table-column prop="name" label="单项分数" width="80">
60   - <template slot-scope="scope">
61   - <span style="padding-left: 10px;">{{ scope.row.singleFraction }}</span>
62   - </template>
63   - </el-table-column>
64   - <el-table-column prop="name" label="正确答案" width="80">
65   - <template slot-scope="scope">
66   - <span style="padding-left: 10px;">{{ scope.row.answer }}</span>
67   - </template>
68   - </el-table-column>
69   - <el-table-column prop="name" label="题目" :show-overflow-tooltip=true>
70   - <template slot-scope="scope">
71   - <span style="padding-left: 10px;">{{ scope.row.subject }}</span>
72   - </template>
73   - </el-table-column>
74   - <el-table-column prop="name" label="解析" :show-overflow-tooltip=true>
75   - <template slot-scope="scope">
76   - <span style="padding-left: 10px;">{{ scope.row.analysis }}</span>
77   - </template>
78   - </el-table-column>
79   - <el-table-column fixed="right" label="操作" width="150">
80   - <template slot-scope="scope">
81   - <el-dropdown @command="(e)=>{handleCommand(e,scope.row.id)}"
82   - style="padding-left: 10px;">
83   - <span class="el-dropdown-link">
84   - 操作<i class="el-icon-arrow-down el-icon--right"></i>
85   - </span>
86   - <template #dropdown>
87   - <el-dropdown-menu>
88   - <el-dropdown-item command="update">编辑</el-dropdown-item>
89   - <!-- <el-dropdown-item command="b">锁定</el-dropdown-item> -->
90   - <el-dropdown-item command="del">删除</el-dropdown-item>
91   - </el-dropdown-menu>
92   - </template>
93   - </el-dropdown>
94   - </template>
95   - </el-table-column>
96   - </el-table>
97   - <el-pagination background @current-change="currentchange"
98   - style="position:static;bottom: 3px;text-align: center;margin-top: 5px;"
99   - :page-size="this.parameter.pageSize" layout="total,prev, pager, next" :total="Count">
100   - </el-pagination>
101   - <div style="clear: both;"></div>
102   - </div>
103   - </div>
104   - </el-col>
105   - </el-row>
106   - <el-dialog title="分类维护" :visible.sync="dialogClassIVIsible" @close="closeClassDialog" width="400px"
107   - :close-on-click-modal="false">
108   - <el-form ref="QuestionClassInfo" :model="QuestionClassInfo" label-width="70px">
109   - <el-form-item label="分类名称">
110   - <el-input v-model="QuestionClassInfo.ClassificationName" placeholder="请输入分类名称"></el-input>
111   - </el-form-item>
112   - </el-form>
113   - <el-button @click="CreateQuestionClassHealder" style="margin: 10px 0 0 0 ;float:right" type="primary">确定
114   - </el-button>
115   - <div style="clear: both;"></div>
116   - </el-dialog>
117   - <el-dialog title="编辑题目" :visible.sync="dialogsubjectlVisible" @close='closeDialog' width="800px"
118   - :close-on-click-modal="false">
119   - <el-form ref="Dataform" :model="Dataform" label-width="60px">
120   - <el-form-item label="题目">
121   - <el-input v-model="Dataform.subject" placeholder="请输入题目名称"></el-input>
122   - </el-form-item>
123   - <el-form-item label="分类" style="padding-top: 5px;">
124   - <el-cascader v-model="Dataform.QuestionClassId" style="width:400px" :props="{emitPath:false}"
125   - :clearable=true :options="QuestionClass">
126   - </el-cascader>
127   - </el-form-item>
128   - <el-form-item label="题型" style="padding-top: 5px;">
129   - <el-select v-model="Dataform.subjectType" value-key="Dataform.subjectType"
130   - @change="changeQuestionType" placeholder="请选择题型">
131   - <el-option label="单选题" :value="1"></el-option>
132   - <el-option label="多选题" :value="2"></el-option>
133   - <el-option label="主观题" :value="3"></el-option>
134   - </el-select>
135   - </el-form-item>
136   - <el-form-item label="选项" v-show="OptionVisible">
137   - <el-table :data="subjectContent" :show-header="false">
138   - <el-table-column>
139   - <template slot-scope="scope">
140   - <el-input placeholder="请输入答案" v-model="scope.row.optionContent" class="optionInput">
141   - <template slot="prepend">{{scope.row.option}}</template>
142   - </el-input>
143   - <i class="el-icon-circle-plus el-icon" @click="Addlist"></i>
144   - <i class="el-icon-remove el-icon" @click="RemoveList(scope)" v-if="scope.$index!=0"></i>
145   - </template>
146   - </el-table-column>
147   - </el-table>
148   - </el-form-item>
149   - <el-form-item label="答案" v-show="OptionVisible" class="subjectContentClass">
150   - <el-radio-group v-for="(item,i) in subjectContent" v-model="Dataform.answer" v-if="GroupVisible">
151   - <el-radio :label="item.option">{{item.option}}</el-radio>
152   - </el-radio-group>
153   - <el-checkbox-group v-for="(item,i) in subjectContent" v-model="Dataform.answer"
154   - v-if="!GroupVisible">
155   - <el-checkbox style="float: left;" :label="item.option">{{item.option}}</el-checkbox>
156   - </el-checkbox-group>
157   - </el-form-item>
158   - <el-form-item label="分数" v-show="OptionVisible">
159   - <el-input-number :step="1" style="float: left;" :min="0" v-model="Dataform.fraction">
160   - </el-input-number>
161   - <div style="float: left;margin-left: 20px;" v-if="!GroupVisible">
162   - <lable style="font-weight: bold;">单项分数:</lable>
163   - <el-input-number :step="0.5" :max="Dataform.fraction/2" :min="0"
164   - v-model="Dataform.singleFraction">
165   - </el-input-number>
166   - </div>
167   - </el-form-item>
168   - <el-form-item label="解析" style="margin-top: 10px;">
169   - <el-input v-model="Dataform.analysis" :rows="10" type="textarea" placeholder="请输入答案解析" />
170   - </el-form-item>
171   - </el-form>
172   - <el-button @click="EditQuestionHeadler" style="margin: 10px 0 0 0;float:right" type="primary">确定
173   - </el-button>
174   - <div style="clear: both;"></div>
175   - </el-dialog>
176   - </div>
  2 + <div class="app-container">
  3 + <el-row id="elRow">
  4 + <el-col :span="6" :style="{ height: TreeColHeight + 'px' }">
  5 + <div style="margin-right: 10px; height: 100%">
  6 + <div class="TreeHeader">
  7 + <label style="font-size: 18px">题目分类</label>
  8 + </div>
  9 + <div
  10 + :style="{ height: TableColHeight + 'px' }"
  11 + class="areadiv"
  12 + style="margin: 10px 0 0 0; padding: 5px 0 0 0"
  13 + >
  14 + <el-tabs
  15 + v-model="activeTab"
  16 + @tab-click="handleTabsClick"
  17 + style="padding: 0 20px"
  18 + :stretch="true"
  19 + >
  20 + <el-tab-pane label="专业类" name="first"></el-tab-pane>
  21 + <el-tab-pane label="测评类" name="second"></el-tab-pane>
  22 + </el-tabs>
  23 + <el-tree
  24 + :data="activeTab == 'first' ? firstTreeData : secondTreeData"
  25 + :props="activeTab == 'first' ? firstTreeData : secondTreeData"
  26 + @node-click="handleNodeClick"
  27 + class="eltree"
  28 + :expand-on-click-node="false"
  29 + >
  30 + <span class="custom-tree-node" slot-scope="{ node, data }">
  31 + <span>{{ node.label }}</span>
  32 + <span style="">
  33 + <el-button
  34 + type="text"
  35 + size="mini"
  36 + @click="showClassDialog(node)"
  37 + >
  38 + 添加下级
  39 + </el-button>
  40 + <el-button
  41 + type="text"
  42 + v-if="activeTab == 'second'"
  43 + @click="handleEditDimension(node, data)"
  44 + >编辑</el-button
  45 + >
  46 + <el-button
  47 + type="text"
  48 + size="mini"
  49 + @click="() => handleDeleteQuestionClass(node, data)"
  50 + >
  51 + 删除
  52 + </el-button>
  53 + </span>
  54 + </span>
  55 + </el-tree>
  56 + </div>
  57 + </div>
  58 + </el-col>
  59 + <el-col :span="18">
  60 + <div class="grid-content bg-purple-light">
  61 + <div class="seetingsDiv" style="">
  62 + <el-button type="primary" @click="dialogsubjectlVisible = true"
  63 + >添加题目
  64 + </el-button>
  65 + </div>
  66 + <div class="areadiv" :style="{ height: TableColHeight + 'px' }">
  67 + <el-table
  68 + :data="QuestList"
  69 + id="QuestionTable"
  70 + border
  71 + style="
  72 + width: 100%;
  73 + border-radius: 5px;
  74 + box-shadow: 0 0 10px #efefef;
  75 + margin-top: 10px;
  76 + "
  77 + :header-cell-class-name="headerStyle"
  78 + :stripe="true"
  79 + >
  80 + <el-table-column prop="date" label="ID" width="50">
  81 + <template slot-scope="scope">
  82 + <span>{{ scope.row.id }}</span>
  83 + </template>
  84 + </el-table-column>
  85 + <el-table-column prop="date" label="题目类型" width="100">
  86 + <template slot-scope="scope">
  87 + <span style="padding-left: 10px">{{
  88 + scope.row.subjectName
  89 + }}</span>
  90 + </template>
  91 + </el-table-column>
  92 + <el-table-column
  93 + prop="QuestionClassName"
  94 + label="分类"
  95 + width="100"
  96 + >
  97 + <template slot-scope="scope">
  98 + <span style="padding-left: 10px">{{
  99 + scope.row.QuestionClassName
  100 + }}</span>
  101 + </template>
  102 + </el-table-column>
  103 + <el-table-column prop="name" label="分数" width="80">
  104 + <template slot-scope="scope">
  105 + <span style="padding-left: 10px">{{
  106 + scope.row.fraction
  107 + }}</span>
  108 + </template>
  109 + </el-table-column>
  110 + <el-table-column prop="name" label="单项分数" width="80">
  111 + <template slot-scope="scope">
  112 + <span style="padding-left: 10px">{{
  113 + scope.row.singleFraction
  114 + }}</span>
  115 + </template>
  116 + </el-table-column>
  117 + <el-table-column prop="name" label="正确答案" width="80">
  118 + <template slot-scope="scope">
  119 + <span style="padding-left: 10px">{{ scope.row.answer }}</span>
  120 + </template>
  121 + </el-table-column>
  122 + <el-table-column
  123 + prop="name"
  124 + label="题目"
  125 + :show-overflow-tooltip="true"
  126 + >
  127 + <template slot-scope="scope">
  128 + <span style="padding-left: 10px">{{
  129 + scope.row.subject
  130 + }}</span>
  131 + </template>
  132 + </el-table-column>
  133 + <el-table-column
  134 + prop="name"
  135 + label="解析"
  136 + :show-overflow-tooltip="true"
  137 + >
  138 + <template slot-scope="scope">
  139 + <span style="padding-left: 10px">{{
  140 + scope.row.analysis
  141 + }}</span>
  142 + </template>
  143 + </el-table-column>
  144 + <el-table-column fixed="right" label="操作" width="150">
  145 + <template slot-scope="scope">
  146 + <el-dropdown
  147 + @command="
  148 + (e) => {
  149 + handleCommand(e, scope.row.id);
  150 + }
  151 + "
  152 + style="padding-left: 10px"
  153 + >
  154 + <span class="el-dropdown-link">
  155 + 操作<i class="el-icon-arrow-down el-icon--right"></i>
  156 + </span>
  157 + <template #dropdown>
  158 + <el-dropdown-menu>
  159 + <el-dropdown-item command="update"
  160 + >编辑</el-dropdown-item
  161 + >
  162 + <!-- <el-dropdown-item command="b">锁定</el-dropdown-item> -->
  163 + <el-dropdown-item command="del">删除</el-dropdown-item>
  164 + </el-dropdown-menu>
  165 + </template>
  166 + </el-dropdown>
  167 + </template>
  168 + </el-table-column>
  169 + </el-table>
  170 + <el-pagination
  171 + background
  172 + @current-change="currentchange"
  173 + style="
  174 + position: static;
  175 + bottom: 3px;
  176 + text-align: center;
  177 + margin-top: 5px;
  178 + "
  179 + :page-size="this.parameter.pageSize"
  180 + layout="total,prev, pager, next"
  181 + :total="Count"
  182 + >
  183 + </el-pagination>
  184 + <div style="clear: both"></div>
  185 + </div>
  186 + </div>
  187 + </el-col>
  188 + </el-row>
  189 + <el-dialog
  190 + title="分类维护"
  191 + :visible.sync="dialogClassIVIsible"
  192 + @close="closeClassDialog"
  193 + width="400px"
  194 + :close-on-click-modal="false"
  195 + >
  196 + <el-form
  197 + ref="QuestionClassInfo"
  198 + :model="QuestionClassInfo"
  199 + label-width="70px"
  200 + >
  201 + <el-form-item label="分类名称">
  202 + <el-input
  203 + v-model="QuestionClassInfo.ClassificationName"
  204 + placeholder="请输入分类名称"
  205 + ></el-input>
  206 + </el-form-item>
  207 + </el-form>
  208 + <el-button
  209 + @click="CreateQuestionClassHealder"
  210 + style="margin: 10px 0 0 0; float: right"
  211 + type="primary"
  212 + >确定
  213 + </el-button>
  214 + <div style="clear: both"></div>
  215 + </el-dialog>
  216 + <el-dialog
  217 + title="编辑题目"
  218 + :visible.sync="dialogsubjectlVisible"
  219 + @close="closeDialog"
  220 + width="800px"
  221 + :close-on-click-modal="false"
  222 + >
  223 + <el-form ref="Dataform" :model="Dataform" label-width="60px">
  224 + <el-form-item label="题目">
  225 + <el-input
  226 + v-model="Dataform.subject"
  227 + placeholder="请输入题目名称"
  228 + ></el-input>
  229 + </el-form-item>
  230 + <el-form-item label="分类" style="padding-top: 5px">
  231 + <el-cascader
  232 + v-model="Dataform.QuestionClassId"
  233 + style="width: 400px"
  234 + :props="{ emitPath: false }"
  235 + :clearable="true"
  236 + :options="QuestionClass"
  237 + >
  238 + </el-cascader>
  239 + </el-form-item>
  240 + <el-form-item label="题型" style="padding-top: 5px">
  241 + <el-select
  242 + v-model="Dataform.subjectType"
  243 + value-key="Dataform.subjectType"
  244 + @change="changeQuestionType"
  245 + placeholder="请选择题型"
  246 + >
  247 + <el-option label="单选题" :value="1"></el-option>
  248 + <el-option label="多选题" :value="2"></el-option>
  249 + <el-option label="主观题" :value="3"></el-option>
  250 + </el-select>
  251 + </el-form-item>
  252 + <el-form-item label="选项" v-show="OptionVisible">
  253 + <el-table :data="subjectContent" :show-header="false">
  254 + <el-table-column>
  255 + <template slot-scope="scope">
  256 + <el-input
  257 + placeholder="请输入答案"
  258 + v-model="scope.row.optionContent"
  259 + class="optionInput"
  260 + >
  261 + <template slot="prepend">{{ scope.row.option }}</template>
  262 + </el-input>
  263 + <i class="el-icon-circle-plus el-icon" @click="Addlist"></i>
  264 + <i
  265 + class="el-icon-remove el-icon"
  266 + @click="RemoveList(scope)"
  267 + v-if="scope.$index != 0"
  268 + ></i>
  269 + </template>
  270 + </el-table-column>
  271 + </el-table>
  272 + </el-form-item>
  273 + <el-form-item
  274 + label="答案"
  275 + v-show="OptionVisible"
  276 + class="subjectContentClass"
  277 + >
  278 + <el-radio-group
  279 + v-for="(item, i) in subjectContent"
  280 + v-model="Dataform.answer"
  281 + v-if="GroupVisible"
  282 + >
  283 + <el-radio :label="item.option">{{ item.option }}</el-radio>
  284 + </el-radio-group>
  285 + <el-checkbox-group
  286 + v-for="(item, i) in subjectContent"
  287 + v-model="Dataform.answer"
  288 + v-if="!GroupVisible"
  289 + >
  290 + <el-checkbox style="float: left" :label="item.option">{{
  291 + item.option
  292 + }}</el-checkbox>
  293 + </el-checkbox-group>
  294 + </el-form-item>
  295 + <el-form-item label="分数" v-show="OptionVisible">
  296 + <el-input-number
  297 + :step="1"
  298 + style="float: left"
  299 + :min="0"
  300 + v-model="Dataform.fraction"
  301 + >
  302 + </el-input-number>
  303 + <div style="float: left; margin-left: 20px" v-if="!GroupVisible">
  304 + <lable style="font-weight: bold">单项分数:</lable>
  305 + <el-input-number
  306 + :step="0.5"
  307 + :max="Dataform.fraction / 2"
  308 + :min="0"
  309 + v-model="Dataform.singleFraction"
  310 + >
  311 + </el-input-number>
  312 + </div>
  313 + </el-form-item>
  314 + <el-form-item label="解析" style="margin-top: 10px">
  315 + <el-input
  316 + v-model="Dataform.analysis"
  317 + :rows="10"
  318 + type="textarea"
  319 + placeholder="请输入答案解析"
  320 + />
  321 + </el-form-item>
  322 + </el-form>
  323 + <el-button
  324 + @click="EditQuestionHeadler"
  325 + style="margin: 10px 0 0 0; float: right"
  326 + type="primary"
  327 + >确定
  328 + </el-button>
  329 + <div style="clear: both"></div>
  330 + </el-dialog>
  331 + <EditDimension ref="editDimensionDialog" :model="currentEditDimension"></EditDimension>
  332 + </div>
177 333 </template>
178 334  
179 335 <script lang="ts">
180   - import {
181   - getQuestionList,
182   - EditQuestion,
183   - getQuestionClassList,
184   - DelQuestionBankEvent,
185   - GetQuestionBankById,
186   - CreateQuestionClass
187   - } from '@/api/QuestionBank'
188   - import {
189   - parseTime
190   - } from '@/utils/index.js'
191   - export default {
192   - filters: {},
193   - data() {
194   - return {
195   - parameter: {
196   - pageIndex: 1,
197   - pageSize: 12,
198   - sort: "id",
199   - sortOrder: 1,
200   - keyword: "",
201   - QuestionClassId: 0,
202   - status: 1
203   - },
204   - Count: 0,
205   - QuestList: [],
206   - dialogsubjectlVisible: false,
207   - dialogClassIVIsible: false,
208   - OptionVisible: true,
209   - GroupVisible: true,
210   - Dataform: {
211   - subject: "",
212   - subjectType: 1,
213   - subjectContent: "",
214   - QuestionClassId: 0,
215   - answer: [],
216   - analysis: "",
217   - fraction: 0,
218   - singleFraction: 0,
219   - addTime: "2021-11-12",
220   - state: 1
221   - },
222   - subjectContent: [{
223   - option: "A",
224   - optionContent: ""
225   - }],
226   - QuestionClass: [],
227   - QuestionClassInfo: {
228   - ParentId: 0,
229   - ClassificationName: "",
230   - Addtime: ""
231   - },
232   - TreeColHeight: 0,
233   - TableColHeight: 0,
234   - treeData: [{
235   - value: 0,
236   - label: "全部"
237   - }],
238   - CreatClassId: 0
239   - }
240   - },
241   - created() {
242   -
243   - },
244   - mounted() {
245   - let ContentAreaHight = window.innerHeight - document.getElementById("elRow").offsetTop - 70;
246   - this.TableColHeight = ContentAreaHight - document.getElementById("QuestionTable").offsetTop;
247   - let lineNumber = this.TableColHeight - 50 - 20; //减去表头来计算
248   - this.TreeColHeight = ContentAreaHight;
249   - lineNumber = Math.floor(lineNumber / 49)
250   - this.parameter.pageSize = lineNumber;
251   - this.GetList();
252   - this.getQuestionClassListHeadler();
253   - },
254   - methods: {
255   - closeClassDialog(){
256   - this.dialogClassIVIsible=false
  336 +import {
  337 + getQuestionList,
  338 + EditQuestion,
  339 + getQuestionClassList,
  340 + DelQuestionBankEvent,
  341 + GetQuestionBankById,
  342 + CreateQuestionClass,
  343 +} from "@/api/QuestionBank";
  344 +import { parseTime } from "@/utils/index.js";
  345 +import EditDimension from "./components/EditDimension.vue";
  346 +export default {
  347 + filters: {},
  348 + components: {
  349 + EditDimension,
  350 + },
  351 + data() {
  352 + return {
  353 + currentEditDimension:{},
  354 + activeTab: "first",
  355 + parameter: {
  356 + pageIndex: 1,
  357 + pageSize: 12,
  358 + sort: "id",
  359 + sortOrder: 1,
  360 + keyword: "",
  361 + QuestionClassId: 0,
  362 + status: 1,
  363 + },
  364 + Count: 0,
  365 + QuestList: [],
  366 + dialogsubjectlVisible: false,
  367 + dialogClassIVIsible: false,
  368 + OptionVisible: true,
  369 + GroupVisible: true,
  370 + Dataform: {
  371 + subject: "",
  372 + subjectType: 1,
  373 + subjectContent: "",
  374 + QuestionClassId: 0,
  375 + answer: [],
  376 + analysis: "",
  377 + fraction: 0,
  378 + singleFraction: 0,
  379 + addTime: "2021-11-12",
  380 + state: 1,
  381 + },
  382 + subjectContent: [
  383 + {
  384 + option: "A",
  385 + optionContent: "",
  386 + },
  387 + ],
  388 + QuestionClass: [],
  389 + QuestionClassInfo: {
  390 + ParentId: 0,
  391 + ClassificationName: "",
  392 + Addtime: "",
257 393 },
258   - //表格右边的操作按钮
259   - handleCommand(value, val) {
260   - if (value == "update") {
261   - this.GetQuestionBankByIdHeadler(val);
262   - }
263   - if (value == "del") {
264   - this.DelQuestionBankEventHeadler(val);
265   - }
266   - },
267   - //添加分类
268   - CreateQuestionClassHealder() {
269   - this.QuestionClassInfo.Addtime = parseTime(new Date(), "");
270   - CreateQuestionClass(this.QuestionClassInfo).then(res => {
271   - alert(res.code)
272   - })
273   - },
274   - //获取选择的题目详细信息
275   - GetQuestionBankByIdHeadler(id) {
276   - GetQuestionBankById(id).then(res => {
277   - this.changeQuestionType(res.data.data.subjectType); //这里先初始化编辑显示内容
278   - this.Dataform = res.data.data; //内容赋值
279   - this.subjectContent = JSON.parse(res.data.data.subjectContent); //赋值选项
280   - if (res.data.data.subjectType == 1) {
281   - this.Dataform.answer = res.data.data.answer.split(',')[0]; //赋值答案
282   - } else {
283   - this.Dataform.answer = res.data.data.answer.split(','); //赋值答案
284   - }
285   - this.dialogsubjectlVisible = true;
  394 + TreeColHeight: 0,
  395 + TableColHeight: 0,
  396 + treeData: [],
  397 + firstTreeData: [],
  398 + secondTreeData: [],
  399 + CreatClassId: 0,
  400 + };
  401 + },
  402 + created() {},
  403 + mounted() {
  404 + let ContentAreaHight =
  405 + window.innerHeight - document.getElementById("elRow").offsetTop - 70;
  406 + this.TableColHeight =
  407 + ContentAreaHight - document.getElementById("QuestionTable").offsetTop;
  408 + let lineNumber = this.TableColHeight - 50 - 20; //减去表头来计算
  409 + this.TreeColHeight = ContentAreaHight;
  410 + lineNumber = Math.floor(lineNumber / 49);
  411 + this.parameter.pageSize = lineNumber;
  412 + this.GetList();
  413 + this.getQuestionClassListHeadler();
  414 + },
  415 + methods: {
  416 + //维度编辑
  417 + handleEditDimension(node,data) {
  418 + console.log(data);
  419 + this.$refs.editDimensionDialog.dialogFormVisible = true;
  420 + this.currentEditDimension = data;
  421 + },
  422 + //切换分类
  423 + handleTabsClick(e) {
  424 + console.log(e.name);
  425 + },
  426 + //删除分类
  427 + handleDeleteQuestionClass(node, data) {
  428 + console.log(node, data);
  429 + console.log(this.API);
  430 + this.API.deleteQuestionClass(data.value).then((res) => {
  431 + this.getQuestionClassListHeadler();
  432 + });
  433 + },
  434 + closeClassDialog() {
  435 + this.dialogClassIVIsible = false;
  436 + },
  437 + //表格右边的操作按钮
  438 + handleCommand(value, val) {
  439 + if (value == "update") {
  440 + this.GetQuestionBankByIdHeadler(val);
  441 + }
  442 + if (value == "del") {
  443 + this.DelQuestionBankEventHeadler(val);
  444 + }
  445 + },
  446 + //添加分类
  447 + CreateQuestionClassHealder() {
  448 + this.QuestionClassInfo.Addtime = parseTime(new Date(), "");
  449 + CreateQuestionClass(this.QuestionClassInfo).then((res) => {
  450 + // alert(res.code);
  451 + });
  452 + },
  453 + //获取选择的题目详细信息
  454 + GetQuestionBankByIdHeadler(id) {
  455 + GetQuestionBankById(id).then((res) => {
  456 + this.changeQuestionType(res.data.data.subjectType); //这里先初始化编辑显示内容
  457 + this.Dataform = res.data.data; //内容赋值
  458 + this.subjectContent = JSON.parse(res.data.data.subjectContent); //赋值选项
  459 + if (res.data.data.subjectType == 1) {
  460 + this.Dataform.answer = res.data.data.answer.split(",")[0]; //赋值答案
  461 + } else {
  462 + this.Dataform.answer = res.data.data.answer.split(","); //赋值答案
  463 + }
  464 + this.dialogsubjectlVisible = true;
  465 + });
  466 + },
  467 + showClassDialog(node) {
  468 + this.dialogClassIVIsible = true;
  469 + console.log(node);
  470 + this.QuestionClassInfo.ParentId = node.data.value;
  471 + // alert(this.QuestionClassInfo.ParentId);
  472 + },
  473 + //关闭弹框的事件
  474 + closeDialog() {
  475 + //初始化数据
  476 + this.Dataform = this.$options.data().Dataform;
  477 + this.subjectContent = this.$options.data().subjectContent;
  478 + //所有文本框恢复到初始化状态
  479 + this.Dataform.answer = [];
  480 + this.OptionVisible = true;
  481 + this.GroupVisible = true;
  482 + },
  483 + //选择题目类型来判断是否显示部分表单
  484 + changeQuestionType(val) {
  485 + if (val == 3) {
  486 + this.OptionVisible = false;
  487 + }
  488 + if (val == 2) {
  489 + this.OptionVisible = true;
  490 + this.Dataform.answer = [];
  491 + this.GroupVisible = false;
  492 + }
  493 + if (val == 1) {
  494 + this.Dataform.answer = [];
  495 + this.OptionVisible = true;
  496 + this.GroupVisible = true;
  497 + }
  498 + },
  499 + headerStyle({ row, column, rowIndex, columnIndex }) {
  500 + return "tableStyle";
  501 + },
  502 + Addlist() {
  503 + if (this.subjectContent.length < 4) {
  504 + var alphabet = String.fromCharCode(
  505 + 64 + parseInt(this.subjectContent.length + 1)
  506 + );
  507 + this.subjectContent.push({
  508 + option: alphabet,
  509 + title: "",
  510 + });
  511 + } else {
  512 + this.$confirm("系统暂时只支持4个答案!", "消息");
  513 + }
  514 + },
  515 + RemoveList(val) {
  516 + this.subjectContent.splice(val.$index, 1);
  517 + this.subjectContent.forEach((item, index) => {
  518 + item.option = String.fromCharCode(64 + parseInt(index + 1));
  519 + });
  520 + },
  521 + handleNodeClick(val) {
  522 + this.parameter.QuestionClassId = val.value;
  523 + this.parameter.pageIndex = 1;
  524 + this.GetList();
  525 + },
  526 + DelQuestionBankEventHeadler(id) {
  527 + this.$confirm("确定删除该试题?", "消息", {
  528 + confirmButtonText: "确认",
  529 + cancelButtonText: "取消",
  530 + callback: (action) => {
  531 + if (action == "confirm") {
  532 + DelQuestionBankEvent(id).then((res) => {
  533 + if (res.data.code == 200) {
  534 + this.$confirm(res.data.message, "消息");
  535 + this.GetList();
  536 + }
  537 + });
  538 + }
  539 + },
  540 + });
  541 + },
  542 + EditQuestionHeadler() {
  543 + let reg = new RegExp('"', "g");
  544 + //this.Dataform.subjectContent = JSON.stringify(this.subjectContent).replace(reg, "\"");
  545 + this.Dataform.subjectContent = this.subjectContent;
  546 + if (typeof this.Dataform.answer != "string")
  547 + //判断是否为字符串
  548 + this.Dataform.answer = this.Dataform.answer.join(",");
  549 + var _this = this;
  550 + EditQuestion(this.Dataform).then((res) => {
  551 + if (res.data.code == 200) {
  552 + _this.GetList();
  553 + this.$message(res.data.message);
  554 + setTimeout(function () {
  555 + _this.dialogsubjectlVisible = false;
  556 + }, 10);
  557 + }
  558 + });
  559 + },
  560 + GetList() {
  561 + let _this = this;
  562 + getQuestionList(_this.parameter).then((res) => {
  563 + _this.QuestList = res.data.data.rows;
  564 + _this.Count = res.data.data.total;
  565 + _this.$forceUpdate();
  566 + });
  567 + },
  568 + currentchange(page) {
  569 + this.parameter.pageIndex = page;
  570 + this.GetList();
  571 + },
  572 + getSubTree(id, list) {
  573 + let result = [];
  574 + result = list.filter((t) => t.ParentId == id);
  575 + if (result.length) {
  576 + result = result.map((item) => {
  577 + item.children = this.getSubTree(item.id, list);
  578 + return item;
  579 + });
  580 + }
  581 + return result;
  582 + },
  583 + getQuestionClassListHeadler() {
  584 + let _this = this;
  585 + getQuestionClassList().then((res) => {
  586 + let list = res.data.data;
  587 + list = list.map((t) => {
  588 + t.value = t.id;
  589 + t.label = t.ClassificationName;
  590 + return t;
  591 + });
  592 + let firstClass = list.find((t) => t.id == 6);
  593 + firstClass.children = this.getSubTree(6, list);
  594 + let secondClass = list.find((t) => t.id == 1);
  595 + secondClass.children = this.getSubTree(1, list);
  596 + this.QuestionClass = list;
286 597  
287   - });
288   - },
289   - showClassDialog(node) {
290   - this.dialogClassIVIsible = true;
291   - console.log(node);
292   - this.QuestionClassInfo.ParentId = node.data.value;
293   - alert(this.QuestionClassInfo.ParentId);
294   - },
295   - //关闭弹框的事件
296   - closeDialog() {
297   - //初始化数据
298   - this.Dataform = this.$options.data().Dataform;
299   - this.subjectContent = this.$options.data().subjectContent;
300   - //所有文本框恢复到初始化状态
301   - this.Dataform.answer = [];
302   - this.OptionVisible = true;
303   - this.GroupVisible = true;
304   - },
305   - //选择题目类型来判断是否显示部分表单
306   - changeQuestionType(val) {
307   - if (val == 3) {
308   - this.OptionVisible = false;
309   - }
310   - if (val == 2) {
311   - this.OptionVisible = true;
312   - this.Dataform.answer = [];
313   - this.GroupVisible = false;
314   - }
315   - if (val == 1) {
316   - this.Dataform.answer = [];
317   - this.OptionVisible = true;
318   - this.GroupVisible = true;
319   - }
320   - },
321   - headerStyle({
322   - row,
323   - column,
324   - rowIndex,
325   - columnIndex
326   - }) {
327   - return 'tableStyle'
328   - },
329   - Addlist() {
330   - if (this.subjectContent.length < 4) {
331   - var alphabet = String.fromCharCode(64 + parseInt(this.subjectContent.length + 1));
332   - this.subjectContent.push({
333   - "option": alphabet,
334   - "title": ""
335   - });
336   - } else {
337   - this.$confirm('系统暂时只支持4个答案!', '消息')
338   - }
339   - },
340   - RemoveList(val) {
341   - this.subjectContent.splice(val.$index, 1);
342   - this.subjectContent.forEach((item, index) => {
343   - item.option = String.fromCharCode(64 + parseInt(index + 1));
344   - })
345   - },
346   - handleNodeClick(val) {
347   - this.parameter.QuestionClassId = val.value;
348   - this.parameter.pageIndex = 1;
349   - this.GetList();
350   - },
351   - DelQuestionBankEventHeadler(id) {
352   - this.$confirm('确定删除该试题?', '消息', {
353   - confirmButtonText: '确认',
354   - cancelButtonText: '取消',
355   - callback: (action) => {
356   - if (action == "confirm") {
357   - DelQuestionBankEvent(id).then(res => {
358   - if (res.data.code == 200) {
359   - this.$confirm(res.data.message, '消息')
360   - this.GetList();
361   - }
362   - });
363   - }
364   - },
365   - })
366   - },
367   - EditQuestionHeadler() {
368   - let reg = new RegExp('"', 'g');
369   - //this.Dataform.subjectContent = JSON.stringify(this.subjectContent).replace(reg, "\"");
370   - this.Dataform.subjectContent = this.subjectContent;
371   - if (typeof(this.Dataform.answer) != 'string') //判断是否为字符串
372   - this.Dataform.answer = this.Dataform.answer.join(',')
373   - var _this = this;
374   - EditQuestion(this.Dataform).then(res => {
375   - if (res.data.code == 200) {
376   - _this.GetList();
377   - this.$message(res.data.message);
378   - setTimeout(function() {
379   - _this.dialogsubjectlVisible = false;
380   - }, 10)
381   - }
382   - });
383   - },
384   - GetList() {
385   - let _this = this;
386   - getQuestionList(_this.parameter).then(res => {
387   - _this.QuestList = res.data.data.rows;
388   - _this.Count = res.data.data.total;
389   - _this.$forceUpdate();
390   - });
391   - },
392   - currentchange(page) {
393   - this.parameter.pageIndex = page;
394   - this.GetList();
395   - },
396   - getQuestionClassListHeadler() {
397   - let _this = this;
398   - getQuestionClassList().then(res => {
399   - var gettree = function(titem) {
400   - titem.children = []
401   - let childrenList = res.data.data.filter(u => u.ParentId == titem.value);
402   - if (childrenList.length == 0)
403   - titem.children = undefined;
404   - res.data.data.filter(u => u.ParentId == titem.value).forEach((item, i) => {
405   - var model = {
406   - value: item.id,
407   - label: item.ClassificationName
408   - };
409   - gettree(model);
410   - titem.children.push(model);
411   - })
412   - }
413   - res.data.data.filter(u => u.ParentId == 0).forEach((item, i) => {
414   - var model = {
415   - value: item.id,
416   - label: item.ClassificationName
417   - };
418   - gettree(model);
419   - _this.QuestionClass.push(model);
420   - _this.treeData.push(model)
421   - })
422   - });
423   - }
424   - }
425   - }
  598 + this.firstTreeData = [firstClass];
  599 + this.secondTreeData = [secondClass];
  600 + });
  601 + },
  602 + },
  603 +};
426 604 </script>
427 605 <style scoped="scoped">
428   - /deep/.cell {
429   - padding-left: 0px;
430   - }
431   - /deep/.el-form-item {
432   - margin-bottom: 5px;
433   - }
434   - /deep/.el-radio {
435   - margin-right: 10px;
436   - }
437   - /deep/.el-radio__input.is-checked .el-radio__inner {
438   - border-color: #409EFF;
439   - background-color: #409EFF;
440   - }
441   - /deep/.el-radio__input.is-checked+.el-radio__label {
442   - color: #409EFF;
443   - font-weight: bold;
444   - }
445   - /deep/.tableStyle {
446   - background-color: #304156 !important;
447   - color: #fff;
448   - font-weight: 400;
449   - }
450   - .QuestDiv {
451   - width: 24%;
452   - float: left;
453   - min-height: 50px;
454   - border: 1px solid #CDCDCD;
455   - margin-right: 10px;
456   - box-shadow: 0 0 10px #808080;
457   - border-radius: 8px;
458   - min-height: 100px;
459   - background-color: #FFF;
460   - opacity: 0.8;
461   - margin-bottom: 10px;
462   - height: 313px;
463   - }
464   - .clear {
465   - clear: both;
466   - margin-bottom: 10px;
467   - }
468   - .font-color {
469   - background-color: #AE1E15 !important;
470   - color: #FFF;
471   - box-shadow: 0 0 5px #AE1E15;
472   - }
473   - /deep/.el-input-group__prepend {
474   - font-weight: bold;
475   - width: 30px;
476   - text-align: center;
477   - background: #409EFF;
478   - color: #FFF;
479   - }
480   - .optionInput {
481   - float: left;
482   - width: 620px !important;
483   - }
484   - .el-icon {
485   - font-size: 20px;
486   - line-height: 40px;
487   - margin: 0 5px;
488   - cursor: pointer;
489   - color: #409EFF !important;
490   - }
491   - >>>.subjectContentClass .el-checkbox__label {
492   - padding-right: 10px !important;
493   - }
494   - .seetingsDiv {
495   - width: 100%;
496   - height: 60px;
497   - background: #efefef;
498   - line-height: 60px;
499   - border-radius: 5px;
500   - box-shadow: 0 0 5px #cdcdcd;
501   - }
502   - .seetingsDiv button {
503   - background-color: #304156;
504   - border: 0px;
505   - margin-left: 10px;
506   - box-shadow: 0 0 5px #cdcdcd;
507   - float: right;
508   - margin-top: 12px;
509   - margin-right: 10px;
510   - }
511   - .areadiv {
512   - background-color: #efefef;
513   - border-radius: 5px;
514   - box-shadow: 0 0 5px #efefef;
515   - }
516   - .TreeHeader {
517   - background-color: #304156;
518   - height: 60px;
519   - border-radius: 5px;
520   - box-shadow: 0 0 10px #efefef;
521   - line-height: 60px;
522   - color: #FFF;
523   - padding-left: 10px;
524   - }
525   - .classbtn {
526   - float: right;
527   - margin: 11px 10px 0 0;
528   - height: 35px;
529   - line-height: 12px;
530   - }
531   - .eltree {
532   - background-color: #efefef;
533   - }
534   - /deep/.el-tree-node__content {
535   - min-height: 40px;
536   - }
537   - .custom-tree-node {
538   - flex: 1;
539   - display: flex;
540   - align-items: center;
541   - justify-content: space-between;
542   - font-size: 14px;
543   - padding-right: 8px;
544   - }
  606 +/deep/.cell {
  607 + padding-left: 0px;
  608 +}
  609 +/deep/.el-form-item {
  610 + margin-bottom: 5px;
  611 +}
  612 +/deep/.el-radio {
  613 + margin-right: 10px;
  614 +}
  615 +/deep/.el-radio__input.is-checked .el-radio__inner {
  616 + border-color: #409eff;
  617 + background-color: #409eff;
  618 +}
  619 +/deep/.el-radio__input.is-checked + .el-radio__label {
  620 + color: #409eff;
  621 + font-weight: bold;
  622 +}
  623 +/deep/.tableStyle {
  624 + background-color: #304156 !important;
  625 + color: #fff;
  626 + font-weight: 400;
  627 +}
  628 +.QuestDiv {
  629 + width: 24%;
  630 + float: left;
  631 + min-height: 50px;
  632 + border: 1px solid #cdcdcd;
  633 + margin-right: 10px;
  634 + box-shadow: 0 0 10px #808080;
  635 + border-radius: 8px;
  636 + min-height: 100px;
  637 + background-color: #fff;
  638 + opacity: 0.8;
  639 + margin-bottom: 10px;
  640 + height: 313px;
  641 +}
  642 +.clear {
  643 + clear: both;
  644 + margin-bottom: 10px;
  645 +}
  646 +.font-color {
  647 + background-color: #ae1e15 !important;
  648 + color: #fff;
  649 + box-shadow: 0 0 5px #ae1e15;
  650 +}
  651 +/deep/.el-input-group__prepend {
  652 + font-weight: bold;
  653 + width: 30px;
  654 + text-align: center;
  655 + background: #409eff;
  656 + color: #fff;
  657 +}
  658 +.optionInput {
  659 + float: left;
  660 + width: 620px !important;
  661 +}
  662 +.el-icon {
  663 + font-size: 20px;
  664 + line-height: 40px;
  665 + margin: 0 5px;
  666 + cursor: pointer;
  667 + color: #409eff !important;
  668 +}
  669 +>>> .subjectContentClass .el-checkbox__label {
  670 + padding-right: 10px !important;
  671 +}
  672 +.seetingsDiv {
  673 + width: 100%;
  674 + height: 60px;
  675 + background: #efefef;
  676 + line-height: 60px;
  677 + border-radius: 5px;
  678 + box-shadow: 0 0 5px #cdcdcd;
  679 +}
  680 +.seetingsDiv button {
  681 + background-color: #304156;
  682 + border: 0px;
  683 + margin-left: 10px;
  684 + box-shadow: 0 0 5px #cdcdcd;
  685 + float: right;
  686 + margin-top: 12px;
  687 + margin-right: 10px;
  688 +}
  689 +.areadiv {
  690 + background-color: #efefef;
  691 + border-radius: 5px;
  692 + box-shadow: 0 0 5px #efefef;
  693 +}
  694 +.TreeHeader {
  695 + background-color: #304156;
  696 + height: 60px;
  697 + border-radius: 5px;
  698 + box-shadow: 0 0 10px #efefef;
  699 + line-height: 60px;
  700 + color: #fff;
  701 + padding-left: 10px;
  702 +}
  703 +.classbtn {
  704 + float: right;
  705 + margin: 11px 10px 0 0;
  706 + height: 35px;
  707 + line-height: 12px;
  708 +}
  709 +.eltree {
  710 + background-color: #efefef;
  711 +}
  712 +/deep/.el-tree-node__content {
  713 + min-height: 40px;
  714 +}
  715 +.custom-tree-node {
  716 + flex: 1;
  717 + display: flex;
  718 + align-items: center;
  719 + justify-content: space-between;
  720 + font-size: 14px;
  721 + padding-right: 8px;
  722 +}
545 723 </style>
... ...
src/views/user/userlist.vue
1 1 <template>
2 2 <div class="app-container">
3   - <!-- <el-upload class="upload-demo" action="/api/Account/ImportUser" :on-preview="handlePreview"
4   - :on-remove="handleRemove" :before-remove="beforeRemove" multiple :limit="3" :on-exceed="handleExceed"
5   - :file-list="fileList">
6   - <el-button size="small" type="primary">导入用户</el-button>
7   - </el-upload> -->
8   - <el-table :data="userList" id="QuestionTable" border
9   - style="width: 100%;border-radius: 5px;box-shadow: 0 0 10px #efefef;margin-top: 10px;" :stripe='true'>
10   - <el-table-column type="index" prop="date" width="50" align="center"></el-table-column>
  3 + <div class="seetingsDiv" style="">
  4 + <div class="flex">
  5 + <el-input placeholder="输入关键字搜索" v-model="query.keyword"></el-input>
  6 + <el-button type="success" @click="search">搜索</el-button>
  7 + <el-button v-if="selectedList.length" type="primary" @click="handleInviteInterview"
  8 + >邀请面试</el-button
  9 + >
  10 + </div>
  11 + <el-upload
  12 + class="upload-demo"
  13 + action="/api/Account/ImportUser"
  14 + multiple
  15 + :limit="3"
  16 + :on-exceed="handleExceed"
  17 + :file-list="fileList"
  18 + >
  19 + <el-button size="small" type="primary">导入用户</el-button>
  20 + </el-upload>
  21 + </div>
  22 + <el-table
  23 + :data="userList"
  24 + id="QuestionTable"
  25 + border
  26 + style="
  27 + width: 100%;
  28 + border-radius: 5px;
  29 + box-shadow: 0 0 10px #efefef;
  30 + margin-top: 10px;
  31 + "
  32 + @selection-change="handleSelectionChange"
  33 + :stripe="true"
  34 + >
  35 + <el-table-column type="selection" width="55"> </el-table-column>
  36 + <el-table-column
  37 + type="index"
  38 + prop="date"
  39 + width="50"
  40 + align="center"
  41 + ></el-table-column>
11 42 <el-table-column prop="date" label="用户昵称">
12 43 <template slot-scope="scope">
13 44 <span>{{ scope.row.fullName }}</span>
... ... @@ -15,71 +46,106 @@
15 46 </el-table-column>
16 47 <el-table-column prop="date" label="电话号码">
17 48 <template slot-scope="scope">
18   - <el-tooltip class="item" effect="dark" :content="scope.row.phone " placement="top-start">
  49 + <el-tooltip
  50 + class="item"
  51 + effect="dark"
  52 + :content="scope.row.phone"
  53 + placement="top-start"
  54 + >
19 55 <span>{{ scope.row.phone1 }}</span>
20 56 </el-tooltip>
21   -
22 57 </template>
23 58 </el-table-column>
24 59  
25 60 <el-table-column prop="date" label="注册时间">
26 61 <template slot-scope="scope">
27   - <span>{{ scope.row.addTime.replace('T',' ') }}</span>
  62 + <span>{{ scope.row.addTime.replace("T", " ") }}</span>
28 63 </template>
29 64 </el-table-column>
30 65 </el-table>
31   - <el-pagination background @current-change="currentchange"
32   - style="position:static;bottom: 3px;text-align: center;margin-top: 5px;" :page-size="this.query.PageSize"
33   - layout="total,prev, pager, next" :total="Count">
  66 + <el-pagination
  67 + background
  68 + @current-change="currentchange"
  69 + style="position: static; bottom: 3px; text-align: center; margin-top: 5px"
  70 + :page-size="this.query.PageSize"
  71 + layout="total,prev, pager, next"
  72 + :total="Count"
  73 + >
34 74 </el-pagination>
35   -
36 75 </div>
37 76 </template>
38 77  
39 78 <script>
40   - import {
41   - ImportUserByExcel,
42   - GetUserList
43   - } from '@/api/user'
44   - export default {
45   - data() {
46   - return {
47   - userList: [],
48   - Count: 0,
49   - type: '1',
50   - query: {
51   - UserTypeEnum: 1, //0:管理员,1普通用户
52   - PageIndex: 1,
53   - PageSize: 10,
54   -
55   - }
56   - }
  79 +import { ImportUserByExcel, GetUserList } from "@/api/user";
  80 +export default {
  81 + data() {
  82 + return {
  83 + userList: [],
  84 + Count: 0,
  85 + type: "1",
  86 + query: {
  87 + UserTypeEnum: 1, //0:管理员,1普通用户
  88 + PageIndex: 1,
  89 + PageSize: 10,
  90 + keyword:''
  91 + },
  92 + fileList:[],
  93 + selectedList: [],
  94 + };
  95 + },
  96 + created() {
  97 + this.GetUser();
  98 + },
  99 + methods: {
  100 + search(){
  101 + this.GetUser();
57 102 },
58   - created() {
59   - this.GetUser()
  103 + handleInviteInterview() {},
  104 + handleSelectionChange(val) {
  105 + console.log(val);
  106 + this.selectedList = val;
60 107 },
61   - methods: {
62   - ImportUser() {
63   -
64   - },
65   - GetUser() {
66   - GetUserList(this.query).then(res => {
67   - this.userList = res.data.data.rows.map(t => {
68   - if(t.phone){
69   - t.phone1 = t.phone.replace(t.phone.substring(3, 7),'****')
  108 + handleExceed(){},
  109 + ImportUser() {},
  110 + GetUser() {
  111 + GetUserList(this.query).then((res) => {
  112 + this.userList = res.data.data.rows.map((t) => {
  113 + if (t.phone) {
  114 + t.phone1 = t.phone.replace(t.phone.substring(3, 7), "****");
70 115 }
71   - return t
72   - })
73   - this.Count = res.data.data.total
74   - })
75   - },
76   - currentchange(page) {
77   - this.query.PageIndex = page;
78   - this.GetUser();
79   - },
80   - }
81   - }
  116 + return t;
  117 + });
  118 + this.Count = res.data.data.total;
  119 + });
  120 + },
  121 + currentchange(page) {
  122 + this.query.PageIndex = page;
  123 + this.GetUser();
  124 + },
  125 + },
  126 +};
82 127 </script>
83 128  
84   -<style>
  129 +<style lang="scss" scoped>
  130 +.seetingsDiv {
  131 + display: flex;
  132 + align-items: center;
  133 + width: 100%;
  134 + height: 60px;
  135 + background: #efefef;
  136 + line-height: 60px;
  137 + border-radius: 5px;
  138 + box-shadow: 0 0 5px #cdcdcd;
  139 + justify-content: space-between;
  140 +}
  141 +
  142 +.seetingsDiv button {
  143 + height: 40px;
  144 + background-color: #304156;
  145 + border: 0px;
  146 + margin-left: 10px;
  147 + box-shadow: 0 0 5px #cdcdcd;
  148 + float: none;
  149 + margin-right: 10px;
  150 +}
85 151 </style>
... ...