src/views/dnc/base/modules/ProductStructure/Document/OtherDocumentTableList.vue
@@ -1,7 +1,7 @@
<template>
  <div>
    <a-table :columns="columns" :data-source="dataSource" bordered :pagination="ipagination"
             :scroll="{y:189}" :customRow="customRow" :size="size" rowKey="docId">
             :scroll="{y:189}" :customRow="customRow" :size="size" rowKey="docId" @change="handleTableChange">
    </a-table>
@@ -10,20 +10,25 @@
</template>
<script>
  import { getAction } from '@/api/manage'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import DocumentModal from './DocumentModal'
  import DocumentModal from '../../../../common/DocumentModal'
  export default {
    name: 'OtherDocumentTableList',
    components: { DocumentModal },
    mixins: [JeecgListMixin],
    props: {
      currentTreeNodeInfo: {
        type: Object
      },
      size: {
        type: String
      }
    },
    data() {
      return {
        disableMixinCreated: true,
        columns: [
          {
            title: '序号',
@@ -37,97 +42,72 @@
          },
          { title: '文件名称', dataIndex: 'docName', align: 'center' },
          { title: '设备编号', dataIndex: 'docCode', align: 'center' },
          { title: '出库状态', dataIndex: 'pullStatus', align: 'center' },
          { title: '状  态', dataIndex: 'docStatus', align: 'center' },
          { title: '出库状态', dataIndex: 'pullStatus_dictText', align: 'center' },
          { title: '状  态', dataIndex: 'docStatus_dictText', align: 'center' },
          { title: '系统指定版本', dataIndex: 'publishVersion', align: 'center' },
          { title: '上传时间', dataIndex: 'createTime', align: 'center' }
        ],
        dataSource: [
          {
            'docId': '1868943615190044674',
            'docName': '测试.nc',
            'docAlias': null,
            'docCode': null,
            'docSuffix': 'nc',
            'docStatus': 1,
            'publishFileId': '1868943615454285825',
            'publishVersion': 'a.1',
            'description': null,
            'createTime': '2024-12-17 16:57:36',
            'updateTime': null,
            'createUser': '1254966905669160962',
            'updateUser': null,
            'docClassCode': null,
            'pullStatus': 1,
            'pullUser': null,
            'attributionType': 1,
            'attributionId': '1326377675659276290',
            'classificationId': '1257965467827027969',
            'syncStatus': null
          },
          {
            'docId': '1868946627732103170',
            'docName': 'nacos-config.sh',
            'docAlias': null,
            'docCode': null,
            'docSuffix': 'sh',
            'docStatus': 1,
            'publishFileId': '1868946628004732930',
            'publishVersion': 'a.1',
            'description': null,
            'createTime': '2024-12-17 17:09:34',
            'updateTime': null,
            'createUser': '1254966905669160962',
            'updateUser': null,
            'docClassCode': null,
            'pullStatus': 1,
            'pullUser': null,
            'attributionType': 1,
            'attributionId': '1326377675659276290',
            'classificationId': '1257965467827027969',
            'syncStatus': null
          },
          {
            'docId': '1868947564353740801',
            'docName': 'dir.sql',
            'docAlias': null,
            'docCode': null,
            'docSuffix': 'sql',
            'docStatus': 1,
            'publishFileId': '1868947564487958530',
            'publishVersion': 'a.1',
            'description': null,
            'createTime': '2024-12-17 17:13:17',
            'updateTime': null,
            'createUser': '1254966905669160962',
            'updateUser': null,
            'docClassCode': null,
            'pullStatus': 1,
            'pullUser': null,
            'attributionType': 1,
            'attributionId': '1326377675659276290',
            'classificationId': '1257965467827027969',
            'syncStatus': null
          }
        ],
        dataSource: [],
        currentClickedDocumentInfo: {},
        url: {
          list: ''
          list: '/nc/doc/find/page'
        }
      }
    },
    watch: {
      currentTreeNodeInfo: {
        handler(value) {
          this.currentClickedDocumentInfo = {}
        },
        immediate: true
      }
    },
    created() {
      this.$bus.$on('tableMenuItemMethodTrigger', this.triggerCorrespondingMethod)
    },
    methods: {
      loadData(arg) {
        if (!this.url.list) {
          this.$message.error('请设置url.list属性!')
          return
        }
        //加载数据 若传入参数1则加载第一页的内容
        if (arg === 1) this.ipagination.current = 1
        var params = this.getQueryParams()//查询条件
        console.log('currentTreeNodeInfo', this.currentTreeNodeInfo)
        params.attributionId = this.currentTreeNodeInfo.id
        params.attributionType = this.currentTreeNodeInfo.type
        params.docClassCode = 'OTHER'
        if (!params) return false
        this.dataSource = []
        this.loading = true
        getAction(this.url.list + `/${this.ipagination.current}/${this.ipagination.pageSize}`, params).then((res) => {
          if (res.success) {
            this.dataSource = res.result.records
            if (res.result.total) {
              this.ipagination.total = res.result.total
            } else {
              this.ipagination.total = 0
            }
          } else {
            this.$message.warning(res.message)
          }
        }).finally(() => {
          this.loading = false
        })
      },
      customRow(record) {
        return {
          on: {
            contextmenu: event => {
              event.preventDefault()
              this.$emit('handleTableContextMenuOpen', { ...record, param: 'document' })
              this.$emit('handleTableContextMenuOpen', { ...record, param: 'OTHER' })
            },
            click: () => {
              this.$bus.$emit('sendCurrentLevelInfo', record)
              if (this.currentClickedDocumentInfo.docId === record.docId) return
              this.currentClickedDocumentInfo = Object.assign({}, record)
              this.$bus.$emit('sendCurrentClickedDocumentInfo', record)
            }
          }
        }
@@ -138,8 +118,12 @@
        this.$refs.modalForm.title = modalTitle
      },
      handleDelete() {
        // 此处函数为屏蔽mixins中的同名函数,通用函数写在父级中
      },
      triggerCorrespondingMethod({ methodName, level, modalTitle, tableRowInfo }) {
        if (this[methodName] && tableRowInfo.attributionType === 1) this[methodName](tableRowInfo, modalTitle)
        if (this[methodName] && tableRowInfo.param === 'OTHER') this[methodName](tableRowInfo, modalTitle)
      }
    }
  }