InsertPaperStructureInfo.vue 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247
  1. <template>
  2. <section class="content">
  3. <LinkTitlesCustom :current-paths="['题型创建', detailName]" />
  4. <!-- 正文信息 -->
  5. <div class="box-body">
  6. <el-form
  7. ref="paperUnitForm"
  8. :inline="true"
  9. :model="paperUnitForm"
  10. :rules="rules"
  11. label-position="right"
  12. label-width="78px"
  13. >
  14. <el-row>
  15. <el-col :span="6">
  16. <el-form-item label="题型结构" prop="questionType">
  17. <el-select
  18. v-model="paperUnitForm.questionType"
  19. class="search_width"
  20. placeholder="请选择"
  21. size="small"
  22. @change="getQuesNameList"
  23. >
  24. <el-option
  25. v-for="item in quesTypes"
  26. :key="item.value"
  27. :label="item.label"
  28. :value="item.value"
  29. ></el-option>
  30. </el-select>
  31. </el-form-item>
  32. </el-col>
  33. <el-col :span="6">
  34. <el-form-item label="每题分值" prop="score">
  35. <el-input
  36. v-model.number="paperUnitForm.score"
  37. class="search_width"
  38. placeholder="请输入"
  39. size="small"
  40. @change="muli"
  41. ></el-input>
  42. </el-form-item>
  43. </el-col>
  44. <el-col :span="6">
  45. <el-form-item label="题目数量" prop="count">
  46. <el-input
  47. v-model.number="paperUnitForm.count"
  48. class="search_width_80px"
  49. :disabled="true"
  50. >
  51. </el-input>
  52. <el-button
  53. icon="el-icon-plus"
  54. @click="propertyDialog = true"
  55. ></el-button>
  56. </el-form-item>
  57. </el-col>
  58. </el-row>
  59. <el-row>
  60. <el-col :span="6">
  61. <el-form-item label="题型总分" prop="totalScore">
  62. <el-input
  63. v-model="paperUnitForm.totalScore"
  64. class="search_width"
  65. :disabled="true"
  66. size="small"
  67. ></el-input>
  68. </el-form-item>
  69. </el-col>
  70. <el-col :span="6">
  71. <el-form-item label="来源大题" prop="quesNames">
  72. <el-select
  73. v-model="paperUnitForm.quesNames"
  74. class="search_width"
  75. multiple
  76. placeholder="请选择"
  77. size="small"
  78. >
  79. <el-option
  80. v-for="item in quesNameList"
  81. :key="item.code"
  82. :label="item.name"
  83. :value="item.code"
  84. ></el-option>
  85. </el-select>
  86. </el-form-item>
  87. </el-col>
  88. <el-col :span="6">
  89. <div class="search_down">
  90. <el-button
  91. size="small"
  92. type="primary"
  93. @click="submitForm('paperUnitForm')"
  94. >保 存</el-button
  95. >
  96. <el-button size="small" @click="resetForm('paperUnitForm')"
  97. ><i class="el-icon-refresh"></i> 重 置</el-button
  98. >
  99. <el-button
  100. size="small"
  101. type="primary"
  102. icon="el-icon-arrow-left"
  103. @click="back"
  104. >返 回</el-button
  105. >
  106. </div>
  107. </el-col>
  108. </el-row>
  109. </el-form>
  110. <div
  111. style="width: 100%; border-bottom: 1px solid #ddd; margin: 10px 0"
  112. ></div>
  113. <!-- 页面列表 -->
  114. <el-table
  115. :data="unitStructs"
  116. border
  117. style="width: 100%; text-align: center"
  118. >
  119. <el-table-column label="大题名称" width="100">
  120. <template slot-scope="scope">
  121. <span v-if="false">{{ scope.detailName }}</span>
  122. <span>{{ detailName }}</span>
  123. </template>
  124. </el-table-column>
  125. <el-table-column label="题型结构" width="80">
  126. <template slot-scope="scope">
  127. <span>{{ getQuesTypeName(scope.row.questionType) }}</span>
  128. </template>
  129. </el-table-column>
  130. <el-table-column label="题目总数" width="80">
  131. <template slot-scope="scope">
  132. <span>{{ scope.row.count }}</span>
  133. </template>
  134. </el-table-column>
  135. <el-table-column label="公开(简单)" width="88">
  136. <template slot-scope="scope">
  137. <span>{{ scope.row.publicSimple }}</span>
  138. </template>
  139. </el-table-column>
  140. <el-table-column label="公开(中等)" width="88">
  141. <template slot-scope="scope">
  142. <span>{{ scope.row.publicMedium }}</span>
  143. </template>
  144. </el-table-column>
  145. <el-table-column label="公开(困难)" width="88">
  146. <template slot-scope="scope">
  147. <span>{{ scope.row.publicDifficulty }}</span>
  148. </template>
  149. </el-table-column>
  150. <el-table-column label="非公开(简单)" width="102">
  151. <template slot-scope="scope">
  152. <span>{{ scope.row.noPublicSimple }}</span>
  153. </template>
  154. </el-table-column>
  155. <el-table-column label="非公开(中等)" width="102">
  156. <template slot-scope="scope">
  157. <span>{{ scope.row.noPublicMedium }}</span>
  158. </template>
  159. </el-table-column>
  160. <el-table-column label="非公开(困难)" width="102">
  161. <template slot-scope="scope">
  162. <span>{{ scope.row.noPublicDifficulty }}</span>
  163. </template>
  164. </el-table-column>
  165. <el-table-column label="每题分值" width="80">
  166. <template slot-scope="scope">
  167. <span>{{ scope.row.score }}</span>
  168. </template>
  169. </el-table-column>
  170. <el-table-column label="题型总分" width="80">
  171. <template slot-scope="scope">
  172. <span>{{ scope.row.totalScore }}</span>
  173. </template>
  174. </el-table-column>
  175. <el-table-column label="来源大题" width="150">
  176. <template slot-scope="scope">
  177. <span>{{ getQuesNames(scope.row.quesNames) }}</span>
  178. </template>
  179. </el-table-column>
  180. <el-table-column label="操作" width="175">
  181. <template slot-scope="scope">
  182. <div class="operate_left">
  183. <el-button
  184. size="mini"
  185. type="primary"
  186. @click="openPaperDetailUnitStructDialog(scope.row.id)"
  187. ><i class="el-icon-edit"></i>编辑</el-button
  188. >
  189. <el-button
  190. size="mini"
  191. type="danger"
  192. @click="deleteUnit(scope.row.id)"
  193. ><i class="el-icon-delete"></i> 删除</el-button
  194. >
  195. </div>
  196. </template>
  197. </el-table-column>
  198. </el-table>
  199. <!-- 小题信息 -->
  200. <el-dialog title="小题信息" :visible.sync="paperDetailUnitStructDialog">
  201. <div>
  202. <el-form
  203. ref="paperUnitForm2"
  204. :inline="true"
  205. :model="paperUnitForm2"
  206. :rules="rules"
  207. >
  208. <el-row>
  209. <el-col :span="12">
  210. <el-form-item
  211. label="题型结构"
  212. prop="questionType"
  213. label-width="78px"
  214. >
  215. <el-select
  216. v-model="paperUnitForm2.questionType"
  217. class="form_width"
  218. placeholder="请选择"
  219. @change="getQuesNameList"
  220. >
  221. <el-option
  222. v-for="item in quesTypes"
  223. :key="item.value"
  224. :label="item.label"
  225. :value="item.value"
  226. ></el-option>
  227. </el-select>
  228. </el-form-item>
  229. </el-col>
  230. <el-col :span="12">
  231. <el-form-item label="每题分值" prop="score" label-width="78px">
  232. <el-input
  233. v-model.number="paperUnitForm2.score"
  234. class="form_width"
  235. placeholder="请输入"
  236. @change="muli2"
  237. ></el-input>
  238. </el-form-item>
  239. </el-col>
  240. </el-row>
  241. <el-row>
  242. <el-col :span="12">
  243. <el-form-item
  244. label="题型总分"
  245. prop="totalScore"
  246. label-width="78px"
  247. >
  248. <el-input
  249. v-model="paperUnitForm2.totalScore"
  250. class="form_width"
  251. :disabled="true"
  252. ></el-input>
  253. </el-form-item>
  254. </el-col>
  255. <el-col :span="12">
  256. <el-form-item
  257. label="来源大题"
  258. prop="quesNames"
  259. label-width="78px"
  260. >
  261. <el-select
  262. v-model="paperUnitForm2.quesNames"
  263. class="form_width"
  264. multiple
  265. placeholder="请选择"
  266. >
  267. <el-option
  268. v-for="item in quesNameList"
  269. :key="item.code"
  270. :label="item.name"
  271. :value="item.code"
  272. ></el-option>
  273. </el-select>
  274. </el-form-item>
  275. </el-col>
  276. </el-row>
  277. <el-row :gutter="20">
  278. <el-col :span="6">
  279. <div class="grid-content bg-purple">
  280. <div class="form_font_size">公开(简单)</div>
  281. </div>
  282. </el-col>
  283. <el-col :span="6">
  284. <div class="grid-content bg-purple">
  285. <div class="form_font_size">公开(中等)</div>
  286. </div>
  287. </el-col>
  288. <el-col :span="6">
  289. <div class="grid-content bg-purple">
  290. <div class="form_font_size">公开(困难)</div>
  291. </div>
  292. </el-col>
  293. <el-col :span="6">
  294. <div class="grid-content bg-purple">
  295. <div class="form_font_size">公开总数</div>
  296. </div>
  297. </el-col>
  298. </el-row>
  299. <!-- 第二列 -->
  300. <el-row :gutter="20">
  301. <el-col :span="6">
  302. <div class="grid-content bg-purple">
  303. <el-input
  304. v-model="paperUnitForm2.publicSimple"
  305. @change="
  306. unitCount(
  307. paperUnitForm2.publicSimple,
  308. 'publicSimple',
  309. paperUnitForm2
  310. )
  311. "
  312. ></el-input>
  313. </div>
  314. </el-col>
  315. <el-col :span="6">
  316. <div class="grid-content bg-purple">
  317. <el-input
  318. v-model="paperUnitForm2.publicMedium"
  319. @change="
  320. unitCount(
  321. paperUnitForm2.publicMedium,
  322. 'publicMedium',
  323. paperUnitForm2
  324. )
  325. "
  326. ></el-input>
  327. </div>
  328. </el-col>
  329. <el-col :span="6">
  330. <div class="grid-content bg-purple">
  331. <el-input
  332. v-model="paperUnitForm2.publicDifficulty"
  333. @change="
  334. unitCount(
  335. paperUnitForm2.publicDifficulty,
  336. 'publicDifficulty',
  337. paperUnitForm2
  338. )
  339. "
  340. ></el-input>
  341. </div>
  342. </el-col>
  343. <el-col :span="6">
  344. <div class="grid-content bg-purple">
  345. <el-input
  346. v-model="paperUnitForm2.publicSum"
  347. :disabled="true"
  348. ></el-input>
  349. </div>
  350. </el-col>
  351. </el-row>
  352. <el-row :gutter="20">
  353. <el-col :span="6">
  354. <div class="grid-content bg-purple">
  355. <div class="form_font_size">非公开(简单)</div>
  356. </div>
  357. </el-col>
  358. <el-col :span="6">
  359. <div class="grid-content bg-purple">
  360. <div class="form_font_size">非公开(中等)</div>
  361. </div>
  362. </el-col>
  363. <el-col :span="6">
  364. <div class="grid-content bg-purple">
  365. <div class="form_font_size">非公开(困难)</div>
  366. </div>
  367. </el-col>
  368. <el-col :span="6">
  369. <div class="grid-content bg-purple">
  370. <div class="form_font_size">非公开总数</div>
  371. </div>
  372. </el-col>
  373. </el-row>
  374. <!-- 第四列 -->
  375. <el-row :gutter="20">
  376. <el-col :span="6">
  377. <div class="grid-content bg-purple">
  378. <el-input
  379. v-model="paperUnitForm2.noPublicSimple"
  380. @change="
  381. unitCount(
  382. paperUnitForm2.noPublicSimple,
  383. 'noPublicSimple',
  384. paperUnitForm2
  385. )
  386. "
  387. ></el-input>
  388. </div>
  389. </el-col>
  390. <el-col :span="6">
  391. <div class="grid-content bg-purple">
  392. <el-input
  393. v-model="paperUnitForm2.noPublicMedium"
  394. @change="
  395. unitCount(
  396. paperUnitForm2.noPublicMedium,
  397. 'noPublicMedium',
  398. paperUnitForm2
  399. )
  400. "
  401. ></el-input>
  402. </div>
  403. </el-col>
  404. <el-col :span="6">
  405. <div class="grid-content bg-purple">
  406. <el-input
  407. v-model="paperUnitForm2.noPublicDifficulty"
  408. @change="
  409. unitCount(
  410. paperUnitForm2.noPublicDifficulty,
  411. 'noPublicDifficulty',
  412. paperUnitForm2
  413. )
  414. "
  415. ></el-input>
  416. </div>
  417. </el-col>
  418. <el-col :span="6">
  419. <div class="grid-content bg-purple">
  420. <el-input
  421. v-model="paperUnitForm2.noPublicSum"
  422. :disabled="true"
  423. ></el-input>
  424. </div>
  425. </el-col>
  426. </el-row>
  427. <el-row :gutter="20">
  428. <el-col :span="6">
  429. <div class="grid-content bg-purple">
  430. <div class="form_font_size">简单总数</div>
  431. </div>
  432. </el-col>
  433. <el-col :span="6">
  434. <div class="grid-content bg-purple">
  435. <div class="form_font_size">中等总数</div>
  436. </div>
  437. </el-col>
  438. <el-col :span="6">
  439. <div class="grid-content bg-purple">
  440. <div class="form_font_size">困难总数</div>
  441. </div>
  442. </el-col>
  443. <el-col :span="6">
  444. <div class="grid-content bg-purple">
  445. <div class="form_font_size">总数</div>
  446. </div>
  447. </el-col>
  448. </el-row>
  449. <!-- 第六列 -->
  450. <el-row :gutter="20">
  451. <el-col :span="6">
  452. <div class="grid-content bg-purple">
  453. <el-input
  454. v-model="paperUnitForm2.simpleSum"
  455. :disabled="true"
  456. ></el-input>
  457. </div>
  458. </el-col>
  459. <el-col :span="6">
  460. <div class="grid-content bg-purple">
  461. <el-input
  462. v-model="paperUnitForm2.mediumSum"
  463. :disabled="true"
  464. ></el-input>
  465. </div>
  466. </el-col>
  467. <el-col :span="6">
  468. <div class="grid-content bg-purple">
  469. <el-input
  470. v-model="paperUnitForm2.difficultySum"
  471. :disabled="true"
  472. ></el-input>
  473. </div>
  474. </el-col>
  475. <el-col :span="6">
  476. <div class="grid-content bg-purple">
  477. <el-input
  478. v-model="paperUnitForm2.count"
  479. :disabled="true"
  480. ></el-input>
  481. </div>
  482. </el-col>
  483. </el-row>
  484. <el-row>
  485. <div style="margin-left: 45%">
  486. <el-button
  487. type="primary"
  488. @click="editSubmitForm('paperUnitForm2')"
  489. >保 存</el-button
  490. >
  491. </div>
  492. </el-row>
  493. </el-form>
  494. </div>
  495. </el-dialog>
  496. <!-- 设置题目数量弹框 -->
  497. <el-dialog title="题目数量" :visible.sync="propertyDialog">
  498. <el-row :gutter="20">
  499. <el-col :span="6">
  500. <div class="grid-content bg-purple">
  501. <div class="form_font_size">公开(简单)</div>
  502. </div>
  503. </el-col>
  504. <el-col :span="6">
  505. <div class="grid-content bg-purple">
  506. <div class="form_font_size">公开(中等)</div>
  507. </div>
  508. </el-col>
  509. <el-col :span="6">
  510. <div class="grid-content bg-purple">
  511. <div class="form_font_size">公开(困难)</div>
  512. </div>
  513. </el-col>
  514. <el-col :span="6">
  515. <div class="grid-content bg-purple">
  516. <div class="form_font_size">公开总数</div>
  517. </div>
  518. </el-col>
  519. </el-row>
  520. <!-- 第二列 -->
  521. <el-row :gutter="20">
  522. <el-col :span="6">
  523. <div class="grid-content bg-purple">
  524. <el-input
  525. v-model="paperUnitForm.publicSimple"
  526. @change="
  527. unitCount(
  528. paperUnitForm.publicSimple,
  529. 'publicSimple',
  530. paperUnitForm
  531. )
  532. "
  533. ></el-input>
  534. </div>
  535. </el-col>
  536. <el-col :span="6">
  537. <div class="grid-content bg-purple">
  538. <el-input
  539. v-model="paperUnitForm.publicMedium"
  540. @change="
  541. unitCount(
  542. paperUnitForm.publicMedium,
  543. 'publicMedium',
  544. paperUnitForm
  545. )
  546. "
  547. ></el-input>
  548. </div>
  549. </el-col>
  550. <el-col :span="6">
  551. <div class="grid-content bg-purple">
  552. <el-input
  553. v-model="paperUnitForm.publicDifficulty"
  554. @change="
  555. unitCount(
  556. paperUnitForm.publicDifficulty,
  557. 'publicDifficulty',
  558. paperUnitForm
  559. )
  560. "
  561. ></el-input>
  562. </div>
  563. </el-col>
  564. <el-col :span="6">
  565. <div class="grid-content bg-purple">
  566. <el-input
  567. v-model="paperUnitForm.publicSum"
  568. :disabled="true"
  569. ></el-input>
  570. </div>
  571. </el-col>
  572. </el-row>
  573. <el-row :gutter="20">
  574. <el-col :span="6">
  575. <div class="grid-content bg-purple">
  576. <div class="form_font_size">非公开(简单)</div>
  577. </div>
  578. </el-col>
  579. <el-col :span="6">
  580. <div class="grid-content bg-purple">
  581. <div class="form_font_size">非公开(中等)</div>
  582. </div>
  583. </el-col>
  584. <el-col :span="6">
  585. <div class="grid-content bg-purple">
  586. <div class="form_font_size">非公开(困难)</div>
  587. </div>
  588. </el-col>
  589. <el-col :span="6">
  590. <div class="grid-content bg-purple">
  591. <div class="form_font_size">非公开总数</div>
  592. </div>
  593. </el-col>
  594. </el-row>
  595. <!-- 第四列 -->
  596. <el-row :gutter="20">
  597. <el-col :span="6">
  598. <div class="grid-content bg-purple">
  599. <el-input
  600. v-model="paperUnitForm.noPublicSimple"
  601. @change="
  602. unitCount(
  603. paperUnitForm.noPublicSimple,
  604. 'noPublicSimple',
  605. paperUnitForm
  606. )
  607. "
  608. ></el-input>
  609. </div>
  610. </el-col>
  611. <el-col :span="6">
  612. <div class="grid-content bg-purple">
  613. <el-input
  614. v-model="paperUnitForm.noPublicMedium"
  615. @change="
  616. unitCount(
  617. paperUnitForm.noPublicMedium,
  618. 'noPublicMedium',
  619. paperUnitForm
  620. )
  621. "
  622. ></el-input>
  623. </div>
  624. </el-col>
  625. <el-col :span="6">
  626. <div class="grid-content bg-purple">
  627. <el-input
  628. v-model="paperUnitForm.noPublicDifficulty"
  629. @change="
  630. unitCount(
  631. paperUnitForm.noPublicDifficulty,
  632. 'noPublicDifficulty',
  633. paperUnitForm
  634. )
  635. "
  636. ></el-input>
  637. </div>
  638. </el-col>
  639. <el-col :span="6">
  640. <div class="grid-content bg-purple">
  641. <el-input
  642. v-model="paperUnitForm.noPublicSum"
  643. :disabled="true"
  644. ></el-input>
  645. </div>
  646. </el-col>
  647. </el-row>
  648. <el-row :gutter="20">
  649. <el-col :span="6">
  650. <div class="grid-content bg-purple">
  651. <div class="form_font_size">简单总数</div>
  652. </div>
  653. </el-col>
  654. <el-col :span="6">
  655. <div class="grid-content bg-purple">
  656. <div class="form_font_size">中等总数</div>
  657. </div>
  658. </el-col>
  659. <el-col :span="6">
  660. <div class="grid-content bg-purple">
  661. <div class="form_font_size">困难总数</div>
  662. </div>
  663. </el-col>
  664. <el-col :span="6">
  665. <div class="grid-content bg-purple">
  666. <div class="form_font_size">总数</div>
  667. </div>
  668. </el-col>
  669. </el-row>
  670. <!-- 第六列 -->
  671. <el-row :gutter="20">
  672. <el-col :span="6">
  673. <div class="grid-content bg-purple">
  674. <el-input
  675. v-model="paperUnitForm.simpleSum"
  676. :disabled="true"
  677. ></el-input>
  678. </div>
  679. </el-col>
  680. <el-col :span="6">
  681. <div class="grid-content bg-purple">
  682. <el-input
  683. v-model="paperUnitForm.mediumSum"
  684. :disabled="true"
  685. ></el-input>
  686. </div>
  687. </el-col>
  688. <el-col :span="6">
  689. <div class="grid-content bg-purple">
  690. <el-input
  691. v-model="paperUnitForm.difficultySum"
  692. :disabled="true"
  693. ></el-input>
  694. </div>
  695. </el-col>
  696. <el-col :span="6">
  697. <div class="grid-content bg-purple">
  698. <el-input
  699. v-model="paperUnitForm.count"
  700. :disabled="true"
  701. ></el-input>
  702. </div>
  703. </el-col>
  704. </el-row>
  705. <div style="margin-top: 20px; margin-left: 42%">
  706. <el-button type="primary" @click="propertyDialog = false"
  707. >保 存</el-button
  708. >
  709. <el-button type="primary" @click="propertyDialog = false"
  710. >返 回</el-button
  711. >
  712. </div>
  713. </el-dialog>
  714. </div>
  715. </section>
  716. </template>
  717. <script>
  718. import { QUESTION_API } from "@/constants/constants";
  719. import { QUESTION_TYPES } from "../constants/constants";
  720. import _ from "lodash";
  721. import LinkTitlesCustom from "@/components/LinkTitlesCustom.vue";
  722. export default {
  723. components: { LinkTitlesCustom },
  724. data() {
  725. var checkIntegerNumber = (rule, value, callback) => {
  726. if (!value) {
  727. return callback(new Error("数值不能为空"));
  728. }
  729. setTimeout(() => {
  730. if (!Number.isInteger(value)) {
  731. callback(new Error("请输入整数"));
  732. } else {
  733. if (value < 0) {
  734. callback(new Error("必须大于0"));
  735. } else {
  736. callback();
  737. }
  738. }
  739. }, 100);
  740. };
  741. var checkDoubleNumber = (rule, value, callback) => {
  742. //var reg = /^[-\+]?\d+(\.\d+)?$/;
  743. var reg = /^\d+(?=\.{0,1}\d+$|$)/;
  744. if (!value) {
  745. return callback(new Error("数值不能为空"));
  746. }
  747. setTimeout(() => {
  748. if (!reg.test(value)) {
  749. callback(new Error("请输入数值"));
  750. } else {
  751. if (value < 0) {
  752. callback(new Error("必须大于等于0"));
  753. } else {
  754. callback();
  755. }
  756. }
  757. }, 100);
  758. };
  759. var validateQuesNames = (rule, value, callback) => {
  760. if (Array.isArray(value) && value.length == 0) {
  761. callback(new Error("请选择来源大题"));
  762. } else {
  763. callback();
  764. }
  765. };
  766. return {
  767. quesTypes: QUESTION_TYPES,
  768. courseNo: "",
  769. quesNameList: [],
  770. paperUnitForm: {
  771. id: "",
  772. questionType: "",
  773. count: 0,
  774. score: "",
  775. totalScore: "",
  776. quesNames: [],
  777. publicSimple: 0,
  778. publicMedium: 0,
  779. publicDifficulty: 0,
  780. noPublicSimple: 0,
  781. noPublicMedium: 0,
  782. noPublicDifficulty: 0,
  783. publicSum: 0,
  784. noPublicSum: 0,
  785. simpleSum: 0,
  786. mediumSum: 0,
  787. difficultySum: 0,
  788. },
  789. paperUnitForm2: {
  790. id: "",
  791. questionType: "",
  792. count: "",
  793. score: "",
  794. totalScore: "",
  795. quesNames: [],
  796. publicSimple: 0,
  797. publicMedium: 0,
  798. publicDifficulty: 0,
  799. noPublicSimple: 0,
  800. noPublicMedium: 0,
  801. noPublicDifficulty: 0,
  802. publicSum: 0,
  803. noPublicSum: 0,
  804. simpleSum: 0,
  805. mediumSum: 0,
  806. difficultySum: 0,
  807. },
  808. unitId: "",
  809. detailName: "",
  810. detailId: "",
  811. paperStructId: "",
  812. paperStruct: {},
  813. unitStructs: [],
  814. paperDetailUnitStructDialog: false,
  815. propertyDialog: false,
  816. rules: {
  817. questionType: [
  818. { required: true, message: "题型不能为空", trigger: "change" },
  819. ],
  820. count: [
  821. { validator: checkIntegerNumber, required: true, trigger: "blur" },
  822. ],
  823. score: [
  824. { required: true, validator: checkDoubleNumber, trigger: "blur" },
  825. ],
  826. quesNames: [{ validator: validateQuesNames, trigger: "change" }],
  827. },
  828. };
  829. },
  830. computed: {
  831. totalScore() {
  832. var sum = 0.0;
  833. for (let unitStruct of this.unitStructs) {
  834. sum += unitStruct.totalScore;
  835. }
  836. return sum;
  837. },
  838. detailCount() {
  839. var count = 0.0;
  840. for (let unitStruct of this.unitStructs) {
  841. count += unitStruct.count;
  842. }
  843. return count;
  844. },
  845. quesNames() {
  846. var quesNames = [];
  847. for (let quesName of this.quesNameList) {
  848. quesNames.push(quesName.code);
  849. }
  850. return quesNames;
  851. },
  852. },
  853. //初始化查询
  854. created() {
  855. this.paperStructId = this.$route.params.id;
  856. this.detailName = this.$route.params.name;
  857. this.detailId = this.$route.params.detailId;
  858. this.courseNo = this.$route.params.courseNo;
  859. this.searchForm();
  860. },
  861. methods: {
  862. //查询来源大题名称
  863. getQuesNameList(quesType) {
  864. if (quesType && quesType.length > 0) {
  865. var quesTypeObj = {};
  866. var url = QUESTION_API + "/paperStruct/quesNames";
  867. if (this.courseNo !== "all") {
  868. quesTypeObj = {
  869. quesType: quesType,
  870. courseNo: this.courseNo,
  871. };
  872. } else {
  873. quesTypeObj = {
  874. quesType: quesType,
  875. };
  876. }
  877. this.$http.get(url, { params: quesTypeObj }).then((response) => {
  878. console.log(response);
  879. this.quesNameList = response.data;
  880. if (this.quesNameList != null) {
  881. for (let quesName of this.quesNameList) {
  882. if (quesName.name.length > 50) {
  883. quesName.name = quesName.name.substring(0, 50) + "...";
  884. }
  885. }
  886. }
  887. this.initQuesNames();
  888. });
  889. }
  890. },
  891. initQuesNames() {
  892. var arr1 = _.difference(this.paperUnitForm.quesNames, this.quesNames);
  893. if (arr1.length > 0) {
  894. this.paperUnitForm.quesNames = [];
  895. }
  896. var arr2 = _.difference(this.paperUnitForm2.quesNames, this.quesNames);
  897. if (arr2.length > 0) {
  898. this.paperUnitForm2.quesNames = [];
  899. }
  900. },
  901. getQuesNames(quesNameList) {
  902. var quesNameStr = "";
  903. if (!Array.isArray(quesNameList)) {
  904. return quesNameStr;
  905. }
  906. for (let quesName of quesNameList) {
  907. if (quesNameStr === "") {
  908. quesNameStr += quesName;
  909. } else {
  910. quesNameStr += "," + quesName;
  911. }
  912. }
  913. return quesNameStr;
  914. },
  915. //查询列表集合
  916. searchForm() {
  917. this.loading = true;
  918. var paperStructStorge = sessionStorage.getItem("paperStruct");
  919. if (typeof paperStructStorge === "string") {
  920. var paperStruct = JSON.parse(paperStructStorge);
  921. this.paperStruct = paperStruct;
  922. this.unitStructs = this.getUnits();
  923. console.log("this.unitStructs:", this.unitStructs);
  924. }
  925. },
  926. //保存
  927. submitForm(formData) {
  928. this.loading = true;
  929. this.$refs[formData].validate((valid) => {
  930. if (valid) {
  931. var unitStruct = Object.assign({}, this.paperUnitForm);
  932. var ids = [];
  933. for (let unitStruct of this.unitStructs) {
  934. ids.push(unitStruct.id);
  935. }
  936. ids.sort();
  937. var maxId;
  938. if (ids.length == 0) {
  939. maxId = 1;
  940. } else {
  941. maxId = ids[ids.length - 1];
  942. }
  943. unitStruct.id = maxId + 1;
  944. this.unitStructs.push(unitStruct);
  945. this.resetForm(formData);
  946. this.paperUnitForm.publicSimple = 0;
  947. this.paperUnitForm.publicMedium = 0;
  948. this.paperUnitForm.publicDifficulty = 0;
  949. this.paperUnitForm.noPublicSimple = 0;
  950. this.paperUnitForm.noPublicMedium = 0;
  951. this.paperUnitForm.noPublicDifficulty = 0;
  952. this.paperUnitForm.publicSum = 0;
  953. this.paperUnitForm.noPublicSum = 0;
  954. this.paperUnitForm.simpleSum = 0;
  955. this.paperUnitForm.mediumSum = 0;
  956. this.paperUnitForm.difficultySum = 0;
  957. this.setUnits();
  958. sessionStorage.setItem(
  959. "paperStruct",
  960. JSON.stringify(this.paperStruct)
  961. );
  962. } else {
  963. return false;
  964. }
  965. });
  966. },
  967. editSubmitForm(formData) {
  968. this.$refs[formData].validate((valid) => {
  969. if (valid) {
  970. for (let unitStruct of this.unitStructs) {
  971. if (unitStruct.id == this.paperUnitForm2.id) {
  972. unitStruct.questionType = this.paperUnitForm2.questionType;
  973. unitStruct.count = this.paperUnitForm2.count;
  974. unitStruct.score = this.paperUnitForm2.score;
  975. unitStruct.totalScore = this.paperUnitForm2.totalScore;
  976. unitStruct.quesNames = this.paperUnitForm2.quesNames;
  977. unitStruct.publicSimple = this.paperUnitForm2.publicSimple;
  978. unitStruct.publicMedium = this.paperUnitForm2.publicMedium;
  979. unitStruct.publicDifficulty = this.paperUnitForm2.publicDifficulty;
  980. unitStruct.noPublicSimple = this.paperUnitForm2.noPublicSimple;
  981. unitStruct.noPublicMedium = this.paperUnitForm2.noPublicMedium;
  982. unitStruct.noPublicDifficulty = this.paperUnitForm2.noPublicDifficulty;
  983. unitStruct.publicSum = this.paperUnitForm2.publicSum;
  984. unitStruct.noPublicSum = this.paperUnitForm2.noPublicSum;
  985. unitStruct.simpleSum = this.paperUnitForm2.simpleSum;
  986. unitStruct.mediumSum = this.paperUnitForm2.mediumSum;
  987. unitStruct.difficultySum = this.paperUnitForm2.difficultySum;
  988. this.setUnits();
  989. this.paperDetailUnitStructDialog = false;
  990. sessionStorage.setItem(
  991. "paperStruct",
  992. JSON.stringify(this.paperStruct)
  993. );
  994. }
  995. }
  996. }
  997. });
  998. },
  999. //重置
  1000. resetForm(formData) {
  1001. this.$refs[formData].resetFields();
  1002. //this.$refs[formData].clearValidate();
  1003. // this.paperUnitForm = {
  1004. // id: "",
  1005. // questionType: "",
  1006. // count: 0,
  1007. // score: "",
  1008. // totalScore: "",
  1009. // quesNames: [],
  1010. // publicSimple: 0,
  1011. // publicMedium: 0,
  1012. // publicDifficulty: 0,
  1013. // noPublicSimple: 0,
  1014. // noPublicMedium: 0,
  1015. // noPublicDifficulty: 0,
  1016. // publicSum: 0,
  1017. // noPublicSum: 0,
  1018. // simpleSum: 0,
  1019. // mediumSum: 0,
  1020. // difficultySum: 0
  1021. // };
  1022. },
  1023. //返回
  1024. back() {
  1025. this.$router.push({
  1026. path: "/questions/insert_paper_structure/" + this.paperStructId,
  1027. });
  1028. },
  1029. muli() {
  1030. this.paperUnitForm.totalScore =
  1031. (this.paperUnitForm.score * 1000 * this.paperUnitForm.count) / 1000;
  1032. },
  1033. muli2() {
  1034. this.paperUnitForm2.totalScore =
  1035. (this.paperUnitForm2.score * 1000 * this.paperUnitForm2.count) / 1000;
  1036. },
  1037. getUnits() {
  1038. var unitStructs = [];
  1039. for (let paperDetailStruct of this.paperStruct.paperDetailStructs) {
  1040. if (parseInt(paperDetailStruct.id) == this.detailId) {
  1041. if (paperDetailStruct.unitStructs) {
  1042. return paperDetailStruct.unitStructs;
  1043. }
  1044. }
  1045. }
  1046. return unitStructs;
  1047. },
  1048. setUnits() {
  1049. for (let paperDetailStruct of this.paperStruct.paperDetailStructs) {
  1050. if (parseInt(paperDetailStruct.id) == this.detailId) {
  1051. paperDetailStruct.unitStructs = this.unitStructs;
  1052. paperDetailStruct.totalScore = this.totalScore;
  1053. paperDetailStruct.detailCount = this.detailCount;
  1054. }
  1055. }
  1056. },
  1057. getQuesTypeName(value) {
  1058. for (let quesType of this.quesTypes) {
  1059. if (value == quesType.value) {
  1060. return quesType.label;
  1061. }
  1062. }
  1063. },
  1064. openPaperDetailUnitStructDialog(id) {
  1065. this.unitId = id;
  1066. for (let unitStruct of this.unitStructs) {
  1067. if (unitStruct.id == id) {
  1068. this.paperUnitForm2.id = id;
  1069. this.paperUnitForm2.questionType = unitStruct.questionType;
  1070. this.paperUnitForm2.count = unitStruct.count;
  1071. this.paperUnitForm2.score = unitStruct.score;
  1072. this.paperUnitForm2.totalScore = unitStruct.totalScore;
  1073. this.paperUnitForm2.quesNames = unitStruct.quesNames;
  1074. this.paperUnitForm2.publicSimple = unitStruct.publicSimple;
  1075. this.paperUnitForm2.publicMedium = unitStruct.publicMedium;
  1076. this.paperUnitForm2.publicDifficulty = unitStruct.publicDifficulty;
  1077. this.paperUnitForm2.noPublicSimple = unitStruct.noPublicSimple;
  1078. this.paperUnitForm2.noPublicMedium = unitStruct.noPublicMedium;
  1079. this.paperUnitForm2.noPublicDifficulty =
  1080. unitStruct.noPublicDifficulty;
  1081. //实时计算,不存数据库
  1082. this.paperUnitForm2.publicSum =
  1083. this.paperUnitForm2.publicSimple +
  1084. this.paperUnitForm2.publicMedium +
  1085. this.paperUnitForm2.publicDifficulty;
  1086. this.paperUnitForm2.noPublicSum =
  1087. this.paperUnitForm2.noPublicSimple +
  1088. this.paperUnitForm2.noPublicMedium +
  1089. this.paperUnitForm2.noPublicDifficulty;
  1090. this.paperUnitForm2.simpleSum =
  1091. this.paperUnitForm2.publicSimple +
  1092. this.paperUnitForm2.noPublicSimple;
  1093. this.paperUnitForm2.mediumSum =
  1094. this.paperUnitForm2.publicMedium +
  1095. this.paperUnitForm2.noPublicMedium;
  1096. this.paperUnitForm2.difficultySum =
  1097. this.paperUnitForm2.publicDifficulty +
  1098. this.paperUnitForm2.noPublicDifficulty;
  1099. }
  1100. }
  1101. this.getQuesNameList(this.paperUnitForm2.questionType);
  1102. this.paperDetailUnitStructDialog = true;
  1103. },
  1104. deleteUnit(id) {
  1105. var unitStructs = this.unitStructs;
  1106. for (let i = unitStructs.length - 1; i >= 0; i--) {
  1107. if (unitStructs[i].id == id) {
  1108. unitStructs.splice(i, 1);
  1109. }
  1110. }
  1111. this.unitStructs = unitStructs;
  1112. this.setUnits();
  1113. sessionStorage.setItem("paperStruct", JSON.stringify(this.paperStruct));
  1114. console.log(sessionStorage.getItem("paperStruct"));
  1115. },
  1116. //判断是否为正整数
  1117. isPositiveInteger(s) {
  1118. //是否为正整数
  1119. var re = /^[0-9]+$/;
  1120. return re.test(s);
  1121. },
  1122. //计算数量
  1123. unitCount(data, rowType, paperUnitForm) {
  1124. //计算前校验正整数
  1125. if (!this.isPositiveInteger(data)) {
  1126. if (rowType === "publicSimple") {
  1127. setTimeout(function () {
  1128. paperUnitForm.publicSimple = 0;
  1129. }, 1);
  1130. } else if (rowType === "publicMedium") {
  1131. setTimeout(function () {
  1132. paperUnitForm.publicMedium = 0;
  1133. }, 1);
  1134. } else if (rowType === "publicDifficulty") {
  1135. setTimeout(function () {
  1136. paperUnitForm.publicDifficulty = 0;
  1137. }, 1);
  1138. } else if (rowType === "noPublicSimple") {
  1139. setTimeout(function () {
  1140. paperUnitForm.noPublicSimple = 0;
  1141. }, 1);
  1142. } else if (rowType === "noPublicMedium") {
  1143. setTimeout(function () {
  1144. paperUnitForm.noPublicMedium = 0;
  1145. }, 1);
  1146. } else if (rowType === "noPublicDifficulty") {
  1147. setTimeout(function () {
  1148. paperUnitForm.noPublicDifficulty = 0;
  1149. }, 1);
  1150. }
  1151. }
  1152. setTimeout(function () {
  1153. paperUnitForm.publicSimple = parseInt(paperUnitForm.publicSimple);
  1154. paperUnitForm.publicMedium = parseInt(paperUnitForm.publicMedium);
  1155. paperUnitForm.publicDifficulty = parseInt(
  1156. paperUnitForm.publicDifficulty
  1157. );
  1158. paperUnitForm.noPublicSimple = parseInt(paperUnitForm.noPublicSimple);
  1159. paperUnitForm.noPublicMedium = parseInt(paperUnitForm.noPublicMedium);
  1160. paperUnitForm.noPublicDifficulty = parseInt(
  1161. paperUnitForm.noPublicDifficulty
  1162. );
  1163. //公开总数
  1164. paperUnitForm.publicSum =
  1165. parseInt(paperUnitForm.publicSimple) +
  1166. parseInt(paperUnitForm.publicMedium) +
  1167. parseInt(paperUnitForm.publicDifficulty);
  1168. //非公开总数
  1169. paperUnitForm.noPublicSum =
  1170. parseInt(paperUnitForm.noPublicSimple) +
  1171. parseInt(paperUnitForm.noPublicMedium) +
  1172. parseInt(paperUnitForm.noPublicDifficulty);
  1173. //简单总数
  1174. paperUnitForm.simpleSum =
  1175. parseInt(paperUnitForm.publicSimple) +
  1176. parseInt(paperUnitForm.noPublicSimple);
  1177. //中等总数
  1178. paperUnitForm.mediumSum =
  1179. parseInt(paperUnitForm.publicMedium) +
  1180. parseInt(paperUnitForm.noPublicMedium);
  1181. //困难总数
  1182. paperUnitForm.difficultySum =
  1183. parseInt(paperUnitForm.publicDifficulty) +
  1184. parseInt(paperUnitForm.noPublicDifficulty);
  1185. //总数
  1186. paperUnitForm.count =
  1187. paperUnitForm.publicSum + paperUnitForm.noPublicSum;
  1188. //分数
  1189. paperUnitForm.totalScore =
  1190. (paperUnitForm.score * 1000 * paperUnitForm.count) / 1000;
  1191. }, 5);
  1192. if (this.clearCheck(paperUnitForm.count)) {
  1193. this.$refs["paperUnitForm"].clearValidate("count");
  1194. }
  1195. },
  1196. clearCheck(value) {
  1197. var reg = /^\d+(?=\.{0,1}\d+$|$)/;
  1198. if (!value) {
  1199. return true;
  1200. }
  1201. if (!reg.test(value)) {
  1202. return true;
  1203. } else {
  1204. if (value < 0) {
  1205. return true;
  1206. } else {
  1207. return false;
  1208. }
  1209. }
  1210. },
  1211. },
  1212. };
  1213. </script>
  1214. <style scoped src="../styles/Common.css"></style>
  1215. <style scoped>
  1216. .el-row {
  1217. margin-bottom: 20px;
  1218. }
  1219. .el-col {
  1220. border-radius: 4px;
  1221. }
  1222. .bg-purple-dark {
  1223. background: #dcdfe6;
  1224. }
  1225. .bg-purple {
  1226. background: #dcdfe6;
  1227. }
  1228. .bg-purple-light {
  1229. background: #f9fafc;
  1230. }
  1231. .grid-content {
  1232. border-radius: 4px;
  1233. min-height: 36px;
  1234. }
  1235. .row-bg {
  1236. padding: 10px 0;
  1237. background-color: #f9fafc;
  1238. }
  1239. .el-form--inline .el-form-item__label {
  1240. float: none;
  1241. display: inline-block;
  1242. width: 78px;
  1243. }
  1244. </style>