From 50ee24192f24f16b2f6114e4c681e98956411887 Mon Sep 17 00:00:00 2001
From: hawind
Date: Fri, 18 Jun 2021 17:31:48 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E5=B8=83=E4=BB=8E=E6=B5=8B=E8=AF=95?=
=?UTF-8?q?=E7=89=88=E6=9C=AC2.3.4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Changelog.md | 11 +-
README.md | 2 +-
app/Gdoo/Index/Controllers/Controller.php | 2 +-
app/Gdoo/Model/Form.php | 21 ++-
.../Model/views/permission/create.blade.php | 8 +-
app/Gdoo/Order/views/order/create.blade.php | 4 +
app/Gdoo/Order/views/report/city.blade.php | 10 +-
app/Gdoo/Order/views/report/single.blade.php | 2 +-
app/Gdoo/User/Controllers/RoleController.php | 7 -
app/Gdoo/User/views/role/config.blade.php | 1 +
database/{gdoo-2.3.3.sql => gdoo-2.3.4.sql} | 130 ++++++++++--------
public/assets/dist/gdoo.min.js | 2 +-
public/assets/js/aggrid/form.js | 1 +
public/assets/js/model.js | 4 +-
public/mix-manifest.json | 2 +-
15 files changed, 119 insertions(+), 88 deletions(-)
rename database/{gdoo-2.3.3.sql => gdoo-2.3.4.sql} (96%)
diff --git a/Changelog.md b/Changelog.md
index dc6e89b1..41c6fb56 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -13,4 +13,13 @@
4.修复首页待办事项不显示
5.修复菜单badge不显示
6.删除废弃的工作流程模块
-本版本更新了个别sql需要重新导入
\ No newline at end of file
+本版本更新了个别sql需要重新导入
+
+2021-06-18 开源测试版 2.3.4发布
+修正
+1.角色权限设置错乱
+2.区域销售品类表无数据判断报错
+新增
+1.单据权限设置子表是否必填选项
+
+本版本sql文件导入可选,没有不兼容修改
\ No newline at end of file
diff --git a/README.md b/README.md
index 9a35cab2..225a4ec9 100644
--- a/README.md
+++ b/README.md
@@ -89,7 +89,7 @@ QQ交流群: 79446405
## 安装
-1. 推荐使用宝塔面板,安装nginx 1.18.x、php-8.x(需要扩展:fileinfo)、mysql-8.x(mariaDB 10.4.x),如果你使用win请自行安装相关环境
+1. 推荐使用宝塔面板,安装nginx 1.18.x、php-8.x(需要扩展:fileinfo)、mysql-8.x(mariaDB 10.4.x),如果你使用win请自行安装相关环境,修改php参数max_input_vars = 100000 (避免变量部分丢失)
2. 创建网站和数据库, 数据库字符utf8mb4, 在网站目录中设置PHP命令行版本为php-80
3. 下载gdoo: https://gitee.com/hawind/gdoo 上传至宝塔网站根目录并解压
4. 打开Xshell并登录, 执行 composer -v
查看composer版本, 执行 composer self-update
升级composer至最新版本
diff --git a/app/Gdoo/Index/Controllers/Controller.php b/app/Gdoo/Index/Controllers/Controller.php
index 4850ef72..3fc2a323 100644
--- a/app/Gdoo/Index/Controllers/Controller.php
+++ b/app/Gdoo/Index/Controllers/Controller.php
@@ -15,7 +15,7 @@ class Controller extends BaseController
/**
* @var 程序版本
*/
- public $version = '2.3.3';
+ public $version = '2.3.4';
/**
* @var 配置参数
diff --git a/app/Gdoo/Model/Form.php b/app/Gdoo/Model/Form.php
index 6f02a251..03191fd4 100644
--- a/app/Gdoo/Model/Form.php
+++ b/app/Gdoo/Model/Form.php
@@ -1472,12 +1472,16 @@ class Form
$tabContent .= '';
}
+ // 保存时数据不能为空
+ $saveDataNotEmpty = in_array('required', (array)$permission_option['v']);
+
$_options = [
'columns' => $columns,
'data' => $rows,
'links' => $links,
'table' => $model['table'],
'title' => $model['name'],
+ 'saveDataNotEmpty' => $saveDataNotEmpty,
];
$js = 'gdoo.forms["'.$model['table'].'"] = gridForms("' . $table . '","' . $model['table'] . '", ' . json_encode($_options, JSON_UNESCAPED_UNICODE) . ');';
@@ -1718,7 +1722,20 @@ class Form
$field = $fields[$key];
$_rules = (array)$row['v'];
if ($_rules) {
- $t = $model['type'] == 1 ? $table . '.rows.*.' . $key : $table . '.' . $key;
+
+ $field_name = $fields[$key]['name'];
+
+ if ($model['type'] == 1) {
+ if ($key == '@option') {
+ $t = $table . '.rows';
+ $field_name = $model->name;
+ } else {
+ $t = $table . '.rows.*.' . $key;
+ }
+ } else {
+ $t = $table . '.' . $key;
+ }
+
$data_type = $field['data_type'];
$data_field = $field['data_field'];
$data_link = $field['data_link'];
@@ -1740,7 +1757,7 @@ class Form
}
}
$rules[$t] = join('|', $_rules);
- $attributes[$t] = $fields[$key]['name'];
+ $attributes[$t] = $field_name;
}
}
}
diff --git a/app/Gdoo/Model/views/permission/create.blade.php b/app/Gdoo/Model/views/permission/create.blade.php
index 2d69d44f..21672271 100644
--- a/app/Gdoo/Model/views/permission/create.blade.php
+++ b/app/Gdoo/Model/views/permission/create.blade.php
@@ -80,12 +80,10 @@
{{$submodel->table}}@option
|
+ |
+ |
- |
-
- |
-
- | ");if(0==listView.field[e].readonly){var o=i>0?'删除":'添加';t.push(''+o+" | ")}$("#body_"+e).append(t.join("\n")),listView.total[e]++},deleteRow:function(e,t){var a=t.parentNode.parentNode;a.parentNode.removeChild(a),listView.footerSum(e)},init:function(e){listView.total[e]=0;for(var t=listView.data[e].length>0?listView.data[e].length:1,a=0;a 过滤'+t.tableTitle,modalClass:"no-padder",dialogClass:"modal-sm",buttons:[{text:"确定",classed:"btn-info",click:function(){t.api.setQuickFilter(a.find("input").val()),i.dialog("close")}},{text:"取消",classed:"btn-default",click:function(){i.dialog("close")}}]}).on("keydown",(function(e){13==e.keyCode&&(t.api.setQuickFilter(a.find("input").val()),i.dialog("close"))}))},closeRow:function(e){var t=this,a=gdoo.forms[e],i=a.api.getSelectedRows();if(i.length>0){var o=i[0].id;top.$.messager.confirm("操作提醒","是否要关闭选中的行数据?",(function(i){if(1==i){var n=showLoading();$.post(app.url(t.bill_url+"/closeRow"),{table:e,id:o},(function(e){e.status?(toastrSuccess(e.data),a.remoteData()):toastrError(e.data)}),"json").complete((function(){layer.close(n)}))}}))}else toastrError("最少选择一行记录。")},closeAllRow:function(e){var t=this,a=gdoo.forms[e],i=[];a.api.forEachNode((function(e){i.push(e.data.id)})),i.length>0?top.$.messager.confirm("操作提醒","是否要关闭所有行数据?",(function(o){if(1==o){var n=showLoading();$.post(app.url(t.bill_url+"/closeAllRow"),{table:e,ids:i},(function(e){e.status?(toastrSuccess(e.data),a.remoteData()):toastrError(e.data)}),"json").complete((function(){layer.close(n)}))}})):toastrError("最少选择一行记录。")}};e.flow=i}(window),function(e){window.gridAction=function(t,a){this.name=a,this.table=t,this.dialogType="dialog",this.show=function(t,a,i){var o=this;if(1!=t.flow_form_edit){var n=app.url(o.bill_url+"/show",{id:t.master_id});"dialog"==o.dialogType?viewDialog({title:o.name,dialogClass:"modal-lg",url:n,close:function(){e(this).dialog("close")}}):(isEmpty(a)&&(a=o.bill_url.replace(/\//g,"_")+"_show"),isEmpty(i)&&(i=o.name),top.addTab(o.bill_url+"/show?id="+t.master_id,a,i))}else o.audit(t)},this.import=function(){var t=this,a=gdoo.grids[t.table].grid;formDialog({title:"数据导入",url:app.url(t.bill_url+"/import"),dialogClass:"modal-md",id:"import-dialog",onSubmit:function(){var i=new FormData;i.append("file",e("#import_file")[0].files[0]);var o=showLoading();e.ajax({url:app.url(t.bill_url+"/import"),type:"POST",data:i,processData:!1,contentType:!1,complete:function(){layer.close(o)},success:function(t){t.status?(e("#modal-import-dialog").dialog("close"),a.remoteData(),toastrSuccess(t.data)):toastrError(t.data)}})}})},this.delete=function(){var t=this,a=gdoo.grids[t.table].grid,i=a.api.getSelectedRows(),o=[];if(e.each(i,(function(e,t){o.push(t.master_id)})),o.length>0){var n=o.length+"个"+t.name+"将被删除?";top.$.messager.confirm("删除"+t.name,n,(function(i){if(1==i){var n=showLoading();e.post(app.url(t.bill_url+"/delete"),{id:o},(function(e){e.status?(toastrSuccess(e.data),a.remoteData()):toastrError(e.data)}),"json").complete((function(){layer.close(n)}))}}))}else toastrError("最少选择一行记录。")},this.created_by=function(t){var a=gdoo.grids[this.table].grid;formDialog({title:"私信",url:app.url("user/message/create",{user_id:t.id}),storeUrl:app.url("model/form/store"),id:"user_message",dialogClass:"modal-md",success:function(t){toastrSuccess(t.data),a.remoteData(),e(this).dialog("close")},error:function(e){toastrError(e.data)}})},this.create=function(){var t=this,a=gdoo.grids[t.table].grid;if("dialog"==t.dialogType)formDialog({title:"新建"+t.name,url:app.url(t.bill_url+"/create"),storeUrl:app.url(t.bill_url+"/store"),id:t.table,table:t.table,dialogClass:"modal-lg",success:function(t){toastrSuccess(t.data),a.remoteData(),e(this).dialog("close")},error:function(e){toastrError(e.data)}});else{var i=t.bill_url.replace(/\//g,"_")+"_show";top.addTab(t.bill_url+"/create",i,t.name)}},this.edit=function(t){var a=this,i=gdoo.grids[a.table].grid;if("dialog"==a.dialogType)formDialog({title:"编辑"+a.name,url:app.url(a.bill_url+"/edit",{id:t.master_id}),storeUrl:app.url(a.bill_url+"/store"),id:a.table,table:a.table,dialogClass:"modal-lg",success:function(t){toastrSuccess(t.data),i.remoteData(),e(this).dialog("close")},error:function(e){toastrError(e.data)}});else{var o=a.bill_url.replace(/\//g,"_")+"_show";top.addTab(a.bill_url+"/edit?id="+t.master_id,o,a.name)}},this.audit=function(t){var a=this,i=gdoo.grids[a.table].grid;if("dialog"==a.dialogType)formDialog({title:"审核"+a.name,url:app.url(a.bill_url+"/audit",{id:t.master_id}),storeUrl:app.url(a.bill_url+"/store"),id:a.table,table:a.table,dialogClass:"modal-lg",success:function(t){toastrSuccess(t.data),i.remoteData(),e(this).dialog("close")},error:function(e){toastrError(e.data)}});else{var o=a.bill_url.replace(/\//g,"_")+"_show";top.addTab(a.bill_url+"/audit?id="+t.master_id,o,a.name)}},this.batchEdit=function(){var t=gdoo.grids[this.table].grid,a=t.api.getSelectedRows(),i=[];e.each(a,(function(e,t){i.push(t.master_id)})),i.length>0?formDialog({title:"批量编辑",dialogClass:"modal-sm",id:"batch-edit-form",url:app.url(this.bill_url+"/batchEdit",{ids:i.join(",")}),success:function(a){toastrSuccess(a.data),t.remoteData(),e(this).dialog("close")},close:function(){e(this).dialog("close")}}):toastrError("最少选择一行记录。")},this.export=function(){LocalExport(gdoo.grids[this.table].grid,this.name)},this.filter=function(){var t=gdoo.grids[this.table],a=t.grid,i=t.search;e(i.advanced.el).dialog({title:"高级搜索",modalClass:"no-padder",buttons:[{text:"取消",class:"btn-default",click:function(){e(this).dialog("close")}},{text:"确定",class:"btn-info",click:function(){var t=i.advanced.el.serializeArray(),o={};return i.queryType="advanced",e.map(t,(function(e){o[e.name]=e.value})),o.page=1,a.remoteData(o),e(this).dialog("close"),!1}}]})}}}(jQuery);var select2List={},dialogCacheSelected={};$((function(){var e=$(document);e.ajaxError((function(e,t){t.responseJSON&&toastrError(t.responseJSON.message)}));var t=e.find(".input-select2");t.length&&t.select2(),e.tooltip({container:"body",placement:"auto",selector:".hinted",delay:{show:200,hide:0}}),$(".select-all").on("click",(function(){var e=$(".select-row").closest("tr");$(this).prop("checked")?e.addClass("success"):e.removeClass("success"),$(".select-row").prop("checked",$(this).prop("checked"))})),e.on("click",'[data-toggle="closetab"]',(function(){if(window.name)var e=window.name.replace("iframe_","");else e=$(this).data("id");top.$.addtabs.close({id:"tab_"+e})})),$(".table tbody tr").on("click",(function(e){var t=$(this),a=t.find(".select-row"),i=a.prop("checked");function o(e){e?t.addClass("success"):t.removeClass("success"),a.prop("checked",e)}0!=a.length&&("INPUT"==e.target.tagName&&o(i),"DIV"==e.target.tagName&&o(!i),"TD"==e.target.tagName&&o(!i))})),e.on("change",'[data-toggle="redirect"]',(function(){var e=$(this).data("url"),t=$(this).attr("id"),a=$(this).find("option:selected").val();location.href=e.replace(new RegExp("("+t+"=)[^&]*","g"),"$1"+a)})),e.on("click.dialog.search",'[data-toggle="dialog-clear"]',(function(){var e=$(this).data();$("#"+e.id).val(""),$("#"+e.id+"_text").val(""),gdoo.event.get(e.id).trigger("clear",e)})),e.on("click.dialog.view",'[data-toggle="dialog-view"]',(function(){var e=$(this).data(),t={};$.each(e,(function(e,a){if("url"==e||"title"==e||"toggle"==e)return!0;t[e]=a}));var a=getIframeName();a&&(t.iframe_id=a);var i=gdoo.formKey(e),o=gdoo.event.get(i.key);o.trigger("open",e,t);var n=e.url,r=e.title;n=app.url(n,t);$.dialog({title:r,url:n,dialogClass:"modal-lg",buttons:[{text:"取消",class:"btn-default",click:function(){$(this).dialog("close")}},{text:"确定",class:"btn-info",click:function(){var t=gdoo.dialogs[i.id];t?!0===gdoo.dialogSelected(o,e,i,t)&&$(this).dialog("close"):$(this).dialog("close")}}]})}));var a=e.find(".gdoo-dialog-input");a.length&&a.gdooDialogInput(),e.on("click.dialog.image",'[data-toggle="dialog-image"]',(function(){var e=$(this).data();$.dialog({title:e.title,html:'
',buttons:[{text:"确定",class:"btn-default",click:function(){$(this).dialog("close")}}]})})),e.on("click.dialog.form",'[data-toggle="dialog-form"]',(function(){var e=$(this).data();e.id=e.id||"myform",e.size=e.size||"md",$.dialog({title:e.title,url:e.url,dialogClass:"modal-"+e.size,buttons:[{text:"取消",class:"btn-default",click:function(){"function"==typeof error?error.call(this,res):$(this).dialog("close")}},{text:"保存",class:"btn-info",click:function(){var t=this,a=$("#"+e.id).attr("action"),i=$("#"+e.id).serialize();$.post(a,i,(function(e){"function"==typeof success?success.call(t,e):e.status?"reload"==e.data?window.location.reload():(toastrSuccess(e.data),$(t).dialog("close")):toastrError(e.data)}),"json")}}]})})),e.on("click.date",'[data-toggle="date"]',(function(){var e=$(this).data(),t={};t.dateFmt=e.format||"yyyy-MM-dd";var a=window[this.id+".onpicked"];"function"==typeof a&&(t.onpicked=a),e.dchanging&&(t.dchanging=e.dchanging),datePicker(t)})),e.on("click.datetime",'[data-toggle="datetime"]',(function(){var e=$(this).data(),t={};t.dateFmt=e.format||"yyyy-MM-dd HH:mm",e.dchanging&&(t.dchanging=e.dchanging),datePicker(t)})),e.on("click.frame.close",'[data-toggle="layer-frame-close"]',(function(){var e=parent.layer.getFrameIndex(window.name);parent.layer.close(e)})),e.on("click.frame.url",'[data-toggle="layer-frame-url"]',(function(){var e=$(this).data("url"),t=$(this).data("title")||!1,a=$(this).data("skin")||"frame",i=$(this).data("close")||!1;layer.open({skin:"layui-layer-"+a,scrollbar:!1,closeBtn:i,title:t,type:2,move:!1,area:["100%","100%"],content:e})})),e.on("click.tab.frame",'[data-toggle="tab-frame-url"]',(function(){var e=$(this).data("url"),t=$(this).data("id"),a=$(this).data("name");top.addTab(e,t,a)})),e.on("click",'[data-toggle="media-delete"]',(function(){var e=$(this).parent();$(this).closest(".media-controller").find(".media-item").length>1?e.remove():(e.find("img").attr("src",app.url("assets/images/nopic.jpg")),e.find("input").val(""))})),$("a.image-show").hover((function(e){var t=$(this).data(),a=$('
');$("body").append(a),$(this).find("img").stop().fadeTo("slow",.5);var i=$(window),o=$(document).find("#image"),n=o.height(),r=o.width(),l=(i.scrollLeft(),i.width(),i.scrollTop()+(i.height()-n)/2+"px"),s=$(this).offset();o.css({left:s.left+100,top:l}),o.fadeIn("fast")}),(function(){$(this).find("img").stop().fadeTo("slow",1),$("#image").remove()})),$("#table-sortable tbody").sortable({delay:50,cursor:"move",axis:"y",items:"tr",handle:"td.move",helper:function(e,t){return t.children().each((function(){$(this).width($(this).width())})),t},stop:function(e,t){},start:function(e,t){t.placeholder.outerHeight(t.item.outerHeight())},update:function(){var e=$(this).parent().attr("url"),t=$(this).sortable("toArray");$.post(e,{sort:t},(function(e){toastrSuccess(e.data)}))}})}));var app={confirm:function(e,t,a){a=a||"操作警告",$.messager.confirm(a,t,(function(t){1==t&&(location.href=e)}))},alert:function(e,t){$.messager.alert(e,t)},url:function(e,t){return"/"==e?settings.public_url:(query=""==t||void 0===t?"":"?"+$.param(t),settings.public_url+"/"+e+query)},redirect:function(e,t){return window.location.href=app.url(e,t)},pinyin:function(e,t,a){a=a||"first",""==$("#"+t).val()&&$.get(app.url("index/api/pinyin?type="+a+"&id="+Math.random()),{name:$("#"+e).val()},(function(e){$("#"+t).val(e)}))}},uploader={file:function(e){var t=$("#"+e).find(".id").val();location.href=app.url("index/attachment/download",{id:t})},cancel:function(e){var t=$("#"+e).find(".id").val();if(t>0){var a=$("#"+e).find(".file-name a").text();$.messager.confirm("删除文件","确定要删除 "+a+" 此文件吗",(function(a){1==a&&$.get(app.url("index/attachment/delete"),{id:t},(function(t){1==t&&$("#"+e).remove()}))}))}else $("#"+e).remove()},insert:function(e){var t=$("#"+e).find(".id").val(),a=$("#"+e).find(".file-name a").text();if(/\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(a))var i='
';else i=''+a+"";UE.getEditor("content").execCommand("insertHtml",i)}};function mediaDialog(e,t,a,i){var o={id:a,name:t,multi:i};e=app.url(e,o);$.dialog({title:"媒体管理",url:e,dialogClass:"modal-lg",buttons:[{text:' 取消',class:"btn-default",click:function(){$(this).dialog("close")}},{text:' 确定',class:"btn-info",click:function(){window.saveMedia&&(window.saveMedia.call(this,o),$(this).dialog("close"))}}]})}function viewBox(e,t,a,i){i=i||"md",$.dialog({title:t,url:a,dialogClass:"modal-"+i,buttons:[{text:"确定",class:"btn-default",click:function(){$(this).dialog("close")}}]})}var viewDialogIndex=0;function viewDialog(e){void 0===e.id&&(e.id="view-dialog-"+viewDialogIndex,viewDialogIndex++);var t=$("#modal-"+e.id);t.length>0&&t.dialog("show");var a={title:name,url,buttons:[{text:"确定",class:"btn-default",click:function(){$(this).dialog("close")}}]},i=$.extend({},a,e);$.dialog(i)}var formDialogIndex=0;function formDialog(e){void 0===e.id&&(e.id="form-dialog-"+formDialogIndex,formDialogIndex++);var t=$("#modal-"+e.id);if(t.length>0)t.dialog("show");else{var a={title:"formDialog",backdrop:"static",buttons:[{text:"取消",class:"btn-default",click:function(){"function"==typeof error?error.call(this):$(this).dialog("close")}},{text:"保存",class:"btn-info",click:function(){var e=this,t=e.options;if("function"==typeof t.onSubmit)t.onSubmit.call(e);else{if(e.options.storeUrl)var a=e.options.storeUrl;else a=$("#"+t.id).attr("action");var i=$("#"+t.id).serialize(),o=gridListData(t.table);if(!1===o)return;var n=showLoading();$.post(a,i+"&"+$.param(o),(function(a){a.status?"function"==typeof t.success&&t.success.call(e,a):"function"==typeof t.error&&t.error.call(e,a)}),"json").complete((function(){layer.close(n)}))}}}]},i=$.extend({},a,e);$.dialog(i)}}function niceTime(e){var t=(new Date).getTime(),a=parseInt((t-1e3*e)/1e3);return a>=0&&a<60?a+"秒前":a>=60&&a<3600?parseInt(a/60)+"分钟前":a>=3600&&a<86400?parseInt(a/3600)+"小时前":parseInt(a/86400)+"天前"}function ucfirst(e){return e?e[0].toUpperCase()+e.substr(1):e}function digitUppercase(e){var t=["角","分"],a=["零","壹","贰","叁","肆","伍","陆","柒","捌","玖"],i=[["元","万","亿"],["","拾","佰","仟"]],o=e<0?"欠":"";e=Math.abs(e);for(var n="",r=0;r0;r++){for(var l="",s=0;s0;s++)l=a[e%10]+i[1][s]+l,e=Math.floor(e/10);n=l.replace(/(零.)*零$/,"").replace(/^$/,"零")+i[0][r]+n}return o+n.replace(/(零.)*零元/,"元").replace(/(零.)+/g,"零").replace(/^整$/,"零元整")}function number_format(e,t,a,i){e=(e+"").replace(/[^0-9+\-Ee.]/g,"");var o=isFinite(+e)?+e:0,n=isFinite(+t)?Math.abs(t):0,r=void 0===i?",":i,l=void 0===a?".":a,s="";return(s=(n?function(e,t){if(-1===(""+e).indexOf("e"))return+(Math.round(e+"e+"+t)+"e-"+t);var a=(""+e).split("e"),i="";return+a[1]+t>0&&(i="+"),(+(Math.round(+a[0]+"e"+i+(+a[1]+t))+"e-"+t)).toFixed(t)}(o,n).toString():""+Math.round(o)).split("."))[0].length>3&&(s[0]=s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,r)),(s[1]||"").length]+>/g,"")}function isWeiXin(){return"micromessenger"==window.navigator.userAgent.toLowerCase().match(/MicroMessenger/i)}function toastrSuccess(e){isWeiXin()?$.toastr("success",e):top.$.toastr("success",e)}function toastrError(e){isWeiXin()?$.toastr("error",e):top.$.toastr("error",e)}function url(e,t){return query=""==t||void 0===t?"":"?"+$.param(t),settings.public_url+"/"+e+query}function format_datetime(e){function t(e){return e<10?"0"+e:e}e=1e3*parseInt(e);var a=new Date(e),i=a.getFullYear(),o=a.getMonth()+1,n=a.getDate(),r=a.getHours(),l=a.getMinutes();a.getSeconds();return i+"-"+t(o)+"-"+t(n)+" "+t(r)+":"+t(l)}function format_date(e){function t(e){return e<10?"0"+e:e}e=1e3*parseInt(e);var a=new Date(e),i=a.getFullYear(),o=a.getMonth()+1,n=a.getDate();a.getHours(),a.getMinutes(),a.getSeconds();return i+"-"+t(o)+"-"+t(n)}function ajaxSubmit(e,t){$("#"+e+"-form-submit").on("click",(function(){var a=$("#"+e),i=a.attr("action"),o=a.serialize(),n={};if(!1!==(n=gridListData(e))){o=o+"&"+$.param(n);var r=showLoading();return $.post(i,o,(function(e){"function"==typeof t?t(e):e.status?(toastrSuccess(e.data),e.url&&(self.location.href=e.url)):toastrError(e.data)}),"json").complete((function(){layer.close(r)})),!1}}))}function getIframeName(){var e=window.name;return e?e.replace("iframe_",""):""}function getIframeDocument(e){if(e){var t=window.frames["iframe_"+e];if(t)return t.document}return null}function showLoading(e){return layer.msg(e||"数据提交中...",{icon:16,shade:.1,time:12e4})}function fileFormatSize(e){return e<1024?e+"B":e<1048576?(e/1024).toFixed(2)+"KB":e<1073741824?(e/1048576).toFixed(2)+"MB":(e/1073741824).toFixed(2)+"GB"}function FindFile(e,t){$.post(app.url("index/attachment/draft"),{key:t},(function(t){var a=[],i="#fileDraft_"+e,o=$(i).find(".id");$.each(o,(function(e,t){a.push($(this).val())})),$.each(t,(function(e,t){if(-1==a.indexOf(t.id+"")){t.size=fileFormatSize(t.size);var o=template("uploader-item-tpl",t);$(i).append(o)}}))}))}function toNumber(e){return e=parseFloat(e),isNaN(e)?0:isFinite(e)?e:0}function StringBuilder(){this._stringArray=new Array}function LocalExport(e,t){if(0!=e.api.getDisplayedRowCount()){var a=[];$.each(e.columnDefs,(function(e,t){1!=t.checkboxSelection&&'"actionCellRenderer"'!=t.cellRenderer&&a.push(t)}));var i=function e(t){var a=[];return $.each(t,(function(t,i){if(null!=i.children){var o=i.children;$.each(e(o),(function(e,t){a.push(t)}))}else a.push(i)})),a}(a),o=function(e){var t=[];return c(e,0,t),t}(a);console.log("开始导出任务:"+t);var n=new StringBuilder,r=o.length-1;$.each(o,(function(e,t){var a=t;n.appendLine(''),$.each(a,(function(t,a){var i=toNumber(a.rowspan),o=toNumber(a.colspan);r>e&&null==a.children&&(i+=e+1);var l='"+a.headerName+" | ",n.appendLine(l)})),n.appendLine("
")}));var l=0;e.api.forEachNode((function(e,t){var a=e.data;n.append(""),l++,$.each(i,(function(e,t){var i;i=null==t.field?"":a[t.field]||"","htmlCellRenderer"==t.cellRenderer&&(i=delHtmlTag(i)),"序号"==t.headerName&&(i=l);var o=[];if("number"==t.type){var r=t.numberOptions||{},s=null==r.places?2:r.places;i=parseFloat(i),i=isNaN(i)?0:i.toFixed(s)}else"date"==t.form_type||o.push("mso-number-format:'@'");n.appendLine(''+i+" | ")})),n.appendLine("
")})),console.log("结束导出任务:"+t);var s='\x3c!--[if gte mso 9]>Sheet1",d=new Date;!function(e,t){var a=document.createElement("a");a.download=t;var i=new Blob([e]);a.href=URL.createObjectURL(i),document.body.appendChild(a),a.click(),document.body.removeChild(a)}(s,t+"-"+[d.getFullYear(),d.getMonth()+1,d.getDate()].join("-")+".xls")}else toastrError("表格无数据,无法导出.");function c(e,t,a){var i=null;a.length>t?i=a[t]:(i=[],a.push(i)),$.each(e,(function(e,o){var n=o.children;null!=n&&(o.colspan=n.length,c(n,t+1,a)),o.rowspan=1,i.push(o)}))}}function LocalTableExport(e,t){var a=$("#"+e),i=!!a.hasClass("table2excel_with_colors"),o=new Date,n=[o.getFullYear(),o.getMonth()+1,o.getDate()].join("-");a.table2excel({exclude:".noExl",name:t,filename:t+n+".xls",fileext:".xls",exclude_img:!0,exclude_links:!0,exclude_inputs:!0,preserveColors:i})}function regionSelect(){var e=arguments,t={a1:"省",a2:"市",a3:"县"};function a(e,t,a,i){$.get(app.url("index/api/region",{layer:t,parent_id:a}),(function(t){var a="";$.map(t,(function(e){a+='"}));var o=$("#"+e).html(a);i>0&&o.val(i)}))}$("#"+e[0]).on("change",(function(){a(e[1],2,this.value,0),$("#"+e[1]).html('"),$("#"+e[2]).html('")})),$("#"+e[1]).on("change",(function(){a(e[2],3,this.value,0),$("#"+e[2]).html('")})),a(e[0],1,0,e[3]),e[3]&&(a(e[1],2,e[3],e[4]),e[4]&&a(e[2],3,e[4],e[5]))}String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")},String.prototype.replaceAll=function(e,t){return this.replace(new RegExp(e,"gm"),t)},StringBuilder.prototype.append=function(e){this._stringArray.push(e)},StringBuilder.prototype.appendLine=function(e){this._stringArray.push(e+"\n")},StringBuilder.prototype.toString=function(e){return this._stringArray.join(e)};
diff --git a/public/assets/js/aggrid/form.js b/public/assets/js/aggrid/form.js
index 71ef44b6..72c01be1 100644
--- a/public/assets/js/aggrid/form.js
+++ b/public/assets/js/aggrid/form.js
@@ -29,6 +29,7 @@ function gridForm(table, options) {
grid.tableTitle = options.title;
grid.tableKey = options.table;
+ grid.tableSaveDataNotEmpty = options.saveDataNotEmpty;
grid.defaultColDef.sortable = false;
grid.defaultColDef.filter = false;
diff --git a/public/assets/js/model.js b/public/assets/js/model.js
index 598c3f9c..68d825aa 100644
--- a/public/assets/js/model.js
+++ b/public/assets/js/model.js
@@ -32,8 +32,8 @@
}
}
- if (rows.length == 0) {
- toastrError(t.tableTitle + '不能为空。');
+ if (rows.length == 0 && t.tableSaveDataNotEmpty === true) {
+ toastrError(t.tableTitle + ' 不能为空。');
return false;
} else {
gets[t.tableKey] = {rows: rows, deleteds: store.deleted};
diff --git a/public/mix-manifest.json b/public/mix-manifest.json
index 38cb3fc5..3a58bb3f 100644
--- a/public/mix-manifest.json
+++ b/public/mix-manifest.json
@@ -1,7 +1,7 @@
{
"/assets/dist/bundle.min.js": "/assets/dist/bundle.min.js?id=4ccf319172adf4f16820",
"/assets/dist/vendor.min.js": "/assets/dist/vendor.min.js?id=29c59d13160c6607b4af",
- "/assets/dist/gdoo.min.js": "/assets/dist/gdoo.min.js?id=1ed00bbba0e428446559",
+ "/assets/dist/gdoo.min.js": "/assets/dist/gdoo.min.js?id=ae7df56b730a240cb42f",
"/assets/dist/index.min.js": "/assets/dist/index.min.js?id=e68deaa21814b7ec0d1c",
"/assets/dist/vendor.min.css": "/assets/dist/vendor.min.css?id=99a58728a17257718260",
"/assets/dist/gdoo.min.css": "/assets/dist/gdoo.min.css?id=b892b527a7b042089ee8",