index.vue 57 KB

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