多体系建设信息化条统-前端
zhouwx
2025-10-14 a219bc2526137283ea2da50ebec18864c8052e8b
修改
2 files modified
40 ■■■■■ changed files
src/views/build/conpanyFunctionConsult/digitalFileDep/project/projectFile/components/dataDialog.vue 4 ●●●● patch | view | raw | blame | history
src/views/build/conpanyFunctionConsult/digitalFileDep/project/projectFile/index.vue 36 ●●●●● patch | view | raw | blame | history
src/views/build/conpanyFunctionConsult/digitalFileDep/project/projectFile/components/dataDialog.vue
@@ -34,10 +34,10 @@
<!--          <el-input v-model.trim="state.form.erdact" :disabled="state.title =='查看'" placeholder="编写指南"></el-input>-->
<!--        </el-form-item>-->
        <el-form-item label="文件:" prop="filePath">
          <el-upload accept=".doc,.docx" :action="state.uploadUrl" :headers="state.header" method="post" :on-success="(res, uploadFile)=>handleAvatarSuccess(res, uploadFile)" :on-exceed="showTip" :limit='state.fileLimit' v-model:file-list="state.fileList" :before-upload="picSize" :on-remove="(file, uploadFiles)=>handleRemove(file, uploadFiles)" >
          <el-upload accept=".doc,.docx,.pdf,.png,.jpg,.jpeg" :action="state.uploadUrl" :headers="state.header" method="post" :on-success="(res, uploadFile)=>handleAvatarSuccess(res, uploadFile)" :on-exceed="showTip" :limit='state.fileLimit' v-model:file-list="state.fileList" :before-upload="picSize" :on-remove="(file, uploadFiles)=>handleRemove(file, uploadFiles)" >
            <el-button type="primary">点击上传</el-button>
            <template #tip>
              <div class="el-upload__tip">支持上传.doc、.docx格式文档,尺寸小于5M,最多可上传1份</div>
              <div class="el-upload__tip">支持上传.doc、.docx、.pdf、图片格式文档,尺寸小于5M,最多可上传1份</div>
            </template>
          </el-upload>
        </el-form-item>
src/views/build/conpanyFunctionConsult/digitalFileDep/project/projectFile/index.vue
@@ -104,6 +104,17 @@
            </el-table-column>
          </el-table>
        </el-form>
        <div class="pag-container">
          <el-pagination
              v-model:current-page="data.queryParams.pageNum"
              v-model:page-size="data.queryParams.pageSize"
              :page-sizes="[10,15,20,25]"
              layout="total, sizes, prev, pager, next, jumper"
              :total="total"
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
          />
        </div>
<!--        <div style="display: flex;align-items: center;justify-content: right;margin-top: 10px">-->
<!--          <el-button v-if="state.form.id && data.isAdmin" type="danger"  @click="deleteData">删除</el-button>-->
<!--          <el-button v-if="data.isAdmin" type="primary"  @click="addData()">保存</el-button>-->
@@ -150,6 +161,8 @@
    type: 3,
    companyId: null,
    itemId: null,
    pageNum: 1,
    pageSize: 10,
  },
  companyList: [],
  projectList: [],
@@ -494,7 +507,9 @@
    companyId: state.form.companyId,
    catalogueId: state.form.catalogueId,
    type: 2,
    itemId: data.queryParams.itemId
    itemId: data.queryParams.itemId,
    pageSize: data.queryParams.pageSize,
    pageNum: data.queryParams.pageNum
  }
  const res = await getProductFilePage(queryParams)
  if (res.code == 200) {
@@ -504,9 +519,18 @@
        fileNameSimple: item.fileName.split('.')[0]
      }
    })
    total.value = res.data.total
  } else {
    ElMessage.warning(res.message)
  }
}
const handleSizeChange = (val) => {
  data.queryParams.pageSize = val
   getFileList()
}
const handleCurrentChange = (val) => {
  data.queryParams.pageNum = val
  getFileList()
}
const openFile = async(path)=>{
  const ext = path.split('.').pop().toLowerCase();
@@ -517,7 +541,9 @@
      console.log('取消预览')
    });
    return
  }
  }else if(ext === 'pdf' || ext === 'png' || ext === 'jpg'|| ext === 'jpeg'){
    window.open(`${import.meta.env.VITE_APP_BASE_API}/${path}`, '_blank');
  }else {
  try {
    // 1. 获取文件
    const response = await fetch(import.meta.env.VITE_APP_BASE_API + '/' + path);
@@ -546,6 +572,8 @@
    console.error('预览失败:', error);
    alert(`预览失败: ${error.message}`);
  }
  }
}
const downloadFile = (e)=>{
  axios.get(import.meta.env.VITE_APP_BASE_API + '/' +e.filePath,{headers:{'Content-Type': 'application/json','Authorization': `${getToken()}`},responseType: 'blob'}).then(res=>{
@@ -658,6 +686,10 @@
<style scoped lang="scss">
.app-container{
  .pag-container{
    float: right;
    margin-top: 10px;
  }
  .bottom{
    display: flex;
    width: auto;