requestProcessing.vue 13 KB

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