scorpio преди 2 години
родител
ревизия
87144d111c

+ 25 - 0
src/api/dispatch/index.js

@@ -47,5 +47,30 @@ export default {
       {},
       'blob'
     )
+  },
+  /**
+   * 关联文件
+   * @param params
+   * @returns {Promise<unknown>}
+   */
+  linkFile(params) {
+    return fetch(
+      '/blade-project-manage-v2/project-dispatch/v2/save-file',
+      params,
+      'post',
+      'json'
+    )
+  },
+  /**
+   * 删除关联文件
+   * @param params
+   * @returns {Promise<unknown>}
+   */
+  removeFile(params) {
+    return fetch(
+      '/blade-project-manage-v2/project-dispatch/v2/delete-file',
+      params,
+      'post'
+    )
   }
 }

+ 22 - 0
src/api/resource/index.js

@@ -42,6 +42,20 @@ export default {
       'json'
     )
   },
+  /**
+   * 文件覆盖
+   * @param params
+   * @returns {Promise<unknown>}
+   */
+  fileCover(params) {
+    // 上传(新增)文件
+    return fetch(
+      '/blade-project-manage-v2/folder/v2/coverFile',
+      params,
+      'post',
+      'json'
+    )
+  },
   /**
    * 文件搜索
    * @param params
@@ -114,5 +128,13 @@ export default {
    */
   fileDetail(id) {
     return fetch('/wutong-library/library/detail/file/' + id)
+  },
+  /**
+   * 删除文件
+   * @param params
+   * @returns {Promise<unknown>}
+   */
+  fileDel(params) {
+    return fetch('/blade-project-manage-v2/folder/v2/remove', params, 'post')
   }
 }

+ 39 - 6
src/components/filepicker/index.vue

@@ -1,13 +1,39 @@
 <template>
   <div>
-    <el-button type="primary" icon="Upload" @click="show = true"
-      >文件上传</el-button
-    >
+    <div v-if="command === null || command.length === 0">
+      <el-button
+        v-if="menuBtn"
+        text
+        type="primary"
+        icon="Upload"
+        @click="show = true"
+        >上传</el-button
+      >
+      <el-button v-else type="primary" icon="Upload" @click="show = true"
+        >文件上传</el-button
+      >
+    </div>
+    <el-dropdown v-else @command="openFile" class="ml-10">
+      <el-button type="primary">
+        文件上传
+        <el-icon class="el-icon--right">
+          <arrow-down />
+        </el-icon>
+      </el-button>
+      <template #dropdown>
+        <el-dropdown-menu>
+          <el-dropdown-item v-for="(item, index) in command" :command="index">
+            {{ item.label }}
+          </el-dropdown-item>
+        </el-dropdown-menu>
+      </template>
+    </el-dropdown>
     <el-dialog
       v-model="show"
       width="1200px"
       :show-close="false"
       :close-on-click-modal="false"
+      append-to-body
       @close="onClose"
     >
       <template #header>
@@ -126,12 +152,21 @@ export default {
   },
   props: {
     projectId: {
+      required: true,
       type: String,
       default: ''
     },
+    menuBtn: {
+      type: Boolean,
+      default: false
+    },
     max: {
       type: Number,
       default: 9
+    },
+    command: {
+      type: Array,
+      default: null
     }
   },
   watch: {
@@ -177,6 +212,7 @@ export default {
         showMenu: false,
         showCheckBox: true,
         folderChecked: false,
+        showCheckAll: false,
         height: 500,
         column: [
           {
@@ -233,7 +269,6 @@ export default {
             } else {
               this.stageId = this.stageList[0].id
             }
-            console.log(this.stageId)
           }
         })
     },
@@ -241,7 +276,6 @@ export default {
      * 获取全部文件
      */
     getFolderList() {
-      console.log('dddddd')
       this.loading = true
       const row = {
         stageId: this.stageId,
@@ -304,7 +338,6 @@ export default {
     },
     rowClick(res) {
       this.currentRow = res
-      console.log(this.currentRow)
       const tmp = this.list.find(ele => ele.id === res.id)
       this.parentId = tmp.id
       if (tmp && tmp.type !== 2) {

+ 47 - 5
src/components/upload-file/index.vue

@@ -34,6 +34,24 @@
         </div>
       </div>
     </div>
+    <el-dialog v-model="show" title="文件名重复" width="400px">
+      <div class="flex flex-center flex-col">
+        <el-icon color="#409eff" :size="70"><WarningFilled /></el-icon>
+        <span class="mt-20">
+          此位置已经存在名称为
+          <span class="main-color">{{
+            repeatList.map(ele => ele.title).join(',')
+          }}</span>
+          的文件。您要使用当前文件进行替换吗?
+        </span>
+        <div class="mt-20 padding-top">
+          <el-button type="primary" plain @click="show = false"
+            >取 消</el-button
+          >
+          <el-button type="primary" @click="reset">替 换</el-button>
+        </div>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -81,6 +99,7 @@ export default {
   },
   data() {
     return {
+      show: false,
       headers: {
         Authorization: `Basic ${Base64.encode(
           `${website.clientId}:${website.clientSecret}`
@@ -89,7 +108,9 @@ export default {
       },
       drawer: false,
       fileList: [],
-      resultList: []
+      resultList: [],
+      repeatList: [],
+      params: null
     }
   },
   methods: {
@@ -104,7 +125,6 @@ export default {
       }
       if (this.resultList.length === this.fileList.length) {
         this.saveFile()
-        this.saveLibrary()
       }
     },
     /**
@@ -135,7 +155,7 @@ export default {
      * 保存文件
      */
     saveFile() {
-      const data = this.resultList.map(e => {
+      this.params = this.resultList.map(e => {
         return {
           fileId: e.id,
           parentId: this.parentId,
@@ -143,14 +163,36 @@ export default {
           stageId: this.stageId
         }
       })
-      // fixme 重复文件未处理
-      this.$api.resource.fileSave(data).then(res => {
+      this.$api.resource.fileSave(this.params).then(res => {
+        if (res.code === 200) {
+          console.log(typeof res.data)
+          if (res.msg.indexOf('存在重名文件,是否覆盖') === -1) {
+            this.saveLibrary()
+            this.$message.success('文件上传完成')
+            this.$emit('on-success', this.resultList)
+            setTimeout(() => {
+              this.drawer = false
+            }, 3000)
+          } else {
+            // 重名
+            this.repeatList = res.data
+            this.show = true
+          }
+        }
+      })
+    },
+    reset() {
+      this.show = false
+      this.$api.resource.fileCover(this.params).then(res => {
         if (res.code === 200) {
+          this.saveLibrary()
           this.$message.success('文件上传完成')
           this.$emit('on-success', this.resultList)
           setTimeout(() => {
             this.drawer = false
           }, 3000)
+        } else {
+          this.$message.error(res.msg)
         }
       })
     }

+ 12 - 10
src/page/404.vue

@@ -1,10 +1,14 @@
 <template>
-  <div class='full-screen flex flex-center'>
-    <img src='https://wutong-1302848345.cos.ap-chengdu.myqcloud.com/wtzx/4e993b2d27a544a893ddbc8f60cc2a65.svg'/>
-    <div class='ml-20'>
-      <h1 style='font-size: 82px' class='bold'>404</h1>
-      <div class='mt-10 bold'>抱歉,你访问的页面不存在</div>
-      <el-button type='primary' class='mt-20' @click='goHome'>返回首页</el-button>
+  <div class="full-screen flex flex-center">
+    <img
+      src="https://wutong-1302848345.cos.ap-chengdu.myqcloud.com/wtzx/4e993b2d27a544a893ddbc8f60cc2a65.svg"
+    />
+    <div class="ml-20">
+      <h1 style="font-size: 82px" class="bold">404</h1>
+      <div class="mt-10 bold">抱歉,您访问的页面不存在</div>
+      <el-button type="primary" class="mt-20" @click="goHome"
+        >返回首页</el-button
+      >
     </div>
   </div>
 </template>
@@ -21,13 +25,11 @@
 export default {
   name: '404',
   methods: {
-    goHome () {
+    goHome() {
       this.$router.push('/')
     }
   }
 }
 </script>
 
-<style scoped>
-
-</style>
+<style scoped></style>

+ 10 - 1
src/views/contract/index.vue

@@ -54,7 +54,11 @@
       <template #menu-left>
         <div class="flex flex-center">
           <div class="main-color ml-10 mr-20 bold font-15">金额单位:万元</div>
-          <filepicker :project-id="projectId" @submit="selection" />
+          <filepicker
+            :project-id="projectId"
+            @submit="selection"
+            :command="command"
+          />
         </div>
       </template>
     </avue-crud>
@@ -78,6 +82,11 @@ export default {
       projectId: '',
       form: {},
       data: [],
+      command: [
+        {
+          label: '33'
+        }
+      ],
       option: {
         align: 'center',
         menuAlign: 'center',

+ 79 - 67
src/views/home/component/dispatch.vue

@@ -10,27 +10,27 @@
           <span class="bold font-18 main-color">进度描述</span>
           <div class="flex flex-center">
             <base-button
-                type="0"
-                title="批量导出"
-                icon="upload"
-                @click="exportFile"
+              type="0"
+              title="批量导出"
+              icon="upload"
+              @click="exportFile"
             />
             <base-button
-                v-if="projectInfo.can_update"
-                class="ml-10"
-                :title="btnTitle"
-                icon="upload"
-                @click="edit"
+              v-if="projectInfo.can_update"
+              class="ml-10"
+              :title="btnTitle"
+              icon="upload"
+              @click="edit"
             />
           </div>
         </div>
         <div class="mt-20">
           <el-input
-              v-model="progress"
-              :rows="10"
-              type="textarea"
-              :disabled="btnTitle === '编辑'"
-              placeholder="填写项目进度信息"
+            v-model="progress"
+            :rows="10"
+            type="textarea"
+            :disabled="btnTitle === '编辑'"
+            placeholder="填写项目进度信息"
           />
         </div>
       </div>
@@ -40,40 +40,38 @@
           <span class="bold font-18 main-color">相关文件</span>
         </div>
         <avue-crud
-            ref="crud"
-            v-model="form"
-            v-model:page="page"
-            :data="data"
-            :option="option"
-            :table-loading="loading"
-            class="curd"
-            :before-open="beforeOpen"
-            @row-del="rowDel"
+          ref="crud"
+          v-model="form"
+          v-model:page="page"
+          :data="data"
+          :option="option"
+          :table-loading="loading"
+          class="curd"
+          :before-open="beforeOpen"
+          @row-del="rowDel"
         >
-          <template #menu="{ row }">
-            <el-button
-                v-if="projectInfo.can_update"
-                icon="Upload"
-                type="primary"
-                text
-                @click="openFile(row)"
-            >
-              上传
-            </el-button>
-            <el-button
+          <template #menu="{ row, index }">
+            <div class="flex flex-center">
+              <filepicker
+                :project-id="projectId"
+                :menu-btn="true"
+                @submit="selection($event, index + 1)"
+              />
+              <el-button
                 text
                 type="primary"
                 icon="Download"
                 @click="fileDownload(row)"
-            >下载
-            </el-button>
+                >下载
+              </el-button>
+            </div>
           </template>
           <template #menu-right>
             <div class="full-width">
               <el-button
-                  icon="el-icon-refresh"
-                  circle
-                  @click="detail"
+                icon="el-icon-refresh"
+                circle
+                @click="detail"
               ></el-button>
             </div>
           </template>
@@ -89,34 +87,27 @@
         <div class="flex flex-center flex-justify-between mt-20">
           <span class="bold font-18 main-color">施工现场图</span>
           <div class="flex flex-center">
-            <base-button
-                type="0"
-                v-if="projectInfo.can_update"
-                title="上传"
-                icon="upload"
-                @click="
-                openFile({
-                  dispatchType: 4
-                })
-              "
+            <filepicker
+              :project-id="projectId"
+              @submit="selection($event, 4)"
             />
           </div>
         </div>
         <div class="mt-20">
-          <el-empty description="暂无施工现场图" v-if="srcList.length === 0"/>
+          <el-empty description="暂无施工现场图" v-if="srcList.length === 0" />
           <el-carousel
-              v-else
-              autoplay
-              :interval="4000"
-              type="card"
-              height="400px"
-              :initial-index="0"
+            v-else
+            autoplay
+            :interval="4000"
+            type="card"
+            height="400px"
+            :initial-index="0"
           >
             <el-carousel-item v-for="(item, index) in srcList" :key="item">
               <el-image
-                  :src="item"
-                  fit="cover"
-                  @click="showImageView(item, index)"
+                :src="item"
+                fit="cover"
+                @click="showImageView(item, index)"
               />
             </el-carousel-item>
           </el-carousel>
@@ -124,10 +115,10 @@
       </div>
     </div>
     <el-image-viewer
-        v-if="showImage"
-        :url-list="preList"
-        :initial-index="imageIndex"
-        @close="showImage = false"
+      v-if="showImage"
+      :url-list="preList"
+      :initial-index="imageIndex"
+      @close="showImage = false"
     />
   </basic-container>
 </template>
@@ -136,10 +127,11 @@
 import BasicContainer from '@/components/basic-container/main.vue'
 import baseButton from '@/components/base-button.vue'
 import api from '@/api/index.js'
+import filepicker from '@/components/filepicker/index.vue'
 
 export default {
   name: 'dispatch',
-  components: {BasicContainer, baseButton},
+  components: { BasicContainer, baseButton, filepicker },
   props: {
     projectInfo: {
       type: Object,
@@ -210,7 +202,7 @@ export default {
         tip: false,
         columnBtn: false,
         selection: false,
-        editBtn: true,
+        editBtn: false,
         editBtnText: '打开',
         editBtnIcon: 'FolderOpened',
         addBtn: false,
@@ -369,7 +361,7 @@ export default {
       if (api.offices.includes(item.fileFolder.suffix)) {
         const routeData = this.$router.resolve({
           path: '/home/file_detail',
-          query: {id: item.fileFolder.fileId}
+          query: { id: item.fileFolder.fileId }
         })
         window.open(routeData.href, '_blank')
       } else {
@@ -388,7 +380,7 @@ export default {
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
-        this.$api.project.fileRemove({ids: row.fileId, type: 2}).then(res => {
+        this.$api.dispatch.removeFile({ ids: row.id, type: 2 }).then(res => {
           if (res.code === 200) {
             this.$message.success(res.msg)
             this.detail()
@@ -433,6 +425,26 @@ export default {
         this.$message.success('资料打包中,完成后系统将会发送通知消息给您')
         this.loading = false
       })
+    },
+    /**
+     * 选择关联文件
+     * @param list
+     */
+    selection(list, type) {
+      const tmps = list.map(e => {
+        return {
+          projectId: this.projectId,
+          year: this.year,
+          month: this.month,
+          fileId: e.id,
+          type
+        }
+      })
+      this.$api.dispatch.linkFile(tmps).then(res => {
+        if (res.code === 200) {
+          this.detail()
+        }
+      })
     }
   }
 }

+ 6 - 2
src/views/resource/component/archives.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
-    <el-button class="ml-10" type="primary" text @click="this.show = true"
-      >归档
+    <el-button class="ml-10" type="primary" text @click="this.show = true">
+      {{ row.fileStatus === 1 ? '已归档' : '归档' }}
     </el-button>
     <el-dialog
       v-model="show"
@@ -205,6 +205,10 @@ import baseButton from '@/components/base-button.vue'
 export default {
   components: { baseButton },
   props: {
+    row: {
+      type: Object,
+      default: {}
+    },
     folderId: {
       type: String,
       default: ''

+ 53 - 0
src/views/resource/component/defile.vue

@@ -0,0 +1,53 @@
+<template>
+  <div>
+    <el-button text type="primary" @click="show = true">删 除</el-button>
+    <el-dialog v-model="show" title="确定删除" width="400px">
+      <div class="flex flex-center flex-col">
+        <el-icon color="#409eff" :size="70"><WarningFilled /></el-icon>
+        <span class="mt-20"
+          >确定删除所选的文件吗?<br />删除的文件可在 10天
+          内通过回收站还原</span
+        >
+        <div class="mt-20 padding-top">
+          <el-button type="primary" plain @click="show = false"
+            >取 消</el-button
+          >
+          <el-button type="primary" @click="del">确 定</el-button>
+        </div>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+export default {
+  props: {
+    row: {
+      type: Object,
+      default: null
+    }
+  },
+  data() {
+    return {
+      show: false
+    }
+  },
+  methods: {
+    del() {
+      this.$api.resource.fileDel({ ids: this.row.id }).then(res => {
+        this.show = false
+        if (res.code === 200) {
+          this.$message.success(res.msg)
+          this.$emit('row-del')
+        } else {
+          this.$confirm(res.msg, {
+            type: 'warning'
+          })
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 5 - 1
src/views/resource/component/search.vue

@@ -137,7 +137,11 @@ export default {
       this.total = 0
     },
     goFoleDetail(item) {
-      this.$router.push('/home/file_detail?id=' + item.id)
+      const routeData = this.$router.resolve(
+        '/home/file_detail?id=' + item.fileId
+      )
+      window.open(routeData.href, '_blank')
+      this.show = false
     },
     closeDialog() {
       this.searchForm.keyword = ''

+ 17 - 2
src/views/resource/component/xtable.vue

@@ -19,7 +19,7 @@
           :style="header.width ? `width:` + header.width + `px` : ''"
         >
           <el-checkbox
-            v-if="index === 0"
+            v-if="index === 0 && showCheckAll"
             class="ml-10"
             label=""
             @change="selection"
@@ -51,6 +51,7 @@
               <archives
                 v-if="row.type === 2 && row.parentId === '0'"
                 :folder-id="row.id"
+                :row="row"
               />
               <move
                 v-if="row.type === 1"
@@ -59,6 +60,7 @@
                 @on-success="refresh"
               />
               <slot name="menu" :row="row"></slot>
+              <defile :row="row" @row-del="refresh" />
             </div>
             <div
               v-else
@@ -72,6 +74,7 @@
                   :index="index"
                   :show-check-box="showCheckBox"
                   :folder-checked="folderChecked"
+                  :show-check-all="showCheckAll"
                   @click="rowClick(row)"
                 ></row1>
               </div>
@@ -101,12 +104,14 @@ import row1 from '@/views/resource/component/row1.vue'
 import move from '@/views/resource/component/move.vue'
 import archives from '@/views/resource/component/archives.vue'
 import preview from '@/views/resource/component/preview.vue'
+import defile from '@/views/resource/component/defile.vue'
 export default {
   components: {
     row1,
     move,
     archives,
-    preview
+    preview,
+    defile
   },
   props: {
     page: {
@@ -145,16 +150,25 @@ export default {
         const menu = {
           label: '操作'
         }
+        // 是否显示列表操作栏
         this.showMenu =
           this.option.showMenu === undefined ? true : this.option.showMenu
+        // 文件夹前面的checkbox 是否默认不可以选择
         this.folderChecked =
           this.option.folderChecked === undefined
             ? false
             : this.option.folderChecked
+        // 是显示 选中框
         this.showCheckBox =
           this.option.showCheckBox === undefined
             ? false
             : this.option.showCheckBox
+        // 是否选择全选按钮
+        this.showCheckAll =
+          this.option.showCheckAll === undefined
+            ? true
+            : this.option.showCheckAll
+
         this.headers = val.column
         if (this.showMenu) {
           if (this.headers.findIndex(e => e.label === '操作') === -1) {
@@ -176,6 +190,7 @@ export default {
       showMenu: true,
       showCheckBox: false,
       folderChecked: false,
+      showCheckAll: true,
       headers: [],
       selectedList: []
     }

+ 2 - 9
src/views/resource/index.vue

@@ -47,11 +47,6 @@
               >新建文件夹
             </el-button>
             <authorize class="ml-10" :list="selectedList" />
-            <filepicker
-              class="ml-10"
-              :project-id="folderInfo.projectId"
-              :stage-id="folderInfo.stageId"
-            />
           </div>
           <div class="flex flex-center main-color mr-10">
             <search
@@ -82,7 +77,7 @@
         >
           <template #menu="{ row }">
             <el-button
-              v-if="row.type === 2"
+              v-if="row.type === 2 && row.fileStatus === 0"
               type="primary"
               text
               @click="renameFolder(row)"
@@ -112,7 +107,7 @@
 <route>
 {
 name: '资料管理',
-meta: { 'show': false }
+meta: { 'show': false, 'back':true}
 }
 </route>
 
@@ -121,7 +116,6 @@ import tipsCustom from '@/components/tips-custom/index.vue'
 import xtable from '@/views/resource/component/xtable.vue'
 import floder from '@/views/resource/component/floder.vue'
 import uploadFile from '@/components/upload-file/index.vue'
-import filepicker from '@/components/filepicker/index.vue'
 import fileWay from '@/components/file-way/index.vue'
 import authorize from '@/views/resource/component/authorize.vue'
 import search from '@/views/resource/component/search.vue'
@@ -132,7 +126,6 @@ export default {
     xtable,
     floder,
     uploadFile,
-    filepicker,
     fileWay,
     authorize,
     search