stock_list.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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: 'scp.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. isExport: false
  80. }
  81. ]
  82. },
  83. // 列表请求函数
  84. getList(...p) {
  85. this.recordSelected = []
  86. return getStockListV2(...p)
  87. },
  88. // 列表导出函数
  89. exportList: exportStockListV2,
  90. // 表格列解析渲染数据更改
  91. columnParsing(item, defaultData) {
  92. return defaultData
  93. },
  94. // 监听勾选变化
  95. selectionChange(data) {
  96. this.recordSelected = data
  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"
  105. onClick={ () => {
  106. this.visible = true
  107. this.detailsId = row.id
  108. }}
  109. >
  110. 查看
  111. </el-button> */}
  112. </div>
  113. )
  114. }
  115. },
  116. handleClose() {
  117. this.addOff(() => {
  118. this.visible = false
  119. })()
  120. },
  121. // 获取仓库列表
  122. getWarehouseList() {
  123. getWarehouseList({
  124. pageNum: 1,
  125. pageSize: -1
  126. }).then(res => {
  127. this.warehouseList = res.data.records
  128. })
  129. },
  130. // 获取产品大类列表
  131. getCategoryList() {
  132. getCategoryList({
  133. pageNum: 1,
  134. pageSize: -1
  135. }).then(res => {
  136. this.typeList = res.data.records
  137. })
  138. },
  139. // 获取产品小类列表
  140. getSmallList() {
  141. getSmallList({ id: this.screenForm.type }).then(res => {
  142. this.smallList = res.data
  143. })
  144. }
  145. }
  146. }
  147. </script>
  148. <style lang="scss" scoped></style>