Browse Source

接口接入

scorpio 2 years ago
parent
commit
3e16b4b0d8

+ 15 - 0
src/api/store/index.js

@@ -1,10 +1,25 @@
 import fetch from '../fetch.js'
 
 export default {
+  /**
+   * 入库预审项目列表
+   * @param params
+   * @returns {Promise | Promise<unknown>}
+   */
   list(params) {
     return fetch(
       '/blade-project-manage-v2/project-dispatch/v2/pre-storage-page',
       params
     )
+  },
+  /**
+   * 入库清单文件列表
+   * @param params
+   */
+  fileList(params) {
+    return fetch(
+      '/blade-project-manage-v2/project-dispatch/v2/pre-storage-detail',
+      params
+    )
   }
 }

+ 1 - 1
src/layout/left.vue

@@ -80,7 +80,7 @@ export default {
         this.subActive = menu.subActive
       }
       if (
-        this.data[this.active].hasChildren !== undefined &&
+        Object.hasOwn(this.data[this.active], 'hasChildren') &&
         this.data[this.active].hasChildren === true
       ) {
         this.activeCollapse = this.data[this.active].name

+ 1 - 1
src/layout/top.vue

@@ -142,7 +142,7 @@ export default {
         this.mini = false
       }
     })
-    this.initWebSocket()
+    // this.initWebSocket()
   },
   unmounted() {
     this.websock.close() // 离开路由之后断开websocket连接

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

@@ -290,6 +290,7 @@ export default {
     const dispatchType = this.$route.query.dispatchType
     if (dispatchType) {
       this.dispatchParams = {
+        preId: this.$route.query.pid,
         projectId: this.$route.query.id,
         ...this.$route.query
       }

+ 111 - 43
src/views/store/component/info3.vue

@@ -5,21 +5,35 @@
     </div>
     <div class="padding-left padding-right mt-20" style="padding: 20px">
       <avue-crud
+        v-model="form"
         :option="option"
         :data="data"
         ref="crud"
-        v-model="form"
         :before-open="beforeOpen"
         @row-del="rowDel"
-        @row-save="rowSave"
-        @row-update="rowUpdate"
         @on-load="onLoad"
       >
         <template #menu-left>
           <div>
-            <el-button type="primary" @click="uploadShow = true"
-              >上传</el-button
-            >
+            <el-dropdown @command="openFile">
+              <el-button type="primary">
+                上传附件<el-icon class="el-icon--right"><arrow-down /></el-icon>
+              </el-button>
+              <template #dropdown>
+                <el-dropdown-menu>
+                  <el-dropdown-item command="1"
+                    >备案证/可研批复</el-dropdown-item
+                  >
+                  <el-dropdown-item command="2">合同</el-dropdown-item>
+                  <el-dropdown-item command="3">工程量清单</el-dropdown-item>
+                  <el-dropdown-item command="4">现场照片</el-dropdown-item>
+                  <el-dropdown-item command="5"
+                    >项目核实认定表</el-dropdown-item
+                  >
+                  <el-dropdown-item command="6">其他资料</el-dropdown-item>
+                </el-dropdown-menu>
+              </template>
+            </el-dropdown>
             <el-button type="primary" plain>导出</el-button>
           </div>
         </template>
@@ -58,54 +72,35 @@
         >
       </el-descriptions>
     </el-dialog>
-    <el-dialog v-model="uploadShow" title="文件上传">
-      <div>
-        <el-button>上传</el-button>
-      </div>
-    </el-dialog>
   </div>
 </template>
 
 <script>
 export default {
+  props: {
+    info: {
+      type: Object,
+      default: null
+    }
+  },
   data() {
     return {
+      pid: '',
       uploadShow: false,
       show: false,
       form: {},
-      data: [
-        {
-          name: '备案证/可研批复',
-          type: '已解决'
-        },
-        {
-          name: '合同',
-          type: '已解决'
-        },
-        {
-          name: '现场照片',
-          type: '已解决'
-        },
-        {
-          name: '分享工程清单',
-          type: '已解决'
-        },
-        {
-          name: '项目核实认定表',
-          type: '已解决'
-        },
-        {
-          name: '其他资料',
-          type: '已解决'
-        }
-      ],
+      data: [],
+      page: {
+        current: 1,
+        size: 10
+      },
       option: {
         align: 'center',
         menuWidth: 380,
         height: 525,
         size: 'mini',
         addBtn: false,
-        viewBtn: true,
+        editBtn: false,
         refreshBtn: false,
         columnBtn: false,
         labelWidth: 140,
@@ -113,24 +108,97 @@ export default {
         column: [
           {
             label: '附件类型',
-            prop: 'name'
+            prop: 'type',
+            type: 'select',
+            dicData: [
+              {
+                label: '备案证/可研批复',
+                value: 1
+              },
+              {
+                label: '合同',
+                value: 2
+              },
+              {
+                label: '现场照片',
+                value: 3
+              },
+              {
+                label: '分享工程清单',
+                value: 4
+              },
+              {
+                label: '项目核实认定表',
+                value: 5
+              },
+              {
+                label: '其他资料',
+                value: 6
+              }
+            ]
           },
           {
             label: '附件名称',
-            prop: 'name'
+            prop: 'title'
           },
           {
             label: '上传情况',
-            prop: 'type'
+            prop: 'isUploaded',
+            type: 'select',
+            dicData: [
+              {
+                label: '未上传',
+                value: 0
+              },
+              {
+                label: '已上传',
+                value: 1
+              }
+            ]
           }
         ]
       }
     }
   },
+  created() {
+    this.pid = this.$route.query.id
+  },
   methods: {
+    onLoad() {
+      const data = Object.assign(this.page, { id: this.pid })
+      this.$api.store.fileList(data).then(res => {
+        if (res.code === 200) {
+          this.data = res.data.files.map(ele => {
+            const tmp = ele.fileFolder
+            delete tmp.id
+            return Object.assign(tmp, ele)
+          })
+        }
+      })
+    },
+    openFile(row) {
+      const routeUrl = this.$router.resolve({
+        path: '/home/details',
+        query: {
+          pid: this.pid,
+          id: this.info.projectId,
+          dispatchType: row,
+          type: 4
+        }
+      })
+      window.open(routeUrl.href, '_blank')
+    },
+    rowDel(row, index, done) {
+      console.log(row)
+    },
     beforeOpen(done, type) {
-      if (type === 'view') {
-        this.show = true
+      if (['view'].includes(type)) {
+        console.log(this.showInfo)
+      } else if (type === 'edit') {
+        this.$router.push({
+          path: '/home/details',
+          query: { id: this.form.id, type: '1' }
+        })
       } else {
         done()
       }

+ 1 - 1
src/views/store/detail.vue

@@ -14,7 +14,7 @@
         class="flex-child-average mb-20 full-width"
         style="min-height: 700px; padding: 0; width: 99%"
       >
-        <info3></info3>
+        <info3 :info="info"></info3>
       </el-card>
       <el-card
         shadow="hover"

+ 2 - 2
vite.config.js

@@ -57,9 +57,9 @@ export default defineConfig({
     proxy: {
       '/api': {
         // 正式环境地址
-        // target: 'https://dev.wutongresearch.club/api',
+        target: 'https://dev.wutongresearch.club/api',
         // target: 'https://prod.wutongshucloud.com/api',
-        target: 'http://192.168.31.181:8110',
+        // target: 'http://192.168.31.181:8110',
         changeOrigin: true,
         rewrite: path => path.replace(/^\/api/, '')
       }