salarySet.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <div class='salary-container'>
  3. <!-- <el-form :inline="true"
  4. :model="searchForm">
  5. <el-form-item label="课酬结算标准">
  6. <el-select v-model="searchForm.salary"
  7. @change="changeSalary">
  8. <el-option label="课时默认结算"
  9. value="TEACHER_DEFAULT"></el-option>
  10. <el-option label="课时梯度结算"
  11. value="GRADIENT_SALARY"></el-option>
  12. </el-select>
  13. </el-form-item>
  14. </el-form> -->
  15. <div class="tableWrap"
  16. v-if='searchForm.salary == "TEACHER_DEFAULT" || searchForm.salary =="CLASSROOM_SALARY"'>
  17. <el-table :data="defaultTableList"
  18. :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  19. row-key="id"
  20. border
  21. default-expand-all
  22. :tree-props="{children: 'classGroupTeacherMapperList', hasChildren: 'hasChildren'}">
  23. <el-table-column label="班级名称"
  24. width="180px"
  25. prop='name'>
  26. </el-table-column>
  27. <el-table-column label="老师名称"
  28. width="180px"
  29. prop='userName'>
  30. </el-table-column>
  31. <el-table-column label="老师类型"
  32. width="180px"
  33. prop="teacherRole">
  34. <template slot-scope="scope">
  35. <div>
  36. {{ scope.row.teacherRole|workType}}
  37. </div>
  38. </template>
  39. </el-table-column>
  40. <el-table-column label="金额">
  41. <template slot-scope="scope">
  42. <div v-if="scope.row.teacherDefaultMusicGroupSalaryList&&scope.row.teacherDefaultMusicGroupSalaryList[0]&&scope.row.teacherDefaultMusicGroupSalaryList[0]">
  43. <span>课酬:</span>
  44. <!-- &&scope.row.teacherDefaultMusicGroupSalaryList[0].mainTeacherSalary &&scope.row.teacherDefaultMusicGroupSalaryList[0].mainTeacherSalary-->
  45. <el-input style="width: 80px;margin-right:10px"
  46. v-if='scope.row.teacherDefaultMusicGroupSalaryList&&scope.row.teacherDefaultMusicGroupSalaryList[0]&&scope.row.teacherRole =="TEACHING"'
  47. v-model="scope.row.teacherDefaultMusicGroupSalaryList[0].assistantTeacherSalary"></el-input>
  48. <el-input style="width: 80px;margin-right:10px"
  49. v-if='scope.row.teacherDefaultMusicGroupSalaryList&&scope.row.teacherDefaultMusicGroupSalaryList[0]&&scope.row.teacherRole =="BISHOP"'
  50. v-model="scope.row.teacherDefaultMusicGroupSalaryList[0].mainTeacherSalary"></el-input>
  51. </div>
  52. </template>
  53. </el-table-column>
  54. </el-table>
  55. </div>
  56. <div class="tableWrap"
  57. v-if='searchForm.salary == "GRADIENT_SALARY"'>
  58. <el-table :data="gradientTableList"
  59. :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  60. row-key="id"
  61. border
  62. default-expand-all
  63. :tree-props="{children: 'classGroupTeacherMapperList', hasChildren: 'hasChildren'}">
  64. <el-table-column label="班级名称"
  65. width="180px"
  66. prop='name'>
  67. </el-table-column>
  68. <el-table-column label="老师名称"
  69. width="180px"
  70. prop='userName'>
  71. </el-table-column>
  72. <el-table-column label="老师类型"
  73. width="180px"
  74. prop="teacherRole">
  75. <template slot-scope="scope">
  76. <div>
  77. {{ scope.row.teacherRole|workType}}
  78. </div>
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="金额">
  82. <template slot-scope="scope">
  83. <div v-if='scope.row.teacherDefaultMusicGroupSalaryList'>
  84. <div v-for="(item,index) in scope.row.teacherDefaultMusicGroupSalaryList"
  85. v-if="scope.row.teacherRole =='TEACHING'"
  86. style="display: table-cell;"
  87. :key='index'>
  88. <span>梯度{{index+1}}:</span>
  89. <el-input style="width: 80px;margin-right:10px"
  90. v-model="scope.row.teacherDefaultMusicGroupSalaryList[index].assistantTeacherSalary"></el-input>
  91. </div>
  92. <div v-for="(item,index) in scope.row.teacherDefaultMusicGroupSalaryList"
  93. v-if="scope.row.teacherRole =='BISHOP'"
  94. style="display: table-cell;"
  95. :key='index'>
  96. <span>梯度{{index+1}}:</span>
  97. <el-input style="width: 80px;margin-right:10px"
  98. v-model="scope.row.teacherDefaultMusicGroupSalaryList[index].mainTeacherSalary"></el-input>
  99. </div>
  100. <!-- <el-input v-if='scope.row.teacherDefaultMusicGroupSalaryList&&scope.row.teacherDefaultMusicGroupSalaryList[0]&&scope.row.teacherDefaultMusicGroupSalaryList[0].mainTeacherSalary&&scope.row.teacherRole =="TEACHING"'
  101. v-model="scope.row.teacherDefaultMusicGroupSalaryList[0].mainTeacherSalary"></el-input>
  102. <el-input v-if='scope.row.teacherDefaultMusicGroupSalaryList&&scope.row.teacherDefaultMusicGroupSalaryList[0]&&scope.row.teacherDefaultMusicGroupSalaryList[0].mainTeacherSalary&&scope.row.teacherRole =="BISHOP"'
  103. v-model="scope.row.teacherDefaultMusicGroupSalaryList[0].assistantTeacherSalary"></el-input> -->
  104. </div>
  105. </template>
  106. </el-table-column>
  107. </el-table>
  108. </div>
  109. <!-- 确认取消 -->
  110. <div class="btnWrap"
  111. style="margin-top:40px;">
  112. <div class="nextBtn"
  113. @click='gotoNext'>下一步</div>
  114. <div class="okBtn">返回</div>
  115. </div>
  116. </div>
  117. </template>
  118. <script>
  119. import { findMusicGroupClassTeacherSalary, setClassGroupTeacherSalary, getTeamDetail } from '@/api/buildTeam'
  120. import { format } from 'path'
  121. export default {
  122. props: {
  123. teamid: {
  124. type: String,
  125. required: true
  126. }
  127. },
  128. data () {
  129. return {
  130. searchForm: {
  131. salary: ''
  132. },
  133. defaultTableList: [],
  134. gradientTableList: [],
  135. subList: [],
  136. isok: true
  137. }
  138. },
  139. mounted () {
  140. getTeamDetail({ musicGroupId: this.teamid }).then(res => {
  141. if (res.code == 200) {
  142. this.searchForm.salary = res.data.settlementType;
  143. if (this.searchForm.salary == 'TEACHER_DEFAULT') {
  144. findMusicGroupClassTeacherSalary({ musicGroupId: this.teamid, type: 'TEACHER_DEFAULT' }).then(res => {
  145. if (res.code == 200) {
  146. this.defaultTableList = res.data;
  147. this.changeSalary(this.searchForm.salary);
  148. }
  149. })
  150. } else if (this.searchForm.salary == 'GRADIENT_SALARY') {
  151. findMusicGroupClassTeacherSalary({ musicGroupId: this.teamid, type: 'GRADIENT_SALARY' }).then(res => {
  152. if (res.code == 200) {
  153. this.gradientTableList = res.data;
  154. this.changeSalary(this.searchForm.salary);
  155. }
  156. })
  157. } else if (this.searchForm.salary == 'CLASSROOM_SALARY') {
  158. findMusicGroupClassTeacherSalary({ musicGroupId: this.teamid, type: 'CLASSROOM_SALARY' }).then(res => {
  159. if (res.code == 200) {
  160. this.defaultTableList = res.data;
  161. this.changeSalary(this.searchForm.salary);
  162. }
  163. })
  164. }
  165. }
  166. })
  167. // 获取乐团收费类型
  168. // 获取默认老师列表 类型为默认
  169. // GRADIENT_SALARY
  170. // 类型为梯度
  171. }, methods: {
  172. gotoNext () {
  173. if (!this.isok) {
  174. this.$message.error('有老师未设置默认课酬,请设置后再试')
  175. }
  176. if (this.searchForm.salary == 'TEACHER_DEFAULT' || this.searchForm.salary == 'CLASSROOM_SALARY') {
  177. // 组件默认课酬
  178. for (let i in this.defaultTableList) {
  179. for (let j in this.defaultTableList[i].classGroupTeacherMapperList) {
  180. let obj = {}
  181. obj.classGroupId = this.defaultTableList[i].id;
  182. obj.userId = this.defaultTableList[i].classGroupTeacherMapperList[j].userId;
  183. obj.teacherRole = this.defaultTableList[i].classGroupTeacherMapperList[j].teacherRole;
  184. obj.teacherDefaultMusicGroupSalaryList = this.defaultTableList[i].classGroupTeacherMapperList[j].teacherDefaultMusicGroupSalaryList;
  185. this.subList.push(obj);
  186. }
  187. }
  188. } else if (this.searchForm.salary == 'GRADIENT_SALARY') {
  189. // 组件梯度课酬
  190. for (let i in this.defaultTableList) {
  191. for (let j in this.defaultTableList[i].classGroupTeacherMapperList) {
  192. let obj = {}
  193. obj.classGroupId = this.defaultTableList[i].id;
  194. obj.userId = this.defaultTableList[i].classGroupTeacherMapperList[j].userId;
  195. obj.teacherRole = this.defaultTableList[i].classGroupTeacherMapperList[j].teacherRole;
  196. obj.teacherDefaultMusicGroupSalaryList = this.defaultTableList[i].classGroupTeacherMapperList[j].teacherDefaultMusicGroupSalaryList;
  197. this.subList.push(obj);
  198. }
  199. }
  200. }
  201. setClassGroupTeacherSalary(this.subList).then(res => {
  202. if (res.code == 200) {
  203. this.subList = [];
  204. this.$message.success('恭喜您设置成功');
  205. this.$router.push({ path: '/business/teamDetail' })
  206. }
  207. }).catch(res => {
  208. this.$message.error('提交失败')
  209. this.subList = [];
  210. })
  211. },
  212. changeSalary (val) {
  213. return
  214. if (val == 'TEACHER_DEFAULT') {
  215. for (let i in this.defaultTableList) {
  216. for (let j in this.defaultTableList[i].classGroupTeacherMapperList) {
  217. if (this.defaultTableList[i].classGroupTeacherMapperList[j].teacherDefaultMusicGroupSalaryList.length <= 0 || this.defaultTableList[i].classGroupTeacherMapperList[j].teacherDefaultMusicGroupSalaryList) {
  218. this.$message.error('还有老师课酬未设置')
  219. this.isok = false;
  220. return
  221. }
  222. }
  223. }
  224. } else if (val == 'GRADIENT_SALARY') {
  225. for (let i in this.gradientTableList) {
  226. for (let j in this.gradientTableList[i].classGroupTeacherMapperList) {
  227. if (this.gradientTableList[i].classGroupTeacherMapperList[j].teacherDefaultMusicGroupSalaryList.length <= 0 || this.gradientTableList[i].classGroupTeacherMapperList[j].teacherDefaultMusicGroupSalaryList) {
  228. this.$message.error('还有老师课酬未确认')
  229. this.isok = false;
  230. return
  231. }
  232. }
  233. }
  234. }
  235. }
  236. },
  237. }
  238. </script>
  239. <style lang="scss">
  240. .salary-container {
  241. padding: 47px 58px;
  242. background-color: #fff;
  243. min-height: 75vh;
  244. }
  245. </style>