index.vue 7.6 KB

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