1. 增加dict.js自动生成
2. 增加table列表固定列和高度
This commit is contained in:
+171
@@ -0,0 +1,171 @@
|
||||
package com.murong.ecp.netpay.mbu.web.pub.action.buipubbpc1;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.murong.ecp.netpay.mbu.web.common.utils.BaseAction;
|
||||
import com.murong.ecp.netpay.mbu.web.common.utils.CommonMessageCode;
|
||||
import com.murong.ecp.netpay.mbu.web.common.utils.ResultT;
|
||||
import com.murong.ecp.netpay.mbu.web.common.utils.ValidatorUtil;
|
||||
import com.murong.ecp.netpay.mbu.web.pub.dal.dao.BuiHlpMapper;
|
||||
import com.murong.ecp.netpay.mbu.web.pub.dal.entity.BuiHlpDO;
|
||||
import com.murong.ecp.netpay.mbu.web.pub.model.BuiHlpDeleteReqBO;
|
||||
import com.yuangou.ecp.biz.transengine.sqlsession.YGSqlSession;
|
||||
import com.yuangou.ecp.bp.comp.pubatc.bat.YGData;
|
||||
import com.yuangou.ecp.bp.core.common.exception.YGException;
|
||||
import com.yuangou.ecp.bp.core.common.message.YGBizMessage;
|
||||
import com.yuangou.ecp.bp.core.common.message.YGBizMessageContext;
|
||||
import com.yuangou.ecp.bp.core.common.yglog4j.Logger;
|
||||
import com.yuangou.ecp.bp.core.common.yglog4j.YGLogger;
|
||||
import com.yuangou.ecp.bp.database.YGDatabaseUtil;
|
||||
import com.yuangou.ecp.bp.database.YGResultSet;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 字典枚举值生成服务
|
||||
* Created by xu_lw on 2019-08-24 17:26:40.
|
||||
*/
|
||||
@Service("buiHlpGenerate")
|
||||
public class BuiHlpGenerateAction extends BaseAction {
|
||||
@Autowired
|
||||
private BuiHlpMapper buiHlpMapper;
|
||||
|
||||
/**
|
||||
* 删除记录
|
||||
*
|
||||
* @param bizCtx
|
||||
* @return
|
||||
* @throws YGException
|
||||
*/
|
||||
public ResultT execute(YGBizMessageContext bizCtx) throws YGException {
|
||||
YGBizMessage bizMsg = bizCtx.getCurrentMsg();
|
||||
Logger msgLog = YGLogger.getLogger(bizMsg);
|
||||
YGDatabaseUtil dbUtil = bizCtx.getDataBaseUtil();
|
||||
|
||||
Connection connection = dbUtil.getConnection();
|
||||
PreparedStatement ps = null;
|
||||
ResultSet rs = null;
|
||||
ResultT resultT = new ResultT();
|
||||
Map<String, Map<String, String>> fldHlps = new HashMap<String, Map<String, String>>();
|
||||
|
||||
try {
|
||||
ps = connection.prepareStatement("select * from t_pub_hlp order by fld_nm,fld_order");
|
||||
rs = ps.executeQuery();
|
||||
while (rs.next()) {
|
||||
String fldNm = rs.getString("fld_nm");
|
||||
String fldVal = rs.getString("fld_val");
|
||||
String fldExp = rs.getString("fld_exp");
|
||||
Map map = (Map) fldHlps.get(fldNm);
|
||||
if (map == null) {
|
||||
map = new LinkedHashMap();
|
||||
fldHlps.put(name, map);
|
||||
}
|
||||
map.put(fldExp, fldVal);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
msgLog.info(e.toString(), e);
|
||||
resultT.setMsgCod(CommonMessageCode.FAIL);
|
||||
resultT.setMsgInf(e.toString());
|
||||
return resultT;
|
||||
} finally {
|
||||
if (rs != null) {
|
||||
try {
|
||||
rs.close();
|
||||
} catch (SQLException e) {
|
||||
;
|
||||
}
|
||||
}
|
||||
if (ps != null) {
|
||||
try {
|
||||
ps.close();
|
||||
} catch (SQLException e) {
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
StringBuffer buf = new StringBuffer();
|
||||
buf.append("const dict = {\n");
|
||||
buf.append(" data: {\n");
|
||||
for (String name : fldHlps.keySet()) {
|
||||
Map<String, String> map = fldHlps.get(name);
|
||||
buf.append("{");
|
||||
for(String name1: map.keySet() ) {
|
||||
buf.append("'" + name1 + "'");
|
||||
buf.append(":");
|
||||
buf.append("'" + map.get(name1) + "'");
|
||||
buf.append(",");
|
||||
}
|
||||
buf.deleteCharAt(buf.length() - 1);
|
||||
buf.append("},\n");
|
||||
}
|
||||
buf.deleteCharAt(buf.length() - 1);
|
||||
buf.append(" },\n");
|
||||
buf.append(" formatter: function(row, column, cellValue, index) {\n" +
|
||||
" if (cellValue == null || cellValue === '') {\n" +
|
||||
" return ''\n" +
|
||||
" }\n" +
|
||||
" var name = column.property\n" +
|
||||
"\n" +
|
||||
" if (!dict.data.hasOwnProperty(name)) {\n" +
|
||||
" return cellValue\n" +
|
||||
" }\n" +
|
||||
" if (!dict.data[name].hasOwnProperty(cellValue)) {\n" +
|
||||
" return cellValue\n" +
|
||||
" }\n" +
|
||||
" return dict.data[name][cellValue]\n" +
|
||||
" },\n" +
|
||||
" get: function(name) {\n" +
|
||||
" if (!dict.data.hasOwnProperty(name)) {\n" +
|
||||
" return {}\n" +
|
||||
" }\n" +
|
||||
" let data2 = []\n" +
|
||||
" for (var key in dict.data[name]) {\n" +
|
||||
" data2.push({value: key, label: dict.data[name][key]})\n" +
|
||||
" }\n" +
|
||||
" return data2\n" +
|
||||
" }\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"export default dict");
|
||||
|
||||
try {
|
||||
FileUtils.write(new File("dict.js"), buf.toString(), "UTF-8");
|
||||
} catch (IOException e) {
|
||||
msgLog.info(e.toString(), e);
|
||||
resultT.setMsgCod(CommonMessageCode.FAIL);
|
||||
resultT.setMsgInf(e.toString());
|
||||
return resultT;
|
||||
}
|
||||
resultT.setMsgCod(CommonMessageCode.SUCC);
|
||||
|
||||
return resultT;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Map map = new LinkedHashMap();
|
||||
map.put("2", "测试2");
|
||||
map.put("1", "测试1");
|
||||
map.put("4", "测试4");
|
||||
map.put("5", "测试5");
|
||||
|
||||
System.out.println(JSON.toJSONString(map));
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,10 @@
|
||||
border
|
||||
v-loading="dataListLoading"
|
||||
@selection-change="selectionChangeHandle"
|
||||
style="width: 100%;">
|
||||
style="width: 100%;"
|
||||
height="400">
|
||||
<el-table-column
|
||||
fixed
|
||||
type="selection"
|
||||
header-align="center"
|
||||
align="center"
|
||||
|
||||
Reference in New Issue
Block a user