index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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="businesDateSearch">
  13. <el-date-picker v-model="search.businesDate" type="daterange" start-placeholder="开始日期" end-placeholder="结束日期"
  14. format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" :default-time="['00:00:00', '23:59:59']">
  15. </el-date-picker>
  16. </template>
  17. </avue-crud>
  18. </basic-container>
  19. </div>
  20. </template>
  21. <script>
  22. import { getToken } from "@/util/auth";
  23. import { getList } from "@/api/statisticAnalysis/salesDetails"
  24. export default {
  25. name: "index",
  26. data() {
  27. return {
  28. form: {},
  29. search: {},
  30. dataList: [],
  31. loading: false,
  32. detailData: {},
  33. page: {
  34. pageSize: 20,
  35. currentPage: 1,
  36. total: 0,
  37. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  38. },
  39. option: {},
  40. optionBack: {
  41. searchShow: true,
  42. searchMenuPosition: "right",
  43. searchSpan: 8,
  44. searchMenuSpan: 8,
  45. border: true,
  46. index: true,
  47. addBtn: false,
  48. viewBtn: false,
  49. editBtn: false,
  50. delBtn: false,
  51. searchIcon: true,
  52. menu: false,
  53. column: [
  54. {
  55. label: "承做人",
  56. prop: "userid",
  57. overHidden: true,
  58. search: true,
  59. formatter: row => {
  60. return row.userName;
  61. }
  62. },
  63. {
  64. label: "日期",
  65. prop: "careteTime",
  66. type: "datetime",
  67. format: 'yyyy-MM-dd',
  68. valueFormat: 'yyyy-MM-dd HH:mm:ss',
  69. searchRange: true,
  70. searchDefaultTime: ['00:00:00', '23:59:59'],
  71. overHidden: true,
  72. search: true,
  73. },
  74. {
  75. label: "客户名称",
  76. prop: "cordName",
  77. overHidden: true,
  78. },
  79. {
  80. label: "任务名称",
  81. prop: "taskName",
  82. overHidden: true,
  83. },
  84. {
  85. label: "提成金额",
  86. prop: "commissionAmount",
  87. overHidden: true
  88. }
  89. ]
  90. }
  91. };
  92. },
  93. async created() {
  94. this.option = await this.getColumnData(this.getColumnName(184), this.optionBack);
  95. },
  96. methods: {
  97. cellStyle() {
  98. return "padding:0;height:40px;";
  99. },
  100. //点击搜索按钮触发
  101. searchChange(params, done) {
  102. this.page.currentPage = 1;
  103. this.onLoad(this.page, params);
  104. done();
  105. },
  106. refreshChange() {
  107. this.onLoad(this.page, this.search);
  108. },
  109. currentChange(val) {
  110. this.page.currentPage = val;
  111. },
  112. sizeChange(val) {
  113. this.page.currentPage = 1;
  114. this.page.pageSize = val;
  115. },
  116. onLoad(page, params) {
  117. if (this.search.careteTime && this.search.careteTime.length > 0) {
  118. params = {
  119. ...params,
  120. beginCreateTime: this.search.careteTime[0],
  121. endCreateTime: this.search.careteTime[1]
  122. };
  123. }
  124. let data = this.deepClone(Object.assign(params, this.search));
  125. delete data.careteTime;
  126. this.loading = true;
  127. getList(
  128. page.currentPage,
  129. page.pageSize,
  130. data
  131. ).then(res => {
  132. if (res.data.data.records) {
  133. res.data.data.records.forEach(e => {
  134. e.itemLoading = true;
  135. });
  136. }
  137. this.dataList = res.data.data.records ? res.data.data.records : [];
  138. this.page.total = res.data.data.total;
  139. if (this.page.total) {
  140. this.option.height = window.innerHeight - 210;
  141. }
  142. }).finally(() => {
  143. this.loading = false;
  144. });
  145. },
  146. //列保存触发
  147. async saveColumn() {
  148. const inSave = await this.saveColumnData(this.getColumnName(184), this.option);
  149. if (inSave) {
  150. this.$message.success("保存成功");
  151. //关闭窗口
  152. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  153. }
  154. },
  155. async resetColumn() {
  156. this.option = this.optionBack;
  157. const inSave = await this.delColumnData(this.getColumnName(184), this.optionBack);
  158. if (inSave) {
  159. this.$message.success("重置成功");
  160. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  161. }
  162. },
  163. editOpen(row) {
  164. },
  165. outExport() {
  166. let queryParams = this.search
  167. if (queryParams.arrivalTime) {
  168. queryParams.beginCreateTime = queryParams.careteTime[0]
  169. queryParams.endCreateTime = queryParams.careteTime[1]
  170. delete queryParams.careteTime
  171. }
  172. const routeData = this.$router.resolve({
  173. path: '/api/blade-land/order/acct-export', //跳转目标窗口的地址
  174. query: {
  175. ...queryParams //括号内是要传递给新窗口的参数
  176. }
  177. })
  178. window.open(routeData.href.slice(1, routeData.href.length - 1) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  179. }
  180. }
  181. };
  182. </script>
  183. <style scoped>
  184. .page-crad ::v-deep .basic-container__card {
  185. height: 94.2vh;
  186. }
  187. ::v-deep .el-table__expanded-cell[class*="cell"] {
  188. padding: 0px;
  189. }
  190. .itemTable ::v-deep .el-table {
  191. width: 100%;
  192. }
  193. </style>