salarySet.vue 13 KB

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