salarySet.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. <template>
  2. <div class="salarySet">
  3. <!-- <h4>单次课次参考时长:30min</h4> -->
  4. <div class="tableList">
  5. <div class="left">
  6. <el-table :data="teamTable"
  7. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  8. <el-table-column label="乐团课课酬课时结算">
  9. <template slot-scope="scope">{{ scope.row.courseScheduleType | coursesType }}</template>
  10. </el-table-column>
  11. <el-table-column label="默认课酬-主教">
  12. <template slot-scope="scope">
  13. <el-input type="number"
  14. @mousewheel.native.prevent
  15. v-model.trim="scope.row.mainTeacher30MinSalary"
  16. placeholder="请输入课酬">
  17. <template slot="append"
  18. v-if="scope.row.courseScheduleType == 'HIGH'">元/45分钟</template>
  19. <template slot="append"
  20. v-else-if="scope.row.courseScheduleType == 'CLASSROOM'">元/40分钟</template>
  21. <template slot="append"
  22. v-else>元/30分钟</template>
  23. </el-input>
  24. </template>
  25. </el-table-column>
  26. <el-table-column label="默认课酬-助教">
  27. <template slot-scope="scope">
  28. <el-input type="number"
  29. @mousewheel.native.prevent
  30. v-model.trim="scope.row.assistantTeacher30MinSalary"
  31. placeholder="请输入课酬">
  32. <template slot="append"
  33. v-if="scope.row.courseScheduleType == 'HIGH'">元/45分钟</template>
  34. <template slot="append"
  35. v-else-if="scope.row.courseScheduleType == 'CLASSROOM'">元/40分钟</template>
  36. <template slot="append"
  37. v-else>元/30分钟</template>
  38. </el-input>
  39. </template>
  40. </el-table-column>
  41. <el-table-column label="3.0课酬-主教">
  42. <template slot-scope="scope">
  43. <el-input type="number"
  44. @mousewheel.native.prevent
  45. :disabled="scope.row.courseScheduleType == 'CLASSROOM'"
  46. v-model.trim="scope.row.mainTeacher90MinSalary"
  47. placeholder="请输入课酬">
  48. <template slot="append"
  49. v-if="scope.row.courseScheduleType == 'HIGH'">元/45分钟</template>
  50. <template slot="append"
  51. v-else-if="scope.row.courseScheduleType == 'CLASSROOM'">元/40分钟</template>
  52. <template slot="append"
  53. v-else>元/90分钟</template>
  54. <!-- <template slot="append">元/{{ (scope.row.courseScheduleType == 'HIGH' || scope.row.courseScheduleType == 'CLASSROOM') ? 45 : 90 }}分钟</template> -->
  55. </el-input>
  56. </template>
  57. </el-table-column>
  58. <el-table-column label="3.0课酬-助教">
  59. <template slot-scope="scope">
  60. <el-input type="number"
  61. @mousewheel.native.prevent
  62. :disabled="scope.row.courseScheduleType == 'CLASSROOM'"
  63. v-model.trim="scope.row.assistantTeacher90MinSalary"
  64. placeholder="请输入课酬">
  65. <template slot="append"
  66. v-if="scope.row.courseScheduleType == 'HIGH'">元/45分钟</template>
  67. <template slot="append"
  68. v-else-if="scope.row.courseScheduleType == 'CLASSROOM'">元/40分钟</template>
  69. <template slot="append"
  70. v-else>元/90分钟</template>
  71. <!-- <template slot="append">元/{{ (scope.row.courseScheduleType == 'HIGH' || scope.row.courseScheduleType == 'CLASSROOM') ? 45 : 90 }}分钟</template> -->
  72. </el-input>
  73. </template>
  74. </el-table-column>
  75. </el-table>
  76. <el-table :data="teamSmallTable"
  77. style=" margin-top: 15px;"
  78. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  79. <el-table-column label="">
  80. <template slot-scope="scope">{{ scope.row.courseScheduleType | coursesType }}</template>
  81. </el-table-column>
  82. <el-table-column label="1V1">
  83. <template slot-scope="scope">
  84. <el-input type="number"
  85. @mousewheel.native.prevent
  86. v-model.trim="scope.row.v1"
  87. placeholder="请输入课酬">
  88. <template slot="append">元/节</template>
  89. </el-input>
  90. </template>
  91. </el-table-column>
  92. <el-table-column label="1V2">
  93. <template slot-scope="scope">
  94. <el-input type="number"
  95. @mousewheel.native.prevent
  96. v-model.trim="scope.row.v2"
  97. placeholder="请输入课酬">
  98. <template slot="append">元/节</template>
  99. </el-input>
  100. </template>
  101. </el-table-column>
  102. <el-table-column label="1V3">
  103. <template slot-scope="scope">
  104. <el-input type="number"
  105. @mousewheel.native.prevent
  106. v-model.trim="scope.row.v3"
  107. placeholder="请输入课酬">
  108. <template slot="append">元/节</template>
  109. </el-input>
  110. </template>
  111. </el-table-column>
  112. <el-table-column label="1V4">
  113. <template slot-scope="scope">
  114. <el-input type="number"
  115. @mousewheel.native.prevent
  116. v-model.trim="scope.row.v4"
  117. placeholder="请输入课酬">
  118. <template slot="append">元/节</template>
  119. </el-input>
  120. </template>
  121. </el-table-column>
  122. <el-table-column label="1V5">
  123. <template slot-scope="scope">
  124. <el-input type="number"
  125. @mousewheel.native.prevent
  126. v-model.trim="scope.row.v5"
  127. placeholder="请输入课酬">
  128. <template slot="append">元/节</template>
  129. </el-input>
  130. </template>
  131. </el-table-column>
  132. </el-table>
  133. <el-table :data="vipTable"
  134. style="width: 70%; margin-top: 15px;"
  135. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  136. <el-table-column label="VIP课课酬参考值"
  137. prop="vipGroupCategoryName"></el-table-column>
  138. <!-- <el-table-column label="线上课">
  139. <template slot-scope="scope">
  140. <el-input
  141. type="number"
  142. @mousewheel.native.prevent
  143. v-model.trim="scope.row.onlineClassesSalary"
  144. placeholder="请输入内容"
  145. >
  146. <template slot="append">元/45分钟</template>
  147. </el-input>
  148. </template>
  149. </el-table-column> -->
  150. <el-table-column label="">
  151. <template slot-scope="scope">
  152. <el-input type="number"
  153. @mousewheel.native.prevent
  154. v-model.trim="scope.row.offlineClassesSalary"
  155. placeholder="请输入内容">
  156. <template slot="append">元/45分钟</template>
  157. </el-input>
  158. </template>
  159. </el-table-column>
  160. </el-table>
  161. <el-table :data="accompanyTable"
  162. style="width: 35%; margin-top: 15px;"
  163. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  164. <el-table-column label="网管课">
  165. <template slot-scope="scope">
  166. <el-input type="number"
  167. style="width:195px"
  168. @mousewheel.native.prevent
  169. v-model.trim="scope.row.mainTeacherSalary">
  170. <template slot="append">元/{{scope.row.minutes}}分钟</template>
  171. </el-input>
  172. </template>
  173. </el-table-column>
  174. </el-table>
  175. <el-form style="margin-top: 20px;">
  176. <el-form-item label="生效日期">
  177. <el-date-picker v-model.trim="startDate"
  178. type="date"
  179. value-format="yyyy-MM-dd"
  180. :picker-options="pickerOptions"
  181. placeholder="选择日期"></el-date-picker>
  182. <div style="display: inline; color: red; padding-left: 10px;">说明:本次调整只对生效日期之后(包含当天)且未结算的课程生效;</div>
  183. </el-form-item>
  184. </el-form>
  185. <div style="padding-top: 10px;"
  186. v-permission="pageType == 'create' ? {child: 'teacherDefaultMusicGroupSalary/batchUpset', parent: 'teacherAdd/batchUpset'} : {child: 'teacherDefaultMusicGroupSalary/batchUpset', parent: 'teacherUpdate/batchUpset'}">
  187. <el-button @click="onSave()"
  188. type="primary">保存</el-button>
  189. </div>
  190. </div>
  191. </div>
  192. </div>
  193. </template>
  194. <script>
  195. import {
  196. vipGroupSalaryList,
  197. vipGroupSalarySet,
  198. teacherSalaryList,
  199. teacherSalaryBatchUpset,
  200. teacherDefaultPracticeGroupSalary,
  201. PracticeGroupSalaryUpdate
  202. } from "@/api/teacherManager";
  203. import { sysConfigList } from "@/api/generalSettings";
  204. import { findTeacherDefaultSalary } from "@/api/vipSeting";
  205. let nowTime = new Date();
  206. let checkTime =
  207. nowTime.getFullYear() +
  208. "-" +
  209. (nowTime.getMonth() + 1) +
  210. "-" +
  211. nowTime.getDate();
  212. export default {
  213. props: ["teacherId"],
  214. name: "salarySet",
  215. data () {
  216. return {
  217. pageType: this.$route.query.type, // 页面类型
  218. // teacherId: this.teacherId ? this.teacherId : this.$route.query.teacherId,
  219. teamTable: [
  220. {
  221. assistantTeacher30MinSalary: 0,
  222. assistantTeacher90MinSalary: 0,
  223. courseScheduleType: "SINGLE",
  224. mainTeacher30MinSalary: 0,
  225. mainTeacher90MinSalary: 0,
  226. userId: this.teacherId
  227. },
  228. {
  229. assistantTeacher30MinSalary: 0,
  230. assistantTeacher90MinSalary: 0,
  231. courseScheduleType: "MIX",
  232. mainTeacher30MinSalary: 0,
  233. mainTeacher90MinSalary: 0,
  234. userId: this.teacherId
  235. },
  236. {
  237. assistantTeacher30MinSalary: 0,
  238. assistantTeacher90MinSalary: 0,
  239. courseScheduleType: "COMPREHENSIVE",
  240. mainTeacher30MinSalary: 0,
  241. mainTeacher90MinSalary: 0,
  242. userId: this.teacherId
  243. },
  244. {
  245. assistantTeacher30MinSalary: 0,
  246. assistantTeacher90MinSalary: 0,
  247. courseScheduleType: "TRAINING_SINGLE",
  248. mainTeacher30MinSalary: 0,
  249. mainTeacher90MinSalary: 0,
  250. userId: this.teacherId
  251. },
  252. {
  253. assistantTeacher30MinSalary: 0,
  254. assistantTeacher90MinSalary: 0,
  255. courseScheduleType: "TRAINING_MIX",
  256. mainTeacher30MinSalary: 0,
  257. mainTeacher90MinSalary: 0,
  258. userId: this.teacherId
  259. },
  260. {
  261. assistantTeacher30MinSalary: 0,
  262. assistantTeacher90MinSalary: 0,
  263. courseScheduleType: "HIGH",
  264. mainTeacher30MinSalary: 0,
  265. mainTeacher90MinSalary: 0,
  266. userId: this.teacherId
  267. },
  268. {
  269. assistantTeacher30MinSalary: 0,
  270. assistantTeacher90MinSalary: 0,
  271. courseScheduleType: "CLASSROOM",
  272. mainTeacher30MinSalary: 0,
  273. mainTeacher90MinSalary: 0,
  274. userId: this.teacherId
  275. }
  276. ],
  277. // salaryRuleJson: { 3: 0, 4: 0, 5: 0 },
  278. // userId: this.teacherId
  279. teamSmallTable: [
  280. {
  281. courseScheduleType: "HIGH_ONLINE",
  282. // salaryRuleJson: { 3: 0, 4: 0, 5: 0 },
  283. v1: 0,
  284. v2: 0,
  285. v3: 0,
  286. v4: 0,
  287. v5: 0,
  288. assistantTeacher30MinSalary: 0,
  289. assistantTeacher90MinSalary: 0,
  290. mainTeacher30MinSalary: 0,
  291. mainTeacher90MinSalary: 0,
  292. userId: this.teacherId
  293. },
  294. {
  295. courseScheduleType: "MUSIC_NETWORK",
  296. // salaryRuleJson: { 3: 0, 4: 0, 5: 0 },
  297. v1: 0,
  298. v2: 0,
  299. v3: 0,
  300. v4: 0,
  301. v5: 0,
  302. assistantTeacher30MinSalary: 0,
  303. assistantTeacher90MinSalary: 0,
  304. mainTeacher30MinSalary: 0,
  305. mainTeacher90MinSalary: 0,
  306. userId: this.teacherId
  307. }
  308. ],
  309. vipTable: [],
  310. musicGroupTable: [],
  311. ruleList: [],
  312. vipList: [],
  313. startDate: null,
  314. accompanyTable: [
  315. {
  316. assistantTeacherSalary: 30,
  317. minutes: 25,
  318. userId: this.teacherId,
  319. mainTeacherSalary: 0
  320. }
  321. ],
  322. pickerOptions: {
  323. disabledDate (time) {
  324. return time.getTime() > Date.now();
  325. },
  326. firstDayOfWeek: 1
  327. }
  328. };
  329. },
  330. created () { },
  331. mounted () {
  332. // this.__init();
  333. },
  334. activated () {
  335. this.pageType = this.$route.query.type;
  336. this.__init();
  337. },
  338. methods: {
  339. __init () {
  340. if (this.$route.query.search) {
  341. this.Fsearch = this.$route.query.search;
  342. }
  343. if (this.$route.query.rules) {
  344. this.Frules = this.$route.query.rules;
  345. }
  346. // 获取课程形态 设置vip课酬
  347. findTeacherDefaultSalary({ userId: this.teacherId }).then(res => {
  348. if (res.code == 200 && res.data.length > 0) {
  349. let vipData = [];
  350. res.data.forEach(item => {
  351. vipData.push({
  352. offlineClassesSalary: null,
  353. onlineClassesSalary: null,
  354. vipGroupCategoryId: item.id,
  355. vipGroupCategoryName: item.name,
  356. userId: this.teacherId
  357. });
  358. });
  359. // VIP课列表
  360. vipGroupSalaryList({
  361. rows: 9999,
  362. page: 1,
  363. search: this.teacherId
  364. }).then(res => {
  365. if (res.code == 200) {
  366. let rows = res.data.rows;
  367. this.vipListCompare(vipData, rows);
  368. }
  369. });
  370. }
  371. });
  372. // 乐团
  373. teacherSalaryList({
  374. rows: 9999,
  375. page: 1,
  376. teacherId: this.teacherId
  377. // settlementType: 'FIXED_SALARY'
  378. }).then(res => {
  379. if (res.code == 200) {
  380. // this.teamTable = res.data.rows
  381. let rows = res.data.rows;
  382. this.teacherSalaryMoney(rows);
  383. }
  384. });
  385. // 网管课
  386. teacherDefaultPracticeGroupSalary({ teacherId: this.teacherId }).then(
  387. res => {
  388. if (res.code == 200 && res.data.length > 0) {
  389. this.accompanyTable = res.data;
  390. }
  391. }
  392. );
  393. },
  394. vipListCompare (vipData, rows) {
  395. // vip 做对比
  396. if (!rows) {
  397. // 判断是否有数据
  398. this.vipTable = vipData;
  399. return;
  400. }
  401. let result = [];
  402. vipData.forEach(item => {
  403. rows.forEach(c => {
  404. if (item.vipGroupCategoryId == c.vipGroupCategoryId) {
  405. item.checked = true;
  406. result.push({
  407. vipGroupCategoryId: c.vipGroupCategoryId,
  408. offlineClassesSalary: c.offlineClassesSalary,
  409. onlineClassesSalary: c.onlineClassesSalary,
  410. vipGroupCategoryName: c.vipGroupCategoryName,
  411. userId: c.userId
  412. });
  413. }
  414. });
  415. });
  416. if (result.length > 0) {
  417. vipData.forEach(item => {
  418. if (!item.checked) {
  419. result.push(item);
  420. }
  421. });
  422. } else {
  423. result = vipData;
  424. }
  425. this.vipTable = result;
  426. },
  427. teacherSalaryMoney (rows) {
  428. // 判断是否有数据
  429. if (!rows || rows.length <= 0) return;
  430. let teamTable = this.teamTable;
  431. let result = [];
  432. teamTable.forEach(item => {
  433. rows.forEach(c => {
  434. if (item.courseScheduleType == c.courseScheduleType) {
  435. item.checked = true;
  436. result.push({
  437. mainTeacher30MinSalary: c.mainTeacher30MinSalary,
  438. mainTeacher90MinSalary: c.mainTeacher90MinSalary,
  439. assistantTeacher30MinSalary: c.assistantTeacher30MinSalary,
  440. assistantTeacher90MinSalary: c.assistantTeacher90MinSalary,
  441. courseScheduleType: c.courseScheduleType,
  442. userId: this.teacherId
  443. });
  444. }
  445. });
  446. });
  447. if (result.length > 0) {
  448. teamTable.forEach(item => {
  449. if (!item.checked) {
  450. result.push(item);
  451. }
  452. });
  453. } else {
  454. result = teamTable;
  455. }
  456. this.teamTable = result;
  457. let smallResult = []
  458. let teamSmallTable = this.teamSmallTable
  459. teamSmallTable.forEach(item => {
  460. rows.forEach(c => {
  461. if (item.courseScheduleType == c.courseScheduleType) {
  462. item.checked = true;
  463. let tempJson = c.salaryRuleJson ? JSON.parse(c.salaryRuleJson) : { 1: 0, 2: 0, 3: 0, 4: 0, 5: 0 }
  464. // console.log(tempJson)
  465. smallResult.push({
  466. mainTeacher30MinSalary: c.mainTeacher30MinSalary,
  467. mainTeacher90MinSalary: c.mainTeacher90MinSalary,
  468. assistantTeacher30MinSalary: c.assistantTeacher30MinSalary,
  469. assistantTeacher90MinSalary: c.assistantTeacher90MinSalary,
  470. salaryRuleJson: tempJson,
  471. v1: tempJson[1] ? tempJson[1] : 0,
  472. v2: tempJson[2] ? tempJson[2] : 0,
  473. v3: tempJson[3] ? tempJson[3] : 0,
  474. v4: tempJson[4] ? tempJson[4] : 0,
  475. v5: tempJson[5] ? tempJson[5] : 0,
  476. courseScheduleType: c.courseScheduleType,
  477. userId: this.teacherId
  478. });
  479. }
  480. });
  481. })
  482. if (smallResult.length > 0) {
  483. teamSmallTable.forEach(item => {
  484. if (!item.checked) {
  485. smallResult.push(item);
  486. }
  487. });
  488. } else {
  489. smallResult = teamSmallTable;
  490. }
  491. this.teamSmallTable = smallResult;
  492. },
  493. onSave () {
  494. this.$confirm("您确定更改老师课酬", "提示", {
  495. confirmButtonText: "确定",
  496. cancelButtonText: "取消",
  497. type: "warning"
  498. })
  499. .then(() => {
  500. let teamTable = this.teamTable;
  501. let checkStatus = true;
  502. teamTable.forEach(item => {
  503. if (
  504. item.assistantTeacher30MinSalary < 0 ||
  505. item.assistantTeacher90MinSalary < 0 ||
  506. item.mainTeacher30MinSalary < 0 ||
  507. item.mainTeacher90MinSalary < 0
  508. ) {
  509. this.$message.error("输入课酬不能为负数");
  510. checkStatus = false;
  511. return;
  512. }
  513. });
  514. let temps = []
  515. this.teamSmallTable.forEach(item => {
  516. if (item.v1 < 0 || item.v2 < 0 || item.v3 < 0 || item.v4 < 0 || item.v5 < 0) {
  517. this.$message.error("输入课酬不能为负数");
  518. checkStatus = false;
  519. return;
  520. }
  521. temps.push({
  522. courseScheduleType: item.courseScheduleType,
  523. salaryRuleJson: JSON.stringify({ 1: Number(item.v1), 2: Number(item.v2), 3: Number(item.v3), 4: Number(item.v4), 5: Number(item.v5) }),
  524. assistantTeacher30MinSalary: 0,
  525. assistantTeacher90MinSalary: 0,
  526. mainTeacher30MinSalary: 0,
  527. mainTeacher90MinSalary: 0,
  528. userId: item.userId
  529. })
  530. })
  531. this.vipTable.forEach(item => {
  532. if (item.offlineClassesSalary < 0 && item.onlineClassesSalary < 0) {
  533. this.$message.error("输入课酬不能为负数");
  534. checkStatus = false;
  535. return;
  536. }
  537. });
  538. this.accompanyTable.forEach(item => {
  539. if (item.mainTeacherSalary < 0) {
  540. this.$message.error("输入课酬不能为负数");
  541. checkStatus = false;
  542. return;
  543. }
  544. if (!item.mainTeacherSalary.toString()) {
  545. this.$message.error("输入网管课课酬");
  546. checkStatus = false;
  547. return;
  548. }
  549. });
  550. // 判断输入的值是否正确
  551. if (!this.startDate) {
  552. this.$message.error("请填写生效日期");
  553. return;
  554. }
  555. if (!checkStatus) {
  556. return
  557. }
  558. let params = teamTable.concat(temps)
  559. teacherSalaryBatchUpset({
  560. teacherDefaultMusicGroupSalaries: params,
  561. startDate: this.startDate
  562. }).then(res => {
  563. if (res.code == 200) {
  564. // 判断输入的值是否正确
  565. vipGroupSalarySet({
  566. teacherDefaultVipGroupSalaries: this.vipTable,
  567. startDate: this.startDate
  568. }).then(res => {
  569. if (res.code == 200) {
  570. PracticeGroupSalaryUpdate({
  571. startDate: this.startDate,
  572. teacherDefaultPracticeGroupSalaries: this.accompanyTable
  573. }).then(res => {
  574. if (res.code == 200) {
  575. this.$message.success("保存成功");
  576. this.$router.push({
  577. path: "/business/teacherList",
  578. query: { rules: this.Frules, search: this.Fsearch }
  579. });
  580. }
  581. });
  582. // if(this.$route.query.type == 'create') {
  583. // }
  584. }
  585. });
  586. }
  587. });
  588. })
  589. .catch(() => { });
  590. }
  591. }
  592. };
  593. </script>
  594. <style lang="scss" scoped>
  595. .salarySet {
  596. h3 {
  597. margin-top: 10px;
  598. margin-bottom: 10px;
  599. font-size: 14px;
  600. color: #444;
  601. font-weight: normal;
  602. }
  603. .tableList {
  604. .left,
  605. .right {
  606. float: left;
  607. }
  608. .left {
  609. width: 70%;
  610. margin-right: 2%;
  611. }
  612. .right {
  613. width: 56%;
  614. margin-left: 2%;
  615. }
  616. }
  617. }
  618. /deep/.el-table__body {
  619. tr {
  620. td:nth-child(3) {
  621. border-right: 1px solid #ebeef5;
  622. }
  623. }
  624. }
  625. /deep/.el-input-group__append {
  626. background-color: #f5f7fa;
  627. color: #909399;
  628. vertical-align: middle;
  629. display: table-cell;
  630. position: relative;
  631. border: 1px solid #dcdfe6;
  632. border-left: 0;
  633. }
  634. </style>