index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  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" icon="el-icon-printer" size="small" :loading="exportLoading" @click.stop="statement">
  10. 报表打印
  11. </el-button> -->
  12. <el-button type="info" size="small" @click="outExport" icon="el-icon-download">导出</el-button>
  13. </template>
  14. <template slot="brandSearch">
  15. <el-select v-model="search.brand" filterable clearable>
  16. <el-option v-for="(item, index) in brandOption" :key="index" :label="item.dictValue"
  17. :value="item.dictValue" />
  18. </el-select>
  19. </template>
  20. </avue-crud>
  21. </basic-container>
  22. <report-dialog :switchDialog="switchDialog" :searchValue="statementData" :reportName="'经销商-可用库存表'"
  23. @onClose="onClose()" />
  24. </div>
  25. </template>
  26. <script>
  27. import { getToken } from "@/util/auth";
  28. import { getList } from "@/api/statisticAnalysis/purchaseReconciliation";
  29. import { micrometerFormat } from "@/util/validate";
  30. import _ from "lodash";
  31. import reportDialog from "@/components/report-dialog/main";
  32. export default {
  33. name: "index",
  34. components: {
  35. reportDialog
  36. },
  37. data() {
  38. return {
  39. exportLoading: false,
  40. switchDialog: false,
  41. statementData: {},
  42. form: {},
  43. search: {},
  44. dataList: [],
  45. loading: false,
  46. detailData: {},
  47. page: {
  48. pageSize: 20,
  49. currentPage: 1,
  50. total: 0,
  51. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  52. },
  53. option: {},
  54. defaultOption: {
  55. searchShow: true,
  56. align: "center",
  57. searchSpan: 8,
  58. searchMenuSpan: 8,
  59. border: true,
  60. index: true,
  61. addBtn: false,
  62. viewBtn: false,
  63. editBtn: false,
  64. delBtn: false,
  65. showSummary: true,
  66. searchIcon: true,
  67. searchIndex: 2,
  68. menu: false,
  69. column: [
  70. {
  71. label: "采购单号",
  72. prop: "orderNo",
  73. search: false,
  74. overHidden: true,
  75. },
  76. {
  77. label: "来源销售单号",
  78. prop: "orgOrderNo",
  79. search: false,
  80. overHidden: true,
  81. },
  82. {
  83. label: "品牌",
  84. prop: "brand",
  85. search: true,
  86. overHidden: true,
  87. },
  88. {
  89. label: "制单日期",
  90. prop: "careteTime",
  91. search: true,
  92. type: 'date',
  93. format: "yyyy-MM-dd",
  94. valueFormat: "yyyy-MM-dd",
  95. unlinkPanels: true,
  96. searchRange: true,
  97. overHidden: true,
  98. },
  99. {
  100. label: "数量",
  101. prop: "quantity",
  102. search: false,
  103. overHidden: true,
  104. },
  105. {
  106. label: "采购金额",
  107. prop: "orderAmount",
  108. search: false,
  109. overHidden: true,
  110. },
  111. {
  112. label: "已付金额",
  113. prop: "settlmentAmount",
  114. search: false,
  115. overHidden: true,
  116. },
  117. ],
  118. },
  119. // 仓库配置
  120. configurationWarehouse: {
  121. multipleChoices: false,
  122. multiple: false,
  123. collapseTags: false,
  124. placeholder: "请点击右边按钮选择",
  125. dicData: [],
  126. },
  127. brandOption: [],
  128. };
  129. },
  130. filters: {
  131. decimalFormat(num) {
  132. return num ? Number(num).toFixed(2) : "0.00";
  133. }
  134. },
  135. async created() {
  136. this.option = await this.getColumnData(this.getColumnName(128), this.defaultOption);
  137. this.getWorkDicts('brand').then(res => {
  138. this.brandOption = res.data.data;
  139. })
  140. },
  141. methods: {
  142. cellStyle() {
  143. return "padding:0;height:40px;";
  144. },
  145. searchCriteriaSwitch(type) {
  146. if (type) {
  147. this.option.height = this.option.height - 46;
  148. } else {
  149. this.option.height = this.option.height + 46;
  150. }
  151. this.$refs.crud.getTableHeight();
  152. },
  153. //点击搜索按钮触发
  154. searchChange(params, done) {
  155. this.page.currentPage = 1;
  156. this.onLoad(this.page, params);
  157. done();
  158. },
  159. outExport() {
  160. let params = { ...this.search }
  161. if (!params.brand) this.$set(params, 'brand', '');
  162. if (params.careteTime && params.careteTime.length > 0) {
  163. params = {
  164. ...params,
  165. beginCreateTime: params.careteTime[0] + ' 00:00:00',
  166. endCreateTime: params.careteTime[1] + ' 23:59:59',
  167. }
  168. } else {
  169. params = {
  170. ...params,
  171. beginCreateTime: '',
  172. endCreateTime: '',
  173. }
  174. }
  175. console.log(params)
  176. this.$confirm('是否导出数据明细?', '提示', {
  177. confirmButtonText: '确定',
  178. cancelButtonText: '取消',
  179. type: 'warning'
  180. }).then(() => {
  181. window.open(
  182. `/api/blade-purchase-sales/exportOrder/selPurchaseExport?${this.website.tokenHeader
  183. }=${getToken()}&brand=${params.brand}&beginCreateTime=${params.beginCreateTime}&endCreateTime=${params.endCreateTime}`
  184. );
  185. }).catch(() => {
  186. this.$message({
  187. type: 'info',
  188. message: '已取消' //
  189. });
  190. })
  191. },
  192. refreshChange() {
  193. delete this.search.corpName;
  194. delete this.search.storageName
  195. this.onLoad(this.page, this.search);
  196. },
  197. currentChange(val) {
  198. this.page.currentPage = val;
  199. },
  200. sizeChange(val) {
  201. this.page.currentPage = 1;
  202. this.page.pageSize = val;
  203. },
  204. onLoad(page, params) {
  205. console.log(this.search, params)
  206. if (this.search.careteTime && this.search.careteTime.length > 0) {
  207. params = {
  208. ...params,
  209. beginCreateTime: this.search.careteTime[0],
  210. endCreateTime: this.search.careteTime[1]
  211. };
  212. }
  213. let queryParams = this.deepClone(Object.assign({}, params, this.search));
  214. delete queryParams.careteTime;
  215. this.loading = true;
  216. getList(
  217. page.currentPage,
  218. page.pageSize,
  219. queryParams
  220. )
  221. .then(res => {
  222. this.dataList = res.data.data.records ? res.data.data.records : [];
  223. this.page.total = res.data.data.total;
  224. if (this.page.total) {
  225. this.option.height = window.innerHeight - 210;
  226. }
  227. })
  228. .finally(() => {
  229. this.loading = false;
  230. });
  231. },
  232. editOpen(row) {
  233. if (row.billType == "BJ") {
  234. this.$router.push({
  235. path: "/exportTrade/customerInquiry/index",
  236. query: {
  237. id: row.id
  238. }
  239. });
  240. } else {
  241. this.$router.push({
  242. path: "/exportTrade/salesContract/index",
  243. query: {
  244. id: row.id
  245. }
  246. });
  247. }
  248. },
  249. statement() {
  250. this.statementData = { ...this.search };
  251. if (this.statementData.careteTime && this.statementData.careteTime.length > 0) {
  252. this.statementData.createStartTime = this.statementData.careteTime[0] + " " + "00:00:00"
  253. this.statementData.createEndTime = this.statementData.careteTime[1] + " " + "23:59:59"
  254. delete this.statementData.careteTime
  255. }
  256. this.switchDialog = !this.switchDialog;
  257. },
  258. onClose(val) {
  259. this.switchDialog = val;
  260. },
  261. //列保存触发
  262. async saveColumn() {
  263. const inSave = await this.saveColumnData(
  264. this.getColumnName(128),
  265. this.option
  266. );
  267. if (inSave) {
  268. this.$nextTick(() => {
  269. this.$refs.crud.doLayout();
  270. });
  271. this.$message.success("保存成功");
  272. //关闭窗口
  273. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  274. }
  275. },
  276. async resetColumn() {
  277. this.option = this.defaultOption;
  278. const inSave = await this.delColumnData(this.getColumnName(128), this.defaultOption);
  279. if (inSave) {
  280. this.$nextTick(() => {
  281. this.$refs.crud.doLayout()
  282. })
  283. this.$message.success("重置成功");
  284. //关闭窗口
  285. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  286. }
  287. },
  288. }
  289. };
  290. </script>
  291. <style scoped>
  292. .page-crad ::v-deep .basic-container__card {
  293. height: 94.2vh;
  294. }
  295. ::v-deep .el-table__expanded-cell[class*="cell"] {
  296. padding: 0px;
  297. }
  298. .itemTable ::v-deep .el-table {
  299. width: 100%;
  300. }
  301. </style>