courseTimerSetting.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <div class="m-container">
  3. <save-form
  4. :inline="true"
  5. class="searchForm"
  6. ref="searchForm"
  7. @submit="search"
  8. @reset="reset"
  9. :saveKey="'courseTimerSetting'"
  10. :model.sync="searchForm"
  11. >
  12. <el-form-item :rules="[]">
  13. <el-select
  14. class="multiple"
  15. v-model.trim="searchForm.organId"
  16. filterable
  17. clearable
  18. placeholder="请选择分部"
  19. >
  20. <el-option
  21. v-for="(item, index) in selects.branchs"
  22. :key="index"
  23. :label="item.name"
  24. :value="item.id"
  25. ></el-option>
  26. </el-select>
  27. </el-form-item>
  28. <el-form-item>
  29. <el-select
  30. class="multiple"
  31. v-model.trim="searchForm.courseScheduleType"
  32. filterable
  33. clearable
  34. placeholder="课程类型"
  35. >
  36. <el-option
  37. v-for="(item, index) in courseType"
  38. :key="index"
  39. :label="item.label"
  40. :value="item.value"
  41. ></el-option>
  42. </el-select>
  43. </el-form-item>
  44. <el-form-item>
  45. <el-button native-type="submit" type="danger">搜索</el-button>
  46. <el-button native-type="reset" type="primary">重置</el-button>
  47. </el-form-item>
  48. </save-form>
  49. <el-button style="margin-bottom: 20px;" type="primary" v-permission="'organizationCourseDurationSettings/insert'" @click="openJob('create')" icon="el-icon-plus">添加</el-button>
  50. <!-- 列表 -->
  51. <div class="tableWrap">
  52. <el-table
  53. :data="tableList"
  54. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  55. >
  56. <el-table-column align="center" prop="organ.name" label="分部名称">
  57. </el-table-column>
  58. <el-table-column
  59. align="center"
  60. prop="classGroupTypeName"
  61. label="课程形式"
  62. >
  63. <template slot-scope="scope">
  64. <div>
  65. {{ scope.row.courseType | coursesType }}
  66. </div>
  67. </template>
  68. </el-table-column>
  69. <el-table-column align="center" label="课程课时" prop="duration">
  70. <!-- <template slot-scope="scope">
  71. {{ scope.row.subjectName ? scope.row.subjectName : "无" }}
  72. </template> -->
  73. </el-table-column>
  74. <el-table-column align="center" label="操作">
  75. <template slot-scope="scope">
  76. <el-button
  77. @click="resetCourseTime(scope.row)"
  78. v-permission="'organizationCourseDurationSettings/update'"
  79. type="text"
  80. >修改</el-button
  81. >
  82. <!-- <el-button
  83. @click="delCourseTime(scope.row)"
  84. v-permission="'courseHomeworkTemplate/del'"
  85. type="text"
  86. >删除</el-button> -->
  87. </template>
  88. </el-table-column>
  89. </el-table>
  90. <pagination
  91. :saveKey="'courseTimerSetting'"
  92. sync
  93. :total.sync="pageInfo.total"
  94. :page.sync="pageInfo.page"
  95. :limit.sync="pageInfo.limit"
  96. :page-sizes="pageInfo.page_size"
  97. @pagination="getList"
  98. />
  99. </div>
  100. <el-dialog
  101. :title="isAdd ? '新增课时时长' : '修改课时时长'"
  102. class="courseMask"
  103. width="600px"
  104. :visible.sync="courseVisible"
  105. >
  106. <courseTimeForm
  107. ref="courseTimeForm"
  108. :activeRow="activeRow"
  109. v-if="courseVisible"
  110. :organList="selects.branchs"
  111. :courseType="courseType"
  112. @close="close"
  113. />
  114. <div slot="footer" class="dialog-footer">
  115. <el-button @click="courseVisible = false">取 消</el-button>
  116. <el-button type="primary" @click="submitInfo">确 定</el-button>
  117. </div>
  118. </el-dialog>
  119. </div>
  120. </template>
  121. <script>
  122. import pagination from "@/components/Pagination/index";
  123. import { musicCourseType } from "@/utils/searchArray";
  124. import { getOrganizationCourseDurationSettings,delOrganizationCourseDurationSettings } from "@/api/specialSetting";
  125. import courseTimeForm from "./modals/courseTimeForm";
  126. const initSearch = {
  127. courseScheduleType: null,
  128. organId: null,
  129. };
  130. export default {
  131. components: { pagination, courseTimeForm },
  132. data() {
  133. return {
  134. tableList: [],
  135. pageInfo: {
  136. // 分页规则
  137. limit: 10, // 限制显示条数
  138. page: 1, // 当前页
  139. total: 0, // 总条数
  140. page_size: [10, 20, 40, 50], // 选择限制显示条数
  141. },
  142. searchForm: { ...initSearch },
  143. courseType: musicCourseType,
  144. isAdd: true,
  145. courseVisible: false,
  146. activeRow: null,
  147. };
  148. },
  149. mounted() {
  150. this.$store.dispatch("setBranchs");
  151. this.getList();
  152. },
  153. methods: {
  154. async getList() {
  155. try {
  156. const res = await getOrganizationCourseDurationSettings({
  157. ...this.searchForm,
  158. page: this.pageInfo.page,
  159. rows: this.pageInfo.limit,
  160. });
  161. this.pageInfo.total = res.data.total;
  162. this.tableList = res.data.rows;
  163. } catch (e) {}
  164. },
  165. search() {
  166. this.pageInfo.page = 1;
  167. this.$refs.searchForm.save(this.searchForm);
  168. this.$refs.searchForm.save(this.pageInfo, "page");
  169. this.getList();
  170. },
  171. reset() {
  172. this.searchForm = { ...initSearch };
  173. this.search();
  174. },
  175. resetCourseTime(row) {
  176. this.isAdd = false;
  177. this.activeRow = row;
  178. this.courseVisible = true;
  179. },
  180. submitInfo() {
  181. const str = this.isAdd ? "create" : "update";
  182. this.$refs.courseTimeForm.submitInfo(str);
  183. },
  184. close() {
  185. this.courseVisible = false;
  186. this.getList();
  187. },
  188. openJob() {
  189. this.isAdd = true;
  190. this.activeRow = null;
  191. this.courseVisible = true;
  192. },
  193. async delCourseTime(row) {
  194. this.$confirm("是否删除?", "提示", {
  195. confirmButtonText: "确定",
  196. cancelButtonText: "取消",
  197. type: "warning",
  198. }).then( async() => {
  199. try{
  200. const res = await delOrganizationCourseDurationSettings({ id:row.id})
  201. this.$message.success('删除成功')
  202. this.getList()
  203. }catch{}
  204. });
  205. },
  206. },
  207. };
  208. </script>
  209. <style lang="scss" scoped>
  210. </style>