DepartmentPointAll.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <div
  3. style=" background-color: #fff; padding:15px; padding-top:0; height: 370px; overflow: hidden"
  4. v-loading="loading"
  5. >
  6. <el-scrollbar
  7. wrap-class="column-wrapper scrollable-items-container"
  8. :native="false"
  9. style="height: 350px;"
  10. >
  11. <el-table
  12. v-show="tableData.length!=0"
  13. ref="multipleTable"
  14. :data="tableData.now"
  15. :border="false"
  16. tooltip-effect="dark"
  17. style="width: 100%"
  18. :row-class-name="tableRowClassName"
  19. @filter-change="filterHandler"
  20. @selection-change="handleSelectionChange"
  21. >
  22. <el-table-column prop="employee_name" label="姓名" width="80px"></el-table-column>
  23. <el-table-column prop="dept_name" label="部门" width="80px">
  24. <template slot-scope="scope">
  25. <div style="width:80px;">
  26. <span v-if="scope.row.dept_name != ''">{{scope.row.dept_name}}</span>
  27. <span v-if="scope.row.dept_name ===null">暂无分配</span>
  28. </div>
  29. </template>
  30. </el-table-column>
  31. <el-table-column sortable prop="add_point.point_sum" label="奖分" width="80px"></el-table-column>
  32. <el-table-column width="100px" sortable prop="add_point.event_count" label="奖分次数"></el-table-column>
  33. <el-table-column sortable prop="sub_point.point_sum" label="扣分" width="80px"></el-table-column>
  34. <el-table-column width="100px" sortable prop="sub_point.event_count" label="扣分次数"></el-table-column>
  35. </el-table>
  36. </el-scrollbar>
  37. <div
  38. v-if="tableData.length == 0"
  39. style="
  40. position: absolute;
  41. width: 100%;
  42. top: 50%;
  43. margin-top: -115px;
  44. "
  45. >
  46. <img
  47. v-if="tableData.length == 0"
  48. src="static/images/nodata.png"
  49. style="display: block; margin:0 auto;"
  50. >
  51. <p style="color:#ccc; text-align: center">暂无数据</p>
  52. </div>
  53. </div>
  54. </template>
  55. <script>
  56. export default {
  57. data() {
  58. return {
  59. loading: false,
  60. profile: this.$store.getters.user_info,
  61. totalCount: 0,
  62. tableData: [],
  63. department_list: [],
  64. pageLimit: 10,
  65. category_list: [],
  66. currentPage: 1,
  67. multipleSelection: [],
  68. filter: {
  69. keywords: "",
  70. target_id_set: [],
  71. category_id: [],
  72. point_type: 0,
  73. time_range: ""
  74. },
  75. categoryTree: [],
  76. employeeOptions: [],
  77. pointTypes: [],
  78. instantPickerOptions: {
  79. shortcuts: [
  80. {
  81. text: "本周",
  82. onClick(picker) {
  83. const now = new Date(new Date().toLocaleDateString());
  84. let start =
  85. now.getTime() - (now.getDay() - 1) * 24 * 60 * 60 * 1000;
  86. let end = start + 7 * 24 * 60 * 60 * 1000 - 1000;
  87. picker.$emit("pick", [start, end]);
  88. }
  89. },
  90. {
  91. text: "上周",
  92. onClick(picker) {
  93. const now = new Date(new Date().toLocaleDateString());
  94. let start =
  95. now.getTime() - (now.getDay() + 6) * 24 * 60 * 60 * 1000;
  96. let end = start + 7 * 24 * 60 * 60 * 1000 - 1000;
  97. picker.$emit("pick", [start, end]);
  98. }
  99. },
  100. {
  101. text: "本月",
  102. onClick(picker) {
  103. const now = new Date();
  104. let startDate = new Date(now.getFullYear(), now.getMonth(), 1);
  105. let endDate = new Date(now.getFullYear(), now.getMonth() + 1, 0);
  106. picker.$emit("pick", [startDate.getTime(), endDate.getTime()]);
  107. }
  108. },
  109. {
  110. text: "上月",
  111. onClick(picker) {
  112. const now = new Date();
  113. let startDate = new Date(
  114. now.getFullYear() - (now.getMonth() > 0 ? 0 : 1),
  115. (now.getMonth() + 11) % 12,
  116. 1
  117. );
  118. let endDate = new Date(now.getFullYear(), now.getMonth(), 0);
  119. picker.$emit("pick", [startDate.getTime(), endDate.getTime()]);
  120. }
  121. }
  122. ]
  123. }
  124. };
  125. },
  126. methods: {
  127. tableRowClassName({ row, rowIndex }) {
  128. if (row.target_id == this.$store.getters.user_info.id) {
  129. return "rank-mine";
  130. }
  131. return "";
  132. },
  133. handleSizeChange(val) {
  134. this.pageLimit = val;
  135. this.onFilterChanged();
  136. },
  137. filterHandler: function(value) {
  138. console.log(value);
  139. this.filter.category_id = value["el-table_1_column_5"];
  140. this.onFilterChanged();
  141. },
  142. onFilterChanged: function() {
  143. this.currentPage = 1;
  144. this.loadEventList();
  145. },
  146. modeTypeFormatter: function(value) {
  147. switch (value) {
  148. case 1:
  149. return "积分录入";
  150. case 2:
  151. return "积分申请";
  152. default:
  153. return "";
  154. }
  155. },
  156. reviewStatusFormatter: function(row, column, cellValue) {
  157. return cellValue == 1 ? "待审核" : "已生效";
  158. },
  159. dateFormatter: function(row, column, cellValue) {
  160. return this.$moment(cellValue * 1000).format("MM月DD日");
  161. },
  162. toggleSelection: function(rows) {
  163. if (rows) {
  164. rows.forEach(row => {
  165. this.$refs.multipleTable.toggleRowSelection(row);
  166. });
  167. } else {
  168. this.$refs.multipleTable.clearSelection();
  169. }
  170. },
  171. handleSelectionChange: function(val) {
  172. this.multipleSelection = val;
  173. },
  174. //获取积分事件列表
  175. loadEventList: function() {
  176. const now = new Date();
  177. let startDate = new Date(now.getFullYear(), now.getMonth(), 1);
  178. let endDate = new Date(now.getFullYear(), now.getMonth() + 1, 0);
  179. let params = {
  180. time_range:
  181. startDate.getTime() / 1000 +
  182. "," +
  183. (endDate.getTime() / 1000 + 3600 * 24 - 1)
  184. };
  185. var self = this;
  186. self.loading = true;
  187. this.$http('get',"/integral.php/point_data/get_department_point",params)
  188. .then(function(response) {
  189. if (response.status == 200) {
  190. self.loading = false;
  191. var jsonData = response.data;
  192. try {
  193. self.tableData = jsonData.data;
  194. } catch (err) {
  195. console.log(err);
  196. }
  197. }
  198. })
  199. .catch(function(error) {
  200. console.log(error);
  201. });
  202. },
  203. changePage: function(current) {
  204. if (isNaN(current) || current < 1) {
  205. return false;
  206. }
  207. this.loadEventList();
  208. }
  209. },
  210. created() {
  211. this.loadEventList();
  212. }
  213. };
  214. </script>
  215. <style>
  216. .el-pagination {
  217. text-align: center;
  218. margin-top: 15px;
  219. }
  220. </style>