Commit 4ee13894903de6fee0646cf36b7a86af6cb40650
1 parent
e011bf15
给大志哥
Showing
4 changed files
with
136 additions
and
42 deletions
src/views/QuestionBank/components/EditDimension.vue
| @@ -122,6 +122,7 @@ | @@ -122,6 +122,7 @@ | ||
| 122 | activeName: '', | 122 | activeName: '', |
| 123 | dialogFormVisible: false, | 123 | dialogFormVisible: false, |
| 124 | form: {}, | 124 | form: {}, |
| 125 | + | ||
| 125 | ruleOptions: [ | 126 | ruleOptions: [ |
| 126 | { label: '大于', value: '>' }, | 127 | { label: '大于', value: '>' }, |
| 127 | { label: '小于', value: '<' }, | 128 | { label: '小于', value: '<' }, |
src/views/QuestionBank/index.vue
| @@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
| 6 | <div class="TreeHeader"> | 6 | <div class="TreeHeader"> |
| 7 | <label style="font-size: 18px">题目分类</label> | 7 | <label style="font-size: 18px">题目分类</label> |
| 8 | </div> | 8 | </div> |
| 9 | + | ||
| 9 | <div :style="{ height: TableColHeight + 'px' }" class="areadiv" | 10 | <div :style="{ height: TableColHeight + 'px' }" class="areadiv" |
| 10 | style="margin: 10px 0 0 0; padding: 5px 0 0 0"> | 11 | style="margin: 10px 0 0 0; padding: 5px 0 0 0"> |
| 11 | <el-tabs v-model="activeTab" @tab-click="handleTabsClick" style="padding: 0 20px" :stretch="true"> | 12 | <el-tabs v-model="activeTab" @tab-click="handleTabsClick" style="padding: 0 20px" :stretch="true"> |
| @@ -18,7 +19,8 @@ | @@ -18,7 +19,8 @@ | ||
| 18 | <span class="custom-tree-node" slot-scope="{ node, data }"> | 19 | <span class="custom-tree-node" slot-scope="{ node, data }"> |
| 19 | <span>{{ node.label }}</span> | 20 | <span>{{ node.label }}</span> |
| 20 | <span style=""> | 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 | </el-button> | 25 | </el-button> |
| 24 | <el-button type="text" v-if="activeTab == 'second'" @click="handleEditDimension(node, data)">编辑 | 26 | <el-button type="text" v-if="activeTab == 'second'" @click="handleEditDimension(node, data)">编辑 |
| @@ -45,7 +47,7 @@ | @@ -45,7 +47,7 @@ | ||
| 45 | box-shadow: 0 0 10px #efefef; | 47 | box-shadow: 0 0 10px #efefef; |
| 46 | margin-top: 10px; | 48 | margin-top: 10px; |
| 47 | " :header-cell-class-name="headerStyle" :stripe="true"> | 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 | <template slot-scope="scope"> | 51 | <template slot-scope="scope"> |
| 50 | <span>{{ scope.row.id }}</span> | 52 | <span>{{ scope.row.id }}</span> |
| 51 | </template> | 53 | </template> |
| @@ -144,12 +146,17 @@ | @@ -144,12 +146,17 @@ | ||
| 144 | <el-dialog title="编辑题目" :visible.sync="dialogsubjectlVisible" @close="closeDialog" width="800px" | 146 | <el-dialog title="编辑题目" :visible.sync="dialogsubjectlVisible" @close="closeDialog" width="800px" |
| 145 | :close-on-click-modal="false"> | 147 | :close-on-click-modal="false"> |
| 146 | <el-form ref="Dataform" :model="Dataform" label-width="60px"> | 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 | <el-form-item label="题目"> | 154 | <el-form-item label="题目"> |
| 148 | <el-input v-model="Dataform.subject" placeholder="请输入题目名称"></el-input> | 155 | <el-input v-model="Dataform.subject" placeholder="请输入题目名称"></el-input> |
| 149 | </el-form-item> | 156 | </el-form-item> |
| 150 | <el-form-item label="分类" style="padding-top: 5px"> | 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 | </el-cascader> | 160 | </el-cascader> |
| 154 | </el-form-item> | 161 | </el-form-item> |
| 155 | <el-form-item label="题型" style="padding-top: 5px"> | 162 | <el-form-item label="题型" style="padding-top: 5px"> |
| @@ -165,7 +172,7 @@ | @@ -165,7 +172,7 @@ | ||
| 165 | <el-table-column> | 172 | <el-table-column> |
| 166 | <template slot-scope="scope"> | 173 | <template slot-scope="scope"> |
| 167 | <el-input placeholder="请输入答案" v-model="scope.row.optionContent" class="optionInput" | 174 | <el-input placeholder="请输入答案" v-model="scope.row.optionContent" class="optionInput" |
| 168 | - style="width:68% !important"> | 175 | + style="width:47% !important"> |
| 169 | <template slot="prepend">{{ scope.row.option }}</template> | 176 | <template slot="prepend">{{ scope.row.option }}</template> |
| 170 | </el-input> | 177 | </el-input> |
| 171 | 178 | ||
| @@ -173,7 +180,10 @@ | @@ -173,7 +180,10 @@ | ||
| 173 | style="width:21% !important;margin-left:1%"> | 180 | style="width:21% !important;margin-left:1%"> |
| 174 | </el-input> | 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 | <i class="el-icon-circle-plus el-icon" @click="Addlist"></i> | 187 | <i class="el-icon-circle-plus el-icon" @click="Addlist"></i> |
| 178 | <i class="el-icon-remove el-icon" @click="RemoveList(scope)" v-if="scope.$index != 0"></i> | 188 | <i class="el-icon-remove el-icon" @click="RemoveList(scope)" v-if="scope.$index != 0"></i> |
| 179 | </template> | 189 | </template> |
| @@ -181,7 +191,7 @@ | @@ -181,7 +191,7 @@ | ||
| 181 | 191 | ||
| 182 | </el-table> | 192 | </el-table> |
| 183 | </el-form-item> | 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 | <el-radio-group v-for="(item, i) in subjectContent" v-model="Dataform.answer" v-if="GroupVisible"> | 195 | <el-radio-group v-for="(item, i) in subjectContent" v-model="Dataform.answer" v-if="GroupVisible"> |
| 186 | <el-radio :label="item.option">{{ item.option }}</el-radio> | 196 | <el-radio :label="item.option">{{ item.option }}</el-radio> |
| 187 | </el-radio-group> | 197 | </el-radio-group> |
| @@ -230,7 +240,7 @@ | @@ -230,7 +240,7 @@ | ||
| 230 | }, | 240 | }, |
| 231 | data() { | 241 | data() { |
| 232 | return { | 242 | return { |
| 233 | - FormClassType:0, | 243 | + FormClassType: 0, |
| 234 | loading: false, | 244 | loading: false, |
| 235 | currentEditDimension: {}, | 245 | currentEditDimension: {}, |
| 236 | activeTab: "first", | 246 | activeTab: "first", |
| @@ -259,12 +269,13 @@ | @@ -259,12 +269,13 @@ | ||
| 259 | fraction: 0, | 269 | fraction: 0, |
| 260 | singleFraction: 0, | 270 | singleFraction: 0, |
| 261 | addTime: "2021-11-12", | 271 | addTime: "2021-11-12", |
| 262 | - state: 1, | 272 | + state: 1, |
| 263 | }, | 273 | }, |
| 264 | subjectContent: [ | 274 | subjectContent: [ |
| 265 | { | 275 | { |
| 266 | option: "A", | 276 | option: "A", |
| 267 | optionContent: "", | 277 | optionContent: "", |
| 278 | + scorerule:'高' | ||
| 268 | }, | 279 | }, |
| 269 | ], | 280 | ], |
| 270 | QuestionClass: [], | 281 | QuestionClass: [], |
| @@ -279,6 +290,7 @@ | @@ -279,6 +290,7 @@ | ||
| 279 | firstTreeData: [], | 290 | firstTreeData: [], |
| 280 | secondTreeData: [], | 291 | secondTreeData: [], |
| 281 | CreatClassId: 0, | 292 | CreatClassId: 0, |
| 293 | + scoreRules:['高','中','低'], | ||
| 282 | }; | 294 | }; |
| 283 | }, | 295 | }, |
| 284 | created() { }, | 296 | created() { }, |
| @@ -295,13 +307,15 @@ | @@ -295,13 +307,15 @@ | ||
| 295 | this.getQuestionClassListHeadler(); | 307 | this.getQuestionClassListHeadler(); |
| 296 | }, | 308 | }, |
| 297 | methods: { | 309 | methods: { |
| 298 | - AddSubject(){ | 310 | + AddSubject() { |
| 299 | this.FormClassType = 0; | 311 | this.FormClassType = 0; |
| 312 | + // if(!this.Dataform.scoperule) | ||
| 313 | + // this.Dataform.scoperule='高'; | ||
| 300 | this.dialogsubjectlVisible = true | 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 | handleEditDimension(node, data) { | 321 | handleEditDimension(node, data) { |
| @@ -320,10 +334,10 @@ | @@ -320,10 +334,10 @@ | ||
| 320 | // console.log(node, data); | 334 | // console.log(node, data); |
| 321 | // console.log(this.API); | 335 | // console.log(this.API); |
| 322 | this.API.deleteQuestionClass(data.value).then((res) => { | 336 | this.API.deleteQuestionClass(data.value).then((res) => { |
| 323 | - | 337 | + |
| 324 | this.getQuestionClassListHeadler(); | 338 | this.getQuestionClassListHeadler(); |
| 325 | 339 | ||
| 326 | - this.loading = false; | 340 | + this.loading = false; |
| 327 | this.$message.success('操作成功!'); | 341 | this.$message.success('操作成功!'); |
| 328 | }); | 342 | }); |
| 329 | }, | 343 | }, |
| @@ -341,24 +355,24 @@ | @@ -341,24 +355,24 @@ | ||
| 341 | }, | 355 | }, |
| 342 | //添加分类 | 356 | //添加分类 |
| 343 | CreateQuestionClassHealder() { | 357 | CreateQuestionClassHealder() { |
| 344 | - if(this.loading)return; | ||
| 345 | - this.loading=true; | ||
| 346 | - | 358 | + if (this.loading) return; |
| 359 | + this.loading = true; | ||
| 360 | + | ||
| 347 | this.QuestionClassInfo.Addtime = parseTime(new Date(), ""); | 361 | this.QuestionClassInfo.Addtime = parseTime(new Date(), ""); |
| 348 | CreateQuestionClass(this.QuestionClassInfo).then((res) => { | 362 | CreateQuestionClass(this.QuestionClassInfo).then((res) => { |
| 349 | this.getQuestionClassListHeadler(); | 363 | this.getQuestionClassListHeadler(); |
| 350 | this.dialogClassIVIsible = false; | 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 | GetQuestionBankByIdHeadler(id) { | 371 | GetQuestionBankByIdHeadler(id) { |
| 358 | GetQuestionBankById(id).then((res) => { | 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 | this.changeQuestionType(res.data.data.subjectType); //这里先初始化编辑显示内容 | 376 | this.changeQuestionType(res.data.data.subjectType); //这里先初始化编辑显示内容 |
| 363 | this.Dataform = res.data.data; //内容赋值 | 377 | this.Dataform = res.data.data; //内容赋值 |
| 364 | this.subjectContent = JSON.parse(res.data.data.subjectContent); //赋值选项 | 378 | this.subjectContent = JSON.parse(res.data.data.subjectContent); //赋值选项 |
| @@ -387,7 +401,7 @@ | @@ -387,7 +401,7 @@ | ||
| 387 | this.GroupVisible = true; | 401 | this.GroupVisible = true; |
| 388 | }, | 402 | }, |
| 389 | //选择题目类型来判断是否显示部分表单 | 403 | //选择题目类型来判断是否显示部分表单 |
| 390 | - changeQuestionType(val) { | 404 | + changeQuestionType(val) { |
| 391 | if (val == 3) { | 405 | if (val == 3) { |
| 392 | this.OptionVisible = false; | 406 | this.OptionVisible = false; |
| 393 | } | 407 | } |
| @@ -395,7 +409,7 @@ | @@ -395,7 +409,7 @@ | ||
| 395 | this.OptionVisible = true; | 409 | this.OptionVisible = true; |
| 396 | this.Dataform.answer = []; | 410 | this.Dataform.answer = []; |
| 397 | this.GroupVisible = false; | 411 | this.GroupVisible = false; |
| 398 | - | 412 | + |
| 399 | } | 413 | } |
| 400 | if (val == 1) { | 414 | if (val == 1) { |
| 401 | this.Dataform.answer = []; | 415 | this.Dataform.answer = []; |
| @@ -426,7 +440,7 @@ | @@ -426,7 +440,7 @@ | ||
| 426 | }); | 440 | }); |
| 427 | }, | 441 | }, |
| 428 | handleNodeClick(val) { | 442 | handleNodeClick(val) { |
| 429 | - if(this.loading)return; | 443 | + if (this.loading) return; |
| 430 | this.parameter.QuestionClassId = val.value; | 444 | this.parameter.QuestionClassId = val.value; |
| 431 | this.parameter.pageIndex = 1; | 445 | this.parameter.pageIndex = 1; |
| 432 | this.GetList(); | 446 | this.GetList(); |
src/views/TestPaper/ManualTestPaper.vue
| @@ -10,10 +10,14 @@ | @@ -10,10 +10,14 @@ | ||
| 10 | <div style="padding:0 10px"> | 10 | <div style="padding:0 10px"> |
| 11 | <el-input size="small" placeholder="输入关键字搜索" v-model="parameter.keyWord"></el-input> | 11 | <el-input size="small" placeholder="输入关键字搜索" v-model="parameter.keyWord"></el-input> |
| 12 | </div> | 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 | <draggable :options="{animation:380,filter:'.unmover'}" group="itxst" v-model="arr1" @end="end1" | 17 | <draggable :options="{animation:380,filter:'.unmover'}" group="itxst" v-model="arr1" @end="end1" |
| 15 | @add="RemoveHere" :move="onMove" class="infinite-list" :style="{'height':contentHeight-80+'px'}" | 18 | @add="RemoveHere" :move="onMove" class="infinite-list" :style="{'height':contentHeight-80+'px'}" |
| 16 | infinite-scroll-disabled="disabled" v-infinite-scroll="load" style="overflow:auto"> | 19 | infinite-scroll-disabled="disabled" v-infinite-scroll="load" style="overflow:auto"> |
| 20 | + | ||
| 17 | <li v-for="i in arr1" class="infinite-list-item" :key="i.id" v-if="!classarr.some(o=>o == i.id)">{{ | 21 | <li v-for="i in arr1" class="infinite-list-item" :key="i.id" v-if="!classarr.some(o=>o == i.id)">{{ |
| 18 | i.subject }}</li> | 22 | i.subject }}</li> |
| 19 | <p v-if="loading" style="text-align: center;color: #cdcdcd;" class="unmover">加载中...</p> | 23 | <p v-if="loading" style="text-align: center;color: #cdcdcd;" class="unmover">加载中...</p> |
| @@ -113,6 +117,40 @@ | @@ -113,6 +117,40 @@ | ||
| 113 | </div> | 117 | </div> |
| 114 | </el-col> | 118 | </el-col> |
| 115 | </el-row> | 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 | </div> | 154 | </div> |
| 117 | </template> | 155 | </template> |
| 118 | 156 | ||
| @@ -122,13 +160,20 @@ | @@ -122,13 +160,20 @@ | ||
| 122 | import { GetQuestionClassByType } from "@/api/QuestionClass"; | 160 | import { GetQuestionClassByType } from "@/api/QuestionClass"; |
| 123 | import { EditTestPaper, GetToplevel } from "@/api/TestPaper"; | 161 | import { EditTestPaper, GetToplevel } from "@/api/TestPaper"; |
| 124 | import { formatTime } from '@/utils/util' | 162 | import { formatTime } from '@/utils/util' |
| 125 | - export default { | 163 | + export default { |
| 126 | //注册draggable组件 | 164 | //注册draggable组件 |
| 127 | components: { | 165 | components: { |
| 128 | draggable, | 166 | draggable, |
| 129 | }, | 167 | }, |
| 130 | data() { | 168 | data() { |
| 131 | return { | 169 | return { |
| 170 | + dynamicValidateForm: { | ||
| 171 | + domains: [{ | ||
| 172 | + value: '' | ||
| 173 | + }], | ||
| 174 | + email: '' | ||
| 175 | + }, | ||
| 176 | + dialogTableVisible:false, | ||
| 132 | loadingType:false, | 177 | loadingType:false, |
| 133 | activeTab: "6", | 178 | activeTab: "6", |
| 134 | parameter: { | 179 | parameter: { |
| @@ -221,6 +266,34 @@ | @@ -221,6 +266,34 @@ | ||
| 221 | //this.GetList(); | 266 | //this.GetList(); |
| 222 | }, | 267 | }, |
| 223 | methods: { | 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 | changetimestartend(val, aa) { | 297 | changetimestartend(val, aa) { |
| 225 | this.TestPaper.EffectiveStartTime = formatTime(val[0]) | 298 | this.TestPaper.EffectiveStartTime = formatTime(val[0]) |
| 226 | this.TestPaper.EffectiveEndTime = formatTime(val[1]) | 299 | this.TestPaper.EffectiveEndTime = formatTime(val[1]) |
src/views/TestPaper/TestPaperList.vue
| @@ -155,9 +155,9 @@ | @@ -155,9 +155,9 @@ | ||
| 155 | getTestPaperClassList, | 155 | getTestPaperClassList, |
| 156 | DeleteTestPaper | 156 | DeleteTestPaper |
| 157 | } from '@/api/TestPaper' | 157 | } from '@/api/TestPaper' |
| 158 | - import {formatTime} from '@/utils/util' | 158 | + import { formatTime } from '@/utils/util' |
| 159 | let that | 159 | let that |
| 160 | - export default { | 160 | + export default { |
| 161 | data() { | 161 | data() { |
| 162 | return { | 162 | return { |
| 163 | parameter: { | 163 | parameter: { |
| @@ -212,10 +212,16 @@ | @@ -212,10 +212,16 @@ | ||
| 212 | }, | 212 | }, |
| 213 | filters: { | 213 | filters: { |
| 214 | typeFilters(val) { | 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 | return '未知' | 225 | return '未知' |
| 220 | } | 226 | } |
| 221 | } | 227 | } |
| @@ -231,13 +237,13 @@ | @@ -231,13 +237,13 @@ | ||
| 231 | this.getQuestionClassListHeadler(); | 237 | this.getQuestionClassListHeadler(); |
| 232 | }, | 238 | }, |
| 233 | methods: { | 239 | methods: { |
| 234 | - changetimestartend(val, aa) { | 240 | + changetimestartend(val, aa) { |
| 235 | this.TestPaper.EffectiveStartTime = formatTime(val[0]) | 241 | this.TestPaper.EffectiveStartTime = formatTime(val[0]) |
| 236 | - this.TestPaper.EffectiveEndTime = formatTime(val[1]) | 242 | + this.TestPaper.EffectiveEndTime = formatTime(val[1]) |
| 237 | }, | 243 | }, |
| 238 | closeClassDialog() { | 244 | closeClassDialog() { |
| 239 | this.dialogAddTestPaperVIsible = false | 245 | this.dialogAddTestPaperVIsible = false |
| 240 | - this.TestPaper= { | 246 | + this.TestPaper = { |
| 241 | TestPaperTitle: "", | 247 | TestPaperTitle: "", |
| 242 | PlateClass: "4", | 248 | PlateClass: "4", |
| 243 | TestPaperClassId: 0, | 249 | TestPaperClassId: 0, |
| @@ -289,7 +295,7 @@ | @@ -289,7 +295,7 @@ | ||
| 289 | getQuestionClassListHeadler() { | 295 | getQuestionClassListHeadler() { |
| 290 | let _this = this; | 296 | let _this = this; |
| 291 | GetToplevel().then(res => { | 297 | GetToplevel().then(res => { |
| 292 | - var gettree = function(titem) { | 298 | + var gettree = function (titem) { |
| 293 | titem.children = [] | 299 | titem.children = [] |
| 294 | let childrenList = res.data.data.filter(u => u.ParentId == titem.value); | 300 | let childrenList = res.data.data.filter(u => u.ParentId == titem.value); |
| 295 | if (childrenList.length == 0) | 301 | if (childrenList.length == 0) |
| @@ -330,15 +336,15 @@ | @@ -330,15 +336,15 @@ | ||
| 330 | val.date = []; | 336 | val.date = []; |
| 331 | val.date.push(val.EffectiveStartTime) | 337 | val.date.push(val.EffectiveStartTime) |
| 332 | val.date.push(val.EffectiveEndTime) | 338 | val.date.push(val.EffectiveEndTime) |
| 333 | - } | 339 | + } |
| 334 | this.TestPaper = val | 340 | this.TestPaper = val |
| 335 | } | 341 | } |
| 336 | else if (value == 'del') { | 342 | else if (value == 'del') { |
| 337 | - DeleteTestPaper(val.id).then(rs=>{ | 343 | + DeleteTestPaper(val.id).then(rs => { |
| 338 | this.$message.success('删除成功!'); | 344 | this.$message.success('删除成功!'); |
| 339 | this.getTestPaperListHeadler(); | 345 | this.getTestPaperListHeadler(); |
| 340 | }) | 346 | }) |
| 341 | - | 347 | + |
| 342 | } | 348 | } |
| 343 | 349 | ||
| 344 | } | 350 | } |
| @@ -365,4 +371,4 @@ | @@ -365,4 +371,4 @@ | ||
| 365 | margin-top: 12px; | 371 | margin-top: 12px; |
| 366 | margin-right: 10px; | 372 | margin-right: 10px; |
| 367 | } | 373 | } |
| 368 | -</style> | 374 | -</style> |
| 375 | +</style> | ||
| 369 | \ No newline at end of file | 376 | \ No newline at end of file |