TrainingPlanManage.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <div class="training-plan-manage">
  3. <div class="part-box part-box-filter part-box-flex">
  4. <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
  5. <template v-if="checkPrivilege('condition', 'condition')">
  6. <el-form-item label="专业:">
  7. <professional-select
  8. v-model="filter.professionalId"
  9. placeholder="专业"
  10. ></professional-select>
  11. </el-form-item>
  12. <el-form-item label="培养方案名称:">
  13. <el-input
  14. v-model.trim="filter.name"
  15. placeholder="培养方案名称"
  16. clearable
  17. ></el-input>
  18. </el-form-item>
  19. </template>
  20. <el-form-item label-width="0px">
  21. <el-button
  22. v-if="checkPrivilege('button', 'select')"
  23. type="primary"
  24. @click="search"
  25. >查询</el-button
  26. >
  27. </el-form-item>
  28. </el-form>
  29. <div class="part-box-action">
  30. <el-button
  31. v-if="checkPrivilege('button', 'add')"
  32. type="primary"
  33. icon="el-icon-add"
  34. @click="toAdd"
  35. >新增</el-button
  36. >
  37. </div>
  38. </div>
  39. <div class="part-box part-box-pad">
  40. <el-table ref="TableList" :data="dataList">
  41. <el-table-column
  42. type="index"
  43. label="序号"
  44. width="70"
  45. :index="indexMethod"
  46. ></el-table-column>
  47. <el-table-column prop="name" label="培养方案名称"> </el-table-column>
  48. <el-table-column prop="professionalName" label="专业">
  49. </el-table-column>
  50. <el-table-column prop="targetCount" label="培养目标">
  51. <span slot-scope="scope"> {{ scope.row.targetCount }}个 </span>
  52. </el-table-column>
  53. <el-table-column prop="requirementCount" label="毕业要求">
  54. <span slot-scope="scope"> {{ scope.row.requirementCount }}项 </span>
  55. </el-table-column>
  56. <el-table-column prop="courseCount" label="课程体系">
  57. <span slot-scope="scope"> {{ scope.row.courseCount }}门 </span>
  58. </el-table-column>
  59. <el-table-column prop="createName" label="创建人">
  60. <span slot-scope="scope">
  61. {{ scope.row.createRealName }}({{ scope.row.createLoginName }})
  62. </span>
  63. </el-table-column>
  64. <el-table-column
  65. class-name="action-column"
  66. label="操作"
  67. width="220"
  68. fixed="right"
  69. >
  70. <template slot-scope="scope">
  71. <el-button
  72. v-if="checkPrivilege('link', 'edit')"
  73. class="btn-primary"
  74. type="text"
  75. @click="toEdit(scope.row)"
  76. >编辑</el-button
  77. >
  78. <el-button
  79. v-if="checkPrivilege('link', 'copy')"
  80. class="btn-primary"
  81. type="text"
  82. @click="toCopy(scope.row)"
  83. >复制</el-button
  84. >
  85. <el-button
  86. v-if="checkPrivilege('link', 'delete')"
  87. class="btn-danger"
  88. type="text"
  89. @click="toDelete(scope.row)"
  90. >删除</el-button
  91. >
  92. <el-button
  93. v-if="checkPrivilege('link', 'CultureProgramDetail')"
  94. class="btn-primary"
  95. type="text"
  96. @click="toDetail(scope.row)"
  97. >查看详情</el-button
  98. >
  99. </template>
  100. </el-table-column>
  101. </el-table>
  102. <div class="part-page">
  103. <el-pagination
  104. background
  105. layout="total, sizes, prev, pager, next, jumper"
  106. :pager-count="5"
  107. :current-page="current"
  108. :total="total"
  109. :page-size="size"
  110. @current-change="toPage"
  111. @size-change="pageSizeChange"
  112. >
  113. </el-pagination>
  114. </div>
  115. </div>
  116. <!-- ModifyTrainingPlan -->
  117. <modify-training-plan
  118. v-if="checkPrivilege('button', 'add') || checkPrivilege('link', 'edit')"
  119. ref="ModifyTrainingPlan"
  120. :instance="curRow"
  121. @modified="getList"
  122. ></modify-training-plan>
  123. <!-- DetailTrainingPlan -->
  124. <detail-training-plan
  125. v-if="checkPrivilege('link', 'CultureProgramDetail')"
  126. ref="DetailTrainingPlan"
  127. :row-data="curRow"
  128. @modified="getList"
  129. ></detail-training-plan>
  130. </div>
  131. </template>
  132. <script>
  133. import {
  134. trainingPlanListPage,
  135. deleteTrainingPlan,
  136. copyTrainingPlan,
  137. } from "../api";
  138. import ModifyTrainingPlan from "../components/training-plan/ModifyTrainingPlan.vue";
  139. import DetailTrainingPlan from "../components/training-plan/DetailTrainingPlan.vue";
  140. export default {
  141. name: "training-plan-manage",
  142. components: { ModifyTrainingPlan, DetailTrainingPlan },
  143. data() {
  144. return {
  145. filter: {
  146. professionalId: "",
  147. name: "",
  148. },
  149. current: 1,
  150. size: this.GLOBAL.pageSize,
  151. total: 0,
  152. dataList: [],
  153. curRow: {},
  154. };
  155. },
  156. mounted() {
  157. this.toPage(1);
  158. },
  159. methods: {
  160. async getList() {
  161. if (!this.checkPrivilege("list", "list")) return;
  162. const datas = {
  163. ...this.filter,
  164. pageNumber: this.current,
  165. pageSize: this.size,
  166. };
  167. const data = await trainingPlanListPage(datas);
  168. this.dataList = data.records;
  169. this.total = data.total;
  170. },
  171. toPage(page) {
  172. this.current = page;
  173. this.getList();
  174. },
  175. search() {
  176. this.toPage(1);
  177. },
  178. toAdd() {
  179. this.curRow = {};
  180. this.$refs.ModifyTrainingPlan.open();
  181. },
  182. toEdit(row) {
  183. this.curRow = row;
  184. this.$refs.ModifyTrainingPlan.open();
  185. },
  186. async toDelete(row) {
  187. const confirm = await this.$confirm(
  188. `确定要删除培养方案【${row.name}】吗?`,
  189. "提示",
  190. {
  191. type: "warning",
  192. }
  193. ).catch(() => {});
  194. if (confirm !== "confirm") return;
  195. await deleteTrainingPlan(row.id);
  196. this.$message.success("删除成功!");
  197. this.deletePageLastItem();
  198. },
  199. async toCopy(row) {
  200. const confirm = await this.$confirm(
  201. `确定要复制培养方案【${row.name}】吗?`,
  202. "提示",
  203. {
  204. type: "warning",
  205. }
  206. ).catch(() => {});
  207. if (confirm !== "confirm") return;
  208. await copyTrainingPlan(row.id);
  209. this.$message.success("复制成功!");
  210. this.getList();
  211. },
  212. toDetail(row) {
  213. this.curRow = row;
  214. this.$refs.DetailTrainingPlan.open();
  215. },
  216. },
  217. };
  218. </script>