salaryList.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <div>
  3. <el-form :inline="true"
  4. class="searchForm"
  5. v-model.trim="searchForm">
  6. <el-form-item>
  7. <el-date-picker v-model.trim="searchForm.date"
  8. style='width:400;'
  9. type="daterange"
  10. align="right"
  11. unlink-panels
  12. range-separator="-"
  13. start-placeholder="开始日期"
  14. end-placeholder="结束日期"
  15. value-format="yyyy-MM-dd"
  16. :picker-options="pickerOptions">
  17. </el-date-picker>
  18. </el-form-item>
  19. <el-form-item>
  20. <el-button @click="search"
  21. type="danger">搜索</el-button>
  22. </el-form-item>
  23. </el-form>
  24. <!-- 查询列表 -->
  25. <!-- 列表 -->
  26. <div class="tableWrap">
  27. <el-table :data='tableList'
  28. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  29. <el-table-column align='center'
  30. label="时间">
  31. <template slot-scope="scope">
  32. {{ scope.row.classDate }} {{ scope.row.startClassTime ? scope.row.startClassTime.substr(0, 5) : '' }}-{{ scope.row.endClassTime ? scope.row.endClassTime.substr(0, 5) : '' }}
  33. </template>
  34. </el-table-column>
  35. <el-table-column align='center'
  36. prop="classGroupName"
  37. label="班级名称">
  38. </el-table-column>
  39. <el-table-column align='center'
  40. prop="courseScheduleType"
  41. label="课程类型">
  42. <template slot-scope="scope">
  43. <div>
  44. {{ scope.row.courseScheduleType | coursesType}}
  45. </div>
  46. </template>
  47. </el-table-column>
  48. <el-table-column align='center'
  49. prop="teacherNum"
  50. label="老师人数">
  51. </el-table-column>
  52. <el-table-column align='center'
  53. label="操作">
  54. <template slot-scope="scope">
  55. <div>
  56. <el-button type='text'
  57. v-if="permission('courseSchedule/queryTeacherSalary')"
  58. @click="setCourseInfo(scope.row)">课酬调整</el-button>
  59. </div>
  60. </template>
  61. </el-table-column>
  62. </el-table>
  63. <pagination :total="rules.total"
  64. :page.sync="rules.page"
  65. :limit.sync="rules.limit"
  66. :page-sizes="rules.page_size"
  67. @pagination="getList" />
  68. </div>
  69. <el-dialog title="课酬调整"
  70. width="800px"
  71. :visible.sync="dialogTableVisible">
  72. <el-table :data="activeTeacherList"
  73. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  74. <el-table-column label="老师姓名"
  75. prop="teacherName"></el-table-column>
  76. <el-table-column label="老师角色">
  77. <template slot-scope="scope">
  78. <div>
  79. {{ scope.row.teacherRole |workType }}
  80. </div>
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="课程课酬"
  84. prop="expectSalary"></el-table-column>
  85. <el-table-column label="课时补贴"
  86. prop="subsidy"></el-table-column>
  87. <el-table-column label="操作">
  88. <template slot-scope="scope">
  89. <div>
  90. <el-button type='text'
  91. v-if="permission('courseSchedule/updateTeacherCoursesSalary')"
  92. @click="resetTeacher(scope.row)">操作</el-button>
  93. </div>
  94. </template>
  95. </el-table-column>
  96. </el-table>
  97. <el-dialog width="500px"
  98. title=""
  99. :visible.sync="innerVisible"
  100. append-to-body>
  101. <!-- 修改代码 -->
  102. <el-form :model="teacherMask"
  103. :rules="teacherRules"
  104. ref='teacherMask'>
  105. <el-form-item label="调整范围"
  106. prop="radio">
  107. <el-radio v-model.trim="teacherMask.radio"
  108. label="all">之后剩余课次</el-radio>
  109. <el-radio v-model.trim="teacherMask.radio"
  110. label="one">仅限本次</el-radio>
  111. </el-form-item>
  112. <el-form-item label="课程课酬"
  113. prop="salary">
  114. <el-input style="width:180px"
  115. v-model.trim="teacherMask.salary"></el-input>
  116. </el-form-item>
  117. <el-form-item label="课时补贴"
  118. prop="subsidy">
  119. <el-input style="width:180px"
  120. v-model.trim="teacherMask.subsidy"></el-input>
  121. </el-form-item>
  122. </el-form>
  123. <div slot="footer"
  124. class="dialog-footer">
  125. <el-button @click="innerVisible = false">取 消</el-button>
  126. <el-button type="primary"
  127. @click="resetSalary">确 定</el-button>
  128. </div>
  129. </el-dialog>
  130. </el-dialog>
  131. </div>
  132. </template>
  133. <script>
  134. import pagination from '@/components/Pagination/index'
  135. import { getCourseList, getTeacherSalary } from '@/api/buildTeam'
  136. import { updateTeacherCoursesSalary } from '@/api/teacherManager'
  137. import { permission } from '@/utils/directivePage'
  138. export default {
  139. name: 'tsalaryList',
  140. props: ['teamid'],
  141. data () {
  142. return {
  143. dialogTableVisible: false,
  144. innerVisible: false,
  145. searchForm: {
  146. date: '' // 时间选择器返回的值
  147. },
  148. pickerOptions: {
  149. shortcuts: [{
  150. text: '最近一周',
  151. onClick (picker) {
  152. const end = new Date();
  153. const start = new Date();
  154. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  155. picker.$emit('pick', [start, end]);
  156. }
  157. }, {
  158. text: '最近一个月',
  159. onClick (picker) {
  160. const end = new Date();
  161. const start = new Date();
  162. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  163. picker.$emit('pick', [start, end]);
  164. }
  165. }, {
  166. text: '最近三个月',
  167. onClick (picker) {
  168. const end = new Date();
  169. const start = new Date();
  170. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  171. picker.$emit('pick', [start, end]);
  172. }
  173. }]
  174. }, // 时间选择器默认选项
  175. tableList: [], // table列表
  176. rules: {
  177. // 分页规则
  178. limit: 10, // 限制显示条数
  179. page: 1, // 当前页
  180. total: 0, // 总条数
  181. page_size: [10, 20, 40, 50] // 选择限制显示条数
  182. },
  183. searchLsit: [],
  184. activeTeacherList: [{ 1: 1 }],
  185. teacherMask: {
  186. salary: '',
  187. subsidy: '',
  188. radio: ''
  189. },
  190. courseScheduleId: '',
  191. teacherRules: {
  192. salary: [{ required: true, message: '请输入课程课酬', trigger: 'blur' }],
  193. subsidy: [{ required: true, message: '请输入课时补贴', trigger: 'blur' }],
  194. radio: [{ required: true, message: '请选择调整范围', trigger: 'blur' }]
  195. },
  196. tempSelectRow: {}, // 选中班级数据
  197. }
  198. },
  199. components: {
  200. pagination
  201. },
  202. mounted () {
  203. this.getList();
  204. },
  205. activated () {
  206. this.getList()
  207. },
  208. methods: {
  209. permission(str) {
  210. return permission(str)
  211. },
  212. search () {
  213. this.rules.page = 1;
  214. this.getList();
  215. },
  216. getList () {
  217. // searchForm.date
  218. if (!this.searchForm.date) {
  219. this.searchForm.date = []
  220. }
  221. let obj = {
  222. musicGroupId: this.teamid,
  223. startTime: this.searchForm.date[0] || null,
  224. endTime: this.searchForm.date[1] || null,
  225. page: this.rules.page, rows: this.rules.limit
  226. }
  227. getCourseList(obj).then(res => {
  228. if (res.code == 200) {
  229. this.tableList = res.data.rows;
  230. this.rules.total = res.data.total;
  231. }
  232. })
  233. },
  234. setCourseInfo (row) {
  235. this.tempSelectRow = row
  236. getTeacherSalary({ courseScheduleId: row.courseScheduleId }).then(res => {
  237. if (res.code == 200) {
  238. this.dialogTableVisible = true;
  239. this.courseScheduleId = row.courseScheduleId;
  240. // row.teachingTeachers
  241. this.activeTeacherList = res.data;
  242. }
  243. })
  244. },
  245. resetTeacher (row) {
  246. this.innerVisible = true;
  247. this.activeTeacher = row;
  248. },
  249. resetSalary () {
  250. let that = this
  251. this.$refs['teacherMask'].validate(res => {
  252. if (res) {
  253. updateTeacherCoursesSalary({
  254. courseScheduleId: this.courseScheduleId,
  255. salary: this.teacherMask.salary,
  256. teacherId: this.activeTeacher.teacherId,
  257. subsidy: this.teacherMask.subsidy,
  258. scope: this.teacherMask.radio
  259. }).then(res => {
  260. if (res.code == 200) {
  261. this.$message.success('修改成功')
  262. this.teacherMask = {
  263. salary: '',
  264. subsidy: '',
  265. radio: ''
  266. }
  267. // this.dialogTableVisible = false;
  268. this.innerVisible = false;
  269. that.setCourseInfo(this.tempSelectRow)
  270. }
  271. })
  272. } else {
  273. this.$message.error('请填写必要参数')
  274. }
  275. })
  276. }
  277. }
  278. }
  279. </script>
  280. <style lang="scss" scope>
  281. </style>