Parcourir la source

在线文档新需求

fan il y a 2 ans
Parent
commit
e40a583843

+ 75 - 4
public/static/views/onlineShareExcel.html

@@ -176,7 +176,7 @@
                     initExcel(res.body.excelJson);
                 }
             });
-            initExcel()
+            //initExcel()
         }
 
         // 表格初始化
@@ -324,6 +324,77 @@
                 if (isAdmin) {
                     $("#newShareBtn").show();
                 }
+                console.log("执行自动保存定时器")
+                var t1 = window.setInterval(function autoSave() {
+                    console.log("执行自动保存")
+                    var excelId = $(window.parent.document).find("#excelId").attr("value");
+                    var sheetName = luckysheet.getSheet().name;
+                    var excelData = luckysheet.getSheet(sheetName);
+                    var urlsave = '/market/cOnlineExcel/saveExcel';
+                    var editFrom = $("#editFrom").val();
+                    var editTo = $("#editTo").val();
+                    var editStatus = $("#editStatus").val();
+                    var excelName = luckysheet.toJson().title;
+                    if ($.trim(editFrom) == '' && $.trim(editTo) == '') {
+
+                    } else if (/^\d*$/.test(editFrom) && /^\d*$/.test(editTo)) {
+                        if (editFrom == 0) {
+                            window.top.$vm.$message({
+                                message: '自动保存出错:可编辑列开始不能为0',
+                                type: 'info'
+                            })
+                            return;
+                        }
+                        if (editFrom > editTo) {
+                            window.top.$vm.$message({
+                                message: '自动保存出错:可编辑列的起始列不能大于结束列',
+                                type: 'info'
+                            })
+                            return;
+                        }
+                    } else if (/^[a-zA-Z]+$/.test(editFrom) && /^[a-zA-Z]+$/.test(editTo)) {
+
+                    } else {
+                        window.top.$vm.$message({
+                            message: '自动保存出错:可编辑列必须全部为字母或数字',
+                            type: 'info'
+                        });
+                        return;
+                    }
+                    util.ajaxJson("正在加载中", ctx + '/market/cOnlineExcel/checkExcelEmpty', {
+                        data: excelData,
+                    }, function (data) {
+                        if (data.result == 1) {
+                            window.top.$vm.$message({
+                                message: data.desc,
+                                type: 'error'
+                            });
+                        } else {
+                            util.ajaxJson("正在加载中", ctx + urlsave, {
+                                data: excelData,
+                                id: excelId,
+                                editConStart: editFrom,
+                                editConEnd: editTo,
+                                excelName: excelName,
+                                editStatus: editStatus
+                            }, function (data) {
+                                if (data.result == 1) {
+                                    window.top.$vm.$message({
+                                        message: data.desc,
+                                        type: 'error'
+                                    })
+                                } else {
+                                    window.top.$vm.$message({
+                                        message: '自动保存成功',
+                                        type: 'info'
+                                    });
+                                    //console.log(data);
+                                    //getData()
+                                }
+                            });
+                        }
+                    });
+                }, 60000)
             }
             if (excelInfo.shareStatus == '1') {
                 $("#editTo").attr('disabled', true);
@@ -404,7 +475,7 @@
                 window.parent['backToExcelList']('true');
             })
             $("#fullScreen").on("click", function () {
-                if (fullScreenState){
+                if (fullScreenState) {
                     fullScreenState = false;
                     $("#fullScreen").html('全屏显示');
                 } else {
@@ -420,7 +491,7 @@
             })
             //分享
             $('#share').off("click").click(function () {
-                if (fullScreenState){
+                if (fullScreenState) {
                     fullScreenState = false;
                     $("#fullScreen").html('全屏显示');
                     window.parent['fullScreen']('true');
@@ -429,7 +500,7 @@
             });
             //新增分享
             $('#newShare').off("click").click(function () {
-                if (fullScreenState){
+                if (fullScreenState) {
                     fullScreenState = false;
                     $("#fullScreen").html('全屏显示');
                     window.parent['fullScreen']('true');

+ 46 - 0
src/components/myMessageRadio.vue

@@ -0,0 +1,46 @@
+<template>
+    <div class="myMessage">
+        <el-dialog title="提示" :visible.sync="centerDialogVisible" top="30vh" width="30%" :close-on-press-escape="false"
+                   :show-close="true" :destroy-on-close="true" :modal-append-to-body="false"
+                   :close-on-click-modal="false" :before-close="realClose">
+            <div style="height: 70px;line-height: 30px;overflow: hidden;">
+                <i class="el-icon-warning" style="font-size: 30px;float:left;padding:0 10px;color: orange;"></i>
+                <span style="height: 30px;line-height: 30px;display: inline-block;float:left">{{ messTit }}</span><br/>
+                <div style="margin-left: 40px">
+                        <el-radio v-model="radioStatus" label="1" style="margin: 10px">{{ yesBtnName }}</el-radio>
+                        <el-radio v-model="radioStatus" label="2" style="margin: 10px">{{ noBtnName }}</el-radio>
+                </div>
+            </div>
+            <span slot="footer" class="dialog-footer">
+                <el-button size="small" type="primary" @click="closemessage()">{{ okBtnName }}</el-button>
+            </span>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+export default {
+    props: ["centerDialogVisible", "messTit", 'type', 'yesBtnName', 'noBtnName', 'okBtnName'],
+    data() {
+        return {
+            radioStatus: '2'
+        };
+    },
+    methods: {
+        closemessage(v) {
+            this.$emit("closeMessage", this.radioStatus)
+        },
+        realClose(v) {
+            this.$emit("closeMessage", '3')
+        }
+    },
+    mounted() {
+    },
+    created() {
+    },
+};
+</script>
+
+
+<style>
+</style>

+ 9 - 5
src/pages/main/onlineExcel/index.vue

@@ -196,8 +196,8 @@
             </el-dialog>
             <myMessage :messTit='messTit' @closeMessage="processDel" :centerDialogVisible="delVisible"
                        v-if="delVisible"></myMessage>
-            <myMessageNew :messTit='oaTitle' @closeMessage="processOa" :centerDialogVisible="oaVisible"
-                          v-if="oaVisible" yesBtnName="是" noBtnName="否"></myMessageNew>
+            <myMessageRadio :messTit='oaTitle' @closeMessage="processOa" :centerDialogVisible="oaVisible"
+                          v-if="oaVisible" yesBtnName="是" noBtnName="否" ok-btn-name="提交"></myMessageRadio>
         </div>
     </fullscreen>
 </template>
@@ -207,6 +207,7 @@ import pForm from "../../../components/p-form";
 import toolList from "../../../components/toolList";
 import myMessage from "../../../components/myMessage.vue";
 import myMessageNew from "../../../components/myMessageNew.vue";
+import myMessageRadio from "../../../components/myMessageRadio.vue";
 import deptTreeUserNew from "../../../components/deptTreeUserNew.vue"
 
 export default {
@@ -215,6 +216,7 @@ export default {
         toolList,
         myMessage,
         myMessageNew,
+        myMessageRadio,
         deptTreeUserNew,
     },
     data() {
@@ -359,13 +361,15 @@ export default {
         },
         //判断是否提交oa待办
         processOa(v) {
+            console.log(v);
             if (v == 1) {
                 this.oaType = 1;
-            } else {
+                this.processExcelShare(this.shareType);
+            } else if (v == 2){
                 this.oaType = 0;
+                this.processExcelShare(this.shareType);
             }
             this.oaVisible = false;
-            this.processExcelShare(this.shareType);
         },
         //打开oa待办选项框
         openOADialog(shareType) {
@@ -392,7 +396,7 @@ export default {
             //提交
             var url = '/market/cOnlineExcel/saveExcelShare';
             if (this.addShareType == '2') {
-                url = '/market/cOnlineExcel/addExcelShare';
+                url = '/market/cOnlineExcel/reShare';
             }
             this.$http({
                 url: url,