Browse Source

成本添加自动保存

yuanrf 1 year ago
parent
commit
ae52c38ee7
1 changed files with 23 additions and 7 deletions
  1. 23 7
      src/components/Finance/Cost.vue

+ 23 - 7
src/components/Finance/Cost.vue

@@ -312,10 +312,12 @@
                             </div>
                             <div v-else-if="item.width == 100">
                                 <div v-if="item.label == 'ITIN'">
-                                    <el-input type="textarea" @input="capslk(scope.row[item.prop],scope.$index,)" :rows="6" placeholder="请输入内容" v-model="scope.row[item.prop]"></el-input>
+                                    <el-input type="textarea" @input="capslk(scope.row[item.prop], scope.$index,)"
+                                        :rows="6" placeholder="请输入内容" v-model="scope.row[item.prop]"></el-input>
                                 </div>
                                 <div v-else-if="item.label == 'ACCO N'">
-                                    <el-input style="position: relative;" type="textarea" :rows="6" placeholder="请输入内容" v-model="scope.row[item.prop]"></el-input>
+                                    <el-input style="position: relative;" type="textarea" :rows="6" placeholder="请输入内容"
+                                        v-model="scope.row[item.prop]"></el-input>
                                     <!-- <div class="accon-ul">
                                         <div class="accon-li">asas</div>
                                         <div class="accon-li">asas</div>
@@ -324,7 +326,8 @@
                                     </div> -->
                                 </div>
                                 <div v-else>
-                                    <el-input type="textarea" :rows="6" placeholder="请输入内容" v-model="scope.row[item.prop]"></el-input>
+                                    <el-input type="textarea" :rows="6" placeholder="请输入内容"
+                                        v-model="scope.row[item.prop]"></el-input>
                                 </div>
                             </div>
                             <div v-else-if="item.prop == 'b' || item.prop == 'l' || item.prop == 'd'">
@@ -2639,7 +2642,8 @@ export default {
                     "singleTips": "会务费人均\n",
                     "width": 60,
                 }
-            ]
+            ],
+            autoSave: null,
         };
     },
     watch: {
@@ -2678,8 +2682,8 @@ export default {
 
     },
     methods: {
-        capslk(val,index){
-            this.tableData[index].itin=val.toUpperCase()
+        capslk(val, index) {
+            this.tableData[index].itin = val.toUpperCase()
         },
         getSummaries(param) {
             var that = this;
@@ -5444,11 +5448,22 @@ export default {
     },
     destroyed() {
         this.$emit('transfer', false)
+        clearInterval(this.autoSave);
     },
     mounted() {
         this.token = JSON.parse(localStorage.getItem('userinif')).token;
         this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
         var costLoadData = localStorage.getItem('costLoadData');
+        const mm = 1000 * 60;
+        if (this.userId == 21) {
+            this.autoSave = setInterval(() => {
+                this.$message.success('自动保存中...');
+                setTimeout(() => {
+                    this.save();
+                }, 100);
+            }, mm * 3);
+        }
+
         document.querySelectorAll('.el-table__footer')[0].style.display = "none"
         if (costLoadData) {
             var JSONP = JSON.parse(costLoadData);
@@ -5760,7 +5775,8 @@ export default {
     cursor: pointer;
     color: #000;
 }
-.accon-ul{
+
+.accon-ul {
     position: absolute;
     box-shadow: #0005 0 0 10px;
     width: 200px;