index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <div>
  3. <basic-container class="page-crad">
  4. <avue-crud ref="crud" :option="option" :data="dataList" :page.sync="page" :search.sync="search"
  5. :cell-style="cellStyle" @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
  6. @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
  7. @resetColumn="resetColumn" @search-criteria-switch="searchCriteriaSwitch">
  8. <template slot="menuLeft">
  9. <el-button type="info" size="small" @click="outExport">导出
  10. </el-button>
  11. </template>
  12. <template slot="userNameSearch">
  13. <user-select v-model="search.userName" :configuration="UConfiguration">
  14. </user-select>
  15. </template>
  16. <template slot="businesDateSearch">
  17. <el-date-picker v-model="search.businesDate" type="daterange" start-placeholder="开始日期" end-placeholder="结束日期"
  18. format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" :default-time="['00:00:00', '23:59:59']">
  19. </el-date-picker>
  20. </template>
  21. </avue-crud>
  22. </basic-container>
  23. </div>
  24. </template>
  25. <script>
  26. import { getToken } from "@/util/auth";
  27. import { getList } from "@/api/statisticAnalysis/taskStatistics"
  28. export default {
  29. name: "index",
  30. data() {
  31. return {
  32. UConfiguration: {
  33. multipleChoices: false,
  34. multiple: false,
  35. disabled: false,
  36. searchShow: true,
  37. collapseTags: false,
  38. placeholder: '请点击右边按钮选择',
  39. dicData: []
  40. },
  41. form: {},
  42. search: {},
  43. dataList: [],
  44. loading: false,
  45. detailData: {},
  46. page: {
  47. pageSize: 20,
  48. currentPage: 1,
  49. total: 0,
  50. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  51. },
  52. option: {},
  53. optionBack: {
  54. searchShow: true,
  55. searchMenuPosition: "right",
  56. searchSpan: 8,
  57. searchMenuSpan: 8,
  58. border: true,
  59. index: true,
  60. addBtn: false,
  61. viewBtn: false,
  62. editBtn: false,
  63. delBtn: false,
  64. searchIcon: true,
  65. menu: false,
  66. showSummary: true,
  67. summaryText: "合计",
  68. sumColumnList: [
  69. {
  70. name: "commission",
  71. type: "sum"
  72. }],
  73. column: [
  74. {
  75. label: "承做人",
  76. prop: "userName",
  77. overHidden: true,
  78. search: true
  79. },
  80. {
  81. label: "业务日期",
  82. prop: "actualDate",
  83. type: "date",
  84. format: 'yyyy-MM-dd',
  85. valueFormat: 'yyyy-MM-dd',
  86. searchRange: true,
  87. overHidden: true,
  88. search: true,
  89. },
  90. {
  91. label: "客户名称",
  92. prop: "cornName",
  93. overHidden: true,
  94. },
  95. {
  96. label: "任务名称",
  97. prop: "pname",
  98. overHidden: true,
  99. },
  100. {
  101. label: "提成金额",
  102. prop: "commission",
  103. overHidden: true
  104. }
  105. ]
  106. }
  107. };
  108. },
  109. async created() {
  110. this.option = await this.getColumnData(this.getColumnName(184), this.optionBack);
  111. },
  112. methods: {
  113. cellStyle() {
  114. return "padding:0;height:40px;";
  115. },
  116. //点击搜索按钮触发
  117. searchChange(params, done) {
  118. this.page.currentPage = 1;
  119. this.onLoad(this.page, params);
  120. done();
  121. },
  122. refreshChange() {
  123. this.onLoad(this.page, this.search);
  124. },
  125. currentChange(val) {
  126. this.page.currentPage = val;
  127. },
  128. sizeChange(val) {
  129. this.page.currentPage = 1;
  130. this.page.pageSize = val;
  131. },
  132. onLoad(page, params) {
  133. let data = this.deepClone(Object.assign({}, params, this.search));
  134. if (data.actualDate) {
  135. data.actualDateStart = data.actualDate[0]
  136. data.actualDateEnd = data.actualDate[1]
  137. delete data.actualDate
  138. }
  139. data.branch = "Y"
  140. this.loading = true;
  141. getList(
  142. page.currentPage,
  143. page.pageSize,
  144. data
  145. ).then(res => {
  146. if (res.data.data.records) {
  147. res.data.data.records.forEach(e => {
  148. e.itemLoading = true;
  149. });
  150. }
  151. this.dataList = res.data.data.records ? res.data.data.records : [];
  152. this.page.total = res.data.data.total;
  153. if (this.page.total) {
  154. this.option.height = window.innerHeight - 210;
  155. }
  156. }).finally(() => {
  157. this.loading = false;
  158. });
  159. },
  160. //列保存触发
  161. async saveColumn() {
  162. const inSave = await this.saveColumnData(this.getColumnName(184), this.option);
  163. if (inSave) {
  164. this.$message.success("保存成功");
  165. //关闭窗口
  166. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  167. }
  168. },
  169. async resetColumn() {
  170. this.option = this.optionBack;
  171. const inSave = await this.delColumnData(this.getColumnName(184), this.optionBack);
  172. if (inSave) {
  173. this.$message.success("重置成功");
  174. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  175. }
  176. },
  177. editOpen(row) {
  178. },
  179. outExport() {
  180. let params = { ...this.search }
  181. if (params.actualDate && params.actualDate.length > 0) {
  182. params = {
  183. ...params,
  184. actualDateStart: params.actualDate[0],
  185. actualDateEnd: params.actualDate[1],
  186. }
  187. } else {
  188. params = {
  189. ...params,
  190. actualDateStart: '',
  191. actualDateEnd: '',
  192. }
  193. }
  194. window.open(
  195. `/api/trade-project/project/statisticsExport?${this.website.tokenHeader
  196. }=${getToken()}&type=TC&branch=Y&actualDateStart=${params.actualDateStart}&actualDateEnd=${params.actualDateEnd}&userName=${params.userName}&taskStatus=${params.taskStatus}`
  197. );
  198. }
  199. }
  200. };
  201. </script>
  202. <style scoped>
  203. .page-crad ::v-deep .basic-container__card {
  204. height: 94.2vh;
  205. }
  206. ::v-deep .el-table__expanded-cell[class*="cell"] {
  207. padding: 0px;
  208. }
  209. .itemTable ::v-deep .el-table {
  210. width: 100%;
  211. }
  212. </style>