index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <div>
  3. <basic-container v-show="isShow" class="page-crad">
  4. <avue-crud
  5. ref="crud"
  6. :option="option"
  7. :data="dataList"
  8. :before-open="beforeOpen"
  9. :page.sync="page"
  10. :search.sync="search"
  11. @search-change="searchChange"
  12. @current-change="currentChange"
  13. @size-change="sizeChange"
  14. @refresh-change="refreshChange"
  15. @on-load="onLoad"
  16. :table-loading="loading"
  17. @saveColumn="saveColumn"
  18. @resetColumn="resetColumn"
  19. :cell-style="cellStyle"
  20. >
  21. <template slot="corpIdSearch">
  22. <crop-select v-model="search.corpId" corpType="KH"></crop-select>
  23. </template>
  24. <template slot="businesDateSearch">
  25. <el-date-picker
  26. v-model="search.businesDate"
  27. type="daterange"
  28. start-placeholder="开始日期"
  29. end-placeholder="结束日期"
  30. format="yyyy-MM-dd"
  31. value-format="yyyy-MM-dd HH:mm:ss"
  32. :default-time="['00:00:00', '23:59:59']"
  33. >
  34. </el-date-picker>
  35. </template>
  36. <!-- <template slot-scope="{ row }" slot="corpId">
  37. <span>{{ row.corpsName }}</span>
  38. </template> -->
  39. </avue-crud>
  40. </basic-container>
  41. </div>
  42. </template>
  43. <script>
  44. import { getList } from "@/api/statisticAnalysis/salesProfit";
  45. export default {
  46. name: "index",
  47. data() {
  48. return {
  49. form: {},
  50. search: {},
  51. dataList: [],
  52. loading: false,
  53. isShow: true,
  54. detailData: {},
  55. page: {
  56. pageSize: 10,
  57. currentPage: 1
  58. },
  59. option: {
  60. searchShow: true,
  61. searchMenuSpan: 24,
  62. align: "center",
  63. searchSpan: 8,
  64. border: true,
  65. index: true,
  66. addBtn: false,
  67. viewBtn: false,
  68. editBtn: false,
  69. delBtn: false,
  70. menuWidth: 120,
  71. searchLabelWidth: 100,
  72. searchIcon: true,
  73. searchIndex: 2,
  74. menu: false,
  75. column: [
  76. {
  77. label: "合同号",
  78. prop: "orderNo",
  79. overHidden: true,
  80. width: 100,
  81. search: true
  82. },
  83. {
  84. label: "客户名称",
  85. prop: "corpId",
  86. overHidden: true,
  87. width: 100,
  88. search: true,
  89. formatter: row => {
  90. return row.corpsName;
  91. }
  92. },
  93. {
  94. label: "合同日期",
  95. prop: "businesDate",
  96. type: "date",
  97. format: "yyyy-MM-dd",
  98. overHidden: true,
  99. search: true,
  100. width: 100
  101. },
  102. {
  103. label: "起运港",
  104. prop: "portOfLoad",
  105. overHidden: true,
  106. width: 100
  107. },
  108. {
  109. label: "目的港",
  110. prop: "portOfDestination",
  111. overHidden: true,
  112. width: 100
  113. },
  114. {
  115. label: "运输条款",
  116. prop: "transport",
  117. overHidden: true,
  118. width: 100
  119. },
  120. {
  121. label: "采购报价",
  122. prop: "purchasePrice",
  123. overHidden: true,
  124. width: 100
  125. },
  126. {
  127. label: "销售金额",
  128. prop: "amount",
  129. overHidden: true,
  130. width: 100
  131. },
  132. {
  133. label: "产品毛利",
  134. prop: "grossProfit",
  135. overHidden: true,
  136. width: 100
  137. },
  138. {
  139. label: "产品利率",
  140. prop: "grossProfitRate",
  141. overHidden: true,
  142. width: 100
  143. },
  144. {
  145. label: "单票利润",
  146. prop: "singleTicketMargin",
  147. overHidden: true,
  148. width: 100
  149. }
  150. ]
  151. }
  152. };
  153. },
  154. methods: {
  155. cellStyle() {
  156. return "padding:0;height:40px;";
  157. },
  158. //点击搜索按钮触发
  159. searchChange(params, done) {
  160. if (params.businesDate) {
  161. params.contractStartDate = params.businesDate[0];
  162. params.contractEndDate = params.businesDate[1];
  163. }
  164. delete params.businesDate;
  165. this.page.currentPage = 1;
  166. this.onLoad(this.page, params);
  167. done();
  168. },
  169. refreshChange() {
  170. this.onLoad(this.page, this.search);
  171. },
  172. currentChange(val) {
  173. this.page.currentPage = val;
  174. },
  175. sizeChange(val) {
  176. this.page.currentPage = 1;
  177. this.page.pageSize = val;
  178. },
  179. onLoad(page, params) {
  180. this.loading = true;
  181. getList(page.currentPage, page.pageSize, params)
  182. .then(res => {
  183. this.dataList = res.data.data.records ? res.data.data.records : [];
  184. this.page.total = res.data.data.total;
  185. if (this.page.total) {
  186. this.option.height = window.innerHeight - 260;
  187. }
  188. })
  189. .finally(() => {
  190. this.loading = false;
  191. });
  192. },
  193. //新增跳转页面
  194. beforeOpen() {
  195. this.isShow = false;
  196. },
  197. editOpen(row, status) {
  198. this.detailData = {
  199. id: row.id,
  200. status: status
  201. };
  202. this.isShow = false;
  203. },
  204. goBack() {
  205. this.detailData = this.$options.data().detailData;
  206. this.isShow = true;
  207. }
  208. }
  209. };
  210. </script>
  211. <style scoped>
  212. .page-crad ::v-deep .basic-container__card {
  213. height: 94.2vh;
  214. }
  215. </style>