teamList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. <template>
  2. <div class="m-container">
  3. <h2>乐团列表</h2>
  4. <div class="m-core">
  5. <div class="btnList">
  6. <div class='newBand'
  7. @click="createNewTeam">新建乐团</div>
  8. <div class='newBand'
  9. @click="resetTeam">乐团调整</div>
  10. </div>
  11. <el-form :inline="true"
  12. class="topForm"
  13. ref="topForm"
  14. :model="topForm">
  15. <el-form-item prop='teamName'>
  16. <el-input v-model="topForm.teamName"
  17. placeholder="请输入乐团名称"></el-input>
  18. </el-form-item>
  19. <!-- 多选 -->
  20. <el-form-item prop='status'>
  21. <el-select class='multiple'
  22. v-model="topForm.status"
  23. clearable
  24. placeholder="请选择乐团状态">
  25. <el-option v-for="(item,index) in nowStatus"
  26. :key="index"
  27. :label="item.text"
  28. :value="item.value"></el-option>
  29. </el-select>
  30. </el-form-item>
  31. <!-- 收费类型 -->
  32. <el-form-item prop='payType'>
  33. <el-select v-model="topForm.payType"
  34. placeholder="请选择收费类型"
  35. clearable>
  36. <el-option v-for="(item,index) in typeList"
  37. :key='index'
  38. :label="item.name"
  39. :value="item.id"></el-option>
  40. </el-select>
  41. </el-form-item>
  42. <el-form-item>
  43. <div class='searchBtn'
  44. @click="getList">搜索</div>
  45. </el-form-item>
  46. </el-form>
  47. <div class="tableWrap">
  48. <el-table style="width: 100%"
  49. @selection-change="handleSelectionChange"
  50. :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  51. :data='tableData'>
  52. <el-table-column type="selection"
  53. :selectable="checkSelectable"
  54. width="50">
  55. </el-table-column>
  56. <el-table-column prop="id"
  57. align='center'
  58. label="乐团编号">
  59. </el-table-column>
  60. <el-table-column prop="name"
  61. align='center'
  62. label="乐团名称">
  63. </el-table-column>
  64. <el-table-column align='center'
  65. width="200px"
  66. prop="cooperationOrganName"
  67. max-width='274'
  68. label="合作单位">
  69. </el-table-column>
  70. <el-table-column prop="status"
  71. align='center'
  72. label="乐团状态">
  73. <template slot-scope="scope">
  74. <div>
  75. {{ scope.row.status | teamStatus }}
  76. </div>
  77. </template>
  78. </el-table-column>
  79. <el-table-column align='center'
  80. prop="chargeTypeName"
  81. label="收费类型">
  82. </el-table-column>
  83. <el-table-column prop="educationalTeacherName"
  84. align='center'
  85. label="教务老师">
  86. </el-table-column>
  87. <el-table-column prop="teamTeacherName"
  88. align='center'
  89. label="教学主管">
  90. </el-table-column>
  91. <el-table-column prop="improventClassesNum"
  92. align='center'
  93. label="成团人数">
  94. </el-table-column>
  95. <el-table-column prop="payNum"
  96. align='center'
  97. label="在读人数">
  98. </el-table-column>
  99. <!-- <el-table-column prop="course"
  100. align='center'
  101. label="当前课时">
  102. </el-table-column> -->
  103. <el-table-column prop="createTime"
  104. align='center'
  105. label="申请时间">
  106. <template slot-scope="scope">
  107. <div>
  108. {{ scope.row.createTime | formatTimer}}
  109. </div>
  110. </template>
  111. </el-table-column>
  112. <el-table-column align='center'
  113. label="成团时间">
  114. <template slot-scope="scope">
  115. <div>
  116. {{ scope.row.billStartDate | formatTimer}}
  117. </div>
  118. </template>
  119. </el-table-column>
  120. <el-table-column align='center'
  121. width='200px'
  122. label="操作">
  123. <template slot-scope="scope">
  124. <div>
  125. <el-button type="text"
  126. v-if="scope.row.status == 'PREPARE'"
  127. @click="gotoImprovement(scope.row)">小班课设置</el-button>
  128. <el-button type="text"
  129. v-if="scope.row.status == 'PREPARE'"
  130. @click="gotodetailList(scope.row)">发放清单</el-button>
  131. <el-button type="text"
  132. v-if="scope.row.status == 'PROGRESS'"
  133. @click="lookTeamDetail(scope.row)">查看</el-button>
  134. <el-button type="text"
  135. v-if="scope.row.status != 'PROGRESS'"
  136. @click="lookTeamDetail(scope.row)">编辑</el-button>
  137. <el-button v-if="scope.row.status == 'PAUSE'"
  138. @click="onTeamOpeation('start', scope.row)"
  139. type="text">启动</el-button>
  140. <el-button v-if="scope.row.status == 'PROGRESS'"
  141. @click="onTeamOpeation('pause', scope.row)"
  142. type="text">暂停</el-button>
  143. </div>
  144. </template>
  145. </el-table-column>
  146. </el-table>
  147. <!-- 分页器 -->
  148. <!-- 分页 -->
  149. <pagination :total="rules.total"
  150. :page.sync="rules.page"
  151. :limit.sync="rules.limit"
  152. :page-sizes="rules.page_size"
  153. @pagination="getList" />
  154. </div>
  155. </div>
  156. </div>
  157. </template>
  158. <script>
  159. import pagination from '@/components/Pagination/index'
  160. // import { truncate } from 'fs';
  161. import { getTeamList, getPayType } from '@/api/teamServer'
  162. import { getCooperation } from '@/api/buildTeam'
  163. export default {
  164. name: "Main",
  165. data () {
  166. return {
  167. topForm: {
  168. teamName: '',
  169. status: '',
  170. payType: '',
  171. word: ''
  172. },
  173. typeList: [], // 收费类型
  174. nowStatus: [{ // 状态数组
  175. value: 'APPLY', text: '报名中'
  176. },
  177. {
  178. value: 'PAY', text: '缴费中'
  179. }, {
  180. value: 'PREPARE', text: '筹备中'
  181. },
  182. {
  183. value: 'PROGRESS', text: '进行中'
  184. }, {
  185. value: 'CANCELED', text: '取消'
  186. }, {
  187. value: 'AUDIT', text: '审核中'
  188. },
  189. {
  190. value: 'PAUSE', text: '暂停'
  191. }, {
  192. value: 'DRAFT', text: '编辑中'
  193. }, {
  194. value: 'AUDIT_FAILED', text: '审核失败'
  195. }
  196. ],
  197. searchLsit: [], // 存储选择后的数组
  198. tableData: [], // table数据
  199. rules: {
  200. // 分页规则
  201. limit: 10, // 限制显示条数
  202. page: 1, // 当前页
  203. total: 0, // 总条数
  204. page_size: [10, 20, 40, 50] // 选择限制显示条数
  205. },
  206. passed: [], // 传递的参数
  207. }
  208. },
  209. components: {
  210. pagination
  211. },
  212. mounted () {
  213. this.getList();
  214. // 获取乐团收费类型
  215. getPayType().then(res => {
  216. // console.log(res);
  217. if (res.code == 200) {
  218. this.typeList = res.data.rows;
  219. }
  220. })
  221. // 获取乐团合作单位(学校)
  222. // getCooperation().then(res => {
  223. // })
  224. },
  225. methods: {
  226. getList () {
  227. /**
  228. *
  229. * teamName: '',
  230. status: [],
  231. payType: '',
  232. *
  233. */
  234. getTeamList({
  235. rows: this.rules.limit,
  236. page: this.rules.page,
  237. organId: this.$store.getters.organ,
  238. chargeTypeId: this.topForm.payType,
  239. musicGroupName: this.topForm.teamName
  240. }).then(res => {
  241. if (res.code == 200) {
  242. this.tableData = res.data.rows
  243. this.rules.total = res.data.total
  244. }
  245. })
  246. },
  247. createNewTeam () {
  248. this.$router.push({ path: '/business/teamBuild', query: { type: 'newTeam' } })
  249. },
  250. resetTeam () {
  251. // 这里还有勾选的乐团信息
  252. if (this.passed && this.passed.length <= 0) {
  253. this.$message.error('请至少选择一个乐团进行调整')
  254. return
  255. }
  256. this.$router.push({ path: '/business/teamBuild', query: { type: 'teamList', teamList: this.passed } })
  257. },
  258. setSearchList (obj) {
  259. //
  260. // 没有相同的key=>添加这个对象
  261. // 有相同的key => 替换这个对象
  262. if (obj.type == 1) {
  263. let flag = false;
  264. this.searchLsit = this.searchLsit.map(item => {
  265. if (item.id == obj.id) {
  266. item = obj;
  267. flag = true;
  268. }
  269. return item;
  270. })
  271. if (!flag) {
  272. this.searchLsit.push(obj)
  273. }
  274. } else {
  275. let flag = false;
  276. this.searchLsit = this.searchLsit.map(item => {
  277. if (item.key == obj.key) {
  278. // 多选框的再次点击=> 等于 就是删除
  279. item = obj;
  280. flag = true;
  281. }
  282. return item;
  283. })
  284. if (!flag) {
  285. this.searchLsit.push(obj)
  286. }
  287. }
  288. },
  289. closeSearch (item) {
  290. // 1.删除search里的元素
  291. if (item.type == 1) {
  292. for (let some in this.searchLsit) {
  293. if (this.searchLsit[some].id == item.id) {
  294. this.searchLsit.splice(some, 1);
  295. }
  296. }
  297. // 2.清空对应元素所对应的的值
  298. this.topForm[item.id] = '';
  299. } else {
  300. for (let i = 0; i < this.topForm[item.id].length; i++) {
  301. if (this.topForm[item.id][i] == item.value) {
  302. this.topForm[item.id].splice(i, 1);
  303. }
  304. }
  305. // 处理search
  306. for (let some in this.searchLsit) {
  307. if (this.searchLsit[some].value == item.value && this.searchLsit[some].id == item.id) {
  308. this.searchLsit.splice(some, 1);
  309. }
  310. // id: 'school', key: this.schools[item].text, value: val, type: 1
  311. }
  312. }
  313. },
  314. onTeamOpeation (type, row) {
  315. if (type == 'start') {
  316. resumeMusicGroup({ musicGroupId: row.id }).then(res => {
  317. if (res.code == 200) {
  318. this.$message.success('开启成功')
  319. this.getList()
  320. } else {
  321. this.$message.error(res.msg)
  322. }
  323. })
  324. } else if (type == 'pause') {
  325. pauseMusicGroup({ musicGroupId: row.id }).then(res => {
  326. if (res.code == 200) {
  327. this.$message.success('暂停成功')
  328. this.getList()
  329. } else {
  330. this.$message.error(res.msg)
  331. }
  332. })
  333. }
  334. },
  335. gotoSearch () {
  336. this.$refs['topForm'].resetFields();
  337. this.searchLsit = [];
  338. },
  339. lookTeamDetail (row) {
  340. switch (row.status) {
  341. case 'DRAFT': {
  342. // 编辑中
  343. this.$router.push({ path: '/business/teamBuild', query: { type: 'teamDraft', id: row.id } })
  344. break;
  345. }
  346. case 'AUDIT': {
  347. // 审核中
  348. break;
  349. }
  350. case 'AUDIT_FAILED': {
  351. // 审核失败
  352. break;
  353. }
  354. case 'APPLY': {
  355. // 报名中
  356. console.log('报名中')
  357. this.$router.push({ path: `/business/signupList`, query: { status: row.status, id: row.id, name: row.name } })
  358. break;
  359. }
  360. case 'PAY': {
  361. // 缴费中
  362. console.log('缴费中')
  363. this.$router.push({ path: `/business/signupList`, query: { status: row.status, id: row.id, name: row.name } })
  364. break;
  365. }
  366. case 'PREPARE': {
  367. // 筹备中 跳转到乐团设置界面
  368. this.$router.push({ path: `/business/teamSeting`, query: { status: row.status, id: row.id, name: row.name } })
  369. break;
  370. }
  371. case 'PROGRESS': {
  372. // 进行中
  373. // 调到乐团详情 teamDetails
  374. this.$router.push({ path: `/business/teamDetails`, query: { status: row.status, id: row.id, name: row.name } })
  375. console.log('进行中')
  376. break
  377. }
  378. case 'CANCELED': {
  379. // 取消
  380. console.log('取消')
  381. break
  382. }
  383. case 'PAUSE': {
  384. // 暂停
  385. break;
  386. }
  387. }
  388. },
  389. checkSelectable (row) {
  390. return row.status == 'PROGRESS'
  391. },
  392. handleSelectionChange (arr) {
  393. this.passed = [];
  394. for (let i in arr) {
  395. let obj = {};
  396. obj.id = arr[i].id;
  397. obj.name = arr[i].name;
  398. this.passed.push(obj)
  399. }
  400. },
  401. gotodetailList (row) {
  402. // row.id
  403. this.$router.push({ path: '/business/teamDetailedList', query: { id: row.id } })
  404. },
  405. // setImprovement 设置小班课
  406. gotoImprovement (row) {
  407. this.$router.push({ path: '/business/setImprovement', query: { id: row.id } })
  408. }
  409. },
  410. }
  411. </script>
  412. <style lang="scss" scoped>
  413. .select {
  414. font-size: 14px;
  415. }
  416. .btnList {
  417. display: flex;
  418. flex-direction: row;
  419. justify-content: flex-start;
  420. align-items: center;
  421. div {
  422. margin-right: 15px;
  423. }
  424. }
  425. </style>