index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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. <template slot="amount" slot-scope="{ row, index }">
  18. <span>{{Number(row.amount?row.amount:0).toFixed(2)}}</span>
  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/specificationsDelivery"
  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: 24,
  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. searchRange: true,
  92. overHidden: true,
  93. hide: true,
  94. showColumn: false,
  95. search: true,
  96. },
  97. {
  98. label: "业务员",
  99. prop: "chargeMember",
  100. type: "select",
  101. dicUrl: "",
  102. filterable: true,
  103. multiple: true,
  104. props: {
  105. label: "name",
  106. value: "name"
  107. },
  108. dicData:[],
  109. dataType: "string",
  110. overHidden: true,
  111. hide: true,
  112. showColumn: false,
  113. search: true
  114. },
  115. {
  116. label: "品号",
  117. prop: "code",
  118. overHidden: true
  119. },
  120. {
  121. label: "规格",
  122. prop: "typeNo",
  123. overHidden: true
  124. },
  125. {
  126. label: "品牌",
  127. prop: "brand",
  128. filterable: true,
  129. multiple: true,
  130. type: "select",
  131. props: {
  132. label: "dictValue",
  133. value: "dictValue"
  134. },
  135. dicData: [],
  136. dataType: "string",
  137. overHidden: true,
  138. search: true
  139. },
  140. {
  141. label: "花纹",
  142. prop: "brandItem",
  143. overHidden: true,
  144. },
  145. {
  146. label: "数量",
  147. prop: "quantity",
  148. overHidden: true,
  149. },
  150. {
  151. label: "数量占比排名",
  152. prop: "rankNo",
  153. overHidden: true,
  154. },
  155. {
  156. label: "金额",
  157. prop: "amount",
  158. overHidden: true,
  159. }
  160. ]
  161. }
  162. };
  163. },
  164. async created() {
  165. this.option = await this.getColumnData(this.getColumnName(230), this.optionBack);
  166. this.getAllWorkDicts()
  167. },
  168. activated() {
  169. this.$nextTick(() => {
  170. this.$refs.crud.refreshTable();
  171. });
  172. },
  173. methods: {
  174. getAllWorkDicts() {
  175. this.option.height = window.innerHeight - 210;
  176. this.getWorkDicts('brand').then(res => {
  177. this.findObject(this.option.column, "brand").dicData =
  178. res.data.data;
  179. })
  180. gainUser().then(res => {
  181. this.findObject(this.option.column, "chargeMember").dicData =
  182. res.data.data;
  183. })
  184. },
  185. cellStyle() {
  186. return "padding:0;height:40px;";
  187. },
  188. searchCriteriaSwitch(type) {
  189. if (type) {
  190. this.option.height = this.option.height - 46;
  191. } else {
  192. this.option.height = this.option.height + 46;
  193. }
  194. this.$refs.crud.getTableHeight();
  195. },
  196. //点击搜索按钮触发
  197. searchChange(params, done) {
  198. this.page.currentPage = 1;
  199. this.onLoad(this.page, params);
  200. done();
  201. },
  202. refreshChange() {
  203. this.onLoad(this.page, this.search);
  204. },
  205. currentChange(val) {
  206. this.page.currentPage = val;
  207. },
  208. sizeChange(val) {
  209. this.page.currentPage = 1;
  210. this.page.pageSize = val;
  211. },
  212. onLoad(page, params = {}) {
  213. let data = this.deepClone(Object.assign({}, params, this.search));
  214. if (data.date) {
  215. data.beginTime = data.date[0]
  216. data.endTime = data.date[1]
  217. delete data.date
  218. }
  219. this.loading = true;
  220. getList(
  221. page.currentPage,
  222. page.pageSize,
  223. data
  224. ).then(res => {
  225. this.dataList = res.data.data.records ? res.data.data.records : [];
  226. this.page.total = res.data.data.total;
  227. }).finally(() => {
  228. this.loading = false;
  229. });
  230. },
  231. //列保存触发
  232. async saveColumn() {
  233. const inSave = await this.saveColumnData(this.getColumnName(230), this.option);
  234. if (inSave) {
  235. this.$message.success("保存成功");
  236. //关闭窗口
  237. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  238. }
  239. },
  240. async resetColumn() {
  241. this.option = this.optionBack;
  242. const inSave = await this.delColumnData(this.getColumnName(230), this.optionBack);
  243. this.getAllWorkDicts()
  244. if (inSave) {
  245. this.$message.success("重置成功");
  246. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  247. }
  248. },
  249. editOpen(row) {
  250. },
  251. outExport() {
  252. let params = { ...this.search }
  253. if (params.date && params.date.length > 0) {
  254. params = {
  255. ...params,
  256. beginTime: params.date[0],
  257. endTime: params.date[1],
  258. }
  259. } else {
  260. params = {
  261. ...params,
  262. beginTime: '',
  263. endTime: '',
  264. }
  265. }
  266. window.open(
  267. `/api/blade-purchase-sales/exportOrder/specificationsProfitExport?${this.website.tokenHeader
  268. }=${getToken()}&beginTime=${params.beginTime}&endTime=${params.endTime}&chargeMember=${params.chargeMember}&brand=${params.brand? params.brand : ''}`
  269. );
  270. }
  271. }
  272. };
  273. </script>
  274. <style scoped>
  275. .page-crad ::v-deep .basic-container__card {
  276. height: 94.2vh;
  277. }
  278. ::v-deep .el-table__expanded-cell[class*="cell"] {
  279. padding: 0px;
  280. }
  281. .itemTable ::v-deep .el-table {
  282. width: 100%;
  283. }
  284. </style>