index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
  3. :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
  4. :exportList="exportList">
  5. </template-page>
  6. </template>
  7. <script>
  8. import TemplatePage from '@/components/template/template-page-1.vue'
  9. import import_mixin from '@/components/template/import_mixin.js'
  10. import { workerStockList, workerStockListExport, workerStockImportM, } from "@/api/inventoryManagement";
  11. import { commonTemplateDownload } from '@/api/common.js'
  12. export default {
  13. components: { TemplatePage },
  14. mixins: [import_mixin],
  15. data() {
  16. return {
  17. // 事件组合
  18. optionsEvensGroup: [
  19. [
  20. [
  21. {
  22. name: '辅材网点库存模板',
  23. click: () => {
  24. commonTemplateDownload({ name: '辅材网点库存.xlsx' }, `${this.$route.meta.title}`)
  25. .then(res => {
  26. this.$message({
  27. message: '下载成功',
  28. type: 'success'
  29. })
  30. })
  31. .catch(err => {
  32. this.$message.error('下载失败')
  33. })
  34. }
  35. }
  36. ],
  37. [
  38. {
  39. name: '导入模板',
  40. render: () => {
  41. return this.importButton(workerStockImportM, '导入模板')
  42. }
  43. }
  44. ],
  45. ],
  46. ],
  47. // 表格属性
  48. tableAttributes: {
  49. // 启用勾选列
  50. selectColumn: false
  51. },
  52. // 表格事件
  53. tableEvents: {
  54. 'selection-change': this.selectionChange
  55. },
  56. // 勾选选中行
  57. recordSelected: [],
  58. }
  59. },
  60. computed: {
  61. // 更多参数
  62. moreParameters() {
  63. return []
  64. },
  65. },
  66. methods: {
  67. // 列表请求函数
  68. getList: workerStockList,
  69. // 列表导出函数
  70. exportList: workerStockListExport,
  71. // 表格列解析渲染数据更改
  72. columnParsing(item, defaultData) {
  73. return defaultData
  74. },
  75. // 监听勾选变化
  76. selectionChange(data) {
  77. this.recordSelected = data
  78. },
  79. // 表格操作列
  80. operation(h, { row, index, column }) {
  81. return (
  82. <div class='operation-btns'></div>
  83. )
  84. },
  85. }
  86. }
  87. </script>
  88. <style lang="scss" scoped></style>