天天看点

Vue 弹确认框Vue 弹确认框

Vue 弹确认框

delet(record) {

      var that = this

      const uritest = '/dataElement/delete/'.concat(record.dataElementId)

      this.$confirm({

        // 询问是或否确定删除

        title: '确定要删除该数据吗?',

        content: '该操作不可撤销',

        okText: '确定',

        okType: 'danger',

        cancelText: '取消',

        onOk() {

          axios({

            url: '/doDelete',

            method: 'get',

            params: {

              api: uritest

            }

          }).then(res => {

            if (res.msg === '删除成功') {

              that.$message.success('删除成功')

            } else {

              that.$message.success('删除失败')

            }

          })

          setTimeout(() => {

            that.$refs.collectionForm.resetFields()

            that.dialogStatus = ''

            that.visible = false

            that.getMenuList()

            that.getTable(that.selectrowkey)

          }, 200)

        },

        oncancel() {

          that.$message.waring('操作已取消')

        }

      })

    }