index.vue 57 KB

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