detail.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <basic-container>
  3. <avue-crud
  4. ref="crud"
  5. :data="dataList"
  6. :option="option"
  7. v-model="form"
  8. :search.sync="search"
  9. :table-loading="loading"
  10. @saveColumn="saveColumn"
  11. @resetColumn="resetColumn"
  12. @search-change="searchChange"
  13. @current-change="currentChange"
  14. @size-change="sizeChange"
  15. @refresh-change="refreshChange"
  16. @on-load="onLoad"
  17. >
  18. <template slot="orderNo" slot-scope="{ row, index }">
  19. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(row, index)">{{ row.orderNo }}</span>
  20. </template>
  21. </avue-crud>
  22. </basic-container>
  23. </template>
  24. <script>
  25. import option from "./config/detail.json";
  26. import {selectStockInventory} from "@/api/basicData/inventoryAccount";
  27. export default {
  28. name: "detail",
  29. data() {
  30. return {
  31. option: {},
  32. dataList: [],
  33. form: {},
  34. page: {
  35. pageSize: 10,
  36. pagerCount: 5,
  37. total: 0,
  38. },
  39. search: {},
  40. loading: false,
  41. params: null,
  42. }
  43. },
  44. async created() {
  45. // this.option = option
  46. console.log('打开了');
  47. this.option = await this.getColumnData(this.getColumnName(67), option);
  48. this.$store.commit("DOMAS_IN_DETAIL");
  49. },
  50. activated() {
  51. this.$store.commit("DOMAS_IN_DETAIL");
  52. this.params = {
  53. goodsId: this.$route.query.goodsId,
  54. stockId:this.$route.query.stockId
  55. }
  56. this.onLoad(this.page)
  57. },
  58. methods: {
  59. onLoad(page, params) {
  60. if (!this.params) return
  61. params = {...params, ...this.params}
  62. this.dataList.forEach(item => {
  63. this.$refs.crud.toggleRowExpansion(item, false)
  64. })
  65. this.loading = true;
  66. selectStockInventory(params)
  67. .then(res => {
  68. console.log('res',res);
  69. this.dataList = res.data.data? res.data.data : [];
  70. this.page.total = res.data.data.total;
  71. if (this.page.total) {
  72. this.option.height = window.innerHeight - 260;
  73. }
  74. })
  75. .finally(() => {
  76. this.loading = false;
  77. });
  78. },
  79. searchChange(params, done) {
  80. this.onLoad(this.page, params);
  81. done();
  82. },
  83. currentChange(val) {
  84. this.page.currentPage = val;
  85. },
  86. sizeChange(val) {
  87. this.page.currentPage = 1;
  88. this.page.pageSize = val;
  89. },
  90. refreshChange() {
  91. this.dataList.forEach(item => {
  92. this.$refs.crud.toggleRowExpansion(item, false)
  93. })
  94. this.page.currentPage = 1;
  95. this.onLoad(this.page, this.search);
  96. },
  97. async saveColumn() {
  98. const inSave = await this.saveColumnData(
  99. this.getColumnName(67),
  100. this.option
  101. );
  102. if (inSave) {
  103. this.$message.success("保存成功");
  104. //关闭窗口
  105. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  106. }
  107. },
  108. async resetColumn() {
  109. this.option = option;
  110. const inSave = await this.delColumnData(
  111. this.getColumnName(67),
  112. option
  113. );
  114. if (inSave) {
  115. this.$message.success("重置成功");
  116. //关闭窗口
  117. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  118. }
  119. },
  120. // 跳转
  121. beforeOpenPage(row,index) {
  122. if (this.$store.getters.domSaleStatus) {
  123. this.$alert("销售单存在,请保存关闭销售单再进行操作", "温馨提示", {
  124. confirmButtonText: "确定",
  125. type: "warning",
  126. callback: action => {
  127. console.log(action);
  128. }
  129. });
  130. } else {
  131. this.$router.$avueRouter.closeTag("/businessManagement/salesOrder/index");
  132. this.$router.push({
  133. path: "/businessManagement/salesOrder/index",
  134. query: {
  135. id: row.id
  136. },
  137. });
  138. }
  139. },
  140. },
  141. }
  142. </script>
  143. <style scoped>
  144. </style>