index.vue 57 KB

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