salarySet.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <div class='salary-container'>
  3. <el-form :inline="true"
  4. v-if="hasDate"
  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. v-if="scope.row.teacherRole =='TEACHING'"
  89. style="display: table-cell;"
  90. :key='item.id'>
  91. <!-- 梯度{{index+1}}: -->
  92. <span>课酬:</span>
  93. <el-input style="width: 80px;margin-right:10px"
  94. v-model="scope.row.teacherDefaultMusicGroupSalaryList[index].assistantTeacher90MinSalary"></el-input>
  95. </div>
  96. <div v-for="(item,index) in scope.row.teacherDefaultMusicGroupSalaryList"
  97. v-if="scope.row.teacherRole =='BISHOP'"
  98. style="display: table-cell;"
  99. :key='item.id'>
  100. <span>课酬:</span>
  101. <el-input style="width: 80px;margin-right:10px"
  102. v-model="scope.row.teacherDefaultMusicGroupSalaryList[index].mainTeacher90MinSalary"></el-input>
  103. </div>
  104. <!-- <el-input v-if='scope.row.teacherDefaultMusicGroupSalaryList&&scope.row.teacherDefaultMusicGroupSalaryList[0]&&scope.row.teacherDefaultMusicGroupSalaryList[0].mainTeacherSalary&&scope.row.teacherRole =="TEACHING"'
  105. v-model="scope.row.teacherDefaultMusicGroupSalaryList[0].mainTeacherSalary"></el-input>
  106. <el-input v-if='scope.row.teacherDefaultMusicGroupSalaryList&&scope.row.teacherDefaultMusicGroupSalaryList[0]&&scope.row.teacherDefaultMusicGroupSalaryList[0].mainTeacherSalary&&scope.row.teacherRole =="BISHOP"'
  107. v-model="scope.row.teacherDefaultMusicGroupSalaryList[0].assistantTeacherSalary"></el-input> -->
  108. </div>
  109. </template>
  110. </el-table-column>
  111. </el-table>
  112. </div>
  113. <!-- 确认取消 -->
  114. <div class="btnWrap"
  115. style="margin-top:40px;">
  116. <div class="nextBtn"
  117. @click='gotoNext'>确定</div>
  118. <!-- <div class="okBtn">返回</div> -->
  119. </div>
  120. </div>
  121. </template>
  122. <script>
  123. import { findMusicGroupClassTeacherSalary, setClassGroupTeacherSalary, getTeamDetail } from '@/api/buildTeam'
  124. import { format } from 'path'
  125. export default {
  126. props: {
  127. teamid: {
  128. type: String,
  129. required: true
  130. }
  131. },
  132. data () {
  133. return {
  134. searchForm: {
  135. salary: ''
  136. },
  137. defaultTableList: [],
  138. gradientTableList: [],
  139. subList: [],
  140. isok: true,
  141. hasDate: false
  142. }
  143. },
  144. mounted () {
  145. sessionStorage.setItem('setStep', 4)
  146. getTeamDetail({ musicGroupId: this.teamid }).then(res => {
  147. if (res.code == 200) {
  148. this.searchForm.salary = res.data.musicGroup.settlementType;
  149. if (!res.data.musicGroup.settlementType) {
  150. this.hasDate = true;
  151. }
  152. if (this.searchForm.salary == 'TEACHER_DEFAULT') {
  153. findMusicGroupClassTeacherSalary({ musicGroupId: this.teamid, type: 'TEACHER_DEFAULT' }).then(res => {
  154. if (res.code == 200) {
  155. this.defaultTableList = res.data;
  156. this.changeSalary(this.searchForm.salary);
  157. }
  158. })
  159. } else if (this.searchForm.salary == 'GRADIENT_SALARY') {
  160. findMusicGroupClassTeacherSalary({ musicGroupId: this.teamid, type: 'GRADIENT_SALARY' }).then(res => {
  161. if (res.code == 200) {
  162. this.gradientTableList = res.data;
  163. this.changeSalary(this.searchForm.salary);
  164. }
  165. })
  166. } else if (this.searchForm.salary == 'CLASSROOM_SALARY') {
  167. findMusicGroupClassTeacherSalary({ musicGroupId: this.teamid, type: 'CLASSROOM_SALARY' }).then(res => {
  168. if (res.code == 200) {
  169. this.defaultTableList = res.data;
  170. this.changeSalary(this.searchForm.salary);
  171. }
  172. })
  173. }
  174. }
  175. })
  176. // 获取乐团收费类型
  177. // 获取默认老师列表 类型为默认
  178. // GRADIENT_SALARY
  179. // 类型为梯度
  180. }, methods: {
  181. gotoNext () {
  182. if (!this.isok) {
  183. this.$message.error('有老师未设置默认课酬,请设置后再试')
  184. }
  185. console.log(this.searchForm.salary)
  186. if (this.searchForm.salary == 'TEACHER_DEFAULT' || this.searchForm.salary == 'CLASSROOM_SALARY') {
  187. // 组件默认课酬
  188. for (let i in this.defaultTableList) {
  189. for (let j in this.defaultTableList[i].classGroupTeacherMapperList) {
  190. let obj = {}
  191. obj.musicGroupId = this.teamid;
  192. obj.classGroupId = this.defaultTableList[i].id;
  193. obj.userId = this.defaultTableList[i].classGroupTeacherMapperList[j].userId;
  194. obj.teacherRole = this.defaultTableList[i].classGroupTeacherMapperList[j].teacherRole;
  195. obj.teacherDefaultMusicGroupSalaryList = this.defaultTableList[i].classGroupTeacherMapperList[j].teacherDefaultMusicGroupSalaryList;
  196. this.subList.push(obj);
  197. }
  198. }
  199. } else if (this.searchForm.salary == 'GRADIENT_SALARY') {
  200. // 组件梯度课酬
  201. for (let i in this.gradientTableList) {
  202. for (let j in this.gradientTableList[i].classGroupTeacherMapperList) {
  203. let obj = {}
  204. obj.musicGroupId = this.teamid;
  205. obj.classGroupId = this.gradientTableList[i].id;
  206. obj.userId = this.gradientTableList[i].classGroupTeacherMapperList[j].userId;
  207. obj.teacherRole = this.gradientTableList[i].classGroupTeacherMapperList[j].teacherRole;
  208. obj.teacherDefaultMusicGroupSalaryList = this.gradientTableList[i].classGroupTeacherMapperList[j].teacherDefaultMusicGroupSalaryList;
  209. this.subList.push(obj);
  210. }
  211. }
  212. }
  213. // let some = {
  214. // teacherDefaultMusicGroupSalaryList: this.subList
  215. // }
  216. setClassGroupTeacherSalary(this.subList).then(res => {
  217. if (res.code == 200) {
  218. this.subList = [];
  219. this.$message.success('恭喜您设置成功');
  220. this.$router.push({ path: '/business/teamDetail' })
  221. }
  222. }).catch(res => {
  223. this.$message.error('提交失败')
  224. this.subList = [];
  225. })
  226. },
  227. changeSalary (val) {
  228. this.searchForm.salary = val;
  229. this.getList()
  230. return
  231. if (val == 'TEACHER_DEFAULT') {
  232. for (let i in this.defaultTableList) {
  233. for (let j in this.defaultTableList[i].classGroupTeacherMapperList) {
  234. if (this.defaultTableList[i].classGroupTeacherMapperList[j].teacherDefaultMusicGroupSalaryList.length <= 0 || this.defaultTableList[i].classGroupTeacherMapperList[j].teacherDefaultMusicGroupSalaryList) {
  235. this.$message.error('还有老师课酬未设置')
  236. this.isok = false;
  237. return
  238. }
  239. }
  240. }
  241. } else if (val == 'GRADIENT_SALARY') {
  242. for (let i in this.gradientTableList) {
  243. for (let j in this.gradientTableList[i].classGroupTeacherMapperList) {
  244. if (this.gradientTableList[i].classGroupTeacherMapperList[j].teacherDefaultMusicGroupSalaryList.length <= 0 || this.gradientTableList[i].classGroupTeacherMapperList[j].teacherDefaultMusicGroupSalaryList) {
  245. this.$message.error('还有老师课酬未确认')
  246. this.isok = false;
  247. return
  248. }
  249. }
  250. }
  251. }
  252. },
  253. getList () {
  254. getTeamDetail({ musicGroupId: this.teamid }).then(res => {
  255. if (res.code == 200) {
  256. this.searchForm.salary = res.data.musicGroup.settlementType;
  257. if (!res.data.settlementType) {
  258. this.hasDate = true;
  259. }
  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>