settlementList.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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. @submit="search"
  12. @reset="onReSet"
  13. :model="searchForm"
  14. >
  15. <el-form-item>
  16. <el-input
  17. v-model.trim="searchForm.search"
  18. @keyup.enter.native="search"
  19. clearable
  20. placeholder="课程组编号&名字"
  21. ></el-input>
  22. </el-form-item>
  23. <el-form-item>
  24. <el-select
  25. placeholder="请选择分部"
  26. v-model="searchForm.organId"
  27. filterable
  28. clearable
  29. >
  30. <el-option
  31. v-for="(item, index) in selects.branchs"
  32. :label="item.name"
  33. :value="item.id"
  34. :key="index"
  35. ></el-option>
  36. </el-select>
  37. </el-form-item>
  38. <el-form-item>
  39. <remote-search
  40. :commit="'setTeachers'"
  41. v-model="searchForm.teacherId"
  42. />
  43. </el-form-item>
  44. <el-form-item>
  45. <el-select
  46. placeholder="转结状态"
  47. v-model="searchForm.settlementStatus"
  48. clearable
  49. >
  50. <el-option label="已结算" value="1"></el-option>
  51. <el-option label="未结算" value="0"></el-option>
  52. </el-select>
  53. </el-form-item>
  54. <el-form-item>
  55. <el-date-picker
  56. v-model.trim="searchForm.date"
  57. style="width: 410px"
  58. type="daterange"
  59. value-format="yyyy-MM-dd"
  60. :picker-options="{
  61. firstDayOfWeek: 1,
  62. }"
  63. range-separator="至"
  64. start-placeholder="结转开始日期"
  65. end-placeholder="结转结束日期"
  66. ></el-date-picker>
  67. </el-form-item>
  68. <el-form-item>
  69. <el-button type="danger" native-type="submit">搜索</el-button>
  70. <el-button @click="onReSet" native-type="reset" type="primary"
  71. >重置</el-button
  72. >
  73. <el-button
  74. @click="onExport"
  75. type="primary"
  76. v-permission="'export/teacherCourseReward'"
  77. style="background: #14928a; border: 1px solid #14928a"
  78. >导出</el-button
  79. >
  80. </el-form-item>
  81. </save-form>
  82. <div class="tableWrap">
  83. <el-table
  84. style="width: 100%"
  85. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  86. :data="tableList"
  87. >
  88. <el-table-column
  89. align="center"
  90. prop="musicGroupId"
  91. label="课程组编号"
  92. >
  93. <template slot-scope="scope">
  94. <div>
  95. <copy-text>{{ scope.row.musicGroupId }}</copy-text>
  96. </div>
  97. </template>
  98. </el-table-column>
  99. <el-table-column
  100. align="center"
  101. prop="courseGroupName"
  102. label="课程组名称"
  103. >
  104. <template slot-scope="scope">
  105. <div>
  106. <copy-text>{{ scope.row.courseGroupName }}</copy-text>
  107. </div>
  108. </template>
  109. </el-table-column>
  110. <el-table-column
  111. align="center"
  112. prop="organName"
  113. label="分部"
  114. >
  115. <template slot-scope="scope">
  116. <div>
  117. <copy-text>{{ scope.row.organName }}</copy-text>
  118. </div>
  119. </template>
  120. </el-table-column>
  121. <el-table-column
  122. align="center"
  123. prop="teacherName"
  124. label="指导老师"
  125. >
  126. <template slot-scope="scope">
  127. <div>
  128. <copy-text>{{ scope.row.teacherName }}</copy-text>
  129. </div>
  130. </template>
  131. </el-table-column>
  132. <el-table-column align="center" label="结转状态">
  133. <template slot-scope="scope">
  134. <div>{{ scope.row.settlementStatus ? "已结算" : "未结算" }}</div>
  135. </template>
  136. </el-table-column>
  137. <el-table-column align="center" label="结转金额">
  138. <template slot-scope="scope">
  139. <div>{{ scope.row.expectRewardAmount | moneyFormat }}元</div>
  140. </template>
  141. </el-table-column>
  142. <el-table-column align="center" label="结转日期">
  143. <template slot-scope="scope">
  144. <div>{{ scope.row.settlementDate | formatTimer }}</div>
  145. </template>
  146. </el-table-column>
  147. <el-table-column align="center"
  148. prop="memo"
  149. width="200"
  150. label="备注">
  151. <template slot-scope="scope">
  152. <overflow-text split :text="scope.row.memo" width="100%"></overflow-text>
  153. </template>
  154. </el-table-column>
  155. </el-table>
  156. <pagination
  157. sync
  158. :total.sync="rules.total"
  159. :page.sync="rules.page"
  160. :limit.sync="rules.limit"
  161. :page-sizes="rules.page_size"
  162. @pagination="getList"
  163. />
  164. </div>
  165. </div>
  166. </div>
  167. </template>
  168. <script>
  169. import axios from "axios";
  170. import qs from "qs";
  171. import { getToken } from "@/utils/auth";
  172. import pagination from "@/components/Pagination/index";
  173. import load from "@/utils/loading";
  174. import { getTeacher, getEmployeeOrgan } from "@/api/buildTeam";
  175. import { teacherCourseReward } from "@/api/operateManager";
  176. export default {
  177. components: { pagination },
  178. data() {
  179. return {
  180. searchForm: {
  181. search: null,
  182. organId: null,
  183. teacherId: null,
  184. settlementStatus: null,
  185. date: [],
  186. },
  187. teacherList: [],
  188. tableList: [],
  189. organList: [],
  190. rules: {
  191. // 分页规则
  192. limit: 10, // 限制显示条数
  193. page: 1, // 当前页
  194. total: 0, // 总条数
  195. page_size: [10, 20, 40, 50], // 选择限制显示条数
  196. },
  197. };
  198. },
  199. //生命周期 - 创建完成(可以访问当前this实例)
  200. created() {},
  201. //生命周期 - 挂载完成(可以访问DOM元素)
  202. mounted() {
  203. // getTeacher().then(res => {
  204. // if (res.code == 200) {
  205. // this.teacherList = res.data;
  206. // }
  207. // });
  208. // getEmployeeOrgan().then(res => {
  209. // if (res.code == 200) {
  210. // this.organList = res.data;
  211. // }
  212. // });
  213. // 获取分部
  214. this.$store.dispatch("setBranchs");
  215. this.init();
  216. },
  217. activated() {
  218. this.init();
  219. },
  220. methods: {
  221. init() {
  222. this.getList();
  223. },
  224. getList() {
  225. this.searchForm.page = this.rules.page;
  226. this.searchForm.rows = this.rules.limit;
  227. if (this.searchForm.date && this.searchForm.date.length > 0) {
  228. this.searchForm.startTime = this.searchForm.date[0];
  229. this.searchForm.endTime = this.searchForm.date[1];
  230. } else {
  231. this.searchForm.startTime = null;
  232. this.searchForm.endTime = null;
  233. }
  234. let obj = JSON.parse(JSON.stringify(this.searchForm));
  235. obj.date = null;
  236. teacherCourseReward(obj).then((res) => {
  237. if (res.code == 200) {
  238. this.tableList = res.data.rows;
  239. this.rules.total = res.data.total;
  240. }
  241. });
  242. },
  243. onExport() {
  244. let url = "/api-web/export/teacherCourseReward";
  245. this.searchForm.page = this.rules.page;
  246. this.searchForm.rows = this.rules.limit;
  247. if (this.searchForm.date && this.searchForm.date.length > 0) {
  248. this.searchForm.startTime = this.searchForm.date[0];
  249. this.searchForm.endTime = this.searchForm.date[1];
  250. }
  251. {
  252. this.searchForm.startTime = null;
  253. this.searchForm.endTime = null;
  254. }
  255. let obj = JSON.parse(JSON.stringify(this.searchForm));
  256. obj.date = null;
  257. const options = {
  258. method: "POST",
  259. headers: {
  260. Authorization: getToken(),
  261. },
  262. data: qs.stringify(obj),
  263. url,
  264. responseType: "blob",
  265. };
  266. this.$confirm("您确定导出报表", "提示", {
  267. confirmButtonText: "确定",
  268. cancelButtonText: "取消",
  269. type: "warning",
  270. })
  271. .then(() => {
  272. load.startLoading();
  273. axios(options)
  274. .then((res) => {
  275. let blob = new Blob([res.data], {
  276. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  277. type: "application/vnd.ms-excel;charset=utf-8",
  278. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  279. });
  280. let text = new Response(blob).text();
  281. text.then((res) => {
  282. // 判断是否报错
  283. if (res.indexOf("code") != -1) {
  284. let json = JSON.parse(res);
  285. this.$message.error(json.msg);
  286. } else {
  287. let objectUrl = URL.createObjectURL(blob);
  288. let link = document.createElement("a");
  289. let nowTime = new Date();
  290. let ymd =
  291. nowTime.getFullYear() +
  292. "" +
  293. (nowTime.getMonth() + 1) +
  294. "" +
  295. nowTime.getDate() +
  296. "" +
  297. nowTime.getHours() +
  298. "" +
  299. nowTime.getMinutes();
  300. let fname = "报表导出" + new Date().getTime() + '.xls'; //下载文件的名字
  301. link.href = objectUrl;
  302. link.setAttribute("download", fname);
  303. document.body.appendChild(link);
  304. link.click();
  305. }
  306. });
  307. load.endLoading();
  308. })
  309. .catch((error) => {
  310. this.$message.error("导出数据失败,请联系管理员");
  311. load.endLoading();
  312. });
  313. })
  314. .catch(() => {});
  315. },
  316. search() {
  317. this.rules.page = 1;
  318. this.getList();
  319. },
  320. onReSet() {
  321. this.searchForm = {
  322. search: null,
  323. organId: null,
  324. teacherId: null,
  325. settlementStatus: null,
  326. date: [],
  327. };
  328. this.search();
  329. },
  330. },
  331. };
  332. </script>
  333. <style lang='scss' scoped>
  334. </style>