Forráskód Böngészése

Merge branch 'master' of http://101.43.194.146:10101/root/supervision-ui

sunyanqiang 3 éve
szülő
commit
8fc90d646f

+ 9 - 1
src/api/regulations/directoryinfo.js

@@ -9,6 +9,14 @@ export function listDirectoryinfo(query) {
   })
 }
 
+// // 查询规章制度子分类列表
+// export function listDirectoryinfo1(id) {
+//   return request({
+//     url: `/regulations/directoryinfo/list?parentId=${id}`,
+//     method: 'get'
+//   })
+// }
+
 // 查询规章制度目录详细
 export function getDirectoryinfo(id) {
   return request({
@@ -38,7 +46,7 @@ export function updateDirectoryinfo(data) {
 // 删除规章制度目录
 export function delDirectoryinfo(id) {
   return request({
-    url: '/regulations/directoryinfo/' + id,
+    url: "/regulations/directoryinfo/" + id,
     method: 'delete'
   })
 }

+ 233 - 38
src/views/regulations/fileinfo/index.vue

@@ -110,7 +110,7 @@
         </tr>
       </table> -->
       <el-table
-          v-loading="loading"
+          v-loading="loading1"
           :data="list"
           @selection-change="handleSelectionChange"
           :header-cell-style="{ background: '#003C69', color: 'white' }"
@@ -196,7 +196,9 @@
       <!-- 目录 -->
       <div class="catalog">
         <div class="jichu">
-          目录 <span class="uploadfilesbtn" @click="upload">上传文件</span
+          目录
+          <el-button size="turnback" @click="turnback">返回</el-button> 
+          <span class="uploadfilesbtn" @click="upload">上传文件</span
           ><span class="manage" @click="mange">目录管理</span>
         </div>
         <el-table
@@ -207,7 +209,11 @@
         >
           <el-table-column label="序号" type="index" width="50">
           </el-table-column>
-          <el-table-column label="目录" align="center" prop="directory" />
+          <el-table-column label="目录" align="center" prop="directory" >
+            <template slot-scope="scope">
+              <div @click="mulus(scope.row)" :class="scope.row.subclassification==0? '' :'undeline'">{{scope.row.directory}}</div>
+            </template>
+          </el-table-column>
           <el-table-column
             label="子分类"
             align="center"
@@ -234,6 +240,14 @@
             </template>
           </el-table-column>
         </el-table>
+        <pagination
+        class="pagination"
+        v-show="total1 > 0"
+        :total="total1"
+        :page.sync="queryParams.pageNum"
+        :limit.sync="queryParams.pageSize"
+        @pagination="ListDirectoryinfo"
+      />
       </div>
       <!-- 排行 -->
       <div class="Ranking">
@@ -308,14 +322,16 @@
                 size="small"
               >
                 <el-option 
-                 v-for="item in directory"
+                 v-for="item in subclassification"
                   :key="item.id"
-                  :label="item.subclassification"
-                  :value="item.subclassification"></el-option>
+                  :label="item.directory"
+                  :value="item.directory"
+                  @click.native="soncategory(item.id)"
+                  ></el-option>
               </el-select>
             </el-form-item>
             <el-form-item style="margin-left: 30px; margin-top: 30px">
-              <fileUpload v-model="form.file" />
+              <span class="uploadfilesbtn"  @click="uoloadfiles">上传文件</span>
             </el-form-item>
           </el-form>
           <div slot="footer" class="dialog-footer">
@@ -324,6 +340,52 @@
           </div>
         </el-dialog>
       </div>
+      <!-- 上传文件 -->
+      <!-- 用户导入对话框 -->
+    <el-dialog
+      :title="upload1.title"
+      :visible.sync="upload1.open"
+      width="400px"
+      append-to-body
+    >
+      <el-upload
+        ref="upload1"
+        :limit="1"
+        accept=".xlsx, .xls"
+        :headers="upload1.headers"
+        :action="upload1.url + '?updateSupport=' + upload1.updateSupport"
+        :disabled="upload1.isUploading"
+        :on-progress="handleFileUploadProgress"
+        :on-success="handleFileSuccess"
+        :auto-upload="false"
+        drag
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">
+          将文件拖到此处,或
+          <em>点击上传</em>
+        </div>
+        <div class="el-upload__tip text-center" slot="tip">
+          <div class="el-upload__tip" slot="tip">
+            <!-- <el-checkbox
+              v-model="upload1.updateSupport"
+            /> -->
+          </div>
+          <span class="imports">仅允许导入xls、xlsx格式文件。</span>
+          <!-- <el-link
+            type="primary"
+            :underline="false"
+            style="font-size: 12px; vertical-align: baseline"
+            @click="importTemplate"
+            >下载模板</el-link
+          > -->
+        </div>
+      </el-upload>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitFileForm">确 定</el-button>
+        <el-button @click="open4 = false">取 消</el-button>
+      </div>
+    </el-dialog>
       <!-- 新建分类弹框 -->
       <el-dialog
         style="color: pink"
@@ -401,8 +463,9 @@ import {
 import {
   listDirectoryinfo,
   addDirectoryinfo,
-  delDirectoryinfo
+  delDirectoryinfo,
 } from "@/api/regulations/directoryinfo";
+import { getToken } from "@/utils/auth";
 export default {
   name: "Fileinfo",
   data() {
@@ -438,9 +501,10 @@ export default {
         },
       ],
       total: 10,
+      total1:"",
       queryParams: {
         pageNum: 1,
-        pageSize: 10,
+        pageSize: 5,
         catalog: "",
         category: "",
         fileName: null,
@@ -472,24 +536,116 @@ export default {
       rules: {},
       // 目录
       directory: [],
+      // 父节点id
+      parentId:"",
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 子分类
+      subclassification:[],
+      // 刷新
+      loading1:false,
+      //  用户导入参数
+       upload1: {
+        // 是否显示弹出层(用户导入)
+        open: false,
+        // 弹出层标题(用户导入)
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: { Authorization: "Bearer " + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/regulations/fileinfo/importData"
+      },
     };
   },
   created() {
     this.getList();
     // 获取目录接口
-    listDirectoryinfo().then((res) => {
-      this.directory = res.rows;
-      console.log(this.directory);
-    });
+    this.ListDirectoryinfo()
   },
   methods: {
+    soncategory(id){
+      this.form.directoryId=id
+      console.log(id)
+    },
+    ListDirectoryinfo(){
+      this.loading = true;
+      this.queryParams.common="1"
+      listDirectoryinfo(this.queryParams).then(res=>{
+        this.directory = res.rows;
+        this.total1=res.rows.length
+        this.loading = false;
+        console.log(this.directory);
+      })
+    },
+    // ListDirectoryinfo1(){
+    //   this.loading = true;
+    //   listDirectoryinfo(this.queryParams).then(res=>{
+    //     this.directory = res.rows;
+    //     this.total1=res.rows.length
+    //     this.loading = false;
+    //     console.log(this.directory);
+    //   })
+    // },
+    // 点击目录
+    mulus(row){
+      console.log(row.id)
+      this.parentId=row.id
+      listDirectoryinfo({parentId:this.parentId}).then(res=>{
+        console.log(res)
+        if(res.rows[0].subclassification==0){
+          this.directory=res.rows
+        }else{
+          return
+        }
+      })
+      // 绑定的数据 directory
+    },
+    // 上传文件
+    uoloadfiles(){
+      this.upload1.title="上传文件"
+      this.upload1.open=true
+    },
+    // /** 下载模板操作 */
+    // importTemplate() {
+    //   importTemplate().then(response => {
+    //     this.$download.name(response.msg);
+    //   });
+    // },
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload1.isUploading = true;
+    },
+    // 文件上传成功处理
+    handleFileSuccess(response, file, fileList) {
+      this.upload1.open = false;
+      this.upload1.isUploading = false;
+      this.$refs.upload1.clearFiles();
+      console.log(this.$refs.upload1)
+      this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
+      // this.getList();
+    },
+    // 提交上传文件
+    submitFileForm() {
+      this.$refs.upload1.submit()
+    },
+    // 返回目录
+    turnback(){
+      this.ListDirectoryinfo()
+    },
     // 选中父目录之后
     chooseDirect(id){
-      // 获取到父目录id了
+      // this.form.subclassification=""
+      this.subclassification=[]
       this.parentId=id
-      console.log(this.parentId)
-      listDirectoryinfo(this.form.parentId).then(res=>{
-        console.log(res.rows)
+      // 获取到父目录id了
+      listDirectoryinfo({parentId:this.parentId}).then(res=>{
+        this.subclassification=res.rows
       })
     },
     /** 查询规章制度文件记录列表 */
@@ -566,13 +722,13 @@ export default {
         //   if(item.directory==this.form.directory){
         //     // 目录id
         //     this.form.parentId=item.id
-        //     // if (valid) {
-        //     //   addFileinfo(this.form).then((response) => {
-        //     //   this.$modal.msgSuccess("上传成功");
-        //     //   this.open = false;
-        //     //   this.listDirectoryinfo();
-        //     // });
-        //     // }
+            if (valid) {
+              addFileinfo(this.form).then((response) => {
+              this.$modal.msgSuccess("上传成功");
+              this.open = false;
+              this.listDirectoryinfo();
+            });
+            }
         //     // console.log(this.form)
         //   }
         // })
@@ -590,13 +746,13 @@ export default {
       // 新建分类接口
       // addDirectoryinfo
       this.$refs["form1"].validate((valid) => {
-        console.log(this.form1);
         if (valid) {
           addDirectoryinfo(this.form1).then((response) => {
             this.$modal.msgSuccess("新增成功");
-            this.open1 = false;
-            this.loading = false;
-            this.listDirectoryinfo();
+            this.ListDirectoryinfo(); 
+             this.open1 = false;
+             this.form1={}
+            //  this.reset()
           });
         }
       });
@@ -609,23 +765,23 @@ export default {
           addDirectoryinfo(this.form2).then((response) => {
             this.$modal.msgSuccess("上传子分类成功");
             this.open2 = false;
-            this.loading = false;
-            this.getList();
+            this.form2={}
+            this.ListDirectoryinfo();
           });
         }
       });
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      const ids = row.id || this.ids;
-      console.log(row.id)
+      const ids = row.id 
+      console.log(ids)
       this.$modal
         .confirm('是否确认删除?')
         .then(function () {
           return delDirectoryinfo(ids);
         })
         .then(() => {
-          this.listDirectoryinfo();
+          this.ListDirectoryinfo();
           this.$modal.msgSuccess("删除成功");
         })
         .catch(() => {});
@@ -650,6 +806,7 @@ export default {
       this.reset();
       this.open = true;
       this.title = "上传文件";
+      this.ListDirectoryinfo()
     },
     // 目录管理
     mange() {
@@ -661,7 +818,7 @@ export default {
       console.log(row.id);
       // 传入父亲目录id
       this.form2.parentId = row.id;
-      console.log(this.form2.parentId)
+      // console.log(this.form2.parentId)
       this.open2 = true;
       this.title2 = "请输入子分类名称";
     },
@@ -714,7 +871,7 @@ export default {
 /* 文件表格 */
 .tablesfile {
   width: 1090px;
-  height: 960px;
+  height: 840px;
   background: #00365f;
   margin-left: 10px;
   /* height: auto; */
@@ -730,16 +887,22 @@ export default {
 /* 目录 */
 .catalog {
   width: 700px;
-  height: 470px;
+  height: 410px;
+  position: relative;
   /* height: auto; */
   /* display: flex; */
   margin-left: 10px;
   background-color: #00365f;
 }
+.pagination{
+  position: absolute;
+  bottom: 20px;
+  right: 10px;
+}
 /* 排行 */
 .Ranking {
   width: 700px;
-  height: 470px;
+  height: 410px;
   margin-left: 10px;
   background-color: #00365f;
   margin-top: 20px;
@@ -862,7 +1025,7 @@ table {
   border-radius: 4px;
   font-size: 14px;
   text-align: center;
-  margin-left: 450px;
+  margin-left: 360px;
   padding-right: 10px;
 }
 /* 目录管理 */
@@ -939,4 +1102,36 @@ table {
 ::v-deep .pagination-container{
   display: block !important;
 }
+/* 返回目录按钮 */
+.el-button--turnback{
+  color: #ffffff;
+  width: 60px;
+  height: 34px;
+  background-color: #1d96ff;
+  border-radius: 4px;
+  font-size: 14px;
+  line-height: 5px;
+  margin-left: 30px;
+  padding-left: 14px;
+}
+.undeline{
+  text-decoration: underline;
+  color: #1d96ff;
+  cursor: pointer;
+}
+/* 序号居中 */
+::v-deep .el-table_1_column_1{
+  text-align: center;
+}
+::v-deep .el-table_2_column_4{
+  text-align: center;
+}
+/* 导入按钮 */
+.imports{
+ color: skyblue;
+ display: inline-block;
+ margin-top: 30px;
+ margin-right: 150px;
+ /* padding-top: 10px; */
+}
 </style>