index.vue 8.0 KB

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