CheckTeacherPay.vue 11 KB

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