index.vue 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039
  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.wordpop.dialogDRword = true"
  27. type="success"
  28. >Word批量导入</el-button
  29. ><el-button size="medium" @click="openExcel" 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. <word-pop ref="wordpop" @backwordData="backwordData" />
  661. <excel-pop ref="excelpop" @backExcelData="backExcelData" />
  662. </div>
  663. </div>
  664. </template>
  665. <script>
  666. import searchBoxNew from "@/components/searchBoxNew";
  667. import pagination from "@/components/pagination";
  668. import tableList from "@/components/tableList";
  669. import busIns from "@/components/busIns";
  670. import questionBank from "@/components/questionBank";
  671. import wordPop from "../../wordPop.vue";
  672. import excelPop from "../../excelPop.vue";
  673. export default {
  674. name: "TopicAddPaper",
  675. components: {
  676. searchBoxNew,
  677. pagination,
  678. tableList,
  679. busIns,
  680. questionBank,
  681. wordPop,
  682. excelPop,
  683. },
  684. data() {
  685. return {
  686. keyValue: "",
  687. dialogDRword: false,
  688. disabledBtn: false,
  689. dialogDRexcel: false,
  690. showHide: false,
  691. activeName: "second",
  692. formList: [
  693. // {
  694. // prop: "educationTypeId",
  695. // placeholder: "教育类型",
  696. // scope: "educationType",
  697. // },
  698. // {
  699. // prop: "businessId",
  700. // placeholder: "业务层次",
  701. // scope: "businessLevel",
  702. // edu: "educationTypeId",
  703. // },
  704. // {
  705. // prop: "subjectId",
  706. // placeholder: "科目",
  707. // scope: "sujectType",
  708. // edu: "educationTypeId",
  709. // },
  710. {
  711. prop: "type",
  712. placeholder: "题目类型",
  713. scope: "selectBank",
  714. },
  715. {
  716. prop: "key",
  717. placeholder: "请输入题目标题/题目编码/知识点/标题前缀",
  718. },
  719. ],
  720. formData: {
  721. publishStatus: 1,
  722. status: 1,
  723. pageSize: 10,
  724. pageNum: 1,
  725. },
  726. totals: 0,
  727. tableSet: [
  728. {
  729. label: "排序",
  730. prop: "sort",
  731. scope: "inputs",
  732. width: "100px",
  733. hidden: true,
  734. },
  735. {
  736. label: "题目编码",
  737. prop: "code",
  738. hidden: false,
  739. },
  740. {
  741. label: "题型",
  742. prop: "type",
  743. hidden: true,
  744. scope: "topic",
  745. width:"140px"
  746. },
  747. {
  748. label: "标题前缀",
  749. prop: "prefixName",
  750. hidden: false,
  751. },
  752. {
  753. label: "题目详细",
  754. prop: "content",
  755. hidden: true,
  756. scope: "htmlInfo",
  757. width: "600px",
  758. dontCenter: true,
  759. },
  760. {
  761. label: "知识点",
  762. prop: "knowledgeList",
  763. hidden: false,
  764. scope: "knowledge",
  765. width: "200px",
  766. showTooltip: true,
  767. },
  768. {
  769. label: "发布状态",
  770. prop: "publishStatus",
  771. hidden: true,
  772. scope: "fabStatus",
  773. width:"140px"
  774. },
  775. ],
  776. tableData: [],
  777. loading: false, //当前表单加载是否加载动画
  778. navText: {
  779. title: "题目管理",
  780. index: 0,
  781. ch: "条",
  782. num: false,
  783. border: true,
  784. choice: true,
  785. addHide: false,
  786. dontNum: true,
  787. backFatherBtn: {
  788. status: true,
  789. title: "分值设置",
  790. },
  791. },
  792. rulesTest: {
  793. // prefixName: [
  794. // { required: true, message: "请输入标签前缀", trigger: "blur" },
  795. // ],
  796. },
  797. dialogVisible: false,
  798. innerVisiblePaperTopic: false,
  799. fullscreenChildPaperTopic: false,
  800. statusPop: 1,
  801. dingForm: {},
  802. questionId: "",
  803. queryData: {},
  804. allOptions: [], //知识点列表
  805. options: [], //当前知识点列表
  806. activeExam: [], // 已选知识点列表
  807. value: "",
  808. BusName: "", //弹窗新增知识点输入框
  809. BusNameList: [],
  810. listNums: {},
  811. typeBus: 1,
  812. indexZB: "",
  813. listData: {
  814. publishStatus: "",
  815. prefixName: "",
  816. },
  817. int: "",
  818. listitem: [
  819. {
  820. label: "标题前缀",
  821. prop: "prefixName",
  822. },
  823. {
  824. label: "知识点",
  825. scope: "bussing",
  826. },
  827. {
  828. label: "发布状态",
  829. prop: "publishStatus",
  830. scope: "radio",
  831. },
  832. ],
  833. radioActive: "",
  834. dialogVisibleActive: false,
  835. dialogVisibleTable: false,
  836. boxtableData: [],
  837. tableSetTables: [
  838. {
  839. label: "题目类型",
  840. prop: "type",
  841. hidden: true,
  842. scope: "topic",
  843. },
  844. {
  845. label: "题目编码",
  846. prop: "code",
  847. hidden: true,
  848. },
  849. {
  850. label: "标题前缀",
  851. prop: "prefixName",
  852. hidden: true,
  853. },
  854. {
  855. label: "知识点",
  856. prop: "knowledgeList",
  857. hidden: true,
  858. scope: "knowledge",
  859. width: "180px",
  860. },
  861. {
  862. label: "题目标题",
  863. prop: "content",
  864. hidden: true,
  865. scope: "editInfoHTMLs",
  866. width: "320px",
  867. },
  868. {
  869. label: "发布状态",
  870. prop: "publishStatus",
  871. hidden: true,
  872. scope: "Status",
  873. width: "120px",
  874. },
  875. ],
  876. activeLists: [],
  877. disCheckList: [],
  878. sujectApisTable: [],
  879. newSujectApisTable: [],
  880. // -------------------------------------
  881. diansBoxStatus: false,
  882. boxtableDataPags: [],
  883. tableSetTablesPags: [
  884. {
  885. label: "排序",
  886. prop: "sort",
  887. hidden: true,
  888. },
  889. {
  890. label: "题型",
  891. prop: "type",
  892. hidden: true,
  893. scope: "topic",
  894. },
  895. {
  896. label: "标题前缀",
  897. prop: "prefixName",
  898. hidden: true,
  899. },
  900. {
  901. label: "题目标题",
  902. prop: "content",
  903. hidden: true,
  904. scope: "editInfoHTMLs",
  905. },
  906. {
  907. label: "发布状态",
  908. prop: "publishStatus",
  909. hidden: true,
  910. scope: "Status",
  911. },
  912. {
  913. label: "分值",
  914. prop: "score",
  915. hidden: true,
  916. scope: "inputS",
  917. width: "250px",
  918. },
  919. ],
  920. activeListsPags: [],
  921. dialogVisibleActivePocis: false,
  922. Pocis: "",
  923. dialogVisibleActivePLPoics: false,
  924. Pocis1: "",
  925. Pocis2: "",
  926. Pocis2s: "",
  927. Pocis3: "",
  928. Pocis4: "",
  929. Pocis5: "",
  930. pocisArray: {
  931. danx: 0,
  932. duox: 0,
  933. pand: 0,
  934. anli: 0,
  935. jiand: 0,
  936. },
  937. passScore: "", //及格分数
  938. djTimeType: 0, //0无限1有限
  939. djTime: 0, //答卷时长
  940. djNumType: 0, //0无限1有限
  941. djNum: 0, //答卷次数
  942. examsType: 1,
  943. businObj: {},
  944. draftBox: [], //草稿箱
  945. copytableData: [],
  946. localStart: false, //定时器是否已经开始
  947. pageId: "", //试卷ID
  948. uploadStatus: false, //是否同步预览
  949. };
  950. },
  951. computed: {
  952. getAllpocis() {
  953. var num = 0;
  954. this.boxtableDataPags.map((item) => {
  955. num += item.score;
  956. });
  957. return num;
  958. },
  959. computedData: function () {
  960. return function (data) {
  961. var arr = [];
  962. if (this.keyValue) {
  963. arr = data.filter((item) => {
  964. return item.content.search(this.keyValue) !== -1;
  965. });
  966. } else {
  967. arr = data;
  968. }
  969. return arr;
  970. };
  971. },
  972. },
  973. watch: {
  974. djTime: {
  975. handler(newVal, oldVal) {
  976. if (newVal === 0) {
  977. this.djTimeType = 0;
  978. } else {
  979. this.djTimeType = 1;
  980. }
  981. },
  982. // 立即处理 进入页面就触发
  983. immediate: true,
  984. },
  985. djNum: {
  986. handler(newVal, oldVal) {
  987. if (newVal === 0) {
  988. this.djNumType = 0;
  989. } else {
  990. this.djNumType = 1;
  991. }
  992. },
  993. // 立即处理 进入页面就触发
  994. immediate: true,
  995. },
  996. tableData: {
  997. handler(newVal, oldVal) {
  998. this.navText.index = newVal.length;
  999. /**
  1000. * 定时器触发机制 防止内存浪费
  1001. */
  1002. if (newVal.length) {
  1003. var a = JSON.stringify(this.tableData);
  1004. var b = JSON.stringify(this.copytableData);
  1005. if (a != b) {
  1006. if (!this.localStart) {
  1007. this.localStart = true;
  1008. this.setInterFunc();
  1009. }
  1010. }
  1011. }
  1012. },
  1013. // 立即处理 进入页面就触发
  1014. immediate: true,
  1015. },
  1016. $route: {
  1017. handler(val, oldval) {
  1018. this.localStart = false;
  1019. },
  1020. // 深度观察监听
  1021. deep: true,
  1022. },
  1023. },
  1024. created() {
  1025. this.pageId = this.$route.query.id;
  1026. },
  1027. async mounted() {
  1028. this.getInfos();
  1029. await this.getFns();
  1030. this.changeAmdis();
  1031. this.search();
  1032. },
  1033. beforeDestroy() {
  1034. this.localStart = false;
  1035. },
  1036. methods: {
  1037. openExcel() {
  1038. this.$refs.excelpop.openBoxs(this.tableData, this.businObj);
  1039. },
  1040. /**
  1041. * 返回word数据
  1042. */
  1043. backwordData(data) {
  1044. this.tableData = this.tableData.concat(data);
  1045. },
  1046. /**
  1047. * 返回数据
  1048. */
  1049. backExcelData(arr) {
  1050. this.tableData = this.tableData.concat(arr);
  1051. },
  1052. setInterFunc() {
  1053. var arr = setInterval(() => {
  1054. if (!this.localStart) {
  1055. clearInterval(arr);
  1056. return;
  1057. }
  1058. this.$methodsTools.storageSet(
  1059. "exam",
  1060. JSON.stringify({
  1061. id: this.pageId,
  1062. data: this.tableData,
  1063. })
  1064. );
  1065. }, 1500);
  1066. },
  1067. /**
  1068. * 批量删除
  1069. */
  1070. delAll() {
  1071. if (this.$refs.tableList.allCheckData.length) {
  1072. this.$confirm(
  1073. `此操作将删除已选中的${this.$refs.tableList.allCheckData.length}条题目, 是否继续?`,
  1074. "提示",
  1075. {
  1076. confirmButtonText: "确定",
  1077. cancelButtonText: "取消",
  1078. type: "warning",
  1079. }
  1080. )
  1081. .then(() => {
  1082. const dataIndedx = this.$refs.tableList.allCheckData.map((item) => {
  1083. return item.index;
  1084. });
  1085. this.tableData = this.tableData.filter((item) => {
  1086. return !dataIndedx.includes(item.index);
  1087. });
  1088. this.$refs.tableList.clearMoreActive()
  1089. this.$message({
  1090. type: "success",
  1091. message: "删除成功!",
  1092. });
  1093. })
  1094. .catch(() => {});
  1095. } else {
  1096. this.$message.warning("请勾选需要删除的题目");
  1097. return;
  1098. }
  1099. },
  1100. getInfos() {
  1101. this.$api.obtainbankexam(this.$route.query.id).then((res) => {
  1102. this.businObj = {
  1103. businessId: res.data.businessId,
  1104. businessName: res.data.businessName,
  1105. educationName: res.data.educationName,
  1106. educationTypeId: res.data.educationTypeId,
  1107. projectName: res.data.projectName,
  1108. projectId: res.data.projectId,
  1109. subjectName: res.data.subjectName,
  1110. subjectId: res.data.subjectId,
  1111. };
  1112. this.djTime = res.data.answerTime;
  1113. this.djNum = res.data.answerNum;
  1114. this.examsType = res.data.doType;
  1115. this.passScore = res.data.passScore;
  1116. });
  1117. },
  1118. // --------------------------分割线---------------------------
  1119. editInfo(v) {
  1120. this.addClick(v, 0);
  1121. },
  1122. search(v) {
  1123. this.loading = true;
  1124. this.$api
  1125. .inquirebankexamquestionList({ examId: this.$route.query.id })
  1126. .then((res) => {
  1127. res.data.map((item, index) => {
  1128. item.optionsList = JSON.parse(item.jsonStr);
  1129. item.index = index;
  1130. });
  1131. this.copytableData = JSON.parse(JSON.stringify(res.data));
  1132. this.tableData = res.data;
  1133. // this.total = res.total;
  1134. this.navText.index = res.total;
  1135. })
  1136. .finally(() => {
  1137. this.loading = false;
  1138. });
  1139. },
  1140. init() {
  1141. this.search();
  1142. },
  1143. del(v) {
  1144. this.$alert(
  1145. "确定删除此内容?<br />内容删除后将无法恢复,请慎重考虑",
  1146. "提示",
  1147. {
  1148. dangerouslyUseHTMLString: true,
  1149. }
  1150. )
  1151. .then(() => {
  1152. let index = this.tableData.findIndex((item) => {
  1153. return item.index === v.index;
  1154. });
  1155. this.tableData.splice(index, 1);
  1156. if(this.$refs.tableList.allCheckData.length){
  1157. this.$refs.tableList.allCheckData = this.$refs.tableList.allCheckData.filter(item => {
  1158. return item.index !== v.index
  1159. })
  1160. }
  1161. })
  1162. .catch(() => {
  1163. this.$message({
  1164. type: "info",
  1165. message: "已取消删除",
  1166. });
  1167. });
  1168. },
  1169. openActiveBox() {
  1170. this.radioActive = "";
  1171. this.dialogVisibleActive = true;
  1172. },
  1173. submitActive() {
  1174. if (!this.radioActive) {
  1175. this.$message.warning("请选择操作类型");
  1176. return;
  1177. }
  1178. this.dialogVisibleActive = false;
  1179. if (this.radioActive === 1) {
  1180. this.addClick();
  1181. } else {
  1182. var self = this;
  1183. this.formData = {
  1184. status: 1,
  1185. pageSize: 10,
  1186. pageNum: 1,
  1187. publishStatus: 1,
  1188. };
  1189. var data = JSON.parse(JSON.stringify(this.formData));
  1190. data.businessId = this.businObj.businessId;
  1191. data.subjectId = this.businObj.subjectId;
  1192. this.$api.inquirebankquestionList(data).then((res) => {
  1193. var aList = [];
  1194. this.tableData.map((item) => {
  1195. if (item.questionId) {
  1196. aList.push(item.questionId);
  1197. }
  1198. });
  1199. this.disCheckList = aList;
  1200. this.boxtableData = res.rows;
  1201. this.totals = res.total;
  1202. this.dialogVisibleTable = true;
  1203. this.$nextTick(function () {
  1204. self.$refs.multipleTable.clearSelection();
  1205. });
  1206. });
  1207. }
  1208. },
  1209. getDIO(int) {
  1210. if (int === 1) {
  1211. this.formData.pageNum = 1;
  1212. }
  1213. if (int === 2) {
  1214. this.formData = {
  1215. status: 1,
  1216. pageSize: 10,
  1217. pageNum: 1,
  1218. publishStatus: 1,
  1219. };
  1220. }
  1221. var data = JSON.parse(JSON.stringify(this.formData));
  1222. data.businessId = this.businObj.businessId;
  1223. data.subjectId = this.businObj.subjectId;
  1224. this.$api.inquirebankquestionList(data).then((res) => {
  1225. this.boxtableData = res.rows;
  1226. this.totals = res.total;
  1227. });
  1228. },
  1229. closeBoxsActive() {
  1230. this.dialogVisibleActive = false;
  1231. },
  1232. submitTable() {
  1233. if (this.activeLists.length === 0) {
  1234. this.dialogVisibleTable = false;
  1235. return;
  1236. }
  1237. if (this.tableData.length) {
  1238. let maxIndex = 0;
  1239. let childrenIndex = 0;
  1240. this.tableData.forEach((item) => {
  1241. if (item.sort > maxIndex) {
  1242. maxIndex = item.sort;
  1243. childrenIndex = item.index;
  1244. }
  1245. if (item.index > childrenIndex) {
  1246. childrenIndex = item.index;
  1247. }
  1248. });
  1249. this.activeLists.forEach((item, index) => {
  1250. childrenIndex++;
  1251. item.index = childrenIndex;
  1252. item.sort = maxIndex + index + 1;
  1253. item.optionsList = JSON.parse(item.jsonStr);
  1254. item.partScore = 0;
  1255. item.score = "";
  1256. });
  1257. } else {
  1258. this.activeLists.forEach((item, index) => {
  1259. item.index = index;
  1260. item.sort = index + 1;
  1261. item.optionsList = JSON.parse(item.jsonStr);
  1262. item.partScore = 0;
  1263. item.score = "";
  1264. });
  1265. }
  1266. this.activeLists.forEach((item) => {
  1267. this.tableData.push(item);
  1268. });
  1269. // this.tableData = this.tableData.concat(this.activeLists);
  1270. this.dialogVisibleTable = false;
  1271. this.$message.success("添加成功");
  1272. this.activeLists = [];
  1273. },
  1274. closeBoxsTable() {
  1275. this.dialogVisibleTable = false;
  1276. },
  1277. selectAll(value) {
  1278. this.activeLists = value;
  1279. },
  1280. select(value) {
  1281. this.activeLists = value;
  1282. },
  1283. checkboxT(row, index) {
  1284. if (this.disCheckList.indexOf(row.questionId) !== -1) {
  1285. return false;
  1286. } else {
  1287. return true;
  1288. }
  1289. },
  1290. getRowKeys(row) {
  1291. return row.questionId;
  1292. },
  1293. addClick(v, int, indexZB, uploadStatus) {
  1294. var self = this;
  1295. if (v === undefined) {
  1296. self.statusPop = 1;
  1297. self.innerVisiblePaperTopic = true;
  1298. self.showHide = true;
  1299. self.$nextTick(() => {
  1300. var data = {
  1301. type: 1,
  1302. optionsList: [],
  1303. answerQuestionList: [],
  1304. content: "",
  1305. status: "",
  1306. analysisContent: "",
  1307. answerQuestion: "",
  1308. };
  1309. for (let i = 0; i < 4; i++) {
  1310. data.optionsList.push({
  1311. content: "",
  1312. imgUrl: null,
  1313. optionsId: i + 1,
  1314. });
  1315. }
  1316. self.listNums = data;
  1317. // (self.$refs.sujects.eduType = "");
  1318. // self.$refs.sujects.courType = "";
  1319. // self.$refs.sujects.sujectApis = [];
  1320. // self.$refs.sujects.newSujectApis = [];
  1321. self.listData = {
  1322. publishStatus: 1,
  1323. };
  1324. self.activeExam = [];
  1325. });
  1326. } else {
  1327. if (uploadStatus) {
  1328. this.uploadStatus = true;
  1329. } else {
  1330. this.uploadStatus = false;
  1331. }
  1332. let newIndex = self.tableData.findIndex((item) => {
  1333. return item.index === indexZB;
  1334. });
  1335. self.innerVisiblePaperTopic = true;
  1336. self.showHide = true;
  1337. self.statusPop = int;
  1338. var vres = JSON.parse(JSON.stringify(v));
  1339. self.indexZB = newIndex;
  1340. if (vres.knowledgeIds) {
  1341. var a = [];
  1342. vres.knowledgeIds
  1343. .split(",")
  1344. .map(Number)
  1345. .map((items) => {
  1346. self.allOptions.map((item) => {
  1347. if (item.knowledgeId === items) {
  1348. a.push(item);
  1349. }
  1350. });
  1351. });
  1352. self.activeExam = a;
  1353. } else {
  1354. self.activeExam = [];
  1355. }
  1356. if (vres.type === 2) {
  1357. if (vres.answerQuestion) {
  1358. vres.answerQuestionList = vres.answerQuestion
  1359. .split(",")
  1360. .map(Number);
  1361. }
  1362. } else if (vres.type === 4) {
  1363. vres.optionsList.map((item) => {
  1364. if (item.type === 2) {
  1365. if (item.answerQuestion) {
  1366. item.answerQuestionList = item.answerQuestion
  1367. .split(",")
  1368. .map(Number);
  1369. }
  1370. } else {
  1371. item.answerQuestionList = [];
  1372. }
  1373. });
  1374. } else {
  1375. vres.answerQuestionList = [];
  1376. }
  1377. self.listData.prefixName = vres.prefixName;
  1378. self.listData.publishStatus = vres.publishStatus;
  1379. self.listNums = vres;
  1380. // var arrays = [];
  1381. // vres.businessList.map((item) => {
  1382. // arrays.push(item.businessId + "-" + item.subjectId);
  1383. // });
  1384. // self.sujectApisTable = arrays;
  1385. // self.newSujectApisTable = vres.businessList;
  1386. }
  1387. },
  1388. //-----------------------------------------------
  1389. comLs(item) {
  1390. var os = this.activeExam.some((items) => {
  1391. return items.knowledgeId === item.knowledgeId;
  1392. });
  1393. if (os) {
  1394. return true;
  1395. } else {
  1396. return false;
  1397. }
  1398. },
  1399. getFns() {
  1400. return new Promise((resolve, reject) => {
  1401. this.$api.inquireKnowledgeExamListS({ status: 1 }).then((res) => {
  1402. this.allOptions = res.rows;
  1403. resolve();
  1404. });
  1405. });
  1406. },
  1407. getSimpleText(html) {
  1408. var re1 = new RegExp("<.+?>", "g"); //匹配html标签的正则表达式,"g"是搜索匹配多个符合的内容
  1409. var msg = html.replace(re1, ""); //执行替换成空字符
  1410. return msg;
  1411. },
  1412. addBusName() {
  1413. if (this.BusName.trim()) {
  1414. var as = this.allOptions.some((item) => {
  1415. return item.knowledgeName == this.BusName;
  1416. });
  1417. if (as) {
  1418. this.$message.warning("当前知识点名称已存在");
  1419. return;
  1420. }
  1421. this.BusNameList.push(this.BusName);
  1422. this.BusName = "";
  1423. } else {
  1424. this.$message({
  1425. message: "请输入知识点内容",
  1426. type: "warning",
  1427. duration: 1200,
  1428. });
  1429. this.BusName = "";
  1430. }
  1431. },
  1432. submit() {
  1433. var data = {
  1434. examKnowledgeBusinessAddBoList: [this.businObj],
  1435. knowledgeName: this.BusNameList,
  1436. status: 1,
  1437. };
  1438. this.$api.addKnowledgeExam(data).then(async (res) => {
  1439. this.$message.success("添加成功");
  1440. this.dialogVisible = false;
  1441. await this.getFns();
  1442. this.changeAmdis();
  1443. });
  1444. },
  1445. closeBoxs() {
  1446. this.dialogVisible = false;
  1447. },
  1448. addExam() {
  1449. // if (!this.businObj.businessId) {
  1450. // this.$message.warning("请选择业务层级");
  1451. // return;
  1452. // }
  1453. this.BusNameList = [];
  1454. this.BusName = "";
  1455. this.dialogVisible = true;
  1456. },
  1457. clearBus() {
  1458. this.BusNameList.splice(index, 1);
  1459. },
  1460. //子组件回调 业务层及变换-知识点重新筛选
  1461. changeAmdis() {
  1462. var int = this.businObj.businessId;
  1463. var ao = [];
  1464. this.allOptions.map((item, index) => {
  1465. let acts = item.courseBusinessList.some((items) => {
  1466. return items.businessId === int;
  1467. });
  1468. if (acts) {
  1469. ao.push(item);
  1470. }
  1471. });
  1472. this.options = ao;
  1473. },
  1474. clearBusName(index) {
  1475. this.activeExam.splice(index, 1);
  1476. },
  1477. changeKnow(item) {
  1478. this.allOptions.map((items) => {
  1479. if (items.knowledgeId === item) {
  1480. this.activeExam.push(items);
  1481. }
  1482. });
  1483. this.value = "";
  1484. },
  1485. addListNums() {
  1486. this.listNums.push({
  1487. type: 1,
  1488. optionsList: [],
  1489. answerQuestionList: [],
  1490. content: "",
  1491. status: "",
  1492. analysisContent: "",
  1493. answerQuestion: "",
  1494. });
  1495. },
  1496. closeBefore() {
  1497. this.innerVisiblePaperTopic = false;
  1498. this.showHide = false;
  1499. },
  1500. async submitForm(formName, int) {
  1501. this.$refs[formName].validate((valid) => {
  1502. if (valid) {
  1503. var self = this;
  1504. // if (!this.$refs.sujects.newSujectApis.length) {
  1505. // this.$message.error("请选择科目");
  1506. // return;
  1507. // }
  1508. var data = this.$refs.child.getInfosPage();
  1509. if (!data.content || data.content == "<p><br></p>") {
  1510. self.$message.error("请填写题目内容");
  1511. return;
  1512. }
  1513. if (data.type != 3 && data.type != 5 && !data.optionsList.length) {
  1514. self.$message.error("请添加选项");
  1515. return;
  1516. }
  1517. if (data.type != 3 && data.type != 4 && data.optionsList.length) {
  1518. var ast = data.optionsList.some((item) => {
  1519. return !item.content && !item.imgUrl;
  1520. });
  1521. if (ast) {
  1522. self.$message.error("请完善选项内容");
  1523. return;
  1524. }
  1525. }
  1526. if (data.type != 5 && data.type != 4) {
  1527. if (data.type === 2 && !data.answerQuestionList.length) {
  1528. self.$message.error("请选择正确答案");
  1529. return;
  1530. }
  1531. if (data.type !== 2 && !data.answerQuestion) {
  1532. self.$message.error("请选择正确答案");
  1533. return;
  1534. }
  1535. }
  1536. if (data.type == 4 && data.optionsList.length) {
  1537. for (let i = 0; i < data.optionsList.length; i++) {
  1538. if (
  1539. !data.optionsList[i].content ||
  1540. data.optionsList[i].content == "<p><br></p>"
  1541. ) {
  1542. self.$message.error("请填写题目内容");
  1543. return;
  1544. }
  1545. if (
  1546. data.optionsList[i].type != 3 &&
  1547. data.optionsList[i].type != 5 &&
  1548. !data.optionsList[i].optionsList.length
  1549. ) {
  1550. self.$message.error("请添加选项");
  1551. return;
  1552. }
  1553. if (
  1554. data.optionsList[i].type != 3 &&
  1555. data.optionsList[i].optionsList.length
  1556. ) {
  1557. var ast = data.optionsList[i].optionsList.some((item) => {
  1558. return !item.content && !item.imgUrl;
  1559. });
  1560. if (ast) {
  1561. self.$message.error("请完善选项内容");
  1562. return;
  1563. }
  1564. }
  1565. if (data.optionsList[i].type != 5) {
  1566. if (
  1567. data.optionsList[i].type === 2 &&
  1568. !data.optionsList[i].answerQuestionList.length
  1569. ) {
  1570. self.$message.error("请选择正确答案");
  1571. return;
  1572. }
  1573. if (
  1574. data.optionsList[i].type !== 2 &&
  1575. !data.optionsList[i].answerQuestion
  1576. ) {
  1577. self.$message.error("请选择正确答案");
  1578. return;
  1579. }
  1580. }
  1581. }
  1582. }
  1583. var numList = [];
  1584. this.activeExam.map((item) => {
  1585. numList.push(item.knowledgeId);
  1586. });
  1587. data.knowledgeList = this.activeExam;
  1588. data.prefixName = this.listData.prefixName;
  1589. data.knowledgeIds = numList.toString();
  1590. data.publishStatus = this.listData.publishStatus;
  1591. // data.businessList = this.$refs.sujects.newSujectApis;
  1592. if (data.type === 2) {
  1593. if (data.answerQuestionList.length) {
  1594. data.answerQuestion = data.answerQuestionList.toString();
  1595. }
  1596. }
  1597. if (data.type === 4) {
  1598. data.optionsList.map((item) => {
  1599. if (item.type === 2) {
  1600. if (item.answerQuestionList.length) {
  1601. item.answerQuestion = item.answerQuestionList.toString();
  1602. }
  1603. }
  1604. });
  1605. }
  1606. if (this.statusPop === 1) {
  1607. data.businessList = [this.businObj];
  1608. data.partScore = 0;
  1609. data.score = "";
  1610. data.status = 1;
  1611. if (this.tableData.length) {
  1612. let maxIndex = 0;
  1613. let childrenIndex = 0;
  1614. this.tableData.forEach((item) => {
  1615. if (item.sort > maxIndex) {
  1616. maxIndex = item.sort;
  1617. }
  1618. if (item.index > childrenIndex) {
  1619. childrenIndex = item.index;
  1620. }
  1621. });
  1622. data.sort = maxIndex + 1;
  1623. data.index = childrenIndex + 1;
  1624. } else {
  1625. data.sort = 1;
  1626. data.index = 0;
  1627. }
  1628. this.tableData.push(data);
  1629. self.$message.success("添加成功");
  1630. self.innerVisiblePaperTopic = false;
  1631. self.showHide = false;
  1632. }
  1633. if (this.statusPop === 0) {
  1634. this.tableData.splice(this.indexZB, 1, data);
  1635. self.$message.success("修改成功");
  1636. self.innerVisiblePaperTopic = false;
  1637. self.showHide = false;
  1638. }
  1639. /**
  1640. * 核心语句👇表格定制化需要使用jsonStr字段,与题目管理同步字段,所以需要实时更新jsonStr
  1641. */
  1642. data.jsonStr = JSON.stringify(data.optionsList);
  1643. } else {
  1644. console.log("error submit!!");
  1645. return false;
  1646. }
  1647. });
  1648. },
  1649. uploadApis(item) {
  1650. return new Promise((resolve, reject) => {
  1651. this.$api.editbankquestion(item).then((res) => {
  1652. resolve();
  1653. });
  1654. });
  1655. },
  1656. addbankquestion(item) {
  1657. return new Promise((resolve, reject) => {
  1658. this.$api.addbankquestion(item).then((res) => {
  1659. resolve(res.data.questionId);
  1660. });
  1661. });
  1662. },
  1663. async submitTableAllInfos() {
  1664. var self = this;
  1665. if (this.examsType === 2) {
  1666. if (Number(this.passScore) > Number(this.getAllpocis)) {
  1667. this.$message.warning("及格分数不得大于当前总分,请重新设置分值");
  1668. return;
  1669. }
  1670. }
  1671. for (let i = 0; i < this.tableData.length; i++) {
  1672. if (!this.tableData[i].sort && this.tableData[i].sort !== 0) {
  1673. this.$message.warning(`题目管理第${i + 1}条请输入排序`);
  1674. return;
  1675. }
  1676. }
  1677. let arr = this.tableData.map((items) => {
  1678. return items.sort;
  1679. });
  1680. if (new Set(arr).size != arr.length) {
  1681. this.$message.warning("排序不允许重复");
  1682. return;
  1683. }
  1684. var arrs = [];
  1685. for (let i = this.tableData.length-1; i >= 0; i--) {
  1686. if (self.tableData[i].questionId) {
  1687. await self.uploadApis(self.tableData[i]);
  1688. } else {
  1689. var ids = await self.addbankquestion(self.tableData[i]);
  1690. self.tableData[i].questionId = ids;
  1691. }
  1692. arrs.push({
  1693. questionId: self.tableData[i].questionId,
  1694. sort: self.tableData[i].sort,
  1695. score: self.tableData[i].score,
  1696. partScore: self.tableData[i].partScore,
  1697. });
  1698. }
  1699. this.disabledBtn = true;
  1700. var data = {
  1701. examId: this.$route.query.id,
  1702. questionList: arrs,
  1703. status: 1,
  1704. passScore: this.passScore,
  1705. doType: this.examsType,
  1706. };
  1707. if (this.djTimeType === 0) {
  1708. data.answerTime = 0;
  1709. } else {
  1710. data.answerTime = this.djTime;
  1711. }
  1712. if (this.djNumType === 0) {
  1713. data.answerNum = 0;
  1714. } else {
  1715. data.answerNum = this.djNum;
  1716. }
  1717. this.$api
  1718. .editbankexam(data)
  1719. .then((res) => {
  1720. this.$message.success("编辑成功");
  1721. setTimeout(async () => {
  1722. await this.removeInfo();
  1723. this.$store.dispatch("tagsView/exitView", this.$route).then(() => {
  1724. this.$router.push({
  1725. path: "testPaperManagement",
  1726. });
  1727. });
  1728. }, 500);
  1729. })
  1730. .catch(() => {
  1731. this.disabledBtn = false;
  1732. });
  1733. },
  1734. removeInfo() {
  1735. return new Promise((resolve, reject) => {
  1736. let localStatus = this.$methodsTools.storageGet("exam");
  1737. if (localStatus) {
  1738. if (JSON.parse(localStatus).id == this.$route.query.id) {
  1739. this.$methodsTools.storageRemove("exam");
  1740. }
  1741. }
  1742. resolve();
  1743. });
  1744. },
  1745. backPage() {
  1746. this.$store.dispatch("tagsView/delView", this.$route).then((res) => {
  1747. this.$router.push({
  1748. path: "testPaperManagement",
  1749. });
  1750. });
  1751. },
  1752. emitData() {
  1753. if (!this.tableData.length) {
  1754. this.$message.warning("请添加题目");
  1755. return;
  1756. }
  1757. this.boxtableDataPags = JSON.parse(JSON.stringify(this.tableData));
  1758. this.diansBoxStatus = true;
  1759. },
  1760. closePagsInfos() {
  1761. this.diansBoxStatus = false;
  1762. },
  1763. submitPagsInfos() {
  1764. if (this.examsType === 2) {
  1765. var ast = this.boxtableDataPags.every((item) => {
  1766. if (item.type === 2) {
  1767. return item.partScore >= 0 && item.score >= 0;
  1768. } else {
  1769. return item.score >= 0;
  1770. }
  1771. });
  1772. if (!ast) {
  1773. this.$message.warning("请设置每道题目的分值");
  1774. return;
  1775. }
  1776. if (Number(this.passScore) > Number(this.getAllpocis)) {
  1777. this.$message.warning("及格分数不得大于当前总分");
  1778. return;
  1779. }
  1780. }
  1781. this.tableData = this.boxtableDataPags;
  1782. this.diansBoxStatus = false;
  1783. },
  1784. selectAllPags(value) {
  1785. this.activeListsPags = value;
  1786. },
  1787. selectPags(value) {
  1788. this.activeListsPags = value;
  1789. },
  1790. getRowKeysPags(row) {
  1791. return row.questionId;
  1792. },
  1793. activeOpens() {
  1794. if (!this.activeListsPags.length) {
  1795. this.$message.warning("请选择需要设置分值的题目");
  1796. return;
  1797. }
  1798. this.Pocis = "";
  1799. this.dialogVisibleActivePocis = true;
  1800. },
  1801. closeBoxsActivePocis() {
  1802. this.dialogVisibleActivePocis = false;
  1803. },
  1804. submitActivePocis() {
  1805. this.activeListsPags.map((item) => {
  1806. item.score = this.Pocis;
  1807. });
  1808. this.dialogVisibleActivePocis = false;
  1809. this.activeListsPags = [];
  1810. this.$refs.multipleTables.clearSelection();
  1811. },
  1812. activePicis() {
  1813. if (!this.activeListsPags.length) {
  1814. this.$message.warning("请选择需要设置分值的题目");
  1815. return;
  1816. }
  1817. this.pocisArray = {
  1818. danx: 0,
  1819. duox: 0,
  1820. pand: 0,
  1821. anli: 0,
  1822. jiand: 0,
  1823. };
  1824. for (let i = 0; i < this.activeListsPags.length; i++) {
  1825. if (this.activeListsPags[i].type === 1) {
  1826. this.pocisArray.danx++;
  1827. }
  1828. if (this.activeListsPags[i].type === 2) {
  1829. this.pocisArray.duox++;
  1830. }
  1831. if (this.activeListsPags[i].type === 3) {
  1832. this.pocisArray.pand++;
  1833. }
  1834. if (this.activeListsPags[i].type === 4) {
  1835. this.pocisArray.anli++;
  1836. }
  1837. if (this.activeListsPags[i].type === 5) {
  1838. this.pocisArray.jiand++;
  1839. }
  1840. }
  1841. this.Pocis1 = "";
  1842. this.Pocis2 = "";
  1843. this.Pocis2s = "";
  1844. this.Pocis3 = "";
  1845. this.Pocis4 = "";
  1846. this.Pocis5 = "";
  1847. this.dialogVisibleActivePLPoics = true;
  1848. },
  1849. closeBoxsActivePLPoics() {
  1850. this.dialogVisibleActivePLPoics = false;
  1851. },
  1852. submitActivePLPoics() {
  1853. this.activeListsPags.map((item) => {
  1854. if (item.type === 1) {
  1855. item.score = this.Pocis1;
  1856. }
  1857. if (item.type === 2) {
  1858. item.score = this.Pocis2;
  1859. item.partScore = this.Pocis2s;
  1860. }
  1861. if (item.type === 3) {
  1862. item.score = this.Pocis3;
  1863. }
  1864. if (item.type === 4) {
  1865. item.score = this.Pocis4;
  1866. }
  1867. if (item.type === 5) {
  1868. item.score = this.Pocis5;
  1869. }
  1870. });
  1871. this.dialogVisibleActivePLPoics = false;
  1872. this.activeListsPags = [];
  1873. this.$refs.multipleTables.clearSelection();
  1874. },
  1875. inits() {
  1876. this.getDIO(2);
  1877. },
  1878. handleSizeChange(v) {
  1879. this.formData.pageSize = v;
  1880. this.formData.pageNum = 1;
  1881. this.getDIO();
  1882. },
  1883. handleCurrentChange(v) {
  1884. this.formData.pageNum = v;
  1885. this.getDIO();
  1886. },
  1887. },
  1888. };
  1889. </script>
  1890. <style lang="less" scoped>
  1891. .boxWidth {
  1892. width: 700px;
  1893. }
  1894. .numInputs {
  1895. width: 150px;
  1896. }
  1897. .checkboxSty {
  1898. max-height: 210px;
  1899. overflow: auto;
  1900. display: flex;
  1901. flex-direction: column;
  1902. }
  1903. .listBoxStys {
  1904. flex-shrink: 0;
  1905. padding: 0px 10px;
  1906. border-radius: 8px;
  1907. border: 1px solid #eee;
  1908. margin-right: 10px;
  1909. margin-bottom: 6px;
  1910. }
  1911. .closeIcons {
  1912. color: red;
  1913. cursor: pointer;
  1914. margin-left: 6px;
  1915. }
  1916. .ach {
  1917. display: flex;
  1918. align-items: center;
  1919. overflow: hidden;
  1920. }
  1921. .clh {
  1922. display: flex;
  1923. align-items: center;
  1924. flex-wrap: wrap;
  1925. }
  1926. .imgBoxins {
  1927. width: 375px;
  1928. height: 220px;
  1929. text-align: center;
  1930. img {
  1931. height: 100%;
  1932. }
  1933. }
  1934. .iconStsz {
  1935. font-size: 40px;
  1936. color: #67c23a;
  1937. cursor: pointer;
  1938. }
  1939. .BusBoxs {
  1940. min-height: 100px;
  1941. border: 1px solid #a4a4a4;
  1942. margin-bottom: 10px;
  1943. border-radius: 8px;
  1944. max-height: 280px;
  1945. padding: 10px;
  1946. overflow-y: auto;
  1947. .fot_Le {
  1948. border-radius: 12px;
  1949. border: 1px solid yellowgreen;
  1950. padding: 0px 10px;
  1951. height: 30px;
  1952. line-height: 30px;
  1953. text-align: center;
  1954. float: left;
  1955. margin-right: 6px;
  1956. margin-bottom: 6px;
  1957. .icon_clear {
  1958. margin-left: 2px;
  1959. font-size: 15px;
  1960. color: #f56c6c;
  1961. cursor: pointer;
  1962. }
  1963. }
  1964. }
  1965. .marg_play {
  1966. display: flex;
  1967. margin-bottom: 15px;
  1968. .spans {
  1969. text-align: right;
  1970. width: 80px;
  1971. }
  1972. }
  1973. /deep/.el-button {
  1974. border-radius: 8px;
  1975. }
  1976. /deep/.el-dialog {
  1977. border-radius: 8px;
  1978. .el-dialog__header {
  1979. padding: 0;
  1980. .hearders {
  1981. height: 40px;
  1982. display: flex;
  1983. align-items: center;
  1984. justify-content: space-between;
  1985. padding: 0px 18px 0px 20px;
  1986. border-bottom: 1px solid #e2e2e2;
  1987. .leftTitle {
  1988. font-size: 14px;
  1989. font-weight: bold;
  1990. color: #2f4378;
  1991. }
  1992. .rightBoxs {
  1993. display: flex;
  1994. align-items: center;
  1995. img {
  1996. width: 14px;
  1997. height: 14px;
  1998. margin-left: 13px;
  1999. cursor: pointer;
  2000. }
  2001. }
  2002. }
  2003. }
  2004. .el-dialog__footer {
  2005. padding: 0;
  2006. .dialog-footer {
  2007. padding: 0px 40px;
  2008. height: 70px;
  2009. border-top: 1px solid #e2e2e2;
  2010. display: flex;
  2011. align-items: center;
  2012. justify-content: center;
  2013. }
  2014. }
  2015. }
  2016. .centerStys {
  2017. display: flex;
  2018. align-items: center;
  2019. justify-content: center;
  2020. margin-top: 18px;
  2021. }
  2022. .dis_fos {
  2023. align-items: flex-end;
  2024. display: flex;
  2025. justify-content: space-between;
  2026. }
  2027. .margin_bs {
  2028. margin-bottom: 6px;
  2029. }
  2030. </style>