CheckTeacherPay.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. <!-- 活动解析 -->
  2. <template>
  3. <div>
  4. <!-- table 表格 -->
  5. <el-row :gutter="20" class="main-items" >
  6. <!--数据监控-->
  7. <el-col :span="20" class="main" :offset="2">
  8. <el-row :gutter="20" class="main-header">
  9. <el-col :span="3" :offset="1"><div class="main-header-item" >
  10. <div class="block" >
  11. <el-date-picker
  12. v-model="selMonth"
  13. type="month"
  14. placeholder="选择月"
  15. value-format="yyyy-MM"
  16. @change="GetTeacherSalaryList()">
  17. </el-date-picker>
  18. </div>
  19. </div>
  20. </el-col>
  21. <el-col :span="6" :offset="3">
  22. <!-- <div @click="handApor()" :class="{superactive:Activeindex == false,ApporStyles:true}" >手动批改</div>
  23. <div @click="AutoApor()" :class="{superactive:Activeindex == true,ApporStyles:true}" >自动批改</div> -->
  24. </el-col>
  25. <el-col :span="4" :offset="16">
  26. <div class="main-header-item">
  27. <i class="el-icon-printer"></i>
  28. <span @click="excel()">导出表格</span>
  29. </div>
  30. </el-col>
  31. </el-row>
  32. <el-table
  33. :data="getTeacherSalaryList.list"
  34. :header-cell-class-name="tableheaderClassName"
  35. :header-cell-style="{
  36. 'background-color': '#F6F7FB',
  37. 'color': '#393939',
  38. 'font-size': '16px'
  39. }"
  40. size="medium"
  41. border
  42. stripe
  43. >
  44. <el-table-column
  45. label="注册老师"
  46. header-align="center"
  47. >
  48. <template slot-scope="scope">
  49. <div class="scope-list">
  50. <img :src='BASE_URL+scope.row.imgUrl' alt="" class="table-img" v-if="scope.row.imgUrl">
  51. <img src="../../assets/img/user.jpg" alt="" v-if="!scope.row.imgUrl" class="table-img">
  52. <span class="scope-name">{{scope.row.name}}</span>
  53. </div>
  54. </template>
  55. </el-table-column>
  56. <el-table-column
  57. prop="lowGradeCount"
  58. label="1~2年级0.2元/张"
  59. header-align="center"
  60. >
  61. </el-table-column>
  62. <el-table-column
  63. prop="middleGradeCount"
  64. label="3~4年级0.3元/张"
  65. header-align="center"
  66. ></el-table-column>
  67. <el-table-column
  68. prop="highGradeCount"
  69. label="5~6年级0.4元/张"
  70. header-align="center">
  71. </el-table-column>
  72. <el-table-column
  73. prop="total"
  74. label="总计"
  75. header-align="center"
  76. width="400"
  77. >
  78. </el-table-column>
  79. </el-table>
  80. <!-- 分页显示 -->
  81. <div class="page-block" v-if="parseInt(getTeacherSalaryList.pages) > 10">
  82. <el-pagination
  83. background
  84. @size-change="handleSizeChange"
  85. @current-change="pageChange"
  86. :page-sizes="[10]"
  87. layout="total,prev, pager, next"
  88. :total= parseInt(getTeacherSalaryList.pages)
  89. ></el-pagination>
  90. </div>
  91. </el-col>
  92. </el-row>
  93. <!--弹框-->
  94. <div class='showModel' @click="allShowModel(2)" v-if="isPigai"></div>
  95. <div class='model' v-if="isPigai">
  96. <div class='model-text'>
  97. <div class="model-text-items">
  98. <div><img src="../../assets/img/del@2x.png" alt="" @click="allShowModel(2)" class="model-text-items-close"></div>
  99. <div>是否导出表格?</div>
  100. </div>
  101. <div class="model-btn">
  102. <div class="model-btn-items main-gay">是</div>
  103. <div class="model-btn-items model-grdeen">否</div>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. </template>
  109. <script>
  110. import { mapGetters, mapActions } from "vuex";
  111. import { IMG_BASE_URL } from '@/ImgConfig'
  112. export default {
  113. components: { },
  114. name: "actvResolveLabel",
  115. props: {},
  116. data() {
  117. return {
  118. Activeindex:false,
  119. BASE_URL:IMG_BASE_URL,
  120. selMonth:'',
  121. hiddenModel:false,
  122. isPigai:false,
  123. ItemList: [
  124. {
  125. text:'数据监控'
  126. },
  127. {
  128. text:'当天'
  129. },
  130. {
  131. text:'当月'
  132. },
  133. ],
  134. filters: {
  135. actvNm: "",
  136. actvCrtUserId: "",
  137. actvType: "",
  138. actvSmallType: "",
  139. // 排序
  140. MaxtimeValue:'',
  141. oneMonth:'',
  142. pageNo: 1,
  143. pageSize: 10,
  144. count: 0,
  145. orderField: "",
  146. orderAD: ""
  147. }
  148. };
  149. },
  150. watch: {},
  151. computed: {
  152. ...mapGetters(["getUser","getTeacherSalaryList"])
  153. },
  154. methods: {
  155. ...mapActions(["setUser"]),
  156. // 表格头部样式
  157. tableheaderClassName({ row, rowIndex }) {
  158. return "table-head-th";
  159. },
  160. //表格导出
  161. excel(){
  162. try {
  163. //var curTbl = document.getElementById(tableId);
  164. //var lenRow = curTbl.rows.length;
  165. var curTbl = $('.el-table')[0];
  166. var lenRow = curTbl.rows.length;
  167. //创建AX对象excel
  168. var oXL = new ActiveXObject("Excel.Application");
  169. //获取workbook对象
  170. var oWB = oXL.Workbooks.Add();
  171. var oSheet = oWB.ActiveSheet;
  172. //取得表格行数
  173. for (var i = 0; i < lenRow; i++) {
  174. var lenCol = curTbl.rows(i).cells.length;
  175. //取得每行的列数
  176. for (var j = 0; j < lenCol; j++)
  177. {
  178. oSheet.Cells(i + 1, j + 1).value = curTbl.rows(i).cells(j).innerText;
  179. }
  180. }
  181. oXL.Visible = true; //设置excel可见属性
  182. //oXL.UserControl = true;
  183. //oXL=null
  184. } catch (e) {
  185. if ((!+'\v1')) { //ie浏览器
  186. alert("无法启动Excel,请确保电脑中已经安装了Excel!")
  187. } else {
  188. let arr = this.getTeacherSalaryList.list;
  189. let str = '注册老师,1~2年级0.2元/张,3~4年级0.3元/张,5~6年级0.4元/张,总计/元';
  190. for (let i = 0; i < arr.length; i++) {
  191. str += "\n" + arr[i].name + ',' + arr[i].lowGradeCount + ',' + arr[i].middleGradeCount + ',' + arr[i].highGradeCount + ',' + arr[i].total
  192. }
  193. var uri = 'data:text/csv;charset=utf-8,' + encodeURIComponent(str);
  194. var downloadLink = document.createElement("a");
  195. downloadLink.href = uri;
  196. downloadLink.download = "export.csv";
  197. document.body.appendChild(downloadLink);
  198. downloadLink.click();
  199. document.body.removeChild(downloadLink);
  200. }
  201. }
  202. },
  203. // 手动批改
  204. handApor(){
  205. this.Activeindex = false;
  206. },
  207. // 自动批改
  208. AutoApor(){
  209. this.Activeindex = true;
  210. },
  211. //弹框
  212. isShow(str){
  213. let _this = this;
  214. console.log(str)
  215. if (str == 1){
  216. _this.hiddenModel = true;
  217. _this.isPigai = false;
  218. } else if (str == 2){
  219. _this.isPigai = true;
  220. _this.hiddenModel = false;
  221. }
  222. },
  223. //关闭弹框
  224. allShowModel(str) {
  225. let _this = this;
  226. if (str == 1){
  227. _this.hiddenModel = false;
  228. } else if (str == 2){
  229. _this.isPigai = false;
  230. }
  231. },
  232. //时间封装
  233. formatDate: function () {
  234. let date = new Date();
  235. let y = date.getFullYear();
  236. let MM = date.getMonth() + 1;
  237. MM = MM < 10 ? ('0' + MM) : MM;
  238. let d = date.getDate();
  239. d = d < 10 ? ('0' + d) : d;
  240. let h = date.getHours();
  241. h = h < 10 ? ('0' + h) : h;
  242. let m = date.getMinutes();
  243. m = m < 10 ? ('0' + m) : m;
  244. let s = date.getSeconds();
  245. s = s < 10 ? ('0' + s) : s;
  246. return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
  247. },
  248. // 老师薪酬列表
  249. async GetTeacherSalaryList() {
  250. this.$store.dispatch("GetTeacherSalaryList", {
  251. pageNo: this.filters.pageNo,
  252. pageSize: this.filters.pageSize,
  253. oneMonth:this.selMonth,
  254. maxCreateTime: this.formatDate()
  255. });
  256. },
  257. // 分页
  258. pageChange(val) {
  259. this.filters.pageNo = val;
  260. this.GetTeacherSalaryList();
  261. },
  262. changeDateSlot(dateSlot) {
  263. if (dateSlot) {
  264. this.filters.startDate = dateSlot[0];
  265. this.filters.endDate = dateSlot[1];
  266. } else {
  267. this.filters.startDate = null;
  268. this.filters.endDate = null;
  269. }
  270. },
  271. actvTypeChange(typeList) {
  272. switch (typeList.length) {
  273. case 1:
  274. this.filters.actvType = typeList[0];
  275. this.filters.actvSmallType = null;
  276. break;
  277. case 2:
  278. this.filters.actvType = null;
  279. this.filters.actvSmallType = typeList[1];
  280. break;
  281. default:
  282. this.filters.actvType = null;
  283. this.filters.actvSmallType = null;
  284. break;
  285. }
  286. },
  287. handleSizeChange(val) {
  288. this.filters.pageSize = val;
  289. this.GetTeacherSalaryList();
  290. },
  291. // 排序
  292. sortChange(sort) {
  293. this.filters.orderField = sort.prop;
  294. this.filters.orderAD = sort.order != null ? sort.order : "";
  295. this.itemListReshow();
  296. },
  297. clearSearch() {
  298. this.filters.actvNm = null;
  299. this.filters.actvCrtUserId = null;
  300. this.filters.actvType = null;
  301. this.filters.actvSmallType = null;
  302. this.filtersActvType = [];
  303. this.createDateSlot = null;
  304. },
  305. },
  306. mounted() {
  307. sessionStorage.setItem('tabIndex',2);
  308. console.log(sessionStorage.getItem('tabIndex'))
  309. this.GetTeacherSalaryList()
  310. }
  311. };
  312. </script>
  313. <!-- Add "scoped" attribute to limit CSS to this component only -->
  314. <style scoped>
  315. .main{
  316. background-color: #fff;
  317. margin-top: 16px;
  318. padding: 0 !important;
  319. border: 1px solid #E1E1E1;
  320. min-height: 980px;
  321. }
  322. el-table{
  323. color: #999999;
  324. font-size: 18px;
  325. }
  326. .el-pagination.is-background .el-pager li:not(.disabled).active {
  327. background-color:#52cc60!important;
  328. color: #fff;
  329. }
  330. .main-items{
  331. color: #393939;
  332. text-align: center;
  333. line-height: 80px;
  334. }
  335. .main-header-item{
  336. cursor: pointer;
  337. font-size: 16px;
  338. color: #7E7E7E;
  339. }
  340. .input-with-select .el-input-group__prepend {
  341. background-color: #fff;
  342. }
  343. .table-img{
  344. width:36px;
  345. height:36px;
  346. border-radius:6px;
  347. }
  348. .showModel{
  349. width: 100%;
  350. height: 100%;
  351. position: fixed;
  352. top: 0;
  353. left: 0;
  354. background: #000000;
  355. opacity: 0.2;
  356. overflow: hidden;
  357. z-index: 1000;
  358. color: #fff;
  359. }
  360. .model{
  361. z-index: 1001;
  362. width:40%;
  363. height:auto;
  364. position: fixed;
  365. top: 30%;
  366. left: 30%;
  367. margin:auto;
  368. background: #fff;
  369. border-radius:10px;
  370. text-align: center;
  371. }
  372. .scope-name{
  373. margin-left: 13px;
  374. }
  375. .model-text{
  376. background:rgba(255,255,255,1);
  377. border-radius:10px;
  378. }
  379. .model-btn{
  380. display: flex;
  381. justify-content: space-around;
  382. margin-bottom: 44px;
  383. }
  384. .model-btn-items{
  385. width:154px;
  386. height:50px;
  387. line-height: 50px;
  388. text-align: center;
  389. font-size: 18px;
  390. border-radius:4px;
  391. }
  392. .main-gay{
  393. background:rgba(246,247,251,1);
  394. color: #7E7E7E;
  395. }
  396. .model-grdeen{
  397. background-color: #52CC60;
  398. color: #fff;
  399. }
  400. .model-text-items-close{
  401. position: absolute;
  402. top: 10px;
  403. right: 15px;
  404. }
  405. .model-text-items{
  406. position: relative;
  407. color: #000000;
  408. font-size: 24px;
  409. text-align: center;
  410. padding: 40px 0 50px 0;
  411. }
  412. .el-table .table-head-th{
  413. background-color:#F6F7FB;
  414. font-size: 16px !important;
  415. color: #393939;
  416. }
  417. .page-block{
  418. text-align: center !important;
  419. margin-top: 15px;
  420. }
  421. .scope-list{
  422. margin-left: 18px;
  423. text-align: left;
  424. }
  425. .ApporStyles{
  426. display:inline-block;
  427. width: 100px;
  428. height: 30px;
  429. line-height:30px;
  430. background-color: #fff;
  431. border-radius:15px;
  432. font-size: 14px;
  433. color:#7C819D;
  434. cursor: pointer;
  435. }
  436. .superactive{
  437. background-color: #52CC60;
  438. color:#fff;
  439. }
  440. </style>