studentLebao.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <div>
  3. <save-form
  4. :inline="true"
  5. class="searchForm"
  6. :model="searchForm"
  7. @submit="onSearch"
  8. @reset="onReSet"
  9. save-key="studentDetail-studentLebao"
  10. >
  11. <el-form-item prop="specification">
  12. <el-input
  13. placeholder="具体型号"
  14. clearable
  15. @keyup.enter.native="onSearch"
  16. v-model.trim="searchForm.specification"
  17. ></el-input>
  18. </el-form-item>
  19. <el-form-item prop="goodsCategoryId">
  20. <el-select
  21. v-model.trim="searchForm.goodsCategoryId"
  22. clearable
  23. placeholder="乐器分类"
  24. >
  25. <el-option
  26. v-for="(item, index) in categoryList"
  27. :key="index"
  28. :label="item.label"
  29. :value="item.value"
  30. ></el-option>
  31. </el-select>
  32. </el-form-item>
  33. <el-form-item prop="status">
  34. <el-select
  35. v-model.trim="searchForm.status"
  36. filterable
  37. clearable
  38. placeholder="是否乐保"
  39. >
  40. <el-option value="0" label="否"></el-option>
  41. <el-option value="1" label="是"></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-form-item>
  47. <el-form-item>
  48. <el-button type="primary" native-type="reset">重置</el-button>
  49. </el-form-item>
  50. </save-form>
  51. <el-button @click="addMusicVisible = true" type="primary" v-permission="'studentInstrument/add'"
  52. >新增乐器</el-button
  53. >
  54. <div class="tableWrap">
  55. <el-table
  56. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  57. :data="tableList"
  58. >
  59. <el-table-column label="具体型号" align="center" prop="id">
  60. <template slot-scope="scope">
  61. <copy-text>{{ scope.row.goodsName }}</copy-text>
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="乐器分类" align="center" prop="name">
  65. <template slot-scope="scope">
  66. <copy-text>{{ scope.row.goodsCategoryName }}</copy-text>
  67. </template>
  68. </el-table-column>
  69. <el-table-column label="是否乐保" align="center" prop="teacherName">
  70. <template slot-scope="scope">
  71. {{ scope.row.status?'是':'否' }}
  72. </template>
  73. </el-table-column>
  74. <el-table-column label="乐保有效期" align="center" prop="studentNum">
  75. <template slot-scope="scope">
  76. <div>
  77. {{ scope.row.startTime|formatTimer}}~{{scope.row.endTime | formatTimer}}
  78. </div>
  79. </template>
  80. </el-table-column>
  81. </el-table>
  82. <pagination
  83. save-key="studentDetail-studentLebao"
  84. sync
  85. :total.sync="pageInfo.total"
  86. :page.sync="pageInfo.page"
  87. :limit.sync="pageInfo.limit"
  88. :page-sizes="pageInfo.page_size"
  89. @pagination="getList"
  90. />
  91. </div>
  92. <el-dialog
  93. title="新增乐器"
  94. width="600px"
  95. :visible.sync="addMusicVisible"
  96. v-if="addMusicVisible"
  97. >
  98. <addMusic :categoryList='categoryList' ref='addMusic' @getList='getList' @close='addMusicVisible = false'/>
  99. <span slot="footer" class="dialog-footer">
  100. <el-button @click="addMusicVisible = false">取 消</el-button>
  101. <el-button type="primary" @click="addMusicSubmit">确 定</el-button>
  102. </span>
  103. </el-dialog>
  104. </div>
  105. </template>
  106. <script>
  107. import pagination from "@/components/Pagination/index";
  108. import addMusic from "../modals/addMusic";
  109. import { getInstrument } from "@/api/buildTeam";
  110. import { categoryListTree } from "@/api/businessManager";
  111. export default {
  112. components: { pagination, addMusic },
  113. data() {
  114. return {
  115. soundLists: [],
  116. tableList: [],
  117. searchForm: {
  118. specification:'',
  119. goodsCategoryId: "",
  120. studentId:this.$route.query.userId
  121. },
  122. pageInfo: {
  123. // 分页规则
  124. limit: 10, // 限制显示条数
  125. page: 1, // 当前页
  126. total: 0, // 总条数
  127. page_size: [10, 20, 40, 50], // 选择限制显示条数
  128. },
  129. addMusicVisible: false,
  130. categoryList: [],
  131. };
  132. },
  133. mounted() {
  134. this.getCategory();
  135. this.getList()
  136. },
  137. methods: {
  138. onSearch() {
  139. this.pageInfo.page = 1;
  140. this.getList()
  141. },
  142. onReSet() {},
  143. async getList() {
  144. try{
  145. const res = await getInstrument({...this.searchForm,rows:this.pageInfo.limit,page:this.pageInfo.page})
  146. this.tableList = res.data.rows
  147. }catch(e){
  148. console.log(e)
  149. }
  150. },
  151. addMusicSubmit() {
  152. this.$refs.addMusic.addMusicSubmit()
  153. },
  154. getCategory() {
  155. let params = {
  156. delFlag: 0,
  157. rows: 9999,
  158. };
  159. categoryListTree(params).then((res) => {
  160. let result = res.data;
  161. if (res.code == 200) {
  162. let tempArray = [];
  163. result.rows.forEach((row) => {
  164. tempArray.push({
  165. label: row.name,
  166. value: row.id,
  167. });
  168. });
  169. this.categoryList = tempArray;
  170. }
  171. });
  172. },
  173. },
  174. };
  175. </script>
  176. <style lang="scss" scoped>
  177. .tableWrap {
  178. margin-top: 20px;
  179. }
  180. </style>