classFeesIsOk.vue 18 KB

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