teamList.vue 16 KB

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