Kaynağa Gözat

修改确定弹窗的逻辑

chuwu 5 yıl önce
ebeveyn
işleme
a488fb7985

+ 37 - 8
src/views/point/config_point/steps/step2.vue

@@ -29,7 +29,7 @@
         <!-- <own-dialog :width="'1000px'" :index="true" title="关键内容设别——检查&微调" :dialogVisible="examineDialog" @cancel="close"> -->
         <!-- <find-keyword ref="findKeyword" :type="type"></find-keyword> -->
         <!-- <examine-main></examine-main>
-            </own-dialog> -->
+                </own-dialog> -->
         <own-dialog :width="'500px'" :index="true" title="位置标签" :dialogVisible="localtionDialog" @cancel="localFalgChange">
             <localtion-falg :renderData="renderData" @changeTag="changeLoc"></localtion-falg>
         </own-dialog>
@@ -122,7 +122,6 @@
             },
             //刷新
             reset() {
-                console.log(this.changeFlag, "changeFlag")
                 if (!this.changeFlag) {
                     this.$confirm("表格数据尚未保存,确定刷新吗?").then(_ => {
                         this.saveData()
@@ -131,9 +130,7 @@
                         this.pages.size = this.oldPage.size
                         this.getData()
                     })
-                } else {
-                    this.getData()
-                }
+                } else {}
             },
             //删除点位
             delePoint(delData) {
@@ -186,7 +183,35 @@
                     this.title = "关键内容识别——批量识别设备参数关键字"
                     this.type = "arguments"
                 }
-                this.isChangeData()
+                this.isChangeDo(this.dialogDo,this.elseDo,true)
+            },
+            isChangeDo(func,elseDo,falg = false){
+                if (!this.changeFlag) {
+                    //发生更改,提示是否保存
+                    this.$confirm('存在数据未保存, 是否继续?', '提示', {
+                        confirmButtonText: '确定',
+                        cancelButtonText: '取消',
+                        type: 'warning'
+                    }).then(() => {
+                        func(falg)
+                    }).catch(() => {
+                        elseDo()
+                    });
+                } else {
+                    func(falg)
+                }
+            },
+            //否则
+            elseDo(){
+                this.pages.currentPage = this.oldPage.currentPage
+                this.pages.size = this.oldPage.size
+                return false
+            },
+            //处理弹窗
+            dialogDo(flag){
+                if(!!flag && !this.changeFlag){
+                    this.changeFlag = !this.changeFlag
+                }
                 this.isDialogShow = true
                 this.$nextTick(() => {
                     this.$refs.findKeyword.changeType(this.type)
@@ -210,13 +235,17 @@
             },
             //点击检查按钮
             examine() {
-                this.isChangeData()
+                this.isChangeDo(this.examineTrue,this.elseDo,true)
+            },
+            examineTrue(flag){
+                if(!!flag && !this.changeFlag){
+                    this.changeFlag = !this.changeFlag
+                }
                 this.examineDialog = true
             },
             //保存
             saveData(falg) {
                 if (!!this.hot) {
-                    console.log(this.hot.getSourceData())
                     let data = this.hot.getSourceData(),
                         changeData;
                     changeData = data.map(item => {

Dosya farkı çok büyük olduğundan ihmal edildi
+ 921 - 935
src/views/project_setting/collection_setting/index.vue