Browse Source

fix 项目迁移

scorpio 2 years ago
parent
commit
f7be209c2f

+ 165 - 70
src/views/home/component/authorize.vue

@@ -1,51 +1,98 @@
 <template>
   <div class='flex flex-justify-between flex-col  full-width '>
-    <div class='flex full-width full-height border-bottom padding-bottom bold '>
-      <span class='flex-child-average text-center'>文件/文件夹名称</span>
-      <span class='flex-child-average text-center'>更新(上传)时间</span>
-      <span class='flex-child-average text-center'>权限设置</span>
-    </div>
-    <div class='border-bottom padding-right padding-left mt-10' style='height: 500px'>
-      <div class='flex flex-align-center mb-10 flex-justify-between border-bottom'>
-        <div class='bold'>文件夹相关权限</div>
-        <el-radio-group v-model="check" @change='allChange'>
-          <el-radio label="3" size="large">不可查看</el-radio>
-          <el-radio label="1" size="large">可见</el-radio>
-          <el-radio label="2" size="large">可编辑</el-radio>
-        </el-radio-group>
-      </div>
-      <div style='overflow-y: scroll; height: 450px'>
-        <div v-for='(item,index) in fileList' :key='item.id'>
-          <item1 :check='item.check' :data='item' :index='index' @change='change'/>
+    <el-tabs type='border-card'>
+      <el-tab-pane label='授权文件夹'>
+        <div class='flex full-width full-height border-bottom padding-bottom bold '>
+          <span class='flex-child-average text-center'>文件夹名称</span>
+          <span class='flex-child-average text-center'>更新(上传)时间</span>
+          <span class='flex-child-average text-center'>权限设置</span>
         </div>
-      </div>
-    </div>
-    <div class='full-width flex flex-align-center mt-10'>
-      <span class='font-14 bold'>授权时长</span>
-      <el-date-picker
-          v-model="authorizeDate"
-          class='ml-20'
-          end-placeholder="截止日期"
-          range-separator="至"
-          start-placeholder="开始日期"
-          type="daterange"
-          value-format='YYYY-MM-DD'
-      />
-    </div>
-    <div class='full-width flex flex-align-center mt-10'>
-      <span class='font-14 bold'>生成授权连接</span>
-      <el-button circle class='ml-20' icon="Picture" type="danger" @click='initCode'/>
-<!--      <el-button circle icon="Paperclip" type="danger"/>-->
-    </div>
-    <div class='full-width mt-20 border-top padding-top flex flex-justify-end'>
-      <el-button @click='close'>取消</el-button>
-      <el-button type='primary' @click='close'>关闭</el-button>
-    </div>
+        <div class='border-bottom padding-right padding-left mt-10' style='height: 500px'>
+          <div class='flex flex-align-center mb-10 flex-justify-between border-bottom'>
+            <div class='bold'>文件夹相关权限</div>
+            <el-radio-group v-model="check" @change='allChange($event,1)'>
+              <el-radio label="1" size="large">可见</el-radio>
+              <el-radio label="2" size="large">可编辑</el-radio>
+            </el-radio-group>
+          </div>
+          <div style='overflow-y: scroll; height: 450px' v-loading='loading'>
+            <div v-for='(item,index) in folderList' :key='item.id'>
+              <item1 :check='item.check' :data='item' :index='index' @change='change($event,1)'/>
+            </div>
+          </div>
+        </div>
+        <div class='full-width flex flex-align-center mt-10'>
+          <span class='font-14 bold'>授权时长</span>
+          <el-date-picker
+              v-model="authorizeDate"
+              class='ml-20'
+              end-placeholder="截止日期"
+              range-separator="至"
+              start-placeholder="开始日期"
+              type="daterange"
+              value-format='YYYY-MM-DD'
+          />
+        </div>
+        <div class='full-width flex flex-align-center mt-10'>
+          <span class='font-14 bold'>生成授权连接</span>
+          <el-button circle class='ml-20' icon="Picture" type="danger" @click='initCode(1)'/>
+          <!--      <el-button circle icon="Paperclip" type="danger"/>-->
+        </div>
+        <div class='full-width mt-20 border-top padding-top flex flex-justify-end'>
+          <el-button @click='close'>取消</el-button>
+          <el-button type='primary' @click='close'>关闭</el-button>
+        </div>
+      </el-tab-pane>
+      <el-tab-pane label='授权文件'>
+        <div class='flex full-width full-height border-bottom padding-bottom bold '>
+          <span class='flex-child-average text-center'>文件名称</span>
+          <span class='flex-child-average text-center'>更新(上传)时间</span>
+          <span class='flex-child-average text-center'>权限设置</span>
+        </div>
+        <div class='border-bottom padding-right padding-left mt-10' style='height: 500px'>
+          <div class='flex flex-align-center mb-10 flex-justify-between border-bottom'>
+            <div class='bold'>文件相关权限</div>
+            <el-radio-group v-model="check" @change='allChange($event,2)'>
+              <el-radio label="3" size="large">不可查看</el-radio>
+              <el-radio label="1" size="large">可见</el-radio>
+              <el-radio label="2" size="large">可编辑</el-radio>
+            </el-radio-group>
+          </div>
+          <div style='overflow-y: scroll; height: 450px'>
+            <div v-for='(item,index) in fileList' :key='item.id'>
+              <item1 :check='item.check' :data='item' :index='index' @change='change($event,2)'/>
+            </div>
+          </div>
+        </div>
+        <div class='full-width flex flex-align-center mt-10'>
+          <span class='font-14 bold'>授权时长</span>
+          <el-date-picker
+              v-model="authorizeDate"
+              class='ml-20'
+              end-placeholder="截止日期"
+              range-separator="至"
+              start-placeholder="开始日期"
+              type="daterange"
+              value-format='YYYY-MM-DD'
+              format='YYYY-MM-DD'
+          />
+        </div>
+        <div class='full-width flex flex-align-center mt-10'>
+          <span class='font-14 bold'>生成授权连接</span>
+          <el-button circle class='ml-20' icon="Picture" type="danger" @click='initCode(2)'/>
+          <!--      <el-button circle icon="Paperclip" type="danger"/>-->
+        </div>
+        <div class='full-width mt-20 border-top padding-top flex flex-justify-end'>
+          <el-button @click='close'>取消</el-button>
+          <el-button type='primary' @click='close'>关闭</el-button>
+        </div>
+      </el-tab-pane>
+    </el-tabs>
     <el-dialog v-model='qrCodeShow' top='20%' width='400px'>
       <div class='flex flex-col flex-center' style='height: 400rpx;width: 400rpx'>
         <vue-qr :currentLevel='3' :logoCornerRadius='4' :logoScale='0.25' :logoSrc='logoSrc' :text='qrCodeText'
                 size='340'/>
-        <span>复制二维码,通过微信进行分享</span>
+        <span>右键复制二维码,通过微信进行分享</span>
       </div>
     </el-dialog>
   </div>
@@ -54,6 +101,7 @@
 <script>
 import item1 from '@/views/home/component/item1.vue'
 import VueQr from 'vue-qr/src/packages/vue-qr.vue'
+
 export default {
   name: 'authorize',
   components: { item1, VueQr },
@@ -74,37 +122,46 @@ export default {
   watch: {
     list: {
       handler (val) {
-        this.fileList = val
-        this.fileList.map(sub => {
+        val = val.map(sub => {
           sub.check = this.check
           return sub
         })
+        this.folderList = val.filter(sub => sub.type !== '1')
+        this.fileList = val.filter(sub => sub.type === '1')
       },
       immediate: true
     }
   },
   data () {
     return {
+      loading: false,
       check: '2',
       authorizeDate: [],
       fileData: null,
       qrCodeShow: false,
       fileList: [],
-      qrCodeText: ''
+      folderList: [],
+      qrCodeText: '',
+      defaultDate: []
     }
   },
   methods: {
     close () {
       this.$emit('close')
     },
-    initCode () {
+    initCode (type) {
+      this.loading = true
+      let list = this.folderList
+      if (type === 2) {
+        list = this.fileList
+      }
       if (this.authorizeDate.length === 0) {
         this.$message.error('请设置授权时间')
         return
       }
       this.startTime = this.authorizeDate[0]
       this.endTime = this.authorizeDate[1]
-      const fileTmps = this.fileList.filter(sub => sub.type === '1').map(sub => {
+      const fileTmps = list.filter(sub => sub.type === '1').map(sub => {
         const item = { fileId: sub.id, startTime: this.startTime, endTime: this.endTime, status: sub.check }
         return item
       })
@@ -114,11 +171,17 @@ export default {
         endTime: this.endTime,
         status: this.check
       }]
-      const folderTmp = this.fileList.filter(sub => sub.type === '2').map(sub => {
+      const folderTmp = list.filter(sub => sub.type === '2').map(sub => {
         const item = { folderId: sub.id, startTime: this.startTime, endTime: this.endTime, status: sub.check }
         return item
       })
-      this.$api.project.initCode({ files: fileTmps, folders: folder.concat(folderTmp), type: 1, projectId: this.projectId }).then(res => {
+      this.$api.project.initCode({
+        files: fileTmps,
+        folders: folder.concat(folderTmp),
+        type: 1,
+        projectId: this.projectId
+      }).then(res => {
+        this.loading = false
         if (res.code === 200) {
           this.qrCodeText = 'https://dev.wutongresearch.club/apply?id=' + res.data.qrcode.qrcodeId + '&roleName=服务商'
           this.qrCodeShow = true
@@ -127,32 +190,64 @@ export default {
         }
       })
     },
-    allChange (res) {
-      this.fileList.forEach(sub => {
-        sub.check = res
-        return sub
-      })
+    allChange (res, type) {
+      console.log(res)
+      if (type === 1) {
+        this.folderList.forEach(sub => {
+          sub.check = res
+          return sub
+        })
+        console.log(this.folderList)
+      } else {
+        this.fileList.forEach(sub => {
+          sub.check = res
+          return sub
+        })
+      }
     },
-    change (res) {
-      this.fileList[res.index] = res
-      let seeCount = 0
-      let editCount = 0
-      let notCount = 0
-      this.fileList.forEach(sub => {
-        if (sub.check === '1') {
-          seeCount = seeCount + 1
-        } else if (sub.check === '2') {
-          editCount = editCount + 1
+    change (res, type) {
+      if (type === 1) {
+        this.folderList[res.index] = res
+        let seeCount = 0
+        let editCount = 0
+        let notCount = 0
+        this.folderList.forEach(sub => {
+          if (sub.check === '1') {
+            seeCount = seeCount + 1
+          } else if (sub.check === '2') {
+            editCount = editCount + 1
+          } else {
+            notCount = notCount + 1
+          }
+        })
+        if (editCount >= seeCount || editCount > 0) {
+          this.check = '2'
+        } else if (seeCount > 0) {
+          this.check = '1'
         } else {
-          notCount = notCount + 1
+          this.check = '3'
         }
-      })
-      if (editCount >= seeCount || editCount > 0) {
-        this.check = '2'
-      } else if (seeCount > 0) {
-        this.check = '1'
       } else {
-        this.check = '3'
+        this.fileList[res.index] = res
+        let seeCount = 0
+        let editCount = 0
+        let notCount = 0
+        this.fileList.forEach(sub => {
+          if (sub.check === '1') {
+            seeCount = seeCount + 1
+          } else if (sub.check === '2') {
+            editCount = editCount + 1
+          } else {
+            notCount = notCount + 1
+          }
+        })
+        if (editCount >= seeCount || editCount > 0) {
+          this.check = '2'
+        } else if (seeCount > 0) {
+          this.check = '1'
+        } else {
+          this.check = '3'
+        }
       }
     }
   }

+ 2 - 2
src/views/home/component/dash.vue

@@ -6,7 +6,7 @@
           <WarningFilled/>
         </el-icon>
         <span class="ml-5">项目总投资额<span
-            class="main-color bold">{{ Number.parseFloat(num).toLocaleString() }}</span>万元</span>
+            class="main-color bold">{{ num ? Number.parseFloat(num).toLocaleString() :'-'}}</span>万元</span>
       </div>
       <div class="flex ml-20 hide-scrollbar" style="overflow-x: scroll;width: 86vw" v-show='stage && stage.length > 0'>
         <div v-for="(item,index) in stage" :key='item.id' :class="active === index ? 'total-s' : 'total'"
@@ -227,7 +227,7 @@ export default {
             label: '更新时间',
             prop: 'updateTime',
             type: 'month',
-            width: 100,
+            width: 120,
             format: 'YYYY-MM-DD',
             valueFormat: 'YYYY-MM-DD'
           }]

+ 7 - 3
src/views/home/component/folder_info.vue

@@ -37,7 +37,7 @@
         </div>
       </div>
       <div class="flex flex-center mr-5 " style="flex: 1.2">
-        <base-button v-if='permissions.permissions.home_folder_authorize' class="mr-20" icon="User" title="授 权"
+        <base-button v-if='permissions.permissions.home_folder_authorize' class="mr-20" icon="User" title="批量授权"
                      type="0" @click='authorizeShow = true'/>
         <base-button v-if='permissions.permissions.home_folder_new' icon="Plus" title="添加文件夹" type="0"
                      @click="addShow = true"/>
@@ -87,7 +87,7 @@
         :url-list="imgList"
         @close='viewerClose'
     />
-<!--    授权-->
+    <!--    授权-->
     <el-dialog v-model='authorizeShow' append-to-body width='40%'>
       <authorize :list='folderList' @close='authorizeShow = false'/>
     </el-dialog>
@@ -187,7 +187,11 @@ export default {
       }
       this.$api.project.folderList(Object.assign(data, this.page)).then(res => {
         if (res.code === 200) {
-          this.folderList = res.data.records
+          this.folderList = res.data.records.map(sub => {
+            const item = sub
+            item.title = sub.folderName
+            return item
+          })
           this.total = res.data.total
         }
       })

+ 3 - 4
src/views/home/component/item1.vue

@@ -1,13 +1,12 @@
 <template>
   <div class='full-width flex flex-center text-center border-bottom padding-top padding-bottom'>
     <div class='flex-child-average flex flex-align-center'>
-      <el-tag class='mr-10 text-left'>{{item.type === '1' ?'文件':'文件夹'}}</el-tag>
-      <div class=' text-left'>{{item.title}}</div>
+      <div class=' text-left'>{{item.title}}{{item.check}}</div>
     </div>
-    <div class='flex-child-average'>{{item.updateTime}}</div>
+    <div class='flex-child-average'>{{item.createTime}}</div>
     <div class='flex-child-average'>
       <el-radio-group v-model="check" @change='change'>
-        <el-radio label="3" size="large">不可查看</el-radio>
+        <el-radio label="3" size="large" v-if='item.type === "1" '>不可查看</el-radio>
         <el-radio label="1" size="large">可见</el-radio>
         <el-radio label="2" size="large">可编辑</el-radio>
       </el-radio-group>