index.vue 7.9 KB

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