lotteryTicket_statistics.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <div>
  3. <el-row :span="24" style="display:flex;min-width:650px;">
  4. <el-col style="width:200px;padding-right:5px;">
  5. <el-date-picker
  6. v-model="formData.month"
  7. type="month"
  8. placeholder="请选择月份"
  9. value-format="yyyy-MM"
  10. ></el-date-picker
  11. ></el-col>
  12. <el-col style="width:200px;">
  13. <el-cascader
  14. v-model="dept_name"
  15. :options="dept_tree"
  16. @change="dept1_null"
  17. :props="{
  18. checkStrictly: true,
  19. value: 'id',
  20. label: 'name',
  21. children: '_child',
  22. }"
  23. ref="dept1"
  24. filterable
  25. change-on-select
  26. placeholder="全公司"
  27. clearable
  28. ></el-cascader>
  29. </el-col>
  30. <el-col class="search" style="width:200px;">
  31. <el-input
  32. v-model="formData.keywords"
  33. placeholder="输入同事姓名"
  34. @keyup.enter.native="get_all_integral"
  35. >
  36. <el-button
  37. class="buttonCLo"
  38. slot="append"
  39. @click="get_all_integral"
  40. icon="el-icon-search"
  41. ></el-button>
  42. </el-input>
  43. </el-col>
  44. </el-row>
  45. <div class="all">
  46. <div>
  47. <el-table
  48. :data="all_integral_list"
  49. style="width: 100%"
  50. v-loading="loading"
  51. >
  52. <el-table-column prop="employee_name" label="姓名" align="left">
  53. <template slot-scope="scope">
  54. <div style="display:flex">
  55. <span class="fl">
  56. <userImage
  57. :id="scope.row.id"
  58. width="50px"
  59. height="50px"
  60. fontSize="1"
  61. :user_name="scope.row.name"
  62. :img_url="scope.row.img_url"
  63. ></userImage>
  64. </span>
  65. <span
  66. style="margin-left: 20px; line-height: 50px; display: inline-block"
  67. >{{ scope.row.name }}</span
  68. >
  69. </div>
  70. </template>
  71. </el-table-column>
  72. <el-table-column prop="performance" label="部门" align="left">
  73. <template slot-scope="scope">
  74. <span>{{ scope.row.dept_name }}</span>
  75. </template>
  76. </el-table-column>
  77. <el-table-column prop="a" label="奖票数量" align="left">
  78. <template slot-scope="scope">
  79. <span>{{ scope.row.ticketNumber }}</span>
  80. </template>
  81. </el-table-column>
  82. <template slot="empty">
  83. <noData></noData>
  84. </template>
  85. </el-table>
  86. <center style="padding: 20px 0;">
  87. <el-pagination
  88. background
  89. @size-change="handleSizeChange1"
  90. @current-change="handleCurrentChange"
  91. :current-page="formData.page"
  92. :page-sizes="[10, 20, 50, 100]"
  93. layout="total, sizes, prev, pager, next"
  94. :page-size="pageLimit1"
  95. :total="total"
  96. >
  97. </el-pagination>
  98. </center>
  99. </div>
  100. </div>
  101. </div>
  102. </template>
  103. <script>
  104. import noData from '@/components/noData';
  105. export default {
  106. data() {
  107. return {
  108. loading: false,
  109. all_integral_list: null,
  110. formData: {
  111. month: this.$moment().format("YYYY-MM"),
  112. keywords: "",
  113. dept_id: "",
  114. page: 1,
  115. page_size: 10
  116. },
  117. total: 0,
  118. //部门
  119. dept_name: [],
  120. dept_tree: [],
  121. pageLimit1: 10
  122. };
  123. },
  124. components: {noData},
  125. watch: {
  126. "formData.month"(val, old_val) {
  127. this.formData.page = 1;
  128. this.get_all_integral();
  129. },
  130. "formData.dept_id"(val, old_val) {
  131. if (!val) {
  132. this.formData.dept_id = 0;
  133. }
  134. this.formData.page = 1;
  135. this.get_all_integral();
  136. }
  137. },
  138. mounted() {
  139. this.get_all_integral();
  140. this.getDepartment(); //部门
  141. },
  142. methods: {
  143. //分页
  144. handleSizeChange1(val) {
  145. this.pageLimit1 = val;
  146. this.formData.page_size = this.pageLimit1;
  147. this.get_all_integral();
  148. },
  149. handleCurrentChange(val) {
  150. this.formData.page = val;
  151. this.get_all_integral();
  152. },
  153. //请求数据
  154. get_all_integral() {
  155. let self = this;
  156. self.loading = true;
  157. self
  158. .$axios("get", "/api/integral/statistics/ticket", self.formData)
  159. .then(res => {
  160. if (res.data.code == 1) {
  161. self.all_integral_list = res.data.data.list;
  162. self.total = res.data.data.total;
  163. } else {
  164. self.$message.error(res.data.data.msg);
  165. }
  166. })
  167. .finally(() => {
  168. self.loading = false;
  169. });
  170. },
  171. dept1_null(val) {
  172. //部门
  173. if (val.length == 0) {
  174. this.formData.dept_id = 0;
  175. } else {
  176. this.formData.dept_id = this.dept_name[this.dept_name.length - 1];
  177. }
  178. this.$nextTick(() => {
  179. this.$refs.dept1.dropDownVisible = false;
  180. });
  181. },
  182. // // 递归判断列表,把最后的children设为undefined
  183. // getTreeData(data) {
  184. // for (var i = 0; i < data.length; i++) {
  185. // if (data[i].children.length < 1) {
  186. // // children若为空数组,则将children设为undefined
  187. // data[i].children = undefined;
  188. // } else {
  189. // // children若不为空数组,则继续 递归调用 本方法
  190. // this.getTreeData(data[i].children);
  191. // }
  192. // }
  193. // return data;
  194. // },
  195. //获取部门
  196. getDepartment() {
  197. this.$axios("get", "/api/department/tree").then((res) => {
  198. this.dept_tree = this.getTreeData(res.data.data.list);
  199. });
  200. },
  201. // 递归判断列表,把最后的children设为undefined
  202. getTreeData(data) {
  203. for (var i = 0; i < data.length; i++) {
  204. if (data[i]._child.length < 1) {
  205. // children若为空数组,则将children设为undefined
  206. data[i]._child = undefined;
  207. } else {
  208. // children若不为空数组,则继续 递归调用 本方法
  209. this.getTreeData(data[i]._child);
  210. }
  211. }
  212. return data;
  213. },
  214. }
  215. };
  216. </script>
  217. <style scoped lang="scss">
  218. .el-date-editor.el-input {
  219. width: auto;
  220. }
  221. .date-picker-width {
  222. width: 145px !important;
  223. }
  224. .search ::v-deep .el-input-group__append{
  225. background: #FFF;
  226. }
  227. .search ::v-deep .el-input-group__append:active {
  228. background: #26a2ff;
  229. }
  230. .search ::v-deep .el-input-group__append:active .el-icon-search {
  231. color: #fff;
  232. }
  233. </style>
  234. <style scoped="scoped" lang="scss">
  235. .all{
  236. margin-top:10px;
  237. padding:10px 20px 0px 20px;
  238. min-height: calc(100vh - 204px);
  239. }
  240. </style>