Commit 4ee13894903de6fee0646cf36b7a86af6cb40650
1 parent
e011bf15
给大志哥
Showing
4 changed files
with
136 additions
and
42 deletions
src/views/QuestionBank/components/EditDimension.vue
src/views/QuestionBank/index.vue
| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | <div class="TreeHeader"> |
| 7 | 7 | <label style="font-size: 18px">题目分类</label> |
| 8 | 8 | </div> |
| 9 | + | |
| 9 | 10 | <div :style="{ height: TableColHeight + 'px' }" class="areadiv" |
| 10 | 11 | style="margin: 10px 0 0 0; padding: 5px 0 0 0"> |
| 11 | 12 | <el-tabs v-model="activeTab" @tab-click="handleTabsClick" style="padding: 0 20px" :stretch="true"> |
| ... | ... | @@ -18,7 +19,8 @@ |
| 18 | 19 | <span class="custom-tree-node" slot-scope="{ node, data }"> |
| 19 | 20 | <span>{{ node.label }}</span> |
| 20 | 21 | <span style=""> |
| 21 | - <el-button type="text" size="mini" @click="showClassDialog(node)" v-if="activeTab == 'first'?true:node.level<2?true:false"> | |
| 22 | + <el-button type="text" size="mini" @click="showClassDialog(node)" | |
| 23 | + v-if="activeTab == 'first'?true:node.level<2?true:false"> | |
| 22 | 24 | 添加下级 |
| 23 | 25 | </el-button> |
| 24 | 26 | <el-button type="text" v-if="activeTab == 'second'" @click="handleEditDimension(node, data)">编辑 |
| ... | ... | @@ -45,7 +47,7 @@ |
| 45 | 47 | box-shadow: 0 0 10px #efefef; |
| 46 | 48 | margin-top: 10px; |
| 47 | 49 | " :header-cell-class-name="headerStyle" :stripe="true"> |
| 48 | - <el-table-column prop="date" label="ID" width="50"> | |
| 50 | + <el-table-column prop="date" label="ID" width="80"> | |
| 49 | 51 | <template slot-scope="scope"> |
| 50 | 52 | <span>{{ scope.row.id }}</span> |
| 51 | 53 | </template> |
| ... | ... | @@ -144,12 +146,17 @@ |
| 144 | 146 | <el-dialog title="编辑题目" :visible.sync="dialogsubjectlVisible" @close="closeDialog" width="800px" |
| 145 | 147 | :close-on-click-modal="false"> |
| 146 | 148 | <el-form ref="Dataform" :model="Dataform" label-width="60px"> |
| 149 | + <div style="padding:10px"> | |
| 150 | + <el-alert v-if="FormClassType==2" | |
| 151 | + title="选项的维度分值如不设置将按照分值规则自动计算" | |
| 152 | + type="warning"></el-alert> | |
| 153 | + </div> | |
| 147 | 154 | <el-form-item label="题目"> |
| 148 | 155 | <el-input v-model="Dataform.subject" placeholder="请输入题目名称"></el-input> |
| 149 | 156 | </el-form-item> |
| 150 | 157 | <el-form-item label="分类" style="padding-top: 5px"> |
| 151 | - <el-cascader @change="changequestionclass" v-model="Dataform.QuestionClassId" style="width: 400px" :props="{ emitPath: false ,checkStrictly:true}" | |
| 152 | - :clearable="true" :options="QuestionClass"> | |
| 158 | + <el-cascader @change="changequestionclass" v-model="Dataform.QuestionClassId" style="width: 400px" | |
| 159 | + :props="{ emitPath: false ,checkStrictly:true}" :clearable="true" :options="QuestionClass"> | |
| 153 | 160 | </el-cascader> |
| 154 | 161 | </el-form-item> |
| 155 | 162 | <el-form-item label="题型" style="padding-top: 5px"> |
| ... | ... | @@ -165,7 +172,7 @@ |
| 165 | 172 | <el-table-column> |
| 166 | 173 | <template slot-scope="scope"> |
| 167 | 174 | <el-input placeholder="请输入答案" v-model="scope.row.optionContent" class="optionInput" |
| 168 | - style="width:68% !important"> | |
| 175 | + style="width:47% !important"> | |
| 169 | 176 | <template slot="prepend">{{ scope.row.option }}</template> |
| 170 | 177 | </el-input> |
| 171 | 178 | |
| ... | ... | @@ -173,7 +180,10 @@ |
| 173 | 180 | style="width:21% !important;margin-left:1%"> |
| 174 | 181 | </el-input> |
| 175 | 182 | |
| 176 | - | |
| 183 | + <el-select v-model="scope.row.scorerule" class="optionInput" placeholder="分值规则" v-if="FormClassType==2" style="width:20% !important;margin-left:1%"> | |
| 184 | + <el-option label="" >不设置</el-option> | |
| 185 | + <el-option v-for="sritem in scoreRules" :label="sritem" :value="sritem">{{sritem}}</el-option> | |
| 186 | + </el-select> | |
| 177 | 187 | <i class="el-icon-circle-plus el-icon" @click="Addlist"></i> |
| 178 | 188 | <i class="el-icon-remove el-icon" @click="RemoveList(scope)" v-if="scope.$index != 0"></i> |
| 179 | 189 | </template> |
| ... | ... | @@ -181,7 +191,7 @@ |
| 181 | 191 | |
| 182 | 192 | </el-table> |
| 183 | 193 | </el-form-item> |
| 184 | - <el-form-item label="答案" v-show="OptionVisible" class="subjectContentClass" v-if="FormClassType!=2"> | |
| 194 | + <el-form-item label="答案" v-show="OptionVisible" class="subjectContentClass" v-if="FormClassType!=2"> | |
| 185 | 195 | <el-radio-group v-for="(item, i) in subjectContent" v-model="Dataform.answer" v-if="GroupVisible"> |
| 186 | 196 | <el-radio :label="item.option">{{ item.option }}</el-radio> |
| 187 | 197 | </el-radio-group> |
| ... | ... | @@ -230,7 +240,7 @@ |
| 230 | 240 | }, |
| 231 | 241 | data() { |
| 232 | 242 | return { |
| 233 | - FormClassType:0, | |
| 243 | + FormClassType: 0, | |
| 234 | 244 | loading: false, |
| 235 | 245 | currentEditDimension: {}, |
| 236 | 246 | activeTab: "first", |
| ... | ... | @@ -259,12 +269,13 @@ |
| 259 | 269 | fraction: 0, |
| 260 | 270 | singleFraction: 0, |
| 261 | 271 | addTime: "2021-11-12", |
| 262 | - state: 1, | |
| 272 | + state: 1, | |
| 263 | 273 | }, |
| 264 | 274 | subjectContent: [ |
| 265 | 275 | { |
| 266 | 276 | option: "A", |
| 267 | 277 | optionContent: "", |
| 278 | + scorerule:'高' | |
| 268 | 279 | }, |
| 269 | 280 | ], |
| 270 | 281 | QuestionClass: [], |
| ... | ... | @@ -279,6 +290,7 @@ |
| 279 | 290 | firstTreeData: [], |
| 280 | 291 | secondTreeData: [], |
| 281 | 292 | CreatClassId: 0, |
| 293 | + scoreRules:['高','中','低'], | |
| 282 | 294 | }; |
| 283 | 295 | }, |
| 284 | 296 | created() { }, |
| ... | ... | @@ -295,13 +307,15 @@ |
| 295 | 307 | this.getQuestionClassListHeadler(); |
| 296 | 308 | }, |
| 297 | 309 | methods: { |
| 298 | - AddSubject(){ | |
| 310 | + AddSubject() { | |
| 299 | 311 | this.FormClassType = 0; |
| 312 | + // if(!this.Dataform.scoperule) | |
| 313 | + // this.Dataform.scoperule='高'; | |
| 300 | 314 | this.dialogsubjectlVisible = true |
| 301 | 315 | }, |
| 302 | - changequestionclass(a,b,c){ | |
| 303 | - var item = this.QuestionClass.find(o=>o.id ==a); | |
| 304 | - if(item) this.FormClassType = item.ClassType; | |
| 316 | + changequestionclass(a, b, c) { | |
| 317 | + var item = this.QuestionClass.find(o => o.id == a); | |
| 318 | + if (item) this.FormClassType = item.ClassType; | |
| 305 | 319 | }, |
| 306 | 320 | //维度编辑 |
| 307 | 321 | handleEditDimension(node, data) { |
| ... | ... | @@ -320,10 +334,10 @@ |
| 320 | 334 | // console.log(node, data); |
| 321 | 335 | // console.log(this.API); |
| 322 | 336 | this.API.deleteQuestionClass(data.value).then((res) => { |
| 323 | - | |
| 337 | + | |
| 324 | 338 | this.getQuestionClassListHeadler(); |
| 325 | 339 | |
| 326 | - this.loading = false; | |
| 340 | + this.loading = false; | |
| 327 | 341 | this.$message.success('操作成功!'); |
| 328 | 342 | }); |
| 329 | 343 | }, |
| ... | ... | @@ -341,24 +355,24 @@ |
| 341 | 355 | }, |
| 342 | 356 | //添加分类 |
| 343 | 357 | CreateQuestionClassHealder() { |
| 344 | - if(this.loading)return; | |
| 345 | - this.loading=true; | |
| 346 | - | |
| 358 | + if (this.loading) return; | |
| 359 | + this.loading = true; | |
| 360 | + | |
| 347 | 361 | this.QuestionClassInfo.Addtime = parseTime(new Date(), ""); |
| 348 | 362 | CreateQuestionClass(this.QuestionClassInfo).then((res) => { |
| 349 | 363 | this.getQuestionClassListHeadler(); |
| 350 | 364 | this.dialogClassIVIsible = false; |
| 351 | - setTimeout(()=>{ | |
| 352 | - this.loading = false; | |
| 353 | - },1000); | |
| 365 | + setTimeout(() => { | |
| 366 | + this.loading = false; | |
| 367 | + }, 1000); | |
| 354 | 368 | }); |
| 355 | 369 | }, |
| 356 | 370 | //获取选择的题目详细信息 |
| 357 | 371 | GetQuestionBankByIdHeadler(id) { |
| 358 | 372 | GetQuestionBankById(id).then((res) => { |
| 359 | - | |
| 360 | - var d = this.QuestionClass.find(o=>o.id==res.data.data.QuestionClassId); | |
| 361 | - if(d)this.FormClassType = d.ClassType; | |
| 373 | + | |
| 374 | + var d = this.QuestionClass.find(o => o.id == res.data.data.QuestionClassId); | |
| 375 | + if (d) this.FormClassType = d.ClassType; | |
| 362 | 376 | this.changeQuestionType(res.data.data.subjectType); //这里先初始化编辑显示内容 |
| 363 | 377 | this.Dataform = res.data.data; //内容赋值 |
| 364 | 378 | this.subjectContent = JSON.parse(res.data.data.subjectContent); //赋值选项 |
| ... | ... | @@ -387,7 +401,7 @@ |
| 387 | 401 | this.GroupVisible = true; |
| 388 | 402 | }, |
| 389 | 403 | //选择题目类型来判断是否显示部分表单 |
| 390 | - changeQuestionType(val) { | |
| 404 | + changeQuestionType(val) { | |
| 391 | 405 | if (val == 3) { |
| 392 | 406 | this.OptionVisible = false; |
| 393 | 407 | } |
| ... | ... | @@ -395,7 +409,7 @@ |
| 395 | 409 | this.OptionVisible = true; |
| 396 | 410 | this.Dataform.answer = []; |
| 397 | 411 | this.GroupVisible = false; |
| 398 | - | |
| 412 | + | |
| 399 | 413 | } |
| 400 | 414 | if (val == 1) { |
| 401 | 415 | this.Dataform.answer = []; |
| ... | ... | @@ -426,7 +440,7 @@ |
| 426 | 440 | }); |
| 427 | 441 | }, |
| 428 | 442 | handleNodeClick(val) { |
| 429 | - if(this.loading)return; | |
| 443 | + if (this.loading) return; | |
| 430 | 444 | this.parameter.QuestionClassId = val.value; |
| 431 | 445 | this.parameter.pageIndex = 1; |
| 432 | 446 | this.GetList(); | ... | ... |
src/views/TestPaper/ManualTestPaper.vue
| ... | ... | @@ -10,10 +10,14 @@ |
| 10 | 10 | <div style="padding:0 10px"> |
| 11 | 11 | <el-input size="small" placeholder="输入关键字搜索" v-model="parameter.keyWord"></el-input> |
| 12 | 12 | </div> |
| 13 | + <div style="padding:10.5px"> | |
| 14 | + <el-button type="primary" @click="randomSubject" style="width:100%">随机抽题</el-button> | |
| 15 | + </div> | |
| 13 | 16 | |
| 14 | 17 | <draggable :options="{animation:380,filter:'.unmover'}" group="itxst" v-model="arr1" @end="end1" |
| 15 | 18 | @add="RemoveHere" :move="onMove" class="infinite-list" :style="{'height':contentHeight-80+'px'}" |
| 16 | 19 | infinite-scroll-disabled="disabled" v-infinite-scroll="load" style="overflow:auto"> |
| 20 | + | |
| 17 | 21 | <li v-for="i in arr1" class="infinite-list-item" :key="i.id" v-if="!classarr.some(o=>o == i.id)">{{ |
| 18 | 22 | i.subject }}</li> |
| 19 | 23 | <p v-if="loading" style="text-align: center;color: #cdcdcd;" class="unmover">加载中...</p> |
| ... | ... | @@ -113,6 +117,40 @@ |
| 113 | 117 | </div> |
| 114 | 118 | </el-col> |
| 115 | 119 | </el-row> |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + <el-dialog title="收货地址" :visible.sync="dialogTableVisible"> | |
| 124 | + <el-form label-width="100px" class="demo-dynamic"> | |
| 125 | + <el-form-item | |
| 126 | + prop="email" | |
| 127 | + label="邮箱" | |
| 128 | + :rules="[ | |
| 129 | + { required: true, message: '请输入邮箱地址', trigger: 'blur' }, | |
| 130 | + { type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] } | |
| 131 | + ]" | |
| 132 | + > | |
| 133 | + <el-input v-model="dynamicValidateForm.email"></el-input> | |
| 134 | + </el-form-item> | |
| 135 | + <el-form-item | |
| 136 | + v-for="(domain, index) in dynamicValidateForm.domains" | |
| 137 | + :label="'域名' + index" | |
| 138 | + :key="domain.key" | |
| 139 | + :prop="'domains.' + index + '.value'" | |
| 140 | + :rules="{ | |
| 141 | + required: true, message: '域名不能为空', trigger: 'blur' | |
| 142 | + }" | |
| 143 | + > | |
| 144 | + <el-input v-model="domain.value"></el-input><el-button @click.prevent="removeDomain(domain)">删除</el-button> | |
| 145 | + </el-form-item> | |
| 146 | + <el-form-item> | |
| 147 | + <el-button type="primary" @click="submitForm('dynamicValidateForm')">提交</el-button> | |
| 148 | + <el-button @click="addDomain">新增域名</el-button> | |
| 149 | + <el-button @click="resetForm('dynamicValidateForm')">重置</el-button> | |
| 150 | + </el-form-item> | |
| 151 | + </el-form> | |
| 152 | + </el-dialog> | |
| 153 | + | |
| 116 | 154 | </div> |
| 117 | 155 | </template> |
| 118 | 156 | |
| ... | ... | @@ -122,13 +160,20 @@ |
| 122 | 160 | import { GetQuestionClassByType } from "@/api/QuestionClass"; |
| 123 | 161 | import { EditTestPaper, GetToplevel } from "@/api/TestPaper"; |
| 124 | 162 | import { formatTime } from '@/utils/util' |
| 125 | - export default { | |
| 163 | + export default { | |
| 126 | 164 | //注册draggable组件 |
| 127 | 165 | components: { |
| 128 | 166 | draggable, |
| 129 | 167 | }, |
| 130 | 168 | data() { |
| 131 | 169 | return { |
| 170 | + dynamicValidateForm: { | |
| 171 | + domains: [{ | |
| 172 | + value: '' | |
| 173 | + }], | |
| 174 | + email: '' | |
| 175 | + }, | |
| 176 | + dialogTableVisible:false, | |
| 132 | 177 | loadingType:false, |
| 133 | 178 | activeTab: "6", |
| 134 | 179 | parameter: { |
| ... | ... | @@ -221,6 +266,34 @@ |
| 221 | 266 | //this.GetList(); |
| 222 | 267 | }, |
| 223 | 268 | methods: { |
| 269 | + randomSubject(){ | |
| 270 | + this.dialogTableVisible=true; | |
| 271 | + }, | |
| 272 | + submitForm(formName) { | |
| 273 | + this.$refs[formName].validate((valid) => { | |
| 274 | + if (valid) { | |
| 275 | + alert('submit!'); | |
| 276 | + } else { | |
| 277 | + console.log('error submit!!'); | |
| 278 | + return false; | |
| 279 | + } | |
| 280 | + }); | |
| 281 | + }, | |
| 282 | + resetForm(formName) { | |
| 283 | + this.$refs[formName].resetFields(); | |
| 284 | + }, | |
| 285 | + removeDomain(item) { | |
| 286 | + var index = this.dynamicValidateForm.domains.indexOf(item) | |
| 287 | + if (index !== -1) { | |
| 288 | + this.dynamicValidateForm.domains.splice(index, 1) | |
| 289 | + } | |
| 290 | + }, | |
| 291 | + addDomain() { | |
| 292 | + this.dynamicValidateForm.domains.push({ | |
| 293 | + value: '', | |
| 294 | + key: Date.now() | |
| 295 | + }); | |
| 296 | + }, | |
| 224 | 297 | changetimestartend(val, aa) { |
| 225 | 298 | this.TestPaper.EffectiveStartTime = formatTime(val[0]) |
| 226 | 299 | this.TestPaper.EffectiveEndTime = formatTime(val[1]) | ... | ... |
src/views/TestPaper/TestPaperList.vue
| ... | ... | @@ -155,9 +155,9 @@ |
| 155 | 155 | getTestPaperClassList, |
| 156 | 156 | DeleteTestPaper |
| 157 | 157 | } from '@/api/TestPaper' |
| 158 | - import {formatTime} from '@/utils/util' | |
| 158 | + import { formatTime } from '@/utils/util' | |
| 159 | 159 | let that |
| 160 | - export default { | |
| 160 | + export default { | |
| 161 | 161 | data() { |
| 162 | 162 | return { |
| 163 | 163 | parameter: { |
| ... | ... | @@ -212,10 +212,16 @@ |
| 212 | 212 | }, |
| 213 | 213 | filters: { |
| 214 | 214 | typeFilters(val) { |
| 215 | - const data = that.list.filter(t => t.id == val)[0] | |
| 216 | - if (data) { | |
| 217 | - return data.ClassTitle | |
| 218 | - } else { | |
| 215 | + var that = this; | |
| 216 | + try { | |
| 217 | + if (!that.list) return '未知'; | |
| 218 | + const data = that.list.filter(t => t.id == val)[0] | |
| 219 | + if (data) { | |
| 220 | + return data.ClassTitle | |
| 221 | + } else { | |
| 222 | + return '未知' | |
| 223 | + } | |
| 224 | + } catch (e) { | |
| 219 | 225 | return '未知' |
| 220 | 226 | } |
| 221 | 227 | } |
| ... | ... | @@ -231,13 +237,13 @@ |
| 231 | 237 | this.getQuestionClassListHeadler(); |
| 232 | 238 | }, |
| 233 | 239 | methods: { |
| 234 | - changetimestartend(val, aa) { | |
| 240 | + changetimestartend(val, aa) { | |
| 235 | 241 | this.TestPaper.EffectiveStartTime = formatTime(val[0]) |
| 236 | - this.TestPaper.EffectiveEndTime = formatTime(val[1]) | |
| 242 | + this.TestPaper.EffectiveEndTime = formatTime(val[1]) | |
| 237 | 243 | }, |
| 238 | 244 | closeClassDialog() { |
| 239 | 245 | this.dialogAddTestPaperVIsible = false |
| 240 | - this.TestPaper= { | |
| 246 | + this.TestPaper = { | |
| 241 | 247 | TestPaperTitle: "", |
| 242 | 248 | PlateClass: "4", |
| 243 | 249 | TestPaperClassId: 0, |
| ... | ... | @@ -289,7 +295,7 @@ |
| 289 | 295 | getQuestionClassListHeadler() { |
| 290 | 296 | let _this = this; |
| 291 | 297 | GetToplevel().then(res => { |
| 292 | - var gettree = function(titem) { | |
| 298 | + var gettree = function (titem) { | |
| 293 | 299 | titem.children = [] |
| 294 | 300 | let childrenList = res.data.data.filter(u => u.ParentId == titem.value); |
| 295 | 301 | if (childrenList.length == 0) |
| ... | ... | @@ -330,15 +336,15 @@ |
| 330 | 336 | val.date = []; |
| 331 | 337 | val.date.push(val.EffectiveStartTime) |
| 332 | 338 | val.date.push(val.EffectiveEndTime) |
| 333 | - } | |
| 339 | + } | |
| 334 | 340 | this.TestPaper = val |
| 335 | 341 | } |
| 336 | 342 | else if (value == 'del') { |
| 337 | - DeleteTestPaper(val.id).then(rs=>{ | |
| 343 | + DeleteTestPaper(val.id).then(rs => { | |
| 338 | 344 | this.$message.success('删除成功!'); |
| 339 | 345 | this.getTestPaperListHeadler(); |
| 340 | 346 | }) |
| 341 | - | |
| 347 | + | |
| 342 | 348 | } |
| 343 | 349 | |
| 344 | 350 | } |
| ... | ... | @@ -365,4 +371,4 @@ |
| 365 | 371 | margin-top: 12px; |
| 366 | 372 | margin-right: 10px; |
| 367 | 373 | } |
| 368 | 374 | -</style> |
| 375 | +</style> | |
| 369 | 376 | \ No newline at end of file | ... | ... |