detail.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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.openFlag | openFlagStatus }}
  127. </div>
  128. </template>
  129. </el-table-column>
  130. <el-table-column align="center" prop="payStatus" label="缴费状态">
  131. <template slot-scope="scope">
  132. <div>
  133. {{ scope.row.payStatus | replacementInsFilter }}
  134. </div>
  135. </template>
  136. </el-table-column>
  137. <el-table-column align="center" label="其他建议">
  138. <template slot-scope="scope">
  139. <Tooltip
  140. :content="
  141. scope.row.otherSuggestion ? scope.row.otherSuggestion : ''
  142. "
  143. />
  144. </template>
  145. </el-table-column>
  146. <el-table-column align="center" prop="studentId" label="操作" width="150px">
  147. <template slot-scope="scope">
  148. <div>
  149. <el-button
  150. type="text"
  151. @click="openFlagMusic(scope.row)"
  152. v-if="scope.row.openFlag == 0 && scope.row.instrumentsId && permission('replacementInstrumentActivity/updateOpenFlag')"
  153. >开启缴费</el-button>
  154. <el-button
  155. type="text"
  156. @click="resetMusic(scope.row)"
  157. v-if="
  158. permission('replacementInstrumentActivity/update') &&
  159. scope.row.payStatus == 0
  160. "
  161. >修改</el-button
  162. >
  163. </div>
  164. </template>
  165. </el-table-column>
  166. </el-table>
  167. <pagination
  168. :total="rules.total"
  169. :page.sync="rules.page"
  170. :limit.sync="rules.limit"
  171. :page-sizes="rules.page_size"
  172. @pagination="getList"
  173. />
  174. </div>
  175. <el-dialog
  176. title="修改信息"
  177. :visible.sync="dialogVisible"
  178. width="600px"
  179. append-to-body
  180. v-if="dialogVisible"
  181. >
  182. <resetInfo
  183. @close="close"
  184. :detail="resetRow"
  185. ref="resetInfo"
  186. @getList="getList"
  187. />
  188. <div slot="footer">
  189. <el-button @click="dialogVisible = false">取 消</el-button>
  190. <el-button type="primary" @click="updateInfo">确认修改</el-button>
  191. </div>
  192. </el-dialog>
  193. </div>
  194. </template>
  195. <script>
  196. import pagination from "@/components/Pagination/index";
  197. import resetInfo from "./resetInfo";
  198. import { getInstrumentSoundList, getInstrumentActivityList, updateOpenFlag } from "../api";
  199. import ItemVue from "@/layout/components/Sidebar/Item.vue";
  200. import Tooltip from "@/components/Tooltip/index";
  201. import { permission } from "@/utils/directivePage";
  202. const soundList = [
  203. { text: "长笛", value: 2 },
  204. { text: "单簧管", value: 4 },
  205. { text: "萨克斯", value: 5 },
  206. { text: "小号", value: 12 },
  207. { text: "圆号", value: 13 },
  208. { text: "长号", value: 14 },
  209. { text: "上低音号", value: 15 },
  210. { text: "大号", value: 17 },
  211. { text: "打击乐", value: 23 },
  212. ];
  213. export default {
  214. components: { pagination, resetInfo, Tooltip },
  215. props: ["detail"],
  216. data() {
  217. return {
  218. searchForm: {
  219. cooperationId: "",
  220. specification: "",
  221. search: "",
  222. subjectId: "",
  223. hasYesFirstAnswer: '',
  224. hasInstrumentsId: ''
  225. },
  226. tableList: [],
  227. rules: {
  228. // 分页规则
  229. limit: 10, // 限制显示条数
  230. page: 1, // 当前页
  231. total: 0, // 总条数
  232. page_size: [10, 20, 40, 50], // 选择限制显示条数
  233. },
  234. dialogVisible: false,
  235. branchList: [],
  236. resetRow: null,
  237. soundList:soundList
  238. };
  239. },
  240. mounted() {
  241. this.init();
  242. },
  243. methods: {
  244. async init() {
  245. this.searchForm.cooperationId = this.detail.id;
  246. await this.$store.dispatch("setSubjects");
  247. this.getList();
  248. },
  249. async getList() {
  250. try {
  251. const res = await getInstrumentActivityList({
  252. ...this.searchForm,
  253. page: this.rules.page,
  254. rows: this.rules.limit,
  255. });
  256. let temp = res.data.rows || []
  257. temp.forEach(item => {
  258. let questionResult = item.questionResult.split('')
  259. item.question1 = questionResult[0] == 1 ? '是' : '否'
  260. })
  261. this.tableList = temp;
  262. this.rules.total = res.data.total;
  263. } catch (e) {}
  264. },
  265. search() {
  266. this.rules.page = 1;
  267. this.getList();
  268. },
  269. openFlagMusic(row) {
  270. // 开启缴费
  271. this.$confirm('您是否开启缴费?', '提示', {
  272. confirmButtonText: '确定',
  273. cancelButtonText: '取消',
  274. type: 'warning'
  275. }).then(async () => {
  276. try {
  277. await updateOpenFlag({
  278. Id: row.id,
  279. openFlag: 1
  280. })
  281. this.$message.success('开启成功')
  282. this.getList()
  283. } catch {
  284. //
  285. }
  286. })
  287. },
  288. onReSet() {
  289. this.$refs.searchForm.resetFields();
  290. this.searchForm.cooperationId = this.detail.id;
  291. this.search();
  292. },
  293. resetMusic(row) {
  294. this.resetRow = row;
  295. this.dialogVisible = true;
  296. },
  297. close() {
  298. this.dialogVisible = false;
  299. },
  300. async changeSound(val) {
  301. this.searchForm.brand = "";
  302. if (val) {
  303. try {
  304. const res = await getInstrumentSoundList({
  305. subjectId: val,
  306. page: 1,
  307. rows: 999,
  308. });
  309. this.branchList = res.data.rows.map((item) => {
  310. return {
  311. name: item.brand + item.specification,
  312. id: item.specification,
  313. };
  314. });
  315. console.log(res);
  316. } catch (e) {
  317. console.log(e);
  318. }
  319. }
  320. },
  321. updateInfo() {
  322. this.$refs.resetInfo.submited();
  323. },
  324. permission(str, parent) {
  325. return permission(str, parent);
  326. },
  327. },
  328. filters: {
  329. openFlagStatus(val) {
  330. let template = ['否', '是']
  331. return template[val]
  332. }
  333. }
  334. };
  335. </script>
  336. <style lang="less" scoped>
  337. /deep/.el-table th {
  338. background: #edeef0;
  339. }
  340. </style>