detail.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <div>
  3. <el-form
  4. :inline="true"
  5. :model="searchForm"
  6. ref="searchForm"
  7. @submit.native.prevent="search"
  8. @reset.native.prevent="onReSet"
  9. >
  10. <el-form-item prop="search">
  11. <el-input
  12. v-model.trim="searchForm.search"
  13. clearable
  14. @keyup.enter.native="search"
  15. placeholder="学生姓名或手机号"
  16. ></el-input>
  17. </el-form-item>
  18. <el-form-item prop="subjectId">
  19. <el-select
  20. v-model.trim="searchForm.subjectId"
  21. filterable
  22. clearable
  23. placeholder="请选择声部"
  24. @change="changeSound"
  25. >
  26. <el-option
  27. v-for="(item, i) in soundList"
  28. :key="i"
  29. :label="item.text"
  30. :value="item.value"
  31. ></el-option>
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item prop="specification">
  35. <el-select
  36. v-model.trim="searchForm.specification"
  37. filterable
  38. clearable
  39. placeholder="请选择品牌型号"
  40. :disabled="!searchForm.subjectId"
  41. >
  42. <el-option
  43. v-for="(item, index) in branchList"
  44. :key="index"
  45. :label="item.name"
  46. :value="item.id"
  47. ></el-option>
  48. </el-select>
  49. </el-form-item>
  50. <!-- <el-form-item prop="hasYesFirstAnswer">
  51. <el-select
  52. v-model.trim="searchForm.hasYesFirstAnswer"
  53. filterable
  54. clearable
  55. placeholder="请选择是否参加市赛"
  56. >
  57. <el-option label="是" :value="1"></el-option>
  58. <el-option label="否" :value="0"></el-option>
  59. </el-select>
  60. </el-form-item> -->
  61. <el-form-item prop="hasInstrumentsId">
  62. <el-select
  63. v-model.trim="searchForm.hasInstrumentsId"
  64. filterable
  65. clearable
  66. placeholder="请选择是置换乐器"
  67. >
  68. <el-option label="是" :value="true"></el-option>
  69. <el-option label="否" :value="false"></el-option>
  70. </el-select>
  71. </el-form-item>
  72. <el-form-item>
  73. <el-button native-type="submit" type="primary">搜索</el-button>
  74. <el-button native-type="reset" type="danger">重置</el-button>
  75. </el-form-item>
  76. </el-form>
  77. <div class="tableWrap">
  78. <el-table
  79. style="width: 100% !important"
  80. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  81. :data="tableList"
  82. max-height="500"
  83. >
  84. <el-table-column
  85. align="center"
  86. prop="userId"
  87. label="学员编号"
  88. ></el-table-column>
  89. <el-table-column
  90. align="center"
  91. prop="userName"
  92. label="学员姓名"
  93. ></el-table-column>
  94. <el-table-column
  95. align="center"
  96. prop="mobileNo"
  97. label="联系电话"
  98. ></el-table-column>
  99. <!-- <el-table-column
  100. align="center"
  101. prop="question1"
  102. label="是否参加市赛"
  103. >
  104. </el-table-column> -->
  105. <el-table-column
  106. align="center"
  107. label="是否置换"
  108. >
  109. <template slot-scope="scope">
  110. {{ scope.row.instrumentsId ? '是' : '否' }}
  111. </template>
  112. </el-table-column>
  113. <el-table-column
  114. align="center"
  115. prop="subjectName"
  116. label="声部"
  117. ></el-table-column>
  118. <el-table-column align="center" prop="studentId" label="品牌型号">
  119. <template slot-scope="scope">
  120. <div>{{ scope.row.brand }}{{ scope.row.specification }}</div>
  121. </template>
  122. </el-table-column>
  123. <el-table-column align="center" prop="payStatus" label="缴费状态">
  124. <template slot-scope="scope">
  125. <div>
  126. {{ scope.row.payStatus | replacementInsFilter }}
  127. </div>
  128. </template>
  129. </el-table-column>
  130. <el-table-column align="center" label="其他建议">
  131. <template slot-scope="scope">
  132. <Tooltip
  133. :content="
  134. scope.row.otherSuggestion ? scope.row.otherSuggestion : ''
  135. "
  136. />
  137. </template>
  138. </el-table-column>
  139. <el-table-column align="center" prop="studentId" label="操作">
  140. <template slot-scope="scope">
  141. <div>
  142. <el-button
  143. type="text"
  144. @click="resetMusic(scope.row)"
  145. v-if="
  146. permission('replacementInstrumentActivity/update') &&
  147. scope.row.payStatus == 0
  148. "
  149. >修改</el-button
  150. >
  151. </div>
  152. </template>
  153. </el-table-column>
  154. </el-table>
  155. <pagination
  156. :total="rules.total"
  157. :page.sync="rules.page"
  158. :limit.sync="rules.limit"
  159. :page-sizes="rules.page_size"
  160. @pagination="getList"
  161. />
  162. </div>
  163. <el-dialog
  164. title="修改信息"
  165. :visible.sync="dialogVisible"
  166. width="600px"
  167. append-to-body
  168. v-if="dialogVisible"
  169. >
  170. <resetInfo
  171. @close="close"
  172. :detail="resetRow"
  173. ref="resetInfo"
  174. @getList="getList"
  175. />
  176. <div slot="footer">
  177. <el-button @click="dialogVisible = false">取 消</el-button>
  178. <el-button type="primary" @click="updateInfo">确认修改</el-button>
  179. </div>
  180. </el-dialog>
  181. </div>
  182. </template>
  183. <script>
  184. import pagination from "@/components/Pagination/index";
  185. import resetInfo from "./resetInfo";
  186. import { getInstrumentSoundList, getInstrumentActivityList } from "../api";
  187. import ItemVue from "@/layout/components/Sidebar/Item.vue";
  188. import Tooltip from "@/components/Tooltip/index";
  189. import { permission } from "@/utils/directivePage";
  190. const soundList = [
  191. { text: "长笛", value: 2 },
  192. { text: "单簧管", value: 4 },
  193. { text: "萨克斯", value: 5 },
  194. { text: "小号", value: 12 },
  195. { text: "圆号", value: 13 },
  196. { text: "长号", value: 14 },
  197. { text: "上低音号", value: 15 },
  198. { text: "大号", value: 17 },
  199. { text: "打击乐", value: 23 },
  200. ];
  201. export default {
  202. components: { pagination, resetInfo, Tooltip },
  203. props: ["detail"],
  204. data() {
  205. return {
  206. searchForm: {
  207. cooperationId: "",
  208. specification: "",
  209. search: "",
  210. subjectId: "",
  211. hasYesFirstAnswer: '',
  212. hasInstrumentsId: ''
  213. },
  214. tableList: [],
  215. rules: {
  216. // 分页规则
  217. limit: 10, // 限制显示条数
  218. page: 1, // 当前页
  219. total: 0, // 总条数
  220. page_size: [10, 20, 40, 50], // 选择限制显示条数
  221. },
  222. dialogVisible: false,
  223. branchList: [],
  224. resetRow: null,
  225. soundList:soundList
  226. };
  227. },
  228. mounted() {
  229. this.init();
  230. },
  231. methods: {
  232. async init() {
  233. this.searchForm.cooperationId = this.detail.id;
  234. await this.$store.dispatch("setSubjects");
  235. this.getList();
  236. },
  237. async getList() {
  238. try {
  239. const res = await getInstrumentActivityList({
  240. ...this.searchForm,
  241. page: this.rules.page,
  242. rows: this.rules.limit,
  243. });
  244. let temp = res.data.rows || []
  245. temp.forEach(item => {
  246. let questionResult = item.questionResult.split('')
  247. item.question1 = questionResult[0] == 1 ? '是' : '否'
  248. })
  249. this.tableList = temp;
  250. this.rules.total = res.data.total;
  251. } catch (e) {}
  252. },
  253. search() {
  254. this.rules.page = 1;
  255. this.getList();
  256. },
  257. onReSet() {
  258. this.$refs.searchForm.resetFields();
  259. this.searchForm.cooperationId = this.detail.id;
  260. this.search();
  261. },
  262. resetMusic(row) {
  263. this.resetRow = row;
  264. this.dialogVisible = true;
  265. },
  266. close() {
  267. this.dialogVisible = false;
  268. },
  269. async changeSound(val) {
  270. this.searchForm.brand = "";
  271. if (val) {
  272. try {
  273. const res = await getInstrumentSoundList({
  274. subjectId: val,
  275. page: 1,
  276. rows: 999,
  277. });
  278. this.branchList = res.data.rows.map((item) => {
  279. return {
  280. name: item.brand + item.specification,
  281. id: item.specification,
  282. };
  283. });
  284. console.log(res);
  285. } catch (e) {
  286. console.log(e);
  287. }
  288. }
  289. },
  290. updateInfo() {
  291. this.$refs.resetInfo.submited();
  292. },
  293. permission(str, parent) {
  294. return permission(str, parent);
  295. },
  296. },
  297. };
  298. </script>
  299. <style lang="less" scoped>
  300. /deep/.el-table th {
  301. background: #edeef0;
  302. }
  303. </style>