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');
         });
 },
相关推荐
Re2751 分钟前
小白也能懂!HTTP和WebSocket的区别,用点外卖和打电话讲明白
前端
OpenTiny社区6 分钟前
TinyVue表格重构 5 大关键帧一次曝光!内存节省 27%,JS 执行时间减少 43% ,FPS 提升 110%
前端·javascript·vue.js
Fly-ping24 分钟前
【前端八股文面试题】【JavaScript篇3】DOM常⻅的操作有哪些?
前端
2301_8109703928 分钟前
Wed前端第二次作业
前端·html
不浪brown34 分钟前
全部开源!100+套大屏可视化模版速来领取!(含源码)
前端·数据可视化
iOS大前端海猫35 分钟前
drawRect方法的理解
前端
姑苏洛言1 小时前
有趣的 npm 库 · json-server
前端
知否技术1 小时前
Vue3项目中轻松开发自适应的可视化大屏!附源码!
前端·数据可视化
Hilaku1 小时前
为什么我坚持用git命令行,而不是GUI工具?
前端·javascript·git
用户adminuser1 小时前
深入理解 JavaScript 中的闭包及其实际应用
前端