requestProcessing.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <!-- -->
  2. <template>
  3. <div class="m-container">
  4. <h2>
  5. <div class="squrt"></div>
  6. 课酬申诉
  7. </h2>
  8. <div class="m-core">
  9. <save-form
  10. :inline="true"
  11. @reset="onReSet"
  12. @submit="search"
  13. :model="searchForm"
  14. >
  15. <!-- <el-form-item>
  16. <el-input v-model.trim="searchForm.search" @keyup.enter.native="search" placeholder></el-input>
  17. </el-form-item>-->
  18. <el-form-item prop="organId">
  19. <el-select
  20. class="multiple"
  21. v-model.trim="searchForm.organId"
  22. filterable
  23. clearable
  24. placeholder="请选择分部"
  25. >
  26. <el-option
  27. v-for="(item, index) in selects.branchs"
  28. :key="index"
  29. :label="item.name"
  30. :value="item.id"
  31. ></el-option>
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item>
  35. <el-select
  36. placeholder="老师姓名"
  37. v-model="searchForm.teacherId"
  38. clearable
  39. filterable
  40. >
  41. <el-option
  42. v-for="(item, index) in selects.teachers"
  43. :label="item.realName"
  44. :value="item.id"
  45. :key="index"
  46. ></el-option>
  47. </el-select>
  48. </el-form-item>
  49. <el-form-item>
  50. <el-select
  51. placeholder="状态"
  52. v-model="searchForm.statusEnum"
  53. clearable
  54. >
  55. <el-option label="待处理" value="PENDING"></el-option>
  56. <el-option label="已完成" value="DONE"></el-option>
  57. <el-option label="已同意" value="AGREED"></el-option>
  58. <el-option label="已拒绝" value="DENIED"></el-option>
  59. <el-option label="已撤回" value="WITHDRAWN"></el-option>
  60. </el-select>
  61. </el-form-item>
  62. <el-form-item>
  63. <el-date-picker
  64. :clearable="true"
  65. style="width: 100% !important;"
  66. v-model="searchForm.salarySettlementMonth"
  67. type="month"
  68. value-format="yyyy-MM"
  69. placeholder="选择归属年月"
  70. ></el-date-picker>
  71. </el-form-item>
  72. <el-form-item>
  73. <el-button type="danger" native-type="seach">搜索</el-button>
  74. <el-button native-type="reset" type="primary">重置</el-button>
  75. <!-- export/isSettlementCourseSalarys -->
  76. <el-button
  77. @click="onExport"
  78. type="primary"
  79. v-permission="'export/teacherSalaryComplaints'"
  80. style="background: #14928a; border: 1px solid #14928a"
  81. >导出</el-button
  82. >
  83. </el-form-item>
  84. </save-form>
  85. <div class="tableWrap">
  86. <el-table
  87. style="width: 100%"
  88. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  89. :data="tableList"
  90. >
  91. <el-table-column
  92. align="center"
  93. prop="organName"
  94. label="分部"
  95. ></el-table-column>
  96. <el-table-column
  97. align="center"
  98. prop="teacherId"
  99. label="老师编号"
  100. ></el-table-column>
  101. <el-table-column
  102. align="center"
  103. prop="realName"
  104. label="老师姓名"
  105. ></el-table-column>
  106. <el-table-column
  107. align="center"
  108. prop="salarySettlementMonth"
  109. width="150"
  110. label="课酬归属时间"
  111. ></el-table-column>
  112. <el-table-column
  113. align="center"
  114. prop="updateTime"
  115. width="150"
  116. label="申诉提交"
  117. >
  118. <template slot-scope="scope">{{
  119. scope.row.updateTime | dateForMinFormat
  120. }}</template>
  121. </el-table-column>
  122. <el-table-column align="center" prop="statusEnum" label="状态">
  123. <template slot-scope="scope">{{
  124. scope.row.statusEnum | statusEnum
  125. }}</template>
  126. </el-table-column>
  127. <el-table-column
  128. align="center"
  129. prop="operatorRealName"
  130. label="申诉处理者"
  131. ></el-table-column>
  132. <!-- <el-table-column align="center" prop="reason" width="400" label="备注"></el-table-column> -->
  133. <el-table-column
  134. align="center"
  135. prop="courseScheduleId"
  136. width="150"
  137. label="操作"
  138. >
  139. <template slot-scope="scope">
  140. <div>
  141. <el-button
  142. type="text"
  143. @click="lookDetail(scope.row)"
  144. v-permission="'teacherSalaryComplaints/complaintsDispose'"
  145. >操作</el-button
  146. >
  147. </div>
  148. </template>
  149. </el-table-column>
  150. </el-table>
  151. <pagination
  152. sync
  153. :total.sync="rules.total"
  154. :page.sync="rules.page"
  155. :limit.sync="rules.limit"
  156. :page-sizes="rules.page_size"
  157. @pagination="getList"
  158. />
  159. </div>
  160. </div>
  161. <el-dialog title="课酬申诉" :visible.sync="dialogVisible" width="400px">
  162. <div>
  163. <el-form ref="visibleForm" :model="visibleForm" class="visibleForm">
  164. <el-form-item
  165. label="申诉内容"
  166. :rules="[
  167. { required: true, message: '请填写申诉内容', trigger: 'blur' },
  168. ]"
  169. prop="reason"
  170. >
  171. <el-input
  172. type="textarea"
  173. :rows="5"
  174. :disabled="visibleForm.statusEnum != 'PENDING'"
  175. v-model.trim="visibleForm.reason"
  176. ></el-input>
  177. </el-form-item>
  178. <el-form-item
  179. label="处理意见"
  180. :rules="[
  181. { required: true, message: '请填写处理意见', trigger: 'blur' },
  182. ]"
  183. prop="handingSuggestion"
  184. >
  185. <el-input
  186. type="textarea"
  187. :rows="5"
  188. :disabled="visibleForm.statusEnum != 'PENDING'"
  189. v-model.trim="visibleForm.handingSuggestion"
  190. ></el-input>
  191. </el-form-item>
  192. <el-form-item
  193. label="处理结果"
  194. v-if="visibleForm.statusEnum != 'PENDING'"
  195. >
  196. {{ visibleForm.statusEnum | statusEnum }}
  197. </el-form-item>
  198. </el-form>
  199. </div>
  200. <div slot="footer" v-if="visibleForm.statusEnum == 'PENDING'">
  201. <el-button @click="subreset('DENIED')">拒绝</el-button>
  202. <el-button type="primary" @click="subreset('AGREED')">同意</el-button>
  203. </div>
  204. </el-dialog>
  205. </div>
  206. </template>
  207. <script>
  208. import qs from "qs";
  209. import axios from "axios";
  210. import { getToken } from "@/utils/auth";
  211. import pagination from "@/components/Pagination/index";
  212. import load from "@/utils/loading";
  213. import {
  214. teacherSalaryComplaints,
  215. teacherSalaryComplaintsDetail,
  216. complaintsDispose,
  217. } from "@/api/journal";
  218. export default {
  219. components: { pagination },
  220. data() {
  221. return {
  222. searchForm: {
  223. search: null,
  224. salarySettlementMonth: null,
  225. statusEnum: null,
  226. teacherId: null,
  227. organId: null,
  228. },
  229. tableList: [],
  230. rules: {
  231. // 分页规则
  232. limit: 10, // 限制显示条数
  233. page: 1, // 当前页
  234. total: 0, // 总条数
  235. page_size: [10, 20, 40, 50], // 选择限制显示条数
  236. },
  237. dialogVisible: false,
  238. visibleForm: {
  239. reason: null,
  240. handingSuggestion: null,
  241. teacherId: null,
  242. salarySettlementMonth: null,
  243. statusEnum: null,
  244. id: null,
  245. },
  246. };
  247. },
  248. //生命周期 - 创建完成(可以访问当前this实例)
  249. created() {},
  250. //生命周期 - 挂载完成(可以访问DOM元素)
  251. async mounted() {
  252. await this.$store.dispatch('setBranchs')
  253. await this.$store.dispatch('setTeachers')
  254. // 获取分部
  255. this.init();
  256. },
  257. methods: {
  258. init() {
  259. this.getList();
  260. },
  261. getList() {
  262. this.searchForm.page = this.rules.page;
  263. this.searchForm.rows = this.rules.limit;
  264. teacherSalaryComplaints(this.searchForm).then((res) => {
  265. if (res.code == 200) {
  266. this.tableList = res.data.rows;
  267. this.rules.total = res.data.total;
  268. }
  269. });
  270. },
  271. search() {
  272. this.rules.page = 1;
  273. this.getList();
  274. },
  275. onReSet() {
  276. this.searchForm = {
  277. search: null,
  278. salarySettlementMonth: null,
  279. statusEnum: null,
  280. teacherId: null,
  281. organId: null,
  282. };
  283. this.search();
  284. },
  285. onExport() {
  286. let url = "/api-web/export/teacherSalaryComplaints";
  287. let obj = this.searchForm;
  288. const options = {
  289. method: "post",
  290. headers: {
  291. Authorization: getToken(),
  292. },
  293. url,
  294. data: qs.stringify(obj),
  295. responseType: "blob",
  296. };
  297. this.$confirm("您确定导出列表?", "提示", {
  298. confirmButtonText: "确定",
  299. cancelButtonText: "取消",
  300. type: "warning",
  301. })
  302. .then(() => {
  303. load.startLoading();
  304. axios(options)
  305. .then((res) => {
  306. let blob = new Blob([res.data], {
  307. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8',
  308. type: "application/vnd.ms-excel;charset=utf-8",
  309. // word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  310. });
  311. let text = new Response(blob).text();
  312. text.then((res) => {
  313. // 判断是否报错
  314. if (res.indexOf("code") != -1) {
  315. let json = JSON.parse(res);
  316. this.$message.error(json.msg);
  317. } else {
  318. let objectUrl = URL.createObjectURL(blob);
  319. let link = document.createElement("a");
  320. let nowTime = new Date();
  321. let ymd =
  322. nowTime.getFullYear() +
  323. "" +
  324. (nowTime.getMonth() + 1) +
  325. "" +
  326. nowTime.getDate() +
  327. "" +
  328. nowTime.getHours() +
  329. "" +
  330. nowTime.getMinutes();
  331. let fname = ymd + "课酬申诉.xls";
  332. link.href = objectUrl;
  333. link.setAttribute("download", fname);
  334. document.body.appendChild(link);
  335. link.click();
  336. }
  337. });
  338. load.endLoading();
  339. })
  340. .catch((error) => {
  341. this.$message.error("导出数据失败,请联系管理员");
  342. load.endLoading();
  343. });
  344. })
  345. .catch(() => {});
  346. },
  347. lookDetail(row) {
  348. teacherSalaryComplaintsDetail({ id: row.id }).then((res) => {
  349. if (res.code == 200) {
  350. this.visibleForm = {
  351. reason: res.data.reason,
  352. handingSuggestion: res.data.handingSuggestion,
  353. teacherId: res.data.teacherId,
  354. salarySettlementMonth: res.data.salarySettlementMonth,
  355. statusEnum: res.data.statusEnum,
  356. id: res.data.id,
  357. };
  358. this.dialogVisible = true;
  359. }
  360. });
  361. },
  362. subreset(str) {
  363. this.$refs["visibleForm"].validate((flag) => {
  364. if (flag) {
  365. let obj = {
  366. reason: this.visibleForm.reason,
  367. handingSuggestion: this.visibleForm.handingSuggestion,
  368. currentReduceSalary: this.visibleForm.reduceSalary,
  369. salarySettlementMonth: this.visibleForm.salarySettlementMonth,
  370. teacherId: this.visibleForm.teacherId,
  371. statusEnum: str,
  372. id: this.visibleForm.id,
  373. };
  374. complaintsDispose(obj).then((res) => {
  375. if (res.code == 200) {
  376. this.dialogVisible = false;
  377. this.$message.success("处理成功");
  378. this.getList();
  379. }
  380. });
  381. }
  382. });
  383. },
  384. },
  385. filters: {
  386. statusEnum(val) {
  387. let template = {
  388. PENDING: "待处理",
  389. DONE: "已完成",
  390. AGREED: "已同意",
  391. DENIED: "已拒绝",
  392. WITHDRAWN: "已撤回",
  393. };
  394. return template[val];
  395. },
  396. },
  397. watch: {
  398. dialogVisible(val) {
  399. if (!val) {
  400. this.visibleForm = {
  401. reason: null,
  402. handingSuggestion: null,
  403. teacherId: null,
  404. salarySettlementMonth: null,
  405. statusEnum: null,
  406. id: null,
  407. };
  408. this.$refs["visibleForm"].resetFields();
  409. }
  410. },
  411. },
  412. };
  413. </script>
  414. <style lang='scss' scoped>
  415. </style>