allAssociatedExamPlans.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <div id="allAssociatedExamPlans">
  3. <el-dialog
  4. @closed="loadingClose"
  5. :visible.sync="dialogVisible"
  6. width="1200px"
  7. :show-close="false"
  8. :close-on-click-modal="false"
  9. >
  10. <div slot="title" class="hearders">
  11. <div class="leftTitle">所有关联的考试计划</div>
  12. <div class="rightBoxs">
  13. <img
  14. src="@/assets/images/Close@2x.png"
  15. alt=""
  16. @click="dialogVisible = false"
  17. />
  18. </div>
  19. </div>
  20. <div>
  21. <el-table
  22. v-loading="loading"
  23. border
  24. :data="tableData"
  25. style="width: 100%; margin-top: 16px"
  26. ref="elTable"
  27. max-height="680px"
  28. >
  29. <el-table-column
  30. align="center"
  31. v-for="(item, index) in tableSet"
  32. :key="index"
  33. :prop="item.prop"
  34. :label="item.label"
  35. :width="item.width"
  36. >
  37. <template slot-scope="scope">
  38. <div v-if="item.scope === 'morePeople'">
  39. <span
  40. v-for="(itm, idm) in scope.row[item.prop]
  41. .split(',')
  42. .map(Number)"
  43. :key="idm"
  44. >
  45. {{ itm === 1 ? "非补考学员" : itm === 2 ? "补考学员" : "" }}
  46. </span>
  47. </div>
  48. <el-button
  49. type="text"
  50. v-else-if="item.scope === 'btn'"
  51. @click="del(scope.row)"
  52. >删除</el-button
  53. >
  54. <span v-else-if="item.scope === 'TimeLists'"
  55. >{{
  56. $methodsTools.onlyForma(scope.row[item.prop1], item.Diszing)
  57. }}
  58. {{
  59. $methodsTools.onlyForma(scope.row[item.prop2], item.Diszing)
  60. }}</span
  61. >
  62. <span v-else>{{ scope.row[item.prop] }}</span>
  63. </template>
  64. </el-table-column>
  65. </el-table>
  66. </div>
  67. <span slot="footer" class="dialog-footer">
  68. <el-button @click="dialogVisible = false">取 消</el-button>
  69. <el-button type="primary" @click="submitForm" :loading="disabledBtn"
  70. >确 定</el-button
  71. >
  72. </span>
  73. </el-dialog>
  74. </div>
  75. </template>
  76. <script>
  77. export default {
  78. data() {
  79. return {
  80. loading: false,
  81. size: "small",
  82. dialogVisible: false,
  83. disabledBtn: false,
  84. total: 0,
  85. tableSet: [
  86. {
  87. label: "考试编码",
  88. prop: "code",
  89. width: "160px",
  90. },
  91. {
  92. label: "考试标题",
  93. prop: "applyName",
  94. },
  95. {
  96. label: "可报学员",
  97. prop: "applyStatus",
  98. scope: "morePeople",
  99. width: "170px",
  100. },
  101. {
  102. label: "学员端报名开放时间",
  103. prop1: "applyStartTime",
  104. prop2: "applyEndTime",
  105. scope: "TimeLists",
  106. Diszing: false,
  107. width: "240px",
  108. },
  109. {
  110. label: "操作",
  111. scope: "btn",
  112. width: "120px",
  113. },
  114. ],
  115. tableData: [],
  116. formData: {},
  117. beforeId: "",
  118. };
  119. },
  120. methods: {
  121. loadingClose() {
  122. this.disabledBtn = false;
  123. },
  124. openBoxs(arr) {
  125. this.beforeId = arr.beforeId;
  126. this.search();
  127. this.dialogVisible = true;
  128. },
  129. search(v) {
  130. this.loading = true;
  131. this.$api
  132. .inquireexamapplyList({ beforeId: this.beforeId })
  133. .then((res) => {
  134. this.tableData = res.rows;
  135. this.total = res.total;
  136. })
  137. .finally(() => {
  138. this.loading = false;
  139. });
  140. },
  141. submitForm() {
  142. this.disabledBtn = true;
  143. let lists = this.tableData.map((item) => {
  144. return item.applyId;
  145. });
  146. this.$api
  147. .addexamapply({ beforeId: this.beforeId, applyIds: lists })
  148. .then((res) => {
  149. this.$message.success("修改成功");
  150. this.$emit("backData");
  151. this.dialogVisible = false;
  152. })
  153. .finally(() => {
  154. this.disabledBtn = false;
  155. });
  156. },
  157. del(row) {
  158. this.tableData = this.tableData.filter((item) => {
  159. return item.applyId !== row.applyId;
  160. });
  161. this.$message.success("删除成功");
  162. },
  163. },
  164. };
  165. </script>
  166. <style lang="less" scoped>
  167. .dis_box {
  168. background-color: #eee;
  169. padding: 10px 10px 0px;
  170. display: flex;
  171. margin-bottom: 16px;
  172. .left_box {
  173. flex: 1;
  174. }
  175. .clear_style {
  176. flex-shrink: 0;
  177. width: 80px;
  178. vertical-align: top;
  179. text-align: center;
  180. }
  181. }
  182. .elform_style {
  183. max-height: 620px;
  184. overflow: auto;
  185. }
  186. .p_style {
  187. font-size: 12px;
  188. color: #a4a4a4;
  189. margin: 0;
  190. }
  191. </style>