gaoluyang
2025-03-10 2f5d64825dbc81f9732893ee9f3de1a38725ae25
src/components/materialOrder/filesLookVisible.vue
@@ -3,26 +3,20 @@
    <el-dialog title="附件查看" :visible.sync="isShow" width="80%" @closed="$emit('closeFilesLook')">
      <div style="display: flex;justify-content: space-between;">
        <ul class="tab">
          <li v-for="(m,i) in dataVisibleTitle" :key="i" :class="{active:i===dataVisibleIndex}" @click="handleDataVisibleTab(m,i)">{{m.label}}</li>
          <li v-for="(m, i) in dataVisibleTitle" :key="i" :class="{ active: i === dataVisibleIndex }"
            @click="handleDataVisibleTab(m, i)">{{ m.label }}</li>
        </ul>
        <el-upload :action="action"
                   :auto-upload="true"
                   :data="{orderId: dataVisibleIndex === 0 ? filesLookInfo.enterOrderId : filesLookInfo.quarterOrderId}"
                   :on-success="handleSuccessUp" :show-file-list="false"
                   accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar' :headers="headers"
                   :before-upload="beforeUpload"
                   style="width: 80px !important;"
                   :on-error="onError" ref='upload'>
        <el-upload :action="action" :auto-upload="true"
          :data="{ orderId: dataVisibleIndex === 0 ? filesLookInfo.enterOrderId : filesLookInfo.quarterOrderId }"
          :on-success="handleSuccessUp" :show-file-list="false"
          accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar' :headers="uploadHeader"
          :before-upload="beforeUpload" style="width: 80px !important;" :on-error="onError" ref='upload'>
          <el-button size="small" type="primary" style="height: 38px">附件上传</el-button>
        </el-upload>
      </div>
      <div style="height: 70vh;overflow-y: auto;" v-if="filesDialogVisible">
        <ValueTable ref="fileList"
                    :url="$api.insOrderPlan.getFileList"
                    :delUrl="$api.insOrderPlan.delfile"
                    class="value-table"
                    :key="upIndex"
                    :componentData="componentData"/>
        <ValueTable ref="fileList" :url="$api.insOrderPlan.getFileList" :delUrl="$api.insOrderPlan.delfile"
          class="value-table" :key="upIndex" :componentData="componentData" />
      </div>
    </el-dialog>
  </div>
@@ -35,7 +29,7 @@
export default {
  name: "filesLookVisible",
  // import 引入的组件需要注入到对象中才能使用
  components: {ValueTable},
  components: { ValueTable },
  props: {
    filesDialogVisible: {
      type: Boolean,
@@ -43,7 +37,7 @@
    },
    filesLookInfo: {
      type: Object,
      default: () => {}
      default: () => { }
    },
  },
  data() {
@@ -64,20 +58,20 @@
      dataVisibleIndex: 0, // tab栏选择值
      componentData: {
        entity: {
          insOrderId:''
          insOrderId: ''
        },
        isIndex: true,
        showSelect: false,
        select: false,
        sort: false,
        init:false,
        init: false,
        do: [
          {
            id: 'parent',
            font: '下载',
            type: 'text',
            method: 'handleDown'
          },{
          }, {
            id: 'delete',
            font: '删除',
            type: 'text',
@@ -87,8 +81,8 @@
        isPage: false,
        linkEvent: {},
        tagField: {
          type:{
            select:[
          type: {
            select: [
              {
                value: 1,
                label: '图片'
@@ -114,7 +108,7 @@
  // 方法集合
  methods: {
    // 切换数据查看tab栏
    handleDataVisibleTab (m, i) {
    handleDataVisibleTab(m, i) {
      this.dataVisibleIndex = i
      this.refreshTable()
    },
@@ -129,17 +123,17 @@
        this.$refs['fileList'].selectList(e)
      })
    },
    handleDown(row){
    handleDown(row) {
      this.$axios.post(this.$api.insOrderPlan.downFile, {
        id: row.id,
      }).then(res => {
        if (res.code === 200) {
          let url = '';
          if(res.data.type==1){
            url = this.javaApi+'/img/'+res.data.fileUrl
            file.downloadIamge(url,row.fileName)
          }else{
            url = this.javaApi+'/word/'+res.data.fileUrl
          if (res.data.type == 1) {
            url = this.javaApi + '/img/' + res.data.fileUrl
            file.downloadIamge(url, row.fileName)
          } else {
            url = this.javaApi + '/word/' + res.data.fileUrl
            const link = document.createElement('a');
            link.href = url;
            link.download = row.fileName;
@@ -150,7 +144,7 @@
      })
    },
    handleSuccessUp(response, ) {
    handleSuccessUp(response,) {
      this.upLoading = false;
      if (response.code == 200) {
        this.$message.success('上传成功');