salarySet.vue 13 KB

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