index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707
  1. <template>
  2. <div id="examRegistration">
  3. <search-box-new
  4. ref="searchBox"
  5. :formData="formData"
  6. :formList="formList"
  7. @search="search"
  8. @init="init"
  9. :advanced="true"
  10. @Advanced="advanced"
  11. advancedName="高级输入"
  12. />
  13. <table-list
  14. :tableSets="tableSet"
  15. :tableData="tableData"
  16. :navText="navText"
  17. :loading="loading"
  18. ref="tableList"
  19. rowKey="subscribeId"
  20. >
  21. <template slot="customize">
  22. <el-button :size="size" type="warning" @click="moreActive"
  23. >考试登记</el-button
  24. >
  25. </template>
  26. </table-list>
  27. <pagination
  28. :total="total"
  29. :pageSize="formData.pageSize"
  30. :currentPage="formData.pageNum"
  31. @handleSizeChange="handleSizeChange"
  32. @handleCurrentChange="handleCurrentChange"
  33. />
  34. <el-dialog
  35. :visible.sync="dialogPLS"
  36. width="660px"
  37. :show-close="false"
  38. :close-on-click-modal="false"
  39. >
  40. <div slot="title" class="hearders">
  41. <div class="leftTitle">高级输入</div>
  42. <div class="rightBoxs">
  43. <img
  44. src="@/assets/images/Close@2x.png"
  45. alt=""
  46. @click="dialogPLS = false"
  47. />
  48. </div>
  49. </div>
  50. <el-row :gutter="20">
  51. <el-col :span="12"
  52. ><h4>请输入学员的身份证号码,换行隔开,每行一个</h4>
  53. <el-input
  54. type="textarea"
  55. :rows="10"
  56. placeholder="请输入身份证"
  57. v-model="idcordList"
  58. >
  59. </el-input>
  60. </el-col>
  61. <el-col :span="12">
  62. <h4>快捷导入</h4>
  63. <el-link type="primary" @click="getDowm">下载模板</el-link>
  64. <label
  65. for="mobles"
  66. class="el-button el-button--primary"
  67. style="margin-left: 14px; padding: 10px 20px"
  68. >上传学员名单</label
  69. ><input
  70. style="display: none"
  71. type="file"
  72. id="mobles"
  73. ref="input1"
  74. @change="importMobleadd"
  75. />
  76. </el-col>
  77. </el-row>
  78. <span slot="footer" class="dialog-footer">
  79. <el-button @click="dialogPLS = false">取消</el-button>
  80. <el-button type="primary" @click="submitChecksPals">确定</el-button>
  81. </span>
  82. </el-dialog>
  83. <el-dialog
  84. :visible.sync="dialogCG"
  85. width="560px"
  86. :show-close="false"
  87. :close-on-click-modal="false"
  88. >
  89. <div slot="title" class="hearders">
  90. <div class="leftTitle">成绩和证书登记</div>
  91. <div class="rightBoxs">
  92. <img
  93. src="@/assets/images/Close@2x.png"
  94. alt=""
  95. @click="dialogCG = false"
  96. />
  97. </div>
  98. </div>
  99. <div>
  100. <div v-for="(item, index) in peopleList" :key="index">
  101. <div class="aListBottom">
  102. {{ item.realname }}
  103. <i
  104. v-if="peopleList.length > 1"
  105. class="el-icon-error clsw"
  106. @click="peopleList.splice(index, 1)"
  107. ></i>
  108. </div>
  109. <el-form
  110. label-width="120px"
  111. :model="item"
  112. :rules="rules"
  113. ref="peopleList"
  114. >
  115. <el-form-item label="考试登记状态" prop="examStatus">
  116. <el-radio-group v-model="item.examStatus">
  117. <el-radio :label="0">待登记</el-radio>
  118. <el-radio :label="1">正常</el-radio>
  119. <el-radio :label="2">缺考</el-radio>
  120. <el-radio :label="3">作弊</el-radio>
  121. <el-radio :label="4">替考</el-radio>
  122. </el-radio-group>
  123. </el-form-item>
  124. <el-form-item
  125. v-if="getTimes(item)"
  126. label="考试成绩"
  127. prop="performance"
  128. >
  129. <el-input-number
  130. size="mini"
  131. :controls="false"
  132. v-model="item.performance"
  133. :min="0"
  134. ></el-input-number>
  135. <span style="margin-left: 6px">分</span>
  136. </el-form-item>
  137. <el-form-item v-if="getTimes(item)" label="考试结果" prop="result">
  138. <el-radio-group v-model="item.result">
  139. <el-radio :label="1">通过</el-radio>
  140. <el-radio :label="0">不通过</el-radio>
  141. </el-radio-group>
  142. </el-form-item>
  143. <el-form-item v-if="getTimes(item)" label="证书编号">
  144. <el-input v-model="item.certificateCode"></el-input>
  145. </el-form-item>
  146. <el-form-item label="登记补充">
  147. <el-input
  148. v-model="item.remark"
  149. type="textarea"
  150. :rows="4"
  151. ></el-input>
  152. </el-form-item>
  153. </el-form>
  154. </div>
  155. </div>
  156. <span slot="footer" class="dialog-footer">
  157. <el-button @click="dialogCG = false">取消</el-button>
  158. <el-button type="primary" @click="submitChecks('peopleList')"
  159. >确定</el-button
  160. >
  161. </span>
  162. </el-dialog>
  163. </div>
  164. </template>
  165. <script>
  166. import * as baseUrls from "@/utils/request.js";
  167. import searchBoxNew from "@/components/searchBoxNew";
  168. import tableList from "@/components/tableList";
  169. import pagination from "@/components/pagination";
  170. export default {
  171. name: "ExamRegistration",
  172. components: { searchBoxNew, tableList, pagination },
  173. data() {
  174. return {
  175. dialogPLS: false,
  176. size: "small",
  177. plan: "",
  178. loading: false, //当前表单加载是否加载动画
  179. navText: {
  180. openCheckMore: true,
  181. tableHide: true,
  182. border: true,
  183. title: "考试登记",
  184. index: 0,
  185. ch: "条",
  186. num: false,
  187. choice: true,
  188. changeWidth: "240px",
  189. addHide: true,
  190. backFatherBtn: {
  191. status: false,
  192. title: "未定义",
  193. },
  194. },
  195. //搜索
  196. formList: [
  197. {
  198. prop: "applyId",
  199. placeholder: "考试标题",
  200. scope: "examList",
  201. },
  202. {
  203. prop: "applySiteAddress",
  204. placeholder: "考试地点",
  205. scope: "applySiteAddress",
  206. getType: 1,
  207. },
  208. {
  209. prop: "searchKey",
  210. placeholder: "请输入学员姓名/学员身份证",
  211. },
  212. {
  213. prop: "idCards",
  214. placeholder: "请输入学员身份证",
  215. scope: "textarea",
  216. },
  217. ],
  218. formData: {
  219. applyId: "",
  220. pageSize: 10,
  221. pageNum: 1,
  222. idCards: "",
  223. // canCancel: 1,
  224. // canBefore:1
  225. canExam: 1,
  226. },
  227. // 表单
  228. tableSet: [
  229. {
  230. label: "预约状态",
  231. prop: "subscribeStatus",
  232. hidden: true,
  233. scope: "isOptions",
  234. options: [
  235. {
  236. label: "正常",
  237. value: 1,
  238. },
  239. {
  240. label: "取消",
  241. value: 2,
  242. },
  243. ],
  244. },
  245. {
  246. label: "前培标记",
  247. prop: "beforeStatus",
  248. hidden: true,
  249. scope: "isOptions",
  250. options: [
  251. {
  252. label: "已开通",
  253. value: 1,
  254. },
  255. ],
  256. },
  257. {
  258. label: "考试登记",
  259. prop: "examStatus",
  260. hidden: true,
  261. scope: "isOptionsDZYQ",
  262. options: [
  263. {
  264. label: "待登记",
  265. value: 0,
  266. },
  267. {
  268. label: "正常",
  269. value: 1,
  270. },
  271. {
  272. label: "缺考",
  273. value: 2,
  274. },
  275. {
  276. label: "作弊",
  277. value: 3,
  278. },
  279. {
  280. label: "替考",
  281. value: 4,
  282. },
  283. ],
  284. },
  285. {
  286. label: "考试成绩和结果",
  287. prop1: "performance",
  288. prop2: "result",
  289. hidden: true,
  290. scope: "resultType",
  291. },
  292. {
  293. label: "证书编号",
  294. prop: "certificateCode",
  295. hidden: true,
  296. },
  297. {
  298. label: "考试标题",
  299. prop: "applyName",
  300. hidden: true,
  301. },
  302. {
  303. label: "前培标题",
  304. prop: "beforeName",
  305. hidden: true,
  306. },
  307. {
  308. label: "学员姓名",
  309. prop: "realname",
  310. hidden: true,
  311. },
  312. {
  313. label: "学员身份证",
  314. prop: "idCard",
  315. hidden: true,
  316. },
  317. {
  318. label: "所购商品",
  319. prop1: "goodsCode",
  320. prop2: "goodsName",
  321. prop3: "standPrice",
  322. hidden: true,
  323. scope: "goodsInfos",
  324. },
  325. {
  326. label: "学员报考类型",
  327. prop: "studentType",
  328. hidden: true,
  329. scope: "isOptions",
  330. options: [
  331. {
  332. label: "非补考学员",
  333. value: 1,
  334. },
  335. {
  336. label: "补考学员",
  337. value: 2,
  338. },
  339. ],
  340. },
  341. {
  342. label: "所报专业",
  343. prop: "categoryName",
  344. hidden: true,
  345. },
  346. {
  347. label: "预约场次(考试地点和时间)",
  348. prop1: "applySiteAddress",
  349. prop2: "applySiteExamTime",
  350. prop3: "applySiteStartTime",
  351. prop4: "applySiteEndTime",
  352. hidden: true,
  353. scope: "changAdress",
  354. },
  355. {
  356. label: "考试次数消耗",
  357. prop: "examExpend",
  358. hidden: true,
  359. },
  360. {
  361. label: "预约场次(考培地点和时间)",
  362. prop1: "applySiteAddressTrain",
  363. prop2: "applySiteExamTrainTime",
  364. prop3: "applySiteStartTrainTime",
  365. prop4: "applySiteEndTrainTime",
  366. hidden: true,
  367. scope: "changAdress",
  368. },
  369. {
  370. label: "前培次数消耗",
  371. prop: "beforeExpend",
  372. hidden: true,
  373. },
  374. {
  375. label: "创建时间",
  376. prop: "createTime",
  377. hidden: true,
  378. scope: "aTimeList",
  379. },
  380. ],
  381. tableData: [], //表单数据
  382. total: 0, //一共多少条
  383. idcordList: "",
  384. copyAppid: "",
  385. dialogCG: false,
  386. peopleList: [],
  387. rules: {
  388. examStatus: [
  389. { required: true, message: "请选择考试登记状态", trigger: "change" },
  390. ],
  391. performance: [
  392. { required: true, message: "请输入考试成绩", trigger: "blur" },
  393. ],
  394. result: [
  395. { required: true, message: "请选择考试结果", trigger: "change" },
  396. ],
  397. },
  398. };
  399. },
  400. async mounted() {
  401. await this.getFirstOptions();
  402. this.search();
  403. },
  404. activated() {
  405. this.search();
  406. },
  407. methods: {
  408. getTimes(obj) {
  409. var time = `${this.$methodsTools.onlyForma(
  410. obj.applySiteExamTime,
  411. false
  412. )} ${obj.applySiteStartTime}:00`;
  413. var newTime = new Date().getTime();
  414. var theTime = new Date(time).getTime();
  415. if (newTime > theTime && obj.examStatus == 1) {
  416. return true;
  417. } else {
  418. return false;
  419. }
  420. },
  421. /**
  422. * 考试登记
  423. */
  424. moreActive() {
  425. if (!this.$refs.tableList.allCheckData.length) {
  426. this.$message.warning("请勾选需要考试登记的列表");
  427. return;
  428. }
  429. this.peopleList = JSON.parse(
  430. JSON.stringify(this.$refs.tableList.allCheckData)
  431. );
  432. this.dialogCG = true;
  433. // this.$nextTick(() => {
  434. // this.$refs.listData.clearValidate();
  435. // });
  436. },
  437. submitChecks(formName) {
  438. var num = 0;
  439. for (let i = 0; i < this.$refs[formName].length; i++) {
  440. this.$refs[formName][i].validate((valid) => {
  441. if (valid) {
  442. num++;
  443. } else {
  444. console.log("error submit!!");
  445. return false;
  446. }
  447. });
  448. }
  449. if (num === this.$refs[formName].length) {
  450. this.submitForm();
  451. }
  452. },
  453. submitForm() {
  454. var data = JSON.parse(JSON.stringify(this.peopleList));
  455. this.$api.editMoresystemsubscribe(data).then((res) => {
  456. this.$message.success("批量考试登记修改成功");
  457. this.dialogCG = false;
  458. this.search();
  459. this.$refs.tableList.clearMoreActive();
  460. });
  461. },
  462. /**
  463. * 下载模板
  464. */
  465. getDowm() {
  466. let url = baseUrls.BASE_IMG_URL + "/oss/images/file/20220214.xls";
  467. let link = document.createElement("a");
  468. let fileName = "导入模板" + ".xlsx";
  469. document.body.appendChild(link);
  470. link.href = url;
  471. link.dowmload = fileName;
  472. link.click();
  473. link.remove();
  474. },
  475. /**
  476. * 导入
  477. */
  478. importMobleadd(e) {
  479. var self = this;
  480. var file = e.target.files[0];
  481. let formData = new FormData();
  482. formData.append("file", file);
  483. this.$api
  484. .editsystemimportIdsData(formData)
  485. .then((res) => {
  486. if (!res.data.length) {
  487. this.$message.warning("未检测到上传学员数据,请检查上传文件");
  488. return;
  489. }
  490. let idList = res.data.map((item) => {
  491. return item.idCard.toString();
  492. });
  493. if (this.idcordList) {
  494. var arr = this.idcordList.split("\n");
  495. var arrs = arr.concat(idList);
  496. var newArr = arrs.filter(function (value, index, self) {
  497. return self.indexOf(value) === index;
  498. });
  499. this.idcordList = newArr.join("\n");
  500. } else {
  501. var newArr = idList.filter(function (value, index, self) {
  502. return self.indexOf(value) === index;
  503. });
  504. this.idcordList = newArr.join("\n");
  505. }
  506. this.$message.success("上传成功");
  507. })
  508. .finally(() => {
  509. e.target.value = "";
  510. });
  511. },
  512. getFirstOptions() {
  513. return new Promise((resolve, reject) => {
  514. this.$api
  515. .inquiresystemapplyList({ status: 1, pageSize: 1, pageNum: 1 })
  516. .then((res) => {
  517. if (res.rows.length) {
  518. this.copyAppid = res.rows[0].applyId;
  519. this.formData.applyId = res.rows[0].applyId;
  520. }
  521. resolve();
  522. });
  523. });
  524. },
  525. submitChecksPals() {
  526. this.formData.idCards = this.idcordList;
  527. this.dialogPLS = false;
  528. },
  529. advanced(datas) {
  530. this.dialogPLS = true;
  531. this.idcordList = this.formData.idCards;
  532. },
  533. search(int) {
  534. this.loading = true;
  535. if (int === 1) {
  536. this.formData.pageNum = 1;
  537. }
  538. if (int === 2) {
  539. this.formData = {
  540. pageSize: 10,
  541. pageNum: 1,
  542. idCards: "",
  543. canExam: 1,
  544. applyId: this.copyAppid,
  545. };
  546. }
  547. var data = JSON.parse(JSON.stringify(this.formData));
  548. if (this.formData.idCards) {
  549. data.idCards = this.formData.idCards.split("\n");
  550. data.searchType = 1
  551. }else{
  552. data.searchType = 0
  553. }
  554. this.$api
  555. .inquiresystemsubscribelist(data)
  556. .then((res) => {
  557. this.tableData = res.rows;
  558. this.total = res.total;
  559. this.navText.index = res.total;
  560. })
  561. .finally(() => {
  562. this.loading = false;
  563. });
  564. },
  565. init() {
  566. this.$refs.tableList.allCheckData = [];
  567. this.$refs.tableList.$refs.pagerset.clearSelection();
  568. this.search(2);
  569. },
  570. handleSizeChange(v) {
  571. this.formData.pageSize = v;
  572. this.formData.pageNum = 1;
  573. this.search();
  574. },
  575. handleCurrentChange(v) {
  576. this.formData.pageNum = v;
  577. this.search();
  578. },
  579. },
  580. };
  581. </script>
  582. <style lang="less" scoped>
  583. .aListBottom {
  584. margin-left: 20px;
  585. padding: 0px 6px;
  586. border: 1px solid #999;
  587. border-radius: 4px;
  588. height: 30px;
  589. line-height: 30px;
  590. display: inline-block;
  591. }
  592. .liBVS {
  593. margin-right: 20px;
  594. margin-bottom: 12px;
  595. padding: 0px 6px;
  596. border: 1px solid #999;
  597. border-radius: 4px;
  598. height: 30px;
  599. line-height: 30px;
  600. display: inline-block;
  601. float: left;
  602. }
  603. .clsw {
  604. margin-left: 4px;
  605. cursor: pointer;
  606. color: #f56c6c;
  607. }
  608. .swq {
  609. text-align: center;
  610. border-bottom: 1px solid #eee;
  611. }
  612. .dowmStys {
  613. color: blue;
  614. cursor: pointer;
  615. }
  616. /deep/.el-button {
  617. border-radius: 8px;
  618. }
  619. /deep/.el-dialog {
  620. border-radius: 8px;
  621. .el-dialog__header {
  622. padding: 0;
  623. .hearders {
  624. height: 40px;
  625. display: flex;
  626. align-items: center;
  627. justify-content: space-between;
  628. padding: 0px 18px 0px 20px;
  629. border-bottom: 1px solid #e2e2e2;
  630. .leftTitle {
  631. font-size: 14px;
  632. font-weight: bold;
  633. color: #2f4378;
  634. }
  635. .rightBoxs {
  636. display: flex;
  637. align-items: center;
  638. img {
  639. width: 14px;
  640. height: 14px;
  641. margin-left: 13px;
  642. cursor: pointer;
  643. }
  644. }
  645. }
  646. }
  647. .el-dialog__footer {
  648. padding: 0;
  649. .dialog-footer {
  650. padding: 0px 40px;
  651. height: 70px;
  652. border-top: 1px solid #e2e2e2;
  653. display: flex;
  654. align-items: center;
  655. justify-content: flex-end;
  656. }
  657. }
  658. }
  659. .imgBox {
  660. width: 100%;
  661. // height: 210px;
  662. border: 1px solid #e2e2e2;
  663. border-radius: 8px;
  664. padding: 8px 8px 3px;
  665. display: flex;
  666. flex-direction: column;
  667. align-items: center;
  668. .imgLabel {
  669. flex: 1;
  670. width: 100%;
  671. border: 1px dotted #e2e2e2;
  672. color: #999;
  673. font-size: 14px;
  674. cursor: pointer;
  675. border-radius: 8px;
  676. .msPhoto {
  677. display: flex;
  678. justify-content: center;
  679. align-items: center;
  680. max-width: 100%;
  681. max-height: 270px;
  682. img {
  683. max-width: 100%;
  684. max-height: 270px;
  685. }
  686. }
  687. .imgbbx {
  688. display: flex;
  689. flex-direction: column;
  690. align-items: center;
  691. justify-content: center;
  692. width: 100%;
  693. height: 100%;
  694. i {
  695. font-weight: bold;
  696. margin: 14px 0;
  697. font-size: 24px;
  698. }
  699. }
  700. }
  701. p {
  702. margin: 5px 0px;
  703. }
  704. }
  705. </style>