scorpio 2 年之前
父節點
當前提交
cab62f7977
共有 3 個文件被更改,包括 73 次插入24 次删除
  1. 73 22
      src/views/contract/component/info3.vue
  2. 0 1
      src/views/home/component/folder_info.vue
  3. 0 1
      src/views/store/component/info3.vue

+ 73 - 22
src/views/contract/component/info3.vue

@@ -10,28 +10,42 @@
         ref="crud"
         v-model="form"
         :before-open="beforeOpen"
-        @row-del="rowDel"
-        @row-save="rowSave"
-        @row-update="rowUpdate"
-        @on-load="onLoad"
       >
+        <template #menu-right>
+          <el-button icon="Refresh" circle @click="getDetail"></el-button>
+        </template>
       </avue-crud>
     </div>
   </div>
 </template>
 
 <script>
+import api from '@/api/index.js'
+
 export default {
   name: 'info',
+  props: {
+    info: {
+      type: Object,
+      default: null
+    }
+  },
+  watch: {
+    info: {
+      handler(val) {
+        if (val) {
+          this.detail = val
+          this.fetchData(val.files)
+        }
+      },
+      immediate: true
+    }
+  },
   data() {
     return {
+      detail: null,
       form: {},
-      data: [
-        {
-          id: 3,
-          prop: 'ooooo'
-        }
-      ],
+      data: [],
       option: {
         align: 'center',
         menuAlign: 'center',
@@ -39,10 +53,11 @@ export default {
         menuBtnTitle: '支付凭证',
         size: 'mini',
         addBtn: true,
+        delBtn: false,
         addBtnText: '上传',
-        editBtn: false,
+        editBtn: true,
+        editBtnText: '下载',
         viewBtn: true,
-        delBtn: true,
         refreshBtn: false,
         columnBtn: false,
         labelWidth: 140,
@@ -50,15 +65,11 @@ export default {
         column: [
           {
             label: '文件名称',
-            prop: 'noticeType'
-          },
-          {
-            label: '上传状态',
-            prop: 'noticeType'
+            prop: 'title'
           },
           {
             label: '上传时间',
-            prop: 'noticeType'
+            prop: 'createTime'
           }
         ]
       }
@@ -66,17 +77,57 @@ export default {
   },
   methods: {
     beforeOpen(done, type) {
-      console.log(type)
       if (type === 'add') {
+        this.openFile()
+      } else if (type === 'view') {
+        this.previewFile(this.form)
+      } else if (type === 'edit') {
+        this.downLoad(this.form)
       }
     },
-    openFile(row) {
+    /**
+     * 文件下载
+     * @param row
+     */
+    downLoad(row) {
+      window.open(row.url, '_blank')
+    },
+    previewFile(item) {
+      if (api.offices.includes(item.suffix)) {
+        const routeData = this.$router.resolve({
+          path: '/home/file_detail',
+          query: { id: item.fileId }
+        })
+        window.open(routeData.href, '_blank')
+      } else {
+        this.preList.length = 0
+        this.preList.push(item.url)
+        this.showImage = true
+      }
+    },
+    getDetail() {
+      this.$api.contract.detail({ id: this.info.id }).then(res => {
+        if (res.code === 200) {
+          this.detail = res.data
+          this.fetchData(this.detail.files)
+        }
+      })
+    },
+    fetchData(files) {
+      this.data = files.map(ele => {
+        const file = ele.fileFolder
+        delete file.id
+        return Object.assign(ele, file)
+      })
+    },
+    openFile() {
       const routeUrl = this.$router.resolve({
         path: '/home/details',
         query: {
+          dispatchType: 1,
           id: this.info.projectId,
-          dispatchType: row,
-          type: 4
+          type: 5,
+          contractId: this.info.id
         }
       })
       window.open(routeUrl.href, '_blank')

+ 0 - 1
src/views/home/component/folder_info.vue

@@ -139,7 +139,6 @@ import baseButton from '../../../components/base-button.vue'
 import folderList from './folder_list.vue'
 import permissionStore from '@/store/permission.js'
 import authorize from '@/views/home/component/authorize.vue'
-import basicCurd from '@/components/basic-curd/index.vue'
 
 export default {
   name: 'right2',

+ 0 - 1
src/views/store/component/info3.vue

@@ -252,7 +252,6 @@ export default {
      * @param item
      */
     previewFile(item) {
-      console.log(item)
       if (api.offices.includes(item.suffix)) {
         const routeData = this.$router.resolve({
           path: '/home/file_detail',