AJAX: 对话框大全



javascript 复制代码
AJAX:
  $.ajax({
  url: "/admin/cutting/getDataWeek",
  type: "GET",
  data:{
  
        },
  dataType:'json',
  success: function (res) {
     if (res.code == 1) {

     }
   },
   error:function (error) {
      console.log('请求失败');
      console.log(error);
   }
 });      	

 $('.sub').unbind('click').click(function() {
    var id = $(this).data('id');
    swal({
      title: "确认完成后,数据将不可再修改?",
      type: "warning",
      showCancelButton: true,
      confirmButtonColor: "#DD6B55",
      confirmButtonText: "确认",
      showLoaderOnConfirm: true,
      cancelButtonText: "取消",
      preConfirm: function() {
        return new Promise(function(resolve) {
          $.ajax({
            method: 'post',
            url: '/admin/patfabric/checksuccess',
            data: {
              id:id,
              type:2,
              _token:LA.token,
            },
            success: function (data) {
               $.pjax.reload('#pjax-container');
               resolve(data);
            }
         });
       });
     }
   }).then(function(result) {
      var data = result.value;
      if (typeof data === 'object') {
        if (data.status) {
           swal(data.message, '', 'success');
        } else {
           swal(data.message, '', 'error');
      }
    }
  });
});	



 supplyCheck:function () {
  this.$confirm('确认审批通过, 是否继续?', '提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning'
  }).then(() => {
     $.ajax({
        url:"/feed_check_store",
        data:{'_token':'{{ csrf_token() }}','user_id':this.user_id)},
        type:'POST',
        cache:false,
        dataType:'json',
        success: function (res) {
          location.reload();
        },
        error: function (xhr, textStatus, errorThrown) {
          }
        });
        this.$message({
           type: 'success',
           message: '审批通过!'
         });
       }).catch(() => {
        this.$message({
          type: 'info',
          message: '取消操作'
        });
      });
  },

 checkBack:function () {
    this.$prompt('请输入驳回原因', '提示', {
       confirmButtonText: '确定',
       cancelButtonText: '取消',
    }).then(({ value }) => {
      $.ajax({
         url:"/feed_check_store",
         data:{'_token':'{{ csrf_token() }}','user_id':this.user_id,'id':this.feed_id,'reject_remark': value},
               type:'POST',
               cache:false,
               dataType:'json',
               success: function (res) {
                 location.reload();
               },
               error: function (xhr, textStatus, errorThrown) {
               }
            });
            this.$message({
              type: 'success',
              message: '驳回完成!'
            });
         }).catch(() => {
           this.$message({
             type: 'info',
             message: '取消操作'
           });
                 // this.$notify({
                 //   title: '警告',
                 //   message: data.message,
                 //   type: 'warning'
                 // });

                 //this.$alert(res.msg, '提示', {
                 //       confirmButtonText: '确定',
                 //});

                 //sweetAlert(res.msg);

 		 //swal(data.msg, '', 'error');
         });
 },
相关推荐
xcLeigh4 分钟前
HTML5实现好看的视频播放器(三种风格,附源码)
前端·音视频·html5
TE-茶叶蛋6 分钟前
html5-qrcode扫码功能
前端·html·html5
2501_906467637 分钟前
HTML5结合Vue3实现百万文件分块上传的思路是什么?
前端·html·html5·vue上传解决方案·vue断点续传·vue分片上传下载·vue分块上传下载
San30.7 分钟前
现代前端工程化实战:从 Vite 到 React Router demo的构建之旅
前端·react.js·前端框架
kirinlau9 分钟前
vue3+vite+scss项目使用tailwindcss
前端·css·scss
阿贾克斯的黎明11 分钟前
现代前端的魔法标签:HTML5 语义化标签全解析
前端·html·html5
菠菜盼娣14 分钟前
vue3知识点
前端·vue.js
JIngJaneIL18 分钟前
基于java+ vue建筑材料管理系统(源码+数据库+文档)
java·开发语言·前端·数据库·vue.js·spring boot
土豆125020 分钟前
终端自治时代的 AI 开发范式:Claude Code CLI 全方位实操指南
前端·人工智能·程序员