Commit c60f4c61676024763e1a26831fcdc399b8389c1b

Authored by 周超
2 parents f7d4b60e f2be913b

Merge branch 'develop_interview' of 39.98.150.180:antissoft/antissoft.dati.admin…

… into develop_interview
src/views/TestPaper/ManualTestPaper.vue
@@ -3,16 +3,24 @@ @@ -3,16 +3,24 @@
3 <el-row :gutter="20"> 3 <el-row :gutter="20">
4 <el-col :span="6" :style="{'height':contentHeight+'px'}"> 4 <el-col :span="6" :style="{'height':contentHeight+'px'}">
5 <div class="grid-content bg-purple"> 5 <div class="grid-content bg-purple">
6 - <div style="width: 100%;height: 80px;background: red;">  
7 - </div>  
8 - <draggable :options="{animation:380,filter:'.unmover'}" group="itxst" v-model="arr1" @end="end1"  
9 - @add="RemoveHere" :move="onMove" class="infinite-list" :style="{'height':contentHeight-80+'px'}"  
10 - infinite-scroll-disabled="disabled" v-infinite-scroll="load" style="overflow:auto">  
11 - <li v-for="i in arr1" class="infinite-list-item">{{ i.subject }}</li>  
12 - <p v-if="loading" style="text-align: center;color: #cdcdcd;" class="unmover">加载中...</p>  
13 - <p v-if="noMore" style="text-align: center;color: #cdcdcd;" class="unmover">没有更多了</p>  
14 - </li>  
15 - </draggable> 6 + <el-tabs
  7 + v-model="activeTab"
  8 + style="padding: 0 20px"
  9 + :stretch="true"
  10 + >
  11 + <el-tab-pane label="专业类" name="6"></el-tab-pane>
  12 + <el-tab-pane label="测评类" name="1"></el-tab-pane>
  13 + </el-tabs>
  14 + <div style="padding:0 10px">
  15 + <el-input size="small" placeholder="输入关键字搜索" v-model="parameter.keyWord"></el-input>
  16 + </div>
  17 + <draggable :options="{animation:380,filter:'.unmover'}" group="itxst" v-model="arr1" @end="end1"
  18 + @add="RemoveHere" :move="onMove" class="infinite-list" :style="{'height':contentHeight-80+'px'}"
  19 + infinite-scroll-disabled="disabled" v-infinite-scroll="load" style="overflow:auto">
  20 + <li v-for="i in arr1" class="infinite-list-item" :key="i.id">{{ i.subject }}</li>
  21 + <p v-if="loading" style="text-align: center;color: #cdcdcd;" class="unmover">加载中...</p>
  22 + <p v-if="noMore" style="text-align: center;color: #cdcdcd;" class="unmover">没有更多了</p>
  23 + </draggable>
16 24
17 </div> 25 </div>
18 </el-col> 26 </el-col>
@@ -93,292 +101,320 @@ @@ -93,292 +101,320 @@
93 </template> 101 </template>
94 102
95 <script> 103 <script>
96 - import draggable from 'vuedraggable'  
97 - import {  
98 - getQuestionClassList,  
99 - getQuestionList,  
100 - } from '@/api/QuestionBank'  
101 - import {  
102 - EditTestPaper,  
103 - GetToplevel  
104 - } from '@/api/TestPaper'  
105 - export default {  
106 - //注册draggable组件  
107 - components: {  
108 - draggable,  
109 - },  
110 - data() {  
111 - return {  
112 - parameter: {  
113 - pageIndex: 0,  
114 - pageSize: 12,  
115 - sort: "id",  
116 - sortOrder: 1,  
117 - keyword: "",  
118 - QuestionClassId: 0,  
119 - status: 1  
120 - },  
121 - contentHeight: 0,  
122 - count: 0,  
123 - edit: false,  
124 - arr1: [],  
125 - arr2: [],  
126 - moveId: -1,  
127 - TestPaper: {  
128 - TestPaperTitle: "未命名试卷标题",  
129 - TestPaperClassId: 0,  
130 - TotalScore: 0,  
131 - Describe: "",  
132 - SingleNumber: 0,  
133 - MultipleNumber: 0,  
134 - SubjectiveNumber: 0,  
135 - OriginalPrice: "0",  
136 - PresentPrice: "0",  
137 - MembershipPrice: "0",  
138 - QuestionBankIds: []  
139 - },  
140 - loading: false,  
141 - rules: {  
142 - OriginalPrice: [{  
143 - required: true,  
144 - message: '不能为空'  
145 - }],  
146 - PresentPrice: [{  
147 - required: true,  
148 - message: '不能为空'  
149 - }],  
150 - MembershipPrice: [{  
151 - required: true,  
152 - message: '不能为空'  
153 - }]  
154 - },  
155 - QuestionClass: [],  
156 - treeData: [{  
157 - value:0,  
158 - label:"全部"  
159 - }]  
160 - }  
161 - },  
162 - computed: {  
163 - noMore() {  
164 - return this.arr1.length >= this.count  
165 - },  
166 - disabled() {  
167 - return this.loading || this.noMore  
168 - }  
169 - },  
170 - created() {  
171 -  
172 - },  
173 - mounted() {  
174 - //计算页面内容区域的高度  
175 - this.contentHeight = window.innerHeight - 90;  
176 - this.getQuestionClassListHeadler();  
177 - //this.GetList();  
178 - },  
179 - methods: {  
180 - SubmitTestPaper() {  
181 - if (this.arr2.length > 0) {  
182 - EditTestPaper(this.TestPaper).then(res => {  
183 - if(res.data.code==200){  
184 - this.$confirm('组卷成功!', '消息')  
185 - }else{  
186 - this.$confirm('组卷失败!', '消息')  
187 - }  
188 - });  
189 - } else {  
190 - this.$confirm('试题未有题目!', '消息')  
191 - }  
192 - },  
193 - load() {  
194 - this.loading = true  
195 - this.parameter.pageIndex += 1;  
196 - this.GetList();  
197 - this.loading = false;  
198 - },  
199 - GetList() {  
200 - getQuestionList(this.parameter).then(res => {  
201 - res.data.data.rows.forEach((item, i) => {  
202 - this.arr1.push(item)  
203 - })  
204 - this.count = res.data.data.total;  
205 - this.$forceUpdate();  
206 - });  
207 - },  
208 - end1(e, ) {  
209 - var that = this;  
210 - if (that.arr1.length < 10) {  
211 - this.load();  
212 - }  
213 -  
214 - var items = this.arr2.filter(function(m) {  
215 - return m.id == that.moveId  
216 - }) 104 +import draggable from "vuedraggable";
  105 +import { getQuestionClassList, getQuestionList } from "@/api/QuestionBank";
  106 +import { EditTestPaper, GetToplevel } from "@/api/TestPaper";
  107 +export default {
  108 + //注册draggable组件
  109 + components: {
  110 + draggable,
  111 + },
  112 + data() {
  113 + return {
  114 + activeTab: "6",
  115 + parameter: {
  116 + pageIndex: 0,
  117 + pageSize: 20,
  118 + sort: "id",
  119 + sortOrder: 1,
  120 + keyWord: "",
  121 + QuestionClassId: 6,
  122 + status: 1,
  123 + },
  124 + contentHeight: 0,
  125 + count: 0,
  126 + edit: false,
  127 + arr1: [],
  128 + arr2: [],
  129 + moveId: -1,
  130 + TestPaper: {
  131 + TestPaperTitle: "未命名试卷标题",
  132 + TestPaperClassId: 0,
  133 + TotalScore: 0,
  134 + Describe: "",
  135 + SingleNumber: 0,
  136 + MultipleNumber: 0,
  137 + SubjectiveNumber: 0,
  138 + OriginalPrice: "0",
  139 + PresentPrice: "0",
  140 + MembershipPrice: "0",
  141 + QuestionBankIds: [],
  142 + },
  143 + loading: false,
  144 + rules: {
  145 + OriginalPrice: [
  146 + {
  147 + required: true,
  148 + message: "不能为空",
  149 + },
  150 + ],
  151 + PresentPrice: [
  152 + {
  153 + required: true,
  154 + message: "不能为空",
  155 + },
  156 + ],
  157 + MembershipPrice: [
  158 + {
  159 + required: true,
  160 + message: "不能为空",
  161 + },
  162 + ],
  163 + },
  164 + QuestionClass: [],
  165 + treeData: [
  166 + {
  167 + value: 0,
  168 + label: "全部",
  169 + },
  170 + ],
  171 + timeout: 0,
  172 + };
  173 + },
  174 + watch: {
  175 + activeTab() {
  176 + console.log("activeTab watch");
  177 + this.search();
  178 + },
  179 + "parameter.keyWord": {
  180 + handler() {
  181 + clearTimeout(this.timeout);
  182 + this.timeout = setTimeout(() => {
  183 + this.search();
  184 + }, 200);
  185 + },
  186 + },
  187 + },
  188 + computed: {
  189 + noMore() {
  190 + return this.arr1.length >= this.count;
  191 + },
  192 + disabled() {
  193 + return this.loading || this.noMore;
  194 + },
  195 + },
  196 + created() {},
  197 + mounted() {
  198 + //计算页面内容区域的高度
  199 + this.contentHeight = window.innerHeight - 90;
  200 + this.getQuestionClassListHeadler();
  201 + //this.GetList();
  202 + },
  203 + methods: {
  204 + search() {
  205 + this.parameter.pageIndex = 1;
  206 + this.parameter.QuestionClassId = Number(this.activeTab);
  207 + this.GetList();
  208 + },
  209 + SubmitTestPaper() {
  210 + if (this.arr2.length > 0) {
  211 + EditTestPaper(this.TestPaper).then((res) => {
  212 + if (res.data.code == 200) {
  213 + this.$confirm("组卷成功!", "消息");
  214 + } else {
  215 + this.$confirm("组卷失败!", "消息");
  216 + }
  217 + });
  218 + } else {
  219 + this.$confirm("试题未有题目!", "消息");
  220 + }
  221 + },
  222 + load() {
  223 + this.loading = true;
  224 + this.parameter.pageIndex++;
  225 + this.GetList();
  226 + this.loading = false;
  227 + },
  228 + GetList() {
  229 + getQuestionList(this.parameter).then((res) => {
  230 + if (this.parameter.pageIndex == 1) {
  231 + this.arr1 = [];
  232 + }
  233 + res.data.data.rows.forEach((item, i) => {
  234 + this.arr1.push(item);
  235 + });
  236 + this.count = res.data.data.total;
  237 + this.$forceUpdate();
  238 + });
  239 + },
  240 + end1(e) {
  241 + var that = this;
  242 + if (that.arr1.length < 10) {
  243 + this.load();
  244 + }
217 245
218 - //如果左边  
219 - if (items.length < 2) return;  
220 - this.arr2.splice(e.newDraggableIndex, 1) 246 + var items = this.arr2.filter(function (m) {
  247 + return m.id == that.moveId;
  248 + });
221 249
222 - // SingleNumber:0,  
223 - // MultipleNumber:0,  
224 - // SubjectiveNumber:0,  
225 - },  
226 - //从右边移除到左边  
227 - RemoveHere(e) {  
228 - if (e.item._underlying_vm_.subjectType == 1) {  
229 - this.TestPaper.SingleNumber -= 1;  
230 - }  
231 - if (e.item._underlying_vm_.subjectType == 2) {  
232 - this.TestPaper.MultipleNumber -= 1;  
233 - }  
234 - if (e.item._underlying_vm_.subjectType == 3) {  
235 - this.TestPaper.SubjectiveNumber -= 1;  
236 - }  
237 - this.TestPaper.TotalScore -= e.item._underlying_vm_.fraction;  
238 - this.TestPaper.QuestionBankIds = this.arr2.map(u => u.id);  
239 - },  
240 - //从左边添加到右边  
241 - ComeHere(e) {  
242 - if (e.item._underlying_vm_.subjectType == 1) {  
243 - this.TestPaper.SingleNumber += 1;  
244 - }  
245 - if (e.item._underlying_vm_.subjectType == 2) {  
246 - this.TestPaper.MultipleNumber += 1;  
247 - }  
248 - if (e.item._underlying_vm_.subjectType == 3) {  
249 - this.TestPaper.SubjectiveNumber += 1;  
250 - }  
251 - this.TestPaper.TotalScore += e.item._underlying_vm_.fraction; 250 + //如果左边
  251 + if (items.length < 2) return;
  252 + this.arr2.splice(e.newDraggableIndex, 1);
252 253
253 - this.TestPaper.QuestionBankIds = this.arr2.map(u => u.id);  
254 - },  
255 - //右边往左边拖动时的事件  
256 - end2(e) {  
257 - var that = this;  
258 - var items = this.arr1.filter(function(m) {  
259 - return m.id == that.moveId  
260 - })  
261 - //如果左边  
262 - if (items.length < 2) return;  
263 - this.arr1.splice(e.newDraggableIndex, 1)  
264 - },  
265 - //move回调方法  
266 - onMove(e, originalEvent) {  
267 - //this.moveId = e.relatedContext.element.id;  
268 - return true;  
269 - },  
270 - getQuestionClassListHeadler() {  
271 - let _this = this;  
272 - GetToplevel().then(res => {  
273 - var gettree = function(titem) {  
274 - titem.children = []  
275 - let childrenList = res.data.data.filter(u => u.ParentId == titem.value);  
276 - if (childrenList.length == 0)  
277 - titem.children = undefined;  
278 - res.data.data.filter(u => u.ParentId == titem.value).forEach((item, i) => {  
279 - var model = {  
280 - value: item.id,  
281 - label: item.ClassTitle  
282 - };  
283 - gettree(model);  
284 - titem.children.push(model);  
285 - })  
286 - }  
287 - res.data.data.filter(u => u.ParentId == 0).forEach((item, i) => {  
288 - var model = {  
289 - value: item.id,  
290 - label: item.ClassTitle  
291 - };  
292 - gettree(model);  
293 - _this.QuestionClass.push(model);  
294 - _this.treeData.push(model)  
295 - })  
296 - });  
297 - } 254 + // SingleNumber:0,
  255 + // MultipleNumber:0,
  256 + // SubjectiveNumber:0,
  257 + },
  258 + //从右边移除到左边
  259 + RemoveHere(e) {
  260 + if (e.item._underlying_vm_.subjectType == 1) {
  261 + this.TestPaper.SingleNumber -= 1;
  262 + }
  263 + if (e.item._underlying_vm_.subjectType == 2) {
  264 + this.TestPaper.MultipleNumber -= 1;
  265 + }
  266 + if (e.item._underlying_vm_.subjectType == 3) {
  267 + this.TestPaper.SubjectiveNumber -= 1;
  268 + }
  269 + this.TestPaper.TotalScore -= e.item._underlying_vm_.fraction;
  270 + this.TestPaper.QuestionBankIds = this.arr2.map((u) => u.id);
  271 + },
  272 + //从左边添加到右边
  273 + ComeHere(e) {
  274 + if (e.item._underlying_vm_.subjectType == 1) {
  275 + this.TestPaper.SingleNumber += 1;
  276 + }
  277 + if (e.item._underlying_vm_.subjectType == 2) {
  278 + this.TestPaper.MultipleNumber += 1;
  279 + }
  280 + if (e.item._underlying_vm_.subjectType == 3) {
  281 + this.TestPaper.SubjectiveNumber += 1;
  282 + }
  283 + this.TestPaper.TotalScore += e.item._underlying_vm_.fraction;
298 284
299 - }  
300 - } 285 + this.TestPaper.QuestionBankIds = this.arr2.map((u) => u.id);
  286 + },
  287 + //右边往左边拖动时的事件
  288 + end2(e) {
  289 + var that = this;
  290 + var items = this.arr1.filter(function (m) {
  291 + return m.id == that.moveId;
  292 + });
  293 + //如果左边
  294 + if (items.length < 2) return;
  295 + this.arr1.splice(e.newDraggableIndex, 1);
  296 + },
  297 + //move回调方法
  298 + onMove(e, originalEvent) {
  299 + //this.moveId = e.relatedContext.element.id;
  300 + return true;
  301 + },
  302 + getQuestionClassListHeadler() {
  303 + let _this = this;
  304 + GetToplevel().then((res) => {
  305 + var gettree = function (titem) {
  306 + titem.children = [];
  307 + let childrenList = res.data.data.filter(
  308 + (u) => u.ParentId == titem.value
  309 + );
  310 + if (childrenList.length == 0) titem.children = undefined;
  311 + res.data.data
  312 + .filter((u) => u.ParentId == titem.value)
  313 + .forEach((item, i) => {
  314 + var model = {
  315 + value: item.id,
  316 + label: item.ClassTitle,
  317 + };
  318 + gettree(model);
  319 + titem.children.push(model);
  320 + });
  321 + };
  322 + res.data.data
  323 + .filter((u) => u.ParentId == 0)
  324 + .forEach((item, i) => {
  325 + var model = {
  326 + value: item.id,
  327 + label: item.ClassTitle,
  328 + };
  329 + gettree(model);
  330 + _this.QuestionClass.push(model);
  331 + _this.treeData.push(model);
  332 + });
  333 + });
  334 + },
  335 + },
  336 +};
301 </script> 337 </script>
302 338
303 <style lang="scss" scoped> 339 <style lang="scss" scoped>
304 - .el-row {  
305 - /* margin-bottom: 20px; */  
306 - &:last-child {  
307 - margin-bottom: 0;  
308 - }  
309 - }  
310 - .el-col {  
311 - border-radius: 4px;  
312 - }  
313 - .bg-purple-dark {  
314 - background: #99a9bf;  
315 - }  
316 - .bg-purple {  
317 - background: #efefef;  
318 - }  
319 - .bg-purple-light {  
320 - background: #e5e9f2;  
321 - }  
322 - .grid-content {  
323 - border-radius: 4px;  
324 - min-height: 36px;  
325 - height: 100%;  
326 - }  
327 - .row-bg {  
328 - padding: 10px 0;  
329 - background-color: #f9fafc;  
330 - }  
331 - .infinite-list {  
332 - list-style: none;  
333 - margin: 0px;  
334 - padding: 0px;  
335 - &::-webkit-scrollbar {  
336 - width: 6px;  
337 - }  
338 - //滚动条小方块  
339 - &::-webkit-scrollbar-thumb {  
340 - border-radius: 10px;  
341 - background: #304156;  
342 - }  
343 - //滚动条轨道  
344 - &::-webkit-scrollbar-track {  
345 - // border-radius: 10px;  
346 - height: 100px;  
347 - background: #cdcdcd;  
348 - }  
349 - .infinite-list-item {  
350 - padding: 10px;  
351 - min-height: 60px;  
352 - width: 95%;  
353 - margin: auto;  
354 - background-color: #FFF;  
355 - margin-bottom: 10px;  
356 - border-radius: 5px;  
357 - box-shadow: 0 0 5px #cdcdcd;  
358 - &:first-child {  
359 - margin-top: 10px;  
360 - }  
361 - }  
362 - }  
363 - .option-p {  
364 - line-height: 15px;  
365 - }  
366 - .areahead {  
367 - text-align: center;  
368 - height: 60px;  
369 - line-height: 60px;  
370 - border-bottom: 1px solid #cdcdcd;  
371 - }  
372 - .testPaper-manager{  
373 - margin: 10px 20px 10px 10px;  
374 - }  
375 - .testPaper-manager .el-form-item {  
376 - margin-bottom: 20px;  
377 - }  
378 - .el-form-item-custom {  
379 - margin-bottom: 0px !important;  
380 - }  
381 - .testpaper-input {  
382 - //max-width: 400px;  
383 - } 340 +.el-row {
  341 + /* margin-bottom: 20px; */
  342 + &:last-child {
  343 + margin-bottom: 0;
  344 + }
  345 +}
  346 +.el-col {
  347 + border-radius: 4px;
  348 +}
  349 +.bg-purple-dark {
  350 + background: #99a9bf;
  351 +}
  352 +.bg-purple {
  353 + background: #efefef;
  354 +}
  355 +.bg-purple-light {
  356 + background: #e5e9f2;
  357 +}
  358 +.grid-content {
  359 + border-radius: 4px;
  360 + min-height: 36px;
  361 + height: 100%;
  362 +}
  363 +.row-bg {
  364 + padding: 10px 0;
  365 + background-color: #f9fafc;
  366 +}
  367 +.infinite-list {
  368 + list-style: none;
  369 + margin: 0px;
  370 + padding: 0px;
  371 + &::-webkit-scrollbar {
  372 + width: 6px;
  373 + }
  374 + //滚动条小方块
  375 + &::-webkit-scrollbar-thumb {
  376 + border-radius: 10px;
  377 + background: #304156;
  378 + }
  379 + //滚动条轨道
  380 + &::-webkit-scrollbar-track {
  381 + // border-radius: 10px;
  382 + height: 100px;
  383 + background: #cdcdcd;
  384 + }
  385 + .infinite-list-item {
  386 + padding: 10px;
  387 + min-height: 60px;
  388 + width: 95%;
  389 + margin: auto;
  390 + background-color: #fff;
  391 + margin-bottom: 10px;
  392 + border-radius: 5px;
  393 + box-shadow: 0 0 5px #cdcdcd;
  394 + &:first-child {
  395 + margin-top: 10px;
  396 + }
  397 + }
  398 +}
  399 +.option-p {
  400 + line-height: 15px;
  401 +}
  402 +.areahead {
  403 + text-align: center;
  404 + height: 60px;
  405 + line-height: 60px;
  406 + border-bottom: 1px solid #cdcdcd;
  407 +}
  408 +.testPaper-manager {
  409 + margin: 10px 20px 10px 10px;
  410 +}
  411 +.testPaper-manager .el-form-item {
  412 + margin-bottom: 20px;
  413 +}
  414 +.el-form-item-custom {
  415 + margin-bottom: 0px !important;
  416 +}
  417 +.testpaper-input {
  418 + //max-width: 400px;
  419 +}
384 </style> 420 </style>