Commit 5e3804c4 authored by 赵啸非's avatar 赵啸非

修改树表页面

parent ae366943
......@@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>大英交易平台</title>
<title>工程代码构建平台</title>
<link rel="stylesheet" href="https://unpkg.com/element-ui@2.15.5/lib/theme-chalk/index.css">
</head>
<body>
......
......@@ -17,8 +17,8 @@ export const type = (data) => {
/**
* 获取登录状态
*
* @returns
*
* @returns
*/
export const getLoginStatus = () => {
return window.sessionStorage.isLogin;
......@@ -35,7 +35,7 @@ export const query = () => {
/**
* 编码url参数
* 编码url参数
*
* @param {object} data 参数对象
* @returns string
......@@ -91,12 +91,12 @@ export function formatterDateDay(datetime) {
};
/**
* 当前日期加天数后得到的相应日期
* @param {*} day
* @param {*} day
*/
export function getAddDay(day){
var today = new Date();
var targetday_milliseconds=today.getTime() + 1000*60*60*24*day;
today.setTime(targetday_milliseconds);
today.setTime(targetday_milliseconds);
var tYear = today.getFullYear();
var tMonth = today.getMonth();
var tDate = today.getDate();
......@@ -330,7 +330,7 @@ export async function getUserListByQuery(query) {
//对源数据深度克隆
const cloneData = JSON.parse(JSON.stringify(data))
//循环所有项
console.log("11111",cloneData)
//console.log("11111",cloneData)
const treeData = cloneData.filter(father => {
let branchArr = cloneData.filter(child => {
//返回每一项的子级数组
......
......@@ -11,11 +11,11 @@
<el-form-item label="密码">
<el-input v-model="form.password" type='password'></el-input>
</el-form-item>
<el-form-item label="验证码">
<!-- <el-form-item label="验证码">
<el-input v-model="form.securityCode">
<img slot="append" width='60' height="30" :src='securityCodeUrl' @click='refreshCode'/>
</el-input>
</el-form-item>
</el-form-item>-->
<el-form-item size="large">
<el-button type="primary" native-type='submit' :loading='loading' @click='onSubmit'>登录</el-button>
</el-form-item>
......@@ -36,8 +36,7 @@ const securityCodeUrl = '/m/securitycode/createCode?v=';
export default {
name: 'login',
created() {
console.log(11111)
this.refreshCode()
//this.refreshCode()
},
methods: {
......@@ -57,13 +56,13 @@ this.refreshCode()
},
loginFail(error) {
this.loading = false;
this.refreshCode();
//this.refreshCode();
this.$message.error(error.message);
},
refreshCode() {
this.form.securityCode = '';
this.securityCodeUrl = securityCodeUrl + Math.random();
},
// refreshCode() {
// this.form.securityCode = '';
// this.securityCodeUrl = securityCodeUrl + Math.random();
// },
onSubmit(e) {
e.preventDefault();
......@@ -73,9 +72,9 @@ this.refreshCode()
if(!this.form.password.length){
return this.$message.warning('请输入密码')
}
if(!this.form.securityCode.length){
return this.$message.warning('请输入验证码')
}
// if(!this.form.securityCode.length){
// return this.$message.warning('请输入验证码')
// }
this.login();
},
},
......@@ -83,11 +82,11 @@ this.refreshCode()
return {
loading: false,
redirect: this.$route.query.redirect || '/',
securityCodeUrl: securityCodeUrl,
/// securityCodeUrl: securityCodeUrl,
form: {
loginName: '',
password: '',
securityCode: '',
// securityCode: '',
}
}
}
......
......@@ -189,7 +189,7 @@ export default {
// 选中选项卡的 name
activeName: "cloum",
// 表格的高度
tableHeight: 500 + "px",
tableHeight: 700 + "px",
// 表信息
tables: [],
// 表列信息
......@@ -229,7 +229,7 @@ export default {
const tableId = this.$route.query && this.$route.query.tableId;
const appId = this.$route.query && this.$route.query.appId;
console.log("tableId", tableId);
if (tableId) {
......@@ -260,7 +260,6 @@ export default {
this.data = this.rule2;
},
methods: {
/** 提交按钮 */
submitForm() {
const basicForm = this.$refs.basicInfo.$refs.basicInfoForm;
......
......@@ -50,12 +50,12 @@ export default {
// 操作菜单状态
changeStatus(row, column) {
return (
<my-switch
confirm
<my-switch
confirm
url='/menu/save'
row={row}
row={row}
onChange={this.statusChange}
value={this.tableData.result}
value={this.tableData.result}
onInput={(data)=>{
this.tableData.result = data;
}}/>
......@@ -104,7 +104,7 @@ export default {
{
prop: 'id',
label: 'ID',
width: 60,
width: 240,
},
{
prop: 'name',
......
......@@ -20,7 +20,7 @@ module.exports = {
target: 'http://127.0.0.1:17311',
changeOrigin: true,
secure: false,
cookieDomainRewrite: 'plm.testnew.com',
cookieDomainRewrite: 'localhost',
}
}
}
......
......@@ -65,7 +65,7 @@ public class LoginController extends BaseCRUDJsonController<UserService, UserFor
JSONObject ret = new JSONObject();
String loginName = loginForm.getLoginName();
String password = loginForm.getPassword();
String securityCode = loginForm.getSecurityCode();
// String securityCode = loginForm.getSecurityCode();
String ip = super.getRequestIP(request);
if (StringUtils.isEmpty(loginName) || StringUtils.isEmpty(password)) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
......@@ -74,14 +74,14 @@ public class LoginController extends BaseCRUDJsonController<UserService, UserFor
}
UserEntity userEntity = null;
try {
loginForm.validate();
boolean result = validCodeService.doCheckImageValidCode(request.getSession().getId(), ip, securityCode);
if (!result) {
recordSysLog(request, userEntity, "登录验证码不正确或已过期!");
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, "登录验证码不正确或已过期!");
return ret.toJSONString();
}
// loginForm.validate();
// boolean result = validCodeService.doCheckImageValidCode(request.getSession().getId(), ip, securityCode);
// if (!result) {
// recordSysLog(request, userEntity, "登录验证码不正确或已过期!");
// ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
// ret.put(KEY_RESULT_MSG, "登录验证码不正确或已过期!");
// return ret.toJSONString();
// }
userEntity = userService.doLogin(loginName, password, ip);
userEntity.setLastLoginAddress(ip);
saveCurrUser(request, response, userEntity);
......
......@@ -242,11 +242,24 @@ public class FreeMarkerUtils {
String treeCode = getTreecode(paramsObj);
String treeParentCode = getTreeParentCode(paramsObj);
//获取树编码父节点类型 todo
String treeParentCodeType ="String";
List<GentableColumnEntity> columns = genTable.getColumns();
for (GentableColumnEntity column : columns) {
if(treeParentCode.equals(column.getColumnName())){
treeParentCodeType=column.getJavaType();
break;
}
}
//树名称
String treeName = getTreeName(paramsObj);
data.put("treeCode", treeCode);
data.put("treeParentCode", treeParentCode);
data.put("treeParentCodeType", treeParentCodeType);
data.put("treeName", treeName);
data.put("expandColumn", getExpandColumn(genTable));
......
......@@ -107,17 +107,17 @@ public class GenUtils {
}
}
// 查询字段
if (ObjectUtils.isEmpty(column.getIsQuery())) {
/* if (ObjectUtils.isEmpty(column.getIsQuery())) {
if (!arraysContains(GenConstants.COLUMNNAME_NOT_QUERY, columnName) && column.getIsPrimaryKey() != YesNo.YES.getValue()) {
column.setIsQuery(GenConstants.REQUIRE);
} else {
column.setIsQuery(GenConstants.NOREQUIRE);
}
}
}*/
//默认都是否
//column.setIsList(GenConstants.NOREQUIRE);
//column.setIsQuery(GenConstants.NOREQUIRE);
column.setIsQuery(GenConstants.NOREQUIRE);
//拆解枚举类,格式必须为(1.啊啊啊,2.不不不)
String temp = column.getColumnComment().replaceAll("(", "(").replaceAll(")", ")");
......
......@@ -56,5 +56,5 @@ public interface ${ClassName}Service extends ${Service}<${ClassName}Entity,${pkC
* @param context
* @return
*/
List<${ClassName}TreeSelect> getListByParentId(String parentId,Context context);
List<${ClassName}TreeSelect> getListByParentId(${treeParentCodeType} parentId,Context context);
}
\ No newline at end of file
......@@ -199,12 +199,12 @@ public class ${ClassName}ServiceImpl extends ${Service}<${ClassName}Dao, ${Class
}
@Override
public List<${ClassName}TreeSelect> getListByParentId(String parentId, Context context) {
public List<${ClassName}TreeSelect> getListByParentId(${treeParentCodeType} parentId, Context context) {
if (ObjectUtils.isEmpty(parentId)) {
parentId = "0";
}
//只做一层
List<${ClassName}TreeSelect> collect = this.find(new ${ClassName}Query().${treeParentCode?cap_first}(parentId), context).stream().map(item -> new ${ClassName}TreeSelect(item)
List<${ClassName}TreeSelect> collect = this.find(new ${ClassName}Query().${treeParentCode}(parentId), context).stream().map(item -> new ${ClassName}TreeSelect(item)
).collect(Collectors.toList());
if ("0".equals(parentId)) {
return collect;
......
......@@ -28,12 +28,14 @@ import com.mortals.framework.model.${Entity};
import ${packageName}.model.${ClassName}Entity;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
/**
* ${functionName}视图对象
*
* @author ${author}
* @date ${datetime}
*/
@Data
public class ${ClassName}Vo extends ${Entity} {
<#if table.tplCategory=="tree" >
......
......@@ -12,6 +12,7 @@ import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import ${packageName}.model.${ClassName}Entity;
import ${packageName}.service.${ClassName}Service;
<#if table.tplCategory=="tree">
import ${packageName}.model.${ClassName}Query;
import ${packageName}.model.${ClassName}TreeSelect;
</#if>
import org.apache.commons.lang3.ArrayUtils;
......@@ -55,17 +56,17 @@ public class ${ClassName}Controller extends BaseCRUDJsonBodyMappingController<${
<#if table.tplCategory=="tree">
@PostMapping("list/exclude")
public String excludeList(${ClassName}Form form) {
public String excludeList(${ClassName}Entity query) {
Map<String, Object> model = new HashMap<>();
JSONObject ret = new JSONObject();
String busiDesc = "查询" + this.getModuleDesc();
Long id = form.getId()[0];
${pkColumn.javaType} id = query.get${pkColumn.javaField?cap_first}();
int code=VALUE_RESULT_SUCCESS;
try {
Set<${pkColumn.javaType}> idSet = new HashSet<>();
idSet.add(query.get${pkColumn.javaField?cap_first}());
List<${ClassName}Entity> collect = this.service.find(new ${ClassName}Query()).stream().map(item -> {
if (item.getId().intValue() == id || ArrayUtils.contains(StringUtils.split(item.getAncestors(), ","), id + "")) {
return null;
}
if(idSet.contains(item.getget${pkColumn.javaField?cap_first}())) return null;
return item;
}).filter(f -> f != null).collect(Collectors.toList());
model.put("result", collect);
......@@ -84,7 +85,7 @@ public class ${ClassName}Controller extends BaseCRUDJsonBodyMappingController<${
* 获取站点下拉树列表
*/
@PostMapping("treeselect")
public String treeselect(${ClassName}Form form) {
public String treeselect(${ClassName}Entity query) {
Map<String, Object> model = new HashMap<>();
JSONObject ret = new JSONObject();
String busiDesc = "查询" + this.getModuleDesc();
......@@ -108,7 +109,7 @@ public class ${ClassName}Controller extends BaseCRUDJsonBodyMappingController<${
* 根据parentId查询子信息
*/
@GetMapping(value = "getListByParentId")
public String getListByParentId(String parentId) {
public String getListByParentId(${treeParentCodeType} parentId) {
JSONObject ret = new JSONObject();
Map<String, Object> model = new HashMap<>();
String busiDesc = "查询" + this.getModuleDesc()+"子节点";
......
......@@ -36,6 +36,10 @@ CREATE TABLE ${table.tableName}(
`${column.columnName}` ${column.columnType} ${Required} ${autoInc} ${Default} COMMENT '${column.columnComment}',
</#list>
PRIMARY KEY (`${table.pkColumn.columnName}`)
<#list table.columns as column>
<#if column.isQuery==1 >
<#sep>,</#sep>KEY `${column.columnName}` (`${column.columnName}`) USING BTREE
</#if>
</#list>
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='${table.functionName}';
</#list>
\ No newline at end of file
......@@ -2,7 +2,7 @@
-- ----------------------------
-- ${table.functionName}菜单 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_menu` VALUES (null, '${table.tableComment}', '/${table.requestMapping}/list', 0, 1, 1, 0, 0,'',NULL, NULL, NULL, 0, 0, 1, NULL, NULL, NULL);
INSERT INTO `mortals_xhx_menu` VALUES (null, '${table.tableComment}', '/${table.requestMapping}/list', 0,'', 1, 1, 0, 0,'',NULL, NULL, NULL, 0, 0, 1, NULL, NULL, NULL);
-- ----------------------------
-- ${table.functionName}资源路径 SQL
......
......@@ -22,7 +22,7 @@
<#elseif column.htmlType == 7>
<Field label="${comment}"><imageUpload v-model="form.${column.javaField}" prePath="/file/preview"/></Field>
<#elseif column.htmlType == 8>
<Field label="${comment}"><fileUpload v-model="form.${column.javaField}" prePath="/file/uploadfile"/></Field>
<Field label="${comment}"><fileUpload v-model="form.${column.javaField}" prePath="/file/fileupload"/></Field>
<#elseif column.htmlType == 9>
<Field label="${comment}"><editor v-model="form.${column.javaField}" :min-height="256"/></Field>
<#else >
......@@ -85,7 +85,7 @@
<#elseif column.htmlType == 7>
<Field label="${comment}"><imageUpload v-model="form.${subclassName}Entity.${column.javaField}" prePath="/file/preview"/></Field>
<#elseif column.htmlType == 8>
<Field label="${comment}"><fileUpload v-model="form.${subclassName}Entity.${column.javaField}" prePath="/file/uploadfile"/></Field>
<Field label="${comment}"><fileUpload v-model="form.${subclassName}Entity.${column.javaField}" prePath="/file/fileupload"/></Field>
<#elseif column.htmlType == 9>
<Field label="${comment}"><editor v-model="form.${subclassName}Entity.${column.javaField}" :min-height="256"/></Field>
<#else >
......
......@@ -26,7 +26,7 @@
<#elseif column.htmlType == 7>
<Field label="${comment}"><imageUpload v-model="form.${column.javaField}" prePath="/file/preview"/></Field>
<#elseif column.htmlType == 8>
<Field label="${comment}"><fileUpload v-model="form.${column.javaField}" prePath="/file/uploadfile"/></Field>
<Field label="${comment}"><fileUpload v-model="form.${column.javaField}" prePath="/file/fileupload"/></Field>
<#elseif column.htmlType == 9>
<Field label="${comment}"><editor v-model="form.${column.javaField}" :min-height="256"/></Field>
<#else >
......@@ -89,7 +89,7 @@
<#elseif column.htmlType == 7>
<Field label="${comment}"><imageUpload v-model="form.${subclassName}Entity.${column.javaField}" prePath="/file/preview"/></Field>
<#elseif column.htmlType == 8>
<Field label="${comment}"><fileUpload v-model="form.${subclassName}Entity.${column.javaField}" prePath="/file/uploadfile"/></Field>
<Field label="${comment}"><fileUpload v-model="form.${subclassName}Entity.${column.javaField}" prePath="/file/fileupload"/></Field>
<#elseif column.htmlType == 9>
<Field label="${comment}"><editor v-model="form.${subclassName}Entity.${column.javaField}" :min-height="256"/></Field>
<#else >
......
......@@ -38,7 +38,7 @@
<#elseif column.htmlType == 8>
<el-col span="12">
<el-form-item label="${comment}">
<fileUpload v-model="form.${column.javaField}" prePath="/uploadfile" />
<fileUpload v-model="form.${column.javaField}" prePath="/file/fileupload" />
</el-form-item>
</el-col>
<#elseif column.htmlType == 9>
......
......@@ -21,7 +21,7 @@
<#elseif column.htmlType == 7>
<Field label="${comment}"><imageUpload v-model="form.${column.javaField}" prePath="/file/preview"/></Field>
<#elseif column.htmlType == 8>
<Field label="${comment}"><fileUpload v-model="form.${column.javaField}" prePath="/file/uploadfile"/></Field>
<Field label="${comment}"><fileUpload v-model="form.${column.javaField}" prePath="/file/fileupload"/></Field>
<#elseif column.htmlType == 9>
<Field label="${comment}"><editor v-model="form.${column.javaField}" :min-height="256"/></Field>
<#else >
......@@ -81,7 +81,7 @@
<#elseif column.htmlType == 7>
<Field label="${comment}"><imageUpload v-model="form.${subclassName}Entity.${column.javaField}" prePath="/file/preview"/></Field>
<#elseif column.htmlType == 8>
<Field label="${comment}"><fileUpload v-model="form.${subclassName}Entity.${column.javaField}" prePath="/file/uploadfile"/></Field>
<Field label="${comment}"><fileUpload v-model="form.${subclassName}Entity.${column.javaField}" prePath="/file/fileupload"/></Field>
<#elseif column.htmlType == 9>
<Field label="${comment}"><editor v-model="form.${subclassName}Entity.${column.javaField}" :min-height="256"/></Field>
<#else >
......
......@@ -127,17 +127,13 @@
},
</#if>
afterRender(data) {
data.result = handleTree(data.result, "${treeCode}","${treeParentCode}");
this.${className}Options = data.result;
data.data = handleTree(data.data, "${treeCode}","${treeParentCode}");
this.${className}Options = data.data;
this.$refs.layoutTable.showType="treetable"
},
handleAdd(row) {
if (row.fileType == 2) {
this.$message.info("文件节点不允许添加子节点!");
return;
}
this.$refs.dialogform.add(row, this.${className}fileOptions);
this.$refs.dialogform.add(row, this.${className}Options);
},
/** 重写新增方法 */
......@@ -147,10 +143,10 @@
/** 重写编辑方法 */
toEdit(row) {
this.loading = true;
this.$post(this.pageInfo.exclude, {${pkColumn.javaField} : [row.${pkColumn.javaField}] })
this.$post(this.pageInfo.exclude, {${pkColumn.javaField} : row.${pkColumn.javaField} })
.then((res) => {
if (res && res.code && res.code == 1) {
this.${className}Options = handleTree(res.data.result);
this.${className}Options = handleTree(res.data.data);
this.$refs.dialogform.edit(row, this.${className}Options);
this.loading = false;
}
......@@ -271,4 +267,40 @@
};
}
};
</script>
\ No newline at end of file
</script>
<style lang="scss">
.ml-row {
margin-bottom: 5px;
}
.el-radio-button__inner {
// width: 82px;
height: 36px;
border-radius: 4px 0px 0px 4px;
border: 1px solid rgba(0, 0, 0, 0) !important;
border-radius: 2px !important;
background-color: rgba(0, 0, 0, 0);
font-size: 14px;
font-weight: 400;
color: #606677;
line-height: 14px;
outline: none;
box-shadow: none;
}
.el-radio-button__orig-radio:checked+.el-radio-button__inner {
background: rgba(0, 0, 0, 0);
border: 1px solid #3E7BFA !important;
color: #3E7BFA;
line-height: 14px;
outline: none;
box-shadow: none;
}
.ml-top-button {
border-color: #ffffff;
background: rgba(0, 0, 0, 0);
font-size: 16px;
margin: 0 10px 0 10px;
}
</style>
\ No newline at end of file
......@@ -30,7 +30,7 @@
</el-descriptions-item>
<#elseif column.htmlType == 8>
<el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
<fileUpload v-model="form.${column.javaField}" prePath="/file/uploadfile"/>
<fileUpload v-model="form.${column.javaField}" prePath="/file/fileupload"/>
</el-descriptions-item>
<#elseif column.htmlType == 9>
<el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
......
......@@ -328,13 +328,13 @@
<#noparse>${_conditionType_}</#noparse> a.${column.columnName} is null
</if>
</if>
<if test="conditionParamRef.containsKey('${column.javaField}List')">
<if test="conditionParamRef.containsKey('${column.javaField}List') and conditionParamRef.${column.javaField}List.size() > 0">
<#noparse>${_conditionType_}</#noparse> a.${column.columnName} in
<foreach collection="conditionParamRef.${column.javaField}List" open="(" close=")" index="index" item="item" separator=",">
<#noparse>#{item}</#noparse>
</foreach>
</if>
<if test="conditionParamRef.containsKey('${column.javaField}NotList')">
<if test="conditionParamRef.containsKey('${column.javaField}NotList') and conditionParamRef.${column.javaField}NotList.size() > 0">
<#noparse>${_conditionType_}</#noparse> a.${column.columnName} not in
<foreach collection="conditionParamRef.${column.javaField}NotList" open="(" close=")" index="index" item="item" separator=",">
<#noparse>#{item}</#noparse>
......@@ -357,13 +357,13 @@
<#noparse>${_conditionType_}</#noparse> a.${column.columnName} is null
</if>
</if>
<if test="conditionParamRef.containsKey('${column.javaField}List')">
<if test="conditionParamRef.containsKey('${column.javaField}List') and conditionParamRef.${column.javaField}List.size() > 0">
<#noparse>${_conditionType_}</#noparse> a.${column.columnName} in
<foreach collection="conditionParamRef.${column.javaField}List" open="(" close=")" index="index" item="item" separator=",">
<#noparse>#</#noparse>{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('${column.javaField}NotList')">
<if test="conditionParamRef.containsKey('${column.javaField}NotList') and conditionParamRef.${column.javaField}NotList.size() > 0">
<#noparse>${_conditionType_}</#noparse> a.${column.columnName} not in
<foreach collection="conditionParamRef.${column.javaField}NotList" open="(" close=")" index="index" item="item" separator=",">
<#noparse>#</#noparse>{item}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment