teamList.vue 16 KB

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