CheckTeacherPay.vue 11 KB

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