index.vue 15 KB

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