Blame view

src/views/TestPaper/ManualTestPaper.vue 31.3 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>
a7974ab3   周超   111
4
5
6
7
8
9
10
11
      <div
        style="width: 100%;text-align: right;background: #efefef;height: 60px;vertical-align: middle;line-height: 60px;padding-right: 10px;">
  
        <el-button style="margin-top: 12px;" @click="next" v-if="active==1">下一步</el-button>
        <el-button style="margin-top: 12px;z-index:888888888" @click="next" v-if="active==2">编辑基本信息</el-button>
        <el-button type="primary" style="" v-if="active==2" @click="SubmitTestPaper">保存
        </el-button>
      </div>
cac28d75   周超   问卷 用户 维度
12
      <el-row :gutter="20">
e011bf15   周超   我先走一步
13
  
04aebc72   周超   11
14
  
b32564ca   周超   11
15
16
17
18
        <el-steps :active="active" finish-status="success" simple style="margin:0px 10px">
          <el-step title="基本信息"></el-step>
          <el-step title="组卷"></el-step>
        </el-steps>
b89c8760   wangming   项目初始化
19
  
e011bf15   周超   我先走一步
20
  
e011bf15   周超   我先走一步
21
  
b32564ca   周超   11
22
23
        <el-col :span="8" :style="{'height':contentHeight+'px'}" class="jinyongtop">
          <div class="jinyong" v-if="active!=1">
e011bf15   周超   我先走一步
24
  
cac28d75   周超   问卷 用户 维度
25
          </div>
cac28d75   周超   问卷 用户 维度
26
27
28
          <div class="grid-content bg-purple">
            <div class="areahead">组卷基本信息</div>
            <el-form ref="form" class="testPaper-manager" :rules="rules" :model="TestPaper" label-width="100px">
cf176b8f   周超   3
29
30
              <el-form-item label="试卷名称:" prop="TestPaperTitle" required class="el-form-item-custom"
                style="margin-bottom: 20px !important;width:100%;">
b32564ca   周超   11
31
                <el-input v-model="TestPaper.TestPaperTitle"></el-input>
cac28d75   周超   问卷 用户 维度
32
              </el-form-item>
a7974ab3   周超   111
33
  
cf176b8f   周超   3
34
35
              <el-form-item label="自定义名称:" prop="CustomName" required class="el-form-item-custom"
                style="margin-bottom: 20px !important;width:100%;">
a7974ab3   周超   111
36
37
                <el-input v-model="TestPaper.CustomName"></el-input>
              </el-form-item>
b32564ca   周超   11
38
39
40
              <!-- <el-form-item label="题目数量:" class="el-form-item-custom">
  
              </el-form-item> -->
cac28d75   周超   问卷 用户 维度
41
42
43
44
              <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   组卷修改
45
                <span style="margin-right: 10px;">主观题:{{TestPaper.VoiceNumber}}</span>
cac28d75   周超   问卷 用户 维度
46
47
              </el-form-item>
              <el-form-item label="题目总分:" class="el-form-item-custom">
e011bf15   周超   我先走一步
48
                {{TestPaper.TotalScore || ''}}
cac28d75   周超   问卷 用户 维度
49
50
              </el-form-item>
  
04aebc72   周超   11
51
52
53
54
55
56
              <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>
b32564ca   周超   11
57
              <el-form-item label="分类" class="el-form-item-custom" prop="QuestionClassId">
cac28d75   周超   问卷 用户 维度
58
                <el-cascader class="testpaper-input" v-model="TestPaper.QuestionClassId"
04aebc72   周超   11
59
                  style="width:100%;margin-bottom: 20px;" :props="{emitPath:false}" :clearable=true
cac28d75   周超   问卷 用户 维度
60
61
62
63
                  :options="QuestionClass">
                </el-cascader>
              </el-form-item>
  
b32564ca   周超   11
64
65
              <el-form-item label="级别" prop="FLevelCount" class="el-form-item-custom"
                style="margin-bottom: 20px !important;width:100%;">
c33c1243   周超   拉取王哥最新的
66
67
68
69
                <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
70
  
cac28d75   周超   问卷 用户 维度
71
              <el-form-item label="有效时间" required>
04aebc72   周超   11
72
                <el-form-item prop="date">
b32564ca   周超   11
73
                  <el-date-picker v-model="TestPaper.date" @change="changetimestartend" type="datetimerange"
cac28d75   周超   问卷 用户 维度
74
                    format="yyyy-MM-dd hh:mm:ss" range-separator="至" start-placeholder="开始时间" style="width:100%"
cf176b8f   周超   3
75
                    end-placeholder="结束时间" :picker-options="pickerOptions">
cac28d75   周超   问卷 用户 维度
76
77
78
                  </el-date-picker>
                </el-form-item>
              </el-form-item>
e1644c39   yangzhi   王哥起来屙尿了
79
              <el-form-item label="总时长控制" prop="AnswerTime">
cac28d75   周超   问卷 用户 维度
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
                <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>
b32564ca   周超   11
106
  
cac28d75   周超   问卷 用户 维度
107
108
109
            </el-form>
          </div>
        </el-col>
a7974ab3   周超   111
110
111
        <el-col :span="6" :style="{'height':contentHeight+'px'}" class="jinyongtop" v-show="active==2">
          <!-- <div class="jinyong" v-if="active==1">
b32564ca   周超   11
112
  
a7974ab3   周超   111
113
          </div> -->
b32564ca   周超   11
114
          <div class="grid-content bg-purple">
cf176b8f   周超   3
115
            <el-tabs v-model="activeTab" style="padding: 0 20px" @tab-click="changeTab" :stretch="true">
b32564ca   周超   11
116
117
118
119
120
121
122
123
124
125
126
              <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>
            <div style="padding:10.5px">
              <el-button type="primary" @click="randomSubject" style="width:100%">随机抽题</el-button>
            </div>
  
            <draggable :options="{animation:380,filter:'.unmover'}" group="itxst" v-model="arr1" @end="end1"
a7974ab3   周超   111
127
128
129
              :disabled="TestPaper.FLevelCount && arr2.length >= TestPaper.FLevelCount" @add="RemoveHere" :move="onMove"
              class="infinite-list" :style="{'height':contentHeight-80+'px'}" infinite-scroll-disabled="disabled"
              v-infinite-scroll="load" style="overflow:auto">
b32564ca   周超   11
130
131
132
133
134
135
136
137
138
  
              <li v-for="i in arr1" class="infinite-list-item" :key="i.id" v-if="!classarr.some(o=>o == i.id)">{{
                i.subject }}</li>
              <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>
  
          </div>
        </el-col>
cf176b8f   周超   3
139
140
        <el-col :span="10" :style="{'height':contentHeight+'px'}" class="jinyongtop" v-show="active==2">
  
b32564ca   周超   11
141
142
143
144
145
146
147
148
149
150
          <div class="grid-content bg-purple">
            <div class="areahead">
              <!-- <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>
              <i :class="{'el-icon-edit': !edit, 'el-icon-check': edit}" @click="edit = !edit"
                style="margin-left: 5px;cursor: pointer;"></i> -->
              题目内容
            </div>
  
            <draggable :options="{animation:380}" group="itxst" v-model="arr2" class="infinite-list" @end="end2"
a7974ab3   周超   111
151
152
              :disable="TestPaper.FLevelCount && arr2.length >= TestPaper.FLevelCount" @add="ComeHere"
              :style="{'height':contentHeight-60+'px'}" style="overflow:auto;padding-top: 10px;">
b32564ca   周超   11
153
154
              <li v-for="(i,index) in arr2" class="infinite-list-item">
                <label> {{index+1}}. [{{i.subjectName}}]{{ i.subject }}</label>
a7974ab3   周超   111
155
156
157
  
                <el-button @click="removeItem(i,index)" type="danger" icon="el-icon-delete" circle size="mini"
                  style="float:right"></el-button>
b32564ca   周超   11
158
159
160
161
162
163
164
165
166
167
168
                <div v-for="item in JSON.parse(i.subjectContent)">
                  <p class="option-p">{{item.option}}:{{item.optionContent}}</p>
                </div>
              </li>
              </li>
            </draggable>
  
  
          </div>
        </el-col>
  
cac28d75   周超   问卷 用户 维度
169
      </el-row>
4ee13894   周超   给大志哥
170
171
  
  
04aebc72   周超   11
172
  
b32564ca   周超   11
173
      <el-dialog title="随机抽题" :visible.sync="dialogTableVisible" style="margin-left:30%;">
04aebc72   周超   11
174
  
e1644c39   yangzhi   王哥起来屙尿了
175
176
177
        <ul class="random-list">
          <li v-for="(item,index) in randomSubjectList" :key="index">
            <span>试题分类:</span>
b32564ca   周超   11
178
179
            <el-cascader :multiple="false" style="flex:1" @change="(a)=>{ changetype(a,item)}"
              v-model="item.QuestionClassId" :options="randomQuestionTypeList" clearable>
c33c1243   周超   拉取王哥最新的
180
              <template slot-scope="{ node, data }">
b32564ca   周超   11
181
                <span>{{ data.label }}</span>
c33c1243   周超   拉取王哥最新的
182
183
184
185
186
                <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
187
188
189
            </el-input-number>
            <i class="el-icon-remove-outline" @click="changeSubjectCount(-1,index)"
              style="margin-left:10px;color:#f56c6c;"></i>
e1644c39   yangzhi   王哥起来屙尿了
190
191
192
193
194
195
196
            <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   周超   给大志哥
197
198
      </el-dialog>
  
cac28d75   周超   问卷 用户 维度
199
    </div>
b89c8760   wangming   项目初始化
200
  </template>
e1644c39   yangzhi   王哥起来屙尿了
201
  <style lang="scss" scoped>
04aebc72   周超   11
202
    .random-list {
e1644c39   yangzhi   王哥起来屙尿了
203
      display: flex;
04aebc72   周超   11
204
205
206
207
208
209
210
211
212
213
214
      flex-direction: column;
  
      li {
        margin-bottom: 20px;
        display: flex;
        align-items: center;
  
        [class^="el-icon"] {
          font-size: 24px;
          cursor: pointer;
        }
e1644c39   yangzhi   王哥起来屙尿了
215
216
      }
    }
b32564ca   周超   11
217
218
219
220
221
222
223
224
225
226
227
228
229
230
  
    .jinyongtop {
      position: relative;
    }
  
    .jinyong {
      width: 100%;
      position: absolute;
      width: 100%;
      top: 0px;
      left: opx;
      right: 0;
      left: 0;
      bottom: 0;
0df97586   yangzhi   组卷页面,禁用的样式层级太高了
231
      z-index: 9;
b32564ca   周超   11
232
      opacity: 0.1;
a7974ab3   周超   111
233
      background: black;
b32564ca   周超   11
234
    }
e1644c39   yangzhi   王哥起来屙尿了
235
  </style>
b89c8760   wangming   项目初始化
236
  <script>
04aebc72   周超   11
237
238
    import draggable from "vuedraggable";
    import { PostRandomGetQuestion, getQuestionList, getQuestionClassList } from "@/api/QuestionBank";
c33c1243   周超   拉取王哥最新的
239
240
    import { GetpaperLevelList } from "@/api/paperLevel";
  
b32564ca   周超   11
241
  
04aebc72   周超   11
242
243
244
245
246
247
248
249
250
251
252
253
254
    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 {
a7974ab3   周超   111
255
256
          pickerOptions: {
            disabledDate(time) {
cf176b8f   周超   3
257
              return time.getTime() <= Date.now() - 1 * 24 * 3600 * 1000
a7974ab3   周超   111
258
259
            }
          },
b32564ca   周超   11
260
          active: 1,
04aebc72   周超   11
261
          randomSubjectList: [
172a152f   yangzhi   组卷左侧题目的分类
262
            {
04aebc72   周超   11
263
264
              QuestionClassId: "",
              Count: "",
172a152f   yangzhi   组卷左侧题目的分类
265
            },
e1644c39   yangzhi   王哥起来屙尿了
266
            {
04aebc72   周超   11
267
268
              QuestionClassId: "",
              Count: "",
e1644c39   yangzhi   王哥起来屙尿了
269
270
            },
          ],
04aebc72   周超   11
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
          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,
a7974ab3   周超   111
295
          totalCount: 0,
04aebc72   周超   11
296
297
298
299
300
301
302
303
304
305
306
307
308
          edit: false,
          arr1: [],
          arr2: [],
          classarr: [],
          moveId: -1,
          TestPaper: {
            TestPaperTitle: "未命名试卷标题",
            TestPaperClassId: 0,
            TotalScore: 0,
            Describe: "",
            SingleNumber: 0,
            MultipleNumber: 0,
            SubjectiveNumber: 0,
b32564ca   周超   11
309
            VoiceNumber: 0,
04aebc72   周超   11
310
311
312
313
            OriginalPrice: "0",
            PresentPrice: "0",
            MembershipPrice: "0",
            QuestionBankIds: [],
b32564ca   周超   11
314
            FLevelCount: null
04aebc72   周超   11
315
316
317
318
319
320
321
322
          },
          loading: false,
          rules: {
            OriginalPrice: [
              {
                required: true,
                message: "不能为空",
              },
b32564ca   周超   11
323
            ],
04aebc72   周超   11
324
325
326
327
328
329
330
331
332
333
334
335
336
337
            PresentPrice: [
              {
                required: true,
                message: "不能为空",
              },
            ],
            UserTypeOfWork: [
              {
                required: true,
                message: "请选择工种",
              },
            ], QuestionClassId: [
              {
                required: true,
b32564ca   周超   11
338
                message: "请选择分类",
04aebc72   周超   11
339
              },
b32564ca   周超   11
340
341
342
343
344
345
346
347
348
349
350
351
            ]
  
            , FLevelCount: [
              {
                required: true,
                message: "请选择级别",
              },
            ]
  
  
  
            , date: [
04aebc72   周超   11
352
353
              {
                required: true,
b32564ca   周超   11
354
                message: "请选择时间段",
04aebc72   周超   11
355
356
              },
            ],
c5b61549   周超   111
357
358
359
            TestPaperTitle: [
              {
                required: true,
b32564ca   周超   11
360
361
                message: "请填写试卷名称",
              }
c5b61549   周超   111
362
363
            ],
  
6963d762   周超   拉取志哥最新的
364
365
366
            AnswerTime: [
              {
                required: true,
b32564ca   周超   11
367
                message: "请填写试总时长控制",
6963d762   周超   拉取志哥最新的
368
              },
b32564ca   周超   11
369
  
a7974ab3   周超   111
370
  
6963d762   周超   拉取志哥最新的
371
            ],
cf176b8f   周超   3
372
  
a7974ab3   周超   111
373
374
375
376
377
            CustomName: [
              {
                required: true,
                message: "自定义名称必填",
              }]
04aebc72   周超   11
378
379
380
          },
          QuestionClass: [],
          treeData: [
e1644c39   yangzhi   王哥起来屙尿了
381
            {
04aebc72   周超   11
382
383
              value: 0,
              label: "全部",
e1644c39   yangzhi   王哥起来屙尿了
384
385
            },
          ],
04aebc72   周超   11
386
          timeout: 0,
b32564ca   周超   11
387
388
          typelist: [],
          levellist: [] //等级
04aebc72   周超   11
389
390
391
392
393
394
        };
      },
      watch: {
        activeTab() {
          console.log("activeTab watch");
          this.search();
cac28d75   周超   问卷 用户 维度
395
        },
04aebc72   周超   11
396
397
398
399
400
401
        "parameter.keyWord": {
          handler() {
            clearTimeout(this.timeout);
            this.timeout = setTimeout(() => {
              this.search();
            }, 200);
e1644c39   yangzhi   王哥起来屙尿了
402
          },
04aebc72   周超   11
403
        },
172a152f   yangzhi   组卷左侧题目的分类
404
      },
04aebc72   周超   11
405
406
407
408
409
410
      computed: {
        noMore() {
          return this.arr1.length >= this.count;
        },
        disabled() {
          return this.loading || this.noMore;
4ee13894   周超   给大志哥
411
        },
e1644c39   yangzhi   王哥起来屙尿了
412
      },
04aebc72   周超   11
413
414
415
416
417
418
419
420
421
      created() {
        this.getQuestionClassListHeadler();
        this.getQuestionClassListHeadler2();
  
  
        GetTypeSetting({}).then(res => {
          if (res.data) {
            this.usertypelist = res.data || [];
          }
b32564ca   周超   11
422
423
        });
        GetpaperLevelList({ pageSize: 1000, sortOrder: 'asc' }).then(res => {
c33c1243   周超   拉取王哥最新的
424
425
426
          if (res.data) {
            this.levellist = res.data.data || [];
          }
04aebc72   周超   11
427
        });
e1644c39   yangzhi   王哥起来屙尿了
428
      },
04aebc72   周超   11
429
430
431
      mounted() {
        //计算页面内容区域的高度
        this.contentHeight = window.innerHeight - 90;
cf176b8f   周超   3
432
        this.GetList();
e1644c39   yangzhi   王哥起来屙尿了
433
      },
04aebc72   周超   11
434
      methods: {
cf176b8f   周超   3
435
436
437
438
439
440
441
442
443
444
445
        changeTab(a, b) {
          if (a.index == "1") {
            this.randomQuestionTypeList[0].disabled = true;
            this.randomQuestionTypeList[1].disabled = false;
          }
          else {
  
            this.randomQuestionTypeList[1].disabled = true;
            this.randomQuestionTypeList[0].disabled = false;
          }
        },
a7974ab3   周超   111
446
447
448
        removeItem(item, index) {
          this.arr2.splice(index, 1);
        },
b32564ca   周超   11
449
450
451
        next() {
          var _this = this;
          console.log(this.active);
a7974ab3   周超   111
452
          if (this.active == 1) {
b32564ca   周超   11
453
            _this.$refs['form'].validate((valid) => {
a7974ab3   周超   111
454
455
456
              if (valid) {
                this.active = 2;
              }
b32564ca   周超   11
457
            });
a7974ab3   周超   111
458
459
460
          }
          else {
            if (this.active++ >= 2) this.active = 1;
b32564ca   周超   11
461
462
  
          }
a7974ab3   周超   111
463
  
b32564ca   周超   11
464
465
466
467
        },
        changetype(a, item) {
          var type = this.typelist.find(o => o.id == item.QuestionClassId[item.QuestionClassId.length - 1]);
          if (type) {
c33c1243   周超   拉取王哥最新的
468
            item.maxcount = type.subjectCount || 0;
b32564ca   周超   11
469
            if (item.Count > item.maxcount) item.Count = item.maxcount;
c33c1243   周超   拉取王哥最新的
470
471
472
          }
        },
  
b32564ca   周超   11
473
474
475
        changelevel(v) {
          var type = this.levellist.find(o => o.f_count == v);
          if (type) {
c33c1243   周超   拉取王哥最新的
476
477
478
            this.TestPaper.FLevelTitle = type.title || '';
          }
        },
b32564ca   周超   11
479
480
481
        getmaxid(item) {
          var type = this.randomQuestionTypeList.find(o => o.id == item.QuestionClassId);
          if (type) return type.subjectCount || 0;
c33c1243   周超   拉取王哥最新的
482
483
          else return 0;
        },
04aebc72   周超   11
484
        getSubTree(id, list) {
78156aa6   yangzhi   级联菜单
485
486
487
488
489
490
491
          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
492
              if (!item.children || !item.children.length) {
78156aa6   yangzhi   级联菜单
493
494
495
496
497
498
499
500
501
502
503
                delete item.children;
              }
              return item;
            });
          }
          return result;
        },
        getQuestionClassListHeadler2() {
          let _this = this;
          getQuestionClassList().then((res) => {
            let alllist = res.data.data;
c33c1243   周超   拉取王哥最新的
504
            this.typelist = alllist;
cf176b8f   周超   3
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
  
            let zylist = [], cplist = [];
            let zylistSource = alllist.filter(o => { return o.ClassType == 0; });
            let cplistSource = alllist.filter(o => { return o.ClassType == 2; });
  
            zylist = zylistSource.filter(t => !t.ParentId);
            zylist = zylist.map((t) => {
              t.value = t.id;
              t.label = t.ClassificationName;
              t.children = this.getSubTree(t.id, zylistSource);
              if (!t.children || !t.children.length) {
                delete t.children;
              }
              return t;
            });
  
            cplist = cplistSource.filter(t => !t.ParentId);
            cplist = cplist.map((t) => {
              t.value = t.id;
              t.label = t.ClassificationName;
              t.children = this.getSubTree(t.id, cplistSource);
              if (!t.children || !t.children.length) {
                delete t.children;
              }
              return t;
            });
            var list = [{
              value: '-1',
              label: '专业类',
              children: zylist,
              disabled: false
            },
            {
              value: '-2',
              label: '测评类',
              children: cplist,
              disabled: true,
            }
            ];
            this.randomQuestionTypeList = list;
          });
        },
  
        getQuestionClassListHeadler2bk() {
          let _this = this;
          getQuestionClassList().then((res) => {
            let alllist = res.data.data;
            this.typelist = alllist;
04aebc72   周超   11
553
            let list = alllist.filter(t => !t.ParentId);
78156aa6   yangzhi   级联菜单
554
555
556
            list = list.map((t) => {
              t.value = t.id;
              t.label = t.ClassificationName;
04aebc72   周超   11
557
558
              t.children = this.getSubTree(t.id, alllist);
              if (!t.children || !t.children.length) {
78156aa6   yangzhi   级联菜单
559
560
561
562
                delete t.children;
              }
              return t;
            });
cf176b8f   周超   3
563
  
78156aa6   yangzhi   级联菜单
564
565
566
            this.randomQuestionTypeList = list;
          });
        },
04aebc72   周超   11
567
        randomCancel() {
e1644c39   yangzhi   王哥起来屙尿了
568
          this.dialogTableVisible = false;
04aebc72   周超   11
569
570
        },
        randomSubmit() {
a7974ab3   周超   111
571
572
573
574
575
576
577
578
579
          var _this = this;
          if (_this.TestPaper.FLevelCount && _this.TestPaper.FLevelCount > 0 && _this.arr2.length >= _this.TestPaper.FLevelCount) {
            this.$notify({
              title: '题目数量已经达到级别最大',
              // message: res.data.message,
              type: 'warning'
            });
            return;
          }
cf176b8f   周超   3
580
  
04aebc72   周超   11
581
582
583
584
          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   级联菜单
585
          }
04aebc72   周超   11
586
587
588
589
  
          list = list.map(t => {
            t.QuestionClassId = t.QuestionClassId.pop();
            return t;
4ee13894   周超   给大志哥
590
          });
a7974ab3   周超   111
591
          var count = 0;
cf176b8f   周超   3
592
          list.forEach(o => { count += o.Count; });
a7974ab3   周超   111
593
594
595
596
597
598
599
600
          if (_this.TestPaper.FLevelCount && _this.TestPaper.FLevelCount > 0 && (_this.arr2.length + count) > _this.TestPaper.FLevelCount) {
            this.$notify({
              title: '题目数量已经达到级别最大',
              // message: res.data.message,
              type: 'warning'
            });
            return;
          }
04aebc72   周超   11
601
602
          PostRandomGetQuestion(list).then((res) => {
            let list = res.data.data;
a7974ab3   周超   111
603
            this.arr2.push(...list);
04aebc72   周超   11
604
605
606
            this.dialogTableVisible = false;
            if (!list.length) {
              this.$message.warning('所选分类没有试题');
b32564ca   周超   11
607
608
609
610
611
            } 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
612
613
614
615
616
617
618
619
620
            }
          });
        },
        changeSubjectCount(type, index) {
          if (type > 0) {
            this.randomSubjectList.push({
              QuestionClassId: "",
              Count: "",
            });
cac28d75   周超   问卷 用户 维度
621
          } else {
04aebc72   周超   11
622
            this.randomSubjectList.splice(index, 1);
cac28d75   周超   问卷 用户 维度
623
          }
04aebc72   周超   11
624
625
626
627
628
629
630
631
        },
        randomSubject() {
          this.dialogTableVisible = true;
        },
        submitForm(formName) {
          this.$refs[formName].validate((valid) => {
            if (valid) {
              alert("submit!");
e1644c39   yangzhi   王哥起来屙尿了
632
            } else {
04aebc72   周超   11
633
634
              console.log("error submit!!");
              return false;
e1644c39   yangzhi   王哥起来屙尿了
635
636
            }
          });
04aebc72   周超   11
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
        },
        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() {
a7974ab3   周超   111
663
          var _this = this;
cf176b8f   周超   3
664
          if (_this.TestPaper.FLevelCount && _this.TestPaper.FLevelCount > 0 && _this.arr2.length > _this.TestPaper.FLevelCount) {
a7974ab3   周超   111
665
666
667
668
669
670
671
            this.$notify({
              title: '题目数量已经达到级别最大',
              // message: res.data.message,
              type: 'warning'
            });
            return;
          }
04aebc72   周超   11
672
          this.$refs['form'].validate((valid) => {
b32564ca   周超   11
673
674
  
            if (!this.TestPaper.TestPaperTitle) {
6963d762   周超   拉取志哥最新的
675
              this.$notify({
b32564ca   周超   11
676
677
678
679
                title: '试卷标题必填!',
                // message: res.data.message,
                type: 'warning'
              });
6963d762   周超   拉取志哥最新的
680
681
              return;
            }
b32564ca   周超   11
682
            if (valid) {
04aebc72   周超   11
683
684
685
686
687
              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   周超   拉取王哥最新的
688
                    this.$notify({
b32564ca   周超   11
689
690
691
692
                      title: '组卷成功!',
                      // message: res.data.message,
                      type: 'success'
                    });
94c54e92   周超   1
693
694
                    this.$router.push({
                      path: '/views/TestPaperList',
b32564ca   周超   11
695
                      query: {
94c54e92   周超   1
696
697
                      }
                    })
04aebc72   周超   11
698
699
700
701
702
703
704
705
                  } else {
                    this.$confirm("组卷失败!", "消息");
                  }
                });
              } else {
                this.$confirm("试题没有题目!", "消息");
              }
            } else {
04aebc72   周超   11
706
              return false;
e1644c39   yangzhi   王哥起来屙尿了
707
            }
cac28d75   周超   问卷 用户 维度
708
          });
cf176b8f   周超   3
709
   
04aebc72   周超   11
710
711
712
713
714
715
716
717
718
719
720
721
722
        },
        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) => {
b32564ca   周超   11
723
                  rs.subject = rs.subjectName = rs.ClassificationName + '(' + (rs.subjectCount || 0) + ')';
04aebc72   周超   11
724
725
726
727
728
729
                  rs.type = "wd";
                  rs.subjectContent = "[]";
                  return rs;
                });
                this.loadingType = true;
              });
cf176b8f   周超   3
730
731
          }
          else { 
04aebc72   周超   11
732
733
734
            getQuestionList(this.parameter).then((res) => {
              if (this.parameter.pageIndex == 1) {
                this.arr1 = [];
e1644c39   yangzhi   王哥起来屙尿了
735
              }
04aebc72   周超   11
736
737
738
739
740
              res.data.data.rows.forEach((item, i) => {
                this.arr1.push(item);
              });
              this.count = res.data.data.total;
              this.$forceUpdate();
cf176b8f   周超   3
741
              this.loadingType=true;
e011bf15   周超   我先走一步
742
            });
04aebc72   周超   11
743
          }
cf176b8f   周超   3
744
  
04aebc72   周超   11
745
746
747
748
749
750
751
752
753
        },
        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   周超   问卷 用户 维度
754
          });
04aebc72   周超   11
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
  
          //如果左边
          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   组卷修改
775
776
777
          if (e.item._underlying_vm_.subjectType == 4) {
            this.TestPaper.VoiceNumber -= 1;
          }
b32564ca   周超   11
778
  
04aebc72   周超   11
779
780
781
782
783
          this.TestPaper.TotalScore -= e.item._underlying_vm_.fraction;
          this.TestPaper.QuestionBankIds = this.arr2.map((u) => u.id);
        },
        //从左边添加到右边
        ComeHere(e) {
a7974ab3   周超   111
784
785
          var _this = this;
          if (_this.TestPaper.FLevelCount && _this.TestPaper.FLevelCount > 0 && _this.arr2.length >= _this.TestPaper.FLevelCount) {
cf176b8f   周超   3
786
787
788
789
790
791
            this.$notify({
              title: '题目数量已经达到级别最大',
              // message: res.data.message,
              type: 'warning'
            });
            return;
a7974ab3   周超   111
792
793
            return;
          }
04aebc72   周超   11
794
795
796
797
798
799
800
801
802
803
          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   组卷修改
804
805
806
          if (e.item._underlying_vm_.subjectType == 4) {
            this.TestPaper.VoiceNumber += 1;
          }
04aebc72   周超   11
807
808
809
810
811
812
813
814
          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,
a7974ab3   周超   111
815
              PageSize: _this.TestPaper.FLevelCount || 1000,
04aebc72   周超   11
816
817
            }).then((res) => {
              var data = res.data.data.rows || [];
a7974ab3   周超   111
818
819
              data = data.filter(o => !_this.arr2.find(d => d.id == o.id));
              _this.arr2 = _this.arr2.filter((o) => o.type != "wd");
04aebc72   周超   11
820
              // this.arr1.splice(this.arr1.findIndex(o=>o.id == d.id),1)
a7974ab3   周超   111
821
              _this.classarr.push(d.id);
04aebc72   周超   11
822
              // var  test = this.arr2;
a7974ab3   周超   111
823
              // this.arr2.push(...data);
04aebc72   周超   11
824
              data.forEach((rs) => {
a7974ab3   周超   111
825
826
                if (_this.TestPaper.FLevelCount && _this.TestPaper.FLevelCount > 0 && _this.arr2.length >= _this.TestPaper.FLevelCount) {
                  // _this.arr2 = _this.arr2.filter((o) => o.type != "wd"); 
04aebc72   周超   11
827
                }
a7974ab3   周超   111
828
829
830
831
832
833
834
835
836
837
838
839
840
841
                else {
                  _this.arr2.push(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;
                  }
                  if (rs.subjectType == 4) {
                    _this.TestPaper.VoiceNumber += 1;
                  }
7cc95822   yangzhi   组卷修改
842
                }
a7974ab3   周超   111
843
  
04aebc72   周超   11
844
              });
a7974ab3   周超   111
845
              console.log(_this.arr2)
04aebc72   周超   11
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
            });
          }
        },
        //右边往左边拖动时的事件
        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   组卷左侧题目的分类
884
            res.data.data
04aebc72   周超   11
885
              .filter((u) => u.ParentId == 0)
172a152f   yangzhi   组卷左侧题目的分类
886
887
888
889
890
891
              .forEach((item, i) => {
                var model = {
                  value: item.id,
                  label: item.ClassTitle,
                };
                gettree(model);
04aebc72   周超   11
892
893
                _this.QuestionClass.push(model);
                _this.treeData.push(model);
172a152f   yangzhi   组卷左侧题目的分类
894
              });
04aebc72   周超   11
895
896
          });
        },
172a152f   yangzhi   组卷左侧题目的分类
897
      },
04aebc72   周超   11
898
    };
b89c8760   wangming   项目初始化
899
900
901
  </script>
  
  <style lang="scss" scoped>
04aebc72   周超   11
902
903
904
905
906
907
    .el-row {
  
      /* margin-bottom: 20px; */
      &:last-child {
        margin-bottom: 0;
      }
cac28d75   周超   问卷 用户 维度
908
    }
04aebc72   周超   11
909
910
911
912
913
914
915
916
917
918
919
  
    .el-col {
      border-radius: 4px;
    }
  
    .bg-purple-dark {
      background: #99a9bf;
    }
  
    .bg-purple {
      background: #efefef;
172a152f   yangzhi   组卷左侧题目的分类
920
    }
cac28d75   周超   问卷 用户 维度
921
  
04aebc72   周超   11
922
923
    .bg-purple-light {
      background: #e5e9f2;
172a152f   yangzhi   组卷左侧题目的分类
924
    }
cac28d75   周超   问卷 用户 维度
925
  
04aebc72   周超   11
926
927
    .grid-content {
      border-radius: 4px;
97bf7b2f   yangzhi   样式优化适配不同分辨率
928
      min-height: 100%;
cac28d75   周超   问卷 用户 维度
929
930
    }
  
04aebc72   周超   11
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
    .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   周超   问卷 用户 维度
971
      }
cac28d75   周超   问卷 用户 维度
972
    }
04aebc72   周超   11
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
  
    .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   周超   问卷 用户 维度
1000
  </style>