classFeesIsOk.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  1. <!-- -->
  2. <template>
  3. <div class="m-container">
  4. <h2>
  5. <div class="squrt"></div>
  6. 课酬确认
  7. </h2>
  8. <div class="m-core">
  9. <div
  10. @click="openSalary"
  11. v-if="isOpen == 0"
  12. v-permission="'courseScheduleTeacherSalary/openSalaryConfirm'"
  13. class="newBand"
  14. >
  15. 开启课酬确认
  16. </div>
  17. <div
  18. v-if="isOpen == 1"
  19. @click="closeSalary"
  20. v-permission="'courseScheduleTeacherSalary/closeSalaryConfirm'"
  21. class="newBand"
  22. >
  23. 关闭课酬确认
  24. </div>
  25. <save-form
  26. :inline="true"
  27. @submit="search"
  28. @reset="onReSet"
  29. :model="searchForm"
  30. >
  31. <el-form-item>
  32. <el-input
  33. v-model.trim="searchForm.search"
  34. @keyup.enter.native="search"
  35. clearable
  36. placeholder="课程编号、课程组名称"
  37. ></el-input>
  38. </el-form-item>
  39. <el-form-item prop="organId">
  40. <el-select
  41. class="multiple"
  42. v-model.trim="searchForm.organIdList"
  43. filterable
  44. clearable
  45. placeholder="请选择分部"
  46. >
  47. <el-option
  48. v-for="(item, index) in selects.branchs"
  49. :key="index"
  50. :label="item.name"
  51. :value="item.id"
  52. ></el-option>
  53. </el-select>
  54. </el-form-item>
  55. <el-form-item prop="organId">
  56. <el-select
  57. class="multiple"
  58. v-model.trim="searchForm.groupType"
  59. filterable
  60. clearable
  61. placeholder="请选择课程组类型"
  62. >
  63. <el-option
  64. v-for="(item, index) in groupTypeList"
  65. :key="index"
  66. :label="item.label"
  67. :value="item.value"
  68. ></el-option>
  69. </el-select>
  70. </el-form-item>
  71. <el-form-item prop="belongDaya">
  72. <el-select
  73. v-model.trim="searchForm.belongDaya"
  74. clearable
  75. placeholder="请选择课酬类型"
  76. >
  77. <el-option
  78. v-for="(item, index) in belongDayaOption"
  79. :key="index"
  80. :label="item.label"
  81. :value="item.value"
  82. ></el-option>
  83. </el-select>
  84. </el-form-item>
  85. <el-form-item>
  86. <remoteSearch :commit='"setTeachers"' v-model='searchForm.teacherId' />
  87. <!-- <el-select
  88. placeholder="老师姓名"
  89. v-model="searchForm.teacherId"
  90. clearable
  91. filterable
  92. >
  93. <el-option
  94. v-for="(item, index) in selects.teachers"
  95. :label="item.realName"
  96. :value="item.id"
  97. :key="index"
  98. ></el-option>
  99. </el-select> -->
  100. </el-form-item>
  101. <el-form-item>
  102. <el-select
  103. placeholder="正常签到"
  104. v-model="searchForm.signInStatus"
  105. clearable
  106. >
  107. <el-option label="是" value="1"></el-option>
  108. <el-option label="否" value="0"></el-option>
  109. </el-select>
  110. </el-form-item>
  111. <el-form-item>
  112. <el-select
  113. placeholder="正常签退"
  114. v-model="searchForm.signOutStatus"
  115. clearable
  116. >
  117. <el-option label="是" value="1"></el-option>
  118. <el-option label="否" value="0"></el-option>
  119. </el-select>
  120. </el-form-item>
  121. <el-form-item>
  122. <el-select
  123. placeholder="状态"
  124. v-model="searchForm.confirmStatus"
  125. clearable
  126. >
  127. <el-option label="待确定" value="1"></el-option>
  128. <el-option label="已确定" value="2"></el-option>
  129. <el-option label="已完成" value="3"></el-option>
  130. </el-select>
  131. </el-form-item>
  132. <el-form-item>
  133. <el-date-picker
  134. :clearable="false"
  135. v-model="searchForm.month"
  136. style="width: 100%"
  137. type="month"
  138. value-format="yyyy-MM"
  139. placeholder="选择年月"
  140. ></el-date-picker>
  141. </el-form-item>
  142. <el-form-item>
  143. <el-button type="danger" native-type="submit">搜索</el-button>
  144. <el-button native-type="reset" type="primary">重置</el-button>
  145. <!-- export/isSettlementCourseSalarys -->
  146. <el-button
  147. @click="onExport"
  148. type="primary"
  149. v-permission="'export/exercisesSituations'"
  150. style="background: #14928a; border: 1px solid #14928a"
  151. >导出</el-button
  152. >
  153. </el-form-item>
  154. </save-form>
  155. <div class="tableWrap">
  156. <el-table
  157. style="width: 100%"
  158. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  159. :data="tableList"
  160. >
  161. <el-table-column
  162. align="center"
  163. prop="organName"
  164. label="分部"
  165. ></el-table-column>
  166. <el-table-column
  167. align="center"
  168. prop="groupType"
  169. width="100"
  170. label="课程组类型"
  171. >
  172. <template slot-scope="scope">{{
  173. scope.row.groupType | coursesType
  174. }}</template>
  175. </el-table-column>
  176. <el-table-column
  177. align="center"
  178. prop="courseScheduleId"
  179. label="课程编号"
  180. ></el-table-column>
  181. <el-table-column
  182. align="center"
  183. prop="courseScheduleId"
  184. width="150"
  185. label="时间"
  186. >
  187. <template slot-scope="scope">{{
  188. scope.row.startClassTime | dateForMinFormat
  189. }}</template>
  190. </el-table-column>
  191. <el-table-column
  192. align="center"
  193. prop="courseName"
  194. width="120"
  195. label="课程名称"
  196. ></el-table-column>
  197. <el-table-column
  198. align="center"
  199. prop="teacherId"
  200. label="老师编号"
  201. ></el-table-column>
  202. <el-table-column
  203. align="center"
  204. prop="teacherName"
  205. label="老师姓名"
  206. ></el-table-column>
  207. <el-table-column
  208. align="center"
  209. prop="courseScheduleId"
  210. width="150"
  211. label="签到时间"
  212. >
  213. <template slot-scope="scope">
  214. <p :class="scope.row.signInStatus == 1 ? '' : 'red'">
  215. {{ scope.row.signInTime | dateForMinFormat }}
  216. </p>
  217. <p :class="scope.row.signInStatus == 1 ? '' : 'red'">
  218. {{ scope.row.signInStatus | attendanceType }}
  219. </p>
  220. <p
  221. class="red"
  222. v-if="!scope.row.signInStatus && scope.row.signInStatus != 0"
  223. >
  224. 未签到
  225. </p>
  226. </template>
  227. </el-table-column>
  228. <el-table-column
  229. align="center"
  230. prop="courseScheduleId"
  231. width="150"
  232. label="签退时间"
  233. >
  234. <template slot-scope="scope">
  235. <p :class="scope.row.signOutStatus == 1 ? '' : 'red'">
  236. {{ scope.row.signOutTime | dateForMinFormat }}
  237. </p>
  238. <p :class="scope.row.signOutStatus == 1 ? '' : 'red'">
  239. {{ scope.row.signOutStatus | attendanceOutType }}
  240. </p>
  241. <p
  242. class="red"
  243. v-if="!scope.row.signOutStatus && scope.row.signOutStatus != 0"
  244. >
  245. 未签退
  246. </p>
  247. </template>
  248. </el-table-column>
  249. <!-- <el-table-column align="center" prop="actualReceipts" label="实际收款">
  250. <template slot-scope="scope">{{(scope.row.actualReceipts ? scope.row.actualReceipts : 0) + '元'}}</template>
  251. </el-table-column> -->
  252. <!-- expectSalary -->
  253. <el-table-column
  254. align="center"
  255. prop="belongDaya"
  256. label="课酬类型"
  257. >
  258. <template slot-scope="scope">{{
  259. belongDaya[scope.row.belongDaya]
  260. }}</template>
  261. </el-table-column>
  262. <el-table-column align="center" prop="actualSalary" label="应发课酬">
  263. <template slot-scope="scope"
  264. >{{ scope.row.actualSalary | moneyFormat }}元</template
  265. >
  266. </el-table-column>
  267. <el-table-column align="center" prop="reduceSalary" label="课酬扣款">
  268. <template slot-scope="scope"
  269. >{{ scope.row.reduceSalary | moneyFormat }}元</template
  270. >
  271. </el-table-column>
  272. <el-table-column align="center" prop="finalSalary" label="结算课酬">
  273. <template slot-scope="scope"
  274. >{{ scope.row.finalSalary | moneyFormat }}元</template
  275. >
  276. </el-table-column>
  277. <el-table-column align="center" prop label="状态" fixed="right">
  278. <template slot-scope="scope">{{
  279. scope.row.confirmStatus | confirmFilter
  280. }}</template>
  281. </el-table-column>
  282. <el-table-column
  283. align="center"
  284. prop="memo"
  285. label="备注"
  286. width="300"
  287. fixed="right"
  288. ></el-table-column>
  289. <el-table-column align="center" label="操作" fixed="right">
  290. <template slot-scope="scope">
  291. <el-button type="text" @click="resetSalary(scope.row)"
  292. >课酬调整</el-button
  293. >
  294. </template>
  295. </el-table-column>
  296. </el-table>
  297. <pagination
  298. sync
  299. :total.sync="rules.total"
  300. :page.sync="rules.page"
  301. :limit.sync="rules.limit"
  302. :page-sizes="rules.page_size"
  303. @pagination="getList"
  304. />
  305. </div>
  306. </div>
  307. <el-dialog title="课酬调整" :visible.sync="dialogVisible" width="400px">
  308. <div>
  309. <el-form
  310. ref="visibleForm"
  311. :model="visibleForm"
  312. class="visibleForm"
  313. :inline="true"
  314. label-width="60px"
  315. >
  316. <el-form-item
  317. label="应发"
  318. :rules="[
  319. { required: true, message: '请填写应发数', trigger: 'blur' },
  320. ]"
  321. prop="actualSalary"
  322. >
  323. <el-input-number
  324. :controls="false"
  325. :min="0"
  326. :precision="2"
  327. v-model.trim="visibleForm.actualSalary"
  328. type="number"
  329. @mousewheel.native.prevent
  330. ></el-input-number>
  331. </el-form-item>
  332. <el-form-item
  333. label="扣款"
  334. :rules="[
  335. { required: true, message: '请填写扣款数', trigger: 'blur' },
  336. ]"
  337. prop="reduceSalary"
  338. >
  339. <el-input-number
  340. :controls="false"
  341. :min="0"
  342. :precision="2"
  343. v-model.trim="visibleForm.reduceSalary"
  344. type="number"
  345. @mousewheel.native.prevent
  346. ></el-input-number>
  347. </el-form-item>
  348. <el-form-item label="实发">
  349. <el-input-number
  350. :controls="false"
  351. :min="0"
  352. :precision="2"
  353. v-model.trim="visibleForm.finalSalary"
  354. disabled
  355. type="number"
  356. @mousewheel.native.prevent
  357. ></el-input-number>
  358. </el-form-item>
  359. <el-form-item
  360. label="说明"
  361. :rules="[
  362. { required: true, message: '请填写说明', trigger: 'blur' },
  363. ]"
  364. prop="memo"
  365. >
  366. <el-input
  367. type="textarea"
  368. :rows="5"
  369. v-model.trim="visibleForm.memo"
  370. ></el-input>
  371. </el-form-item>
  372. </el-form>
  373. </div>
  374. <div slot="footer">
  375. <el-button @click="dialogVisible = false">取 消</el-button>
  376. <el-button type="primary" @click="subreset">确 定</el-button>
  377. </div>
  378. </el-dialog>
  379. </div>
  380. </template>
  381. <script>
  382. import numeral from "numeral";
  383. import axios from "axios";
  384. import { getToken } from "@/utils/auth";
  385. import pagination from "@/components/Pagination/index";
  386. import remoteSearch from '@/components/remote-search/index'
  387. import load from "@/utils/loading";
  388. import { belongDaya } from '@/constant'
  389. import { objectToOptions } from '@/utils'
  390. import dayjs from 'dayjs'
  391. import {
  392. findIsSettlementCourseSalarys,
  393. openSalaryConfirm,
  394. closeSalaryConfirm,
  395. teacherSalaryModifyLog,
  396. } from "@/api/journal";
  397. import { courseListType } from "@/utils/searchArray";
  398. export default {
  399. components: { pagination, remoteSearch },
  400. data() {
  401. return {
  402. belongDaya,
  403. searchForm: {
  404. search: null,
  405. organIdList: null,
  406. groupType: null,
  407. teacherId: null,
  408. signInStatus: null,
  409. signOutStatus: null,
  410. month: null,
  411. confirmStatus: null,
  412. belongDaya: null,
  413. },
  414. dialogVisible: false,
  415. visibleForm: {
  416. finalSalary: null,
  417. reduceSalary: null,
  418. actualSalary: null,
  419. courseScheduleId: null,
  420. teacherId: null,
  421. memo: null,
  422. },
  423. isOpen: null,
  424. activeRow: null,
  425. tableList: [],
  426. groupTypeList: courseListType,
  427. rules: {
  428. // 分页规则
  429. limit: 10, // 限制显示条数
  430. page: 1, // 当前页
  431. total: 0, // 总条数
  432. page_size: [10, 20, 40, 50], // 选择限制显示条数
  433. },
  434. };
  435. },
  436. //生命周期 - 创建完成(可以访问当前this实例)
  437. created() {
  438. if (!this.searchForm.month) {
  439. var now = new Date();
  440. this.searchForm.month = new Date(
  441. Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
  442. )
  443. .toISOString()
  444. .slice(0, 7);
  445. }
  446. },
  447. //生命周期 - 挂载完成(可以访问DOM元素)
  448. async mounted() {
  449. await this.$store.dispatch('setBranchs')
  450. await this.$store.dispatch('setTeachers')
  451. // 获取分部
  452. this.init();
  453. },
  454. methods: {
  455. init() {
  456. this.getList();
  457. },
  458. getList() {
  459. let obj = this.getDate();
  460. findIsSettlementCourseSalarys(obj).then((res) => {
  461. if (res.code == 200) {
  462. this.isOpen = res.data.isOpenConfirm;
  463. this.tableList = res.data.pageInfo.rows;
  464. this.rules.total = res.data.pageInfo.total;
  465. }
  466. });
  467. },
  468. search() {
  469. this.rules.page = 1;
  470. this.getList();
  471. },
  472. onReSet() {
  473. this.searchForm = {
  474. search: null,
  475. organIdList: null,
  476. groupType: null,
  477. teacherId: null,
  478. signInStatus: null,
  479. signOutStatus: null,
  480. month: dayjs().format('YYYY-MM'),
  481. confirmStatus: null,
  482. };
  483. this.search();
  484. },
  485. getDate() {
  486. let obj = {
  487. search: this.searchForm.search,
  488. organIdList: this.searchForm.organIdList || null,
  489. groupType: this.searchForm.groupType || null,
  490. teacherId: this.searchForm.teacherId || null,
  491. signInStatus: this.searchForm.signInStatus || null,
  492. signOutStatus: this.searchForm.signOutStatus || null,
  493. month: this.searchForm.month || null,
  494. confirmStatus: this.searchForm.confirmStatus || null,
  495. belongDaya: this.searchForm.belongDaya || null,
  496. page: this.rules.page,
  497. rows: this.rules.limit,
  498. };
  499. return obj;
  500. },
  501. openSalary() {
  502. this.$confirm("您确定开启课酬确认?", "提示", {
  503. confirmButtonText: "确定",
  504. cancelButtonText: "取消",
  505. type: "warning",
  506. }).then(() => {
  507. openSalaryConfirm({ month: this.searchForm.month }).then((res) => {
  508. if (res.code == 200) {
  509. this.$message.success("开启成功");
  510. this.getList();
  511. }
  512. });
  513. });
  514. },
  515. closeSalary() {
  516. this.$confirm("您确定关闭课酬确认?", "提示", {
  517. confirmButtonText: "确定",
  518. cancelButtonText: "取消",
  519. type: "warning",
  520. }).then(() => {
  521. closeSalaryConfirm({ month: this.searchForm.month }).then((res) => {
  522. if (res.code == 200) {
  523. this.$message.success("关闭成功");
  524. this.getList();
  525. }
  526. });
  527. });
  528. },
  529. onExport() {
  530. let url = "/api-web/export/isSettlementCourseSalarys";
  531. let obj = this.getDate();
  532. const options = {
  533. method: "get",
  534. headers: {
  535. Authorization: getToken(),
  536. },
  537. url,
  538. params: obj,
  539. responseType: "blob",
  540. };
  541. this.$confirm("您确定导出列表?", "提示", {
  542. confirmButtonText: "确定",
  543. cancelButtonText: "取消",
  544. type: "warning",
  545. })
  546. .then(() => {
  547. load.startLoading();
  548. axios(options)
  549. .then((res) => {
  550. let blob = new Blob([res.data], {
  551. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8',
  552. type: "application/vnd.ms-excel;charset=utf-8",
  553. // word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  554. });
  555. let text = new Response(blob).text();
  556. text.then((res) => {
  557. // 判断是否报错
  558. if (res.indexOf("code") != -1) {
  559. let json = JSON.parse(res);
  560. this.$message.error(json.msg);
  561. } else {
  562. let objectUrl = URL.createObjectURL(blob);
  563. let link = document.createElement("a");
  564. let nowTime = new Date();
  565. let ymd =
  566. nowTime.getFullYear() +
  567. "" +
  568. (nowTime.getMonth() + 1) +
  569. "" +
  570. nowTime.getDate() +
  571. "" +
  572. nowTime.getHours() +
  573. "" +
  574. nowTime.getMinutes();
  575. let fname = ymd + "课酬确认.xls";
  576. link.href = objectUrl;
  577. link.setAttribute("download", fname);
  578. document.body.appendChild(link);
  579. link.click();
  580. }
  581. });
  582. load.endLoading();
  583. })
  584. .catch((error) => {
  585. this.$message.error("导出数据失败,请联系管理员");
  586. load.endLoading();
  587. });
  588. })
  589. .catch(() => {});
  590. },
  591. resetSalary(row) {
  592. this.$nextTick(() => {
  593. this.visibleForm = {
  594. finalSalary: row.finalSalary, // 实发
  595. reduceSalary: row.reduceSalary, // 扣款
  596. actualSalary: row.actualSalary, // 应发
  597. courseScheduleId: row.courseScheduleId,
  598. memo: row.memo,
  599. teacherId: row.teacherId
  600. }
  601. })
  602. // let obj = {
  603. // finalSalary: row.finalSalary, // 实发
  604. // reduceSalary: row.reduceSalary, // 扣款
  605. // actualSalary: row.actualSalary, // 应发
  606. // courseScheduleId: row.courseScheduleId,
  607. // memo: row.memo,
  608. // teacherId: row.teacherId,
  609. // };
  610. // this.$set(this, "visibleForm", obj);
  611. this.dialogVisible = true;
  612. },
  613. subreset() {
  614. this.$refs["visibleForm"].validate((flag) => {
  615. if (flag) {
  616. let obj = {
  617. courseScheduleId: this.visibleForm.courseScheduleId,
  618. currentExpectSalary: this.visibleForm.actualSalary,
  619. currentReduceSalary: this.visibleForm.reduceSalary,
  620. memo: this.visibleForm.memo,
  621. teacherId: this.visibleForm.teacherId,
  622. };
  623. teacherSalaryModifyLog(obj).then((res) => {
  624. if (res.code == 200) {
  625. this.dialogVisible = false;
  626. this.$message.success("调整成功");
  627. this.getList();
  628. }
  629. });
  630. }
  631. });
  632. },
  633. },
  634. filters: {
  635. confirmFilter(val) {
  636. if (val) {
  637. let template = {
  638. 1: "待确认",
  639. 2: "已确认",
  640. 3: "已完成",
  641. };
  642. return template[val];
  643. }
  644. },
  645. },
  646. computed: {
  647. getActualsalary() {
  648. // 应发
  649. return this.visibleForm.actualSalary;
  650. },
  651. getReduceSalary() {
  652. // 扣款
  653. return this.visibleForm.reduceSalary;
  654. },
  655. belongDayaOption() {
  656. return objectToOptions(belongDaya)
  657. }
  658. },
  659. watch: {
  660. getActualsalary(val) {
  661. var number = numeral(val);
  662. this.visibleForm.finalSalary = Math.max(
  663. number.subtract(this.getReduceSalary).value(),
  664. 0
  665. );
  666. },
  667. getReduceSalary(val) {
  668. var number = numeral(this.getActualsalary);
  669. this.visibleForm.finalSalary = Math.max(number.subtract(val).value(), 0);
  670. },
  671. dialogVisible(val) {
  672. if (!val) {
  673. // this.visibleForm = {
  674. // expectSalary: null,
  675. // reduceSalary: null,
  676. // actualSalary: null,
  677. // courseScheduleId: null,
  678. // teacherId: null,
  679. // memo: null,
  680. // };
  681. this.$refs["visibleForm"].resetFields();
  682. }
  683. },
  684. },
  685. };
  686. </script>
  687. <style lang='scss' scoped>
  688. .red {
  689. color: red;
  690. }
  691. .visibleForm {
  692. /deep/.el-input__inner,
  693. /deep/.el-textarea__inner {
  694. width: 225px !important;
  695. }
  696. }
  697. /deep/.el-input-number .el-input__inner {
  698. text-align: left;
  699. }
  700. </style>