index.vue 61 KB

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