scorpio 2 年之前
父節點
當前提交
f5504a41da

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

@@ -83,5 +83,18 @@ export default {
    */
   fileMove(params) {
     return fetch('/blade-project-manage-v2/folder/v2/moveFile', params, 'post')
+  },
+  /**
+   * 生成授权二维码
+   * @param params
+   * @returns {Promise<unknown>}
+   */
+  fileAuthorize(params) {
+    return fetch(
+      '/blade-project-manage-v2/qrcode/v2/getGrantQrcode',
+      params,
+      'post',
+      'json'
+    )
   }
 }

+ 134 - 0
src/views/resource/component/authorize.vue

@@ -0,0 +1,134 @@
+<template>
+  <div>
+    <el-button type="primary" plain icon="User" @click="show = true"
+      >批量授权
+    </el-button>
+    <el-dialog v-model="show" width="880px">
+      <template #header>
+        <div class="full-width flex flex-center flex-justify-between">
+          <h4>批量授权</h4>
+        </div>
+      </template>
+      <div class="flex flex-center flex-justify-between">
+        <div class="from">
+          <div class="padding flex full-width flex-col flex-justify-start">
+            <span class="full-width text-left bold mt-20">访问权限:</span>
+            <div class="flex flex-center flex-justify-start mt-10">
+              <el-radio-group v-model="query.status">
+                <el-radio :label="1">可看</el-radio>
+                <el-radio :label="2">可编辑</el-radio>
+                <el-radio :label="3">不可查看</el-radio>
+              </el-radio-group>
+            </div>
+            <span class="full-width text-left bold mt-20">授权时间:</span>
+            <el-date-picker
+              style="width: 360px"
+              v-model="time"
+              type="daterange"
+              clearable
+              class="mt-10"
+              range-separator="至"
+              start-placeholder="开始时间"
+              end-placeholder="截止时间"
+              format="YYYY-MM-DD"
+              value-format="YYYY-MM-DD"
+              @change="dateChange"
+            />
+          </div>
+          <el-checkbox
+            class="full-width flex flex-justify-start mt-20"
+            label="应用到此文件夹、子文件夹及文件"
+            @change="changeApplyAll"
+          />
+
+          <el-divider />
+          <span class="grey-6">- 复制二维码并通过他微信分享给被授权用户 -</span>
+        </div>
+        <el-divider direction="vertical" style="height: 350px" />
+        <div class="qrcode">
+          <el-empty
+            description="请先选择授权方式"
+            v-if="qrCodeText.length === 0"
+          ></el-empty>
+          <vue-qr
+            v-else
+            :currentLevel="3"
+            :logoCornerRadius="4"
+            :logoScale="0.25"
+            :logoSrc="logoSrc"
+            :text="qrCodeText"
+            size="360"
+          />
+        </div>
+      </div>
+      <div class="mt-20 full-width flex flex-center">
+        <el-button type="primary" plain>取 消</el-button>
+        <el-button type="primary" @click="qrCode()">生成二维码</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import VueQr from 'vue-qr/src/packages/vue-qr.vue'
+
+export default {
+  components: {
+    VueQr
+  },
+
+  data() {
+    return {
+      show: false,
+      access: 1,
+      logoSrc: new URL('@/assets/img/logo.png', import.meta.url).href,
+      qrCodeText: '',
+      time: '',
+      query: {
+        ids: '1684455585037017090',
+        status: 1,
+        startTime: '',
+        endTime: '',
+        type: 1,
+        isApplyAll: 0
+      }
+    }
+  },
+  methods: {
+    qrCode() {
+      this.$api.resource.fileAuthorize(this.query).then(res => {
+        if (res.code === 200) {
+          this.qrCodeText = res.data
+        }
+      })
+    },
+    changeApplyAll(res) {
+      console.log(res)
+      if (res) {
+        this.query.isApplyAll = 0
+      } else {
+        this.query.isApplyAll = 1
+      }
+    },
+    dateChange() {
+      if (this.time.length === 0) {
+        return
+      }
+      this.query.startTime = this.time[0]
+      this.query.endTime = this.time[1]
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.from {
+  width: 400px;
+  height: 400px;
+}
+
+.qrcode {
+  width: 400px;
+  height: 400px;
+}
+</style>

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

@@ -7,7 +7,7 @@
       <el-checkbox
         v-if="showCheckBox"
         v-model="info.checked"
-        :disabled="info.type === 2"
+        :disabled="folderChecked"
         class="padding-right"
         @change="rowChecked(row)"
       />
@@ -69,6 +69,10 @@ export default {
     showCheckBox: {
       type: Boolean,
       default: false
+    },
+    folderChecked: {
+      type: Boolean,
+      default: false
     }
   },
   watch: {

+ 6 - 0
src/views/resource/component/xtable.vue

@@ -56,6 +56,7 @@
                   :column="prop"
                   :index="index"
                   :show-check-box="showCheckBox"
+                  :folder-checked="folderChecked"
                   @click="rowClick(row)"
                 ></row1>
               </div>
@@ -126,6 +127,10 @@ export default {
         }
         this.showMenu =
           this.option.showMenu === undefined ? true : this.option.showMenu
+        this.folderChecked =
+          this.option.folderChecked === undefined
+            ? false
+            : this.option.folderChecked
         this.showCheckBox =
           this.option.showCheckBox === undefined
             ? false
@@ -144,6 +149,7 @@ export default {
     return {
       showMenu: true,
       showCheckBox: false,
+      folderChecked: false,
       headers: [],
       selectedList: []
     }

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

@@ -45,7 +45,7 @@
               @click="showDialog(1)"
               >新建文件夹
             </el-button>
-            <el-button type="primary" plain icon="User">批量授权</el-button>
+            <authorize class="ml-10" />
             <filepicker
               class="ml-10"
               :project-id="folderInfo.projectId"
@@ -119,6 +119,7 @@ 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'
 
 export default {
   components: {
@@ -127,7 +128,8 @@ export default {
     floder,
     uploadFile,
     filepicker,
-    fileWay
+    fileWay,
+    authorize
   },
 
   data() {
@@ -142,6 +144,8 @@ export default {
       currentFolder: null,
       data: [],
       option: {
+        showCheckBox: true,
+        folderChecked: false,
         column: [
           {
             label: '名称',