salarySet.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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. isSetSalary: {
  135. type: Boolean,
  136. required: true
  137. }
  138. },
  139. data () {
  140. return {
  141. searchForm: {
  142. salary: ''
  143. },
  144. defaultTableList: [],
  145. gradientTableList: [],
  146. subList: [],
  147. isok: true,
  148. hasDate: false
  149. }
  150. },
  151. mounted () {
  152. sessionStorage.setItem('setStep', 4)
  153. getTeamDetail({ musicGroupId: this.teamid }).then(res => {
  154. if (res.code == 200) {
  155. this.searchForm.salary = res.data.settlementType;
  156. if (!res.data.settlementType) {
  157. this.hasDate = true;
  158. }
  159. if (this.searchForm.salary == 'TEACHER_DEFAULT') {
  160. findMusicGroupClassTeacherSalary({ musicGroupId: this.teamid, type: 'TEACHER_DEFAULT' }).then(res => {
  161. if (res.code == 200) {
  162. this.defaultTableList = res.data;
  163. this.changeSalary(this.searchForm.salary);
  164. }
  165. })
  166. } else if (this.searchForm.salary == 'GRADIENT_SALARY') {
  167. findMusicGroupClassTeacherSalary({ musicGroupId: this.teamid, type: 'GRADIENT_SALARY' }).then(res => {
  168. if (res.code == 200) {
  169. this.gradientTableList = res.data;
  170. this.changeSalary(this.searchForm.salary);
  171. }
  172. })
  173. } else if (this.searchForm.salary == 'CLASSROOM_SALARY') {
  174. findMusicGroupClassTeacherSalary({ musicGroupId: this.teamid, type: 'CLASSROOM_SALARY' }).then(res => {
  175. if (res.code == 200) {
  176. this.defaultTableList = res.data;
  177. this.changeSalary(this.searchForm.salary);
  178. }
  179. })
  180. }
  181. }
  182. })
  183. // 获取乐团收费类型
  184. // 获取默认老师列表 类型为默认
  185. // GRADIENT_SALARY
  186. // 类型为梯度
  187. }, methods: {
  188. gotoNext () {
  189. if (this.isSetSalary) {
  190. this.$message.error('课酬确认后无法编辑')
  191. return;
  192. }
  193. if (!this.isok) {
  194. this.$message.error('有老师未设置默认课酬,请设置后再试')
  195. }
  196. if (this.searchForm.salary == 'TEACHER_DEFAULT' || this.searchForm.salary == 'CLASSROOM_SALARY') {
  197. // 组件默认课酬
  198. for (let i in this.defaultTableList) {
  199. for (let j in this.defaultTableList[i].classGroupTeacherMapperList) {
  200. let obj = {}
  201. obj.musicGroupId = this.teamid;
  202. obj.classGroupId = this.defaultTableList[i].id;
  203. obj.userId = this.defaultTableList[i].classGroupTeacherMapperList[j].userId;
  204. obj.teacherRole = this.defaultTableList[i].classGroupTeacherMapperList[j].teacherRole;
  205. obj.teacherDefaultMusicGroupSalaryList = this.defaultTableList[i].classGroupTeacherMapperList[j].teacherDefaultMusicGroupSalaryList;
  206. this.subList.push(obj);
  207. }
  208. }
  209. } else if (this.searchForm.salary == 'GRADIENT_SALARY') {
  210. // 组件梯度课酬
  211. for (let i in this.gradientTableList) {
  212. for (let j in this.gradientTableList[i].classGroupTeacherMapperList) {
  213. let obj = {}
  214. obj.musicGroupId = this.teamid;
  215. obj.classGroupId = this.gradientTableList[i].id;
  216. obj.userId = this.gradientTableList[i].classGroupTeacherMapperList[j].userId;
  217. obj.teacherRole = this.gradientTableList[i].classGroupTeacherMapperList[j].teacherRole;
  218. obj.teacherDefaultMusicGroupSalaryList = this.gradientTableList[i].classGroupTeacherMapperList[j].teacherDefaultMusicGroupSalaryList;
  219. this.subList.push(obj);
  220. }
  221. }
  222. }
  223. // let some = {
  224. // teacherDefaultMusicGroupSalaryList: this.subList
  225. // }
  226. setClassGroupTeacherSalary(this.subList).then(res => {
  227. if (res.code == 200) {
  228. this.subList = [];
  229. this.$message.success('恭喜您设置成功');
  230. this.$router.push({ path: '/business/teamDetail' })
  231. }
  232. }).catch(res => {
  233. this.$message.error('提交失败')
  234. this.subList = [];
  235. })
  236. },
  237. changeSalary (val) {
  238. this.searchForm.salary = val;
  239. // this.hasDate = false;
  240. this.getList()
  241. return
  242. if (val == 'TEACHER_DEFAULT') {
  243. for (let i in this.defaultTableList) {
  244. for (let j in this.defaultTableList[i].classGroupTeacherMapperList) {
  245. if (this.defaultTableList[i].classGroupTeacherMapperList[j].teacherDefaultMusicGroupSalaryList.length <= 0 || this.defaultTableList[i].classGroupTeacherMapperList[j].teacherDefaultMusicGroupSalaryList) {
  246. this.$message.error('还有老师课酬未设置')
  247. this.isok = false;
  248. return
  249. }
  250. }
  251. }
  252. } else if (val == 'GRADIENT_SALARY') {
  253. for (let i in this.gradientTableList) {
  254. for (let j in this.gradientTableList[i].classGroupTeacherMapperList) {
  255. if (this.gradientTableList[i].classGroupTeacherMapperList[j].teacherDefaultMusicGroupSalaryList.length <= 0 || this.gradientTableList[i].classGroupTeacherMapperList[j].teacherDefaultMusicGroupSalaryList) {
  256. this.$message.error('还有老师课酬未确认')
  257. this.isok = false;
  258. return
  259. }
  260. }
  261. }
  262. }
  263. },
  264. getList () {
  265. getTeamDetail({ musicGroupId: this.teamid }).then(res => {
  266. if (res.code == 200) {
  267. // this.searchForm.salary = res.data.settlementType;
  268. if (this.searchForm.salary == 'TEACHER_DEFAULT') {
  269. findMusicGroupClassTeacherSalary({ musicGroupId: this.teamid, type: 'TEACHER_DEFAULT' }).then(res => {
  270. if (res.code == 200) {
  271. this.defaultTableList = res.data;
  272. // this.changeSalary(this.searchForm.salary);
  273. }
  274. })
  275. } else if (this.searchForm.salary == 'GRADIENT_SALARY') {
  276. findMusicGroupClassTeacherSalary({ musicGroupId: this.teamid, type: 'GRADIENT_SALARY' }).then(res => {
  277. if (res.code == 200) {
  278. this.gradientTableList = res.data;
  279. // this.changeSalary(this.searchForm.salary);
  280. }
  281. })
  282. } else if (this.searchForm.salary == 'CLASSROOM_SALARY') {
  283. findMusicGroupClassTeacherSalary({ musicGroupId: this.teamid, type: 'CLASSROOM_SALARY' }).then(res => {
  284. if (res.code == 200) {
  285. this.defaultTableList = res.data;
  286. // this.changeSalary(this.searchForm.salary);
  287. }
  288. })
  289. }
  290. }
  291. })
  292. }
  293. },
  294. }
  295. </script>
  296. <style lang="scss">
  297. .salary-container {
  298. padding: 47px 58px;
  299. background-color: #fff;
  300. min-height: 75vh;
  301. }
  302. </style>