index.vue 57 KB

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