index.vue 56 KB

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