salarySet.vue 13 KB

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