index.vue 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912
  1. <template>
  2. <div id="topicAddPaper">
  3. <el-tabs v-model="activeName" type="card">
  4. <el-tab-pane label="试卷基本信息" name="first" disabled></el-tab-pane>
  5. <el-tab-pane label="试卷题目内容" name="second"></el-tab-pane>
  6. </el-tabs>
  7. <div>
  8. <table-list
  9. :tableSets="tableSet"
  10. :tableData="tableData"
  11. :navText="navText"
  12. @addClick="openActiveBox"
  13. :loading="loading"
  14. @editInfo="editInfo"
  15. @emitData="emitData"
  16. >
  17. <template slot="btn" slot-scope="props">
  18. <el-button
  19. type="text"
  20. @click="addClick(props.scope.row, 0, props.scope.$index)"
  21. >编辑</el-button
  22. >
  23. <el-button
  24. type="text"
  25. @click="del(props.scope.row, props.scope.$index)"
  26. >删除</el-button
  27. >
  28. </template>
  29. </table-list>
  30. <div class="centerStys">
  31. <el-button size="small" @click="backPage">取消</el-button>
  32. <el-button
  33. size="small"
  34. type="primary"
  35. @click="submitTableAllInfos"
  36. :loading="disabledBtn"
  37. >确定</el-button
  38. >
  39. </div>
  40. <el-dialog
  41. width="1080px"
  42. :visible.sync="innerVisiblePaperTopic"
  43. append-to-body
  44. :show-close="false"
  45. :fullscreen="fullscreenChildPaperTopic"
  46. :close-on-click-modal="false"
  47. >
  48. <div slot="title" class="hearders">
  49. <div class="leftTitle">
  50. {{ statusPop === 1 ? "添加" : statusPop === 0 ? "修改" : "详情" }}
  51. </div>
  52. <div class="rightBoxs">
  53. <img
  54. src="@/assets/images/Max@2x.png"
  55. alt=""
  56. @click="fullscreenChildPaperTopic = !fullscreenChildPaperTopic"
  57. />
  58. <img
  59. src="@/assets/images/Close@2x.png"
  60. alt=""
  61. @click="closeBefore"
  62. />
  63. </div>
  64. </div>
  65. <!-- <busIns
  66. @amdis="changeAmdis"
  67. ref="sujects"
  68. :typeBus="typeBus"
  69. :sujectApisTable="sujectApisTable"
  70. :newSujectApisTable="newSujectApisTable"
  71. /> -->
  72. <div v-if="showHide">
  73. <el-form
  74. label-position="right"
  75. label-width="110px"
  76. :model="listData"
  77. ref="listData"
  78. :rules="rulesTest"
  79. >
  80. <el-form-item
  81. v-for="(items, indexs) in listitem"
  82. :key="indexs"
  83. :label="items.label"
  84. :prop="items.prop"
  85. >
  86. <div v-if="items.scope === 'bussing'">
  87. <div v-if="!activeExam.length">请在下面输入框添加知识点</div>
  88. <ul v-else class="BusBoxs">
  89. <li
  90. class="fot_Le"
  91. v-for="(item, index) in activeExam"
  92. :key="index"
  93. >
  94. {{ item.knowledgeName }}
  95. <i
  96. class="el-icon-error icon_clear"
  97. @click="clearBusName(index)"
  98. ></i>
  99. </li>
  100. <div style="clear: both"></div>
  101. </ul>
  102. <el-select
  103. v-model="value"
  104. placeholder="请选择知识点"
  105. @change="changeKnow"
  106. >
  107. <el-option
  108. v-for="item in options"
  109. :key="item.knowledgeId"
  110. :label="item.knowledgeName"
  111. :value="item.knowledgeId"
  112. :disabled="comLs(item)"
  113. >
  114. </el-option>
  115. </el-select>
  116. <!-- <el-button @click="addExam">自定义添加</el-button> -->
  117. </div>
  118. <el-radio-group
  119. v-else-if="items.scope === 'radio'"
  120. v-model="listData[items.prop]"
  121. >
  122. <el-radio :label="1">发布</el-radio>
  123. <el-radio :label="0">未发布</el-radio>
  124. </el-radio-group>
  125. <el-input
  126. v-model="listData[items.prop]"
  127. v-else
  128. ></el-input> </el-form-item
  129. ></el-form>
  130. <questionBank :dingFormInfo="listNums" :nums="1" ref="child" />
  131. </div>
  132. <span slot="footer" class="dialog-footer">
  133. <el-button @click="closeBefore">关 闭</el-button>
  134. <el-button
  135. @click="submitForm('listData')"
  136. v-if="statusPop === 1 || statusPop === 0"
  137. >完成</el-button
  138. >
  139. </span>
  140. </el-dialog>
  141. <el-dialog
  142. :visible.sync="dialogVisible"
  143. :append-to-body="true"
  144. width="780px"
  145. :show-close="false"
  146. :close-on-click-modal="false"
  147. >
  148. <div slot="title" class="hearders">
  149. <div class="leftTitle">添加</div>
  150. <div class="rightBoxs">
  151. <img src="@/assets/images/Close@2x.png" alt="" @click="closeBoxs" />
  152. </div>
  153. </div>
  154. <div>
  155. <el-form label-position="right" label-width="110px">
  156. <el-form-item label="知识点">
  157. <div>
  158. <div v-if="!BusNameList.length">请在下面输入框添加知识点</div>
  159. <ul v-else class="BusBoxs">
  160. <li
  161. class="fot_Le"
  162. v-for="(item, index) in BusNameList"
  163. :key="index"
  164. >
  165. {{ item }}
  166. <i
  167. class="el-icon-error icon_clear"
  168. @click="clearBus(index)"
  169. ></i>
  170. </li>
  171. <div style="clear: both"></div>
  172. </ul>
  173. <el-input
  174. style="width: 40%; margin-right: 10px"
  175. v-model="BusName"
  176. ></el-input
  177. ><el-button @click="addBusName">添加</el-button>
  178. </div></el-form-item
  179. ></el-form
  180. >
  181. </div>
  182. <span slot="footer" class="dialog-footer">
  183. <el-button @click="closeBoxs">取 消</el-button>
  184. <el-button type="primary" @click="submit">确 定</el-button>
  185. </span>
  186. </el-dialog>
  187. <el-dialog
  188. :visible.sync="dialogVisibleActive"
  189. width="420px"
  190. :show-close="false"
  191. :close-on-click-modal="false"
  192. >
  193. <div slot="title" class="hearders">
  194. <div class="leftTitle">操作类型</div>
  195. <div class="rightBoxs">
  196. <img
  197. src="@/assets/images/Close@2x.png"
  198. alt=""
  199. @click="closeBoxsActive"
  200. />
  201. </div>
  202. </div>
  203. <div>
  204. <el-radio-group v-model="radioActive">
  205. <el-radio :label="1">自定义</el-radio>
  206. <el-radio :label="2">已有数据池</el-radio>
  207. </el-radio-group>
  208. </div>
  209. <span slot="footer" class="dialog-footer">
  210. <el-button @click="closeBoxsActive">取 消</el-button>
  211. <el-button type="primary" @click="submitActive">确 定</el-button>
  212. </span>
  213. </el-dialog>
  214. <el-dialog
  215. :visible.sync="dialogVisibleTable"
  216. width="960px"
  217. :show-close="false"
  218. :close-on-click-modal="false"
  219. >
  220. <div slot="title" class="hearders">
  221. <div class="leftTitle">题库数据池</div>
  222. <div class="rightBoxs">
  223. <img
  224. src="@/assets/images/Close@2x.png"
  225. alt=""
  226. @click="closeBoxsTable"
  227. />
  228. </div>
  229. </div>
  230. <div>
  231. <search-box-new
  232. ref="searchBox"
  233. :formData="formData"
  234. :formList="formList"
  235. @search="getDIO(1)"
  236. @init="inits"
  237. />
  238. <el-table
  239. ref="multipleTable"
  240. :data="boxtableData"
  241. border
  242. @select-all="selectAll"
  243. @select="select"
  244. :row-key="getRowKeys"
  245. :header-cell-style="{
  246. 'background-color': '#eee',
  247. padding: '8px',
  248. color: '#333',
  249. }"
  250. >
  251. <el-table-column
  252. align="center"
  253. type="selection"
  254. width="55"
  255. header-align="center"
  256. :selectable="checkboxT"
  257. :reserve-selection="true"
  258. >
  259. </el-table-column>
  260. <template v-for="(item, index) in tableSetTables">
  261. <el-table-column
  262. v-if="item.scope !== 'inputs'"
  263. :width="item.width"
  264. :key="index"
  265. :label="item.label"
  266. align="center"
  267. :show-overflow-tooltip="true"
  268. header-align="center"
  269. >
  270. <template slot-scope="scope">
  271. <span v-if="item.scope === 'Status'">
  272. {{
  273. scope.row[item.prop] === 1
  274. ? "发布"
  275. : scope.row[item.prop] === 0
  276. ? "未发布"
  277. : "未知"
  278. }}
  279. </span>
  280. <span v-else-if="item.scope === 'topic'">{{
  281. scope.row[item.prop] === 1
  282. ? "单选题"
  283. : scope.row[item.prop] === 2
  284. ? "多选题"
  285. : scope.row[item.prop] === 3
  286. ? "判断题"
  287. : scope.row[item.prop] === 4
  288. ? "案例题"
  289. : scope.row[item.prop] === 5
  290. ? "简答题"
  291. : "未知"
  292. }}</span>
  293. <div
  294. class="editInfoSty"
  295. v-else-if="item.scope === 'editInfoHTMLs'"
  296. >
  297. {{ getSimpleText(scope.row[item.prop]) }}
  298. </div>
  299. <div v-else-if="item.scope === 'knowledge'">
  300. <el-button
  301. type="success"
  302. size="small"
  303. v-for="(items, ks) in scope.row[item.prop]"
  304. :key="ks"
  305. >
  306. {{ items.knowledgeName }}
  307. </el-button>
  308. </div>
  309. <span v-else>{{ scope.row[item.prop] }}</span></template
  310. >
  311. </el-table-column></template
  312. >
  313. </el-table>
  314. <pagination
  315. :total="totals"
  316. :pageSize="formData.pageSize"
  317. :currentPage="formData.pageNum"
  318. @handleSizeChange="handleSizeChange"
  319. @handleCurrentChange="handleCurrentChange"
  320. />
  321. </div>
  322. <span slot="footer" class="dialog-footer">
  323. <el-button @click="closeBoxsTable">取 消</el-button>
  324. <el-button type="primary" @click="submitTable">确 定</el-button>
  325. </span>
  326. </el-dialog>
  327. <el-dialog
  328. :visible.sync="diansBoxStatus"
  329. width="960px"
  330. :show-close="false"
  331. :close-on-click-modal="false"
  332. >
  333. <div slot="title" class="hearders">
  334. <div class="leftTitle">分值设置</div>
  335. <div class="rightBoxs">
  336. <img
  337. src="@/assets/images/Close@2x.png"
  338. alt=""
  339. @click="closePagsInfos"
  340. />
  341. </div>
  342. </div>
  343. <div>
  344. <div class="dis_fos">
  345. <div>
  346. <div class="margin_bs">当前总分:{{ getAllpocis }}</div>
  347. <div class="margin_bs" v-if="examsType === 2">
  348. 及格分数:<el-input-number
  349. style="margin: 0px 6px; width: 100px !important"
  350. v-model="passScore"
  351. controls-position="right"
  352. :min="0"
  353. size="mini"
  354. ></el-input-number>
  355. </div>
  356. <div class="margin_bs" v-if="examsType === 2">
  357. 答卷时长:
  358. <el-radio-group v-model="djTimeType">
  359. <el-radio :label="0">无限时长</el-radio>
  360. <el-radio :label="1">有限时长</el-radio>
  361. </el-radio-group>
  362. <el-input-number
  363. v-if="djTimeType === 1"
  364. style="margin: 0px 6px; width: 100px !important"
  365. v-model="djTime"
  366. controls-position="right"
  367. :min="1"
  368. size="mini"
  369. ></el-input-number
  370. ><span v-if="djTimeType === 1">分钟</span>
  371. </div>
  372. <div class="margin_bs">
  373. 答卷次数:
  374. <el-radio-group v-model="djNumType">
  375. <el-radio :label="0">无限次</el-radio>
  376. <el-radio :label="1">有限次</el-radio>
  377. </el-radio-group>
  378. <el-input-number
  379. v-if="djNumType === 1"
  380. style="margin: 0px 6px; width: 100px !important"
  381. v-model="djNum"
  382. controls-position="right"
  383. :min="1"
  384. size="mini"
  385. ></el-input-number>
  386. </div>
  387. <div class="margin_bs">
  388. 做题类型:
  389. <el-radio-group v-model="examsType">
  390. <el-radio :label="1">练习</el-radio>
  391. <el-radio :label="2">考试</el-radio>
  392. </el-radio-group>
  393. </div>
  394. </div>
  395. <div class="margin_bs">
  396. <el-button size="mini" @click="activeOpens"
  397. >按选中设置分数</el-button
  398. ><el-button size="mini" @click="activePicis"
  399. >按题型设置分数</el-button
  400. >
  401. </div>
  402. </div>
  403. <el-table
  404. ref="multipleTables"
  405. :data="boxtableDataPags"
  406. border
  407. @select-all="selectAllPags"
  408. @select="selectPags"
  409. :row-key="getRowKeysPags"
  410. :header-cell-style="{
  411. 'background-color': '#eee',
  412. padding: '8px',
  413. color: '#333',
  414. }"
  415. >
  416. <el-table-column
  417. align="center"
  418. type="selection"
  419. width="55"
  420. header-align="center"
  421. :reserve-selection="true"
  422. >
  423. </el-table-column>
  424. <el-table-column
  425. label="序号"
  426. align="center"
  427. type="index"
  428. width="80"
  429. >
  430. </el-table-column>
  431. <template v-for="(item, index) in tableSetTablesPags">
  432. <el-table-column
  433. v-if="item.scope !== 'inputs'"
  434. :width="item.width"
  435. :key="index"
  436. :label="item.label"
  437. :align="item.scope === 'inputS' ? 'left' : 'center'"
  438. :show-overflow-tooltip="true"
  439. header-align="center"
  440. >
  441. <template slot-scope="scope">
  442. <span v-if="item.scope === 'Status'">
  443. {{
  444. scope.row[item.prop] === 1
  445. ? "发布"
  446. : scope.row[item.prop] === 0
  447. ? "未发布"
  448. : "未知"
  449. }}
  450. </span>
  451. <span v-else-if="item.scope === 'topic'">{{
  452. scope.row[item.prop] === 1
  453. ? "单选题"
  454. : scope.row[item.prop] === 2
  455. ? "多选题"
  456. : scope.row[item.prop] === 3
  457. ? "判断题"
  458. : scope.row[item.prop] === 4
  459. ? "案例题"
  460. : scope.row[item.prop] === 5
  461. ? "简答题"
  462. : "未知"
  463. }}</span>
  464. <div
  465. class="editInfoSty"
  466. v-else-if="item.scope === 'editInfoHTMLs'"
  467. >
  468. {{ getSimpleText(scope.row[item.prop]) }}
  469. </div>
  470. <div v-else-if="item.scope === 'inputS'">
  471. <el-input-number
  472. style="width: 100px !important"
  473. v-model="scope.row[item.prop]"
  474. controls-position="right"
  475. :min="0"
  476. ></el-input-number>
  477. <el-tooltip
  478. class="item"
  479. effect="dark"
  480. content="右侧输入框为多选题漏选给分"
  481. placement="top-start"
  482. >
  483. <i
  484. v-if="scope.row['type'] === 2"
  485. class="el-icon-question"
  486. ></i>
  487. </el-tooltip>
  488. <el-input-number
  489. v-if="scope.row['type'] === 2"
  490. style="width: 100px !important"
  491. v-model="scope.row['partScore']"
  492. controls-position="right"
  493. :min="0"
  494. ></el-input-number>
  495. </div>
  496. <div v-else-if="item.scope === 'knowledge'">
  497. <el-button
  498. type="success"
  499. size="small"
  500. v-for="(items, ks) in scope.row[item.prop]"
  501. :key="ks"
  502. >
  503. {{ items.knowledgeName }}
  504. </el-button>
  505. </div>
  506. <span v-else>{{ scope.row[item.prop] }}</span></template
  507. >
  508. </el-table-column></template
  509. >
  510. </el-table>
  511. </div>
  512. <span slot="footer" class="dialog-footer">
  513. <el-button @click="closePagsInfos">取 消</el-button>
  514. <el-button type="primary" @click="submitPagsInfos">确 定</el-button>
  515. </span>
  516. </el-dialog>
  517. <el-dialog
  518. :visible.sync="dialogVisibleActivePocis"
  519. width="420px"
  520. append-to-body
  521. :show-close="false"
  522. :close-on-click-modal="false"
  523. >
  524. <div slot="title" class="hearders">
  525. <div class="leftTitle">分值设置</div>
  526. <div class="rightBoxs">
  527. <img
  528. src="@/assets/images/Close@2x.png"
  529. alt=""
  530. @click="closeBoxsActivePocis"
  531. />
  532. </div>
  533. </div>
  534. <div>
  535. 一共选择了{{ activeListsPags.length }}道题目,一键设置
  536. <el-input-number
  537. style="width: 100px !important"
  538. v-model="Pocis"
  539. controls-position="right"
  540. :min="0"
  541. ></el-input-number>
  542. </div>
  543. <span slot="footer" class="dialog-footer">
  544. <el-button @click="closeBoxsActivePocis">取 消</el-button>
  545. <el-button type="primary" @click="submitActivePocis">确 定</el-button>
  546. </span>
  547. </el-dialog>
  548. <el-dialog
  549. :visible.sync="dialogVisibleActivePLPoics"
  550. width="580px"
  551. append-to-body
  552. :show-close="false"
  553. :close-on-click-modal="false"
  554. >
  555. <div slot="title" class="hearders">
  556. <div class="leftTitle">分值设置</div>
  557. <div class="rightBoxs">
  558. <img
  559. src="@/assets/images/Close@2x.png"
  560. alt=""
  561. @click="closeBoxsActivePLPoics"
  562. />
  563. </div>
  564. </div>
  565. <div>
  566. <div class="margin_bs" v-if="pocisArray.danx">
  567. 单选题:共{{ pocisArray.danx }}道,共
  568. {{ pocisArray.danx * Pocis1 }} 分数,每题分数<el-input-number
  569. style="margin: 0px 6px; width: 100px !important"
  570. v-model="Pocis1"
  571. controls-position="right"
  572. :min="0"
  573. size="mini"
  574. ></el-input-number
  575. >分
  576. </div>
  577. <div class="margin_bs" v-if="pocisArray.duox">
  578. 多选题:共{{ pocisArray.duox }}道,共
  579. {{ pocisArray.duox * Pocis2 }} 分数,每题分数<el-input-number
  580. style="margin: 0px 6px; width: 100px !important"
  581. v-model="Pocis2"
  582. controls-position="right"
  583. :min="0"
  584. size="mini"
  585. ></el-input-number
  586. >分
  587. <el-tooltip
  588. class="item"
  589. effect="dark"
  590. content="右侧输入框为多选题漏选给分"
  591. placement="top-start"
  592. >
  593. <i class="el-icon-question"></i>
  594. </el-tooltip>
  595. <el-input-number
  596. style="margin: 0px 6px; width: 100px !important"
  597. v-model="Pocis2s"
  598. controls-position="right"
  599. :min="0"
  600. size="mini"
  601. ></el-input-number>
  602. </div>
  603. <div class="margin_bs" v-if="pocisArray.pand">
  604. 判断题:共{{ pocisArray.pand }}道,共
  605. {{ pocisArray.pand * Pocis3 }} 分数,每题分数<el-input-number
  606. style="margin: 0px 6px; width: 100px !important"
  607. v-model="Pocis3"
  608. controls-position="right"
  609. :min="0"
  610. size="mini"
  611. ></el-input-number
  612. >分
  613. </div>
  614. <div class="margin_bs" v-if="pocisArray.anli">
  615. 案例题:共{{ pocisArray.anli }}道,共
  616. {{ pocisArray.anli * Pocis4 }} 分数,每题分数<el-input-number
  617. style="margin: 0px 6px; width: 100px !important"
  618. v-model="Pocis4"
  619. controls-position="right"
  620. :min="0"
  621. size="mini"
  622. ></el-input-number
  623. >分
  624. </div>
  625. <div class="margin_bs" v-if="pocisArray.jiand">
  626. 简答题:共{{ pocisArray.jiand }}道,共
  627. {{ pocisArray.jiand * Pocis5 }} 分数,每题分数<el-input-number
  628. style="margin: 0px 6px; width: 100px !important"
  629. v-model="Pocis5"
  630. controls-position="right"
  631. :min="0"
  632. size="mini"
  633. ></el-input-number
  634. >分
  635. </div>
  636. </div>
  637. <span slot="footer" class="dialog-footer">
  638. <el-button @click="closeBoxsActivePLPoics" size="small"
  639. >取 消</el-button
  640. >
  641. <el-button type="primary" size="small" @click="submitActivePLPoics"
  642. >确 定</el-button
  643. >
  644. </span>
  645. </el-dialog>
  646. </div>
  647. </div>
  648. </template>
  649. <script>
  650. import searchBoxNew from "@/components/searchBoxNew";
  651. import pagination from "@/components/pagination";
  652. import tableList from "@/components/tableList";
  653. import busIns from "@/components/busIns";
  654. import questionBank from "@/components/questionBank";
  655. export default {
  656. name: "TopicAddPaper",
  657. components: { searchBoxNew, pagination, tableList, busIns, questionBank },
  658. data() {
  659. return {
  660. disabledBtn: false,
  661. showHide: false,
  662. activeName: "second",
  663. formList: [
  664. // {
  665. // prop: "educationTypeId",
  666. // placeholder: "教育类型",
  667. // scope: "educationType",
  668. // },
  669. // {
  670. // prop: "businessId",
  671. // placeholder: "业务层次",
  672. // scope: "businessLevel",
  673. // edu: "educationTypeId",
  674. // },
  675. // {
  676. // prop: "subjectId",
  677. // placeholder: "科目",
  678. // scope: "sujectType",
  679. // edu: "educationTypeId",
  680. // },
  681. {
  682. prop: "type",
  683. placeholder: "题目类型",
  684. scope: "selectBank",
  685. },
  686. {
  687. prop: "key",
  688. placeholder: "请输入题目标题/题目编码/知识点/标题前缀",
  689. },
  690. ],
  691. formData: {
  692. publishStatus: 1,
  693. status: 1,
  694. pageSize: 10,
  695. pageNum: 1,
  696. },
  697. totals: 0,
  698. tableSet: [
  699. {
  700. label: "排序",
  701. prop: "sort",
  702. scope: "inputs",
  703. width: "100px",
  704. hidden: true,
  705. },
  706. {
  707. label: "题目编码",
  708. prop: "code",
  709. hidden: true,
  710. },
  711. {
  712. label: "题型",
  713. prop: "type",
  714. hidden: true,
  715. scope: "topic",
  716. },
  717. {
  718. label: "标题前缀",
  719. prop: "prefixName",
  720. hidden: true,
  721. },
  722. {
  723. label: "知识点",
  724. prop: "knowledgeList",
  725. hidden: true,
  726. scope: "knowledge",
  727. width: "200px",
  728. showTooltip: true,
  729. },
  730. {
  731. label: "题目内容",
  732. prop: "content",
  733. hidden: true,
  734. scope: "editInfoHTMLs",
  735. },
  736. {
  737. label: "发布状态",
  738. prop: "publishStatus",
  739. hidden: true,
  740. scope: "fabStatus",
  741. },
  742. ],
  743. tableData: [],
  744. loading: false, //当前表单加载是否加载动画
  745. navText: {
  746. title: "题目管理",
  747. index: 0,
  748. ch: "条",
  749. num: false,
  750. border: true,
  751. choice: false,
  752. addHide: false,
  753. backFatherBtn: {
  754. status: true,
  755. title: "分值设置",
  756. },
  757. },
  758. rulesTest: {
  759. // prefixName: [
  760. // { required: true, message: "请输入标签前缀", trigger: "blur" },
  761. // ],
  762. },
  763. dialogVisible: false,
  764. innerVisiblePaperTopic: false,
  765. fullscreenChildPaperTopic: false,
  766. statusPop: 1,
  767. dingForm: {},
  768. questionId: "",
  769. queryData: {},
  770. allOptions: [], //知识点列表
  771. options: [], //当前知识点列表
  772. activeExam: [], // 已选知识点列表
  773. value: "",
  774. BusName: "", //弹窗新增知识点输入框
  775. BusNameList: [],
  776. listNums: {},
  777. typeBus: 1,
  778. indexZB: "",
  779. listData: {
  780. publishStatus: "",
  781. prefixName: "",
  782. },
  783. int: "",
  784. listitem: [
  785. {
  786. label: "标题前缀",
  787. prop: "prefixName",
  788. },
  789. {
  790. label: "知识点",
  791. scope: "bussing",
  792. },
  793. {
  794. label: "发布状态",
  795. prop: "publishStatus",
  796. scope: "radio",
  797. },
  798. ],
  799. radioActive: "",
  800. dialogVisibleActive: false,
  801. dialogVisibleTable: false,
  802. boxtableData: [],
  803. tableSetTables: [
  804. {
  805. label: "题目类型",
  806. prop: "type",
  807. hidden: true,
  808. scope: "topic",
  809. },
  810. {
  811. label: "题目编码",
  812. prop: "code",
  813. hidden: true,
  814. },
  815. {
  816. label: "标题前缀",
  817. prop: "prefixName",
  818. hidden: true,
  819. },
  820. {
  821. label: "知识点",
  822. prop: "knowledgeList",
  823. hidden: true,
  824. scope: "knowledge",
  825. width: "180px",
  826. },
  827. {
  828. label: "题目标题",
  829. prop: "content",
  830. hidden: true,
  831. scope: "editInfoHTMLs",
  832. },
  833. {
  834. label: "发布状态",
  835. prop: "publishStatus",
  836. hidden: true,
  837. scope: "Status",
  838. },
  839. ],
  840. activeLists: [],
  841. disCheckList: [],
  842. sujectApisTable: [],
  843. newSujectApisTable: [],
  844. // -------------------------------------
  845. diansBoxStatus: false,
  846. boxtableDataPags: [],
  847. tableSetTablesPags: [
  848. {
  849. label: "排序",
  850. prop: "sort",
  851. hidden: true,
  852. },
  853. {
  854. label: "题型",
  855. prop: "type",
  856. hidden: true,
  857. scope: "topic",
  858. },
  859. {
  860. label: "标题前缀",
  861. prop: "prefixName",
  862. hidden: true,
  863. },
  864. {
  865. label: "题目标题",
  866. prop: "content",
  867. hidden: true,
  868. scope: "editInfoHTMLs",
  869. },
  870. {
  871. label: "发布状态",
  872. prop: "publishStatus",
  873. hidden: true,
  874. scope: "Status",
  875. },
  876. {
  877. label: "分值",
  878. prop: "score",
  879. hidden: true,
  880. scope: "inputS",
  881. width: "250px",
  882. },
  883. ],
  884. activeListsPags: [],
  885. dialogVisibleActivePocis: false,
  886. Pocis: "",
  887. dialogVisibleActivePLPoics: false,
  888. Pocis1: "",
  889. Pocis2: "",
  890. Pocis2s: "",
  891. Pocis3: "",
  892. Pocis4: "",
  893. Pocis5: "",
  894. pocisArray: {
  895. danx: 0,
  896. duox: 0,
  897. pand: 0,
  898. anli: 0,
  899. jiand: 0,
  900. },
  901. passScore: "", //及格分数
  902. djTimeType: 0, //0无限1有限
  903. djTime: 0, //答卷时长
  904. djNumType: 0, //0无限1有限
  905. djNum: 0, //答卷次数
  906. examsType: 1,
  907. businObj: {},
  908. draftBox: [], //草稿箱
  909. copytableData: [],
  910. localStart: false, //定时器是否已经开始
  911. pageId: "", //试卷ID
  912. };
  913. },
  914. computed: {
  915. getAllpocis() {
  916. var num = 0;
  917. this.boxtableDataPags.map((item) => {
  918. num += item.score;
  919. });
  920. return num;
  921. },
  922. },
  923. watch: {
  924. djTime: {
  925. handler(newVal, oldVal) {
  926. if (newVal === 0) {
  927. this.djTimeType = 0;
  928. } else {
  929. this.djTimeType = 1;
  930. }
  931. },
  932. // 立即处理 进入页面就触发
  933. immediate: true,
  934. },
  935. djNum: {
  936. handler(newVal, oldVal) {
  937. if (newVal === 0) {
  938. this.djNumType = 0;
  939. } else {
  940. this.djNumType = 1;
  941. }
  942. },
  943. // 立即处理 进入页面就触发
  944. immediate: true,
  945. },
  946. tableData: {
  947. handler(newVal, oldVal) {
  948. this.navText.index = newVal.length;
  949. /**
  950. * 定时器触发机制 防止内存浪费
  951. */
  952. if (newVal.length) {
  953. var a = JSON.stringify(this.tableData);
  954. var b = JSON.stringify(this.copytableData);
  955. if (a != b) {
  956. if (!this.localStart) {
  957. this.localStart = true;
  958. this.setInterFunc();
  959. }
  960. }
  961. }
  962. },
  963. // 立即处理 进入页面就触发
  964. immediate: true,
  965. },
  966. $route: {
  967. handler(val, oldval) {
  968. this.localStart = false;
  969. },
  970. // 深度观察监听
  971. deep: true,
  972. },
  973. },
  974. created() {
  975. this.pageId = this.$route.query.id;
  976. },
  977. async mounted() {
  978. this.getInfos();
  979. await this.getFns();
  980. this.changeAmdis();
  981. this.search();
  982. },
  983. beforeDestroy() {
  984. this.localStart = false;
  985. },
  986. methods: {
  987. setInterFunc() {
  988. var arr = setInterval(() => {
  989. if (!this.localStart) {
  990. clearInterval(arr);
  991. return;
  992. }
  993. this.$methodsTools.storageSet(
  994. "exam",
  995. JSON.stringify({
  996. id: this.pageId,
  997. data: this.tableData,
  998. })
  999. );
  1000. }, 1500);
  1001. },
  1002. getInfos() {
  1003. this.$api.obtainbankexam(this.$route.query.id).then((res) => {
  1004. this.businObj = {
  1005. businessId: res.data.businessId,
  1006. businessName: res.data.businessName,
  1007. educationName: res.data.educationName,
  1008. educationTypeId: res.data.educationTypeId,
  1009. projectName: res.data.projectName,
  1010. projectId: res.data.projectId,
  1011. subjectName: res.data.subjectName,
  1012. subjectId: res.data.subjectId,
  1013. };
  1014. this.djTime = res.data.answerTime;
  1015. this.djNum = res.data.answerNum;
  1016. this.examsType = res.data.doType;
  1017. this.passScore = res.data.passScore;
  1018. });
  1019. },
  1020. // --------------------------分割线---------------------------
  1021. editInfo(v) {
  1022. this.addClick(v, 0);
  1023. },
  1024. search(v) {
  1025. this.loading = true;
  1026. this.$api
  1027. .inquirebankexamquestionList({ examId: this.$route.query.id })
  1028. .then((res) => {
  1029. res.data.map((item) => {
  1030. item.optionsList = JSON.parse(item.jsonStr);
  1031. });
  1032. this.copytableData = JSON.parse(JSON.stringify(res.data));
  1033. this.tableData = res.data;
  1034. // this.total = res.total;
  1035. this.navText.index = res.total;
  1036. })
  1037. .finally(() => {
  1038. this.loading = false;
  1039. });
  1040. },
  1041. init() {
  1042. this.search();
  1043. },
  1044. del(v, index) {
  1045. this.$alert(
  1046. "确定删除此内容?<br />内容删除后将无法恢复,请慎重考虑",
  1047. "提示",
  1048. {
  1049. dangerouslyUseHTMLString: true,
  1050. }
  1051. )
  1052. .then(() => {
  1053. this.tableData.splice(index, 1);
  1054. })
  1055. .catch(() => {
  1056. this.$message({
  1057. type: "info",
  1058. message: "已取消删除",
  1059. });
  1060. });
  1061. },
  1062. openActiveBox() {
  1063. this.radioActive = "";
  1064. this.dialogVisibleActive = true;
  1065. },
  1066. submitActive() {
  1067. if (!this.radioActive) {
  1068. this.$message.warning("请选择操作类型");
  1069. return;
  1070. }
  1071. this.dialogVisibleActive = false;
  1072. if (this.radioActive === 1) {
  1073. this.addClick();
  1074. } else {
  1075. var self = this;
  1076. this.formData = {
  1077. status: 1,
  1078. pageSize: 10,
  1079. pageNum: 1,
  1080. publishStatus: 1,
  1081. };
  1082. var data = JSON.parse(JSON.stringify(this.formData));
  1083. data.businessId = this.businObj.businessId;
  1084. data.subjectId = this.businObj.subjectId;
  1085. this.$api.inquirebankquestionList(data).then((res) => {
  1086. var aList = [];
  1087. this.tableData.map((item) => {
  1088. if (item.questionId) {
  1089. aList.push(item.questionId);
  1090. }
  1091. });
  1092. this.disCheckList = aList;
  1093. this.boxtableData = res.rows;
  1094. this.totals = res.total;
  1095. this.dialogVisibleTable = true;
  1096. this.$nextTick(function () {
  1097. self.$refs.multipleTable.clearSelection();
  1098. });
  1099. });
  1100. }
  1101. },
  1102. getDIO(int) {
  1103. if (int === 1) {
  1104. this.formData.pageNum = 1;
  1105. }
  1106. if (int === 2) {
  1107. this.formData = {
  1108. status: 1,
  1109. pageSize: 10,
  1110. pageNum: 1,
  1111. publishStatus: 1,
  1112. };
  1113. }
  1114. var data = JSON.parse(JSON.stringify(this.formData));
  1115. data.businessId = this.businObj.businessId;
  1116. data.subjectId = this.businObj.subjectId;
  1117. this.$api.inquirebankquestionList(data).then((res) => {
  1118. this.boxtableData = res.rows;
  1119. this.totals = res.total;
  1120. });
  1121. },
  1122. closeBoxsActive() {
  1123. this.dialogVisibleActive = false;
  1124. },
  1125. submitTable() {
  1126. if (this.activeLists.length === 0) {
  1127. this.dialogVisibleTable = false;
  1128. return;
  1129. }
  1130. if (this.tableData.length) {
  1131. let maxIndex = 0;
  1132. this.tableData.forEach((item) => {
  1133. if (item.sort > maxIndex) {
  1134. maxIndex = item.sort;
  1135. }
  1136. });
  1137. this.activeLists.forEach((item, index) => {
  1138. item.sort = maxIndex + index + 1;
  1139. item.optionsList = JSON.parse(item.jsonStr);
  1140. item.partScore = 0;
  1141. item.score = "";
  1142. });
  1143. } else {
  1144. this.activeLists.forEach((item, index) => {
  1145. item.sort = index + 1;
  1146. item.optionsList = JSON.parse(item.jsonStr);
  1147. item.partScore = 0;
  1148. item.score = "";
  1149. });
  1150. }
  1151. this.activeLists.forEach((item) => {
  1152. this.tableData.push(item);
  1153. });
  1154. // this.tableData = this.tableData.concat(this.activeLists);
  1155. this.dialogVisibleTable = false;
  1156. this.$message.success("添加成功");
  1157. this.activeLists = [];
  1158. },
  1159. closeBoxsTable() {
  1160. this.dialogVisibleTable = false;
  1161. },
  1162. selectAll(value) {
  1163. this.activeLists = value;
  1164. },
  1165. select(value) {
  1166. this.activeLists = value;
  1167. },
  1168. checkboxT(row, index) {
  1169. if (this.disCheckList.indexOf(row.questionId) !== -1) {
  1170. return false;
  1171. } else {
  1172. return true;
  1173. }
  1174. },
  1175. getRowKeys(row) {
  1176. return row.questionId;
  1177. },
  1178. addClick(v, int, indexZB) {
  1179. var self = this;
  1180. if (v === undefined) {
  1181. self.statusPop = 1;
  1182. self.innerVisiblePaperTopic = true;
  1183. self.showHide = true;
  1184. self.$nextTick(() => {
  1185. var data = {
  1186. type: 1,
  1187. optionsList: [],
  1188. answerQuestionList: [],
  1189. content: "",
  1190. status: "",
  1191. analysisContent: "",
  1192. answerQuestion: "",
  1193. };
  1194. for (let i = 0; i < 4; i++) {
  1195. data.optionsList.push({
  1196. content: "",
  1197. imgUrl: null,
  1198. optionsId: i + 1,
  1199. });
  1200. }
  1201. self.listNums = data;
  1202. // (self.$refs.sujects.eduType = "");
  1203. // self.$refs.sujects.courType = "";
  1204. // self.$refs.sujects.sujectApis = [];
  1205. // self.$refs.sujects.newSujectApis = [];
  1206. self.listData = {
  1207. publishStatus: 1,
  1208. };
  1209. self.activeExam = [];
  1210. });
  1211. } else {
  1212. self.innerVisiblePaperTopic = true;
  1213. self.showHide = true;
  1214. self.statusPop = int;
  1215. var vres = JSON.parse(JSON.stringify(v));
  1216. self.indexZB = indexZB;
  1217. if (vres.knowledgeIds) {
  1218. var a = [];
  1219. vres.knowledgeIds
  1220. .split(",")
  1221. .map(Number)
  1222. .map((items) => {
  1223. self.allOptions.map((item) => {
  1224. if (item.knowledgeId === items) {
  1225. a.push(item);
  1226. }
  1227. });
  1228. });
  1229. self.activeExam = a;
  1230. } else {
  1231. self.activeExam = [];
  1232. }
  1233. if (vres.type === 2) {
  1234. if (vres.answerQuestion) {
  1235. vres.answerQuestionList = vres.answerQuestion
  1236. .split(",")
  1237. .map(Number);
  1238. }
  1239. } else if (vres.type === 4) {
  1240. vres.optionsList.map((item) => {
  1241. if (item.type === 2) {
  1242. if (item.answerQuestion) {
  1243. item.answerQuestionList = item.answerQuestion
  1244. .split(",")
  1245. .map(Number);
  1246. }
  1247. } else {
  1248. item.answerQuestionList = [];
  1249. }
  1250. });
  1251. } else {
  1252. vres.answerQuestionList = [];
  1253. }
  1254. self.listData.prefixName = vres.prefixName;
  1255. self.listData.publishStatus = vres.publishStatus;
  1256. self.listNums = vres;
  1257. // var arrays = [];
  1258. // vres.businessList.map((item) => {
  1259. // arrays.push(item.businessId + "-" + item.subjectId);
  1260. // });
  1261. // self.sujectApisTable = arrays;
  1262. // self.newSujectApisTable = vres.businessList;
  1263. }
  1264. },
  1265. //-----------------------------------------------
  1266. comLs(item) {
  1267. var os = this.activeExam.some((items) => {
  1268. return items.knowledgeId === item.knowledgeId;
  1269. });
  1270. if (os) {
  1271. return true;
  1272. } else {
  1273. return false;
  1274. }
  1275. },
  1276. getFns() {
  1277. return new Promise((resolve, reject) => {
  1278. this.$api.inquireKnowledgeExamListS({ status: 1 }).then((res) => {
  1279. this.allOptions = res.rows;
  1280. resolve();
  1281. });
  1282. });
  1283. },
  1284. getSimpleText(html) {
  1285. var re1 = new RegExp("<.+?>", "g"); //匹配html标签的正则表达式,"g"是搜索匹配多个符合的内容
  1286. var msg = html.replace(re1, ""); //执行替换成空字符
  1287. return msg;
  1288. },
  1289. addBusName() {
  1290. if (this.BusName.trim()) {
  1291. var as = this.allOptions.some((item) => {
  1292. return item.knowledgeName == this.BusName;
  1293. });
  1294. if (as) {
  1295. this.$message.warning("当前知识点名称已存在");
  1296. return;
  1297. }
  1298. this.BusNameList.push(this.BusName);
  1299. this.BusName = "";
  1300. } else {
  1301. this.$message({
  1302. message: "请输入知识点内容",
  1303. type: "warning",
  1304. duration: 1200,
  1305. });
  1306. this.BusName = "";
  1307. }
  1308. },
  1309. submit() {
  1310. var data = {
  1311. examKnowledgeBusinessAddBoList: [this.businObj],
  1312. knowledgeName: this.BusNameList,
  1313. status: 1,
  1314. };
  1315. this.$api.addKnowledgeExam(data).then(async (res) => {
  1316. this.$message.success("添加成功");
  1317. this.dialogVisible = false;
  1318. await this.getFns();
  1319. this.changeAmdis();
  1320. });
  1321. },
  1322. closeBoxs() {
  1323. this.dialogVisible = false;
  1324. },
  1325. addExam() {
  1326. // if (!this.businObj.businessId) {
  1327. // this.$message.warning("请选择业务层级");
  1328. // return;
  1329. // }
  1330. this.BusNameList = [];
  1331. this.BusName = "";
  1332. this.dialogVisible = true;
  1333. },
  1334. clearBus() {
  1335. this.BusNameList.splice(index, 1);
  1336. },
  1337. //子组件回调 业务层及变换-知识点重新筛选
  1338. changeAmdis() {
  1339. var int = this.businObj.businessId;
  1340. var ao = [];
  1341. this.allOptions.map((item, index) => {
  1342. let acts = item.courseBusinessList.some((items) => {
  1343. return items.businessId === int;
  1344. });
  1345. if (acts) {
  1346. ao.push(item);
  1347. }
  1348. });
  1349. this.options = ao;
  1350. },
  1351. clearBusName(index) {
  1352. this.activeExam.splice(index, 1);
  1353. },
  1354. changeKnow(item) {
  1355. this.allOptions.map((items) => {
  1356. if (items.knowledgeId === item) {
  1357. this.activeExam.push(items);
  1358. }
  1359. });
  1360. this.value = "";
  1361. },
  1362. addListNums() {
  1363. this.listNums.push({
  1364. type: 1,
  1365. optionsList: [],
  1366. answerQuestionList: [],
  1367. content: "",
  1368. status: "",
  1369. analysisContent: "",
  1370. answerQuestion: "",
  1371. });
  1372. },
  1373. closeBefore() {
  1374. this.innerVisiblePaperTopic = false;
  1375. this.showHide = false;
  1376. },
  1377. async submitForm(formName, int) {
  1378. this.$refs[formName].validate((valid) => {
  1379. if (valid) {
  1380. var self = this;
  1381. // if (!this.$refs.sujects.newSujectApis.length) {
  1382. // this.$message.error("请选择科目");
  1383. // return;
  1384. // }
  1385. var data = this.$refs.child.getInfosPage();
  1386. if (!data.content || data.content == "<p><br></p>") {
  1387. self.$message.error("请填写题目内容");
  1388. return;
  1389. }
  1390. if (data.type != 3 && data.type != 5 && !data.optionsList.length) {
  1391. self.$message.error("请添加选项");
  1392. return;
  1393. }
  1394. if (data.type != 3 && data.type != 4 && data.optionsList.length) {
  1395. var ast = data.optionsList.some((item) => {
  1396. return !item.content && !item.imgUrl;
  1397. });
  1398. if (ast) {
  1399. self.$message.error("请完善选项内容");
  1400. return;
  1401. }
  1402. }
  1403. if (data.type != 5 && data.type != 4) {
  1404. if (data.type === 2 && !data.answerQuestionList.length) {
  1405. self.$message.error("请选择正确答案");
  1406. return;
  1407. }
  1408. if (data.type !== 2 && !data.answerQuestion) {
  1409. self.$message.error("请选择正确答案");
  1410. return;
  1411. }
  1412. }
  1413. if (data.type == 4 && data.optionsList.length) {
  1414. for (let i = 0; i < data.optionsList.length; i++) {
  1415. if (
  1416. !data.optionsList[i].content ||
  1417. data.optionsList[i].content == "<p><br></p>"
  1418. ) {
  1419. self.$message.error("请填写题目内容");
  1420. return;
  1421. }
  1422. if (
  1423. data.optionsList[i].type != 3 &&
  1424. data.optionsList[i].type != 5 &&
  1425. !data.optionsList[i].optionsList.length
  1426. ) {
  1427. self.$message.error("请添加选项");
  1428. return;
  1429. }
  1430. if (
  1431. data.optionsList[i].type != 3 &&
  1432. data.optionsList[i].optionsList.length
  1433. ) {
  1434. var ast = data.optionsList[i].optionsList.some((item) => {
  1435. return !item.content && !item.imgUrl;
  1436. });
  1437. if (ast) {
  1438. self.$message.error("请完善选项内容");
  1439. return;
  1440. }
  1441. }
  1442. if (data.optionsList[i].type != 5) {
  1443. if (
  1444. data.optionsList[i].type === 2 &&
  1445. !data.optionsList[i].answerQuestionList.length
  1446. ) {
  1447. self.$message.error("请选择正确答案");
  1448. return;
  1449. }
  1450. if (
  1451. data.optionsList[i].type !== 2 &&
  1452. !data.optionsList[i].answerQuestion
  1453. ) {
  1454. self.$message.error("请选择正确答案");
  1455. return;
  1456. }
  1457. }
  1458. }
  1459. }
  1460. var numList = [];
  1461. this.activeExam.map((item) => {
  1462. numList.push(item.knowledgeId);
  1463. });
  1464. data.knowledgeList = this.activeExam;
  1465. data.prefixName = this.listData.prefixName;
  1466. data.knowledgeIds = numList.toString();
  1467. data.publishStatus = this.listData.publishStatus;
  1468. // data.businessList = this.$refs.sujects.newSujectApis;
  1469. if (data.type === 2) {
  1470. if (data.answerQuestionList.length) {
  1471. data.answerQuestion = data.answerQuestionList.toString();
  1472. }
  1473. }
  1474. if (data.type === 4) {
  1475. data.optionsList.map((item) => {
  1476. if (item.type === 2) {
  1477. if (item.answerQuestionList.length) {
  1478. item.answerQuestion = item.answerQuestionList.toString();
  1479. }
  1480. }
  1481. });
  1482. }
  1483. if (this.statusPop === 1) {
  1484. data.businessList = [this.businObj];
  1485. data.partScore = 0;
  1486. data.score = "";
  1487. data.status = 1;
  1488. if (this.tableData.length) {
  1489. let maxIndex = 0;
  1490. this.tableData.forEach((item) => {
  1491. if (item.sort > maxIndex) {
  1492. maxIndex = item.sort;
  1493. }
  1494. });
  1495. data.sort = maxIndex + 1;
  1496. } else {
  1497. data.sort = 1;
  1498. }
  1499. this.tableData.push(data);
  1500. // this.$api.addbankquestion(data).then((res) => {
  1501. self.$message.success("添加成功");
  1502. self.innerVisiblePaperTopic = false;
  1503. self.showHide = false;
  1504. // self.search();
  1505. // });
  1506. }
  1507. if (this.statusPop === 0) {
  1508. this.tableData.splice(this.indexZB, 1, data);
  1509. // this.$api.editbankquestion(data).then((res) => {
  1510. self.$message.success("修改成功");
  1511. self.innerVisiblePaperTopic = false;
  1512. self.showHide = false;
  1513. // self.search();
  1514. // });
  1515. }
  1516. } else {
  1517. console.log("error submit!!");
  1518. return false;
  1519. }
  1520. });
  1521. },
  1522. uploadApis(item) {
  1523. return new Promise((resolve, reject) => {
  1524. this.$api.editbankquestion(item).then((res) => {
  1525. resolve();
  1526. });
  1527. });
  1528. },
  1529. addbankquestion(item) {
  1530. return new Promise((resolve, reject) => {
  1531. this.$api.addbankquestion(item).then((res) => {
  1532. resolve(res.data.questionId);
  1533. });
  1534. });
  1535. },
  1536. async submitTableAllInfos() {
  1537. var self = this;
  1538. if (this.examsType === 2) {
  1539. if (Number(this.passScore) > Number(this.getAllpocis)) {
  1540. this.$message.warning("及格分数不得大于当前总分,请重新设置分值");
  1541. return;
  1542. }
  1543. }
  1544. for (let i = 0; i < this.tableData.length; i++) {
  1545. if (!this.tableData[i].sort && this.tableData[i].sort !== 0) {
  1546. this.$message.warning(`题目管理第${i + 1}条请输入排序`);
  1547. return;
  1548. }
  1549. }
  1550. let arr = this.tableData.map((items) => {
  1551. return items.sort;
  1552. });
  1553. if (new Set(arr).size != arr.length) {
  1554. this.$message.warning("排序不允许重复");
  1555. return;
  1556. }
  1557. var arrs = [];
  1558. for (let i = 0; i < this.tableData.length; i++) {
  1559. if (self.tableData[i].questionId) {
  1560. await self.uploadApis(self.tableData[i]);
  1561. } else {
  1562. var ids = await self.addbankquestion(self.tableData[i]);
  1563. self.tableData[i].questionId = ids;
  1564. }
  1565. arrs.push({
  1566. questionId: self.tableData[i].questionId,
  1567. sort: self.tableData[i].sort,
  1568. score: self.tableData[i].score,
  1569. partScore: self.tableData[i].partScore,
  1570. });
  1571. }
  1572. this.disabledBtn = true;
  1573. var data = {
  1574. examId: this.$route.query.id,
  1575. questionList: arrs,
  1576. status: 1,
  1577. passScore: this.passScore,
  1578. doType: this.examsType,
  1579. };
  1580. if (this.djTimeType === 0) {
  1581. data.answerTime = 0;
  1582. } else {
  1583. data.answerTime = this.djTime;
  1584. }
  1585. if (this.djNumType === 0) {
  1586. data.answerNum = 0;
  1587. } else {
  1588. data.answerNum = this.djNum;
  1589. }
  1590. this.$api
  1591. .editbankexam(data)
  1592. .then((res) => {
  1593. this.$message.success("编辑成功");
  1594. setTimeout(async () => {
  1595. await this.removeInfo();
  1596. this.$store.dispatch("tagsView/exitView", this.$route).then(() => {
  1597. this.$router.push({
  1598. path: "testPaperManagement",
  1599. });
  1600. });
  1601. }, 500);
  1602. })
  1603. .catch(() => {
  1604. this.disabledBtn = false;
  1605. });
  1606. },
  1607. removeInfo() {
  1608. return new Promise((resolve, reject) => {
  1609. let localStatus = this.$methodsTools.storageGet("exam");
  1610. if (localStatus) {
  1611. if (JSON.parse(localStatus).id == this.$route.query.id) {
  1612. this.$methodsTools.storageRemove("exam");
  1613. }
  1614. }
  1615. resolve();
  1616. });
  1617. },
  1618. backPage() {
  1619. this.$store.dispatch("tagsView/delView", this.$route).then((res) => {
  1620. this.$router.push({
  1621. path: "testPaperManagement",
  1622. });
  1623. });
  1624. },
  1625. emitData() {
  1626. if (!this.tableData.length) {
  1627. this.$message.warning("请添加题目");
  1628. return;
  1629. }
  1630. this.boxtableDataPags = JSON.parse(JSON.stringify(this.tableData));
  1631. this.diansBoxStatus = true;
  1632. },
  1633. closePagsInfos() {
  1634. this.diansBoxStatus = false;
  1635. },
  1636. submitPagsInfos() {
  1637. if (this.examsType === 2) {
  1638. var ast = this.boxtableDataPags.every((item) => {
  1639. if (item.type === 2) {
  1640. return item.partScore >= 0 && item.score >= 0;
  1641. } else {
  1642. return item.score >= 0;
  1643. }
  1644. });
  1645. if (!ast) {
  1646. this.$message.warning("请设置每道题目的分值");
  1647. return;
  1648. }
  1649. if (Number(this.passScore) > Number(this.getAllpocis)) {
  1650. this.$message.warning("及格分数不得大于当前总分");
  1651. return;
  1652. }
  1653. }
  1654. this.tableData = this.boxtableDataPags;
  1655. this.diansBoxStatus = false;
  1656. },
  1657. selectAllPags(value) {
  1658. this.activeListsPags = value;
  1659. },
  1660. selectPags(value) {
  1661. this.activeListsPags = value;
  1662. },
  1663. getRowKeysPags(row) {
  1664. return row.questionId;
  1665. },
  1666. activeOpens() {
  1667. if (!this.activeListsPags.length) {
  1668. this.$message.warning("请选择需要设置分值的题目");
  1669. return;
  1670. }
  1671. this.Pocis = "";
  1672. this.dialogVisibleActivePocis = true;
  1673. },
  1674. closeBoxsActivePocis() {
  1675. this.dialogVisibleActivePocis = false;
  1676. },
  1677. submitActivePocis() {
  1678. this.activeListsPags.map((item) => {
  1679. item.score = this.Pocis;
  1680. });
  1681. this.dialogVisibleActivePocis = false;
  1682. this.activeListsPags = [];
  1683. this.$refs.multipleTables.clearSelection();
  1684. },
  1685. activePicis() {
  1686. if (!this.activeListsPags.length) {
  1687. this.$message.warning("请选择需要设置分值的题目");
  1688. return;
  1689. }
  1690. this.pocisArray = {
  1691. danx: 0,
  1692. duox: 0,
  1693. pand: 0,
  1694. anli: 0,
  1695. jiand: 0,
  1696. };
  1697. for (let i = 0; i < this.activeListsPags.length; i++) {
  1698. if (this.activeListsPags[i].type === 1) {
  1699. this.pocisArray.danx++;
  1700. }
  1701. if (this.activeListsPags[i].type === 2) {
  1702. this.pocisArray.duox++;
  1703. }
  1704. if (this.activeListsPags[i].type === 3) {
  1705. this.pocisArray.pand++;
  1706. }
  1707. if (this.activeListsPags[i].type === 4) {
  1708. this.pocisArray.anli++;
  1709. }
  1710. if (this.activeListsPags[i].type === 5) {
  1711. this.pocisArray.jiand++;
  1712. }
  1713. }
  1714. this.Pocis1 = "";
  1715. this.Pocis2 = "";
  1716. this.Pocis2s = "";
  1717. this.Pocis3 = "";
  1718. this.Pocis4 = "";
  1719. this.Pocis5 = "";
  1720. this.dialogVisibleActivePLPoics = true;
  1721. },
  1722. closeBoxsActivePLPoics() {
  1723. this.dialogVisibleActivePLPoics = false;
  1724. },
  1725. submitActivePLPoics() {
  1726. this.activeListsPags.map((item) => {
  1727. if (item.type === 1) {
  1728. item.score = this.Pocis1;
  1729. }
  1730. if (item.type === 2) {
  1731. item.score = this.Pocis2;
  1732. item.partScore = this.Pocis2s;
  1733. }
  1734. if (item.type === 3) {
  1735. item.score = this.Pocis3;
  1736. }
  1737. if (item.type === 4) {
  1738. item.score = this.Pocis4;
  1739. }
  1740. if (item.type === 5) {
  1741. item.score = this.Pocis5;
  1742. }
  1743. });
  1744. this.dialogVisibleActivePLPoics = false;
  1745. this.activeListsPags = [];
  1746. this.$refs.multipleTables.clearSelection();
  1747. },
  1748. inits() {
  1749. this.getDIO(2);
  1750. },
  1751. handleSizeChange(v) {
  1752. this.formData.pageSize = v;
  1753. this.formData.pageNum = 1;
  1754. this.getDIO();
  1755. },
  1756. handleCurrentChange(v) {
  1757. this.formData.pageNum = v;
  1758. this.getDIO();
  1759. },
  1760. },
  1761. };
  1762. </script>
  1763. <style lang="less" scoped>
  1764. .boxWidth {
  1765. width: 700px;
  1766. }
  1767. .numInputs {
  1768. width: 150px;
  1769. }
  1770. .checkboxSty {
  1771. max-height: 210px;
  1772. overflow: auto;
  1773. display: flex;
  1774. flex-direction: column;
  1775. }
  1776. .listBoxStys {
  1777. flex-shrink: 0;
  1778. padding: 0px 10px;
  1779. border-radius: 8px;
  1780. border: 1px solid #eee;
  1781. margin-right: 10px;
  1782. margin-bottom: 6px;
  1783. }
  1784. .closeIcons {
  1785. color: red;
  1786. cursor: pointer;
  1787. margin-left: 6px;
  1788. }
  1789. .ach {
  1790. display: flex;
  1791. align-items: center;
  1792. overflow: hidden;
  1793. }
  1794. .clh {
  1795. display: flex;
  1796. align-items: center;
  1797. flex-wrap: wrap;
  1798. }
  1799. .imgBoxins {
  1800. width: 375px;
  1801. height: 220px;
  1802. text-align: center;
  1803. img {
  1804. height: 100%;
  1805. }
  1806. }
  1807. .iconStsz {
  1808. font-size: 40px;
  1809. color: #67c23a;
  1810. cursor: pointer;
  1811. }
  1812. .BusBoxs {
  1813. min-height: 100px;
  1814. border: 1px solid #a4a4a4;
  1815. margin-bottom: 10px;
  1816. border-radius: 8px;
  1817. max-height: 280px;
  1818. padding: 10px;
  1819. overflow-y: auto;
  1820. .fot_Le {
  1821. border-radius: 12px;
  1822. border: 1px solid yellowgreen;
  1823. padding: 0px 10px;
  1824. height: 30px;
  1825. line-height: 30px;
  1826. text-align: center;
  1827. float: left;
  1828. margin-right: 6px;
  1829. margin-bottom: 6px;
  1830. .icon_clear {
  1831. margin-left: 2px;
  1832. font-size: 15px;
  1833. color: #f56c6c;
  1834. cursor: pointer;
  1835. }
  1836. }
  1837. }
  1838. .marg_play {
  1839. display: flex;
  1840. margin-bottom: 15px;
  1841. .spans {
  1842. text-align: right;
  1843. width: 80px;
  1844. }
  1845. }
  1846. /deep/.el-button {
  1847. border-radius: 8px;
  1848. }
  1849. /deep/.el-dialog {
  1850. border-radius: 8px;
  1851. .el-dialog__header {
  1852. padding: 0;
  1853. .hearders {
  1854. height: 40px;
  1855. display: flex;
  1856. align-items: center;
  1857. justify-content: space-between;
  1858. padding: 0px 18px 0px 20px;
  1859. border-bottom: 1px solid #e2e2e2;
  1860. .leftTitle {
  1861. font-size: 14px;
  1862. font-weight: bold;
  1863. color: #2f4378;
  1864. }
  1865. .rightBoxs {
  1866. display: flex;
  1867. align-items: center;
  1868. img {
  1869. width: 14px;
  1870. height: 14px;
  1871. margin-left: 13px;
  1872. cursor: pointer;
  1873. }
  1874. }
  1875. }
  1876. }
  1877. .el-dialog__footer {
  1878. padding: 0;
  1879. .dialog-footer {
  1880. padding: 0px 40px;
  1881. height: 70px;
  1882. border-top: 1px solid #e2e2e2;
  1883. display: flex;
  1884. align-items: center;
  1885. justify-content: center;
  1886. }
  1887. }
  1888. }
  1889. .centerStys {
  1890. display: flex;
  1891. align-items: center;
  1892. justify-content: center;
  1893. margin-top: 18px;
  1894. }
  1895. .dis_fos {
  1896. align-items: flex-end;
  1897. display: flex;
  1898. justify-content: space-between;
  1899. }
  1900. .margin_bs {
  1901. margin-bottom: 6px;
  1902. }
  1903. </style>