detail.vue 3.7 KB

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