index.vue 8.3 KB

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