123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- $(function(){
- //页面白底区块,设置最低高度
- if($(".main-wrapper").length>0)
- {
- $(".main-wrapper").css("min-height",($(window).height()-100)+'px');
- }
- if($(".main-wrapper-inner").length>0)
- {
- $(".main-wrapper-inner").css("min-height",($(window).height()-0)+'px');
- }
- })
- //编辑器中的弹框被遮挡了,得做个处理
- function fixUeditorLayer()
- {
- setInterval(function(){
- if($('#edui_fixedlayer').length>0)
- {
- var zindex = $('#edui_fixedlayer').css('z-index');
- if(zindex<9000)
- {
- $('#edui_fixedlayer').css('z-index','9999');
- }
- }
- if($('.edui-editor-toolbarbox').css('position')=='fixed'){
- $('.edui-editor-toolbarbox').css('position','absolute');
- }
- },300);
- }
- //表单数据转json
- $.fn.serializeJson=function(){
- var serializeObj={};
- var array=this.serializeArray();
- // var str=this.serialize();
- $(array).each(function(){ // 遍历数组的每个元素
- if(serializeObj[this.name]){ // 判断对象中是否已经存在 name,如果存在name
- if($.isArray(serializeObj[this.name])){
- serializeObj[this.name].push(this.value); // 追加一个值 hobby : ['音乐','体育']
- }else{
- // 将元素变为 数组 ,hobby : ['音乐','体育']
- serializeObj[this.name]=[serializeObj[this.name],this.value];
- }
- }else{
- serializeObj[this.name]=this.value; // 如果元素name不存在,添加一个属性 name:value
- }
- });
- return serializeObj;
- };
- //美化下拉选择框
- $('select.form-select').each(function(){
- if(!$(this).hasClass('original')){
- dselect(this);
- }
- })
- //删除操作
- function delConfirm(url)
- {
- var url = url;
- Swal.fire({
- icon: "warning",
- title: "确认删除吗?",
- html: "<h5>删除后无法恢复!</h5>",
- buttonsStyling: false,
- showCancelButton: true,
- confirmButtonColor: "#556ee6",
- cancelButtonColor: '#d33',
- width:'28em',
- customClass: {
- confirmButton: 'btn btn-success mt-2 me-2',
- cancelButton: 'btn btn-danger mt-2',
- content: 'tex'
- },
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- allowOutsideClick: () => !Swal.isLoading(),
- showLoaderOnConfirm: true,
- preConfirm: () => {
- return fetch(url,{method:'get',headers: {"Content-Type": "application/json"}}).then(response => {
- return response.json();
- }).then(result => {
- if(result.error==0){
- Swal.fire({
- icon: "success",
- title: result.msg,
- width:'28em',
- buttonsStyling: false,
- customClass: {
- confirmButton: 'btn btn-primary mt-2'
- }
- }).then(function(oper) {
- if (oper.isConfirmed) {
- reLoad();
- }
- })
- }else{
- Swal.fire({
- icon: "error",
- title: result.msg,
- width:'28em',
- buttonsStyling: false,
- customClass: {
- confirmButton: 'btn btn-primary mt-2'
- }
- })
- }
- })
- }
- }).then(function(result) {
- if (result.isConfirmed) {
- } else if (result.isDenied) {
- //do nothing
- }
- })
- }
- //批量删除操作
- function multiDelConfirm(url,ids)
- {
- if(ids.length==0)
- {
- Swal.fire({
- icon: "warning",
- title: '您没有选中任何记录',
- width:'28em',
- buttonsStyling: false,
- customClass: {
- confirmButton: 'btn btn-primary mt-2'
- }
- })
- return;
- }
- var url = url;
- url = url.split("?");
- var params = [];
- if(url[1]!='')
- {
- params = url[1].split("&");
- }
- params[params.length]="ids="+ids.join(",");
- var newUrl = url[0]+'?'+params.join("&");
- Swal.fire({
- icon: "warning",
- title: "确认删除吗?",
- html: "<h5>删除后无法恢复!</h5>",
- buttonsStyling: false,
- showCancelButton: true,
- confirmButtonColor: "#556ee6",
- cancelButtonColor: '#d33',
- width:'28em',
- customClass: {
- confirmButton: 'btn btn-success mt-2 me-2',
- cancelButton: 'btn btn-danger mt-2',
- content: 'tex'
- },
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- allowOutsideClick: () => !Swal.isLoading(),
- showLoaderOnConfirm: true,
- preConfirm: () => {
- return fetch(newUrl,{method:'get',headers: {"Content-Type": "application/json"}}).then(response => {
- return response.json();
- }).then(result => {
- if(result.error==0){
- Swal.fire({
- icon: "success",
- title: result.msg,
- width:'28em',
- buttonsStyling: false,
- customClass: {
- confirmButton: 'btn btn-primary mt-2'
- }
- }).then(function(oper) {
- if (oper.isConfirmed) {
- reLoad();
- }
- })
- }else{
- Swal.fire({
- icon: "error",
- title: result.msg,
- width:'28em',
- buttonsStyling: false,
- customClass: {
- confirmButton: 'btn btn-primary mt-2'
- }
- })
- }
- })
- }
- }).then(function(result) {
- if (result.isConfirmed) {
- } else if (result.isDenied) {
- //do nothing
- }
- })
- }
- //批量操作
- function multiOperate(url,ids)
- {
- if(ids.length==0)
- {
- Swal.fire({
- icon: "warning",
- title: '您没有选中任何记录',
- width:'28em',
- buttonsStyling: false,
- customClass: {
- confirmButton: 'btn btn-primary mt-2'
- }
- })
- return;
- }
- var url = url;
- url = url.split("?");
- var params = [];
- if(url[1]!='')
- {
- params = url[1].split("&");
- }
- params[params.length]="ids="+ids.join(",");
- var newUrl = url[0]+'?'+params.join("&");
- Swal.fire({
- icon: "warning",
- title: "确认执行该操作吗?",
- html: "<h5>执行后无法撤回!</h5>",
- buttonsStyling: false,
- showCancelButton: true,
- confirmButtonColor: "#556ee6",
- cancelButtonColor: '#d33',
- width:'28em',
- customClass: {
- confirmButton: 'btn btn-success mt-2 me-2',
- cancelButton: 'btn btn-danger mt-2',
- content: 'tex'
- },
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- allowOutsideClick: () => !Swal.isLoading(),
- showLoaderOnConfirm: true,
- preConfirm: () => {
- return fetch(newUrl,{method:'get',headers: {"Content-Type": "application/json"}}).then(response => {
- return response.json();
- }).then(result => {
- if(result.error==0){
- Swal.fire({
- icon: "success",
- title: result.msg,
- width:'28em',
- buttonsStyling: false,
- customClass: {
- confirmButton: 'btn btn-primary mt-2'
- }
- }).then(function(oper) {
- if (oper.isConfirmed) {
- reLoad();
- }
- })
- }else{
- Swal.fire({
- icon: "error",
- title: result.msg,
- width:'28em',
- buttonsStyling: false,
- customClass: {
- confirmButton: 'btn btn-primary mt-2'
- }
- })
- }
- })
- }
- }).then(function(result) {
- if (result.isConfirmed) {
- } else if (result.isDenied) {
- //do nothing
- }
- })
- }
|