Commit e011bf151deb401616926a54a79524fdc8d5ef52

Authored by 周超
1 parent f0b7a6c2

我先走一步

src/api/QuestionClass.js
... ... @@ -15,6 +15,14 @@ export function getQuestionClass(params) {
15 15 params
16 16 })
17 17 }
  18 +
  19 +export function GetQuestionClassByType(params) {
  20 + return request({
  21 + url: `/QuestionClass/GetQuestionClassByType`,
  22 + method: 'get',
  23 + params
  24 + })
  25 +}
18 26 // 修改 | 保存
19 27 export function EditQuestionClass(params) {
20 28 return request({
... ...
src/api/TestPaper.js
... ... @@ -10,7 +10,8 @@ export function EditTestPaper(params) {
10 10  
11 11 export function getTestPaperList(params) {
12 12 return request({
13   - url: `/TestPaper/List?pageIndex=${params.pageIndex}&pageSize=${params.pageSize}&sort=${params.sort}&sortOrder=${params.sortOrder}`,
  13 + url: `/TestPaper/List`,
  14 + // url: `/TestPaper/List?pageIndex=${params.pageIndex}&pageSize=${params.pageSize}&sort=${params.sort}&sortOrder=${params.sortOrder}`,
14 15 method: 'get',
15 16 data: params
16 17 })
... ...
src/api/user.js
... ... @@ -94,4 +94,12 @@ export function UpdateCurrentPasswordById(data) {
94 94 method: 'post',
95 95 data
96 96 })
97   -}
  97 +}
  98 +
  99 +export function AddInvitationAnswerMultiple(data) {
  100 + return request({
  101 + url: `/InvitationAnswer/AddInvitationAnswerMultiple`,
  102 + method: 'post',
  103 + data
  104 + })
  105 +}
98 106 \ No newline at end of file
... ...
src/views/QuestionBank/components/EditDimension.vue
... ... @@ -237,8 +237,7 @@
237 237 } catch (e) { }
238 238 },
239 239 show(id) {
240   - if (id) {
241   - this.data = {
  240 + this.data = {
242 241 // id: Date.parse(new Date()) + '_' + Math.ceil(Math.random() * 99999),
243 242 // key: Date.parse(new Date()) + '_' + Math.ceil(Math.random() * 99999),
244 243 rules: [
... ... @@ -255,6 +254,8 @@
255 254 }
256 255 ]
257 256 };
  257 + if (id) {
  258 +
258 259 this.dialogFormVisible = true;
259 260 getQuestionClass({ id }).then(res => {
260 261  
... ...
src/views/QuestionBank/index.vue
... ... @@ -6,48 +6,24 @@
6 6 <div class="TreeHeader">
7 7 <label style="font-size: 18px">题目分类</label>
8 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   - >
  9 + <div :style="{ height: TableColHeight + 'px' }" class="areadiv"
  10 + style="margin: 10px 0 0 0; padding: 5px 0 0 0">
  11 + <el-tabs v-model="activeTab" @tab-click="handleTabsClick" style="padding: 0 20px" :stretch="true">
20 12 <el-tab-pane label="专业类" name="first"></el-tab-pane>
21 13 <el-tab-pane label="测评类" name="second"></el-tab-pane>
22 14 </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   - >
  15 + <el-tree :data="activeTab == 'first' ? firstTreeData : secondTreeData"
  16 + :props="activeTab == 'first' ? firstTreeData : secondTreeData" @node-click="handleNodeClick"
  17 + class="eltree" :expand-on-click-node="false">
30 18 <span class="custom-tree-node" slot-scope="{ node, data }">
31 19 <span>{{ node.label }}</span>
32 20 <span style="">
33   - <el-button
34   - type="text"
35   - size="mini"
36   - @click="showClassDialog(node)"
37   - >
  21 + <el-button type="text" size="mini" @click="showClassDialog(node)" v-if="activeTab == 'first'?true:node.level<2?true:false">
38 22 添加下级
39 23 </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   - >
  24 + <el-button type="text" v-if="activeTab == 'second'" @click="handleEditDimension(node, data)">编辑
  25 + </el-button>
  26 + <el-button type="text" size="mini" @click="() => handleDeleteQuestionClass(node, data)">
51 27 删除
52 28 </el-button>
53 29 </span>
... ... @@ -59,24 +35,16 @@
59 35 <el-col :span="18">
60 36 <div class="grid-content bg-purple-light">
61 37 <div class="seetingsDiv" style="">
62   - <el-button type="primary" @click="dialogsubjectlVisible = true"
63   - >添加题目
  38 + <el-button type="primary" @click="AddSubject">添加题目
64 39 </el-button>
65 40 </div>
66 41 <div class="areadiv" :style="{ height: TableColHeight + 'px' }">
67   - <el-table
68   - :data="QuestList"
69   - id="QuestionTable"
70   - border
71   - style="
  42 + <el-table :data="QuestList" id="QuestionTable" border style="
72 43 width: 100%;
73 44 border-radius: 5px;
74 45 box-shadow: 0 0 10px #efefef;
75 46 margin-top: 10px;
76   - "
77   - :header-cell-class-name="headerStyle"
78   - :stripe="true"
79   - >
  47 + " :header-cell-class-name="headerStyle" :stripe="true">
80 48 <el-table-column prop="date" label="ID" width="50">
81 49 <template slot-scope="scope">
82 50 <span>{{ scope.row.id }}</span>
... ... @@ -86,32 +54,28 @@
86 54 <template slot-scope="scope">
87 55 <span style="padding-left: 10px">{{
88 56 scope.row.subjectName
89   - }}</span>
  57 + }}</span>
90 58 </template>
91 59 </el-table-column>
92   - <el-table-column
93   - prop="QuestionClassName"
94   - label="分类"
95   - width="100"
96   - >
  60 + <el-table-column prop="QuestionClassName" label="分类" width="100">
97 61 <template slot-scope="scope">
98 62 <span style="padding-left: 10px">{{
99 63 scope.row.QuestionClassName
100   - }}</span>
  64 + }}</span>
101 65 </template>
102 66 </el-table-column>
103 67 <el-table-column prop="name" label="分数" width="80">
104 68 <template slot-scope="scope">
105 69 <span style="padding-left: 10px">{{
106 70 scope.row.fraction
107   - }}</span>
  71 + }}</span>
108 72 </template>
109 73 </el-table-column>
110 74 <el-table-column prop="name" label="单项分数" width="80">
111 75 <template slot-scope="scope">
112 76 <span style="padding-left: 10px">{{
113 77 scope.row.singleFraction
114   - }}</span>
  78 + }}</span>
115 79 </template>
116 80 </el-table-column>
117 81 <el-table-column prop="name" label="正确答案" width="80">
... ... @@ -119,46 +83,33 @@
119 83 <span style="padding-left: 10px">{{ scope.row.answer }}</span>
120 84 </template>
121 85 </el-table-column>
122   - <el-table-column
123   - prop="name"
124   - label="题目"
125   - :show-overflow-tooltip="true"
126   - >
  86 + <el-table-column prop="name" label="题目" :show-overflow-tooltip="true">
127 87 <template slot-scope="scope">
128 88 <span style="padding-left: 10px">{{
129 89 scope.row.subject
130   - }}</span>
  90 + }}</span>
131 91 </template>
132 92 </el-table-column>
133   - <el-table-column
134   - prop="name"
135   - label="解析"
136   - :show-overflow-tooltip="true"
137   - >
  93 + <el-table-column prop="name" label="解析" :show-overflow-tooltip="true">
138 94 <template slot-scope="scope">
139 95 <span style="padding-left: 10px">{{
140 96 scope.row.analysis
141   - }}</span>
  97 + }}</span>
142 98 </template>
143 99 </el-table-column>
144 100 <el-table-column fixed="right" label="操作" width="150">
145 101 <template slot-scope="scope">
146   - <el-dropdown
147   - @command="
  102 + <el-dropdown @command="
148 103 (e) => {
149 104 handleCommand(e, scope.row.id);
150 105 }
151   - "
152   - style="padding-left: 10px"
153   - >
  106 + " style="padding-left: 10px">
154 107 <span class="el-dropdown-link">
155 108 操作<i class="el-icon-arrow-down el-icon--right"></i>
156 109 </span>
157 110 <template #dropdown>
158 111 <el-dropdown-menu>
159   - <el-dropdown-item command="update"
160   - >编辑</el-dropdown-item
161   - >
  112 + <el-dropdown-item command="update">编辑</el-dropdown-item>
162 113 <!-- <el-dropdown-item command="b">锁定</el-dropdown-item> -->
163 114 <el-dropdown-item command="del">删除</el-dropdown-item>
164 115 </el-dropdown-menu>
... ... @@ -167,83 +118,43 @@
167 118 </template>
168 119 </el-table-column>
169 120 </el-table>
170   - <el-pagination
171   - background
172   - @current-change="currentchange"
173   - style="
  121 + <el-pagination background @current-change="currentchange" style="
174 122 position: static;
175 123 bottom: 3px;
176 124 text-align: center;
177 125 margin-top: 5px;
178   - "
179   - :page-size="this.parameter.pageSize"
180   - layout="total,prev, pager, next"
181   - :total="Count"
182   - >
  126 + " :page-size="this.parameter.pageSize" layout="total,prev, pager, next" :total="Count">
183 127 </el-pagination>
184 128 <div style="clear: both"></div>
185 129 </div>
186 130 </div>
187 131 </el-col>
188 132 </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   - >
  133 + <el-dialog title="分类维护" :visible.sync="dialogClassIVIsible" @close="closeClassDialog" width="400px"
  134 + :close-on-click-modal="false">
  135 + <el-form ref="QuestionClassInfo" :model="QuestionClassInfo" label-width="70px">
201 136 <el-form-item label="分类名称">
202   - <el-input
203   - v-model="QuestionClassInfo.ClassificationName"
204   - placeholder="请输入分类名称"
205   - ></el-input>
  137 + <el-input v-model="QuestionClassInfo.ClassificationName" placeholder="请输入分类名称"></el-input>
206 138 </el-form-item>
207 139 </el-form>
208   - <el-button
209   - @click="CreateQuestionClassHealder"
210   - style="margin: 10px 0 0 0; float: right"
211   - type="primary"
212   - >确定
  140 + <el-button @click="CreateQuestionClassHealder" style="margin: 10px 0 0 0; float: right" type="primary">确定
213 141 </el-button>
214 142 <div style="clear: both"></div>
215 143 </el-dialog>
216   - <el-dialog
217   - title="编辑题目"
218   - :visible.sync="dialogsubjectlVisible"
219   - @close="closeDialog"
220   - width="800px"
221   - :close-on-click-modal="false"
222   - >
  144 + <el-dialog title="编辑题目" :visible.sync="dialogsubjectlVisible" @close="closeDialog" width="800px"
  145 + :close-on-click-modal="false">
223 146 <el-form ref="Dataform" :model="Dataform" label-width="60px">
224 147 <el-form-item label="题目">
225   - <el-input
226   - v-model="Dataform.subject"
227   - placeholder="请输入题目名称"
228   - ></el-input>
  148 + <el-input v-model="Dataform.subject" placeholder="请输入题目名称"></el-input>
229 149 </el-form-item>
230 150 <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   - >
  151 + <el-cascader @change="changequestionclass" v-model="Dataform.QuestionClassId" style="width: 400px" :props="{ emitPath: false ,checkStrictly:true}"
  152 + :clearable="true" :options="QuestionClass">
238 153 </el-cascader>
239 154 </el-form-item>
240 155 <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   - >
  156 + <el-select v-model="Dataform.subjectType" value-key="Dataform.subjectType" @change="changeQuestionType"
  157 + placeholder="请选择题型">
247 158 <el-option label="单选题" :value="1"></el-option>
248 159 <el-option label="多选题" :value="2"></el-option>
249 160 <el-option label="主观题" :value="3"></el-option>
... ... @@ -253,484 +164,488 @@
253 164 <el-table :data="subjectContent" :show-header="false">
254 165 <el-table-column>
255 166 <template slot-scope="scope">
256   - <el-input
257   - placeholder="请输入答案"
258   - v-model="scope.row.optionContent"
259   - class="optionInput"
260   - style="width:68% !important"
261   - >
  167 + <el-input placeholder="请输入答案" v-model="scope.row.optionContent" class="optionInput"
  168 + style="width:68% !important">
262 169 <template slot="prepend">{{ scope.row.option }}</template>
263 170 </el-input>
264 171  
265   - <el-input
266   - placeholder="维度分值"
267   - v-model="scope.row.score"
268   - class="optionInput"
269   - style="width:21% !important;margin-left:1%"
270   - >
271   - </el-input>
  172 + <el-input placeholder="维度分值" v-model="scope.row.score" class="optionInput" v-if="FormClassType==2"
  173 + style="width:21% !important;margin-left:1%">
  174 + </el-input>
272 175  
273 176  
274 177 <i class="el-icon-circle-plus el-icon" @click="Addlist"></i>
275   - <i
276   - class="el-icon-remove el-icon"
277   - @click="RemoveList(scope)"
278   - v-if="scope.$index != 0"
279   - ></i>
  178 + <i class="el-icon-remove el-icon" @click="RemoveList(scope)" v-if="scope.$index != 0"></i>
280 179 </template>
281 180 </el-table-column>
282   -
  181 +
283 182 </el-table>
284 183 </el-form-item>
285   - <el-form-item
286   - label="答案"
287   - v-show="OptionVisible"
288   - class="subjectContentClass"
289   - >
290   - <el-radio-group
291   - v-for="(item, i) in subjectContent"
292   - v-model="Dataform.answer"
293   - v-if="GroupVisible"
294   - >
  184 + <el-form-item label="答案" v-show="OptionVisible" class="subjectContentClass" v-if="FormClassType!=2">
  185 + <el-radio-group v-for="(item, i) in subjectContent" v-model="Dataform.answer" v-if="GroupVisible">
295 186 <el-radio :label="item.option">{{ item.option }}</el-radio>
296 187 </el-radio-group>
297   - <el-checkbox-group
298   - v-for="(item, i) in subjectContent"
299   - v-model="Dataform.answer"
300   - v-if="!GroupVisible"
301   - >
  188 + <el-checkbox-group v-for="(item, i) in subjectContent" v-model="Dataform.answer" v-if="!GroupVisible">
302 189 <el-checkbox style="float: left" :label="item.option">{{
303 190 item.option
304   - }}</el-checkbox>
  191 + }}</el-checkbox>
305 192 </el-checkbox-group>
306 193 </el-form-item>
307   - <el-form-item label="分数" v-show="OptionVisible">
308   - <el-input-number
309   - :step="1"
310   - style="float: left"
311   - :min="0"
312   - v-model="Dataform.fraction"
313   - >
  194 + <el-form-item label="分数" v-show="OptionVisible && FormClassType !=2">
  195 + <el-input-number :step="1" style="float: left" :min="0" v-model="Dataform.fraction">
314 196 </el-input-number>
315 197 <div style="float: left; margin-left: 20px" v-if="!GroupVisible">
316 198 <lable style="font-weight: bold">单项分数:</lable>
317   - <el-input-number
318   - :step="0.5"
319   - :max="Dataform.fraction / 2"
320   - :min="0"
321   - v-model="Dataform.singleFraction"
322   - >
  199 + <el-input-number :step="0.5" :max="Dataform.fraction / 2" :min="0" v-model="Dataform.singleFraction">
323 200 </el-input-number>
324 201 </div>
325 202 </el-form-item>
326 203 <el-form-item label="解析" style="margin-top: 10px">
327   - <el-input
328   - v-model="Dataform.analysis"
329   - :rows="10"
330   - type="textarea"
331   - placeholder="请输入答案解析"
332   - />
  204 + <el-input v-model="Dataform.analysis" :rows="10" type="textarea" placeholder="请输入答案解析" />
333 205 </el-form-item>
334 206 </el-form>
335   - <el-button
336   - @click="EditQuestionHeadler"
337   - style="margin: 10px 0 0 0; float: right"
338   - type="primary"
339   - >确定
  207 + <el-button @click="EditQuestionHeadler" style="margin: 10px 0 0 0; float: right" type="primary">确定
340 208 </el-button>
341 209 <div style="clear: both"></div>
342 210 </el-dialog>
343   - <EditDimension ref="editDimensionDialog" :model="currentEditDimension"></EditDimension>
  211 + <EditDimension ref="editDimensionDialog" :model="currentEditDimension"></EditDimension>
344 212 </div>
345 213 </template>
346 214  
347 215 <script lang="ts">
348   -import {
349   - getQuestionList,
350   - EditQuestion,
351   - getQuestionClassList,
352   - DelQuestionBankEvent,
353   - GetQuestionBankById,
354   - CreateQuestionClass,
355   -} from "@/api/QuestionBank";
356   -import { parseTime } from "@/utils/index.js";
357   -import EditDimension from "./components/EditDimension.vue";
358   -export default {
359   - filters: {},
360   - components: {
361   - EditDimension,
362   - },
363   - data() {
364   - return {
365   - currentEditDimension:{},
366   - activeTab: "first",
367   - parameter: {
368   - pageIndex: 1,
369   - pageSize: 12,
370   - sort: "id",
371   - sortOrder: 1,
372   - keyword: "",
373   - QuestionClassId: 0,
374   - status: 1,
375   - },
376   - Count: 0,
377   - QuestList: [],
378   - dialogsubjectlVisible: false,
379   - dialogClassIVIsible: false,
380   - OptionVisible: true,
381   - GroupVisible: true,
382   - Dataform: {
383   - subject: "",
384   - subjectType: 1,
385   - subjectContent: "",
386   - QuestionClassId: 0,
387   - answer: [],
388   - analysis: "",
389   - fraction: 0,
390   - singleFraction: 0,
391   - addTime: "2021-11-12",
392   - state: 1,
393   - },
394   - subjectContent: [
395   - {
396   - option: "A",
397   - optionContent: "",
398   - },
399   - ],
400   - QuestionClass: [],
401   - QuestionClassInfo: {
402   - ParentId: 0,
403   - ClassificationName: "",
404   - Addtime: "",
405   - },
406   - TreeColHeight: 0,
407   - TableColHeight: 0,
408   - treeData: [],
409   - firstTreeData: [],
410   - secondTreeData: [],
411   - CreatClassId: 0,
412   - };
413   - },
414   - created() {},
415   - mounted() {
416   - let ContentAreaHight =
417   - window.innerHeight - document.getElementById("elRow").offsetTop - 70;
418   - this.TableColHeight =
419   - ContentAreaHight - document.getElementById("QuestionTable").offsetTop;
420   - let lineNumber = this.TableColHeight - 50 - 20; //减去表头来计算
421   - this.TreeColHeight = ContentAreaHight;
422   - lineNumber = Math.floor(lineNumber / 49);
423   - this.parameter.pageSize = lineNumber;
424   - this.GetList();
425   - this.getQuestionClassListHeadler();
426   - },
427   - methods: {
428   - //维度编辑
429   - handleEditDimension(node,data) {
430   - console.log(data);
431   - // this.$refs.editDimensionDialog.dialogFormVisible = true;
432   - this.$refs.editDimensionDialog.show(data.id);
433   - this.currentEditDimension = data;
434   - },
435   - //切换分类
436   - handleTabsClick(e) {
437   - console.log(e.name);
  216 + import {
  217 + getQuestionList,
  218 + EditQuestion,
  219 + getQuestionClassList,
  220 + DelQuestionBankEvent,
  221 + GetQuestionBankById,
  222 + CreateQuestionClass,
  223 + } from "@/api/QuestionBank";
  224 + import { parseTime } from "@/utils/index.js";
  225 + import EditDimension from "./components/EditDimension.vue";
  226 + export default {
  227 + filters: {},
  228 + components: {
  229 + EditDimension,
438 230 },
439   - //删除分类
440   - handleDeleteQuestionClass(node, data) {
441   - console.log(node, data);
442   - console.log(this.API);
443   - this.API.deleteQuestionClass(data.value).then((res) => {
444   - this.getQuestionClassListHeadler();
445   - });
446   - },
447   - closeClassDialog() {
448   - this.dialogClassIVIsible = false;
449   - },
450   - //表格右边的操作按钮
451   - handleCommand(value, val) {
452   - if (value == "update") {
453   - this.GetQuestionBankByIdHeadler(val);
454   - }
455   - if (value == "del") {
456   - this.DelQuestionBankEventHeadler(val);
457   - }
  231 + data() {
  232 + return {
  233 + FormClassType:0,
  234 + loading: false,
  235 + currentEditDimension: {},
  236 + activeTab: "first",
  237 + parameter: {
  238 + pageIndex: 1,
  239 + pageSize: 12,
  240 + sort: "id",
  241 + sortOrder: 1,
  242 + keyword: "",
  243 + QuestionClassId: 0,
  244 + status: 1,
  245 + },
  246 + Count: 0,
  247 + QuestList: [],
  248 + dialogsubjectlVisible: false,
  249 + dialogClassIVIsible: false,
  250 + OptionVisible: true,
  251 + GroupVisible: true,
  252 + Dataform: {
  253 + subject: "",
  254 + subjectType: 1,
  255 + subjectContent: "",
  256 + QuestionClassId: 0,
  257 + answer: [],
  258 + analysis: "",
  259 + fraction: 0,
  260 + singleFraction: 0,
  261 + addTime: "2021-11-12",
  262 + state: 1,
  263 + },
  264 + subjectContent: [
  265 + {
  266 + option: "A",
  267 + optionContent: "",
  268 + },
  269 + ],
  270 + QuestionClass: [],
  271 + QuestionClassInfo: {
  272 + ParentId: 0,
  273 + ClassificationName: "",
  274 + Addtime: "",
  275 + },
  276 + TreeColHeight: 0,
  277 + TableColHeight: 0,
  278 + treeData: [],
  279 + firstTreeData: [],
  280 + secondTreeData: [],
  281 + CreatClassId: 0,
  282 + };
458 283 },
459   - //添加分类
460   - CreateQuestionClassHealder() {
461   - this.QuestionClassInfo.Addtime = parseTime(new Date(), "");
462   - CreateQuestionClass(this.QuestionClassInfo).then((res) => {
463   - // alert(res.code);
464   - });
  284 + created() { },
  285 + mounted() {
  286 + let ContentAreaHight =
  287 + window.innerHeight - document.getElementById("elRow").offsetTop - 70;
  288 + this.TableColHeight =
  289 + ContentAreaHight - document.getElementById("QuestionTable").offsetTop;
  290 + let lineNumber = this.TableColHeight - 50 - 20; //减去表头来计算
  291 + this.TreeColHeight = ContentAreaHight;
  292 + lineNumber = Math.floor(lineNumber / 49);
  293 + this.parameter.pageSize = lineNumber;
  294 + this.GetList();
  295 + this.getQuestionClassListHeadler();
465 296 },
466   - //获取选择的题目详细信息
467   - GetQuestionBankByIdHeadler(id) {
468   - GetQuestionBankById(id).then((res) => {
469   - this.changeQuestionType(res.data.data.subjectType); //这里先初始化编辑显示内容
470   - this.Dataform = res.data.data; //内容赋值
471   - this.subjectContent = JSON.parse(res.data.data.subjectContent); //赋值选项
472   - if (res.data.data.subjectType == 1) {
473   - this.Dataform.answer = res.data.data.answer.split(",")[0]; //赋值答案
474   - } else {
475   - this.Dataform.answer = res.data.data.answer.split(","); //赋值答案
  297 + methods: {
  298 + AddSubject(){
  299 + this.FormClassType = 0;
  300 + this.dialogsubjectlVisible = true
  301 + },
  302 + changequestionclass(a,b,c){
  303 + var item = this.QuestionClass.find(o=>o.id ==a);
  304 + if(item) this.FormClassType = item.ClassType;
  305 + },
  306 + //维度编辑
  307 + handleEditDimension(node, data) {
  308 + console.log(data);
  309 + // this.$refs.editDimensionDialog.dialogFormVisible = true;
  310 + this.$refs.editDimensionDialog.show(data.id);
  311 + this.currentEditDimension = data;
  312 + },
  313 + //切换分类
  314 + handleTabsClick(e) {
  315 + console.log(e.name);
  316 + },
  317 + //删除分类
  318 + handleDeleteQuestionClass(node, data) {
  319 + this.loading = true;
  320 + // console.log(node, data);
  321 + // console.log(this.API);
  322 + this.API.deleteQuestionClass(data.value).then((res) => {
  323 +
  324 + this.getQuestionClassListHeadler();
  325 +
  326 + this.loading = false;
  327 + this.$message.success('操作成功!');
  328 + });
  329 + },
  330 + closeClassDialog() {
  331 + this.dialogClassIVIsible = false;
  332 + },
  333 + //表格右边的操作按钮
  334 + handleCommand(value, val) {
  335 + if (value == "update") {
  336 + this.GetQuestionBankByIdHeadler(val);
476 337 }
477   - this.dialogsubjectlVisible = true;
478   - });
479   - },
480   - showClassDialog(node) {
481   - this.dialogClassIVIsible = true;
482   - console.log(node);
483   - this.QuestionClassInfo.ParentId = node.data.value;
484   - // alert(this.QuestionClassInfo.ParentId);
485   - },
486   - //关闭弹框的事件
487   - closeDialog() {
488   - //初始化数据
489   - this.Dataform = this.$options.data().Dataform;
490   - this.subjectContent = this.$options.data().subjectContent;
491   - //所有文本框恢复到初始化状态
492   - this.Dataform.answer = [];
493   - this.OptionVisible = true;
494   - this.GroupVisible = true;
495   - },
496   - //选择题目类型来判断是否显示部分表单
497   - changeQuestionType(val) {
498   - if (val == 3) {
499   - this.OptionVisible = false;
500   - }
501   - if (val == 2) {
502   - this.OptionVisible = true;
503   - this.Dataform.answer = [];
504   - this.GroupVisible = false;
505   - }
506   - if (val == 1) {
  338 + if (value == "del") {
  339 + this.DelQuestionBankEventHeadler(val);
  340 + }
  341 + },
  342 + //添加分类
  343 + CreateQuestionClassHealder() {
  344 + if(this.loading)return;
  345 + this.loading=true;
  346 +
  347 + this.QuestionClassInfo.Addtime = parseTime(new Date(), "");
  348 + CreateQuestionClass(this.QuestionClassInfo).then((res) => {
  349 + this.getQuestionClassListHeadler();
  350 + this.dialogClassIVIsible = false;
  351 + setTimeout(()=>{
  352 + this.loading = false;
  353 + },1000);
  354 + });
  355 + },
  356 + //获取选择的题目详细信息
  357 + GetQuestionBankByIdHeadler(id) {
  358 + GetQuestionBankById(id).then((res) => {
  359 +
  360 + var d = this.QuestionClass.find(o=>o.id==res.data.data.QuestionClassId);
  361 + if(d)this.FormClassType = d.ClassType;
  362 + this.changeQuestionType(res.data.data.subjectType); //这里先初始化编辑显示内容
  363 + this.Dataform = res.data.data; //内容赋值
  364 + this.subjectContent = JSON.parse(res.data.data.subjectContent); //赋值选项
  365 + if (res.data.data.subjectType == 1) {
  366 + this.Dataform.answer = res.data.data.answer.split(",")[0]; //赋值答案
  367 + } else {
  368 + this.Dataform.answer = res.data.data.answer.split(","); //赋值答案
  369 + }
  370 + this.dialogsubjectlVisible = true;
  371 + });
  372 + },
  373 + showClassDialog(node) {
  374 + this.dialogClassIVIsible = true;
  375 + console.log(node);
  376 + this.QuestionClassInfo.ParentId = node.data.value;
  377 + // alert(this.QuestionClassInfo.ParentId);
  378 + },
  379 + //关闭弹框的事件
  380 + closeDialog() {
  381 + //初始化数据
  382 + this.Dataform = this.$options.data().Dataform;
  383 + this.subjectContent = this.$options.data().subjectContent;
  384 + //所有文本框恢复到初始化状态
507 385 this.Dataform.answer = [];
508 386 this.OptionVisible = true;
509 387 this.GroupVisible = true;
510   - }
511   - },
512   - headerStyle({ row, column, rowIndex, columnIndex }) {
513   - return "tableStyle";
514   - },
515   - Addlist() {
516   - if (this.subjectContent.length < 4) {
517   - var alphabet = String.fromCharCode(
518   - 64 + parseInt(this.subjectContent.length + 1)
519   - );
520   - this.subjectContent.push({
521   - option: alphabet,
522   - title: "",
  388 + },
  389 + //选择题目类型来判断是否显示部分表单
  390 + changeQuestionType(val) {
  391 + if (val == 3) {
  392 + this.OptionVisible = false;
  393 + }
  394 + if (val == 2) {
  395 + this.OptionVisible = true;
  396 + this.Dataform.answer = [];
  397 + this.GroupVisible = false;
  398 +
  399 + }
  400 + if (val == 1) {
  401 + this.Dataform.answer = [];
  402 + this.OptionVisible = true;
  403 + this.GroupVisible = true;
  404 + }
  405 + },
  406 + headerStyle({ row, column, rowIndex, columnIndex }) {
  407 + return "tableStyle";
  408 + },
  409 + Addlist() {
  410 + if (this.subjectContent.length < 4) {
  411 + var alphabet = String.fromCharCode(
  412 + 64 + parseInt(this.subjectContent.length + 1)
  413 + );
  414 + this.subjectContent.push({
  415 + option: alphabet,
  416 + title: "",
  417 + });
  418 + } else {
  419 + this.$confirm("系统暂时只支持4个答案!", "消息");
  420 + }
  421 + },
  422 + RemoveList(val) {
  423 + this.subjectContent.splice(val.$index, 1);
  424 + this.subjectContent.forEach((item, index) => {
  425 + item.option = String.fromCharCode(64 + parseInt(index + 1));
523 426 });
524   - } else {
525   - this.$confirm("系统暂时只支持4个答案!", "消息");
526   - }
527   - },
528   - RemoveList(val) {
529   - this.subjectContent.splice(val.$index, 1);
530   - this.subjectContent.forEach((item, index) => {
531   - item.option = String.fromCharCode(64 + parseInt(index + 1));
532   - });
533   - },
534   - handleNodeClick(val) {
535   - this.parameter.QuestionClassId = val.value;
536   - this.parameter.pageIndex = 1;
537   - this.GetList();
538   - },
539   - DelQuestionBankEventHeadler(id) {
540   - this.$confirm("确定删除该试题?", "消息", {
541   - confirmButtonText: "确认",
542   - cancelButtonText: "取消",
543   - callback: (action) => {
544   - if (action == "confirm") {
545   - DelQuestionBankEvent(id).then((res) => {
546   - if (res.data.code == 200) {
547   - this.$confirm(res.data.message, "消息");
548   - this.GetList();
549   - }
550   - });
  427 + },
  428 + handleNodeClick(val) {
  429 + if(this.loading)return;
  430 + this.parameter.QuestionClassId = val.value;
  431 + this.parameter.pageIndex = 1;
  432 + this.GetList();
  433 + },
  434 + DelQuestionBankEventHeadler(id) {
  435 + this.$confirm("确定删除该试题?", "消息", {
  436 + confirmButtonText: "确认",
  437 + cancelButtonText: "取消",
  438 + callback: (action) => {
  439 + if (action == "confirm") {
  440 + DelQuestionBankEvent(id).then((res) => {
  441 + if (res.data.code == 200) {
  442 + this.$confirm(res.data.message, "消息");
  443 + this.GetList();
  444 + }
  445 + });
  446 + }
  447 + },
  448 + });
  449 + },
  450 + EditQuestionHeadler() {
  451 + let reg = new RegExp('"', "g");
  452 + //this.Dataform.subjectContent = JSON.stringify(this.subjectContent).replace(reg, "\"");
  453 + this.Dataform.subjectContent = this.subjectContent;
  454 + if (typeof this.Dataform.answer != "string")
  455 + //判断是否为字符串
  456 + this.Dataform.answer = this.Dataform.answer.join(",");
  457 + var _this = this;
  458 + EditQuestion(this.Dataform).then((res) => {
  459 + if (res.data.code == 200) {
  460 + _this.GetList();
  461 + this.$message(res.data.message);
  462 + setTimeout(function () {
  463 + _this.dialogsubjectlVisible = false;
  464 + }, 10);
551 465 }
552   - },
553   - });
554   - },
555   - EditQuestionHeadler() {
556   - let reg = new RegExp('"', "g");
557   - //this.Dataform.subjectContent = JSON.stringify(this.subjectContent).replace(reg, "\"");
558   - this.Dataform.subjectContent = this.subjectContent;
559   - if (typeof this.Dataform.answer != "string")
560   - //判断是否为字符串
561   - this.Dataform.answer = this.Dataform.answer.join(",");
562   - var _this = this;
563   - EditQuestion(this.Dataform).then((res) => {
564   - if (res.data.code == 200) {
565   - _this.GetList();
566   - this.$message(res.data.message);
567   - setTimeout(function () {
568   - _this.dialogsubjectlVisible = false;
569   - }, 10);
570   - }
571   - });
572   - },
573   - GetList() {
574   - let _this = this;
575   - getQuestionList(_this.parameter).then((res) => {
576   - _this.QuestList = res.data.data.rows;
577   - _this.Count = res.data.data.total;
578   - _this.$forceUpdate();
579   - });
580   - },
581   - currentchange(page) {
582   - this.parameter.pageIndex = page;
583   - this.GetList();
584   - },
585   - getSubTree(id, list) {
586   - let result = [];
587   - result = list.filter((t) => t.ParentId == id);
588   - if (result.length) {
589   - result = result.map((item) => {
590   - item.children = this.getSubTree(item.id, list);
591   - return item;
592 466 });
593   - }
594   - return result;
595   - },
596   - getQuestionClassListHeadler() {
597   - let _this = this;
598   - getQuestionClassList().then((res) => {
599   - let list = res.data.data;
600   - list = list.map((t) => {
601   - t.value = t.id;
602   - t.label = t.ClassificationName;
603   - return t;
  467 + },
  468 + GetList() {
  469 + let _this = this;
  470 + getQuestionList(_this.parameter).then((res) => {
  471 + _this.QuestList = res.data.data.rows;
  472 + _this.Count = res.data.data.total;
  473 + _this.$forceUpdate();
604 474 });
605   - let firstClass = list.find((t) => t.id == 6);
606   - firstClass.children = this.getSubTree(6, list);
607   - let secondClass = list.find((t) => t.id == 1);
608   - secondClass.children = this.getSubTree(1, list);
609   - this.QuestionClass = list;
  475 + },
  476 + currentchange(page) {
  477 + this.parameter.pageIndex = page;
  478 + this.GetList();
  479 + },
  480 + getSubTree(id, list) {
  481 + let result = [];
  482 + result = list.filter((t) => t.ParentId == id);
  483 + if (result.length) {
  484 + result = result.map((item) => {
  485 + item.children = this.getSubTree(item.id, list);
  486 + return item;
  487 + });
  488 + }
  489 + return result;
  490 + },
  491 + getQuestionClassListHeadler() {
  492 + let _this = this;
  493 + getQuestionClassList().then((res) => {
  494 + let list = res.data.data;
  495 + list = list.map((t) => {
  496 + t.value = t.id;
  497 + t.label = t.ClassificationName;
  498 + return t;
  499 + });
  500 + let firstClass = list.find((t) => t.id == 6);
  501 + firstClass.children = this.getSubTree(6, list);
  502 + let secondClass = list.find((t) => t.id == 1);
  503 + secondClass.children = this.getSubTree(1, list);
  504 + this.QuestionClass = list;
610 505  
611   - this.firstTreeData = [firstClass];
612   - this.secondTreeData = [secondClass];
613   - });
  506 + this.firstTreeData = [firstClass];
  507 + this.secondTreeData = [secondClass];
  508 + });
  509 + },
614 510 },
615   - },
616   -};
  511 + };
617 512 </script>
618 513 <style scoped="scoped">
619   -/deep/.cell {
620   - padding-left: 0px;
621   -}
622   -/deep/.el-form-item {
623   - margin-bottom: 5px;
624   -}
625   -/deep/.el-radio {
626   - margin-right: 10px;
627   -}
628   -/deep/.el-radio__input.is-checked .el-radio__inner {
629   - border-color: #409eff;
630   - background-color: #409eff;
631   -}
632   -/deep/.el-radio__input.is-checked + .el-radio__label {
633   - color: #409eff;
634   - font-weight: bold;
635   -}
636   -/deep/.tableStyle {
637   - background-color: #304156 !important;
638   - color: #fff;
639   - font-weight: 400;
640   -}
641   -.QuestDiv {
642   - width: 24%;
643   - float: left;
644   - min-height: 50px;
645   - border: 1px solid #cdcdcd;
646   - margin-right: 10px;
647   - box-shadow: 0 0 10px #808080;
648   - border-radius: 8px;
649   - min-height: 100px;
650   - background-color: #fff;
651   - opacity: 0.8;
652   - margin-bottom: 10px;
653   - height: 313px;
654   -}
655   -.clear {
656   - clear: both;
657   - margin-bottom: 10px;
658   -}
659   -.font-color {
660   - background-color: #ae1e15 !important;
661   - color: #fff;
662   - box-shadow: 0 0 5px #ae1e15;
663   -}
664   -/deep/.el-input-group__prepend {
665   - font-weight: bold;
666   - width: 30px;
667   - text-align: center;
668   - background: #409eff;
669   - color: #fff;
670   -}
671   -.optionInput {
672   - float: left;
673   - width: 620px !important;
674   -}
675   -.el-icon {
676   - font-size: 20px;
677   - line-height: 40px;
678   - margin: 0 5px;
679   - cursor: pointer;
680   - color: #409eff !important;
681   -}
682   ->>> .subjectContentClass .el-checkbox__label {
683   - padding-right: 10px !important;
684   -}
685   -.seetingsDiv {
686   - width: 100%;
687   - height: 60px;
688   - background: #efefef;
689   - line-height: 60px;
690   - border-radius: 5px;
691   - box-shadow: 0 0 5px #cdcdcd;
692   -}
693   -.seetingsDiv button {
694   - background-color: #304156;
695   - border: 0px;
696   - margin-left: 10px;
697   - box-shadow: 0 0 5px #cdcdcd;
698   - float: right;
699   - margin-top: 12px;
700   - margin-right: 10px;
701   -}
702   -.areadiv {
703   - background-color: #efefef;
704   - border-radius: 5px;
705   - box-shadow: 0 0 5px #efefef;
706   -}
707   -.TreeHeader {
708   - background-color: #304156;
709   - height: 60px;
710   - border-radius: 5px;
711   - box-shadow: 0 0 10px #efefef;
712   - line-height: 60px;
713   - color: #fff;
714   - padding-left: 10px;
715   -}
716   -.classbtn {
717   - float: right;
718   - margin: 11px 10px 0 0;
719   - height: 35px;
720   - line-height: 12px;
721   -}
722   -.eltree {
723   - background-color: #efefef;
724   -}
725   -/deep/.el-tree-node__content {
726   - min-height: 40px;
727   -}
728   -.custom-tree-node {
729   - flex: 1;
730   - display: flex;
731   - align-items: center;
732   - justify-content: space-between;
733   - font-size: 14px;
734   - padding-right: 8px;
735   -}
736   -</style>
  514 + /deep/.cell {
  515 + padding-left: 0px;
  516 + }
  517 +
  518 + /deep/.el-form-item {
  519 + margin-bottom: 5px;
  520 + }
  521 +
  522 + /deep/.el-radio {
  523 + margin-right: 10px;
  524 + }
  525 +
  526 + /deep/.el-radio__input.is-checked .el-radio__inner {
  527 + border-color: #409eff;
  528 + background-color: #409eff;
  529 + }
  530 +
  531 + /deep/.el-radio__input.is-checked+.el-radio__label {
  532 + color: #409eff;
  533 + font-weight: bold;
  534 + }
  535 +
  536 + /deep/.tableStyle {
  537 + background-color: #304156 !important;
  538 + color: #fff;
  539 + font-weight: 400;
  540 + }
  541 +
  542 + .QuestDiv {
  543 + width: 24%;
  544 + float: left;
  545 + min-height: 50px;
  546 + border: 1px solid #cdcdcd;
  547 + margin-right: 10px;
  548 + box-shadow: 0 0 10px #808080;
  549 + border-radius: 8px;
  550 + min-height: 100px;
  551 + background-color: #fff;
  552 + opacity: 0.8;
  553 + margin-bottom: 10px;
  554 + height: 313px;
  555 + }
  556 +
  557 + .clear {
  558 + clear: both;
  559 + margin-bottom: 10px;
  560 + }
  561 +
  562 + .font-color {
  563 + background-color: #ae1e15 !important;
  564 + color: #fff;
  565 + box-shadow: 0 0 5px #ae1e15;
  566 + }
  567 +
  568 + /deep/.el-input-group__prepend {
  569 + font-weight: bold;
  570 + width: 30px;
  571 + text-align: center;
  572 + background: #409eff;
  573 + color: #fff;
  574 + }
  575 +
  576 + .optionInput {
  577 + float: left;
  578 + width: 620px !important;
  579 + }
  580 +
  581 + .el-icon {
  582 + font-size: 20px;
  583 + line-height: 40px;
  584 + margin: 0 5px;
  585 + cursor: pointer;
  586 + color: #409eff !important;
  587 + }
  588 +
  589 + >>>.subjectContentClass .el-checkbox__label {
  590 + padding-right: 10px !important;
  591 + }
  592 +
  593 + .seetingsDiv {
  594 + width: 100%;
  595 + height: 60px;
  596 + background: #efefef;
  597 + line-height: 60px;
  598 + border-radius: 5px;
  599 + box-shadow: 0 0 5px #cdcdcd;
  600 + }
  601 +
  602 + .seetingsDiv button {
  603 + background-color: #304156;
  604 + border: 0px;
  605 + margin-left: 10px;
  606 + box-shadow: 0 0 5px #cdcdcd;
  607 + float: right;
  608 + margin-top: 12px;
  609 + margin-right: 10px;
  610 + }
  611 +
  612 + .areadiv {
  613 + background-color: #efefef;
  614 + border-radius: 5px;
  615 + box-shadow: 0 0 5px #efefef;
  616 + }
  617 +
  618 + .TreeHeader {
  619 + background-color: #304156;
  620 + height: 60px;
  621 + border-radius: 5px;
  622 + box-shadow: 0 0 10px #efefef;
  623 + line-height: 60px;
  624 + color: #fff;
  625 + padding-left: 10px;
  626 + }
  627 +
  628 + .classbtn {
  629 + float: right;
  630 + margin: 11px 10px 0 0;
  631 + height: 35px;
  632 + line-height: 12px;
  633 + }
  634 +
  635 + .eltree {
  636 + background-color: #efefef;
  637 + }
  638 +
  639 + /deep/.el-tree-node__content {
  640 + min-height: 40px;
  641 + }
  642 +
  643 + .custom-tree-node {
  644 + flex: 1;
  645 + display: flex;
  646 + align-items: center;
  647 + justify-content: space-between;
  648 + font-size: 14px;
  649 + padding-right: 8px;
  650 + }
  651 +</style>
737 652 \ No newline at end of file
... ...
src/views/TestPaper/ManualTestPaper.vue
... ... @@ -10,10 +10,12 @@
10 10 <div style="padding:0 10px">
11 11 <el-input size="small" placeholder="输入关键字搜索" v-model="parameter.keyWord"></el-input>
12 12 </div>
  13 +
13 14 <draggable :options="{animation:380,filter:'.unmover'}" group="itxst" v-model="arr1" @end="end1"
14 15 @add="RemoveHere" :move="onMove" class="infinite-list" :style="{'height':contentHeight-80+'px'}"
15 16 infinite-scroll-disabled="disabled" v-infinite-scroll="load" style="overflow:auto">
16   - <li v-for="i in arr1" class="infinite-list-item" :key="i.id">{{ i.subject }}</li>
  17 + <li v-for="i in arr1" class="infinite-list-item" :key="i.id" v-if="!classarr.some(o=>o == i.id)">{{
  18 + i.subject }}</li>
17 19 <p v-if="loading" style="text-align: center;color: #cdcdcd;" class="unmover">加载中...</p>
18 20 <p v-if="noMore" style="text-align: center;color: #cdcdcd;" class="unmover">没有更多了</p>
19 21 </draggable>
... ... @@ -28,6 +30,7 @@
28 30 <i :class="{'el-icon-edit': !edit, 'el-icon-check': edit}" @click="edit = !edit"
29 31 style="margin-left: 5px;cursor: pointer;"></i>
30 32 </div>
  33 +
31 34 <draggable :options="{animation:380}" group="itxst" v-model="arr2" class="infinite-list" @end="end2"
32 35 @add="ComeHere" :style="{'height':contentHeight-60+'px'}" style="overflow:auto;padding-top: 10px;">
33 36 <li v-for="i in arr2" class="infinite-list-item">
... ... @@ -38,6 +41,8 @@
38 41 </li>
39 42 </li>
40 43 </draggable>
  44 +
  45 +
41 46 </div>
42 47 </el-col>
43 48 <el-col :span="8" :style="{'height':contentHeight+'px'}">
... ... @@ -56,7 +61,7 @@
56 61 <span style="margin-right: 10px;">主观题:{{TestPaper.SubjectiveNumber}}</span>
57 62 </el-form-item>
58 63 <el-form-item label="题目总分:" class="el-form-item-custom">
59   - {{TestPaper.TotalScore}}
  64 + {{TestPaper.TotalScore || ''}}
60 65 </el-form-item>
61 66  
62 67  
... ... @@ -114,6 +119,7 @@
114 119 <script>
115 120 import draggable from "vuedraggable";
116 121 import { getQuestionClassList, getQuestionList } from "@/api/QuestionBank";
  122 + import { GetQuestionClassByType } from "@/api/QuestionClass";
117 123 import { EditTestPaper, GetToplevel } from "@/api/TestPaper";
118 124 import { formatTime } from '@/utils/util'
119 125 export default {
... ... @@ -123,6 +129,7 @@
123 129 },
124 130 data() {
125 131 return {
  132 + loadingType:false,
126 133 activeTab: "6",
127 134 parameter: {
128 135 pageIndex: 0,
... ... @@ -138,6 +145,7 @@
138 145 edit: false,
139 146 arr1: [],
140 147 arr2: [],
  148 + classarr: [],
141 149 moveId: -1,
142 150 TestPaper: {
143 151 TestPaperTitle: "未命名试卷标题",
... ... @@ -215,7 +223,7 @@
215 223 methods: {
216 224 changetimestartend(val, aa) {
217 225 this.TestPaper.EffectiveStartTime = formatTime(val[0])
218   - this.TestPaper.EffectiveEndTime = formatTime(val[1])
  226 + this.TestPaper.EffectiveEndTime = formatTime(val[1])
219 227 },
220 228 search() {
221 229 this.parameter.pageIndex = 1;
... ... @@ -223,6 +231,7 @@
223 231 this.GetList();
224 232 },
225 233 SubmitTestPaper() {
  234 + var d = this.TestPaper;
226 235 if (this.arr2.length > 0) {
227 236 EditTestPaper(this.TestPaper).then((res) => {
228 237 if (res.data.code == 200) {
... ... @@ -242,16 +251,32 @@
242 251 this.loading = false;
243 252 },
244 253 GetList() {
245   - getQuestionList(this.parameter).then((res) => {
246   - if (this.parameter.pageIndex == 1) {
247   - this.arr1 = [];
248   - }
249   - res.data.data.rows.forEach((item, i) => {
250   - this.arr1.push(item);
  254 +
  255 + if (this.parameter.QuestionClassId == '1') {
  256 + if(!this.loadingType)
  257 + GetQuestionClassByType({ ClassType: 2 }).then(res => {
  258 + var classarr = res.data.data || [];
  259 + this.arr1 = classarr.map(rs => {
  260 + rs.subject = rs.subjectName = rs.ClassificationName;
  261 + rs.type = 'wd';
  262 + rs.subjectContent = "[]";
  263 + return rs;
  264 + });
  265 + this.loadingType = true;
251 266 });
252   - this.count = res.data.data.total;
253   - this.$forceUpdate();
254   - });
  267 + }
  268 + else {
  269 + getQuestionList(this.parameter).then((res) => {
  270 + if (this.parameter.pageIndex == 1) {
  271 + this.arr1 = [];
  272 + }
  273 + res.data.data.rows.forEach((item, i) => {
  274 + this.arr1.push(item);
  275 + });
  276 + this.count = res.data.data.total;
  277 + this.$forceUpdate();
  278 + });
  279 + }
255 280 },
256 281 end1(e) {
257 282 var that = this;
... ... @@ -287,6 +312,7 @@
287 312 },
288 313 //从左边添加到右边
289 314 ComeHere(e) {
  315 + var d = e.item._underlying_vm_;
290 316 if (e.item._underlying_vm_.subjectType == 1) {
291 317 this.TestPaper.SingleNumber += 1;
292 318 }
... ... @@ -299,6 +325,33 @@
299 325 this.TestPaper.TotalScore += e.item._underlying_vm_.fraction;
300 326  
301 327 this.TestPaper.QuestionBankIds = this.arr2.map((u) => u.id);
  328 +
  329 + if (d.type == 'wd') {
  330 + getQuestionList({
  331 + QuestionClassId: d.id,
  332 + PageIndex: 1,
  333 + PageSize: 1000,
  334 + }).then(res => {
  335 + var data = res.data.data.rows || [];
  336 + this.arr2 = this.arr2.filter(o => o.type != 'wd');
  337 + // this.arr1.splice(this.arr1.findIndex(o=>o.id == d.id),1)
  338 + this.classarr.push(d.id);
  339 + // var test = this.arr2;
  340 + this.arr2.push(...data);
  341 + data.forEach(rs => {
  342 + if (rs.subjectType == 1) {
  343 + this.TestPaper.SingleNumber += 1;
  344 + }
  345 + if (rs.subjectType == 2) {
  346 + this.TestPaper.MultipleNumber += 1;
  347 + }
  348 + if (rs.subjectType == 3) {
  349 + this.TestPaper.SubjectiveNumber += 1;
  350 + }
  351 + });
  352 +
  353 + });
  354 + }
302 355 },
303 356 //右边往左边拖动时的事件
304 357 end2(e) {
... ...
src/views/TestPaper/TestPaperClass.vue
... ... @@ -53,7 +53,7 @@
53 53 <el-input v-model="TestPaperClassInfo.ClassTitle" placeholder="请输入分类名称"></el-input>
54 54 </el-form-item>
55 55 </el-form>
56   - <el-button @click="CreateTestPaperClassHealder" style="margin: 10px 0 0 0 ;float:right" type="primary">确定
  56 + <el-button @click="CreateTestPaperClassHealder" style="margin: 10px 0 0 0 ;float:right" type="primary" :disabled="loading">确定
57 57 </el-button>
58 58 <div style="clear: both;"></div>
59 59 </el-dialog>
... ... @@ -74,6 +74,7 @@
74 74 export default {
75 75 data() {
76 76 return {
  77 + loading:false,
77 78 parameter: {
78 79 pageIndex: 1,
79 80 pageSize: 20,
... ... @@ -110,6 +111,7 @@ this.getTestPaperClassListHeadler();
110 111 },
111 112 methods: {
112 113 CreateTestPaperClassHealder() {
  114 + this.loading = true;
113 115 if (this.TestPaperClassInfo.id == 0) {
114 116 this.TestPaperClassInfo.Addtime = parseTime(new Date(), "");
115 117 this.TestPaperClassInfo.Addtime = parseTime(new Date(), "");
... ... @@ -119,6 +121,9 @@ this.getTestPaperClassListHeadler();
119 121 this.dialogClassIVIsible=false
120 122 this.getTestPaperClassListHeadler();
121 123  
  124 + setTimeout(()=>{
  125 + this.loading = false;
  126 + },1000);
122 127 })
123 128 } else {
124 129 UpdateTestPaperClass(this.TestPaperClassInfo).then(res => {
... ... @@ -126,7 +131,9 @@ this.getTestPaperClassListHeadler();
126 131 this.dialogClassIVIsible=false
127 132 this.TestPaperClassInfo = {};
128 133 this.getTestPaperClassListHeadler();
129   -
  134 + setTimeout(()=>{
  135 + this.loading = false;
  136 + },1000);
130 137 });
131 138 }
132 139 },
... ...
src/views/TestPaper/TestPaperList.vue
... ... @@ -69,7 +69,7 @@
69 69 </span>
70 70 <template #dropdown>
71 71 <el-dropdown-menu>
72   - <el-dropdown-item command="addquestion">题目维护</el-dropdown-item>
  72 + <!-- <el-dropdown-item command="addquestion">题目维护</el-dropdown-item> -->
73 73 <el-dropdown-item command="update">编辑</el-dropdown-item>
74 74 <!-- <el-dropdown-item command="b">锁定</el-dropdown-item> -->
75 75 <el-dropdown-item command="del">删除</el-dropdown-item>
... ... @@ -152,8 +152,10 @@
152 152 GetToplevel,
153 153 EditTestPaper,
154 154 TestPaperUpdate,
155   - getTestPaperClassList
  155 + getTestPaperClassList,
  156 + DeleteTestPaper
156 157 } from '@/api/TestPaper'
  158 + import {formatTime} from '@/utils/util'
157 159 let that
158 160 export default {
159 161 data() {
... ... @@ -161,8 +163,8 @@
161 163 parameter: {
162 164 pageIndex: 1,
163 165 pageSize: 12,
164   - sort: "id",
165   - sortOrder: 1,
  166 + // sort: "id",
  167 + // sortOrder: 1,
166 168 keyword: "",
167 169 QuestionClassId: 0,
168 170 status: 1
... ... @@ -200,8 +202,8 @@
200 202 let parameter = {
201 203 pageIndex: 1,
202 204 pageSize: 10000,
203   - sort: "id",
204   - sortOrder: 1,
  205 + // sort: "id",
  206 + // sortOrder: 1,
205 207 keyword: ""
206 208 }
207 209 getTestPaperClassList(parameter).then(res => {
... ... @@ -229,7 +231,7 @@
229 231 this.getQuestionClassListHeadler();
230 232 },
231 233 methods: {
232   - changetimestartend(val, aa) {
  234 + changetimestartend(val, aa) {
233 235 this.TestPaper.EffectiveStartTime = formatTime(val[0])
234 236 this.TestPaper.EffectiveEndTime = formatTime(val[1])
235 237 },
... ... @@ -331,6 +333,14 @@
331 333 }
332 334 this.TestPaper = val
333 335 }
  336 + else if (value == 'del') {
  337 + DeleteTestPaper(val.id).then(rs=>{
  338 + this.$message.success('删除成功!');
  339 + this.getTestPaperListHeadler();
  340 + })
  341 +
  342 + }
  343 +
334 344 }
335 345 }
336 346 }
... ...
src/views/login/index.vue
... ... @@ -11,7 +11,7 @@
11 11 <span class="svg-container">
12 12 <svg-icon icon-class="user" />
13 13 </span>
14   - <el-input ref="username" v-model="loginForm.username" placeholder="Username" name="username" type="text"
  14 + <el-input ref="username" v-model="loginForm.username" placeholder="用户名" name="username" type="text"
15 15 tabindex="1" auto-complete="on" />
16 16 </el-form-item>
17 17  
... ... @@ -20,7 +20,7 @@
20 20 <svg-icon icon-class="password" />
21 21 </span>
22 22 <el-input :key="passwordType" ref="password" v-model="loginForm.password" :type="passwordType"
23   - placeholder="Password" name="password" tabindex="2" auto-complete="on"
  23 + placeholder="密码" name="password" tabindex="2" auto-complete="on"
24 24 @keyup.enter.native="handleLogin" />
25 25 <span class="show-pwd" @click="showPwd">
26 26 <svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
... ... @@ -28,7 +28,7 @@
28 28 </el-form-item>
29 29  
30 30 <el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;"
31   - @click.native.prevent="handleLogin">Login</el-button>
  31 + @click.native.prevent="handleLogin">登录</el-button>
32 32 <div style="text-align: center;color: #FFF;">技术支持:成都安第斯信息技术有限公司</div>
33 33  
34 34 <!-- <div class="tips">
... ...
src/views/user/userlist.vue
... ... @@ -83,9 +83,10 @@
83 83  
84 84 <el-table-column prop="date" label="近期测试">
85 85 <template slot-scope="{row}">
86   - <span>{{row.TestPaperTitle || '无'}}</span>
87 86 <el-button v-if="row.TestPaperTitle || 1==1" type="text" icon="el-icon-star-off"
88 87 @click="handleTestHitory(row)"></el-button>
  88 + <span>{{row.TestPaperTitle || '无'}}</span>
  89 +
89 90 </template>
90 91 </el-table-column>
91 92 <el-table-column prop="date" label="电话号码">
... ... @@ -139,6 +140,10 @@
139 140 '未命名')}}</el-option>
140 141 </el-select>
141 142 </el-form-item>
  143 + <el-form-item label="允许测评次数">
  144 + <el-input v-model="form.NumberOfAnswers" type="number" placeholder="请输入允许测评次数" style="width:30%"/>
  145 + </el-form-item>
  146 +
142 147 </el-form>
143 148 <div slot="footer" class="dialog-footer">
144 149 <el-button @click="dialogFormVisible = false">取 消</el-button>
... ... @@ -148,6 +153,7 @@
148 153  
149 154 <el-dialog title="测试历史记录" :visible.sync="dialogTableVisible" @close=" gridData =[]" height="400">
150 155 <el-table :data="gridData" height="400">
  156 + <el-table-column property="TestPaperTitle" label="试卷" sortable></el-table-column>
151 157 <el-table-column property="AnswerTime" label="测试时间" width="180" sortable>
152 158 <template slot-scope="scope">
153 159 <span>{{ scope.row.AnswerTime.replace("T", " ") }}</span>
... ... @@ -165,10 +171,11 @@
165 171 </template>
166 172 </el-table-column>
167 173 <el-table-column property="Achievement" label="成绩" sortable></el-table-column>
  174 +
168 175 </el-table>
169 176  
170 177 <div style="text-align:right;margin-top:20px">
171   -
  178 +
172 179 <el-button type="primary" @click="dialogTableVisible = false">
173 180 确定
174 181 </el-button>
... ... @@ -177,21 +184,19 @@
177 184  
178 185  
179 186  
180   - <el-dialog :visible.sync="dialogVisiblecat" :title="dialogTypecat === 'update' ? '修改' : '新增'" width="455px">
181   - <el-form ref="dataForm" :model="temp" label-width="120px" label-position="right">
  187 + <el-dialog :visible.sync="dialogVisiblecat" :title="dialogTypecat === 'update' ? '修改' : '新增'" width="455px" >
  188 + <el-form ref="dataForm" :model="temp" label-width="120px" label-position="right" >
182 189  
183 190 <el-form-item label="分类名称">
184 191 <el-input v-model="temp.ClassTitle" placeholder="请输入名称" />
185 192 </el-form-item>
186   - <!-- <el-form-item label="备注">
187   - <el-input v-model="temp.exid1" placeholder="请输入备注" />
188   - </el-form-item> -->
  193 +
189 194 </el-form>
190 195 <div style="text-align:right;">
191 196 <el-button type="danger" @click="dialogVisiblecat = false">
192 197 取消
193 198 </el-button>
194   - <el-button type="primary" @click="submitcat">
  199 + <el-button type="primary" @click="submitcat" :disabled="loading">
195 200 确定
196 201 </el-button>
197 202 </div>
... ... @@ -247,7 +252,7 @@
247 252 </template>
248 253  
249 254 <script>
250   - import { ImportUserByExcel, GetUserList } from "@/api/user";
  255 + import { ImportUserByExcel, GetUserList, AddInvitationAnswerMultiple } from "@/api/user";
251 256 import { GetUserClassList, UserClassCreate, UserClassUpdate, UserClassDelete } from "@/api/userclass";
252 257 import { GetHistoryList } from '@/api/HistoryAnswer'
253 258  
... ... @@ -257,11 +262,15 @@
257 262 export default {
258 263 data() {
259 264 return {
  265 + loading:false,
260 266 dialogFormVisible: false,
261 267 dialogTableVisible: false,
262 268 dialogTypecat: 'create',
263 269 testpaperlist: [],
264   - form: {},
  270 + form: {
  271 +
  272 + NumberOfAnswers: 3
  273 + },
265 274 userList: [],
266 275 data: [],
267 276 dialogVisiblecat: false,
... ... @@ -331,10 +340,11 @@
331 340 },
332 341 handleShareSend() {
333 342 var rows = this.$refs.userList.selection;
334   - var ids = rows.map(o => o.id) || [];
  343 + var ids = rows.map(o => { return { UserId: o.id } }) || [];
335 344 var postData = {
336 345 TestPaperId: this.form.TestPaperId,
337   - UserList: ids
  346 + NumberOfAnswers: this.form.NumberOfAnswers || 1,
  347 + Users: ids
338 348 };
339 349 if (!ids || ids.length < 1) {
340 350 this.$message.warning('请至少选择一个用户进行发送!');
... ... @@ -351,7 +361,7 @@
351 361 callback: (action) => {
352 362 if (action == "confirm") {
353 363  
354   - SendUserMessage(postData).then(res => {
  364 + AddInvitationAnswerMultiple(postData).then(res => {
355 365 if (res.data.code == 200) {
356 366 this.$message.success('发送成功');
357 367 this.form = {};
... ... @@ -401,10 +411,11 @@
401 411 this.dialogVisible_content = true;
402 412 },
403 413 submitcat() {
404   - // if (this.loading) {
405   - // return
406   - // }
407   - this.loading = true
  414 + // this.$loading({lock:true,text:'保存中...'});
  415 + if (this.loading) {
  416 + return
  417 + }
  418 + this.loading = true
408 419 var postData = this.temp;
409 420 if (this.dialogTypecat == 'update') {
410 421 if (postData.AddTime == '0001-01-01T00:00:00') postData.AddTime = new Date();
... ... @@ -414,6 +425,9 @@
414 425 type: 'success'
415 426 })
416 427 this.dialogVisiblecat = false;
  428 + setTimeout(()=>{
  429 + this.loading = false;
  430 + },1000);
417 431 });
418 432  
419 433 }
... ... @@ -429,6 +443,10 @@
429 443 this.dialogVisiblecat = false
430 444  
431 445 this.loadTree();
  446 + setTimeout(()=>{
  447 + this.loading = false;
  448 + },1000);
  449 +
432 450 });
433 451 }
434 452 },
... ...