index.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 { workerStockListP, workerStockListPExport, workerStockImportP, } from "@/api/inventoryManagement";
  11. import { commonTemplateDownload } from '@/api/common.js'
  12. import operation_mixin from '@/components/template/operation_mixin.js'
  13. export default {
  14. components: { TemplatePage },
  15. mixins: [import_mixin, operation_mixin],
  16. data() {
  17. return {
  18. // 表格属性
  19. tableAttributes: {
  20. // 启用勾选列
  21. selectColumn: false
  22. },
  23. // 表格事件
  24. tableEvents: {
  25. 'selection-change': this.selectionChange
  26. },
  27. // 勾选选中行
  28. recordSelected: [],
  29. }
  30. },
  31. computed: {
  32. // 事件组合
  33. optionsEvensGroup() {
  34. return [
  35. [
  36. [
  37. this.optionsEvensAuth("template", {
  38. click: () => {
  39. commonTemplateDownload({ name: '配件师傅库存.xlsx' }, `${this.$route.meta.title}`)
  40. .then(res => {
  41. this.$message({
  42. message: '下载成功',
  43. type: 'success'
  44. })
  45. })
  46. .catch(err => {
  47. this.$message.error('下载失败')
  48. })
  49. }
  50. }),
  51. ],
  52. [
  53. this.optionsEvensAuth("imp", ({ moduleName }) => {
  54. return {
  55. name: moduleName,
  56. render: () => {
  57. return this.importButton(workerStockImportP, moduleName)
  58. }
  59. }
  60. }),
  61. ],
  62. ]
  63. ]
  64. },
  65. // 更多参数
  66. moreParameters() {
  67. return []
  68. },
  69. },
  70. methods: {
  71. // 列表请求函数
  72. getList: workerStockListP,
  73. // 列表导出函数
  74. exportList: workerStockListPExport,
  75. // 表格列解析渲染数据更改
  76. columnParsing(item, defaultData) {
  77. return defaultData
  78. },
  79. // 监听勾选变化
  80. selectionChange(data) {
  81. this.recordSelected = data
  82. },
  83. }
  84. }
  85. </script>
  86. <style lang="scss" scoped></style>