index.vue 59 KB

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