Blame view

src/views/QuestionBank/index.vue 33.9 KB
b89c8760   wangming   项目初始化
1
  <template>
f6d2db76   yangzhi   超哥牛皮皮
2
3
4
5
6
7
8
    <div class="app-container">
      <el-row id="elRow">
        <el-col :span="6" :style="{ height: TreeColHeight + 'px' }">
          <div style="margin-right: 10px; height: 100%">
            <div class="TreeHeader">
              <label style="font-size: 18px">题目分类</label>
            </div>
4ee13894   周超   给大志哥
9
  
6963d762   周超   拉取志哥最新的
10
            <div :style="{ height: TableColHeight + 'px','overflow-y':'auto' }" class="areadiv"
e011bf15   周超   我先走一步
11
12
              style="margin: 10px 0 0 0; padding: 5px 0 0 0">
              <el-tabs v-model="activeTab" @tab-click="handleTabsClick" style="padding: 0 20px" :stretch="true">
f6d2db76   yangzhi   超哥牛皮皮
13
14
15
                <el-tab-pane label="专业类" name="first"></el-tab-pane>
                <el-tab-pane label="测评类" name="second"></el-tab-pane>
              </el-tabs>
94c54e92   周超   1
16
17
              <el-button type="button" size="mini" style="width:100%;margin-bottom:10px"
                @click="showClassDialog(null,0,activeTab == 'first' ? 0 : 2)">
6963d762   周超   拉取志哥最新的
18
                添加顶级
c5b61549   周超   111
19
20
              </el-button>
              <el-tree :data="activeTab == 'first' ? firstTreeData : secondTreeData"
b32564ca   周超   11
21
22
23
                :props="activeTab == 'first' ? firstTreeData : secondTreeData" @node-click="handleNodeClick"
                class="eltree" :expand-on-click-node="false" node-key="value" :default-expanded-keys="defaultexpand"
                @node-expand="handleNodeExpand" ref="tree">
f6d2db76   yangzhi   超哥牛皮皮
24
                <span class="custom-tree-node" slot-scope="{ node, data }">
b32564ca   周超   11
25
                  <span>[{{data.id}}] {{ node.label }} ({{data.subjectCount || 0}})</span>
f6d2db76   yangzhi   超哥牛皮皮
26
                  <span style="">
52e3f6e1   周超   微调题目维护
27
                    <!-- v-if="activeTab == 'first'?true:node.level<2?true:false" -->
6963d762   周超   拉取志哥最新的
28
                    <el-button type="text" size="mini" @click="showClassDialog(node)" v-if="node.level <3">
f6d2db76   yangzhi   超哥牛皮皮
29
30
                      添加下级
                    </el-button>
94c54e92   周超   1
31
32
                    <el-button type="text" v-if="activeTab == 'second'  || 1==1" @click="handleEditDimension(node, data)">
                      编辑
e011bf15   周超   我先走一步
33
34
                    </el-button>
                    <el-button type="text" size="mini" @click="() => handleDeleteQuestionClass(node, data)">
f6d2db76   yangzhi   超哥牛皮皮
35
36
37
38
39
40
41
42
43
44
45
                      删除
                    </el-button>
                  </span>
                </span>
              </el-tree>
            </div>
          </div>
        </el-col>
        <el-col :span="18">
          <div class="grid-content bg-purple-light">
            <div class="seetingsDiv" style="">
94c54e92   周超   1
46
47
  
  
e011bf15   周超   我先走一步
48
              <el-button type="primary" @click="AddSubject">添加题目
f6d2db76   yangzhi   超哥牛皮皮
49
              </el-button>
94c54e92   周超   1
50
51
52
53
              <el-button type="danger" @click="handleDelete">批量删除
              </el-button>
              <el-button type="danger" @click="handleChangeCat">批量修改分类
              </el-button>
b32564ca   周超   11
54
55
56
              <el-button type="danger" @click="dialogFormVisible = true">导入题目</el-button>
              <!-- <el-button type="danger" @click="handleChangeType">批量修改题型
              </el-button> -->
f6d2db76   yangzhi   超哥牛皮皮
57
58
            </div>
            <div class="areadiv" :style="{ height: TableColHeight + 'px' }">
e011bf15   周超   我先走一步
59
              <el-table :data="QuestList" id="QuestionTable" border style="
f6d2db76   yangzhi   超哥牛皮皮
60
61
62
63
                  width: 100%;
                  border-radius: 5px;
                  box-shadow: 0 0 10px #efefef;
                  margin-top: 10px;
94c54e92   周超   1
64
65
                " :header-cell-class-name="headerStyle" :stripe="true" ref="table">
                <el-table-column type="selection" width="55"> </el-table-column>
4ee13894   周超   给大志哥
66
                <el-table-column prop="date" label="ID" width="80">
f6d2db76   yangzhi   超哥牛皮皮
67
68
69
70
                  <template slot-scope="scope">
                    <span>{{ scope.row.id }}</span>
                  </template>
                </el-table-column>
6963d762   周超   拉取志哥最新的
71
                <el-table-column prop="date" label="题目类型" width="110" sortable>
f6d2db76   yangzhi   超哥牛皮皮
72
73
74
                  <template slot-scope="scope">
                    <span style="padding-left: 10px">{{
                      scope.row.subjectName
e011bf15   周超   我先走一步
75
                      }}</span>
f6d2db76   yangzhi   超哥牛皮皮
76
77
                  </template>
                </el-table-column>
6963d762   周超   拉取志哥最新的
78
                <el-table-column prop="QuestionClassName" label="分类" width="110" sortable>
f6d2db76   yangzhi   超哥牛皮皮
79
80
81
                  <template slot-scope="scope">
                    <span style="padding-left: 10px">{{
                      scope.row.QuestionClassName
e011bf15   周超   我先走一步
82
                      }}</span>
f6d2db76   yangzhi   超哥牛皮皮
83
84
                  </template>
                </el-table-column>
6963d762   周超   拉取志哥最新的
85
                <el-table-column prop="name" label="分数" width="90" sortable>
f6d2db76   yangzhi   超哥牛皮皮
86
87
88
                  <template slot-scope="scope">
                    <span style="padding-left: 10px">{{
                      scope.row.fraction
e011bf15   周超   我先走一步
89
                      }}</span>
f6d2db76   yangzhi   超哥牛皮皮
90
91
                  </template>
                </el-table-column>
6963d762   周超   拉取志哥最新的
92
                <el-table-column prop="name" label="单项分数" width="110" sortable>
f6d2db76   yangzhi   超哥牛皮皮
93
94
95
                  <template slot-scope="scope">
                    <span style="padding-left: 10px">{{
                      scope.row.singleFraction
e011bf15   周超   我先走一步
96
                      }}</span>
f6d2db76   yangzhi   超哥牛皮皮
97
98
99
100
101
102
103
                  </template>
                </el-table-column>
                <el-table-column prop="name" label="正确答案" width="80">
                  <template slot-scope="scope">
                    <span style="padding-left: 10px">{{ scope.row.answer }}</span>
                  </template>
                </el-table-column>
e011bf15   周超   我先走一步
104
                <el-table-column prop="name" label="题目" :show-overflow-tooltip="true">
f6d2db76   yangzhi   超哥牛皮皮
105
106
107
                  <template slot-scope="scope">
                    <span style="padding-left: 10px">{{
                      scope.row.subject
e011bf15   周超   我先走一步
108
                      }}</span>
f6d2db76   yangzhi   超哥牛皮皮
109
110
                  </template>
                </el-table-column>
e011bf15   周超   我先走一步
111
                <el-table-column prop="name" label="解析" :show-overflow-tooltip="true">
f6d2db76   yangzhi   超哥牛皮皮
112
113
114
                  <template slot-scope="scope">
                    <span style="padding-left: 10px">{{
                      scope.row.analysis
e011bf15   周超   我先走一步
115
                      }}</span>
f6d2db76   yangzhi   超哥牛皮皮
116
117
118
119
                  </template>
                </el-table-column>
                <el-table-column fixed="right" label="操作" width="150">
                  <template slot-scope="scope">
e011bf15   周超   我先走一步
120
                    <el-dropdown @command="
f6d2db76   yangzhi   超哥牛皮皮
121
122
123
                        (e) => {
                          handleCommand(e, scope.row.id);
                        }
e011bf15   周超   我先走一步
124
                      " style="padding-left: 10px">
f6d2db76   yangzhi   超哥牛皮皮
125
126
127
128
129
                      <span class="el-dropdown-link">
                        操作<i class="el-icon-arrow-down el-icon--right"></i>
                      </span>
                      <template #dropdown>
                        <el-dropdown-menu>
e011bf15   周超   我先走一步
130
                          <el-dropdown-item command="update">编辑</el-dropdown-item>
f6d2db76   yangzhi   超哥牛皮皮
131
132
133
134
135
136
137
138
                          <!-- <el-dropdown-item command="b">锁定</el-dropdown-item> -->
                          <el-dropdown-item command="del">删除</el-dropdown-item>
                        </el-dropdown-menu>
                      </template>
                    </el-dropdown>
                  </template>
                </el-table-column>
              </el-table>
e011bf15   周超   我先走一步
139
              <el-pagination background @current-change="currentchange" style="
f6d2db76   yangzhi   超哥牛皮皮
140
141
142
143
                  position: static;
                  bottom: 3px;
                  text-align: center;
                  margin-top: 5px;
e011bf15   周超   我先走一步
144
                " :page-size="this.parameter.pageSize" layout="total,prev, pager, next" :total="Count">
f6d2db76   yangzhi   超哥牛皮皮
145
146
147
148
149
150
              </el-pagination>
              <div style="clear: both"></div>
            </div>
          </div>
        </el-col>
      </el-row>
e011bf15   周超   我先走一步
151
152
153
      <el-dialog title="分类维护" :visible.sync="dialogClassIVIsible" @close="closeClassDialog" width="400px"
        :close-on-click-modal="false">
        <el-form ref="QuestionClassInfo" :model="QuestionClassInfo" label-width="70px">
f6d2db76   yangzhi   超哥牛皮皮
154
          <el-form-item label="分类名称">
b32564ca   周超   11
155
  
e011bf15   周超   我先走一步
156
            <el-input v-model="QuestionClassInfo.ClassificationName" placeholder="请输入分类名称"></el-input>
f6d2db76   yangzhi   超哥牛皮皮
157
          </el-form-item>
b32564ca   周超   11
158
159
160
  
  
  
f6d2db76   yangzhi   超哥牛皮皮
161
        </el-form>
6963d762   周超   拉取志哥最新的
162
        <!-- {{QuestionClassInfo}} -->
e011bf15   周超   我先走一步
163
        <el-button @click="CreateQuestionClassHealder" style="margin: 10px 0 0 0; float: right" type="primary">确定
f6d2db76   yangzhi   超哥牛皮皮
164
165
166
        </el-button>
        <div style="clear: both"></div>
      </el-dialog>
e011bf15   周超   我先走一步
167
168
      <el-dialog title="编辑题目" :visible.sync="dialogsubjectlVisible" @close="closeDialog" width="800px"
        :close-on-click-modal="false">
6963d762   周超   拉取志哥最新的
169
170
  
        <el-form ref="Dataform" :model="Dataform" label-width="60px" :rules="rules">
4ee13894   周超   给大志哥
171
          <div style="padding:10px">
94c54e92   周超   1
172
            <el-alert v-if="FormClassType==2" title="选项的维度分值如不设置将按照分值规则自动计算" type="warning"></el-alert>
4ee13894   周超   给大志哥
173
          </div>
6963d762   周超   拉取志哥最新的
174
          <el-form-item label="题目" prop="subject">
e011bf15   周超   我先走一步
175
            <el-input v-model="Dataform.subject" placeholder="请输入题目名称"></el-input>
f6d2db76   yangzhi   超哥牛皮皮
176
          </el-form-item>
6963d762   周超   拉取志哥最新的
177
          <el-form-item label="分类" style="padding-top: 5px" prop="QuestionClassId">
b32564ca   周超   11
178
  
6963d762   周超   拉取志哥最新的
179
            <el-cascader @change="changequestionclass" filterable v-model="Dataform.QuestionClassId" style="width: 400px"
52e3f6e1   周超   微调题目维护
180
              :props="{ emitPath: false ,checkStrictly:true}" :clearable="true" :options="QuestionClass">
6963d762   周超   拉取志哥最新的
181
182
183
184
185
186
187
  
              <template slot-scope="{ node, data }">
                <span>{{ data.label }}</span>
                <span v-if="!node.isLeaf"> ({{ data.subjectCount || 0 }}) </span>
              </template>
  
  
f6d2db76   yangzhi   超哥牛皮皮
188
189
190
            </el-cascader>
          </el-form-item>
          <el-form-item label="题型" style="padding-top: 5px">
e011bf15   周超   我先走一步
191
192
            <el-select v-model="Dataform.subjectType" value-key="Dataform.subjectType" @change="changeQuestionType"
              placeholder="请选择题型">
f6d2db76   yangzhi   超哥牛皮皮
193
194
195
              <el-option label="单选题" :value="1"></el-option>
              <el-option label="多选题" :value="2"></el-option>
              <el-option label="主观题" :value="3"></el-option>
e1644c39   yangzhi   王哥起来屙尿了
196
              <el-option label="语音题" :value="4"></el-option>
f6d2db76   yangzhi   超哥牛皮皮
197
198
199
200
201
202
            </el-select>
          </el-form-item>
          <el-form-item label="选项" v-show="OptionVisible">
            <el-table :data="subjectContent" :show-header="false">
              <el-table-column>
                <template slot-scope="scope">
e011bf15   周超   我先走一步
203
                  <el-input placeholder="请输入答案" v-model="scope.row.optionContent" class="optionInput"
4ee13894   周超   给大志哥
204
                    style="width:47% !important">
f6d2db76   yangzhi   超哥牛皮皮
205
206
                    <template slot="prepend">{{ scope.row.option }}</template>
                  </el-input>
cac28d75   周超   问卷 用户 维度
207
  
6963d762   周超   拉取志哥最新的
208
                  <!-- <el-input placeholder="维度分值" v-model="scope.row.score" class="optionInput"
e011bf15   周超   我先走一步
209
                    style="width:21% !important;margin-left:1%">
6963d762   周超   拉取志哥最新的
210
211
212
213
                  </el-input> -->
  
                  <el-input-number v-model="scope.row.score" class="optionInput" :min="0" :step="5" placeholder="分值"
                    style="width:21% !important;margin-left:1%"></el-input-number>
52e3f6e1   周超   微调题目维护
214
                  <!-- v-if="FormClassType==2"  -->
94c54e92   周超   1
215
216
217
                  <el-select v-model="scope.row.scorerule" class="optionInput" placeholder="分值规则"
                    style="width:20% !important;margin-left:1%">
                    <el-option label="">不设置</el-option>
4ee13894   周超   给大志哥
218
219
                    <el-option v-for="sritem in scoreRules" :label="sritem" :value="sritem">{{sritem}}</el-option>
                  </el-select>
f6d2db76   yangzhi   超哥牛皮皮
220
                  <i class="el-icon-circle-plus el-icon" @click="Addlist"></i>
6963d762   周超   拉取志哥最新的
221
                  <i class="el-icon-remove el-icon" @click="RemoveList(scope)" v-if="subjectContent.length >1"></i>
f6d2db76   yangzhi   超哥牛皮皮
222
223
                </template>
              </el-table-column>
e011bf15   周超   我先走一步
224
  
f6d2db76   yangzhi   超哥牛皮皮
225
226
            </el-table>
          </el-form-item>
4ee13894   周超   给大志哥
227
          <el-form-item label="答案" v-show="OptionVisible" class="subjectContentClass" v-if="FormClassType!=2">
e011bf15   周超   我先走一步
228
            <el-radio-group v-for="(item, i) in subjectContent" v-model="Dataform.answer" v-if="GroupVisible">
f6d2db76   yangzhi   超哥牛皮皮
229
230
              <el-radio :label="item.option">{{ item.option }}</el-radio>
            </el-radio-group>
e011bf15   周超   我先走一步
231
            <el-checkbox-group v-for="(item, i) in subjectContent" v-model="Dataform.answer" v-if="!GroupVisible">
f6d2db76   yangzhi   超哥牛皮皮
232
233
              <el-checkbox style="float: left" :label="item.option">{{
                item.option
e011bf15   周超   我先走一步
234
                }}</el-checkbox>
f6d2db76   yangzhi   超哥牛皮皮
235
236
            </el-checkbox-group>
          </el-form-item>
e011bf15   周超   我先走一步
237
238
          <el-form-item label="分数" v-show="OptionVisible && FormClassType !=2">
            <el-input-number :step="1" style="float: left" :min="0" v-model="Dataform.fraction">
f6d2db76   yangzhi   超哥牛皮皮
239
240
241
            </el-input-number>
            <div style="float: left; margin-left: 20px" v-if="!GroupVisible">
              <lable style="font-weight: bold">单项分数:</lable>
e011bf15   周超   我先走一步
242
              <el-input-number :step="0.5" :max="Dataform.fraction / 2" :min="0" v-model="Dataform.singleFraction">
f6d2db76   yangzhi   超哥牛皮皮
243
244
245
246
              </el-input-number>
            </div>
          </el-form-item>
          <el-form-item label="解析" style="margin-top: 10px">
e011bf15   周超   我先走一步
247
            <el-input v-model="Dataform.analysis" :rows="10" type="textarea" placeholder="请输入答案解析" />
f6d2db76   yangzhi   超哥牛皮皮
248
249
          </el-form-item>
        </el-form>
e011bf15   周超   我先走一步
250
        <el-button @click="EditQuestionHeadler" style="margin: 10px 0 0 0; float: right" type="primary">确定
f6d2db76   yangzhi   超哥牛皮皮
251
252
253
        </el-button>
        <div style="clear: both"></div>
      </el-dialog>
94c54e92   周超   1
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
  
      <el-dialog title="批量设置分类" :visible.sync="dialogsubjectlVisibleSetCat" @close="closeDialogCat" width="800px"
        :close-on-click-modal="false">
        <el-form ref="Dataform" :model="Dataform" label-width="60px">
  
          <el-form-item label="分类" style="padding-top: 5px">
            <el-cascader v-model="QuestionClassId" style="width: 400px" :props="{ emitPath: false ,checkStrictly:true}"
              :clearable="true" :options="QuestionClass">
            </el-cascader>
          </el-form-item>
  
        </el-form>
        <el-button @click="handleSetClass" style="margin: 10px 0 0 0; float: right" type="primary">确定
        </el-button>
        <div style="clear: both"></div>
      </el-dialog>
  
      <el-dialog title="批量设置题型" :visible.sync="dialogsubjectlVisibleSetType" @close="closeDialogType" width="800px"
        :close-on-click-modal="false">
        <el-form ref="Dataform" :model="Dataform" label-width="60px">
  
          <el-form-item label="题型" style="padding-top: 5px">
            <el-select v-model="QuestionTypeId" placeholder="请选择题型">
              <el-option label="请选择" value=""></el-option>
              <el-option label="单选题" :value="1"></el-option>
              <el-option label="多选题" :value="2"></el-option>
              <el-option label="主观题" :value="3"></el-option>
              <el-option label="语音题" :value="4"></el-option>
            </el-select>
          </el-form-item>
  
        </el-form>
        <el-button @click="handleSetType" style="margin: 10px 0 0 0; float: right" type="primary">确定
        </el-button>
        <div style="clear: both"></div>
      </el-dialog>
b32564ca   周超   11
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
  
  
  
  
  
      <el-dialog title="导入" :visible.sync="dialogFormVisible">
  
  
  
  
        <el-upload class="upload-demo" style="width:80%" :headers="{Authorization:token}" drag
        :on-success="handleSuccess"
          action="/api/QuestionBank/import" :limit="1">
          <i class="el-icon-upload"></i>
          <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
          <div class="el-upload__tip" slot="tip">只能上传excel文件,条数尽量不要太多控制在1000内
            <br>
            <br>
            <br>
            <span style="color:red;line-height:20px;font-size:16px">
              注意: 
              <br>
              1.导入每个选项格式 分为三段 用” @@ “ 隔开 选项内容@@选项分值@@选项权重(权重 分为三个 高 中 低) <br /> 例如:
              <p>选项A 今天感觉怎么样@@10@@高</p>
              <p>选项B 内容@@10@@高</p>
              <p>选项C 内容@@5@@中</p>
              <p>选项D 内容@@8@@低</p>
  
            </span>
  
            <br>
            <span style="color:red;line-height:20px;font-size:16px">
            2.分类编号  从后台题库管理左侧分类的名称前获取 [1] 只需填写中间的数字即可
            </span>
  
            <br>
  
            <span style="color:red;line-height:20px;font-size:16px">
              3.多选题  多选题选项 多个用 英文,隔开  如: A,B,C
              </span>
    
              <br>
            <el-link :href="BASE_URL + '/temp/题目导入模板.xlsx'" target="_blank" type="primary">点击下载导入模板</el-link>
  
          </div>
        </el-upload>
  
  
  
  
      </el-dialog>
  
  
94c54e92   周超   1
343
344
      <EditDimension ref="editDimensionDialog" :model="currentEditDimension" @close="closeEditDim" @save="saveEditDim">
      </EditDimension>
f6d2db76   yangzhi   超哥牛皮皮
345
    </div>
b89c8760   wangming   项目初始化
346
347
348
  </template>
  
  <script lang="ts">
e011bf15   周超   我先走一步
349
350
351
352
353
354
    import {
      getQuestionList,
      EditQuestion,
      getQuestionClassList,
      DelQuestionBankEvent,
      GetQuestionBankById,
94c54e92   周超   1
355
      CreateQuestionClass, ChangeQuestionBankClass, ChangeQuestionBankType
e011bf15   周超   我先走一步
356
357
358
    } from "@/api/QuestionBank";
    import { parseTime } from "@/utils/index.js";
    import EditDimension from "./components/EditDimension.vue";
b32564ca   周超   11
359
360
361
362
363
364
  
    import {
      getToken
    } from '@/utils/auth'
  
  
e011bf15   周超   我先走一步
365
366
367
368
    export default {
      filters: {},
      components: {
        EditDimension,
f6d2db76   yangzhi   超哥牛皮皮
369
      },
e011bf15   周超   我先走一步
370
371
      data() {
        return {
b32564ca   周超   11
372
373
          token: getToken(),
          dialogFormVisible: false,
4ee13894   周超   给大志哥
374
          FormClassType: 0,
e011bf15   周超   我先走一步
375
376
          loading: false,
          currentEditDimension: {},
b32564ca   周超   11
377
          defaultexpand: [],
e011bf15   周超   我先走一步
378
379
380
381
382
383
384
385
386
387
388
389
          activeTab: "first",
          parameter: {
            pageIndex: 1,
            pageSize: 12,
            sort: "id",
            sortOrder: 1,
            keyword: "",
            QuestionClassId: 0,
            status: 1,
          },
          Count: 0,
          QuestList: [],
94c54e92   周超   1
390
391
392
393
394
395
396
          QuestionClassId: 0,
          dialogsubjectlVisibleSetCat: false,
  
          QuestionTypeId: '',
          dialogsubjectlVisibleSetType: false,
  
  
e011bf15   周超   我先走一步
397
398
399
400
401
402
403
404
405
406
407
408
409
410
          dialogsubjectlVisible: false,
          dialogClassIVIsible: false,
          OptionVisible: true,
          GroupVisible: true,
          Dataform: {
            subject: "",
            subjectType: 1,
            subjectContent: "",
            QuestionClassId: 0,
            answer: [],
            analysis: "",
            fraction: 0,
            singleFraction: 0,
            addTime: "2021-11-12",
94c54e92   周超   1
411
            state: 1,
e011bf15   周超   我先走一步
412
413
414
415
416
          },
          subjectContent: [
            {
              option: "A",
              optionContent: "",
94c54e92   周超   1
417
              scorerule: '高'
e011bf15   周超   我先走一步
418
419
420
421
422
423
424
425
426
427
428
429
430
431
            },
          ],
          QuestionClass: [],
          QuestionClassInfo: {
            ParentId: 0,
            ClassificationName: "",
            Addtime: "",
          },
          TreeColHeight: 0,
          TableColHeight: 0,
          treeData: [],
          firstTreeData: [],
          secondTreeData: [],
          CreatClassId: 0,
94c54e92   周超   1
432
433
          scoreRules: ['高', '中', '低'],
          currentEditNode: undefined,
6963d762   周超   拉取志哥最新的
434
435
436
437
438
439
440
441
442
443
444
445
446
          currentExpend: [1],
          rules: {
            subject: [
              { required: true, message: '题目名称必填', trigger: 'blur' }
            ],
            subjectType: [
              { required: true, message: '请选择分类', trigger: 'change' }
            ],
            QuestionClassId: [
              { required: true, message: '请选择分类', trigger: 'change' }
            ]
          }
  
e011bf15   周超   我先走一步
447
        };
f6d2db76   yangzhi   超哥牛皮皮
448
      },
52e3f6e1   周超   微调题目维护
449
      created() { },
e011bf15   周超   我先走一步
450
451
452
453
454
455
456
457
458
459
460
      mounted() {
        let ContentAreaHight =
          window.innerHeight - document.getElementById("elRow").offsetTop - 70;
        this.TableColHeight =
          ContentAreaHight - document.getElementById("QuestionTable").offsetTop;
        let lineNumber = this.TableColHeight - 50 - 20; //减去表头来计算
        this.TreeColHeight = ContentAreaHight;
        lineNumber = Math.floor(lineNumber / 49);
        this.parameter.pageSize = lineNumber;
        this.GetList();
        this.getQuestionClassListHeadler();
f6d2db76   yangzhi   超哥牛皮皮
461
      },
e011bf15   周超   我先走一步
462
      methods: {
94c54e92   周超   1
463
464
        closeEditDim(data) {
        },
b32564ca   周超   11
465
466
467
468
469
470
471
472
        handleSuccess(res) {
          var msg = '';
          if(res.data.data){
            msg = `导入完成  共:${res.data.data.tableCount}个题目  成功 ${res.data.data.SuccessCount}个题目`;
          } 
  				this.$message.success(msg);
  				this.GetList();
  			},
c5b61549   周超   111
473
        saveEditDim(data) {
94c54e92   周超   1
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
          // if(this.currentEditNode && this.currentEditNode.parent)
          // this.currentExpend=[this.currentEditNode.parent.data.id];
          // {
          //   this.currentEditNode.label = data.ClassificationName;
          //   this.currentEditNode.data.ClassificationName = data.ClassificationName;
          //   if(this.currentEditNode.parent)
          //   {
          //     this.currentEditNode.parent.loaded =false;
          //     this.currentEditNode.parent.expand();
          //   }
          // }
          this.getQuestionClassListHeadler();
          this.$forceUpdate();
        },
        handleDelete() {
          var rows = this.$refs.table.selection;
          if (!rows || rows.length < 1) {
            this.$message.warning('至少选择一项进行操作!');
            return;
          }
          this.$confirm("确认删除选择的题目吗?", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          }).then(() => {
            DelQuestionBankEvent(rows.map(o => o.id).join(',')).then((o) => {
              this.$message.success("删除成功");
              this.GetList();
            });
          });
  
        },
        handleSetClass() {
          var rows = this.$refs.table.selection;
          if (!this.QuestionClassId || this.QuestionClassId < 1) {
            this.$message.warning('至少选择一个分类进行操作!');
            return;
          }
          this.$confirm("确认批量修改题目分类吗?", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          }).then(() => {
            ChangeQuestionBankClass(rows.map(o => o.id).join(','), this.QuestionClassId).then((o) => {
              this.$message.success("修改成功");
              this.GetList();
              this.dialogsubjectlVisibleSetCat = false;
            });
          });
        },
        handleChangeCat() {
          var rows = this.$refs.table.selection;
b32564ca   周超   11
526
          if (!rows || rows.length < 1) {
94c54e92   周超   1
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
553
554
555
556
557
558
559
560
561
562
            this.$message.warning('至少选择一项进行操作!');
            return;
          }
          this.dialogsubjectlVisibleSetCat = true;
        },
  
  
        handleSetType() {
          var rows = this.$refs.table.selection;
          if (!this.QuestionTypeId || this.QuestionTypeId < 1) {
            this.$message.warning('至少选择一个类型进行操作!');
            return;
          }
          this.$confirm("确认批量修改题目类型吗?", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          }).then(() => {
            ChangeQuestionBankType(rows.map(o => o.id).join(','), this.QuestionTypeId).then((o) => {
              this.$message.success("修改成功");
              this.GetList();
              this.dialogsubjectlVisibleSetType = false;
            });
          });
        },
        handleChangeType() {
          var rows = this.$refs.table.selection;
          if (!rows || rows.length < 1) {
            this.$message.warning('至少选择一项进行操作!');
            return;
          }
          this.dialogsubjectlVisibleSetType = true;
        },
  
  
        AddSubject() {
e011bf15   周超   我先走一步
563
          this.FormClassType = 0;
4ee13894   周超   给大志哥
564
565
          // if(!this.Dataform.scoperule)
          // this.Dataform.scoperule='高';
e011bf15   周超   我先走一步
566
567
          this.dialogsubjectlVisible = true
        },
4ee13894   周超   给大志哥
568
        changequestionclass(a, b, c) {
6963d762   周超   拉取志哥最新的
569
          debugger;
4ee13894   周超   给大志哥
570
571
          var item = this.QuestionClass.find(o => o.id == a);
          if (item) this.FormClassType = item.ClassType;
e011bf15   周超   我先走一步
572
573
574
575
576
        },
        //维度编辑
        handleEditDimension(node, data) {
          console.log(data);
          // this.$refs.editDimensionDialog.dialogFormVisible = true;
6963d762   周超   拉取志哥最新的
577
          this.$refs.editDimensionDialog.show(data.id, node);
e011bf15   周超   我先走一步
578
          this.currentEditDimension = data;
94c54e92   周超   1
579
          this.currentEditNode = node;
e011bf15   周超   我先走一步
580
581
582
583
584
585
586
587
588
589
        },
        //切换分类
        handleTabsClick(e) {
          console.log(e.name);
        },
        //删除分类
        handleDeleteQuestionClass(node, data) {
          this.loading = true;
          // console.log(node, data);
          // console.log(this.API);
e011bf15   周超   我先走一步
590
  
6963d762   周超   拉取志哥最新的
591
          setTimeout(() => {
4ee13894   周超   给大志哥
592
            this.loading = false;
6963d762   周超   拉取志哥最新的
593
594
595
596
597
598
599
600
  
          }, 1000);
          this.$confirm("确认删除该分类信息吗?", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          }).then(() => {
            this.API.deleteQuestionClass(data.value).then((res) => {
b32564ca   周超   11
601
602
603
              if (res.data.success) {
                this.getQuestionClassListHeadler();
                this.$message.success('操作成功!');
6963d762   周超   拉取志哥最新的
604
              }
b32564ca   周超   11
605
              else {
6963d762   周超   拉取志哥最新的
606
607
                this.$message.error(res.data.message || '删除失败!');
              }
b32564ca   周超   11
608
  
6963d762   周超   拉取志哥最新的
609
            });
e011bf15   周超   我先走一步
610
          });
6963d762   周超   拉取志哥最新的
611
612
613
  
  
  
e011bf15   周超   我先走一步
614
615
616
617
618
619
620
621
        },
        closeClassDialog() {
          this.dialogClassIVIsible = false;
        },
        //表格右边的操作按钮
        handleCommand(value, val) {
          if (value == "update") {
            this.GetQuestionBankByIdHeadler(val);
f6d2db76   yangzhi   超哥牛皮皮
622
          }
e011bf15   周超   我先走一步
623
624
625
626
627
628
          if (value == "del") {
            this.DelQuestionBankEventHeadler(val);
          }
        },
        //添加分类
        CreateQuestionClassHealder() {
4ee13894   周超   给大志哥
629
630
631
          if (this.loading) return;
          this.loading = true;
  
e011bf15   周超   我先走一步
632
633
634
635
          this.QuestionClassInfo.Addtime = parseTime(new Date(), "");
          CreateQuestionClass(this.QuestionClassInfo).then((res) => {
            this.getQuestionClassListHeadler();
            this.dialogClassIVIsible = false;
4ee13894   周超   给大志哥
636
637
638
            setTimeout(() => {
              this.loading = false;
            }, 1000);
e011bf15   周超   我先走一步
639
640
641
642
643
          });
        },
        //获取选择的题目详细信息
        GetQuestionBankByIdHeadler(id) {
          GetQuestionBankById(id).then((res) => {
4ee13894   周超   给大志哥
644
645
646
  
            var d = this.QuestionClass.find(o => o.id == res.data.data.QuestionClassId);
            if (d) this.FormClassType = d.ClassType;
e011bf15   周超   我先走一步
647
648
649
650
651
652
653
654
655
656
657
            this.changeQuestionType(res.data.data.subjectType); //这里先初始化编辑显示内容
            this.Dataform = res.data.data; //内容赋值
            this.subjectContent = JSON.parse(res.data.data.subjectContent); //赋值选项
            if (res.data.data.subjectType == 1) {
              this.Dataform.answer = res.data.data.answer.split(",")[0]; //赋值答案
            } else {
              this.Dataform.answer = res.data.data.answer.split(","); //赋值答案
            }
            this.dialogsubjectlVisible = true;
          });
        },
6963d762   周超   拉取志哥最新的
658
659
660
        showClassDialog(node, parent, type) {
          this.QuestionClassInfo.ClassificationName = '';
          this.$forceUpdate();
e011bf15   周超   我先走一步
661
662
          this.dialogClassIVIsible = true;
          console.log(node);
b32564ca   周超   11
663
664
665
          if (parent == 0) {
            this.QuestionClassInfo.ParentId = 0;
          }
94c54e92   周超   1
666
667
          if (node)
            this.QuestionClassInfo.ParentId = node.data.value;
c5b61549   周超   111
668
669
670
          if (type) this.QuestionClassInfo.ClassType = type;
          else if (node.data.ClassType) this.QuestionClassInfo.ClassType = node.data.ClassType;
  
6963d762   周超   拉取志哥最新的
671
  
e011bf15   周超   我先走一步
672
673
674
675
676
677
678
679
          //   alert(this.QuestionClassInfo.ParentId);
        },
        //关闭弹框的事件
        closeDialog() {
          //初始化数据
          this.Dataform = this.$options.data().Dataform;
          this.subjectContent = this.$options.data().subjectContent;
          //所有文本框恢复到初始化状态
f6d2db76   yangzhi   超哥牛皮皮
680
681
682
          this.Dataform.answer = [];
          this.OptionVisible = true;
          this.GroupVisible = true;
e011bf15   周超   我先走一步
683
        },
94c54e92   周超   1
684
685
686
687
688
689
690
691
692
693
        closeDialogCat() {
          this.QuestionClassId = 0;
          this.dialogsubjectlVisibleSetCat = false;
        },
        closeDialogType() {
          this.QuestionClassTypeId = '';
          this.dialogsubjectlVisibleSetType = false;
        },
  
  
e011bf15   周超   我先走一步
694
        //选择题目类型来判断是否显示部分表单
4ee13894   周超   给大志哥
695
        changeQuestionType(val) {
e1644c39   yangzhi   王哥起来屙尿了
696
          if (val == 3 || val == 4) {
e011bf15   周超   我先走一步
697
698
699
700
701
702
            this.OptionVisible = false;
          }
          if (val == 2) {
            this.OptionVisible = true;
            this.Dataform.answer = [];
            this.GroupVisible = false;
4ee13894   周超   给大志哥
703
  
e011bf15   周超   我先走一步
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
          }
          if (val == 1) {
            this.Dataform.answer = [];
            this.OptionVisible = true;
            this.GroupVisible = true;
          }
        },
        headerStyle({ row, column, rowIndex, columnIndex }) {
          return "tableStyle";
        },
        Addlist() {
          if (this.subjectContent.length < 4) {
            var alphabet = String.fromCharCode(
              64 + parseInt(this.subjectContent.length + 1)
            );
            this.subjectContent.push({
              option: alphabet,
              title: "",
            });
          } else {
            this.$confirm("系统暂时只支持4个答案!", "消息");
          }
        },
        RemoveList(val) {
          this.subjectContent.splice(val.$index, 1);
          this.subjectContent.forEach((item, index) => {
            item.option = String.fromCharCode(64 + parseInt(index + 1));
f6d2db76   yangzhi   超哥牛皮皮
731
          });
e011bf15   周超   我先走一步
732
        },
b32564ca   周超   11
733
734
735
        handleNodeExpand(a, b, c) {
          this.defaultexpand = [a.id];
        },
e011bf15   周超   我先走一步
736
        handleNodeClick(val) {
4ee13894   周超   给大志哥
737
          if (this.loading) return;
e011bf15   周超   我先走一步
738
739
          this.parameter.QuestionClassId = val.value;
          this.parameter.pageIndex = 1;
6963d762   周超   拉取志哥最新的
740
          this.Dataform.QuestionClassId = val.value;
b32564ca   周超   11
741
          this.defaultexpand = [val.value];
e011bf15   周超   我先走一步
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
          this.GetList();
        },
        DelQuestionBankEventHeadler(id) {
          this.$confirm("确定删除该试题?", "消息", {
            confirmButtonText: "确认",
            cancelButtonText: "取消",
            callback: (action) => {
              if (action == "confirm") {
                DelQuestionBankEvent(id).then((res) => {
                  if (res.data.code == 200) {
                    this.$confirm(res.data.message, "消息");
                    this.GetList();
                  }
                });
              }
            },
          });
        },
b32564ca   周超   11
760
        EditQuestionHeadler() {
6963d762   周超   拉取志哥最新的
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
          this.$refs['Dataform'].validate((valid) => {
            if (valid) {
  
              let reg = new RegExp('"', "g");
              //this.Dataform.subjectContent = JSON.stringify(this.subjectContent).replace(reg, "\"");
              this.Dataform.subjectContent = this.subjectContent;
              if (typeof this.Dataform.answer != "string")
                //判断是否为字符串
                this.Dataform.answer = this.Dataform.answer.join(",");
              var _this = this;
              EditQuestion(this.Dataform).then((res) => {
                if (res.data.code == 200) {
                  _this.GetList();
                  this.$message.success(res.data.message);
                  setTimeout(function () {
                    _this.dialogsubjectlVisible = false;
                  }, 10);
                }
              });
            } else {
              console.log('error submit!!');
              return false;
f6d2db76   yangzhi   超哥牛皮皮
783
            }
f6d2db76   yangzhi   超哥牛皮皮
784
          });
6963d762   周超   拉取志哥最新的
785
  
e011bf15   周超   我先走一步
786
787
788
789
790
791
792
        },
        GetList() {
          let _this = this;
          getQuestionList(_this.parameter).then((res) => {
            _this.QuestList = res.data.data.rows;
            _this.Count = res.data.data.total;
            _this.$forceUpdate();
f6d2db76   yangzhi   超哥牛皮皮
793
          });
e011bf15   周超   我先走一步
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
        },
        currentchange(page) {
          this.parameter.pageIndex = page;
          this.GetList();
        },
        getSubTree(id, list) {
          let result = [];
          result = list.filter((t) => t.ParentId == id);
          if (result.length) {
            result = result.map((item) => {
              item.children = this.getSubTree(item.id, list);
              return item;
            });
          }
          return result;
        },
        getQuestionClassListHeadler() {
          let _this = this;
          getQuestionClassList().then((res) => {
            let list = res.data.data;
            list = list.map((t) => {
              t.value = t.id;
              t.label = t.ClassificationName;
              return t;
            });
94c54e92   周超   1
819
820
821
822
            // let firstClass = list.find((t) => t.id == 6);
            // firstClass.children = this.getSubTree(6, list);
            // let secondClass = list.find((t) => t.id == 1);
            // secondClass.children = this.getSubTree(1, list);
e011bf15   周超   我先走一步
823
            this.QuestionClass = list;
b89c8760   wangming   项目初始化
824
  
94c54e92   周超   1
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
            var firstlist = list.filter(o => o.ClassType == 0 && o.ParentId == 0).map(o => {
              o.children = this.getSubTree(o.id, list);
              return o;
            });
  
            var twolist = list.filter(o => o.ClassType == 2 && o.ParentId == 0).map(o => {
              o.children = this.getSubTree(o.id, list);
              return o;
  
            });
  
            this.firstTreeData = firstlist;
            this.secondTreeData = twolist;
            // _this.$nextTick(()=>{
            //   if(_this.currentEditNode){
            //     _this.$refs.tree.getNode(_this.currentEditNode.parent).loaded = false
            //     _this.$refs.tree.getNode(_this.currentEditNode.parent).expand();
            //     _this.$refs.tree.getNode(_this.currentEditNode.parent).expanded=true;
            //     _this.$forceUpdate()
c5b61549   周超   111
844
  
94c54e92   周超   1
845
846
847
            // }
  
            // });
c5b61549   周超   111
848
  
94c54e92   周超   1
849
850
            // this.firstTreeData = [firstClass];
            // this.secondTreeData = [secondClass];
e011bf15   周超   我先走一步
851
852
          });
        },
f6d2db76   yangzhi   超哥牛皮皮
853
      },
e011bf15   周超   我先走一步
854
    };
b89c8760   wangming   项目初始化
855
856
  </script>
  <style scoped="scoped">
e011bf15   周超   我先走一步
857
858
859
860
861
    /deep/.cell {
      padding-left: 0px;
    }
  
    /deep/.el-form-item {
6963d762   周超   拉取志哥最新的
862
      /* margin-bottom: 5px; */
e011bf15   周超   我先走一步
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
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
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
    }
  
    /deep/.el-radio {
      margin-right: 10px;
    }
  
    /deep/.el-radio__input.is-checked .el-radio__inner {
      border-color: #409eff;
      background-color: #409eff;
    }
  
    /deep/.el-radio__input.is-checked+.el-radio__label {
      color: #409eff;
      font-weight: bold;
    }
  
    /deep/.tableStyle {
      background-color: #304156 !important;
      color: #fff;
      font-weight: 400;
    }
  
    .QuestDiv {
      width: 24%;
      float: left;
      min-height: 50px;
      border: 1px solid #cdcdcd;
      margin-right: 10px;
      box-shadow: 0 0 10px #808080;
      border-radius: 8px;
      min-height: 100px;
      background-color: #fff;
      opacity: 0.8;
      margin-bottom: 10px;
      height: 313px;
    }
  
    .clear {
      clear: both;
      margin-bottom: 10px;
    }
  
    .font-color {
      background-color: #ae1e15 !important;
      color: #fff;
      box-shadow: 0 0 5px #ae1e15;
    }
  
    /deep/.el-input-group__prepend {
      font-weight: bold;
      width: 30px;
      text-align: center;
      background: #409eff;
      color: #fff;
    }
  
    .optionInput {
      float: left;
      width: 620px !important;
    }
  
    .el-icon {
      font-size: 20px;
      line-height: 40px;
      margin: 0 5px;
      cursor: pointer;
      color: #409eff !important;
    }
  
    >>>.subjectContentClass .el-checkbox__label {
      padding-right: 10px !important;
    }
  
    .seetingsDiv {
      width: 100%;
      height: 60px;
      background: #efefef;
      line-height: 60px;
      border-radius: 5px;
      box-shadow: 0 0 5px #cdcdcd;
    }
  
    .seetingsDiv button {
      background-color: #304156;
      border: 0px;
      margin-left: 10px;
      box-shadow: 0 0 5px #cdcdcd;
      float: right;
      margin-top: 12px;
      margin-right: 10px;
    }
  
    .areadiv {
      background-color: #efefef;
      border-radius: 5px;
      box-shadow: 0 0 5px #efefef;
    }
  
    .TreeHeader {
      background-color: #304156;
      height: 60px;
      border-radius: 5px;
      box-shadow: 0 0 10px #efefef;
      line-height: 60px;
      color: #fff;
      padding-left: 10px;
    }
  
    .classbtn {
      float: right;
      margin: 11px 10px 0 0;
      height: 35px;
      line-height: 12px;
    }
  
    .eltree {
      background-color: #efefef;
    }
  
    /deep/.el-tree-node__content {
      min-height: 40px;
    }
  
    .custom-tree-node {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 14px;
      padding-right: 8px;
    }
  </style>