adjust_warehouse.vue 5.0 KB

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