select sum(sum_price) from ocm_purchaseplan_manager where status = '18' and year_period = ? and proect_name_id = ?
10:46:03.016 [http-nio-80-exec-10] DEBUG c.t.p.o.m.O.sumApprovedAmount - ==> Parameters: 2019(String), 5048(String)
select sum(contract_Amount) from ocm_contract_review where status = '3' and PROECT_NAME_ID=5048 and to_date(sign_time,'yyyy-mm-dd') between to_date('2019-01-01','yyyy-mm-dd') and to_date('2019-12-31','yyyy-mm-dd')
var optioncya = {
grid : {},
title : {
text : '',
},
tooltip:{
trigger:'item',
confine : true,
/* formatter:"{b} : {c} (万元)({d}%)" */
formatter:function(data){
var value = data.value;
if(value==null || value == "" || value == "0" || value == "0.0" || value == "0.00"){
value = "0.00";
}else{
value = Number(value);
//千分位显示
value = (value.toFixed(2)+"").replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g,'$&,');
}
return data.name + ":" + value +"万元(" + data.percent.toFixed(2) +"%)";
}
},
legend:{
orient:'vertical',
left: 'right',
data : eval(currentYearAmount)
},
series : [ {
type : 'pie',
radius : '70%',
data : eval(currentYearAmount),
avoidLableOverlap:false,
label : {
normal : {
show : false
}
}
} ],
color : [
'#5ab1ef','#FF8C00',
]
};
$c._fillQS(!$dp.has.d,1)------my97时间插件右键官网设置 默认为1(有);改为0为即可
js判断包含 以及替换:
if(newValue.indexOf("<") != -1){
newValue = newValue.replace(/</g,"<");
$('.treeTable').treeTable('setCellValue', {
id : rowKey, //列id
columnName : columnName, //列名称
value : newValue //设置的内容
});
return false;
}
JS动态添加----
var obj = document.getElementById('projectName')
obj.onclick=function(){
alert(1111);
}
obj.onclick=function(){
alert(1112);
}
obj.onclick=function(){
alert(1113);
}
只有最后一个有效;IE FF 都有效
var obj = document.getElementById('projectName')
obj.attachEvent("onclick",method1);
obj.attachEvent("onclick",method2);
obj.attachEvent("onclick",method3);
function method1(){alert(111);}
function method2(){alert(112);}
function method3(){alert(113);}
321弹出;IE 有效
var obj = document.getElementById('projectName')
obj.addEventListener("click",method1,false);
obj.addEventListener("click",method2,false);
obj.addEventListener("click",method3,false);
function method1(){alert(111);}
function method2(){alert(112);}
function method3(){alert(113);}
123弹出;FF 有效
JS动态添加----
---------按月份查询
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date btime;
Date Etime;
try {
btime = sdf.parse(bcode);
Etime = sdf.parse(ecode);
criteria.andBetween("createDate", new Date(btime.getTime()), new Date(Etime.getTime()));
} catch (ParseException e) {
e.printStackTrace();
}
页面转义:newValue = $('<span/>').text(newValue).html();
页面时间转换:<input name="compilDate" readonly="readonly" class="textfield_2_100" id="compilDate"
value="<fmt:formatDate value='${ocmContractReview.completeDate}' pattern='yyyy-MM-dd' />"
onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" options="{ labelWidth : 100,width:230,height:25}"/>
页面中报错: 1.js问题--可能是没有取到值,取某一行或者整个表格的数据 rowData为空,rowData.数据就会报错
ajax后台判断状态
var flag = true;
$.ajaxSettings.async = false;
$.post('fmCheckBudgetData', {'id': datas[0].id}, function(datas) {
if (datas.status == '2' || datas.status == '3') {
$.popmsg({
msg : '请勿重复提交'
}, 'error');
flag = false;
return flag;
}
});
$.ajaxSettings.async = true;
if(!flag){
return;
}
function checkData(id){
var obj = null;
$.ajaxSettings.async = false;
$.post('checkData', {
id : id,
},function(result) {
obj = result;
});
$.ajaxSettings.async = true;
return obj;
}
页面遍历格式化
function secFmt(value) {
<c:forEach items='${secLevelList}' var ="list">
if(${list.id}==parseInt(value)){
return "<div title = '${list.name}'>${list.name}</div>";
}
</c:forEach>
}
后台链接获取与拼接
String url = request.getRequestURI().toString();
String newUrl = url.substring(0, url.indexOf("/", url.indexOf("/") + 1));
url = newUrl + "/ocm/cg/ocmPurchaseplanManagerView/" + ocmPurchaseplanManager.getId();
IPv6 --修改tomcat的bin目录catalina.bat 中 添加 set JAVA_OPTS=% -Djava.net.preferIPv4Stack=true %LOGGING_MANAGER%
前后台json数据的传递:
后台:List<LabelBean> subjectList = sysDictionaryService.getDictionarys(PmConstants.BUDGET_SUBJECT);
JSONArray choiceList = JSONArray.fromObject(subjectList);//对象转json
map.put("choiceList", choiceList.toString());
//"[{"label":"专用费","value":1021},{"label":"元件","value":1022},{"label":"外协费","value":1020},{"label":"材料费","value":1023}]"
前台:使用eval()函数计算得到json数据
var choiceArray = eval('${choiceList}');
//[{"label":"专用费","value":1021},{"label":"元件","value":1022},{"label":"外协费","value":1020},{"label":"材料费","value":1023}]
//下拉框固定高度
<style type="text/css">
.ui_form_field_option_container {
height: 120px;
overflow: auto;
width: 220px;
}
</style>
<select class="select" name="projectUnit" id="projectUnit" options="{label : '承担部门',width : 200,height : 25,
readOnly : false,icon : 'icon_search'}">
<c:forEach items='${orgList}' var ="list">
<option value= "${list.id}" >${list.name}</option>
</c:forEach>
</select>
jQuery 左侧菜单
$('.menu0').click(function(e){
dropSwift($(this),'.drop1');
e.stopPropagation();
})
$('.menu1').click(function(e){
dropSwift($(this),'.drop1');
e.stopPropagation();
})
$('.menu2').click(function(e){
dropSwift($(this),'.drop2');
e.stopPropagation();
})
function dropSwift(dom,drop){
//点击当前元素,收起或者伸展下一级菜单
//$(drop).show();
dom.next().slideToggle();
//点击该层,将其他显示的下滑层隐藏
dom.parent().siblings().find(drop).slideUp();
}
集合排序
fundPlanList = fmFundPlanMapper.selectByExample(example);
if (fundPlanList.size()>0) {//List根据ID进行排序
Collections.sort(fundPlanList, new Comparator<FmFundPlan>() {
@Override
public int compare(FmFundPlan o1, FmFundPlan o2) {
Integer i1 = o1.getId();
Integer i2 = o2.getId();
return i1.compareTo(i2);
}
});
}
对树中数据筛选
/**
* @Title: filterNode
* @param @param fmFundPlanVo 所有数据
* @param @param targtNodes 过滤数据
* @param @return
* @Description:TODO
* @return List<FmFundPlanVo> 过滤后所有子项
* @author:秦艽
* @date:2019年4月25日 下午7:25:11
*
*/
private List<FmFundPlanVo> filterNode(FmFundPlanVo fmFundPlanVo, List<FmFundPlan> targtNodes) {
List<FmFundPlanVo> childs = fmFundPlanVo.getChilds();
List<FmFundPlanVo> newNodes = new ArrayList<>();
List<FmFundPlanVo> tagNodes = new ArrayList<>();
for (FmFundPlanVo node : childs) {
boolean flag = false;//是否有符合的节点
for (FmFundPlan targtNode : targtNodes) {
if (targtNode.getId().intValue() == node.getId().intValue()) {
newNodes.add(node);//符合节点
flag = true;
}
}
if (node.getChilds() != null && node.getChilds().size() > 0) {
List<FmFundPlanVo> retNodes = filterNode(node,targtNodes);
if (retNodes.size() > 0) {
node.setChilds(retNodes);
}else{
//没有符合的子几点
//node.setChilds(null);
if(!flag){//并且子节点也没有符合的--标记
tagNodes.add(node);
}
}
}else {
if(!flag){
//标记
tagNodes.add(node);
}
}
}
childs.removeAll(tagNodes);
return childs;
}
<form:input触发事件 (方法名不能是关键字)
<form:input cssClass="textfield" path="fileCode" id="fileCode"
errorMessage="${fileCode}" maxlength="50" onblur="check()"
options="{label:'文件编码',placeHolder:'请输入文件编码'}" />
//判断文件编码唯一性
function check(){
var oldFileCode = '${oldFileCode}';
oldFileCode = $('<span/>').html(oldFileCode).text();
var fileCode = $("#fileCode").val();
//新增时验证文件编码是否唯一
if(oldFileCode=="" && fileCode != ""){
$.ajaxSettings.async = false;
$.post(url+'/fm/sj/getCheckFileCode', {"fileCode":fileCode}, function(data) {
if (data > 0) {
$.popmsg({
msg : '文件编码已存在',
delay : 1000
},'error');
$("#fileCode").val("");
}
});
}
//修改时验证
if(oldFileCode != "" && fileCode != "" && oldFileCode != fileCode){
$.post(url+"/fm/sj/getCheckFileCode", {"fileCode":fileCode}, function(data) {
if (data > 0) {
$.popmsg({
msg : '文件编码已存在',
delay : 1000
},'error');
$("#fileCode").val(oldFileCode);
}
});
}
}
//获取路径地址
filePath =request.getSession().getServletContext().getRealPath("/excel/常规质量检查表.doc");
//下拉框加检索
<td><input class="textfield" id="principalId" maxlength="20"
id="principalId" title="" onkeyup="searchText(this,'Staff')"
options="{label:'负责人',width:230,height:25}" />
<div class="textes" id="textesStaff"></div> <input type="hidden"
id="staffId" /></td>
var f = 1;
var t = null;
function searchText(obj, flag) {
t = obj;
f = flag;
var keywords = $(obj).val();
if (keywords == '') {
$('#textes' + flag).hide();
return;
}
if (flag == "Staff") {
$.post('selectStaffList', {
"key" : keywords
}, function(result) {
var staffs = result.staffs;
if (staffs != null && staffs.length > 0) {
$('#textes' + flag).empty().show();
for (var i = 0; i < staffs.length; i++) {
$('#textes' + flag).append(
'<div class="click_work" id="'+ staffs[i].id +'">'
+ staffs[i].name + '</div>')
}
}
});
}
if (flag == "Org") {
$.post('selectOrgList', {
"key" : keywords
}, function(result) {
var orgs = result.orgs;
if (orgs != null && orgs.length > 0) {
$('#textes' + flag).empty().show();
for (var i = 0; i < orgs.length; i++) {
$('#textes' + flag).append(
'<div class="click_work" id="'+ orgs[i].id +'">'
+ orgs[i].name + '</div>')
}
}
});
}
$(document).on('click', '.click_work', function() {
var word = $(this).text();
if (f == "Staff") {
$("#staffId").val(this.id);
} else if (f == "Org") {
$("#orgId").val(this.id);
}
$(t).val(word);
$('#textes' + f).hide();
});
//隐藏文字补全框
$(document).on('click', function() {
$('#textes' + f).hide();
});
}
//oracle 语句拼接----url like '%'||#{url}||'%'
//oracle 拼接列数据
select rs.id ,rs.name,wm_concat(to_char(t.org_id)) as orgId,wm_concat(to_char(ro.name)) as org from rac_staff rs
left join RAC_ORG_STAFF t on rs.id = t.staff_id
left join rac_organization ro on ro.id = t.org_id
where ro.name like '%设计%'
group by rs.id,rs.name
//自输入输入框
.pmtext{
background: transparent;
width: 150px;
height: 80px;
/* line-height: 80px; */
border: 1px solid #DDD;
text-align: center;
font-size: 14px;
font-weight: bold;
/* resize: none; */
}
<div>
<input value="概述11" id="projectSummaryName" class="pmtext" onchange="checkpsName()">
<form:textarea cssClass="textarea" path="projectSummary"
errorMessage="${projectSummary}" maxlength="950" onkeydown="checklength(this);" onblur="checklength(this);"
options="{label:'',placeHolder:'请输入概述',labelWidth : '0'}" />
</div>
<div>
<input value="编制依据" class="pmtext">
<form:textarea cssClass="textarea" path="projectSource"
errorMessage="${projectSource}" maxlength="950" onkeydown="checklength(this);" onblur="checklength(this);"
options="{label:'',placeHolder:'请输入编制依据',labelWidth : '0'}" />
</div>
<div>
<input value="研制目标及研制内容" class="pmtext">
<form:textarea cssClass="textarea" id="projectContent" path="projectContent"
errorMessage="${projectContent}" maxlength="950" onkeydown="checklength(this);" onblur="checklength(this);"
options="{label:'',placeHolder:'请输入研制目标及研制内容',labelWidth : '0'}" />
</div>
<div>
<input value="研制任务难点及对策" class="pmtext">
<form:textarea cssClass="textarea" id="difficultyResolve" path="difficultyResolve"
errorMessage="${difficultyResolve}" maxlength="950" onkeydown="checklength(this);" onblur="checklength(this);"
options="{label:'',placeHolder:'请输入研制任务难点及对策',labelWidth : '0'}" />
</div>
<div>
<input value="重点管理要求" class="pmtext">
<form:textarea cssClass="textarea" path="keypointRequire"
errorMessage="${keypointRequire}" maxlength="950" onkeydown="checklength(this);" onblur="checklength(this);"
options="{label:'',placeHolder:'请输入重点管理要求',labelWidth : '0'}" />
</div>
<div>
<input value="备注" class="pmtext">
<form:textarea cssClass="textarea" path="remark" maxlength="450" onkeydown="checklength(this);"
errorMessage="${remark}" onblur="checklength(this);"
options="{placeHolder:'请输入备注',labelWidth : '0'}" />
</div>
</div>
function checkpsName(){
var projectSummaryName= $('#projectSummaryName').val();
if (projectSummaryName == '') {
$.popmsg({
msg : '名称不能为空',
delay : 1000
},'error');
$('#projectSummaryName').val('概述');
}
}
//复选框绑定 改变事件 绑定 获取复选框选中状态
$("#staffDiv").find("input[type=checkbox]").click(function(){
var id=$(this).parent().parent().attr('dataid')
var ids=[id];
var row = $('#tableStaff').table('getRowData',ids);
var table = $('#staffDiv');
var checkall = table.find('.ui_table_header_checkbox');
if (checkall[0].checked) {
addRight1();
} else {
backRight1();
}
addCheckedId(id, row[0]);
});
//js中计算时间差
var planEndTime = new Date(row.planEndTime.replace(/\-/g,"\/"));
var actualEndTime = new Date(row.actualEndTime.replace(/\-/g,"\/"));
var subtraction = actualEndTime - planEndTime;
if(subtraction > 0){//计算超期天数
var total = Math.floor(subtraction/(24*3600*1000));
}
//单选框
<div style="position: relative; height: 50px;margin-bottom: 0px;">
<div class="radio" options="{
label : '是否合格',
name : 'isQualified',
width : 720,
height : 30,
top : 10,
left : 10
}">
<input type="radio" title="是" <c:if test="${ocmLargeAperture.isQualified=='是' || ocmLargeAperture.isQualified==null}"> checked</c:if> value="是" onclick="unfold('是')"/>
<input type="radio" title="否" value="否" onclick="unfold('否')" <c:if test="${ocmLargeAperture.isQualified=='否'}"> checked</c:if>/>
</div>
</div>
$(".radio").radio();
var ss = $("input[type='radio']:checked").val();//获取选中的值
//调用子页面的方法
$("#iframeDetail")[0].contentWindow.doDelete();
//人员选择与移除
<td><input id="customerUnitName" name="customerUnitName" class="textfield1" options="{label:'客户单位',placeHolder:'请选择客户单位',readOnly : true}" type="text" value="" maxlength="66"/>
<div class="buttonGroup" >
<a options="{onclick:'unitList',icon:'icon_search'}"></a>
<a options="{onclick:'deleteUnit',icon:'icon_delete'}"></a>
</div>
</td>
$(function() {
var fieldDefault = {
width : 350,
margin : [ 10, 0, 0, 10 ]
};
var fieldDefault1 = {
width : 308,
margin : [ 10, 0, 0, 10 ]
};
var textareaDefault = $.extend({}, fieldDefault, {
width : 717,
height : 120
});
$('.buttonGroup').buttonGroup();
$('.textfield').textfield(fieldDefault);
$('.textfield1').textfield(fieldDefault1);
$('.textarea').textarea(textareaDefault);
$('.select').select(fieldDefault);
$('.table').table();
$('.ui_form_field_label').css("width","100px");
$('.textfield1').css("left","100px");
$('.textfield').css("left","100px");
$('.ui_form_field_option_select ').css("left","100px");
$('.ui_form_field_placeholder ').css("left","100px");
});
//选择下一步审核人
//审批过程中添加审批人员
List<PerDeptVO> assigneeList = new ArrayList<PerDeptVO>();
assigneeList.add(null);
if(assigneeList.size()>0){
//市场副总 从新赋值
//修改人员显示页面
processExecuteWebService.setExecutionService(processId, roleName, objType, perDeptVOList);
/*jbpmTemplate.getExecutionService().setVariable(processId,
"副总" +
"ASSIGNEE_VAR_NAME", assigneeList);*/
//修改具体处理人
processExecuteWebService.reAssigneeTask(taskId, perDeptList);
//processExecuteService.reAssigneeTask(taskIdNew,assigneeList);
}
//判断是不是最后一个角色
String taskId = workflowMixBusinessService.getTaskIdByObj(id.toString(), WfConstants.WORKFLOW_FLAG_OCMCGXQ_TYPE,loginUserId);
CoopTask task = processExecuteWebService.getCoopTask(taskId);
if("SUB_TASK".equals(task.getTaskType())){//会签节点
List<cn.topera.wf.common.bean.vo.PerDeptVO> taskUsers = processExecuteWebService.getProcInstTaskUsers(task.getProcInstId(), task.getActivityName(), "");
List<CoopApprove> taskApproves = processQueryService.getTaskApproves(task.getProcInstId(), task.getActivityName());
if (taskUsers.size() - taskApproves.size() == 1) {
map.put("lastFlag", "1");// 会签的最后一个人审批
}
}
//div合并表头
<div class="inline_block ui_treetable_headers_col" style="width: 136px; border-right: 1px solid rgb(221, 221, 221); border-bottom: 1px solid rgb(221, 221, 221); line-height: 20px;"><div style="width: 100%;height:50%;line-height: 20px;border-right:none;border-bottom:1px solid #DDD;" class="">合同测试名称</div><div style="width: 50%;height:50%;line-height: 30px;float:left;border-right:1px solid #DDD;border-bottom:none;display:inline-block;" class="">合同测试名</div><div style="width: 50%;height:50%;line-height: 30px;float:left;border-right:none;border-bottom:none;display:inline-block;" class="">合同测试名</div></div>
//js 中对象和字符串互转
JSON.stringify(obj)
JSON.parse(str)
//复选框获取选中值
var checkedColumns = [];
$('input[name="columns"]:checked').each(function(){
checkedColumns.push($(this).val());
})
//获取<p>77</p>内容
$('p').text();
//java天数计算
Date actualEndTime = ocmProgressPlan.getActualEndTime();
Date planEndTime = ocmProgressPlan.getPlanEndTime();
//根据时间设置状态
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
if (actualEndTime != null && planEndTime != null) {
long time = actualEndTime.getTime();
long time2 = planEndTime.getTime();
//相差天数
long day = (time-time2)/(24*60*60*1000);
//完成状态
if(day <= 0){
ocmProgressPlanWbsVo.setWorkStatus("0");
}else if (day > 0 && day <30) {
ocmProgressPlanWbsVo.setWorkStatus("1");
}else if (day >= 30 && day <60) {
ocmProgressPlanWbsVo.setWorkStatus("2");
}else {
ocmProgressPlanWbsVo.setWorkStatus("3");
}
}
//input框只能输入数字且是两位
onkeyup="!/^(\d+\.?)?\d{0,2}$/.test(this.value)?(this.value=this.value.substring(0,this.value.length-1)):''"
//onkeyup="formatNum(this)" --光标不能移动
function formatNum(obj) {
//数字和.
obj.value = obj.value.replace(/[^\d.]/g,"");
//保证只有一个.
obj.value = obj.value.replace(/\.{2,}/g,".");
//第一个位数字
obj.value = obj.value.replace(/^\./g,"");
//.只能出现一次
obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
//只能输入四个小数
obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');
}
//树结构查询
select s.*
from OCM_PROGRESS_PLAN s
start with s.id = (select t.id
from OCM_PROGRESS_PLAN t
where t.ledger_id = '5654' and t.parent_code = '0')
connect by s.parent_code = prior s.id
order siblings by s.id asc
//子父页面链接
if(top.location.href==window.location.href){
var errurl = top.location.href;
if(errurl.indexOf("/error/errorIndex") != -1){
}else{
var msg = "您没有访问权限!"
msg = encodeURI(msg);//密级id,名称,菜单,模块
msg = $('<span/>').html(msg).text();
window.location.href="<%=contextPath%>/error/errorIndex?msg="+msg;
}
}
//树中的延时保存
var datas = $('.treeTable').treeTable('getDatas');
$("#fmForexUnitlist").val(JSON.stringify(datas));
JSONArray jsonArray = JSONArray.fromObject(ocmPurchaseplanManager.getFmContractShedulelist());
List<OcmPlanBudget> list = (List<OcmPlanBudget>) JSONArray.toCollection(jsonArray, OcmPlanBudget.class);
//get方法拼接中文处理
var workPackName = $('#workPackName').val();
workPackName = encodeURI(workPackName);//密级id,名称,菜单,模块
workPackName = $('<span/>').html(workPackName).text();
//IE中出现 stack overflow
1.重定义系统触发事件:onclick/onsubmit-----修改方法名
2.IE缓存满了----清缓存
3.重复引用js
4.死循环
5.页面传递路径问题----循环调用
//java.lang.IllegalArgumentException: id to load is required for loading----通过id查询时id为null(hibernate)
//键盘按键触发事件
//定义一个保存旧值得数组 数组中包含 对象{id:'',columnName:'',value:''}
var revokeArray = [];
//定义一个保存新值得数组 数组中包含 对象{id:'',columnName:'',value:''}
var newValueArray = [];
var beforeKeyValue = {};
document.onkeydown = function(e) {
var ev = e || event;
if (ev && ev.keyCode == 9) {//Tab 键
$('.treeTable').treeTable('editNext');
return false;
}
if (ev.ctrlKey == true && ev.keyCode == 90) {//ctrl+z
if ('id' in beforeKeyValue) {
document.getElementById(beforeKeyValue.id + '$'
+ beforeKeyValue.columnName).style.backgroundColor = '';//绿
}
if (revokeArray && revokeArray.length > 0) {
//得到最后一个属性的数组
var lastProp = revokeArray.pop();
//得到数组的最后一个 键值对
var lastKey;
var lastValue;
for ( var m in lastProp) {
lastKey = m;
lastValue = lastProp[m];
}
// 取消编辑
$('.treeTable').treeTable('cancelEdit');
//将目前的值保存到新的数组中
var curVal = $('.treeTable').treeTable('getCellValue', {
id : lastProp.id,
columnName : lastKey
});
var curObj = {
"id" : lastProp.id
};
curObj[lastKey] = curVal;
newValueArray.push(curObj);
//先结束编辑,然后赋值
$('.treeTable').treeTable('setCellValue', {
id : lastProp.id,
columnName : lastKey,
value : lastValue
});
beforeKeyValue.id = lastProp.id;
beforeKeyValue.columnName = lastKey;
document.getElementById(lastProp.id + '$' + lastKey).style.backgroundColor = '#c7edcc';//绿
//调用ajax保存到数据库
var data = {
columnName : lastKey,
id : lastProp.id
};
data[lastKey] = lastValue;
$.ajax({
type : 'POST',
url : 'saveOneNode',
data : data,
dataType : 'json',
success : function(data, textstatus, jqXmlHttpRequest) {
}
});
// TODO
}
}
if (ev.ctrlKey == true && ev.keyCode == 89) {//ctrl+y
if ('id' in beforeKeyValue) {
document.getElementById(beforeKeyValue.id + '$'
+ beforeKeyValue.columnName).style.backgroundColor = '';//绿
}
if (newValueArray && newValueArray.length > 0) {
//得到最后一个属性的数组
var lastProp = newValueArray.pop();
//得到数组的最后一个 键值对
var lastKey;
var lastValue;
for ( var m in lastProp) {
lastKey = m;
lastValue = lastProp[m];
}
// 取消编辑
$('.treeTable').treeTable('cancelEdit');
//将目前的值保存到新的数组中
var curVal = $('.treeTable').treeTable('getCellValue', {
id : lastProp.id,
columnName : lastKey
});
var curObj = {
"id" : lastProp.id
};
curObj[lastKey] = curVal;
revokeArray.push(curObj);
//先结束编辑,然后赋值
$('.treeTable').treeTable('setCellValue', {
id : lastProp.id,
columnName : lastKey,
value : lastValue
});
beforeKeyValue.id = lastProp.id;
beforeKeyValue.columnName = lastKey;
document.getElementById(lastProp.id + '$' + lastKey).style.backgroundColor = '#c7edcc';//绿
//调用ajax保存到数据库
var data = {
columnName : lastKey,
id : lastProp.id
};
data[lastKey] = lastValue;
$.ajax({
type : 'POST',
url : 'saveOneNode',
data : data,
dataType : 'json',
success : function(data, textstatus, jqXmlHttpRequest) {
}
});
// TODO
}
}
}
//树中设置 输入框 类型
var editor2 = {
type : 'date',
config : {
dateFmt : 'yyyy-MM-dd',
readOnly : true
}
}
if (columnName == "remark" && newValue == "准确时间") {
for ( var m in columnArray1) {
if (columnArray1[m].name == 'deadline') {
columnArray1[m].editor = editor2;
columnArray1[m].editable = true;
}
}
}
//1491$nodeRequest #1491$nodeRequest 树中双击可以编辑
if(columnName == 'nodeRequest'){
$("div").dblclick(function(){
a=1;
});
if(a == '1'){//双击
falg = true;
a = 0;
}else{
falg = false;
}
}
//按周选择日期
<form:input cssClass="Wdate textfield" path="actualEndTime" id="actualEndTime"
onFocus="WdatePicker({isShowWeek:true,readOnly:true,onpicked:function(){$dp.$('d122_1').value=$dp.cal.getP('W','W');$dp.$('d122_2').value=$dp.cal.getP('W','WW');}})"
errorMessage="${actualEndTime}" maxlength="100"
options="{label:'<span class=\"required\">*</span>实际完成时间',placeHolder:'请选择回报时间'}" />
//javax.servlet.ServletException: File [/WEB-INF/views/.jsp] not found--问题原因是给页面返回值错误;重定向返回页面容易出错;路径错误
//页面表格颜色没有渲染---lib中配置文件cas.server地址未使用域名而是ip导致
//oracle 中 case when 在where中的应用 --查询当data_status = '2'时month='10'的所有数据
select *
from SP_PLAN_SCHEDULE
where parent_code = '6091'
and year = '2019'
and data_status != '3'
and (case when data_status = '2' then month else '10' end)='10' --当data_status = '2' 时 and 后条件是 month = '10' 否则 是 '10' = '10' 即没有条件 ===>只去data_status = '2' month = '10' 两个同时满足的数据
order by forstr(WBS_CODE)
===>
//自写sql并设置条件/排序
@Select({ "<script>", "select * from SP_PLAN_SCHEDULE ",
" where parent_code = #{parentCode} and year = #{year} and data_status != #{dataStatus} ",
" <if test='month != null '>",
" and (case when data_status = '2' then month else #{month} end)=#{month} ",
" </if>",
" order by forstr( WBS_CODE) ",
"</script>" })
//max函数去重
@Select({"<script>",
" select * from ( select rownum as rw, z.* from (select j.* from jbpm_task_his j where id=(select max(id) from jbpm_task_his s where s.proc_inst_id=j.proc_inst_id) and UNDERTAKER_ID='${undertakerId}' order by ${sortBy} ${sort} )z) where rw>${pageStart} and rw<=${pageEnd} ",
"</script>"
})
public List<JbpmTaskHis> getList(@Param("pageStart")Integer pageStart,@Param("pageEnd")Integer pageEnd, @Param("sortBy") String sortBy, @Param("sort") String sort, @Param("undertakerId") String undertakerId );
//高效率去重
select t.* from jbpm_task t where rowid in( select min(rowid) from jbpm_task t where t.draft_person_id = 'shengaj' and t.task_type !='1' group by t.proc_inst_name)
select j.*
from jbpm_task_his j
where id = (select max(id)
from jbpm_task_his s
where s.proc_inst_id = j.proc_inst_id and s.UNDERTAKER_ID = j.UNDERTAKER_ID)
and UNDERTAKER_ID = 'liuqy'
order by task_end_time desc
//前一个月
select * from OCM_CONTRACT_INFORMATION where to_date(PAY_TIME,'yyyy-mm-dd') < add_months(sysdate,-1);
//最后一轮谈判 后一个月提醒签订合同
select j.*
from OCM_NEGOTIATION_PROCESS j
where id = (select max(id)
from OCM_NEGOTIATION_PROCESS s
where s.contract_id = j.contract_id)
and j.confirmation_time = to_char( add_months(sysdate,-1),'yyyy-mm-dd');
//SQL中遍历
@Select({"<script>",
"select task_code "
+ "from ( select task_id "
+ " from schedule_task_fros "
+ " where staff_id = #{staffId} "
+ " <if test=\"roleIds != null\">"
+ " or role_id in <foreach collection=\"roleIds\" item=\"roleId\" close=\")\" open=\"(\" separator=\",\">#{roleId}</foreach> "
+ " </if>"
+ " <if test=\"orgIds != null\">"
+ " or org_id in <foreach collection=\"orgIds\" item=\"orgId\" close=\")\" open=\"(\" separator=\",\">#{orgId}</foreach> "
+ " </if>"
+ " group by task_id "
+ ") r "
+ "left join schedule_task on task_id = id",
"</script>"})
List<String> getTaskByPromiss(@Param("staffId")String staffId, @Param("roleIds")List<Integer> roleIds, @Param("orgIds")List<Integer> orgIds);
//分组
//根据parentId分组
Map<Integer, List<Func>> collect = list.stream().collect(Collectors.groupingBy(Func::getParentId));
for (Integer key : collect.keySet()) {
List<Func> groupList = collect.get(key);
for (Func st : groupList) {
Item item = new Item( st.getId()+ "",st.getName(),CenterConfigUtil.replaceProperty(st.getIconUrl()),st.getUrl(),st.getFlag());
group.getItems().add(item);
}
}
result.add(group);
//用户默认数据--去重
List<Item> list1=itemService.getShortcutList(appId,mr1);//深化论证及合同签订过程
for (Item item : list1) {
list = list.stream().filter(x->!(item.getId()).equals(x.getId())).collect(Collectors.toList());
}
//多表联查
select s.id, s.name,o.id,o.name,t.* from RAC_ROLE t
left join rac_role_staff rs on rs.role_id = t.id
left join rac_staff s on s.id = rs.staff_id
left join rac_org_staff os on os.staff_id = s.id
left join rac_organization o on o.id = os.org_id
where t.flag = 'BGSZB'and o.flag = '04'
//复制旧表结构
create table newTableName like oldTableName
//echarts 悬浮自定义 千分位 百分号保留两位小数
tooltip:{
trigger:'item',
/* formatter:"{b} : {c} (万元)({d}%)" */
formatter:function(data){
var value = data.value;
if(value==null || value == "" || value == "0" || value == "0.0" || value == "0.00"){
return "0.00";
}else{
value = Number(value);
//千分位显示
value = (value.toFixed(2)+"").replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g,'$&,');
return data.name + ":" + value +"万元(" + data.percent.toFixed(2) +"%)";
}
}
},
insert into OCM_PLAN_BUDGET(id,budget_id,plan_id,fund_item_number,fund_item_name,fund_support_item,sum_price,approved_account,approving_account,resolve_content,resolve_account,resolve_basis,status,character,remark,parent_code,implement_amount,contract_id,contract_change_id,plan_change_id,year_period) values (SEQ_OCM_BUDGET.NEXTVAL,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
java.sql.BatchUpdateException: ORA-01810: 格式代码出现两次 ---时间格式处理 : hh24:mi:ss
java.sql.SQLException: 索引中丢失 IN 或 OUT 参数:: 1
List<FmContractShedule> fcsInsertList = new ArrayList<>();//批量数据List
fcsInsertList.add(fmContractShedule);
JdbcUtil.insertList(fcsInsertList, FmContractShedule.class,"SEQ_FM_CONTRACT_SHEDULE");
List<String> modelIdList = new ArrayList<>();//对象id
Map<String, String> teamMap = new HashMap<String, String>();
teamMap.put("modelType", "fmContractBudget");
for(FmContractBudget qm : list){
modelIdList.add(String.valueOf(qm.getId()));
}
/**
* 批量查询所有对象id对应的人员
* where t.model_id = '${modelId}' and t.model_type= '${modelType}'
*/
List<PubSecscope> pubSecscope =(List<PubSecscope>) JdbcUtil.queryList(modelIdList, PubSecscope.class, "modelId",teamMap,null);
List<SysDictionary> sysMjList = sysDictionaryService.getSysDictionarys(PmConstants.DATA_SECURITY_CODE);
for (FmAttachment fmAttachment : attachmentList) {
//String secName = sysDictionaryService.getSysDictionary(fmAttachment.getSecLevel().intValue()).getName();
String secName = "";
for (SysDictionary sysDictionary : sysMjList) {
if(sysDictionary.getId().equals(fmAttachment.getSecLevel())){
secName = sysDictionary.getName();
break;
}
}
//复选框反选 选择器使用
function setChecked(checkStatus){
$("[name = "+checkStatus+"]").attr("onclick","return false;")
//var obj = document.getElementsByClassName("myCheck");//获取input
$("#myTable").find("tr input[value=1]").each(function(){
this.checked =true;
})
}
每次执行indexOf方法前执行该方法即可
//解决ie8不支持数组的indexOf方法,array的indexOf方法
function addIndexOf() {
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (elt /*, from*/) {
var len = this.length >>>0;
var from = Number(arguments[1]) || 0;
from = (from < 0)
? Math.ceil(from)
: Math.floor(from);
if (from < 0) {
from += len;
}
for ( ; from < len; from++) {
if (from in this && this[from] === elt) {
return from;
}
}
return -1;
};
}
}
//BigDecimal比较大小
.compareTo(BigDecimal.ZERO) ===> -1:小于;0:等于;1:大于
update FM_CONTRACT_SHEDULE t1
set t1.approved_amount = (select decode(sum(approved_amount),null,t1.approved_amount,sum(approved_amount))
from FM_CONTRACT_SHEDULE t2
where t2.id <> t1.id
and connect_by_isleaf = 1
start with t2.id = t1.id
connect by prior t2.id = t2.parent_code);
//oracle 创建级联删除 (plsql可直接图形化) 主外键字段类型一直
alter table PIM_PLANWBS
add constraint FK_PIMMONTH foreign key (PIM_PLAN_ID)
references pim_annual_plan (ID) on delete cascade;
//树查询--
select t.ocontract_id
from (select s.*
from FM_FUND_PLAN s
where s.ocontract_id is not null
start with s.id = (select m.id
from FM_FUND_PLAN m
where m.fcontract_id = '5664'
and m.cs_parent_code = '0')
connect by s.parent_code = prior s.id
order siblings by s.id) t
group by t.ocontract_id
/* @Select({"<script>",
"select * from "
+"(( select level,CONNECT_BY_ISLEAF as leaf, s.* "
+ "from FM_CONTRACT_SHEDULE s "
+ "start with s.id = (select m.id "
+ "from FM_CONTRACT_SHEDULE m "
+ "where m.contract_budget_id = #{id} "
+ "and m.parent_code = '0') "
+ "connect by s.parent_code = prior s.id "
+ "order siblings by s.id )t1 "
+"left join (select t.project_id, sum(replace(t.pay_money,',','')) as payMoney from FM_OTHER_PAY t group by t.project_id) t2 on t2.project_id = t1.id) order by id ",
"</script>"
})
*/ /*@Select({"<script>",
"select level,CONNECT_BY_ISLEAF as leaf, s.* "
+ "from (select *from FM_CONTRACT_SHEDULE t1 "
+ " left join (select t.project_id,sum(replace(t.pay_money, ',', '')) as payMoney "
+ " from FM_OTHER_PAY t "
+ " group by t.project_id) t2 "
+ " on t2.project_id = t1.id) s "
+ "start with s.id = (select m.id "
+ "from FM_CONTRACT_SHEDULE m "
+ "where m.contract_budget_id = #{id} "
+ "and m.parent_code = '0') "
+ "connect by s.parent_code = prior s.id "
+ "order siblings by s.id ",
"</script>"
})*/
//质保金应付时间前一个月提醒
select * from OCM_CONTRACT_INFORMATION where payment_category = '1052' and PAY_TIME = to_char(add_months(sysdate,1),'yyyy-mm-dd') ;
//合同验收时间后一个月
select * from OCM_SUPPLIER_GRADE where to_char( contract_check_date,'yyyy-mm-dd') = to_char( add_months(sysdate,-1),'yyyy-mm-dd') ;
//最后一轮谈判 后一个月提醒签订合同
select j.*
from OCM_NEGOTIATION_PROCESS j
where id = (select max(id)
from OCM_NEGOTIATION_PROCESS s
where s.contract_id = j.contract_id)
and j.confirmation_time = to_char( add_months(sysdate,-1),'yyyy-mm-dd'); (1=1)
//组织所查人员id集合 java8
List<Integer> allIdList = smpList.stream().map(SmpWbsTable::getGroupLeader).collect(Collectors.toList());
//去重
List<Integer> idsList = allIdList.stream().distinct().collect(Collectors.toList());
//根据id获取所需人员的信息
List<OrgStaff> orgStaffList = all.stream().filter(c->idsList.contains(c.getStaffId())).collect(Collectors.toList());
//js中监听变量 数据劫持
var monitor = {saveFlag : 0};
var lastTimeValue = monitor.saveFlag;
Object.defineProperty(monitor,'saveFlag',{
get:function(){
return saveFlag;
},
set:function(value){
saveFlag = value;
if(lastTimeValue != saveFlag){
lastTimeValue = saveFlag;
var tableConfig = {url:'fmNewSumBudgetListNewData?budfileCode='+budfileCode,maxLevel:2,}
$('.treeTable').treeTable('reload', tableConfig);
}
}
});
// 生成webservice接口调用代码
C:\Users\Administrator.USER-20190610UM>wsimport -keep -d E:\genereted\class -s E:\g
enereted\java -p com.webservice -verbose http://aj.topera.cn/topera-pm-service/ws/PmService?wsdl
// 路径获取
String s1=request.getRequestURL().toString();// http://aj.topera.cn/topera-pm-web/pim/annual/pimAnnualPlanList
String s2=request.getRequestURI().toString();// /topera-pm-web/pim/annual/pimAnnualPlanList
String s3=request.getContextPath().toString();// /topera-pm-web
String s4=request.getServletPath().toString();// /pim/annual/pimAnnualPlanList
String s5=request.getServerName().toString();// aj.topera.cn
String s6=request.getLocalName().toString();// USER-20190610UM
String s7=request.getRealPath("/").toString();// D:\tools\apache-tomcat-8.5.31\webapps\topera-pm-web\
String s8=request.getScheme().toString();// http
int s9=request.getServerPort();// 80