index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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="corpNameSearch">
  13. <crop-select v-model="search.corpName" corpType="KH" :zhKey="true"></crop-select>
  14. </template>
  15. <template slot="businesDateSearch">
  16. <el-date-picker v-model="search.businesDate" type="daterange" start-placeholder="开始日期" end-placeholder="结束日期"
  17. format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" :default-time="['00:00:00', '23:59:59']">
  18. </el-date-picker>
  19. </template>
  20. </avue-crud>
  21. </basic-container>
  22. </div>
  23. </template>
  24. <script>
  25. import { getToken } from "@/util/auth";
  26. import { getList } from "@/api/statisticAnalysis/customerDelivery"
  27. import { gainUser } from "@/api/basicData/customerInquiry";
  28. import { defaultDate5 } from "@/util/date";
  29. export default {
  30. name: "index",
  31. data() {
  32. return {
  33. UConfiguration: {
  34. multipleChoices: false,
  35. multiple: false,
  36. disabled: false,
  37. searchShow: true,
  38. collapseTags: false,
  39. placeholder: '请点击右边按钮选择',
  40. dicData: []
  41. },
  42. form: {},
  43. search: {
  44. date:defaultDate5()
  45. },
  46. dataList: [],
  47. loading: false,
  48. detailData: {},
  49. page: {
  50. pageSize: 20,
  51. currentPage: 1,
  52. total: 0,
  53. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  54. },
  55. option: {},
  56. optionBack: {
  57. align: "center",
  58. searchShow: true,
  59. searchMenuPosition: "right",
  60. searchSpan: 8,
  61. searchMenuSpan: 8,
  62. border: true,
  63. index: true,
  64. addBtn: false,
  65. viewBtn: false,
  66. editBtn: false,
  67. delBtn: false,
  68. searchIcon: true,
  69. menu: false,
  70. summaryText: "合计",
  71. showSummary: true,
  72. sumColumnList: [
  73. {
  74. name: "quantity",
  75. type: "sum",
  76. decimals:0
  77. },
  78. {
  79. name: "amount",
  80. type: "sum",
  81. decimals:2
  82. }
  83. ],
  84. column: [
  85. {
  86. label: "业务日期",
  87. prop: "date",
  88. type: "date",
  89. format: 'yyyy-MM-dd',
  90. valueFormat: 'yyyy-MM-dd',
  91. searchValue:defaultDate5(),
  92. searchRange: true,
  93. overHidden: true,
  94. hide: true,
  95. showColumn: false,
  96. search: true,
  97. },
  98. {
  99. label: "品牌",
  100. prop: "brand",
  101. filterable: true,
  102. multiple: true,
  103. type: "select",
  104. props: {
  105. label: "dictValue",
  106. value: "dictValue"
  107. },
  108. dicData: [],
  109. dataType: "string",
  110. overHidden: true,
  111. hide: true,
  112. showColumn: false,
  113. search: true
  114. },
  115. {
  116. label: "省份",
  117. prop: "belongtoarea",
  118. overHidden: true,
  119. search: true
  120. },
  121. {
  122. label: "客户",
  123. prop: "corpName",
  124. overHidden: true,
  125. search: true
  126. },
  127. {
  128. label: "业务员",
  129. prop: "chargeMember",
  130. type: "select",
  131. dicUrl: "",
  132. filterable: true,
  133. multiple: true,
  134. props: {
  135. label: "name",
  136. value: "name"
  137. },
  138. dicData:[],
  139. dataType: "string",
  140. overHidden: true,
  141. search: true
  142. },
  143. {
  144. label: "发货数量",
  145. prop: "quantity",
  146. overHidden: true,
  147. },
  148. {
  149. label: "销售收入",
  150. prop: "amount",
  151. overHidden: true,
  152. }
  153. ]
  154. }
  155. };
  156. },
  157. async created() {
  158. this.option = await this.getColumnData(this.getColumnName(226), this.optionBack);
  159. this.getAllWorkDicts()
  160. },
  161. activated() {
  162. this.$nextTick(() => {
  163. this.$refs.crud.refreshTable();
  164. });
  165. },
  166. methods: {
  167. getAllWorkDicts() {
  168. this.option.height = window.innerHeight - 210;
  169. this.getWorkDicts('brand').then(res => {
  170. this.findObject(this.option.column, "brand").dicData =
  171. res.data.data;
  172. })
  173. gainUser().then(res => {
  174. this.findObject(this.option.column, "chargeMember").dicData =
  175. res.data.data;
  176. })
  177. },
  178. cellStyle() {
  179. return "padding:0;height:40px;";
  180. },
  181. searchCriteriaSwitch(type) {
  182. if (type) {
  183. this.option.height = this.option.height - 46;
  184. } else {
  185. this.option.height = this.option.height + 46;
  186. }
  187. this.$refs.crud.getTableHeight();
  188. },
  189. //点击搜索按钮触发
  190. searchChange(params, done) {
  191. this.page.currentPage = 1;
  192. this.onLoad(this.page, params);
  193. done();
  194. },
  195. refreshChange() {
  196. this.onLoad(this.page, this.search);
  197. },
  198. currentChange(val) {
  199. this.page.currentPage = val;
  200. },
  201. sizeChange(val) {
  202. this.page.currentPage = 1;
  203. this.page.pageSize = val;
  204. },
  205. onLoad(page, params = {}) {
  206. let data = this.deepClone(Object.assign({}, params, this.search));
  207. if (data.date) {
  208. data.beginTime = data.date[0]
  209. data.endTime = data.date[1]
  210. delete data.date
  211. }
  212. this.loading = true;
  213. getList(
  214. page.currentPage,
  215. page.pageSize,
  216. data
  217. ).then(res => {
  218. this.dataList = res.data.data.records ? res.data.data.records : [];
  219. this.page.total = res.data.data.total;
  220. }).finally(() => {
  221. this.loading = false;
  222. });
  223. },
  224. //列保存触发
  225. async saveColumn() {
  226. const inSave = await this.saveColumnData(this.getColumnName(226), this.option);
  227. if (inSave) {
  228. this.$message.success("保存成功");
  229. //关闭窗口
  230. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  231. }
  232. },
  233. async resetColumn() {
  234. this.option = this.optionBack;
  235. const inSave = await this.delColumnData(this.getColumnName(226), this.optionBack);
  236. this.getAllWorkDicts()
  237. if (inSave) {
  238. this.$message.success("重置成功");
  239. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  240. }
  241. },
  242. editOpen(row) {
  243. },
  244. outExport() {
  245. let params = { ...this.search }
  246. if (params.date && params.date.length > 0) {
  247. params = {
  248. ...params,
  249. beginTime: params.date[0],
  250. endTime: params.date[1],
  251. }
  252. } else {
  253. params = {
  254. ...params,
  255. beginTime: '',
  256. endTime: '',
  257. }
  258. }
  259. window.open(
  260. `/api/blade-purchase-sales/exportOrder/corpStatisticsExport?${this.website.tokenHeader
  261. }=${getToken()}&beginTime=${params.beginTime}&endTime=${params.endTime}&chargeMember=${params.chargeMember}&brand=${params.brand? params.brand : ''}`
  262. );
  263. }
  264. }
  265. };
  266. </script>
  267. <style scoped>
  268. .page-crad ::v-deep .basic-container__card {
  269. height: 94.2vh;
  270. }
  271. ::v-deep .el-table__expanded-cell[class*="cell"] {
  272. padding: 0px;
  273. }
  274. .itemTable ::v-deep .el-table {
  275. width: 100%;
  276. }
  277. </style>