yangbifan 2 лет назад
Родитель
Сommit
7c1286c6d7
3 измененных файлов с 89 добавлено и 36 удалено
  1. 3 1
      src/components/upload.vue
  2. 1 1
      src/http/index.js
  3. 85 34
      src/pages/main/onlineOffice/index.vue

+ 3 - 1
src/components/upload.vue

@@ -9,7 +9,7 @@
                 <div class="el-upload__text">点击上传</div>
             </div>
             <div v-if="fileInfo.type === 'btn'">
-                <el-button :size="fileInfo.size?fileInfo.size:'medium'" :type="fileInfo.btntype">{{fileInfo.typename}}</el-button>
+                <el-button :size="fileInfo.size?fileInfo.size:'medium'" icon="el-icon-upload" :type="fileInfo.btntype">{{fileInfo.typename}}</el-button>
             </div>
         </el-upload>
     </div>
@@ -113,6 +113,7 @@
                 this.$http({
                     url: this.fileInfo.url,
                     method: "post",
+                    type:this.fileInfo.urlType ?this.fileInfo.urlType :'',
                     headers: {
                         "Content-Type": "application/json",
                     },
@@ -120,6 +121,7 @@
                 }).then((res) => {
                     if (this.fileInfo.type === 'btn') {
                         this.$refs['upload'].clearFiles();
+                        console.log(res);
                         this.$emit('uploadBack',res)
                         if(res.data.result==0){
                             this.$emit('onSuccess',file)

+ 1 - 1
src/http/index.js

@@ -13,7 +13,7 @@ axios.defaults.baseURL = 'http://43.138.50.94:9600/';
     axios.interceptors.request.use(function (config) {
         console.log(config);
         if(config.type === 'office'){
-            config.baseURL = 'http://150.158.79.10:7779'
+            config.baseURL = 'http://192.168.2.124:7779'
         }else{
             config.baseURL = 'http://43.138.50.94:9600/'
         }

+ 85 - 34
src/pages/main/onlineOffice/index.vue

@@ -1,24 +1,33 @@
 <template>
     <div class="flex-count">
-        <el-col :span="12">
-    <span class="demonstration">新建+</span>
-    <el-dropdown trigger="click">
-      <span class="el-dropdown-link">
-        下拉菜单<i class="el-icon-arrow-down el-icon--right"></i>
-      </span>
-      <el-dropdown-menu slot="dropdown">
-        <el-dropdown-item icon="el-icon-plus">黄金糕</el-dropdown-item>
-        <el-dropdown-item icon="el-icon-circle-plus">狮子头</el-dropdown-item>
-        <el-dropdown-item icon="el-icon-circle-plus-outline">螺蛳粉</el-dropdown-item>
-        <el-dropdown-item icon="el-icon-check">双皮奶</el-dropdown-item>
-        <el-dropdown-item icon="el-icon-circle-check">蚵仔煎</el-dropdown-item>
-      </el-dropdown-menu>
-    </el-dropdown>
-  </el-col>
-        <fromList :list="firstTable" @clickDemand="clickDemand" />
+        <div class="flex-header-count">
+            <el-popover placement="right-start" width="460" v-model="visible">
+                <el-form ref="form" :model="form" label-width="80px">
+                    <el-form-item label="文档名称">
+                        <el-input v-model="form.fileName"></el-input>
+                    </el-form-item>
+                    <el-form-item label="文档类型">
+                        <el-select v-model="form.docType" placeholder="请选择文档类型">
+                            <el-option label="word" value="word"></el-option>
+                            <el-option label="cell" value="cell"></el-option>
+                            <el-option label="slide" value="slide"></el-option>
+                        </el-select>
+                    </el-form-item>
+                </el-form>
+                <div style="text-align: right; margin: 0">
+                    <el-button type="primary" @click="visible = false">取消</el-button>
+                    <el-button type="primary" @click="clickNewSave">确定</el-button>
+                </div>
+                <el-button size="medium" slot="reference" icon="el-icon-circle-plus-outline">新建</el-button>
+            </el-popover>
+            <myUpload style="margin-left:20px ;" @uploadBack="uploadBack" :fileInfo="fileInfo"
+                :fileList="fileInfo.fileList">
+            </myUpload>
+        </div>
+
+        <fromList  @changeNum="changeNum" :list="firstTable" @clickDemand="clickDemand" />
         <div>
-            <!-- <myUpload @uploadBack="uploadBack" :fileInfo="fileInfo" :fileList="fileInfo.fileList">
-        </myUpload> -->
+
             <el-dialog :modal="false" title="提示" :visible.sync="officeStatus" style="height:100% ;" width="100%"
                 height="100%" center>
                 <div id="DocEditor" v-if="officeStatus">
@@ -46,32 +55,41 @@ export default {
     },
     data() {
         return {
+            dataList:[],
+            page:1,
+            searchData:'',
+            limit:10,
+            form: {},
+            visible: false,
             saveStatus: false,
             officeStatus: false,
             src: '',
             config: {},
             fileInfo: {
                 limit: 10,
-                url: '/aps/api/file/upload',
+                type: 'btn',
+                typename: '导入',
+                urlType: 'office',
+                url: '/office/file/upload',
                 fileList: []
             },
             firstTable: {
-                height: '400',
+                height: '520',
                 name: "first",
                 titledata: [
                     {
                         label: "名称",
                         prop: "fileName",
-                        width: 400,
+                        width: 600,
                     },
                     {
-                        label: "文件Id",
-                        prop: "id",
+                        label: "最后修改时间",
+                        prop: "lastModifyTimeStr",
                         width: 400,
                     },
                     {
-                        label: "未确定字段",
-                        prop: "fileSize",
+                        label: "文件大小",
+                        prop: "fileSizeStr",
                         width: 400,
                     },
                 ], //表格头
@@ -84,7 +102,7 @@ export default {
                 },
                 isSelection: false, // 表格有多选时设置
                 isOperation: false, // 表格有操作列时设置
-                isIndex: false, // 列表序号
+                isIndex: true, // 列表序号
                 operation: {
                     // 表格有操作列时设置
                     label: "操作", // 列名
@@ -106,9 +124,14 @@ export default {
         this.getLists()
     },
     methods: {
+        uploadBack(e) {
+            this.form = {};
+            this.getLists();
+        },
+
         //新建在线编辑xxx
         clickNewSave() {
-            this.saveStatus = true
+            // this.saveStatus = true
             this.$http({
                 url: "/office/file/create",
                 method: "post",
@@ -116,11 +139,13 @@ export default {
                 headers: {
                     "Content-Type": "application/json",
                 },
-                data: {
-
-                },
+                data: this.form
             }).then((res) => {
-                this.firstTable.data = res.data.body;
+                this.page = 1;
+                this.$message.success('新建成功')
+                this.form = {}
+                this.getLists();
+                this.visible = false;
 
             });
         },
@@ -184,21 +209,44 @@ export default {
 
                 },
             }).then((res) => {
-                this.firstTable.data = res.data.body;
+                this.dataList = res.data.body;
+                this.currentPage(res.data.body)
+                this.firstTable.pageData.total = res.data.body.length;
+
 
             });
         },
         onReady(editor) {
             console.log('[ editor ] >', editor)
         },
-        uploadBack() {
-
+        currentPage(e) {
+            console.log(e);
+            let list = e.filter((item, index) =>
+                item.fileName.includes(this.searchData)
+            )
+            this.firstTable.data = list.filter((item, index) =>
+                index < this.page * this.limit && index >= this.limit * (this.page - 1)
+            )
+        },
+        changeNum(e){
+           this.page = e;
+           this.currentPage(this.dataList)
         }
     },
 };
 </script>
 
 <style lang="scss" scoped>
+.flex-header-count {
+    padding: 20px;
+    display: flex;
+}
+
+.el-dropdown-link {
+    margin: 20px;
+    position: relative;
+}
+
 ::v-deep .el-dialog--center {
     height: 100%;
     margin-top: 10px !important;
@@ -216,4 +264,7 @@ export default {
     height: 100%;
     background: #fff;
 }
+::v-deep .el-pagination{
+    background-color: #fff !important;
+}
 </style>