<table class="honry-table" cellpadding="1" cellspacing="1" style="margin:10px auto 0;">
<tr>
<td class="honry-lable">医生名称:</td>
<td class="honry-info">
<input id="emplCode" name="conEmplSymptom.emplCode" value="${conEmplSymptom.emplCode}" data-options="required:true, missingMessage:'请选择医生!'" style="width:95%"/>
</td>
</tr>
<tr>
<input type ="hidden" id="hospitalCode" name="conEmplSymptom.hospitalCode" value="${conEmplSymptom.hospitalCode}" style="width:95%"/>
</tr>
</table>
var selectNode = $('#tDt').tree("getSelected");//选中树节点
var selectNode1 = $('#list').datagrid("getSelected");//选中表格
var conEmplSymptomId ="${conEmplSymptom.id}";
var hospId;//医院id
var nodeId,type,pid;//节点id,类型,根节点
//点击树节点获取下拉表格查询参数设置
if(null != selectNode && selectNode.id != 'root'){
nodeId = selectNode.id;
type = selectNode.attributes.type;
pid = selectNode.attributes.pid;
if(type == 'c'){//科室导航
nodeId = pid;
}
if(type == 'd'){//实际科室
nodeId = nodeId.substring(id.indexOf("-")+1,id.length);//转化id,去掉"...-"
}
}
//edit:选中表格任意一行数据,combogrid回显
if(selectNode1!=null && conEmplSymptomId !=''){
type='e'
nodeId = selectNode1.emplCode;
}
$('#emplCode').combogrid({
panelWidth:600,
panelHeight:300,
rownumbers:true,
striped:true,
border:true,
mode: 'remote',
prompt:'输入查询,点击选取',
url:"<%=basePath%>sys/employee/queryAllEmployees.action",
method: 'post',
queryParams: {
'vo.type': type,
'vo.deptCode': nodeId,
},
idField: 'employeeJobno',
textField: 'employeeName',
required:true,
tipPosition:'left',
fitColumns: true,
multiple:false,
pageNumber:1,
pagination:true,
pageSize:20,
pageList:[20,30,50,100],
columns: [
[{
field: 'employeeJobno',
title: '员工工号',
hidden: true,
sortable: true,
},
{
field: 'employeeName',
title: '员工名称',
width: 60,
sortable: true
},
{
field: 'employeeDeptname',
title: '科室名称',
width: 100,
sortable: true
},
{
field: 'employeeHospitalName',
title: '医院名称',
width: 100,
sortable: true
},
]
],
onSelect: function(index, row) {
$("#hospitalCode").val(row.employeeHospitalid);
},
});
//添加时回显科室
if(type=='e' && conEmplSymptomId ==''&&null!= selectNode&&selectNode.id != 'root'){
$('#emplCode').combogrid('setValue',selectNode.id);
//递归获取医院code
var hospitalCode,father;
function getHospitalCode(node){
if (node!=null && node !=undefined && node !='') {
nodeType = node.attributes.type;
console.log(nodeType);
if(nodeType != 'd'){
father = $('#tDt').tree("getParent",node.target);
getHospitalCode(father);
}else{
hospitalCode = node.attributes.pid;
}
}
return hospitalCode;
}
$("#hospitalCode").val(getHospitalCode(selectNode));
}