index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title+'-列表', essential: true }]">
  3. <template slot-scope="{activeKey, data}">
  4. <template-page v-if="activeKey == 'list'" ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
  5. :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing" :operationColumnWidth="80"
  6. :operation="operation()" :exportList="exportList">
  7. </template-page>
  8. </template>
  9. </zj-tab-page>
  10. </template>
  11. <script>
  12. import TemplatePage from '@/components/template/template-page-1.vue'
  13. import import_mixin from '@/components/template/import_mixin.js'
  14. import ImageUpload from '@/components/file-upload'
  15. import { downloadFiles } from '@/utils/util'
  16. import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
  17. import { listPageV2, pageExport, getDetail, listImport } from "@/api/salesPurchasing/goodsInventory";
  18. import { commonTemplateDownload } from '@/api/common.js'
  19. import operation_mixin from '@/components/template/operation_mixin.js'
  20. export default {
  21. components: { TemplatePage, ImageUpload },
  22. mixins: [import_mixin, operation_mixin],
  23. data() {
  24. return {
  25. // 表格属性
  26. tableAttributes: {
  27. // 启用勾选列
  28. selectColumn: true
  29. },
  30. // 表格事件
  31. tableEvents: {
  32. 'selection-change': this.selectionChange
  33. },
  34. // 勾选选中行
  35. recordSelected: [],
  36. /** 表单变量 */
  37. formDialogType: 0,
  38. formDialogTitles: ["新增", "编辑", "详情"],
  39. formDialog: false,
  40. formData: {},
  41. formType: 'add',
  42. formVisible: false,
  43. }
  44. },
  45. computed: {
  46. // 事件组合
  47. optionsEvensGroup() {
  48. return []
  49. },
  50. // 更多参数
  51. moreParameters() {
  52. return []
  53. },
  54. formItems() {
  55. return []
  56. }
  57. },
  58. methods: {
  59. // 列表请求函数
  60. getList(p, cb) {
  61. try {
  62. var pam = JSON.parse(JSON.stringify(p))
  63. cb && cb(pam)
  64. return listPageV2(pam)
  65. } catch (error) {
  66. console.log(error)
  67. }
  68. },
  69. // 列表导出函数
  70. exportList: pageExport,
  71. // 表格列解析渲染数据更改
  72. columnParsing(item, defaultData) {
  73. return defaultData
  74. },
  75. // 监听勾选变化
  76. selectionChange(data) {
  77. this.recordSelected = data
  78. },
  79. operation() {
  80. return this.operationBtn({
  81. detail: {
  82. conditions: ({ row, index, column }) => {
  83. return JSON.parse(localStorage.getItem('greemall_user')).joinCode === "CODE"
  84. },
  85. click: ({ row, index, column }) => {
  86. this.$router.push({
  87. name: 'goodsCodeMachineAccount',
  88. params: {
  89. pageName: row.goodsMaterialId,
  90. pageType: '-',
  91. pageCode: row.goodsMaterialId
  92. },
  93. })
  94. }
  95. },
  96. })
  97. },
  98. formCancel() {
  99. this.formVisible = false
  100. this.$refs?.formRef?.resetFields()
  101. this.$data.formData = this.$options.data().formData
  102. }
  103. }
  104. }
  105. </script>
  106. <style lang="scss" scoped>
  107. .tab {
  108. padding: 20px 20px 0 20px;
  109. }
  110. </style>