scorpio 2 år sedan
förälder
incheckning
2735082e18

+ 3 - 1
src/components/filepicker/index.vue

@@ -1,6 +1,8 @@
 <template>
   <div>
-    <el-button type="primary" @click="show = true">文件上传</el-button>
+    <el-button type="primary" icon="Upload" @click="show = true"
+      >文件上传</el-button
+    >
     <el-dialog
       v-model="show"
       width="1200px"

+ 1 - 1
src/views/home/component/top-fliter.vue

@@ -6,7 +6,7 @@
         v-model="query.projectYear"
         @change="change($event, 1)"
         class="padding-right"
-        style="width: 50%"
+        style="width: 80px"
         clearable
       >
         <el-option

+ 81 - 27
src/views/resource/component/archives.vue

@@ -1,11 +1,6 @@
 <template>
   <div>
-    <el-button
-      class="ml-10"
-      type="primary"
-      size="small"
-      text
-      @click="this.show = true"
+    <el-button class="ml-10" type="primary" text @click="this.show = true"
       >归档
     </el-button>
     <el-dialog
@@ -14,8 +9,9 @@
       width="960"
       :close-on-click-modal="false"
       :show-close="false"
+      @close="close"
     >
-      <el-form :model="form" label-width="100px" :rules="rules" ref="formRef">
+      <el-form :model="from" label-width="100px" :rules="rules" ref="formRef">
         <div class="flex flex-col flex-justify-between border-bottom">
           <div class="flex flex-center">
             <el-form-item label="类别:">
@@ -70,7 +66,7 @@
             <el-input
               v-model="from.fileTitle"
               placeholder="输入案卷标题"
-              autosize
+              :rows="6"
               type="textarea"
             />
           </el-form-item>
@@ -90,8 +86,12 @@
           <el-form-item style="width: 33.5%" label="编制单位:" prop="makeUnit">
             <el-input v-model="from.makeUnit" placeholder="输入编制单位" />
           </el-form-item>
-          <el-form-item style="width: 66.5%" label="编制日期:" prop="makeDate">
-            <div class="flex flex-center">
+          <el-form-item
+            style="width: 66.5%"
+            label="编制日期:"
+            prop="makeStartDate"
+          >
+            <div class="flex flex-center flex-justify-start">
               <el-col :span="10">
                 <el-form-item>
                   <el-date-picker
@@ -102,11 +102,11 @@
                   />
                 </el-form-item>
               </el-col>
-              <el-col :span="3">
+              <el-col :span="4">
                 <span class="grey-6">至</span>
               </el-col>
               <el-col :span="10">
-                <el-form-item>
+                <el-form-item prop="makeStartDate">
                   <el-date-picker
                     v-model="from.makeEndDate"
                     placeholder="结束日期"
@@ -202,13 +202,27 @@ export default {
       default: ''
     }
   },
+  watch: {
+    show: {
+      handler(val) {
+        if (val) {
+          this.getDic('archive-category')
+          this.getDic('file-genus')
+          this.getDic('archives-type')
+          this.getDic('retention-period')
+          this.getDic('file-classification')
+        }
+      },
+      immediate: true
+    }
+  },
   data() {
     return {
       show: false,
       from: {
         folderId: '',
         category: '1', // 类别
-        classification: '', // 密级
+        classification: '1', // 密级
         directoryNum: '', // 目录号
         fileDate: '', // 归档日期
         fileLocation: '', // 归档位置
@@ -219,7 +233,7 @@ export default {
         makeUnit: '', // 编制单位
         quanzongNum: '', // 全宗号
         recordsNum: '', // 案卷号
-        retentionPeriod: '', // 保管期限
+        retentionPeriod: '1', // 保管期限
         genus: '1' // 属别
       },
       genus: [],
@@ -259,6 +273,13 @@ export default {
             trigger: 'blur'
           }
         ],
+        makeStartDate: [
+          {
+            required: true,
+            message: '编制时间不能为空!',
+            trigger: 'blur'
+          }
+        ],
         fileDate: [
           {
             required: true,
@@ -290,13 +311,6 @@ export default {
       }
     }
   },
-  created() {
-    this.getDic('archive-category')
-    this.getDic('file-genus')
-    this.getDic('archives-type')
-    this.getDic('retention-period')
-    this.getDic('file-classification')
-  },
   methods: {
     getDic(code) {
       this.$api.common.dicList({ code }).then(res => {
@@ -316,13 +330,53 @@ export default {
       })
     },
     archiveInduction() {
-      // this.$refs.formRef.validate((valid, fields) => {
-      //   console.log(valid)
-      // })
-      this.from.folderId = this.folderId
-      this.$api.resource.fileArchives(this.from).then(res => {
-        console.log(res)
+      this.$refs.formRef.validate((valid, fields) => {
+        console.log(valid)
+        if (valid) {
+          this.from.folderId = this.folderId
+          this.$api.resource.fileArchives(this.from).then(res => {
+            if (Object.hasOwn(res, 'code')) {
+              this.$message.error(res.msg)
+              return
+            }
+            this.download(res)
+          })
+        }
       })
+    },
+    download(res) {
+      const url = window.URL.createObjectURL(
+        new Blob([res], { type: 'application/vnd.ms-excel' })
+      )
+      const link = document.createElement('a')
+      link.style.display = 'none'
+      link.href = url
+      const excelName = this.from.fileTitle + '.docx'
+      link.setAttribute('download', excelName)
+      document.body.appendChild(link)
+      link.click()
+      link.remove()
+      this.show = false
+      this.$message.success('导出成功')
+    },
+    close() {
+      this.from = {
+        folderId: '',
+        category: '1', // 类别
+        classification: '1', // 密级
+        directoryNum: '', // 目录号
+        fileDate: '', // 归档日期
+        fileLocation: '', // 归档位置
+        fileTitle: '', // 案卷标题
+        fileType: '1', // 档案类型
+        makeStartDate: '', // 编织开始时间
+        makeEndDate: '', // 编制结束时间
+        makeUnit: '', // 编制单位
+        quanzongNum: '', // 全宗号
+        recordsNum: '', // 案卷号
+        retentionPeriod: '1', // 保管期限
+        genus: '1' // 属别
+      }
     }
   }
 }

+ 29 - 7
src/views/resource/component/authorize.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <el-button type="primary" plain icon="User" @click="show = true"
+    <el-button type="primary" plain icon="User" @click="showDialog"
       >批量授权
     </el-button>
     <el-dialog v-model="show" width="880px">
@@ -47,7 +47,7 @@
         <el-divider direction="vertical" style="height: 350px" />
         <div class="qrcode">
           <el-empty
-            description="请先选择授权方式"
+            description="请选择授权配置后点击生成二维码"
             v-if="qrCodeText.length === 0"
           ></el-empty>
           <vue-qr
@@ -62,7 +62,7 @@
         </div>
       </div>
       <div class="mt-20 full-width flex flex-center">
-        <el-button type="primary" plain>取 消</el-button>
+        <el-button type="primary" plain @click="show = false">取 消</el-button>
         <el-button type="primary" @click="qrCode()">生成二维码</el-button>
       </div>
     </el-dialog>
@@ -76,6 +76,12 @@ export default {
   components: {
     VueQr
   },
+  props: {
+    list: {
+      type: Array,
+      default: []
+    }
+  },
 
   data() {
     return {
@@ -95,19 +101,35 @@ export default {
     }
   },
   methods: {
+    showDialog() {
+      console.log(this.list.length)
+      if (this.list.length === 0) {
+        this.$message.error('请先选择要授权的文件夹、文件')
+        return
+      }
+      this.show = true
+    },
     qrCode() {
+      if (this.list.length === 0) {
+        return
+      }
+      if (this.time.length === 0) {
+        this.$message.error('请选择授权时间')
+        return
+      }
+      this.query.ids = this.list.map(e => e.id).join(',')
       this.$api.resource.fileAuthorize(this.query).then(res => {
         if (res.code === 200) {
-          this.qrCodeText = res.data
+          this.qrCodeText =
+            'https://dev.wutongresearch.club/apply?id=' + res.data
         }
       })
     },
     changeApplyAll(res) {
-      console.log(res)
       if (res) {
-        this.query.isApplyAll = 0
-      } else {
         this.query.isApplyAll = 1
+      } else {
+        this.query.isApplyAll = 0
       }
     },
     dateChange() {

+ 0 - 1
src/views/resource/component/floder.vue

@@ -7,7 +7,6 @@
       prefix-icon="EditPen"
     />
     <div class="mt-20 flex flex-justify-end full-width">
-      {{ rename }}
       <el-button type="primary" @click="folderAdd">确 定</el-button>
     </div>
   </div>

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

@@ -11,6 +11,7 @@
         class="padding-right"
         @change="rowChecked(row)"
       />
+      <div v-else style="width: 24px" />
       <div v-if="info.type === 2">
         <img
           v-if="info.isAccess === 1"
@@ -44,7 +45,7 @@
     </div>
     <div
       v-else
-      class="flex flex-align-center flex-center full-height flex-child-average"
+      class="flex flex-align-center flex-center flex-justify-start ml-10 full-height flex-child-average"
     >
       {{ info[column.prop] }}
     </div>

+ 33 - 5
src/views/resource/component/xtable.vue

@@ -1,7 +1,11 @@
 <template>
   <div class="full-height">
     <div class="flex flex-center flex-justify-between border-bottom">
-      <div v-for="header in headers" :key="header.id" class="mt-20 full-width">
+      <div
+        v-for="(header, index) in headers"
+        :key="header.id"
+        class="mt-20 full-width"
+      >
         <div
           v-if="header.label === '操作'"
           class="padding-top padding-bottom"
@@ -11,10 +15,18 @@
         </div>
         <div
           v-else
-          class="menu flex flex-center"
+          class="menu flex flex-center flex-justify-start"
           :style="header.width ? `width:` + header.width + `px` : ''"
         >
-          {{ header.label }}
+          <el-checkbox
+            v-if="index === 0"
+            class="ml-10"
+            label=""
+            @change="selection"
+          />
+          <div class="ml-10">
+            {{ header.label }}
+          </div>
         </div>
       </div>
     </div>
@@ -36,7 +48,7 @@
               style="width: 280px"
             >
               <el-button type="primary" text>查看</el-button>
-              <archives v-if="row.type === 2" />
+              <archives v-if="row.type === 2" :folder-id="row.id" />
               <move
                 v-if="row.type === 1"
                 :project-id="row.projectId"
@@ -143,6 +155,11 @@ export default {
         }
       },
       immediate: true
+    },
+    selectedList: {
+      handler(val) {
+        this.$emit('selected', this.selectedList)
+      }
     }
   },
   data() {
@@ -177,7 +194,18 @@ export default {
       } else {
         this.selectedList = this.selectedList.filter(ele => ele.id !== row.id)
       }
-      this.$emit('selected', this.selectedList)
+    },
+    /**
+     * 文件选择
+     */
+    selection(res) {
+      this.showCheckBox = res
+      this.data.map(ele => {
+        ele.checked = res
+        return ele
+      })
+      this.selectedList = this.data.filter(ele => ele.checked)
+      this.$emit('selection', res)
     }
   }
 }

+ 12 - 3
src/views/resource/index.vue

@@ -45,7 +45,7 @@
               @click="showDialog(1)"
               >新建文件夹
             </el-button>
-            <authorize class="ml-10" />
+            <authorize class="ml-10" :list="selectedList" />
             <filepicker
               class="ml-10"
               :project-id="folderInfo.projectId"
@@ -72,9 +72,11 @@
           :option="option"
           :loading="loading"
           :page="page"
+          @selected="selected"
           @row-click="getFileList"
           @current-change="currentChange"
           @refresh="refreshData"
+          @selection="selectAll"
         >
           <template #menu="{ row }">
             <el-button
@@ -142,9 +144,10 @@ export default {
       top: true,
       loading: false,
       currentFolder: null,
+      selectedList: [],
       data: [],
       option: {
-        showCheckBox: true,
+        showCheckBox: false,
         folderChecked: false,
         column: [
           {
@@ -312,6 +315,12 @@ export default {
       this.show = true
       this.showType = 1
       this.folderInfo = res
+    },
+    selectAll(res) {
+      this.option.showCheckBox = res
+    },
+    selected(list) {
+      this.selectedList = list
     }
   }
 }
@@ -319,6 +328,6 @@ export default {
 
 <style lang="scss" scoped>
 .content {
-  height: auth;
+  height: auto;
 }
 </style>