ソースを参照

confirm弹出框取消事件处理

ZhangWenQiang 6 年 前
コミット
23739c5ac7
1 ファイル変更44 行追加30 行削除
  1. 44 30
      src/views/hpuser/UserList.vue

+ 44 - 30
src/views/hpuser/UserList.vue

@@ -36,31 +36,31 @@
 
     <!-- 操作按钮区域 -->
     <!--<div class="table-operator">-->
-      <!--<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
-      <!--<a-button type="primary" icon="download" @click="handleExportXls('用户审核')">导出</a-button>-->
-      <!--<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"-->
-                <!--@change="handleImportExcel">-->
-        <!--<a-button type="primary" icon="import">导入</a-button>-->
-      <!--</a-upload>-->
-      <!--<a-dropdown v-if="selectedRowKeys.length > 0">-->
-        <!--<a-menu slot="overlay">-->
-          <!--<a-menu-item key="1" @click="batchDel">-->
-            <!--<a-icon type="delete"/>-->
-            <!--删除-->
-          <!--</a-menu-item>-->
-        <!--</a-menu>-->
-        <!--<a-button style="margin-left: 8px"> 批量操作-->
-          <!--<a-icon type="down"/>-->
-        <!--</a-button>-->
-      <!--</a-dropdown>-->
+    <!--<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
+    <!--<a-button type="primary" icon="download" @click="handleExportXls('用户审核')">导出</a-button>-->
+    <!--<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"-->
+    <!--@change="handleImportExcel">-->
+    <!--<a-button type="primary" icon="import">导入</a-button>-->
+    <!--</a-upload>-->
+    <!--<a-dropdown v-if="selectedRowKeys.length > 0">-->
+    <!--<a-menu slot="overlay">-->
+    <!--<a-menu-item key="1" @click="batchDel">-->
+    <!--<a-icon type="delete"/>-->
+    <!--删除-->
+    <!--</a-menu-item>-->
+    <!--</a-menu>-->
+    <!--<a-button style="margin-left: 8px"> 批量操作-->
+    <!--<a-icon type="down"/>-->
+    <!--</a-button>-->
+    <!--</a-dropdown>-->
     <!--</div>-->
 
     <!-- table区域-begin -->
     <div>
       <!--<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">-->
-        <!--<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{-->
-        <!--selectedRowKeys.length }}</a>项-->
-        <!--<a style="margin-left: 24px" @click="onClearSelected">清空</a>-->
+      <!--<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{-->
+      <!--selectedRowKeys.length }}</a>项-->
+      <!--<a style="margin-left: 24px" @click="onClearSelected">清空</a>-->
       <!--</div>-->
 
       <a-table
@@ -93,8 +93,9 @@
 <script>
   import UserModal from './modules/UserModal'
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
-  import { getAction,deleteAction,putAction,postAction} from '@/api/manage'
-  const auditHpUser = (params)=>putAction("/user/user/audit",params);
+  import { getAction, deleteAction, putAction, postAction } from '@/api/manage'
+
+  const auditHpUser = (params) => putAction('/user/user/audit', params)
 
   export default {
     name: 'UserList',
@@ -159,28 +160,41 @@
       }
     },
     methods: {
+      close() {
+        this.$emit('close')
+        this.visible = false
+      },
       audit: function(record) {
         let that = this
-        that.$confirm({
+        const modal = that.$confirm({
           title: '审核',
           content: '确认审核通过?',
-          okText:"通过",
-          cancelText:"不通过",
+          okText: '通过',
+          cancelText: '不通过',
+          closable: true,
+          keyboard: false,
+          maskClosable: true,
           onOk: function() {
-            auditHpUser({ id: record.id,authenticationStatus:3 }).then((res) => {
+            auditHpUser({ id: record.id, authenticationStatus: 3 }).then((res) => {
               if (res.success) {
                 that.$message.success(res.message)
-                that.loadData();
+                that.loadData()
               } else {
                 that.$message.warning(res.message)
               }
             })
           },
-          onCancel:function() {
-            auditHpUser({ id: record.id,authenticationStatus:2 }).then((res) => {
+          onCancel: function(e) {
+            //区别于取消按钮
+            if (e.triggerCancel) {
+              return
+            }
+            //关闭弹窗
+            modal.destroy()
+            auditHpUser({ id: record.id, authenticationStatus: 2 }).then((res) => {
               if (res.success) {
                 that.$message.success(res.message)
-                that.loadData();
+                that.loadData()
               } else {
                 that.$message.warning(res.message)
               }