Blame view

src/views/TestPaper/ManualTestPaper.vue 25.1 KB
b89c8760   wangming   项目初始化
1
  <template>
cac28d75   周超   问卷 用户 维度
2
    <div class="app-container">
e1644c39   yangzhi   王哥起来屙尿了
3
      <div id="id_test_video" style="width:100%; height:auto;"></div>
cac28d75   周超   问卷 用户 维度
4
5
6
7
8
9
10
11
12
13
      <el-row :gutter="20">
        <el-col :span="6" :style="{'height':contentHeight+'px'}">
          <div class="grid-content bg-purple">
            <el-tabs v-model="activeTab" style="padding: 0 20px" :stretch="true">
              <el-tab-pane label="专业类" name="6"></el-tab-pane>
              <el-tab-pane label="测评类" name="1"></el-tab-pane>
            </el-tabs>
            <div style="padding:0 10px">
              <el-input size="small" placeholder="输入关键字搜索" v-model="parameter.keyWord"></el-input>
            </div>
4ee13894   周超   给大志哥
14
15
16
            <div style="padding:10.5px">
              <el-button type="primary" @click="randomSubject" style="width:100%">随机抽题</el-button>
            </div>
e011bf15   周超   我先走一步
17
  
cac28d75   周超   问卷 用户 维度
18
19
20
            <draggable :options="{animation:380,filter:'.unmover'}" group="itxst" v-model="arr1" @end="end1"
              @add="RemoveHere" :move="onMove" class="infinite-list" :style="{'height':contentHeight-80+'px'}"
              infinite-scroll-disabled="disabled" v-infinite-scroll="load" style="overflow:auto">
04aebc72   周超   11
21
  
e011bf15   周超   我先走一步
22
23
              <li v-for="i in arr1" class="infinite-list-item" :key="i.id" v-if="!classarr.some(o=>o == i.id)">{{
                i.subject }}</li>
cac28d75   周超   问卷 用户 维度
24
25
26
              <p v-if="loading" style="text-align: center;color: #cdcdcd;" class="unmover">加载中...</p>
              <p v-if="noMore" style="text-align: center;color: #cdcdcd;" class="unmover">没有更多了</p>
            </draggable>
b89c8760   wangming   项目初始化
27
  
cac28d75   周超   问卷 用户 维度
28
29
30
31
32
          </div>
        </el-col>
        <el-col :span="10" :style="{'height':contentHeight+'px'}">
          <div class="grid-content bg-purple">
            <div class="areahead">
94c54e92   周超   1
33
34
              <!-- <span v-show="!edit" style="font-weight: bold;">{{ TestPaper.TestPaperTitle }}</span> -->
              <!-- <el-input v-show="edit" style="width: 400px;" v-model="TestPaper.TestPaperTitle"></el-input>
cac28d75   周超   问卷 用户 维度
35
              <i :class="{'el-icon-edit': !edit, 'el-icon-check': edit}" @click="edit = !edit"
94c54e92   周超   1
36
37
                style="margin-left: 5px;cursor: pointer;"></i> -->
                题目内容
cac28d75   周超   问卷 用户 维度
38
            </div>
e011bf15   周超   我先走一步
39
  
cac28d75   周超   问卷 用户 维度
40
41
            <draggable :options="{animation:380}" group="itxst" v-model="arr2" class="infinite-list" @end="end2"
              @add="ComeHere" :style="{'height':contentHeight-60+'px'}" style="overflow:auto;padding-top: 10px;">
94c54e92   周超   1
42
43
              <li v-for="(i,index) in arr2" class="infinite-list-item">
                <label> {{index+1}}. [{{i.subjectName}}]{{ i.subject }}</label>
cac28d75   周超   问卷 用户 维度
44
45
46
47
48
49
                <div v-for="item in JSON.parse(i.subjectContent)">
                  <p class="option-p">{{item.option}}:{{item.optionContent}}</p>
                </div>
              </li>
              </li>
            </draggable>
e011bf15   周超   我先走一步
50
51
  
  
cac28d75   周超   问卷 用户 维度
52
53
54
55
56
57
          </div>
        </el-col>
        <el-col :span="8" :style="{'height':contentHeight+'px'}">
          <div class="grid-content bg-purple">
            <div class="areahead">组卷基本信息</div>
            <el-form ref="form" class="testPaper-manager" :rules="rules" :model="TestPaper" label-width="100px">
c5b61549   周超   111
58
              <el-form-item label="试卷名称:"  prop="TestPaperTitle" required class="el-form-item-custom">
94c54e92   周超   1
59
                <el-input   v-model="TestPaper.TestPaperTitle"></el-input>
cac28d75   周超   问卷 用户 维度
60
61
              </el-form-item>
              <el-form-item label="题目数量:" class="el-form-item-custom">
c5b61549   周超   111
62
           
cac28d75   周超   问卷 用户 维度
63
64
65
66
67
              </el-form-item>
              <el-form-item label="题型数量:" class="el-form-item-custom">
                <span style="margin-right: 10px;">单选题:{{TestPaper.SingleNumber}}</span>
                <span style="margin-right: 10px;">多选题:{{TestPaper.MultipleNumber}}</span>
                <span style="margin-right: 10px;">主观题:{{TestPaper.SubjectiveNumber}}</span>
7cc95822   yangzhi   组卷修改
68
                <span style="margin-right: 10px;">主观题:{{TestPaper.VoiceNumber}}</span>
cac28d75   周超   问卷 用户 维度
69
70
              </el-form-item>
              <el-form-item label="题目总分:" class="el-form-item-custom">
e011bf15   周超   我先走一步
71
                {{TestPaper.TotalScore || ''}}
cac28d75   周超   问卷 用户 维度
72
73
              </el-form-item>
  
04aebc72   周超   11
74
75
76
77
78
79
80
              <el-form-item label="工种" prop="UserTypeOfWork" required class="el-form-item-custom"
                style="margin-bottom: 20px !important;width:100%;">
                <el-select v-model="TestPaper.UserTypeOfWork" placeholder="请选择工种" style="width:100%">
                  <el-option v-for="item in usertypelist" :label="item.name" :value="item.id"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="分类" class="el-form-item-custom" prop="QuestionClassId"  >
cac28d75   周超   问卷 用户 维度
81
                <el-cascader class="testpaper-input" v-model="TestPaper.QuestionClassId"
04aebc72   周超   11
82
                  style="width:100%;margin-bottom: 20px;" :props="{emitPath:false}" :clearable=true
cac28d75   周超   问卷 用户 维度
83
84
85
86
                  :options="QuestionClass">
                </el-cascader>
              </el-form-item>
  
c33c1243   周超   拉取王哥最新的
87
88
89
90
91
92
        <el-form-item label="级别" prop="FLevelCount"   class="el-form-item-custom"
                style="margin-bottom: 20px !important;width:100%;"> 
                <el-select v-model="TestPaper.FLevelCount" placeholder="请选择级别" @change="changelevel" style="width:100%">
                  <el-option v-for="item in levellist" :label="item.title" :value="item.f_count"></el-option>
                </el-select>
              </el-form-item>
04aebc72   周超   11
93
  
cac28d75   周超   问卷 用户 维度
94
              <el-form-item label="有效时间" required>
04aebc72   周超   11
95
96
                <el-form-item prop="date">
                  <el-date-picker v-model="TestPaper.date" @change="changetimestartend" type="datetimerange" 
cac28d75   周超   问卷 用户 维度
97
98
99
100
101
                    format="yyyy-MM-dd hh:mm:ss" range-separator="至" start-placeholder="开始时间" style="width:100%"
                    end-placeholder="结束时间">
                  </el-date-picker>
                </el-form-item>
              </el-form-item>
e1644c39   yangzhi   王哥起来屙尿了
102
              <el-form-item label="总时长控制" prop="AnswerTime">
cac28d75   周超   问卷 用户 维度
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
                <el-input class="testpaper-input" type="number" placeholder="总时长控制(分钟)" v-model="TestPaper.AnswerTime">
                </el-input>
              </el-form-item>
  
              <el-form-item label="试卷原价:" prop="OriginalPrice" v-show="false">
                <el-input class="testpaper-input" oninput="value=value.replace(/[^0-9.]/g,'')"
                  v-model="TestPaper.OriginalPrice" :precision="0">
                  <template slot="append">元</template>
                </el-input>
              </el-form-item>
              <el-form-item label="试卷价格:" prop="PresentPrice" v-show="false">
                <el-input class="testpaper-input" oninput="value=value.replace(/[^0-9.]/g,'')"
                  v-model="TestPaper.PresentPrice">
                  <template slot="append">元</template>
                </el-input>
              </el-form-item>
              <el-form-item label="会员价:" prop="MembershipPrice" v-show="false">
                <el-input class="testpaper-input" oninput="value=value.replace(/[^0-9.]/g,'')"
                  v-model="TestPaper.MembershipPrice">
                  <template slot="append">元</template>
                </el-input>
              </el-form-item>
              <el-form-item label="试卷简介:">
                <el-input class="testpaper-input" :rows="10" type="textarea" v-model="TestPaper.Describe">
                </el-input>
              </el-form-item>
              <el-button type="primary" style="float: right;" @click="SubmitTestPaper">保存
              </el-button>
            </el-form>
          </div>
        </el-col>
      </el-row>
4ee13894   周超   给大志哥
135
136
  
  
04aebc72   周超   11
137
  
e1644c39   yangzhi   王哥起来屙尿了
138
      <el-dialog title="随机抽题" :visible.sync="dialogTableVisible">
04aebc72   周超   11
139
  
e1644c39   yangzhi   王哥起来屙尿了
140
141
142
        <ul class="random-list">
          <li v-for="(item,index) in randomSubjectList" :key="index">
            <span>试题分类:</span>
c33c1243   周超   拉取王哥最新的
143
144
145
146
147
148
149
150
151
            <el-cascader :multiple="false" style="flex:1" @change="(a)=>{ changetype(a,item)}" v-model="item.QuestionClassId" :options="randomQuestionTypeList"
              clearable>
              <template slot-scope="{ node, data }">
                <span>{{ data.label }}</span> 
                <span v-if="data.subjectCount"> ({{ data.subjectCount || '0' }}) </span>
              </template>
            </el-cascader>
            <span style="margin-left:10px;">试题数量:{{item.maxcount}}</span>
            <el-input-number v-model="item.Count" :min="1" :max="item.maxcount" label="描述文字" style="margin-left:10px;">
04aebc72   周超   11
152
153
154
            </el-input-number>
            <i class="el-icon-remove-outline" @click="changeSubjectCount(-1,index)"
              style="margin-left:10px;color:#f56c6c;"></i>
e1644c39   yangzhi   王哥起来屙尿了
155
156
157
158
159
160
161
            <i class="el-icon-circle-plus" @click="changeSubjectCount(1)" style="margin-left:10px;color:#67C23A;"></i>
          </li>
        </ul>
        <div slot="footer">
          <el-button @click="randomCancel">取消</el-button>
          <el-button type="primary" @click="randomSubmit">确定</el-button>
        </div>
4ee13894   周超   给大志哥
162
163
      </el-dialog>
  
cac28d75   周超   问卷 用户 维度
164
    </div>
b89c8760   wangming   项目初始化
165
  </template>
e1644c39   yangzhi   王哥起来屙尿了
166
  <style lang="scss" scoped>
04aebc72   周超   11
167
    .random-list {
e1644c39   yangzhi   王哥起来屙尿了
168
      display: flex;
04aebc72   周超   11
169
170
171
172
173
174
175
176
177
178
179
      flex-direction: column;
  
      li {
        margin-bottom: 20px;
        display: flex;
        align-items: center;
  
        [class^="el-icon"] {
          font-size: 24px;
          cursor: pointer;
        }
e1644c39   yangzhi   王哥起来屙尿了
180
181
      }
    }
e1644c39   yangzhi   王哥起来屙尿了
182
  </style>
b89c8760   wangming   项目初始化
183
  <script>
04aebc72   周超   11
184
185
    import draggable from "vuedraggable";
    import { PostRandomGetQuestion, getQuestionList, getQuestionClassList } from "@/api/QuestionBank";
c33c1243   周超   拉取王哥最新的
186
187
188
    import { GetpaperLevelList } from "@/api/paperLevel";
  
    
04aebc72   周超   11
189
190
191
192
193
194
195
196
197
198
199
200
201
202
    import { GetQuestionClassByType } from "@/api/QuestionClass";
    import { EditTestPaper, GetToplevel } from "@/api/TestPaper";
    import { formatTime } from "@/utils/util";
    import {
      GetTypeSetting
    } from '@/api/user'
    export default {
      //注册draggable组件
      components: {
        draggable,
      },
      data() {
        return {
          randomSubjectList: [
172a152f   yangzhi   组卷左侧题目的分类
203
            {
04aebc72   周超   11
204
205
              QuestionClassId: "",
              Count: "",
172a152f   yangzhi   组卷左侧题目的分类
206
            },
e1644c39   yangzhi   王哥起来屙尿了
207
            {
04aebc72   周超   11
208
209
              QuestionClassId: "",
              Count: "",
e1644c39   yangzhi   王哥起来屙尿了
210
211
            },
          ],
04aebc72   周超   11
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
          randomQuestionTypeList: [],
          dynamicValidateForm: {
            domains: [
              {
                value: "",
              },
            ],
            email: "",
          },
          usertypelist: [], //工种
          dialogTableVisible: false,
          loadingType: false,
          activeTab: "6",
          parameter: {
            pageIndex: 0,
            pageSize: 20,
            sort: "id",
            sortOrder: 1,
            keyWord: "",
            QuestionClassId: 6,
            status: 1,
          },
          contentHeight: 0,
          count: 0,
          edit: false,
          arr1: [],
          arr2: [],
          classarr: [],
          moveId: -1,
          TestPaper: {
            TestPaperTitle: "未命名试卷标题",
            TestPaperClassId: 0,
            TotalScore: 0,
            Describe: "",
            SingleNumber: 0,
            MultipleNumber: 0,
            SubjectiveNumber: 0,
7cc95822   yangzhi   组卷修改
249
            VoiceNumber:0,
04aebc72   周超   11
250
251
252
253
            OriginalPrice: "0",
            PresentPrice: "0",
            MembershipPrice: "0",
            QuestionBankIds: [],
c33c1243   周超   拉取王哥最新的
254
            FLevelCount:0
04aebc72   周超   11
255
256
257
258
259
260
261
262
          },
          loading: false,
          rules: {
            OriginalPrice: [
              {
                required: true,
                message: "不能为空",
              },
c33c1243   周超   拉取王哥最新的
263
            ],   
04aebc72   周超   11
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
            PresentPrice: [
              {
                required: true,
                message: "不能为空",
              },
            ],
            UserTypeOfWork: [
              {
                required: true,
                message: "请选择工种",
              },
            ], QuestionClassId: [
              {
                required: true,
                message: "请选择分类", 
              },
            ],date: [
              {
                required: true,
                message: "请选择时间段", 
              },
            ],
c5b61549   周超   111
286
287
288
289
            TestPaperTitle: [
              {
                required: true,
                message: "请填写试卷名称", 
6963d762   周超   拉取志哥最新的
290
              } 
c5b61549   周超   111
291
292
            ],
  
6963d762   周超   拉取志哥最新的
293
294
295
296
297
298
299
            AnswerTime: [
              {
                required: true,
                message: "请填写试总时长控制", 
              },
   
            ],
04aebc72   周超   11
300
301
302
          },
          QuestionClass: [],
          treeData: [
e1644c39   yangzhi   王哥起来屙尿了
303
            {
04aebc72   周超   11
304
305
              value: 0,
              label: "全部",
e1644c39   yangzhi   王哥起来屙尿了
306
307
            },
          ],
04aebc72   周超   11
308
          timeout: 0,
c33c1243   周超   拉取王哥最新的
309
310
          typelist:[],
          levellist:[] //等级
04aebc72   周超   11
311
312
313
314
315
316
        };
      },
      watch: {
        activeTab() {
          console.log("activeTab watch");
          this.search();
cac28d75   周超   问卷 用户 维度
317
        },
04aebc72   周超   11
318
319
320
321
322
323
        "parameter.keyWord": {
          handler() {
            clearTimeout(this.timeout);
            this.timeout = setTimeout(() => {
              this.search();
            }, 200);
e1644c39   yangzhi   王哥起来屙尿了
324
          },
04aebc72   周超   11
325
        },
172a152f   yangzhi   组卷左侧题目的分类
326
      },
04aebc72   周超   11
327
328
329
330
331
332
      computed: {
        noMore() {
          return this.arr1.length >= this.count;
        },
        disabled() {
          return this.loading || this.noMore;
4ee13894   周超   给大志哥
333
        },
e1644c39   yangzhi   王哥起来屙尿了
334
      },
04aebc72   周超   11
335
336
337
338
339
340
341
342
343
      created() {
        this.getQuestionClassListHeadler();
        this.getQuestionClassListHeadler2();
  
  
        GetTypeSetting({}).then(res => {
          if (res.data) {
            this.usertypelist = res.data || [];
          }
c33c1243   周超   拉取王哥最新的
344
345
346
347
348
        }); 
        GetpaperLevelList({pageSize:1000,sortOrder:'asc'}).then(res => {
          if (res.data) {
            this.levellist = res.data.data || [];
          }
04aebc72   周超   11
349
        });
e1644c39   yangzhi   王哥起来屙尿了
350
      },
04aebc72   周超   11
351
352
353
354
      mounted() {
        //计算页面内容区域的高度
        this.contentHeight = window.innerHeight - 90;
        //this.GetList();
e1644c39   yangzhi   王哥起来屙尿了
355
      },
04aebc72   周超   11
356
      methods: {
c33c1243   周超   拉取王哥最新的
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
        changetype(a,item){
          var type = this.typelist.find(o=>o.id ==  item.QuestionClassId[item.QuestionClassId.length-1]);
          if(type) {
            item.maxcount = type.subjectCount || 0;
            if(item.Count > item.maxcount) item.Count = item.maxcount;
          }
        },
  
        changelevel(v){ 
          var type = this.levellist.find(o=>o.f_count ==  v);
          if(type) {
            this.TestPaper.FLevelTitle = type.title || '';
          }
        },
        getmaxid(item){ 
          var type = this.randomQuestionTypeList.find(o=>o.id == item.QuestionClassId);
          if(type) return type.subjectCount || 0;
          else return 0;
        },
04aebc72   周超   11
376
        getSubTree(id, list) {
78156aa6   yangzhi   级联菜单
377
378
379
380
381
382
383
          let result = [];
          result = list.filter((t) => t.ParentId == id);
          if (result.length) {
            result = result.map((item) => {
              item.value = item.id;
              item.label = item.ClassificationName;
              item.children = this.getSubTree(item.id, list);
04aebc72   周超   11
384
              if (!item.children || !item.children.length) {
78156aa6   yangzhi   级联菜单
385
386
387
388
389
390
391
392
393
394
395
                delete item.children;
              }
              return item;
            });
          }
          return result;
        },
        getQuestionClassListHeadler2() {
          let _this = this;
          getQuestionClassList().then((res) => {
            let alllist = res.data.data;
c33c1243   周超   拉取王哥最新的
396
            this.typelist = alllist;
04aebc72   周超   11
397
            let list = alllist.filter(t => !t.ParentId);
78156aa6   yangzhi   级联菜单
398
399
400
            list = list.map((t) => {
              t.value = t.id;
              t.label = t.ClassificationName;
04aebc72   周超   11
401
402
              t.children = this.getSubTree(t.id, alllist);
              if (!t.children || !t.children.length) {
78156aa6   yangzhi   级联菜单
403
404
405
406
407
408
409
                delete t.children;
              }
              return t;
            });
            this.randomQuestionTypeList = list;
          });
        },
04aebc72   周超   11
410
        randomCancel() {
e1644c39   yangzhi   王哥起来屙尿了
411
          this.dialogTableVisible = false;
04aebc72   周超   11
412
413
414
415
416
417
        },
        randomSubmit() {
          var list = JSON.parse(JSON.stringify(this.randomSubjectList));
          if (list.findIndex((t) => !t.QuestionClassId || !t.QuestionClassId.length || !t.Count) > -1) {
            this.$message.warning("参数不完整");
            return;
78156aa6   yangzhi   级联菜单
418
          }
04aebc72   周超   11
419
420
421
422
  
          list = list.map(t => {
            t.QuestionClassId = t.QuestionClassId.pop();
            return t;
4ee13894   周超   给大志哥
423
          });
04aebc72   周超   11
424
425
426
427
428
429
          PostRandomGetQuestion(list).then((res) => {
            let list = res.data.data;
            this.arr2 = list;
            this.dialogTableVisible = false;
            if (!list.length) {
              this.$message.warning('所选分类没有试题');
7cc95822   yangzhi   组卷修改
430
431
432
433
434
            }else{
              this.TestPaper.SingleNumber = list.filter(t=>t.subjectType == 1).length;
              this.TestPaper.MultipleNumber = list.filter(t=>t.subjectType == 2).length;
              this.TestPaper.SubjectiveNumber = list.filter(t=>t.subjectType == 3).length;
              this.TestPaper.VoiceNumber = list.filter(t=>t.subjectType == 4).length;
04aebc72   周超   11
435
436
437
438
439
440
441
442
443
            }
          });
        },
        changeSubjectCount(type, index) {
          if (type > 0) {
            this.randomSubjectList.push({
              QuestionClassId: "",
              Count: "",
            });
cac28d75   周超   问卷 用户 维度
444
          } else {
04aebc72   周超   11
445
            this.randomSubjectList.splice(index, 1);
cac28d75   周超   问卷 用户 维度
446
          }
04aebc72   周超   11
447
448
449
450
451
452
453
454
        },
        randomSubject() {
          this.dialogTableVisible = true;
        },
        submitForm(formName) {
          this.$refs[formName].validate((valid) => {
            if (valid) {
              alert("submit!");
e1644c39   yangzhi   王哥起来屙尿了
455
            } else {
04aebc72   周超   11
456
457
              console.log("error submit!!");
              return false;
e1644c39   yangzhi   王哥起来屙尿了
458
459
            }
          });
04aebc72   周超   11
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
        },
        resetForm(formName) {
          this.$refs[formName].resetFields();
        },
        removeDomain(item) {
          var index = this.dynamicValidateForm.domains.indexOf(item);
          if (index !== -1) {
            this.dynamicValidateForm.domains.splice(index, 1);
          }
        },
        addDomain() {
          this.dynamicValidateForm.domains.push({
            value: "",
            key: Date.now(),
          });
        },
        changetimestartend(val, aa) {
          this.TestPaper.EffectiveStartTime = formatTime(val[0]);
          this.TestPaper.EffectiveEndTime = formatTime(val[1]);
        },
        search() {
          this.parameter.pageIndex = 1;
          this.parameter.QuestionClassId = Number(this.activeTab);
          this.GetList();
        },
        SubmitTestPaper() {
  
          this.$refs['form'].validate((valid) => {
94c54e92   周超   1
488
         
6963d762   周超   拉取志哥最新的
489
490
491
492
493
494
495
496
            if(!this.TestPaper.TestPaperTitle){
              this.$notify({
                    title: '试卷标题必填!',
                    // message: res.data.message,
                    type: 'warning'
                  });
              return;
            }
04aebc72   周超   11
497
498
499
500
501
502
            if (valid) { 
              this.TestPaper.QuestionBankIds = this.arr2.map((u) => u.id);
              var d = this.TestPaper;
              if (this.arr2.length > 0) {
                EditTestPaper(this.TestPaper).then((res) => {
                  if (res.data.code == 200) {
c33c1243   周超   拉取王哥最新的
503
504
505
506
507
                    this.$notify({
                    title: '组卷成功!',
                    // message: res.data.message,
                    type: 'success'
                  });
94c54e92   周超   1
508
509
510
511
512
                    this.$router.push({
                      path: '/views/TestPaperList',
                      query: { 
                      }
                    })
04aebc72   周超   11
513
514
515
516
517
518
519
520
521
522
                  } else {
                    this.$confirm("组卷失败!", "消息");
                  }
                });
              } else {
                this.$confirm("试题没有题目!", "消息");
              }
            } else {
  
              return false;
e1644c39   yangzhi   王哥起来屙尿了
523
            }
cac28d75   周超   问卷 用户 维度
524
          });
b89c8760   wangming   项目初始化
525
  
b89c8760   wangming   项目初始化
526
  
e011bf15   周超   我先走一步
527
  
04aebc72   周超   11
528
529
530
531
532
533
534
535
536
537
538
539
540
        },
        load() {
          this.loading = true;
          this.parameter.pageIndex++;
          this.GetList();
          this.loading = false;
        },
        GetList() {
          if (this.parameter.QuestionClassId == "1") {
            if (!this.loadingType)
              GetQuestionClassByType({ ClassType: 2 }).then((res) => {
                var classarr = res.data.data || [];
                this.arr1 = classarr.map((rs) => {
c5b61549   周超   111
541
                  rs.subject = rs.subjectName = rs.ClassificationName+'('+(rs.subjectCount || 0)+')';
04aebc72   周超   11
542
543
544
545
546
547
548
549
550
551
                  rs.type = "wd";
                  rs.subjectContent = "[]";
                  return rs;
                });
                this.loadingType = true;
              });
          } else {
            getQuestionList(this.parameter).then((res) => {
              if (this.parameter.pageIndex == 1) {
                this.arr1 = [];
e1644c39   yangzhi   王哥起来屙尿了
552
              }
04aebc72   周超   11
553
554
555
556
557
              res.data.data.rows.forEach((item, i) => {
                this.arr1.push(item);
              });
              this.count = res.data.data.total;
              this.$forceUpdate();
e011bf15   周超   我先走一步
558
            });
04aebc72   周超   11
559
560
561
562
563
564
565
566
567
568
          }
        },
        end1(e) {
          var that = this;
          if (that.arr1.length < 10) {
            this.load();
          }
  
          var items = this.arr2.filter(function (m) {
            return m.id == that.moveId;
cac28d75   周超   问卷 用户 维度
569
          });
04aebc72   周超   11
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
  
          //如果左边
          if (items.length < 2) return;
          this.arr2.splice(e.newDraggableIndex, 1);
  
          //	SingleNumber:0,
          // MultipleNumber:0,
          // SubjectiveNumber:0,
        },
        //从右边移除到左边
        RemoveHere(e) {
          if (e.item._underlying_vm_.subjectType == 1) {
            this.TestPaper.SingleNumber -= 1;
          }
          if (e.item._underlying_vm_.subjectType == 2) {
            this.TestPaper.MultipleNumber -= 1;
          }
          if (e.item._underlying_vm_.subjectType == 3) {
            this.TestPaper.SubjectiveNumber -= 1;
          }
7cc95822   yangzhi   组卷修改
590
591
592
593
          if (e.item._underlying_vm_.subjectType == 4) {
            this.TestPaper.VoiceNumber -= 1;
          }
          
04aebc72   周超   11
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
          this.TestPaper.TotalScore -= e.item._underlying_vm_.fraction;
          this.TestPaper.QuestionBankIds = this.arr2.map((u) => u.id);
        },
        //从左边添加到右边
        ComeHere(e) {
          var d = e.item._underlying_vm_;
          if (e.item._underlying_vm_.subjectType == 1) {
            this.TestPaper.SingleNumber += 1;
          }
          if (e.item._underlying_vm_.subjectType == 2) {
            this.TestPaper.MultipleNumber += 1;
          }
          if (e.item._underlying_vm_.subjectType == 3) {
            this.TestPaper.SubjectiveNumber += 1;
          }
7cc95822   yangzhi   组卷修改
609
610
611
          if (e.item._underlying_vm_.subjectType == 4) {
            this.TestPaper.VoiceNumber += 1;
          }
04aebc72   周超   11
612
613
614
615
616
617
618
619
          this.TestPaper.TotalScore += e.item._underlying_vm_.fraction;
  
          this.TestPaper.QuestionBankIds = this.arr2.map((u) => u.id);
  
          if (d.type == "wd") {
            getQuestionList({
              QuestionClassId: d.id,
              PageIndex: 1,
c33c1243   周超   拉取王哥最新的
620
              PageSize: this.TestPaper.FLevelCount ||  1000,
04aebc72   周超   11
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
            }).then((res) => {
              var data = res.data.data.rows || [];
              data = data.filter(o => !this.arr2.find(d => d.id == o.id));
              this.arr2 = this.arr2.filter((o) => o.type != "wd");
              // this.arr1.splice(this.arr1.findIndex(o=>o.id == d.id),1)
              this.classarr.push(d.id);
              // var  test = this.arr2;
              this.arr2.push(...data);
              data.forEach((rs) => {
                if (rs.subjectType == 1) {
                  this.TestPaper.SingleNumber += 1;
                }
                if (rs.subjectType == 2) {
                  this.TestPaper.MultipleNumber += 1;
                }
                if (rs.subjectType == 3) {
                  this.TestPaper.SubjectiveNumber += 1;
                }
7cc95822   yangzhi   组卷修改
639
640
641
                if (rs.subjectType == 4) {
                  this.TestPaper.VoiceNumber += 1;
                }
04aebc72   周超   11
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
              });
            });
          }
        },
        //右边往左边拖动时的事件
        end2(e) {
          var that = this;
          var items = this.arr1.filter(function (m) {
            return m.id == that.moveId;
          });
          //如果左边
          if (items.length < 2) return;
          this.arr1.splice(e.newDraggableIndex, 1);
        },
        //move回调方法
        onMove(e, originalEvent) {
          //this.moveId = e.relatedContext.element.id;
          return true;
        },
        getQuestionClassListHeadler() {
          let _this = this;
          GetToplevel().then((res) => {
            var gettree = function (titem) {
              titem.children = [];
              let childrenList = res.data.data.filter(
                (u) => u.ParentId == titem.value
              );
              if (childrenList.length == 0) titem.children = undefined;
              res.data.data
                .filter((u) => u.ParentId == titem.value)
                .forEach((item, i) => {
                  var model = {
                    value: item.id,
                    label: item.ClassTitle,
                  };
                  gettree(model);
                  titem.children.push(model);
                });
            };
172a152f   yangzhi   组卷左侧题目的分类
681
            res.data.data
04aebc72   周超   11
682
              .filter((u) => u.ParentId == 0)
172a152f   yangzhi   组卷左侧题目的分类
683
684
685
686
687
688
              .forEach((item, i) => {
                var model = {
                  value: item.id,
                  label: item.ClassTitle,
                };
                gettree(model);
04aebc72   周超   11
689
690
                _this.QuestionClass.push(model);
                _this.treeData.push(model);
172a152f   yangzhi   组卷左侧题目的分类
691
              });
04aebc72   周超   11
692
693
          });
        },
172a152f   yangzhi   组卷左侧题目的分类
694
      },
04aebc72   周超   11
695
    };
b89c8760   wangming   项目初始化
696
697
698
  </script>
  
  <style lang="scss" scoped>
04aebc72   周超   11
699
700
701
702
703
704
    .el-row {
  
      /* margin-bottom: 20px; */
      &:last-child {
        margin-bottom: 0;
      }
cac28d75   周超   问卷 用户 维度
705
    }
04aebc72   周超   11
706
707
708
709
710
711
712
713
714
715
716
  
    .el-col {
      border-radius: 4px;
    }
  
    .bg-purple-dark {
      background: #99a9bf;
    }
  
    .bg-purple {
      background: #efefef;
172a152f   yangzhi   组卷左侧题目的分类
717
    }
cac28d75   周超   问卷 用户 维度
718
  
04aebc72   周超   11
719
720
    .bg-purple-light {
      background: #e5e9f2;
172a152f   yangzhi   组卷左侧题目的分类
721
    }
cac28d75   周超   问卷 用户 维度
722
  
04aebc72   周超   11
723
724
725
726
    .grid-content {
      border-radius: 4px;
      min-height: 36px;
      height: 100%;
cac28d75   周超   问卷 用户 维度
727
728
    }
  
04aebc72   周超   11
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
    .row-bg {
      padding: 10px 0;
      background-color: #f9fafc;
    }
  
    .infinite-list {
      list-style: none;
      margin: 0px;
      padding: 0px;
  
      &::-webkit-scrollbar {
        width: 6px;
      }
  
      //滚动条小方块
      &::-webkit-scrollbar-thumb {
        border-radius: 10px;
        background: #304156;
      }
  
      //滚动条轨道
      &::-webkit-scrollbar-track {
        // border-radius: 10px;
        height: 100px;
        background: #cdcdcd;
      }
  
      .infinite-list-item {
        padding: 10px;
        min-height: 60px;
        width: 95%;
        margin: auto;
        background-color: #fff;
        margin-bottom: 10px;
        border-radius: 5px;
        box-shadow: 0 0 5px #cdcdcd;
  
        &:first-child {
          margin-top: 10px;
        }
cac28d75   周超   问卷 用户 维度
769
      }
cac28d75   周超   问卷 用户 维度
770
    }
04aebc72   周超   11
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
  
    .option-p {
      line-height: 15px;
    }
  
    .areahead {
      text-align: center;
      height: 60px;
      line-height: 60px;
      border-bottom: 1px solid #cdcdcd;
    }
  
    .testPaper-manager {
      margin: 10px 20px 10px 10px;
    }
  
    .testPaper-manager .el-form-item {
      margin-bottom: 20px;
    }
  
    .el-form-item-custom {
      margin-bottom: 0px !important;
    }
  
    .testpaper-input {
      //max-width: 400px;
    }
cac28d75   周超   问卷 用户 维度
798
  </style>