index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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"
  6. @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading"
  7. @resetColumn="resetColumn('crud', 'option', 'defaultOption', 422)"
  8. @saveColumn="saveColumn('crud', 'option', 'defaultOption', 422)">
  9. <template slot="header">
  10. <el-table :data="commodityData" border size="small" @header-click="cellClick" style="width: 100%"
  11. v-loading="itemloading">
  12. <el-table-column v-for="(item, index) in commodityLabel" :key="index" :prop="item.prop"
  13. show-overflow-tooltip :label="item.label" />
  14. </el-table>
  15. </template>
  16. <template slot="menuLeft">
  17. <el-button type="info" size="small" @click="outExport" icon="el-icon-download">导出</el-button>
  18. </template>
  19. </avue-crud>
  20. </basic-container>
  21. </div>
  22. </template>
  23. <script>
  24. import { getToken } from "@/util/auth";
  25. import { saleFinancingDetail, saleFinancingDetailSum } from "@/api/tirePartsMall/statisticAnalysis/outboundStatistics";
  26. import _ from "lodash";
  27. export default {
  28. name: "index",
  29. data() {
  30. return {
  31. itemloading: false,
  32. commodityLabel: [
  33. {
  34. id: 4,
  35. label: "代采数",
  36. prop: "sendNumFinancing",
  37. }, {
  38. id: 5,
  39. label: "代采金额",
  40. prop: "sendNumFinancingAmount",
  41. }
  42. ],
  43. commodityData: [], // 合计数据
  44. form: {},
  45. search: {},
  46. dataList: [],
  47. loading: false,
  48. page: {
  49. pageSize: 20,
  50. currentPage: 1,
  51. total: 0,
  52. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  53. },
  54. option: {},
  55. defaultOption: {
  56. height: 'auto',
  57. align: "center",
  58. border: true,
  59. index: true,
  60. addBtn: false,
  61. viewBtn: false,
  62. editBtn: false,
  63. delBtn: false,
  64. searchMenuSpan: 12,
  65. emptyBtnText: '清空所有条件',
  66. menu: false,
  67. column: [
  68. {
  69. label: '品牌',
  70. prop: 'brandName',
  71. width: 100,
  72. overHidden: true,
  73. },
  74. {
  75. label: '商品编码',
  76. prop: 'goodsNo',
  77. width: 100,
  78. overHidden: true,
  79. },
  80. {
  81. label: '商品名称',
  82. prop: 'goodsName',
  83. width: 100,
  84. search: true,
  85. overHidden: true,
  86. },
  87. {
  88. label: '规格型号',
  89. prop: 'propertyName',
  90. width: 100,
  91. overHidden: true,
  92. },
  93. {
  94. label: '花纹',
  95. prop: 'pattern',
  96. width: 100,
  97. overHidden: true,
  98. },
  99. {
  100. label: '代采数',
  101. prop: 'sendNumFinancing',
  102. width: 100,
  103. overHidden: true,
  104. },
  105. {
  106. label: '代采金额',
  107. prop: 'sendNumFinancingAmount',
  108. width: 100,
  109. overHidden: true,
  110. },
  111. {
  112. label: "出库日期",
  113. prop: "businesDate",
  114. width: 100,
  115. type: 'date',
  116. format: "yyyy-MM-dd",
  117. valueFormat: "yyyy-MM-dd",
  118. overHidden: true,
  119. },
  120. {
  121. label: '销售订单号',
  122. prop: 'saleOrdNo',
  123. width: 120,
  124. overHidden: true,
  125. },
  126. {
  127. label: '出库单号',
  128. prop: 'billno',
  129. width: 100,
  130. overHidden: true,
  131. },
  132. {
  133. label: '采购订单号',
  134. prop: 'ordNo',
  135. width: 120,
  136. search: true,
  137. overHidden: true,
  138. showColumn: false,
  139. hide: true,
  140. },
  141. {
  142. label: '采购订单号',
  143. prop: 'purchaseOrdNo',
  144. width: 120,
  145. overHidden: true,
  146. },
  147. {
  148. label: "出库状态",
  149. prop: "statusName",
  150. width: 100,
  151. type: 'select',
  152. dicData: [{
  153. label: '已出库',
  154. value: '已出库'
  155. }, {
  156. label: '待出库',
  157. value: '待出库'
  158. }, {
  159. label: '撤销出库',
  160. value: '撤销出库'
  161. }],
  162. searchValue: "已出库",
  163. search: true,
  164. showColumn: false,
  165. hide: true,
  166. },
  167. {
  168. label: '仓库',
  169. prop: 'warehouse',
  170. overHidden: true,
  171. },
  172. {
  173. label: '出库开始',
  174. prop: 'dateStart',
  175. overHidden: true,
  176. search: true,
  177. hide: true,
  178. showColumn: false,
  179. type: "date",
  180. format: "yyyy-MM-dd",
  181. valueFormat: "yyyy-MM-dd",
  182. }, {
  183. label: '出库结束',
  184. prop: 'dateEnd',
  185. overHidden: true,
  186. search: true,
  187. hide: true,
  188. showColumn: false,
  189. type: "date",
  190. format: "yyyy-MM-dd",
  191. valueFormat: "yyyy-MM-dd",
  192. },
  193. {
  194. label: "类型",
  195. prop: "type",
  196. type: 'select',
  197. dicData: [{
  198. label: '自有',
  199. value: 0
  200. }, {
  201. label: '融资',
  202. value: 1
  203. }],
  204. search: true,
  205. searchValue: 1,
  206. showColumn: false,
  207. hide: true,
  208. }
  209. ],
  210. },
  211. };
  212. },
  213. async created() {
  214. this.option = await this.getColumnData(this.getColumnName(422), this.defaultOption);
  215. },
  216. methods: {
  217. cellStyle() {
  218. return "padding:0;height:40px;";
  219. },
  220. searchReset() {
  221. this.search = this.$options.data().search;
  222. this.onLoad(this.page);
  223. },
  224. //点击搜索按钮触发
  225. searchChange(params, done) {
  226. this.page.currentPage = 1;
  227. this.onLoad(this.page, params);
  228. done();
  229. },
  230. refreshChange() {
  231. this.onLoad(this.page, this.search);
  232. },
  233. currentChange(val) {
  234. this.page.currentPage = val;
  235. },
  236. sizeChange(val) {
  237. this.page.currentPage = 1;
  238. this.page.pageSize = val;
  239. },
  240. onLoad(page, params = {}) {
  241. let obj = {}
  242. obj = {
  243. ...Object.assign(params, this.query),
  244. }
  245. saleFinancingDetail(page.currentPage, page.pageSize, obj).then(res => {
  246. this.dataList = res.data.data.records;
  247. this.page.total = res.data.data.total;
  248. this.itemloading = true,
  249. saleFinancingDetailSum(obj).then(res => {
  250. this.commodityData = [res.data.data]
  251. }).finally(() => {
  252. this.itemloading = false;
  253. });
  254. }).finally(() => {
  255. this.loading = false;
  256. });
  257. },
  258. //自定义列保存
  259. async saveColumn(ref, option, optionBack, code) {
  260. /**
  261. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  262. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  263. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  264. */
  265. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  266. if (inSave) {
  267. this.$message.success("保存成功");
  268. //关闭窗口
  269. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  270. this.searchReset()
  271. }
  272. },
  273. //自定义列重置
  274. async resetColumn(ref, option, optionBack, code) {
  275. this[option] = this[optionBack];
  276. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  277. if (inSave) {
  278. this.$message.success("重置成功");
  279. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  280. this.searchReset()
  281. }
  282. },
  283. outExport() {
  284. let config = { params: { ...this.search } }
  285. if (config.params) {
  286. for (const propName of Object.keys(config.params)) {
  287. const value = config.params[propName];
  288. if (value !== null && typeof (value) !== "undefined") {
  289. if (value instanceof Array) {
  290. for (const key of Object.keys(value)) {
  291. let params = propName + '[' + key + ']';
  292. config.params[params] = value[key]
  293. }
  294. delete config.params[propName]
  295. }
  296. }
  297. }
  298. }
  299. const routeData = this.$router.resolve({
  300. path: '/api/blade-sales-part/statistics/saleFinancingDetailExport', //跳转目标窗口的地址
  301. query: {
  302. ...config.params, //括号内是要传递给新窗口的参数
  303. identification: this.url
  304. }
  305. })
  306. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  307. },
  308. }
  309. };
  310. </script>
  311. <style scoped>
  312. .page-crad ::v-deep .basic-container__card {
  313. height: 94.2vh;
  314. }
  315. ::v-deep .el-table__expanded-cell[class*="cell"] {
  316. padding: 0px;
  317. }
  318. .itemTable ::v-deep .el-table {
  319. width: 100%;
  320. }
  321. /deep/ .el-col-md-8 {
  322. width: 24.33333%;
  323. }
  324. </style>