Merge remote-tracking branch 'origin/branch_20190822' into branch_20190822

This commit is contained in:
lai_kd
2019-08-29 17:44:45 +08:00
10 changed files with 288 additions and 36 deletions
+2
View File
@@ -11,9 +11,11 @@ import httpRequest from '@/utils/httpRequest' // api: https://github.com/axios/a
import { isAuth } from '@/utils'
import cloneDeep from 'lodash/cloneDeep'
import './utils/directives.js'
import dict from './utils/dict'
Vue.use(VueCookie)
Vue.config.productionTip = false
Vue.prototype.dict = dict
// 非生产环境, 适配mockjs模拟数据 // api: https://github.com/nuysoft/Mock
if (process.env.NODE_ENV !== 'production') {
+90
View File
@@ -0,0 +1,90 @@
import httpRequest from '@/utils/httpRequest' // api: https://github.com/axios/axios
import { isGDASucc } from '@/utils'
var storage = {
set(key, value) {
sessionStorage.setItem(key, JSON.stringify(value))
},
get(key) {
return JSON.parse(sessionStorage.getItem(key))
},
remove(key) {
sessionStorage.removeItem(key)
}
}
const dict = {
flag: false,
formatter: function(row, column, cellValue, index) {
if (cellValue == null || cellValue === '') {
return ''
}
let name = column.columnKey
if (name == null) {
name = column.property
}
let data = storage.get(name)
console.log('data1:' + data)
if (!data) {
dict.getHlpData(name)
return cellValue
}
if (!data.hasOwnProperty(cellValue)) {
return cellValue
}
console.log('data2:' + data[cellValue])
return data[cellValue]
},
get: function(name) {
let data = storage.get(name)
if (!data) {
return {}
}
let data2 = []
for (var key in data) {
data2.push({value: key, label: data[key]})
}
return data2
},
getHlpData: function(name) {
if (dict.flag) {
return
}
dict.flag = true
if (storage.get(name)) {
return
}
// 后台获取
httpRequest({
url: httpRequest.adornUrl('/buipubbpc1/buiHlpQueryByName.do'),
method: 'get',
params: httpRequest.adornParams({
'name': name
})
}).then(({data}) => {
dict.flag = false
if (isGDASucc(data)) {
if (data.data) {
let data1 = {}
for (let k in data.data) {
data1[data.data[k]['fld_val']] = data.data[k]['fld_exp']
}
console.log('data1:' + JSON.stringify(data1))
storage.set(name, data1)
} else {
dict.data[name] = {}
}
} else {
dict.data[name] = {}
}
this.dataListLoading = false
})
}
}
export default dict
+2 -2
View File
@@ -25,7 +25,7 @@ http.interceptors.request.use(config => {
}, error => {
console.log('request.use:' + error)
Message.error({message: 'communcation error:' + error})
return null
return ''
})
/**
@@ -46,7 +46,7 @@ http.interceptors.response.use(response => {
}, error => {
console.log('response.use:' + error)
Message.error({message: 'communcation error:' + error})
return null
return ''
})
/**
+13
View File
@@ -0,0 +1,13 @@
var storage = {
set(key, value) {
sessionStorage.setItem(key, JSON.stringify(value))
},
get(key) {
return JSON.parse(sessionStorage.getItem(key))
},
remove(key) {
sessionStorage.removeItem(key)
}
}
export default storage
+1 -1
View File
@@ -62,7 +62,7 @@
},
menuActiveName: {
get () { return this.$store.state.common.menuActiveName },
set (val) { this.$store.commit('common/', val) }
set (val) { this.$store.commit('common/updateMenuActiveName', val) }
},
mainTabs: {
get () { return this.$store.state.common.mainTabs },
@@ -53,7 +53,7 @@
<el-col :span="12">
<el-form-item label="用户类型" prop="operType">
<el-select v-model="dataForm.operTypeList" placeholder="请选择" style="width:170px">
<el-option v-for="item in operTypeList" :key="item.value" :label="item.label" :value="item.value">
<el-option v-for="item in dict.get('oper_typ')" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
@@ -133,22 +133,6 @@
status: '0'
},
orgNoList: [],
operTypeList: [{
value: '1',
label: '管理人员'
}, {
value: '2',
label: '业务操作人员'
}, {
value: '3',
label: '客户经理'
}, {
value: '4',
label: '技术操作员'
}, {
value: '9',
label: '其他'
}],
dataRule: {
operNo: [
{ required: true, message: '登录账号不能为空', trigger: 'blur' }
+5 -15
View File
@@ -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"
@@ -37,7 +39,8 @@
</el-table-column>
<el-table-column
prop="oper_typ"
:formatter = "operTypStateFormat"
column-key="oper_typ"
:formatter = "dict.formatter"
header-align="center"
align="center"
label="用户类型">
@@ -136,19 +139,6 @@
},
methods: {
// 数据转义
operTypStateFormat (row, column) {
if (row.oper_typ === '1') {
return '管理人员'
} else if (row.oper_typ === '2') {
return '业务操作人员'
} else if (row.oper_typ === '3') {
return '客户经理'
} else if (row.oper_typ === '4') {
return '技术操作员'
} else {
return '其他'
}
},
// 获取数据列表
getDataList () {
this.dataListLoading = true
Binary file not shown.
@@ -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"