JEECG 3.7.5 VUE+ElementUI SPA单页面应用版本发布

jeecg_3.7.5
zhangdaiscott@163.com 6 years ago
parent 40705b2a3d
commit ade928170a

@ -123,7 +123,7 @@ public class SystemController extends BaseController {
public ModelAndView druid() {
return new ModelAndView(new RedirectView("druid/index.html"));
}
@RequestMapping(params = "typeListJson")
@ResponseBody
public AjaxJson typeListJson(@RequestParam(required=true)String typeGroupName) {
@ -139,13 +139,13 @@ public class SystemController extends BaseController {
for (TSType type : typeList) {
JSONObject typeJson = new JSONObject();
typeJson.put("typecode", type.getTypecode());
//update-begin-author:taoyan 数据字典加载国际化---
String typename = type.getTypename();
if(MutiLangUtil.existLangKey(typename)){
typename = MutiLangUtil.doMutiLang(typename,"");
}
typeJson.put("typename",typename );
//update-end-author:taoyan 数据字典加载国际化---
typeArray.add(typeJson);
}
}
@ -157,7 +157,6 @@ public class SystemController extends BaseController {
}
return ajaxJson;
}
/**
*
@ -201,7 +200,6 @@ public class SystemController extends BaseController {
@RequestMapping(params = "typeGroupGrid")
public void typeGroupGrid(HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid, TSTypegroup typegroup) {
CriteriaQuery cq = new CriteriaQuery(TSTypegroup.class, dataGrid);
String typegroupname = request.getParameter("typegroupname");
if(oConvertUtils.isNotEmpty(typegroupname)) {
typegroupname = typegroupname.trim();
@ -220,10 +218,10 @@ public class SystemController extends BaseController {
this.systemService.getDataGridReturn(cq, true);
MutiLangUtil.setMutiLangValueForList(dataGrid.getResults(), "typegroupname");
TagUtil.datagrid(response, dataGrid);
}
/**
*
* @param request
@ -252,7 +250,6 @@ public class SystemController extends BaseController {
return new ArrayList<ComboTree>(){{add(rootCombotree);}};
}
/**
* easyuiAJAX
*
@ -268,15 +265,11 @@ public class SystemController extends BaseController {
CriteriaQuery cq = new CriteriaQuery(TSType.class, dataGrid);
cq.eq("TSTypegroup.id", typegroupid);
cq.like("typename", typename);
cq.addOrder("createDate", SortDirection.desc);
cq.add();
this.systemService.getDataGridReturn(cq, true);
MutiLangUtil.setMutiLangValueForList(dataGrid.getResults(), "typename");
TagUtil.datagrid(response, dataGrid);
}
@ -291,7 +284,6 @@ public class SystemController extends BaseController {
request.setAttribute("typegroupid", typegroupid);
return new ModelAndView("system/type/typeListForTypegroup");
}
// @RequestMapping(params = "typeGroupTree")
// @ResponseBody
// public List<ComboTree> typeGroupTree(HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
@ -342,16 +334,13 @@ public class SystemController extends BaseController {
}
} else {
cq = new CriteriaQuery(TSTypegroup.class);
String typegroupcode = request.getParameter("typegroupcode");
if(typegroupcode != null ) {
HqlRuleEnum rule = PageValueConvertRuleEnum
.convert(typegroupcode);
Object value = PageValueConvertRuleEnum.replaceValue(rule,
typegroupcode);
ObjectParseUtil.addCriteria(cq, "typegroupcode", rule, value);
cq.add();
}
String typegroupname = request.getParameter("typegroupname");
@ -360,7 +349,6 @@ public class SystemController extends BaseController {
List<String> typegroupnameKeyList = systemService.findByQueryString("select typegroupname from TSTypegroup");
MutiLangSqlCriteriaUtil.assembleCondition(typegroupnameKeyList, cq, "typegroupname", typegroupname);
}
List<TSTypegroup> typeGroupList = systemService.getListByCriteriaQuery(cq, false);
for (TSTypegroup obj : typeGroupList) {
TreeGrid treeNode = new TreeGrid();
@ -447,7 +435,6 @@ public class SystemController extends BaseController {
String message = null;
AjaxJson j = new AjaxJson();
typegroup = systemService.getEntity(TSTypegroup.class, typegroup.getId());
message = "类型分组: " + mutiLangService.getLang(typegroup.getTypegroupname()) + " 被删除 成功";
if (ListUtils.isNullOrEmpty(typegroup.getTSTypes())) {
systemService.delete(typegroup);
@ -457,7 +444,6 @@ public class SystemController extends BaseController {
} else {
message = "类型分组: " + mutiLangService.getLang(typegroup.getTypegroupname()) + " 下有类型信息,不能删除!";
}
j.setMsg(message);
return j;
}
@ -502,7 +488,8 @@ public class SystemController extends BaseController {
}
return v;
}
/**
* &
*
@ -523,7 +510,6 @@ public class SystemController extends BaseController {
j.setMsg(message);
return j;
}
/**
*
@ -705,7 +691,6 @@ public class SystemController extends BaseController {
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} else {
// String orgCode = systemService.generateOrgCode(depart.getId(), pid);
// depart.setOrgCode(orgCode);
if(oConvertUtils.isNotEmpty(pid)){
@ -716,7 +701,6 @@ public class SystemController extends BaseController {
String localMaxCode = getMaxLocalCode(null);
depart.setOrgCode(YouBianCodeUtil.getNextYouBianCode(localMaxCode));
}
userService.save(depart);
message = MutiLangUtil.paramAddSuccess("common.department");
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
@ -733,28 +717,22 @@ public class SystemController extends BaseController {
int localCodeLength = parentCode.length() + YouBianCodeUtil.zhanweiLength;
StringBuilder sb = new StringBuilder();
sb.append("SELECT org_code FROM t_s_depart");
if(ResourceUtil.getJdbcUrl().indexOf(JdbcDao.DATABSE_TYPE_SQLSERVER)!=-1){
sb.append(" where LEN(org_code) = ").append(localCodeLength);
}else{
sb.append(" where LENGTH(org_code) = ").append(localCodeLength);
}
if(oConvertUtils.isNotEmpty(parentCode)){
sb.append(" and org_code like '").append(parentCode).append("%'");
} else {
sb.append(" and LEFT(org_code,1)='A'");
}
sb.append(" ORDER BY org_code DESC");
List<Map<String, Object>> objMapList = systemService.findForJdbc(sb.toString(), 1, 1);
String returnCode = null;
if(objMapList!=null && objMapList.size()>0){
returnCode = (String)objMapList.get(0).get("org_code");
}
return returnCode;
}
@ -1130,7 +1108,7 @@ public class SystemController extends BaseController {
public ModelAndView commonUpload(HttpServletRequest req) {
return new ModelAndView("common/upload/uploadView");
}
@RequestMapping(params = "commonWebUpload")
public ModelAndView commonWebUpload(HttpServletRequest req) {
return new ModelAndView("common/upload/uploadView2");
@ -1223,7 +1201,7 @@ public class SystemController extends BaseController {
for (String string : set) {
DataLogDiff dataLogDiff = new DataLogDiff();
dataLogDiff.setName(string);
if (map1.containsKey(string)) {
if ("createDate".equals(string)&&StringUtil.isNotEmpty(map1.get(string))){
java.util.Date date=new Date((String) map1.get(string));
@ -1232,7 +1210,6 @@ public class SystemController extends BaseController {
}else {
value1 = map1.get(string).toString();
}
if (value1 == null) {
dataLogDiff.setValue1("");
}else {
@ -1241,7 +1218,6 @@ public class SystemController extends BaseController {
}else{
dataLogDiff.setValue1("");
}
if (map2.containsKey(string)) {
if ("createDate".equals(string)&&StringUtil.isNotEmpty(map2.get(string))){
java.util.Date date=new Date((String) map2.get(string));
@ -1250,7 +1226,6 @@ public class SystemController extends BaseController {
}else {
value2 = map2.get(string).toString();
}
if (value2 == null) {
dataLogDiff.setValue2("");
}else {
@ -1259,7 +1234,6 @@ public class SystemController extends BaseController {
}else {
dataLogDiff.setValue2("");
}
if (value1 == null && value2 == null) {
dataLogDiff.setDiff("N");
@ -1289,7 +1263,6 @@ public class SystemController extends BaseController {
return new ModelAndView("system/dataLog/diffDataVersion");
}
/**
* ftpUploader
* ftp /
@ -1528,7 +1501,7 @@ public class SystemController extends BaseController {
}
return success;
}
/**
* WebUploader
@ -1606,10 +1579,12 @@ public class SystemController extends BaseController {
public void getImgByurl(HttpServletResponse response,HttpServletRequest request) throws Exception{
String flag=request.getParameter("down");//是否下载否则展示图片
String dbpath = request.getParameter("dbPath");
if(oConvertUtils.isNotEmpty(dbpath)&&dbpath.endsWith(",")){
dbpath = dbpath.substring(0, dbpath.length()-1);
}
if("1".equals(flag)){
response.setContentType("application/x-msdownload;charset=utf-8");
String fileName=dbpath.substring(dbpath.lastIndexOf(File.separator)+1);
String userAgent = request.getHeader("user-agent").toLowerCase();
if (userAgent.contains("msie") || userAgent.contains("like gecko") ) {
fileName = URLEncoder.encode(fileName, "UTF-8");
@ -1617,7 +1592,6 @@ public class SystemController extends BaseController {
fileName = new String(fileName.getBytes("UTF-8"), "iso-8859-1");
}
response.setHeader("Content-disposition", "attachment; filename="+ fileName);
}else{
response.setContentType("image/jpeg;charset=utf-8");
}

@ -187,7 +187,23 @@
valid=$("#form").Validform({
tiptype:function(msg,o,cssctl){
if(o.type==3){
validationMessage(o.obj,msg);
var oopanel = $(o.obj).closest(".el-tab-pane");
var a = 0;
if(oopanel.length>0){
var panelID = oopanel.attr("id");
if(!!panelID){
var waitActive = $("#tab-"+panelID.substring(panelID.indexOf("-")+1));
if(!waitActive.attr(".aria-selected")){
waitActive.click();
a = 1;
}
}
}
if(a==1){
setTimeout(function(){validationMessage(o.obj,msg);},500);
}else{
validationMessage(o.obj,msg);
}
}else{
removeMessage(o.obj);
}
@ -225,8 +241,6 @@
</#list>
},
addFormVisible: false,//新增界面是否显示
addLoading: false,
//新增界面数据
addForm: {
<#list pageColumns as po>
@ -367,15 +381,23 @@
initForm: function (row) {
if(!!row){
this.addForm = Object.assign({}, row);
this.formFile={
<#list pageColumns as po>
<#if po.showType=='file' || po.showType == 'image'>
main_${po.fieldName}:[{
var ${po.fieldName}=[];
if(!!this.addForm.${po.fieldName}){
${po.fieldName}=[{
name:this.addForm.${po.fieldName}.substring(this.addForm.${po.fieldName}.lastIndexOf('\\')+1),
url:this.addForm.${po.fieldName}
}],
}]
}
</#if>
</#list>
this.formFile={
<#list pageColumns as po>
<#if po.showType=='file' || po.showType == 'image'>
${po.fieldName}:${po.fieldName},
</#if>
</#list>
};
//加载子表列表
<#list subtables as key>

@ -108,7 +108,11 @@
<#if po.showType=='file' || po.showType == 'image'>
<el-table-column prop="${po.fieldName}" label="${po.content}" min-width="${po.fieldLength}" sortable="custom" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.${po.fieldName}">
<#if po.showType=='file'>
<el-button size="mini" type="primary" @click="handleDownFile('1',scope.row.${po.fieldName})">文件下载</el-button>
<#else>
<img width="100%" :src="'systemController/showOrDownByurl.do?dbPath='+scope.row.${po.fieldName}" alt="${po.content}">
</#if>
</template>
</el-table-column>
<#else>
@ -293,7 +297,7 @@
var data = datas[i];
<#list columns as po>
<#if po.showType=='checkbox'>
data.${po.fieldName}=data.${po.fieldName}.split(',');
data.${po.fieldName}=!!data.${po.fieldName}?data.${po.fieldName}.split(','):[];
</#if>
</#list>
}

@ -81,7 +81,8 @@ public class ${entityName}ServiceImpl extends CommonServiceImpl implements ${ent
* @return
*/
private void doAddBus(${entityName}Entity t) throws Exception{
<#list buttonSqlMap['add'] as sql>
//-----------------sql增强 start----------------------------
<#list buttonSqlMap['add'] as sql>
//sql增强第${sql_index+1}条
String sqlEnhance_${sql_index+1} ="${sql}";
<#-- update--begin--author:zhoujf date:20180413 for:TASK #2623 bugsql -->
@ -95,14 +96,16 @@ public class ${entityName}ServiceImpl extends CommonServiceImpl implements ${ent
Map<String,Object> data = populationMap(t);
executeJavaExtend("${buttonJavaMap['add'].cgJavaType}","${buttonJavaMap['add'].cgJavaValue}",data);
</#if>
}
//-----------------java增强 end-----------------------------
}
/**
*
* @param t
* @return
*/
private void doUpdateBus(${entityName}Entity t) throws Exception{
<#list buttonSqlMap['update'] as sql>
//-----------------sql增强 start----------------------------
<#list buttonSqlMap['update'] as sql>
//sql增强第${sql_index+1}条
String sqlEnhance_${sql_index+1} ="${sql}";
<#-- update--begin--author:zhoujf date:20180413 for:TASK #2623 bugsql -->
@ -116,14 +119,16 @@ public class ${entityName}ServiceImpl extends CommonServiceImpl implements ${ent
Map<String,Object> data = populationMap(t);
executeJavaExtend("${buttonJavaMap['update'].cgJavaType}","${buttonJavaMap['update'].cgJavaValue}",data);
</#if>
}
//-----------------java增强 end-----------------------------
}
/**
*
* @param id
* @return
*/
private void doDelBus(${entityName}Entity t) throws Exception{
<#list buttonSqlMap['delete'] as sql>
//-----------------sql增强 start----------------------------
<#list buttonSqlMap['delete'] as sql>
//sql增强第${sql_index+1}条
String sqlEnhance_${sql_index+1} ="${sql}";
<#-- update--begin--author:zhoujf date:20180413 for:TASK #2623 bugsql -->
@ -137,7 +142,8 @@ public class ${entityName}ServiceImpl extends CommonServiceImpl implements ${ent
Map<String,Object> data = populationMap(t);
executeJavaExtend("${buttonJavaMap['delete'].cgJavaType}","${buttonJavaMap['delete'].cgJavaValue}",data);
</#if>
}
//-----------------java增强 end-----------------------------
}
private Map<String,Object> populationMap(${entityName}Entity t){
Map<String,Object> map = new HashMap<String,Object>();

@ -105,7 +105,11 @@
<#if po.showType=='file' || po.showType == 'image'>
<el-table-column prop="${po.fieldName}" label="${po.content}" min-width="${po.fieldLength}" sortable="custom" show-overflow-tooltip>
<template slot-scope="scope" v-if="scope.row.${po.fieldName}">
<#if po.showType=='file'>
<el-button size="mini" type="primary" @click="handleDownFile('1',scope.row.${po.fieldName})">文件下载</el-button>
<#else>
<img width="100%" :src="'systemController/showOrDownByurl.do?dbPath='+scope.row.${po.fieldName}" alt="${po.content}">
</#if>
</template>
</el-table-column>
<#else>
@ -171,7 +175,7 @@
:action="url.upload"
:data="{isup:'1'}"
:on-success="handle${po.fieldName?cap_first}UploadFile"
:on-remove="handleRemoveFile"
:on-remove="handle${po.fieldName?cap_first}RemoveFile"
:file-list="formFile.${po.fieldName}">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
@ -336,14 +340,15 @@
<#if po.showType=='file' || po.showType == 'image'>
handle${po.fieldName?cap_first}UploadFile: function(response, file, fileList){
file.url=response.obj;
this.addForm.${po.fieldName}=response.obj;
if(fileList.length>1){
this.handleRemoveFile(fileList.splice(0,1)[0],fileList);
}
this.addForm.${po.fieldName}=response.obj;
},
</#if>
</#list>
handleRemoveFile: function(file, fileList){
handle${po.fieldName?cap_first}RemoveFile: function(file, fileList){
if(fileList.length==0){
this.addForm.${po.fieldName}="";
}
this.$http.get(this.url.upload,{
params:{
isdel:'1',
@ -352,6 +357,8 @@
}).then((res) => {
});
},
</#if>
</#list>
handleSortChange(sort){
this.sort={
sort:sort.prop,
@ -456,7 +463,7 @@
var data = datas[i];
<#list columns as po>
<#if po.showType=='checkbox'>
data.${po.fieldName}=data.${po.fieldName}.split(',');
data.${po.fieldName}=!!data.${po.fieldName}?data.${po.fieldName}.split(','):[];
</#if>
</#list>
}
@ -488,15 +495,23 @@
handleEdit: function (index, row) {
this.editFormVisible = true;
this.addForm = Object.assign({}, row);
this.formFile={
<#list pageColumns as po>
<#if po.showType=='file' || po.showType == 'image'>
${po.fieldName}:[{
var ${po.fieldName}=[];
if(!!this.addForm.${po.fieldName}){
${po.fieldName}=[{
name:this.addForm.${po.fieldName}.substring(this.addForm.${po.fieldName}.lastIndexOf('\\')+1),
url:this.addForm.${po.fieldName}
}],
}]
}
</#if>
</#list>
this.formFile={
<#list pageColumns as po>
<#if po.showType=='file' || po.showType == 'image'>
${po.fieldName}:${po.fieldName},
</#if>
</#list>
};
},
//显示新增界面

@ -138,49 +138,54 @@
</#list>
},
methods: {
init: function(){
var _this = this;
jQuery.ajax({
url: "${entityName?uncap_first}Controller.do?initFormData",
type:"GET",
dataType:"JSON",
success: function (back) {
if(back.success){
var backtemp = back.obj;
<#list pageColumns as po>
<#if po.isShow == 'Y' && po.showType=='checkbox'>
<#-- 主表checkbox值替换 -->
backtemp.${po.fieldName} = (!!backtemp.${po.fieldName})?backtemp.${po.fieldName}.split(","):[];
</#if>
</#list>
<#list subtables as key>
var temp${subsG['${key}'].entityName}List = backtemp.${subsG['${key}'].entityName?uncap_first}List;
<#if subsG['${key}'].cgFormHead.relationType==1>
<#-- 1对1子表值替换为单个实体 -->
_this.${subsG['${key}'].entityName?uncap_first}Data = temp${subsG['${key}'].entityName}List[0];
<#list subColumnsMap['${key}'] as po>
<#if po.isShow == 'Y' && po.showType=='checkbox'>
<#-- 1对1子表checkbox值替换 -->
_this.${subsG['${key}'].entityName?uncap_first}Data.${po.fieldName}=(!!_this.${subsG['${key}'].entityName?uncap_first}Data.${po.fieldName})?_this.${subsG['${key}'].entityName?uncap_first}Data.${po.fieldName}.split(","):[];
</#if>
</#list>
<#else>
<#list subColumnsMap['${key}'] as po>
<#if po.isShow == 'Y' && po.showType=='checkbox'>
<#-- 1对n子表checkbox值替换 需要循环 -->
if(!!temp${subsG['${key}'].entityName}List && temp${subsG['${key}'].entityName}List.length>0){
for(var a = 0;a<temp${subsG['${key}'].entityName}List.length;a++){
temp${subsG['${key}'].entityName}List[a].${po.fieldName} = (!!temp${subsG['${key}'].entityName}List[a].${po.fieldName})?temp${subsG['${key}'].entityName}List[a].${po.fieldName}.split(","):[];
}
}
</#if>
</#list>
</#if>
</#list>
_this.formdata = backtemp;
}
}
});
loadData:function(){
return new Promise(function(resolve, reject){
jQuery.ajax({
url: "${entityName?uncap_first}Controller.do?initFormData",
type:"GET",
dataType:"JSON",
success: function (back) {
if(back.success){
resolve(back.obj);
}
}
});
});
},
init: function(backtemp){
var _this = this;
<#list pageColumns as po>
<#if po.isShow == 'Y' && po.showType=='checkbox'>
<#-- 主表checkbox值替换 -->
backtemp.${po.fieldName} = (!!backtemp.${po.fieldName})?backtemp.${po.fieldName}.split(","):[];
</#if>
</#list>
<#list subtables as key>
var temp${subsG['${key}'].entityName}List = backtemp.${subsG['${key}'].entityName?uncap_first}List;
<#if subsG['${key}'].cgFormHead.relationType==1>
<#-- 1对1子表值替换为单个实体 -->
_this.${subsG['${key}'].entityName?uncap_first}Data = temp${subsG['${key}'].entityName}List[0];
<#list subColumnsMap['${key}'] as po>
<#if po.isShow == 'Y' && po.showType=='checkbox'>
<#-- 1对1子表checkbox值替换 -->
_this.${subsG['${key}'].entityName?uncap_first}Data.${po.fieldName}=(!!_this.${subsG['${key}'].entityName?uncap_first}Data.${po.fieldName})?_this.${subsG['${key}'].entityName?uncap_first}Data.${po.fieldName}.split(","):[];
</#if>
</#list>
<#else>
<#list subColumnsMap['${key}'] as po>
<#if po.isShow == 'Y' && po.showType=='checkbox'>
<#-- 1对n子表checkbox值替换 需要循环 -->
if(!!temp${subsG['${key}'].entityName}List && temp${subsG['${key}'].entityName}List.length>0){
for(var a = 0;a<temp${subsG['${key}'].entityName}List.length;a++){
temp${subsG['${key}'].entityName}List[a].${po.fieldName} = (!!temp${subsG['${key}'].entityName}List[a].${po.fieldName})?temp${subsG['${key}'].entityName}List[a].${po.fieldName}.split(","):[];
}
}
</#if>
</#list>
</#if>
</#list>
_this.formdata = backtemp;
_this.addValidType();
},
initDictsData:function(){
var _this = this;
@ -209,20 +214,20 @@
</#list>
},
addValidType:function(){
<#list pageColumns as po>
<#if po.isShow == 'Y' && po.showType !='input' && po.showType !='checkbox'>
<@datatypeJs descriptb="${ftl_description}" po = po/>
</#if>
</#list>
setTimeout(function(){
<#list subtables as key>
<#list subColumnsMap['${key}'] as spo>
<#if spo.isShow == 'Y' && spo.showType !='input' && spo.showType !='checkbox'>
<@datatypeJs descriptb="${subsG['${key}'].ftlDescription}" po = spo/>
</#if>
</#list>
</#list>
},1000);
this.$nextTick(() => {
<#list pageColumns as po>
<#if po.isShow == 'Y' && po.showType !='input' && po.showType !='checkbox'>
<@datatypeJs descriptb="${ftl_description}" po = po/>
</#if>
</#list>
<#list subtables as key>
<#list subColumnsMap['${key}'] as spo>
<#if spo.isShow == 'Y' && spo.showType !='input' && spo.showType !='checkbox'>
<@datatypeJs descriptb="${subsG['${key}'].ftlDescription}" po = spo/>
</#if>
</#list>
</#list>
});
},
<#list subTab as sub>
delete${sub.entityName}:function(index, row) {
@ -287,10 +292,12 @@
});
}
},
mounted() {
this.init();
this.initDictsData();
this.addValidType();
mounted:function() {
var _this = this;
_this.loadData().then(function(data){
_this.init(data);
});
_this.initDictsData();
}
});
$(document).ready(function() {

@ -39,7 +39,7 @@
<el-main>
<form class="form-horizontal" role="form" id="dailogForm" action="" method="POST">
<button type="button" id="btn_sub" class="btn_sub" @click="doSubmitForm()" style="display:none"></button>
<input name = "id" type = "hidden" value = "${formId}" />
<input name = "id" type = "hidden" value = "${'$'}{formId}" />
<div class="main-form">
<el-form label-width="110px">
<#list pageColumns as po>
@ -138,50 +138,54 @@
</#list>
},
methods: {
init:function(){
var _this = this;
jQuery.ajax({
url: "${entityName?uncap_first}Controller.do?initFormData&id=${'$'}{formId}",
type:"GET",
dataType:"JSON",
success: function (back) {
if(back.success){
var backtemp = back.obj;
<#list pageColumns as po>
<#if po.isShow == 'Y' && po.showType=='checkbox'>
<#-- 主表checkbox值替换 -->
backtemp.${po.fieldName} = (!!backtemp.${po.fieldName})?backtemp.${po.fieldName}.split(","):[];
</#if>
</#list>
<#list subtables as key>
var temp${subsG['${key}'].entityName}List = backtemp.${subsG['${key}'].entityName?uncap_first}List;
<#if subsG['${key}'].cgFormHead.relationType==1>
<#-- 1对1子表值替换为单个实体 -->
_this.${subsG['${key}'].entityName?uncap_first}Data = temp${subsG['${key}'].entityName}List[0];
<#list subColumnsMap['${key}'] as po>
<#if po.isShow == 'Y' && po.showType=='checkbox'>
<#-- 1对1子表checkbox值替换 -->
_this.${subsG['${key}'].entityName?uncap_first}Data.${po.fieldName}=(!!_this.${subsG['${key}'].entityName?uncap_first}Data.${po.fieldName})?_this.${subsG['${key}'].entityName?uncap_first}Data.${po.fieldName}.split(","):[];
</#if>
</#list>
<#else>
<#list subColumnsMap['${key}'] as po>
<#if po.isShow == 'Y' && po.showType=='checkbox'>
<#-- 1对n子表checkbox值替换 需要循环 -->
if(!!temp${subsG['${key}'].entityName}List && temp${subsG['${key}'].entityName}List.length>0){
for(var a = 0;a<temp${subsG['${key}'].entityName}List.length;a++){
temp${subsG['${key}'].entityName}List[a].${po.fieldName} = (!!temp${subsG['${key}'].entityName}List[a].${po.fieldName})?temp${subsG['${key}'].entityName}List[a].${po.fieldName}.split(","):[];
}
}
</#if>
</#list>
</#if>
</#list>
_this.formdata = backtemp;
}
}
});
loadData:function(){
return new Promise(function(resolve, reject){
jQuery.ajax({
url: "${entityName?uncap_first}Controller.do?initFormData&id=${'$'}{formId}",
type:"GET",
dataType:"JSON",
success: function (back) {
if(back.success){
resolve(back.obj);
}
}
});
});
},
init:function(backtemp){
var _this = this;
<#list pageColumns as po>
<#if po.isShow == 'Y' && po.showType=='checkbox'>
<#-- 主表checkbox值替换 -->
backtemp.${po.fieldName} = (!!backtemp.${po.fieldName})?backtemp.${po.fieldName}.split(","):[];
</#if>
</#list>
<#list subtables as key>
var temp${subsG['${key}'].entityName}List = backtemp.${subsG['${key}'].entityName?uncap_first}List;
<#if subsG['${key}'].cgFormHead.relationType==1>
<#-- 1对1子表值替换为单个实体 -->
_this.${subsG['${key}'].entityName?uncap_first}Data = temp${subsG['${key}'].entityName}List[0];
<#list subColumnsMap['${key}'] as po>
<#if po.isShow == 'Y' && po.showType=='checkbox'>
<#-- 1对1子表checkbox值替换 -->
_this.${subsG['${key}'].entityName?uncap_first}Data.${po.fieldName}=(!!_this.${subsG['${key}'].entityName?uncap_first}Data.${po.fieldName})?_this.${subsG['${key}'].entityName?uncap_first}Data.${po.fieldName}.split(","):[];
</#if>
</#list>
<#else>
<#list subColumnsMap['${key}'] as po>
<#if po.isShow == 'Y' && po.showType=='checkbox'>
<#-- 1对n子表checkbox值替换 需要循环 -->
if(!!temp${subsG['${key}'].entityName}List && temp${subsG['${key}'].entityName}List.length>0){
for(var a = 0;a<temp${subsG['${key}'].entityName}List.length;a++){
temp${subsG['${key}'].entityName}List[a].${po.fieldName} = (!!temp${subsG['${key}'].entityName}List[a].${po.fieldName})?temp${subsG['${key}'].entityName}List[a].${po.fieldName}.split(","):[];
}
}
</#if>
</#list>
</#if>
</#list>
_this.formdata = backtemp;
_this.addValidType();
},
initDictsData:function(){
var _this = this;
@ -210,20 +214,20 @@
</#list>
},
addValidType:function(){
<#list pageColumns as po>
<#if po.isShow == 'Y' && po.showType !='input' && po.showType !='checkbox'>
<@datatypeJs descriptb="${ftl_description}" po = po />
</#if>
</#list>
setTimeout(function(){
<#list subtables as key>
<#list subColumnsMap['${key}'] as spo>
<#if spo.isShow == 'Y' && spo.showType !='input' && spo.showType !='checkbox'>
<@datatypeJs descriptb="${subsG['${key}'].ftlDescription}" po = spo />
</#if>
</#list>
</#list>
},1000);
this.$nextTick(() => {
<#list pageColumns as po>
<#if po.isShow == 'Y' && po.showType !='input' && po.showType !='checkbox'>
<@datatypeJs descriptb="${ftl_description}" po = po />
</#if>
</#list>
<#list subtables as key>
<#list subColumnsMap['${key}'] as spo>
<#if spo.isShow == 'Y' && spo.showType !='input' && spo.showType !='checkbox'>
<@datatypeJs descriptb="${subsG['${key}'].ftlDescription}" po = spo />
</#if>
</#list>
</#list>
});
},
<#list subTab as sub>
delete${sub.entityName}:function(index, row) {
@ -288,10 +292,12 @@
});
}
},
mounted() {
this.init();
this.initDictsData();
this.addValidType();
mounted:function() {
var _this = this;
_this.loadData().then(function(data){
_this.init(data);
});
_this.initDictsData();
}
});
$(document).ready(function() {

@ -45,11 +45,11 @@
<#if uploadFlag==1>
<#assign fileName = "" />
<!-- 上传组件 -->
<link rel="stylesheet" href="plug-in/uploadify/css/uploadify.css" type="text/css" />
<script type="text/javascript" src="plug-in/uploadify/jquery.uploadify-3.1.js"></script>
<link rel="stylesheet" type="text/css" href="plug-in/webuploader/custom.css"></link>
<script type="text/javascript" src="plug-in/webuploader/webuploader.min.js"></script>
</#if>
</head>
<body style="overflow:hidden;margin-top: 20px">
<body style="overflow:hidden;overflow-y:auto;margin-top: 20px">
<form id="formobj" action="${entityName?uncap_first}Controller.do?doAdd" class="form-horizontal validform" role="form" method="post">
<input type="hidden" id="btn_sub" class="btn_sub"/>
<input type="hidden" id="id" name="id"/>
@ -72,7 +72,7 @@
<span class="glyphicon glyphicon-calendar"></span>
</span>
<#elseif po.showType=='file' || po.showType == 'image'>
<@uploadtag po = po/>
<@webuploadtag po = po defval=""/>
<#else>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" maxlength="${po.length?c}" class="form-control input-sm" placeholder="请输入${po.content}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/>/>
</#if>
@ -149,11 +149,7 @@
callback : function(data) {
var win = frameElement.api.opener;
if (data.success == true) {
<#if uploadFlag==1>
callbackUpload(data);
<#else>
frameElement.api.close();
</#if>
win.reloadTable();
win.tip(data.msg);
} else {
@ -176,29 +172,6 @@
});
});
<#if uploadFlag==1>
function callbackUpload(data) {
if(!$("input[name='id']").val()){
if(data.obj!=null && data.obj!='undefined'){
$("input[name='id']").val(data.obj.id);
}
}
if($(".uploadify-queue-item").length>0){
<#assign subFileName = fileName?substring(0,fileName?length - 1) />
<#list subFileName?split(",") as name>
$('#${name}').uploadify('upload', '*');
</#list>
}else{
frameElement.api.close();
}
}
function cancel() {
<#assign subFileName2 = fileName?substring(0,fileName?length - 1) />
<#list subFileName2?split(",") as name>
$('#${name}').uploadify('cancel', '*');
</#list>
}
</#if>
</script>
</body>
</html>

@ -45,13 +45,11 @@
<#if uploadFlag==1>
<#assign fileName = "" />
<!-- 上传组件 -->
<link rel="stylesheet" href="plug-in/uploadify/css/uploadify.css" type="text/css" />
<script type="text/javascript" src="plug-in/uploadify/jquery.uploadify-3.1.js"></script>
<script type="text/javascript" src="plug-in/lhgDialog/lhgdialog.min.js"></script>
<script type="text/javascript" src="plug-in/tools/curdtools_zh-cn.js"></script>
<link rel="stylesheet" type="text/css" href="plug-in/webuploader/custom.css"></link>
<script type="text/javascript" src="plug-in/webuploader/webuploader.min.js"></script>
</#if>
</head>
<body style="overflow:hidden;margin-top: 20px">
<body style="overflow:hidden;overflow-y:auto;margin-top: 20px">
<form id="formobj" action="${entityName?uncap_first}Controller.do?doUpdate" class="form-horizontal validform" role="form" method="post">
<input type="hidden" id="btn_sub" class="btn_sub"/>
<input type="hidden" id="id" name="id" value="${'$'}{${entityName?uncap_first}Page.id}"/>
@ -81,7 +79,7 @@
<span class="glyphicon glyphicon-calendar"></span>
</span>
<#elseif po.showType=='file' || po.showType == 'image'>
<@uploadtag po = po opt = "update"/>
<@webuploadtag po = po defval="${'$'}{${entityName?uncap_first}Page.${po.fieldName}}"/>
<#else>
<input id="${po.fieldName}" name="${po.fieldName}" value='${'$'}{${entityName?uncap_first}Page.${po.fieldName}}' type="text" maxlength="${po.length?c}" class="form-control input-sm" placeholder="请输入${po.content}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" tableName="${po.table.tableName}" fieldName="${po.oldFieldName}"/>/>
</#if>
@ -160,11 +158,7 @@
callback : function(data) {
var win = frameElement.api.opener;
if (data.success == true) {
<#if uploadFlag==1>
callbackUpload(data);
<#else>
frameElement.api.close();
</#if>
win.reloadTable();
win.tip(data.msg);
} else {
@ -187,84 +181,5 @@
});
});
</script>
<#if uploadFlag==1>
<script>
$(function(){
var cgFormId=$("input[name='id']").val();
$.ajax({
type: "post",
url: "${entityName?uncap_first}Controller.do?getFiles&id=" + cgFormId,
success: function(data){
var arrayFileObj = jQuery.parseJSON(data).obj;
$.each(arrayFileObj,function(n,file){
var fieldName = file.field.toLowerCase();
var table = $("#"+fieldName+"_fileTable");
var tr = $("<tr style=\"height:34px;\"></tr>");
var title = file.title;
if(title.length > 15){
title = title.substring(0,12) + "...";
}
var td_title = $("<td title='"+file.title+"'>" + title + "</td>");
var td_download = $("<td><a style=\"margin-left:10px;\" href=\"commonController.do?viewFile&fileid=" + file.fileKey + "&subclassname=org.jeecgframework.web.cgform.entity.upload.CgUploadEntity\" title=\"下载\">下载</a></td>")
var td_view = $("<td><a style=\"margin-left:10px;\" href=\"javascript:void(0);\" onclick=\"openwindow('预览','commonController.do?openViewFile&fileid=" + file.fileKey + "&subclassname=org.jeecgframework.web.cgform.entity.upload.CgUploadEntity','fList',700,500)\">预览</a></td>");
var td_del = $("<td><a style=\"margin-left:10px;\" href=\"javascript:void(0)\" class=\"jeecgDetail\" onclick=\"del('cgUploadController.do?delFile&id=" + file.fileKey + "',this)\">删除</a></td>");
tr.appendTo(table);
td_title.appendTo(tr);
td_download.appendTo(tr);
td_view.appendTo(tr);
td_del.appendTo(tr);
});
}
});
});
//表单提交成功后上传文件
function callbackUpload(data) {
if(!$("input[name='id']").val()){
if(data.obj!=null && data.obj!='undefined'){
$("input[name='id']").val(data.obj.id);
}
}
if($(".uploadify-queue-item").length>0){
<#assign subFileName = fileName?substring(0,fileName?length - 1) />
<#list subFileName?split(",") as name>
$('#${name}').uploadify('upload', '*');
</#list>
}else{
frameElement.api.close();
}
}
function cancel() {
<#assign subFileName2 = fileName?substring(0,fileName?length - 1) />
<#list subFileName2?split(",") as name>
$('#${name}').uploadify('cancel', '*');
</#list>
}
//删除单个文件
function del(url,obj){
$.dialog.setting.zIndex =9999;
$.dialog.confirm("确认删除该条记录?", function(){
$.ajax({
async : false,
cache : false,
type : 'POST',
url : url,// 请求的action路径
error : function() {// 请求失败处理函数
},
success : function(data) {
var d = $.parseJSON(data);
if (d.success) {
var msg = d.msg;
tip(msg);
$(obj).closest("tr").hide("slow");
}
}
});
}, function(){
});
}
</script>
</#if>
</body>
</html>

@ -85,6 +85,21 @@
<i class="fa fa-trash"></i>
<span>批量删除</span>
</button>
<button type="button" class="tool-btn tool-btn-default tool-btn-xs" onclick="openuploadwin('Excel导入', '${entityName?uncap_first}Controller.do?upload', '${entityName?uncap_first}List')">
<i class="fa fa-download"></i>
<span>导入</span>
</button>
<button type="button" class="tool-btn tool-btn-default tool-btn-xs" onclick="JeecgExcelExport('${entityName?uncap_first}Controller.do?exportXls','${entityName?uncap_first}List')">
<i class="fa fa-upload"></i>
<span>导出</span>
</button>
<button type="button" class="tool-btn tool-btn-default tool-btn-xs" onclick="JeecgExcelExport('${entityName?uncap_first}Controller.do?exportXlsByT','${entityName?uncap_first}List')">
<i class="fa fa-upload"></i>
<span>模版下载</span>
</button>
<button type="button" class="tool-btn tool-btn-default tool-btn-xs" onclick="$('.toolbar-search').slideToggle();">
<i class="fa fa-arrow-circle-left"></i>
@ -354,13 +369,15 @@ function listFileImgFormat(value,type){
if(value==null || value.length==0){
return href;
}
var value1 = "systemController/showOrDownByurl.do?dbPath="+value;
if("image"==type){
href+="<img src='"+value+"' width=30 height=30 onmouseover='tipImg(this)' onmouseout='moveTipImg()' style='vertical-align:middle'/>";
href+="<img src='"+value1+"' width=30 height=30 onmouseover='tipImg(this)' onmouseout='moveTipImg()' style='vertical-align:middle'/>";
}else{
if(value.indexOf(".jpg")>-1 || value.indexOf(".gif")>-1 || value.indexOf(".png")>-1){
href+="<img src='"+value+"' onmouseover='tipImg(this)' onmouseout='moveTipImg()' width=30 height=30 />";
href+="<img src='"+value1+"' onmouseover='tipImg(this)' onmouseout='moveTipImg()' width=30 height=30 style='vertical-align:middle'/>";
}else{
href+="<a href='"+value+"' class='ace_button' style='text-decoration:none;' target=_blank><u><i class='fa fa-download'></i>点击下载</u></a>";
var value2 = "systemController/showOrDownByurl.do?down=1&dbPath="+value;
href+="<a href='"+value2+"' class='ace_button' style='text-decoration:none;' target=_blank><u><i class='fa fa-download'></i>点击下载</u></a>";
}
}
return href;

@ -81,7 +81,8 @@ public class ${entityName}ServiceImpl extends CommonServiceImpl implements ${ent
* @return
*/
private void doAddBus(${entityName}Entity t) throws Exception{
<#list buttonSqlMap['add'] as sql>
//-----------------sql增强 start----------------------------
<#list buttonSqlMap['add'] as sql>
//sql增强第${sql_index+1}条
String sqlEnhance_${sql_index+1} ="${sql}";
<#-- update--begin--author:zhoujf date:20180413 for:TASK #2623 bugsql -->
@ -95,14 +96,16 @@ public class ${entityName}ServiceImpl extends CommonServiceImpl implements ${ent
Map<String,Object> data = populationMap(t);
executeJavaExtend("${buttonJavaMap['add'].cgJavaType}","${buttonJavaMap['add'].cgJavaValue}",data);
</#if>
}
//-----------------java增强 end-----------------------------
}
/**
*
* @param t
* @return
*/
private void doUpdateBus(${entityName}Entity t) throws Exception{
<#list buttonSqlMap['update'] as sql>
//-----------------sql增强 start----------------------------
<#list buttonSqlMap['update'] as sql>
//sql增强第${sql_index+1}条
String sqlEnhance_${sql_index+1} ="${sql}";
<#-- update--begin--author:zhoujf date:20180413 for:TASK #2623 bugsql -->
@ -116,14 +119,16 @@ public class ${entityName}ServiceImpl extends CommonServiceImpl implements ${ent
Map<String,Object> data = populationMap(t);
executeJavaExtend("${buttonJavaMap['update'].cgJavaType}","${buttonJavaMap['update'].cgJavaValue}",data);
</#if>
}
//-----------------java增强 end-----------------------------
}
/**
*
* @param id
* @return
*/
private void doDelBus(${entityName}Entity t) throws Exception{
<#list buttonSqlMap['delete'] as sql>
//-----------------sql增强 start----------------------------
<#list buttonSqlMap['delete'] as sql>
//sql增强第${sql_index+1}条
String sqlEnhance_${sql_index+1} ="${sql}";
<#-- update--begin--author:zhoujf date:20180413 for:TASK #2623 bugsql -->
@ -137,7 +142,8 @@ public class ${entityName}ServiceImpl extends CommonServiceImpl implements ${ent
Map<String,Object> data = populationMap(t);
executeJavaExtend("${buttonJavaMap['delete'].cgJavaType}","${buttonJavaMap['delete'].cgJavaValue}",data);
</#if>
}
//-----------------java增强 end-----------------------------
}
private Map<String,Object> populationMap(${entityName}Entity t){
Map<String,Object> map = new HashMap<String,Object>();

@ -35,6 +35,29 @@
</#if>
</#macro>
<#-- 文件上传使用新标签
po: 对象
opt操作类型 add/update
-->
<#macro webuploadtag po defval="">
<#local validType="${po.fieldValidType!''}"/>
<#local isNull="${po.isNull}"/>
<t:webUploader name="${po.fieldName}" outJs="true" auto="true" showImgDiv="filediv_${po.fieldName}"<#rt/>
<#if po.showType == 'image'><#rt/>
type="image" buttonText='添加图片' displayTxt="false"<#rt/>
</#if><#rt/>
<#if defval != ''><#rt/>
pathValues="${defval}"<#rt/>
</#if><#rt/>
<#if validType?if_exists?html != ''><#rt/>
datatype="${validType?if_exists?html}"<#rt/>
<#elseif isNull != 'Y'><#rt/>
datatype="*"<#rt/>
</#if><#rt/>
></t:webUploader>
<div class="form" id="filediv_${po.fieldName}"></div>
</#macro>
<#-- 树控件使用标签 -->
<#macro treetag po formStyle="" opt="">
<t:treeSelectTag id="${po.fieldName}" field="${po.fieldName}" code = "${po.dictField}"<#rt/>

Loading…
Cancel
Save