index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. <template>
  2. <div id="formerAccount">
  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="dialogQP"
  85. width="460px"
  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="dialogQP = false"
  96. />
  97. </div>
  98. </div>
  99. <div>
  100. <ul style="margin: 0px">
  101. <li class="liBVS" v-for="(item, index) in peopleList" :key="index">
  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. </li>
  109. <div style="clear: both"></div>
  110. </ul>
  111. <p style="margin: 0px">所选学员的前培账号标记为【已开通】吗?</p>
  112. <div style="text-align: center; margin-top: 12px">
  113. <el-radio-group v-model="beforeStatus">
  114. <el-radio :label="1">是</el-radio>
  115. <el-radio :label="2">否</el-radio>
  116. </el-radio-group>
  117. </div>
  118. </div>
  119. <span slot="footer" class="dialog-footer">
  120. <el-button @click="dialogQP = false">取消</el-button>
  121. <el-button type="primary" @click="submitChecksQP">确定</el-button>
  122. </span>
  123. </el-dialog>
  124. </div>
  125. </template>
  126. <script>
  127. import * as baseUrls from "@/utils/request.js";
  128. import searchBoxNew from "@/components/searchBoxNew";
  129. import tableList from "@/components/tableList";
  130. import pagination from "@/components/pagination";
  131. export default {
  132. name: "FormerAccount",
  133. components: { searchBoxNew, tableList, pagination },
  134. data() {
  135. return {
  136. dialogPLS: false,
  137. size: "small",
  138. beforeStatus: "",
  139. loading: false, //当前表单加载是否加载动画
  140. navText: {
  141. openCheckMore: true,
  142. tableHide: true,
  143. border: true,
  144. title: "前培账号标记",
  145. index: 0,
  146. ch: "条",
  147. num: false,
  148. choice: true,
  149. changeWidth: "240px",
  150. addHide: true,
  151. backFatherBtn: {
  152. status: false,
  153. title: "未定义",
  154. },
  155. },
  156. //搜索
  157. formList: [
  158. // {
  159. // prop: "beforeId",
  160. // placeholder: "前培计划",
  161. // scope: "beforeLists",
  162. // },
  163. {
  164. prop: "applyId",
  165. placeholder: "考试计划",
  166. scope: "examLists",
  167. },
  168. {
  169. prop: "beforeStatus",
  170. placeholder: "开通状态",
  171. scope: "select",
  172. options: [
  173. {
  174. label: "已开通",
  175. value: 1,
  176. },
  177. {
  178. label: "未开通",
  179. value: 0,
  180. },
  181. ],
  182. },
  183. {
  184. prop: "searchKey",
  185. placeholder: "请输入学员姓名/学员身份证",
  186. },
  187. {
  188. prop: "idCards",
  189. placeholder: "请输入学员身份证",
  190. scope: "textarea",
  191. },
  192. ],
  193. formData: {
  194. beforeId: "",
  195. applyId: "",
  196. pageSize: 10,
  197. pageNum: 1,
  198. idCards: "",
  199. beforeStatus: "",
  200. canBefore: 1,
  201. },
  202. // 表单
  203. tableSet: [
  204. {
  205. label: "考试机会",
  206. prop1: "examNumber",
  207. prop2: "expendNumber",
  208. hidden: true,
  209. scope: "chance",
  210. },
  211. {
  212. label: "前培机会",
  213. prop1: "doNumber",
  214. prop2: "expendBefore",
  215. hidden: true,
  216. scope: "chance",
  217. },
  218. {
  219. label: "预约状态",
  220. prop: "subscribeStatus",
  221. hidden: true,
  222. scope: "isOptions",
  223. options: [
  224. {
  225. label: "正常",
  226. value: 1,
  227. },
  228. {
  229. label: "取消",
  230. value: 2,
  231. },
  232. ],
  233. },
  234. {
  235. label: "前培标记",
  236. prop: "beforeStatus",
  237. hidden: true,
  238. scope: "isOptions",
  239. options: [
  240. {
  241. label: "已开通",
  242. value: 1,
  243. },
  244. ],
  245. },
  246. {
  247. label: "考试登记",
  248. prop: "examStatus",
  249. hidden: true,
  250. scope: "isOptionsDZYQ",
  251. options: [
  252. {
  253. label: "待登记",
  254. value: 0,
  255. },
  256. {
  257. label: "正常",
  258. value: 1,
  259. },
  260. {
  261. label: "缺考",
  262. value: 2,
  263. },
  264. {
  265. label: "作弊",
  266. value: 3,
  267. },
  268. {
  269. label: "替考",
  270. value: 4,
  271. },
  272. ],
  273. },
  274. {
  275. label: "考试成绩和结果",
  276. prop1: "performance",
  277. prop2: "result",
  278. hidden: true,
  279. scope: "resultType",
  280. },
  281. {
  282. label: "证书编号",
  283. prop: "certificateCode",
  284. hidden: true,
  285. },
  286. {
  287. label: "考试标题",
  288. prop: "applyName",
  289. hidden: true,
  290. },
  291. {
  292. label: "前培标题",
  293. prop: "beforeName",
  294. hidden: true,
  295. },
  296. {
  297. label: "学员姓名",
  298. prop: "realname",
  299. hidden: true,
  300. },
  301. {
  302. label: "学员身份证",
  303. prop: "idCard",
  304. hidden: true,
  305. },
  306. {
  307. label: "所购商品",
  308. prop1: "goodsCode",
  309. prop2: "goodsName",
  310. prop3: "standPrice",
  311. hidden: true,
  312. scope: "goodsInfos",
  313. },
  314. {
  315. label: "学员报考类型",
  316. prop: "studentType",
  317. hidden: true,
  318. scope: "isOptions",
  319. options: [
  320. {
  321. label: "非补考学员",
  322. value: 1,
  323. },
  324. {
  325. label: "补考学员",
  326. value: 2,
  327. },
  328. ],
  329. },
  330. {
  331. label: "所报专业",
  332. prop: "categoryName",
  333. hidden: true,
  334. },
  335. {
  336. label: "预约场次(考试地点和时间)",
  337. prop1: "applySiteAddress",
  338. prop2: "applySiteExamTime",
  339. prop3: "applySiteStartTime",
  340. prop4: "applySiteEndTime",
  341. hidden: true,
  342. scope: "changAdress",
  343. },
  344. {
  345. label: "考试次数消耗",
  346. prop: "examExpend",
  347. hidden: true,
  348. },
  349. {
  350. label: "预约场次(考培地点和时间)",
  351. prop1: "applySiteAddressTrain",
  352. prop2: "applySiteExamTrainTime",
  353. prop3: "applySiteStartTrainTime",
  354. prop4: "applySiteEndTrainTime",
  355. hidden: true,
  356. scope: "changAdress",
  357. },
  358. {
  359. label: "前培次数消耗",
  360. prop: "beforeExpend",
  361. hidden: true,
  362. },
  363. {
  364. label: "创建时间",
  365. prop: "createTime",
  366. hidden: true,
  367. scope: "aTimeList",
  368. },
  369. ],
  370. tableData: [], //表单数据
  371. total: 0, //一共多少条
  372. idcordList: "",
  373. copyAppid: "",
  374. dialogQP: false,
  375. listData: {},
  376. peopleList: [],
  377. };
  378. },
  379. mounted() {
  380. // await this.getFirstOptions();
  381. this.search();
  382. },
  383. activated() {
  384. this.search();
  385. },
  386. methods: {
  387. /**
  388. * 下载模板
  389. */
  390. getDowm() {
  391. let url = baseUrls.BASE_IMG_URL + "/oss/images/file/20220214.xls" +
  392. `?time=${this.$methodsTools.getNewTime()}`;;
  393. let link = document.createElement("a");
  394. let fileName = "导入模板" + ".xlsx";
  395. document.body.appendChild(link);
  396. link.href = url;
  397. link.dowmload = fileName;
  398. link.click();
  399. link.remove();
  400. },
  401. /**
  402. * 导入
  403. */
  404. importMobleadd(e) {
  405. var self = this;
  406. var file = e.target.files[0];
  407. let formData = new FormData();
  408. formData.append("file", file);
  409. this.$api
  410. .editsystemimportIdsData(formData)
  411. .then((res) => {
  412. if (!res.data.length) {
  413. this.$message.warning("未检测到上传学员数据,请检查上传文件");
  414. return;
  415. }
  416. let idList = res.data.map((item) => {
  417. return item.idCard.toString();
  418. });
  419. if (this.idcordList) {
  420. var arr = this.idcordList.split("\n");
  421. var arrs = arr.concat(idList);
  422. var newArr = arrs.filter(function (value, index, self) {
  423. return self.indexOf(value) === index;
  424. });
  425. this.idcordList = newArr.join("\n");
  426. } else {
  427. var newArr = idList.filter(function (value, index, self) {
  428. return self.indexOf(value) === index;
  429. });
  430. this.idcordList = newArr.join("\n");
  431. }
  432. this.$message.success("上传成功");
  433. })
  434. .finally(() => {
  435. e.target.value = "";
  436. });
  437. },
  438. getFirstOptions() {
  439. return new Promise((resolve, reject) => {
  440. this.$api
  441. .inquiresystembefore({ status: "0,1,2", pageSize: 1, pageNum: 1 })
  442. .then((res) => {
  443. if (res.rows.length) {
  444. this.copyAppid = res.rows[0].beforeId;
  445. this.formData.beforeId = res.rows[0].beforeId;
  446. }
  447. resolve();
  448. });
  449. });
  450. },
  451. submitChecksPals() {
  452. this.formData.idCards = this.idcordList;
  453. this.dialogPLS = false;
  454. },
  455. advanced(datas) {
  456. this.dialogPLS = true;
  457. this.idcordList = this.formData.idCards;
  458. },
  459. moreActive() {
  460. if (!this.$refs.tableList.allCheckData.length) {
  461. this.$message.warning("请勾选需要前培账号标记的列表");
  462. return;
  463. }
  464. this.peopleList = JSON.parse(
  465. JSON.stringify(this.$refs.tableList.allCheckData)
  466. );
  467. this.listData = {};
  468. this.beforeStatus = 1;
  469. this.dialogQP = true;
  470. },
  471. submitChecksQP() {
  472. var data = JSON.parse(JSON.stringify(this.listData));
  473. if (!this.beforeStatus) {
  474. this.$message.warning("请选择是或否");
  475. return;
  476. }
  477. var arrays = [];
  478. this.peopleList.forEach((item) => {
  479. arrays.push(item.subscribeId);
  480. });
  481. data.subscribeId = arrays;
  482. if (this.beforeStatus === 1) {
  483. data.beforeStatus = 1;
  484. data.beforeId = this.formData.beforeId;
  485. }
  486. if (this.beforeStatus === 2) {
  487. data.beforeStatus = 0;
  488. data.beforeId = this.formData.beforeId;
  489. }
  490. this.$api.editsystemsubscribe(data).then((res) => {
  491. this.$message.success("前培账号已开通标记修改成功");
  492. this.dialogQP = false;
  493. this.search();
  494. this.$refs.tableList.allCheckData = [];
  495. this.$refs.tableList.$refs.pagerset.clearSelection();
  496. });
  497. },
  498. search(int) {
  499. this.loading = true;
  500. if (int === 1) {
  501. this.formData.pageNum = 1;
  502. }
  503. if (int === 2) {
  504. this.formData = {
  505. pageSize: 10,
  506. pageNum: 1,
  507. idCards: "",
  508. canBefore: 1,
  509. beforeId: this.formData.beforeId,
  510. applyId: "",
  511. beforeStatus: "",
  512. };
  513. }
  514. var data = JSON.parse(JSON.stringify(this.formData));
  515. if (this.formData.idCards) {
  516. data.idCards = this.formData.idCards.split("\n");
  517. }
  518. if (this.formData.searchKey && this.formData.idCards) {
  519. data.searchType = 1;
  520. } else {
  521. data.searchType = 0;
  522. }
  523. this.$api
  524. .inquiresystemsubscribelist(data)
  525. .then((res) => {
  526. this.tableData = res.rows;
  527. this.total = res.total;
  528. this.navText.index = res.total;
  529. })
  530. .finally(() => {
  531. this.loading = false;
  532. });
  533. },
  534. init() {
  535. this.$refs.tableList.allCheckData = [];
  536. this.$refs.tableList.$refs.pagerset.clearSelection();
  537. this.search(2);
  538. },
  539. handleSizeChange(v) {
  540. this.formData.pageSize = v;
  541. this.formData.pageNum = 1;
  542. this.search();
  543. },
  544. handleCurrentChange(v) {
  545. this.formData.pageNum = v;
  546. this.search();
  547. },
  548. },
  549. };
  550. </script>
  551. <style lang="less" scoped>
  552. /deep/.el-button {
  553. border-radius: 8px;
  554. }
  555. /deep/.el-dialog {
  556. border-radius: 8px;
  557. .el-dialog__header {
  558. padding: 0;
  559. .hearders {
  560. height: 40px;
  561. display: flex;
  562. align-items: center;
  563. justify-content: space-between;
  564. padding: 0px 18px 0px 20px;
  565. border-bottom: 1px solid #e2e2e2;
  566. .leftTitle {
  567. font-size: 14px;
  568. font-weight: bold;
  569. color: #2f4378;
  570. }
  571. .rightBoxs {
  572. display: flex;
  573. align-items: center;
  574. img {
  575. width: 14px;
  576. height: 14px;
  577. margin-left: 13px;
  578. cursor: pointer;
  579. }
  580. }
  581. }
  582. }
  583. .el-dialog__footer {
  584. padding: 0;
  585. .dialog-footer {
  586. padding: 0px 40px;
  587. height: 70px;
  588. border-top: 1px solid #e2e2e2;
  589. display: flex;
  590. align-items: center;
  591. justify-content: flex-end;
  592. }
  593. }
  594. }
  595. .imgBox {
  596. width: 100%;
  597. // height: 210px;
  598. border: 1px solid #e2e2e2;
  599. border-radius: 8px;
  600. padding: 8px 8px 3px;
  601. display: flex;
  602. flex-direction: column;
  603. align-items: center;
  604. .imgLabel {
  605. flex: 1;
  606. width: 100%;
  607. border: 1px dotted #e2e2e2;
  608. color: #999;
  609. font-size: 14px;
  610. cursor: pointer;
  611. border-radius: 8px;
  612. .msPhoto {
  613. display: flex;
  614. justify-content: center;
  615. align-items: center;
  616. max-width: 100%;
  617. max-height: 270px;
  618. img {
  619. max-width: 100%;
  620. max-height: 270px;
  621. }
  622. }
  623. .imgbbx {
  624. display: flex;
  625. flex-direction: column;
  626. align-items: center;
  627. justify-content: center;
  628. width: 100%;
  629. height: 100%;
  630. i {
  631. font-weight: bold;
  632. margin: 14px 0;
  633. font-size: 24px;
  634. }
  635. }
  636. }
  637. p {
  638. margin: 5px 0px;
  639. }
  640. }
  641. .liBVS {
  642. margin-right: 20px;
  643. margin-bottom: 12px;
  644. padding: 0px 6px;
  645. border: 1px solid #999;
  646. border-radius: 4px;
  647. height: 30px;
  648. line-height: 30px;
  649. display: inline-block;
  650. float: left;
  651. }
  652. .clsw {
  653. margin-left: 4px;
  654. cursor: pointer;
  655. color: #f56c6c;
  656. }
  657. .swq {
  658. text-align: center;
  659. border-bottom: 1px solid #eee;
  660. }
  661. .dowmStys {
  662. color: blue;
  663. cursor: pointer;
  664. }
  665. </style>