index.vue 59 KB

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