adjust_warehouse.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <div>
  3. <template-page
  4. v-if="!pageType"
  5. style="width: 100%;
  6. height: 100%;"
  7. ref="pageRef"
  8. :getList="getList"
  9. :exportList="exportList"
  10. :operation="operation()"
  11. :columnParsing="columnParsing"
  12. :optionsEvensGroup="optionsEvensGroup"
  13. >
  14. </template-page>
  15. <warehouse-form v-else-if="pageType==1" />
  16. <warehouse-examine v-else-if="pageType==2" :detailsId="detailsId" />
  17. <warehouse-details v-else :detailsId="detailsId" />
  18. </div>
  19. </template>
  20. <script>
  21. import TemplatePage from '@/components/template/template-page-1.vue'
  22. import import_mixin from '@/components/template/import_mixin.js'
  23. import { getFrontListCustomerAcc, exportCustomerStockOrderBean, deleteCustomerStockOrder } from '@/api/stock'
  24. import WarehouseForm from '@/views/sales_control/components/WarehouseForm'
  25. import WarehouseExamine from '@/views/sales_control/components/WarehouseExamine'
  26. import WarehouseDetails from '@/views/sales_control/components/WarehouseDetails'
  27. export default {
  28. components: { TemplatePage, WarehouseForm, WarehouseExamine, WarehouseDetails },
  29. mixins: [import_mixin],
  30. data() {
  31. return {
  32. // 事件组合
  33. optionsEvensGroup: [
  34. [
  35. [
  36. {
  37. name: '库存调整',
  38. click: this.addWarehouse
  39. }
  40. ]
  41. ]
  42. ],
  43. // 表格属性
  44. tableAttributes: {
  45. // 启用勾选列
  46. selectColumn: true
  47. },
  48. // 表格事件
  49. tableEvents: {
  50. 'selection-change': this.selectionChange
  51. },
  52. recordSelected: [],
  53. detailsId: '',
  54. pageType: 0
  55. }
  56. },
  57. methods: {
  58. // 列表请求函数
  59. getList(...p) {
  60. this.recordSelected = []
  61. return getFrontListCustomerAcc(...p)
  62. },
  63. // 列表导出函数
  64. exportList: exportCustomerStockOrderBean,
  65. // 表格列解析渲染数据更改
  66. columnParsing(item, defaultData) {
  67. return defaultData
  68. },
  69. // 监听勾选变化
  70. selectionChange(data) {
  71. this.recordSelected = data
  72. },
  73. addWarehouse() {
  74. this.pageType = 1
  75. console.log(this.pageType, '333')
  76. },
  77. operation() {
  78. return (h, { row, index, column }) => {
  79. return (
  80. <div class="operation-btns">
  81. <el-button
  82. size="mini"
  83. type="text" onClick={() => {
  84. this.detailsId = row.id
  85. this.pageType = 3
  86. }}
  87. >
  88. 查看
  89. </el-button>
  90. {row.examineStatus != 'OK' ? (
  91. <el-button
  92. size="mini"
  93. type="text" onClick={() => {
  94. this.detailsId = row.id
  95. this.pageType = 2
  96. }}
  97. >
  98. 审批
  99. </el-button>
  100. ) : null}
  101. <el-popconfirm
  102. onOnConfirm={() => {
  103. deleteCustomerStockOrder({ id: row.id }).then(res => {
  104. this.$successMsg('删除成功')
  105. this.$refs.pageRef.refreshList()
  106. })
  107. }}
  108. title="删除吗?"
  109. >
  110. <el-button slot="reference" size="mini" type="text">删除</el-button>
  111. </el-popconfirm>
  112. </div>
  113. )
  114. }
  115. }
  116. // 批量删除
  117. // dels() {
  118. // if (this.recordSelected.length) {
  119. // this.$confirm('此操作将删除数据, 是否继续?', '提示', {
  120. // confirmButtonText: '确定',
  121. // cancelButtonText: '取消',
  122. // type: 'warning'
  123. // })
  124. // .then(() => {
  125. // partsOldOutDel({
  126. // ids: this.recordSelected.map(item => item.id).join(',')
  127. // })
  128. // .then(res => {
  129. // this.$refs.pageRef.refreshList()
  130. // this.$message({
  131. // type: 'success',
  132. // message: '删除成功!'
  133. // })
  134. // })
  135. // .catch(() => {
  136. // this.$message({
  137. // type: 'error',
  138. // message: '删除失败'
  139. // })
  140. // })
  141. // })
  142. // .catch(() => {
  143. // this.$message({
  144. // type: 'info',
  145. // message: '已取消删除'
  146. // })
  147. // })
  148. // } else {
  149. // this.$message({
  150. // type: 'info',
  151. // message: '请先勾选需要删除的数据!'
  152. // })
  153. // }
  154. // }
  155. }
  156. }
  157. </script>
  158. <style lang="scss" scoped>
  159. ::v-deep .el-table__body-wrapper {
  160. height: 100% !important;
  161. }
  162. </style>