Browse Source

更改根目录ID

zhaoxiaohai 2 years ago
parent
commit
96a4560b4b

+ 25 - 24
src/HManagement/archvies_mag/modules/add.vue

@@ -11,7 +11,8 @@
       </scopeOfauth>
       <div class="dialog-footer">
         <el-button size="small" @click="dialogFolderVisible = false" class="normal-btn-width">取 消</el-button>
-        <el-button size="small" type="warning" @click="createFolderComplete(folder)" class="normal-btn-width btn-warning">确 定</el-button>
+        <el-button size="small" type="warning" @click="createFolderComplete(folder)"
+          class="normal-btn-width btn-warning">确 定</el-button>
       </div>
     </el-dialog>
   </div>
@@ -20,55 +21,55 @@
 <script>
 import scopeOfauth from '@/components/scopeOfAuthority/index.vue'
 export default {
-  components:{
+  components: {
     scopeOfauth,
   },
-  data () {
+  data() {
     return {
-      dialogFolderVisible:false,
-      defaultData:{},
-      folder:{
-        document:''
+      dialogFolderVisible: false,
+      defaultData: {},
+      folder: {
+        document: ''
       },
-      attachmentid:null,
-      params:{
+      attachmentid: null,
+      params: {
         "classname": "system.attachment.MediaCenter",
         "method": "createFolder",
         "content": {
           "foldername": "文件夹名称",
-          "parentid":  ''
+          "parentid": ''
         }
       }
     }
   },
-  methods:{
-    createFolder () {},
-     // 获取保存授权范围数据
-    onChecked (param) {
+  methods: {
+    createFolder() { },
+    // 获取保存授权范围数据
+    onChecked(param) {
       this.authData = param
     },
-    async createFolderComplete (folder) {
-      let id = this.$route.query.id?this.$route.query.id:JSON.parse(sessionStorage.getItem('folderid')).appfolderid
+    async createFolderComplete(folder) {
+      let id = this.$route.query.id ? this.$route.query.id : JSON.parse(sessionStorage.getItem("folderid")).salematerialfolderid
       this.params.content.parentid = id
       this.params.content.foldername = folder.document
       const res = await this.$api.requested(this.params)
       this.$emit('onSuccess')
-      this.tool.showMessage(res,()=>{this.dialogFolderVisible = false})
-      res.code === 1?this.insertCoursewareauth(res.data.attachmentid):''
+      this.tool.showMessage(res, () => { this.dialogFolderVisible = false })
+      res.code === 1 ? this.insertCoursewareauth(res.data.attachmentid) : ''
     },
     // 新增授权范围
-    async insertCoursewareauth (attachmentid) {
+    async insertCoursewareauth(attachmentid) {
       this.authData.attachmentid = attachmentid
       const res = await this.$api.requested({
         "classname": "webmanage.saletool.salematerial.salematerialAuth",
         "method": "insertOrUpdate",
         "content": this.authData
       })
-      res.code === 0?this.$notify({
-        title:'失败',
-        message:res.data,
-        type:'error'
-      }):''
+      res.code === 0 ? this.$notify({
+        title: '失败',
+        message: res.data,
+        type: 'error'
+      }) : ''
     },
   }
 }

+ 84 - 71
src/HManagement/archvies_mag/modules/list.vue

@@ -1,51 +1,55 @@
 <template>
-  <div> 
-    <div  class="flex-align-center flex-between border-bottom container normal-panel">
+  <div>
+    <div class="flex-align-center flex-between border-bottom container normal-panel">
       <div class="flex-align-center">
         <slot name="upload"></slot>
         <slot name="add"></slot>
         <slot name="btngroup"></slot>
       </div>
       <div class="flex-align-center">
-        <el-input size="small" style="width:160px;margin-right:16px" prefix-icon="el-icon-search" v-model="params.content.where.condition" @keyup.enter.native="queryAttachment(params.content.pageNumber = 1)" @clear="queryAttachment(params.content.pageNumber = 1)" placeholder="搜索全部" clearable></el-input>
+        <el-input size="small" style="width:160px;margin-right:16px" prefix-icon="el-icon-search"
+          v-model="params.content.where.condition" @keyup.enter.native="queryAttachment(params.content.pageNumber = 1)"
+          @clear="queryAttachment(params.content.pageNumber = 1)" placeholder="搜索全部" clearable></el-input>
         <sort :sort="sort" @onSort="onSort"></sort>
-        <i class="el-icon-refresh" style="margin-left:16px" @click="queryAttachment(params.content.where.condition = '')"></i>
+        <i class="el-icon-refresh" style="margin-left:16px"
+          @click="queryAttachment(params.content.where.condition = '')"></i>
       </div>
     </div>
     <div ref="ele" id="scroll" style="height:calc(100vh - 255px);overflow-y:scroll" class="container normal-panel">
       <el-row :gutter="10" class="folder-list">
         <el-col :span="2" v-for="folder in list" :key="folder.id">
-          <div  class="folder-item" :class="folder.ischeck?'checked':''">
+          <div class="folder-item" :class="folder.ischeck ? 'checked' : ''">
             <el-checkbox class="folder-checkbox" v-model="folder.ischeck" @change="onChange(folder)"></el-checkbox>
             <div @click.stop="folderDetails(folder)" class="img-panel">
-              <img v-if="folder.postfix === 'DOC' || folder.postfix === 'DOCX'"  src="../../../assets/file_icons/word.png" alt="">
-              <img v-else-if="folder.postfix === 'PDF'"  src="../../../assets/file_icons/PDF.png" alt="">
-              <img v-else-if="folder.postfix === 'MP4' || folder.postfix === 'AVI'"  src="../../../assets/file_icons/video.png" alt="">
-              <img v-else-if="folder.postfix === 'XLS' || folder.postfix === 'XLSX'"  src="../../../assets/file_icons/excel.png" alt="">
-              <img v-else-if="folder.postfix === 'PNG' || folder.postfix === 'JPG'|| folder.postfix === 'JPEG'"  src="../../../assets/file_icons/image.png" alt="">
-              <img v-else-if="folder.postfix === 'PPT' || folder.postfix === 'PPTX'"  src="../../../assets/file_icons/PPT.png" alt="">
-              <img v-else-if="folder.postfix === 'FOLDER'"  src="../../../assets/file_icons/folder.png" alt="">
-              <img v-else  src="../../../assets/file_icons/unknow.png" alt="">
+              <img v-if="folder.postfix === 'DOC' || folder.postfix === 'DOCX'"
+                src="../../../assets/file_icons/word.png" alt="">
+              <img v-else-if="folder.postfix === 'PDF'" src="../../../assets/file_icons/PDF.png" alt="">
+              <img v-else-if="folder.postfix === 'MP4' || folder.postfix === 'AVI'"
+                src="../../../assets/file_icons/video.png" alt="">
+              <img v-else-if="folder.postfix === 'XLS' || folder.postfix === 'XLSX'"
+                src="../../../assets/file_icons/excel.png" alt="">
+              <img v-else-if="folder.postfix === 'PNG' || folder.postfix === 'JPG' || folder.postfix === 'JPEG'"
+                src="../../../assets/file_icons/image.png" alt="">
+              <img v-else-if="folder.postfix === 'PPT' || folder.postfix === 'PPTX'"
+                src="../../../assets/file_icons/PPT.png" alt="">
+              <img v-else-if="folder.postfix === 'FOLDER'" src="../../../assets/file_icons/folder.png" alt="">
+              <img v-else src="../../../assets/file_icons/unknow.png" alt="">
             </div>
-            <input v-if="folder.newfolder" type="text" v-model="folder.document" autofocus size="mini" @blur="changeFolderName(folder)">
+            <input v-if="folder.newfolder" type="text" v-model="folder.document" autofocus size="mini"
+              @blur="changeFolderName(folder)">
             <!-- <p v-else>{{folder.document}}</p> -->
-            <p v-else>{{folder.document}}</p>
+            <p v-else>{{ folder.document }}</p>
           </div>
         </el-col>
       </el-row>
-      <div v-if="list.length === 0" class="flex-align-center" style="height:calc(100vh - 200px);justify-content:space-around">
+      <div v-if="list.length === 0" class="flex-align-center"
+        style="height:calc(100vh - 200px);justify-content:space-around">
         <el-empty description="暂无文件,请点击左上角的“上传”按钮添加"></el-empty>
       </div>
     </div>
     <div style="margin:16px 0;text-align:right">
-      <el-pagination
-        background
-        small
-        @size-change="handleSizeChange"
-        @current-change="handleCurrentChange"
-        :current-page="currentPage"
-        :page-size="params.content.pageSize"
-        layout="total, prev, pager, next, jumper"
+      <el-pagination background small @size-change="handleSizeChange" @current-change="handleCurrentChange"
+        :current-page="currentPage" :page-size="params.content.pageSize" layout="total, prev, pager, next, jumper"
         :total="total">
       </el-pagination>
     </div>
@@ -54,39 +58,39 @@
 
 <script>
 export default {
-  data () {
+  data() {
     return {
-      params:{
+      params: {
         "classname": "webmanage.saletool.salematerial.salematerial",
         "method": "selectList",
         "content": {
-          "parentid":0,
-          "pageNumber":1,
-          "pageSize":20,
-            "where":{
-                "condition":""
-            }
+          "parentid": 0,
+          "pageNumber": 1,
+          "pageSize": 20,
+          "where": {
+            "condition": ""
+          }
         }
       },
-      list:[],
-      sort:[],
-      total:0,
-      currentPage:0,
-      isLoad:true,
-      msg:"正在加载"
+      list: [],
+      sort: [],
+      total: 0,
+      currentPage: 0,
+      isLoad: true,
+      msg: "正在加载"
     }
   },
-  methods:{
+  methods: {
     // 排序
-    onSort (sort) {
+    onSort(sort) {
       this.params.content.sort = [sort]
       this.queryAttachment(this.params.content.parentid)
     },
-    async queryAttachment () {
-      this.params.content.parentid = this.$route.query.id?this.$route.query.id:JSON.parse(sessionStorage.getItem('folderid')).appfolderid
+    async queryAttachment() {
+      this.params.content.parentid = this.$route.query.id ? this.$route.query.id : JSON.parse(sessionStorage.getItem("folderid")).salematerialfolderid
       const res = await this.$api.requested(this.params)
-      res.data.map(e=>{
-        e.postfix  = e.postfix.toUpperCase()
+      res.data.map(e => {
+        e.postfix = e.postfix.toUpperCase()
         e.ischeck = false
       })
       this.list = res.data
@@ -104,46 +108,46 @@ export default {
       this.params.content.pageNumber = val
       this.queryAttachment(this.params.content.parentid)
     },
-    changeFolderName (folder) {
-      this.$emit('onNameChange',folder)
+    changeFolderName(folder) {
+      this.$emit('onNameChange', folder)
     },
-    onChange (folder) {
+    onChange(folder) {
       let checkArray = []
-      this.list.forEach((e,index)=>{
+      this.list.forEach((e, index) => {
         if (e.ischeck === true) {
           checkArray.push(e)
         }
       })
-      this.$emit('folderChecked',checkArray)
+      this.$emit('folderChecked', checkArray)
     },
-    folderDetails (folder) {
+    folderDetails(folder) {
       if (folder.postfix === 'FOLDER') {
-        this.$router.push({path:'/archvies_mag',query:{id:folder.attachmentid}})
-        this.$emit('toFolderDetail',folder.attachmentid)
+        this.$router.push({ path: '/archvies_mag', query: { id: folder.attachmentid } })
+        this.$emit('toFolderDetail', folder.attachmentid)
         this.queryAttachment(folder.attachmentid)
       }
     },
-    restChecked () {
-      this.list.forEach((e,index)=>{
+    restChecked() {
+      this.list.forEach((e, index) => {
         e.ischeck = false
       })
     },
   },
 
-  mounted () {
+  mounted() {
     // 根据容器高度计算需要的数据条数
     var heightCss = window.getComputedStyle(this.$refs.ele).height
-    this.params.content.pageSize = Math.ceil((heightCss.match(/\d+/g) / 114)) *12
+    this.params.content.pageSize = Math.ceil((heightCss.match(/\d+/g) / 114)) * 12
     this.queryAttachment()
   },
   // 离开这个页面销毁滚动条事件,不然会给每一个页面都触发
   beforeDestroy() {
   },
-  watch:{
-    $route () {
+  watch: {
+    $route() {
       this.queryAttachment()
       // 路由发生变化的时候初始化选择数组
-      this.$emit('folderChecked',[])
+      this.$emit('folderChecked', [])
     }
   }
 }
@@ -152,16 +156,16 @@ export default {
 <style>
 .folder-item {
   position: relative;
-  padding:10px 5px;
+  padding: 10px 5px;
   text-align: center;
-  color:#333;
+  color: #333;
   margin-bottom: 15px;
   cursor: pointer;
   font-size: 14px;
   /* min-height: 110px; */
 }
 
-.folder-item p{
+.folder-item p {
   line-height: 25px;
   width: calc(100% - 20px);
   padding: 0 10px;
@@ -174,47 +178,56 @@ export default {
 
   -webkit-box-orient: vertical;
 
-  -webkit-line-clamp: 1; /* 这里是超出几行省略 */
+  -webkit-line-clamp: 1;
+  /* 这里是超出几行省略 */
 
   overflow: hidden;
 }
-.folder-item input{
+
+.folder-item input {
   width: calc(100% - 8px);
   padding: 2px;
-  margin-top:10px;
+  margin-top: 10px;
 }
+
 .img-panel {
   width: 64px;
   /* height: 64px; */
-  margin:0 auto;
+  margin: 0 auto;
   text-align: center;
 }
-.img-panel > img{
+
+.img-panel>img {
   width: 80%;
 }
-.folder-checkbox{
+
+.folder-checkbox {
   display: none;
   position: absolute;
-  top:5px;
+  top: 5px;
   left: 5px;
 }
-.checked{
+
+.checked {
   background: #f1f2f3;
   border-radius: 3px;
 }
+
 .checked .folder-checkbox {
   display: block;
 }
+
 .folder-item:hover .folder-checkbox {
   display: block;
 }
+
 .folder-item:hover {
   background: #f1f2f3;
   border-radius: 3px;
 }
 </style>
 <style scoped>
-.border-bottom{
+.border-bottom {
   border-bottom: 1px solid #f1f2f3;
 }
 </style>

+ 22 - 16
src/SManagement/archives/index.vue

@@ -8,11 +8,11 @@
       <!-- <select-panl :titleLists="titleLists" @CurrentSelectType="CurrentSelectType" ref="selectPanl" v-if="tool.checkAuth($route.name,'read')"></select-panl> -->
       <search @searchActive="searchActive" @clearData="clearData"></search>
       <!--切换最热最新-->
-      <hot-new-control @sortTypeChange="sortTypeChange" v-if="tool.checkAuth($route.name,'read')"></hot-new-control>
+      <hot-new-control @sortTypeChange="sortTypeChange" v-if="tool.checkAuth($route.name, 'read')"></hot-new-control>
     </div>
     <!--文件展示-->
     <file-list :fileData="fileData" @upFileData="upFileData" @statusChange="statusChange" :isCollect="true"
-      v-if="tool.checkAuth($route.name,'read')">
+      v-if="tool.checkAuth($route.name, 'read')">
     </file-list>
 
   </div>
@@ -27,17 +27,17 @@ import BreadCrumbs from '@/components/bread-crumbs/BreadCrumbs'
 import { log } from '@antv/g2plot/lib/utils'
 export default {
   name: 'index',
-  data () {
+  data() {
     return {
       params: {
         "accesstoken": "14fed62faa62714a6a1e2ebe2d3997e3",
         "classname": "saletool.salematerial.salematerial",
         "method": "selectList",
         "content": {
-          "nocache":true,
+          "nocache": true,
           "pageNumber": 1,
           "pageSize": 9999999999999,
-          "parentid": 1,
+          "parentid": JSON.parse(sessionStorage.getItem("folderid")).salematerialfolderid,
           "where": {
             "condition": "",
           }
@@ -88,29 +88,30 @@ export default {
   watch: {
 
   },
-  created () {
+  created() {
     this.getFileList()
     this.tempFileData[0].id = 1
   },
   methods: {
-    //获取文件数据
-    async getFileList () {
+    //获取文件数据 //salematerialfolderid
+    async getFileList() {
+      console.log(this.params)
       let res = await this.$api.requested(this.params)
       this.total = res.total
       this.params.content.sort = res.sort
       this.allFileData = this.fileType.fileList(res.data)
       this.fileData = this.filterFileData(this.allFileData, this.isType)
     },
-    searchActive (txt) {
+    searchActive(txt) {
       this.params.content.where.condition = txt
       this.getFileList()
     },
-    clearData () {
+    clearData() {
       this.params.content.where.condition = ''
       this.getFileList()
     },
     //监听文件夹单击事件
-    upFileData (parentid, name, id) {
+    upFileData(parentid, name, id) {
       this.params.content.parentid = id
       this.currentFileIndex = id
       this.tempFileData[this.tempFileData.length - 1].id = parentid
@@ -122,12 +123,12 @@ export default {
 
     },
     //监听类型选择组件发出的更改事件
-    CurrentSelectType (type) {
+    CurrentSelectType(type) {
       this.isType = type
       this.fileData = this.filterFileData(this.allFileData, type)
     },
     //面包屑发出的事件
-    BreadCrumbsChange (index) {
+    BreadCrumbsChange(index) {
       if (this.tempFileData.length <= 1) return
       this.isType = 'all'
       this.params.content.parentid = index
@@ -137,12 +138,12 @@ export default {
 
     },
     //修改收藏状态
-    statusChange (id, item) {
+    statusChange(id, item) {
       this.params.content.parentid = item.parentid
       this.getFileList()
     },
     //监听最热组件变化
-    sortTypeChange (name) {
+    sortTypeChange(name) {
       for (let i = 0; i < this.params.content.sort.length; i++) {
         this.params.content.sort[i].sorted = this.params.content.sort[i].sortname == name ? 1 : 0
       }
@@ -150,7 +151,7 @@ export default {
       this.currentFileIndex = 0
     },
     //数据过滤
-    filterFileData (file, type) {
+    filterFileData(file, type) {
       if (type == 'all') return file
       return file.filter(item => {
         return item.fileType == type
@@ -164,6 +165,7 @@ export default {
 * {
   box-sizing: border-box;
 }
+
 .normal-card {
   -webkit-user-select: none;
   -moz-user-select: none;
@@ -172,17 +174,21 @@ export default {
   min-height: 100%;
   position: relative;
 }
+
 .normal-card .el-breadcrumb {
   margin-bottom: 34px;
 }
+
 .normal-card .header-panl {
   display: flex;
   justify-content: space-between;
   margin-bottom: 30px;
 }
+
 .normal-card .header-panl .el-dropdown-link {
   display: flex;
 }
+
 .normal-card .header-panl .el-dropdown .el-dropdown-link .select {
   margin-left: 8px;
 }