index.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <div>
  3. <basic-container class="page-crad">
  4. <avue-crud
  5. ref="crud"
  6. :option="option"
  7. :data="dataList"
  8. :page.sync="page"
  9. :search.sync="search"
  10. :cell-style="cellStyle"
  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. @search-criteria-switch="searchCriteriaSwitch"
  20. >
  21. <template slot="menuLeft">
  22. <el-button type="info" size="small" @click="outExport" icon="el-icon-download">导出</el-button>
  23. </template>
  24. <template slot="corpNameSearch">
  25. <crop-select v-model="search.corpId" corpType="KH"></crop-select>
  26. </template>
  27. <template slot="storageNameSearch">
  28. <warehouse-select
  29. v-model="search.storageId"
  30. :configuration="configurationWarehouse"/>
  31. </template>
  32. </avue-crud>
  33. </basic-container>
  34. </div>
  35. </template>
  36. <script>
  37. import { getToken } from "@/util/auth";
  38. import { getList, exportExcel } from "@/api/statisticAnalysis/salesReconciliation";
  39. import { micrometerFormat } from "@/util/validate";
  40. import _ from "lodash";
  41. import option from "../../businessManagement/salesOrder/configuration/mainList.json";
  42. export default {
  43. name: "index",
  44. data() {
  45. return {
  46. form: {},
  47. search: {},
  48. dataList: [],
  49. loading: false,
  50. detailData: {},
  51. page: {
  52. pageSize: 20,
  53. currentPage: 1,
  54. total: 0,
  55. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  56. },
  57. option: {},
  58. defaultOption: {
  59. searchShow: true,
  60. align: "center",
  61. searchSpan: 8,
  62. border: true,
  63. index: true,
  64. addBtn: false,
  65. viewBtn: false,
  66. editBtn: false,
  67. delBtn: false,
  68. showSummary: true,
  69. searchIcon: true,
  70. searchIndex: 2,
  71. menu: false,
  72. column: [
  73. {
  74. label: "客户名称",
  75. prop: "corpName",
  76. search: true,
  77. overHidden: true,
  78. },
  79. {
  80. label: "制单日期",
  81. prop: "businesDate",
  82. search: true,
  83. type: 'date',
  84. format: "yyyy-MM-dd",
  85. valueFormat: "yyyy-MM-dd",
  86. unlinkPanels: true,
  87. searchRange: true,
  88. overHidden: true,
  89. },
  90. {
  91. label: "商品名称",
  92. prop: "goodName",
  93. search: false,
  94. overHidden: true,
  95. },
  96. {
  97. label: "规格",
  98. prop: "typeno",
  99. search: false,
  100. overHidden: true,
  101. },
  102. {
  103. label: "级别",
  104. prop: "level",
  105. search: false,
  106. overHidden: true,
  107. },
  108. {
  109. label: "花纹",
  110. prop: "brandItem",
  111. search: false,
  112. overHidden: true,
  113. },
  114. {
  115. label: "批号",
  116. prop: "lotNo",
  117. search: false,
  118. overHidden: true,
  119. },
  120. {
  121. label: "销售数量",
  122. prop: "orderQuantity",
  123. search: false,
  124. overHidden: true,
  125. },
  126. {
  127. label: "单价",
  128. prop: "price",
  129. search: false,
  130. overHidden: true,
  131. },
  132. {
  133. label: "应收金额",
  134. prop: "debitAmount",
  135. search: false,
  136. overHidden: true,
  137. },
  138. {
  139. label: "仓库名称",
  140. prop: "storageName", //storageId
  141. search: true,
  142. overHidden: true,
  143. },
  144. {
  145. label: "备注",
  146. prop: "remarks",
  147. search: false,
  148. overHidden: true,
  149. },
  150. ],
  151. },
  152. // 仓库配置
  153. configurationWarehouse: {
  154. multipleChoices: false,
  155. multiple: false,
  156. collapseTags: false,
  157. placeholder: "请点击右边按钮选择",
  158. dicData: [],
  159. },
  160. };
  161. },
  162. filters: {
  163. decimalFormat(num) {
  164. return num ? Number(num).toFixed(2) : "0.00";
  165. }
  166. },
  167. async created() {
  168. this.option = await this.getColumnData(this.getColumnName(126), this.defaultOption);
  169. let i = 0;
  170. this.option.column.forEach(item => {
  171. if (item.search) i++
  172. })
  173. if (i % 3 !== 0){
  174. const num = 3 - Number(i % 3)
  175. this.option.searchMenuSpan = num * 8;
  176. this.option.searchMenuPosition = "right";
  177. }
  178. },
  179. methods: {
  180. cellStyle() {
  181. return "padding:0;height:40px;";
  182. },
  183. searchCriteriaSwitch(type) {
  184. if (type) {
  185. this.option.height = this.option.height - 46;
  186. } else {
  187. this.option.height = this.option.height + 46;
  188. }
  189. this.$refs.crud.getTableHeight();
  190. },
  191. //点击搜索按钮触发
  192. searchChange(params, done) {
  193. this.page.currentPage = 1;
  194. this.onLoad(this.page, params);
  195. done();
  196. },
  197. refreshChange() {
  198. delete this.search.corpName;
  199. delete this.search.storageName
  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. this.loading = true;
  211. this.dataList.forEach(item => {
  212. this.$refs.crud.toggleRowExpansion(item, false);
  213. });
  214. let queryParams = Object.assign({}, params);
  215. if (queryParams.businesDate && queryParams.businesDate.length > 0) {
  216. queryParams = {
  217. ...queryParams,
  218. orderStartDate: queryParams.businesDate[0] + ' 00:00:00',
  219. orderEndDate: queryParams.businesDate[1] + ' 23:59:59',
  220. }
  221. delete queryParams.businesDate;
  222. }
  223. getList(
  224. page.currentPage,
  225. page.pageSize,
  226. queryParams
  227. )
  228. .then(res => {
  229. if (res.data.data.records) {
  230. res.data.data.records.forEach(e => {
  231. e.itemLoading = true;
  232. });
  233. }
  234. this.dataList = res.data.data.records ? res.data.data.records : [];
  235. this.page.total = res.data.data.total;
  236. if (this.page.total) {
  237. this.option.height = window.innerHeight - 210;
  238. }
  239. })
  240. .finally(() => {
  241. this.loading = false;
  242. });
  243. },
  244. editOpen(row) {
  245. if (row.billType == "BJ") {
  246. this.$router.push({
  247. path: "/exportTrade/customerInquiry/index",
  248. query: {
  249. id: row.id
  250. }
  251. });
  252. } else {
  253. this.$router.push({
  254. path: "/exportTrade/salesContract/index",
  255. query: {
  256. id: row.id
  257. }
  258. });
  259. }
  260. },
  261. outExport() {
  262. if (!this.search.corpId) this.$set(this.search, 'corpId', '');
  263. if (!this.search.storageId) this.$set(this.search, 'storageId', '');
  264. if (this.search.businesDate && this.search.businesDate.length > 0) {
  265. this.search = {
  266. ...this.search,
  267. orderStartDate: this.search.businesDate[0] + ' 00:00:00',
  268. orderEndDate: this.search.businesDate[1] + ' 23:59:59',
  269. }
  270. } else {
  271. this.search = {
  272. ...this.search,
  273. orderStartDate: '',
  274. orderEndDate: '',
  275. }
  276. }
  277. // return console.log(this.search)
  278. this.$confirm('是否导出销售对账信息?', '提示', {
  279. confirmButtonText: '确定',
  280. cancelButtonText: '取消',
  281. type: 'warning'
  282. }).then(() => {
  283. window.open(
  284. `/api/blade-purchase-sales/dealerOrder/orderItemStat/export?${
  285. this.website.tokenHeader
  286. }=${getToken()}&corpId=${this.search.corpId}&storageId=${this.search.storageId}&orderStartDate=${this.search.orderStartDate}&orderEndDate=${this.search.orderEndDate}`
  287. );
  288. }).catch(() => {
  289. this.$message({
  290. type: 'info',
  291. message: '已取消' //
  292. });
  293. })
  294. },
  295. //列保存触发
  296. async saveColumn() {
  297. const inSave = await this.saveColumnData(
  298. this.getColumnName(126),
  299. this.option
  300. );
  301. if (inSave) {
  302. this.$nextTick(() => {
  303. this.$refs.crud.doLayout();
  304. });
  305. this.$message.success("保存成功");
  306. //关闭窗口
  307. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  308. }
  309. },
  310. async resetColumn() {
  311. this.option = this.defaultOption;
  312. const inSave = await this.delColumnData(this.getColumnName(126), this.defaultOption);
  313. if (inSave) {
  314. this.$nextTick(() => {
  315. this.$refs.crud.doLayout()
  316. })
  317. this.$message.success("重置成功");
  318. //关闭窗口
  319. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  320. }
  321. },
  322. }
  323. };
  324. </script>
  325. <style scoped>
  326. .page-crad ::v-deep .basic-container__card {
  327. height: 94.2vh;
  328. }
  329. ::v-deep .el-table__expanded-cell[class*="cell"] {
  330. padding: 0px;
  331. }
  332. .itemTable ::v-deep .el-table {
  333. width: 100%;
  334. }
  335. </style>