stock_list.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <template-page
  3. ref="pageRef"
  4. :get-list="getList"
  5. :export-list="exportList"
  6. :options-evens-group="optionsEvensGroup"
  7. :column-parsing="columnParsing"
  8. :no-use="true"
  9. :field-beans-hook="fieldBeansHook"
  10. />
  11. </template>
  12. <script>
  13. import TemplatePage from '@/components/template/template-page-1.vue'
  14. import import_mixin from '@/components/template/import_mixin.js'
  15. import add_callback_mixin from '@/components/template/add_callback_mixin.js'
  16. import { getStockListV2, getWarehouseList, exportStockListV2 } from '@/api/stock'
  17. import { getCategoryList, getSmallList } from '@/api/common'
  18. export default {
  19. components: { TemplatePage },
  20. mixins: [import_mixin, add_callback_mixin],
  21. data() {
  22. return {
  23. visible: false,
  24. // 事件组合
  25. optionsEvensGroup: [],
  26. // 表格属性
  27. tableAttributes: {
  28. // 启用勾选列
  29. selectColumn: true
  30. }, // 关闭新增弹窗
  31. // 表格事件
  32. tableEvents: {
  33. 'selection-change': this.selectionChange
  34. },
  35. recordSelected: [],
  36. currentPage: 1, // 当前页码
  37. pageSize: 10, // 每页数量
  38. listTotal: 0, // 列表总数
  39. dataList: null, // 列表数据
  40. listLoading: false, // 列表加载loading
  41. screenForm: {
  42. // 筛选表单数据
  43. warehouse: [],
  44. position: '',
  45. goodsName: '',
  46. goodsNum: '',
  47. goodsCode: '',
  48. model: '',
  49. type: '',
  50. categoryId: []
  51. },
  52. warehouseList: [],
  53. positionList: [],
  54. typeList: [],
  55. smallList: []
  56. }
  57. },
  58. methods: {
  59. fieldBeansHook(List) {
  60. return [
  61. ...List,
  62. {
  63. adminUserId: null,
  64. colName: 'correspond_id',
  65. enumMap: '{}',
  66. frontCode: 'STOCK_NO',
  67. hide: false,
  68. isCopy: false,
  69. isQuery: true,
  70. isShow: false,
  71. isTotal: false,
  72. jname: 'correspondId',
  73. label: '仓库名称',
  74. multiple: true,
  75. pk: false,
  76. sortNum: 0,
  77. tbName: '',
  78. type: 'select'
  79. }
  80. ]
  81. },
  82. // 列表请求函数
  83. getList(...p) {
  84. this.recordSelected = []
  85. return getStockListV2(...p)
  86. },
  87. // 列表导出函数
  88. exportList: exportStockListV2,
  89. // 表格列解析渲染数据更改
  90. columnParsing(item, defaultData) {
  91. return defaultData
  92. },
  93. // 监听勾选变化
  94. selectionChange(data) {
  95. this.recordSelected = data
  96. },
  97. operation() {
  98. return (h, { row, index, column }) => {
  99. return (
  100. <div class="operation-btns">
  101. {/* <el-button
  102. size="mini"
  103. type="text"
  104. onClick={ () => {
  105. this.visible = true
  106. this.detailsId = row.id
  107. }}
  108. >
  109. 查看
  110. </el-button> */}
  111. </div>
  112. )
  113. }
  114. },
  115. handleClose() {
  116. this.addOff(() => {
  117. this.visible = false
  118. })()
  119. },
  120. // 获取仓库列表
  121. getWarehouseList() {
  122. getWarehouseList({
  123. pageNum: 1,
  124. pageSize: -1
  125. }).then(res => {
  126. this.warehouseList = res.data.records
  127. })
  128. },
  129. // 获取产品大类列表
  130. getCategoryList() {
  131. getCategoryList({
  132. pageNum: 1,
  133. pageSize: -1
  134. }).then(res => {
  135. this.typeList = res.data.records
  136. })
  137. },
  138. // 获取产品小类列表
  139. getSmallList() {
  140. getSmallList({ id: this.screenForm.type }).then(res => {
  141. this.smallList = res.data
  142. })
  143. }
  144. }
  145. }
  146. </script>
  147. <style lang="scss" scoped></style>