ปรับปรุงการค้นหา

This commit is contained in:
LAPTOP-KB8JC2K2\acer
2021-09-11 12:28:00 +07:00
parent edc9bf053e
commit 98dd8b0860
14 changed files with 103 additions and 39 deletions

View File

@@ -20,9 +20,9 @@ namespace TodoAPI2.Models
public int? org_id { get; set; }
public string search_employee_code { get; set; }
public int? employee_id { get; set; }
public string search_employee_fullname { get; set; }
public string evaluation_round_search { get; set; }
}
}

View File

@@ -223,16 +223,30 @@ namespace TodoAPI2.Models
var entity = Get(id, emp_id);
var i = Mapper.Map<eva_create_evaluation_detail_firstdocWithSelectionViewModel>(entity);
i.item_org_id = ext.GetDepartmentData();
i.item_employee_id = (from x in emp.GetAllEmployee()
where x.count_resigns == 0 && x.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา"
orderby x.fullname
select new external_linkageViewModel { external_id = x.id, external_name = x.fullname }
).ToList();
i.item_evaluation_round_search = (from x in _repository.Context.eva_performance_plan
orderby x.fiscal_year descending, x.theTime descending
select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) }
).ToList();
return i;
}
public eva_create_evaluation_detail_firstdocWithSelectionViewModel GetBlankItem()
{
var i = new eva_create_evaluation_detail_firstdocWithSelectionViewModel();
i.item_org_id = ext.GetDepartmentData();
i.item_employee_id = (from x in emp.GetAllEmployee()
where x.count_resigns == 0 && x.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา"
orderby x.fullname
select new external_linkageViewModel { external_id = x.id, external_name = x.fullname }
).ToList();
i.item_evaluation_round_search = (from x in _repository.Context.eva_performance_plan
orderby x.fiscal_year descending, x.theTime descending
select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) }
).ToList();
return i;
}
@@ -245,6 +259,14 @@ namespace TodoAPI2.Models
public List<eva_create_evaluation_detail_firstdocViewModel> GetListBySearch(eva_create_evaluation_detail_firstdocSearchModel model, int? emp_id)
{
if (string.IsNullOrEmpty(model.evaluation_round_search))
{
model.evaluation_round_search = (from x in _repository.Context.eva_performance_plan
orderby x.fiscal_year descending, x.theTime descending
select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) }
).FirstOrDefault().id_guid.ToString();
}
var allemp = emp.GetListByemployee_type(null, null);
var dept = ext.GetDepartmentData();
@@ -282,8 +304,8 @@ namespace TodoAPI2.Models
where 1 == 1
&& (m_eva_create_evaluation_detail_agreement.create_evaluation_id == model.create_evaluation_id || !model.create_evaluation_id.HasValue)
&& (fk_external_employee.department_id == model.org_id || !model.org_id.HasValue)
&& (fk_external_employee.employee_no == model.search_employee_code || string.IsNullOrEmpty(model.search_employee_code))
&& (fk_external_employee.fullname.Contains(model.search_employee_fullname) || string.IsNullOrEmpty(model.search_employee_fullname))
&& (fk_external_employee.id == model.employee_id || !model.employee_id.HasValue)
&& (string.IsNullOrEmpty(model.evaluation_round_search) || fk_planResult.id == Guid.Parse(model.evaluation_round_search))
&& (m_eva_create_evaluation_detail_agreement.employee_id == emp_id || m_eva_create_evaluation_detail_agreement.chief == emp_id)
orderby

View File

@@ -8,6 +8,8 @@ namespace TodoAPI2.Models
public class eva_create_evaluation_detail_firstdocWithSelectionViewModel: eva_create_evaluation_detail_firstdocViewModel
{
public List<external_linkageViewModel> item_org_id { get; set; }
public List<external_linkageViewModel> item_employee_id { get; set; }
public List<external_linkageViewModel> item_evaluation_round_search { get; set; }
}
}

View File

@@ -24,6 +24,8 @@ namespace TodoAPI2.Models
public int? employee_id { get; set; }
public string evaluation_round_search { get; set; }
public string path { get; set; }
}
}

View File

@@ -222,7 +222,11 @@ namespace TodoAPI2.Models
item.item_level_score = (from i in _repository.Context.eva_level_score
orderby i.min_score
select Mapper.Map<eva_level_scoreViewModel>(i)).ToList();
item.item_employee_id = (from x in emp.GetAllEmployee() where x.count_resigns == 0 select x).ToList();
item.item_employee_id = (from x in emp.GetAllEmployee() where x.count_resigns == 0 && x.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา" select x).ToList();
item.item_evaluation_round_search = (from x in _repository.Context.eva_performance_plan
orderby x.fiscal_year descending, x.theTime descending
select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) }
).ToList();
return item;
}
@@ -231,9 +235,10 @@ namespace TodoAPI2.Models
var i = new eva_create_evaluation_detail_processWithSelectionViewModel();
i.item_org_id = ext.GetDepartmentData();
i.item_employee_id = (from x in emp.GetAllEmployee() where x.count_resigns == 0 && x.workingstatus != "คณะกรรมการเนติบัณฑิตยสภา" select x).ToList();
//i.item_level_score = (from j in _repository.Context.eva_level_score
// orderby j.min_score
// select Mapper.Map<eva_level_scoreViewModel>(i)).ToList();
i.item_evaluation_round_search = (from x in _repository.Context.eva_performance_plan
orderby x.fiscal_year descending, x.theTime descending
select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) }
).ToList();
return i;
}
@@ -260,6 +265,14 @@ namespace TodoAPI2.Models
public List<eva_create_evaluation_detail_processViewModel> GetListBySearch(eva_create_evaluation_detail_processSearchModel model, int? emp_id, string path)
{
if (string.IsNullOrEmpty(model.evaluation_round_search))
{
model.evaluation_round_search = (from x in _repository.Context.eva_performance_plan
orderby x.fiscal_year descending, x.theTime descending
select new external_linkageViewModel { id_guid = x.id, external_name = checkNull(x.theTime) + "/" + checkNull(x.fiscal_year) }
).FirstOrDefault().id_guid.ToString();
}
var allemp = emp.GetListByemployee_type(null, null);
var all_org_id = from i in ext.GetAllChildInDep(model.org_id) select i.external_id;
@@ -295,6 +308,7 @@ namespace TodoAPI2.Models
&& (all_org_id.Contains(fk_external_employee.department_id) || !model.org_id.HasValue)
&& (fk_external_employee.employee_no == model.search_employee_code || string.IsNullOrEmpty(model.search_employee_code))
&& (fk_external_employee.fullname.Contains(model.search_employee_fullname) || string.IsNullOrEmpty(model.search_employee_fullname))
&& (string.IsNullOrEmpty(model.evaluation_round_search) || fk_planResult.id == Guid.Parse(model.evaluation_round_search))
&& emp_id.HasValue
&& (
(m_eva_create_evaluation_detail_process.chief.HasValue && emp_id == m_eva_create_evaluation_detail_process.chief)

View File

@@ -13,6 +13,8 @@ namespace TodoAPI2.Models
public List<external_employeeViewModel> item_employee_id { get; set; }
public List<external_linkageViewModel> item_evaluation_round_search { get; set; }
public decimal? create_evaluation_score1 { get; set; }
public decimal? create_evaluation_score2 { get; set; }

View File

@@ -29,20 +29,19 @@
<div class="row">
<input class="form-control" type="hidden" id="s_eva_create_evaluation_detail_firstdoc_create_evaluation_id" />
<div class="form-group col-md-3">
<label id='lab_s_eva_create_evaluation_detail_firstdoc_evaluation_round_search' for='s_eva_create_evaluation_detail_firstdoc_evaluation_round_search'>รอบการประเมิน</label>
<select class="form-control" id="s_eva_create_evaluation_detail_firstdoc_evaluation_round_search" iLabel="รอบการประเมิน" iRequire="false" iGroup="s_eva_create_evaluation_detail_firstdoc" title='รอบการประเมิน' placeholder='รอบการประเมิน'></select>
</div>
<div class="form-group col-md-3">
<label id='lab_s_eva_create_evaluation_detail_firstdoc_employee_id' for='s_eva_create_evaluation_detail_firstdoc_employee_id'>ชื่อ-สกุล</label>
<select class="form-control" id="s_eva_create_evaluation_detail_firstdoc_employee_id" iLabel="ชื่อ-สกุล" iRequire="false" iGroup="s_eva_create_evaluation_detail_firstdoc" title='ชื่อ-สกุล' placeholder='ชื่อ-สกุล'></select>
</div>
<div class="form-group col-md-3">
<label id='lab_s_eva_create_evaluation_detail_firstdoc_org_id' for='s_eva_create_evaluation_detail_firstdoc_org_id'>หน่วยงาน</label>
<select class="form-control" id="s_eva_create_evaluation_detail_firstdoc_org_id" iLabel="หน่วยงาน" iRequire="true" iGroup="s_eva_create_evaluation_detail_firstdoc" title='หน่วยงาน' placeholder='หน่วยงาน'></select>
</div>
<div class="form-group col-md-3">
<label id='lab_s_eva_create_evaluation_detail_firstdoc_search_employee_code' for='s_eva_create_evaluation_detail_firstdoc_search_employee_code'>รหัสพนักงาน</label>
<input class="form-control" type="text" id="s_eva_create_evaluation_detail_firstdoc_search_employee_code" iLabel="รหัสพนักงาน" iRequire="true" iGroup="s_eva_create_evaluation_detail_firstdoc" title='รหัสพนักงาน' placeholder='รหัสพนักงาน' />
</div>
<div class="form-group col-md-3">
<label id='lab_s_eva_create_evaluation_detail_firstdoc_search_employee_fullname' for='s_eva_create_evaluation_detail_firstdoc_search_employee_fullname'>ชื่อ-สกุล</label>
<input class="form-control" type="text" id="s_eva_create_evaluation_detail_firstdoc_search_employee_fullname" iLabel="ชื่อ-สกุล" iRequire="true" iGroup="s_eva_create_evaluation_detail_firstdoc" title='ชื่อ-สกุล' placeholder='ชื่อ-สกุล' />
<select class="form-control" id="s_eva_create_evaluation_detail_firstdoc_org_id" iLabel="หน่วยงาน" iRequire="false" iGroup="s_eva_create_evaluation_detail_firstdoc" title='หน่วยงาน' placeholder='หน่วยงาน'></select>
</div>
<div class="col-md-3">
@@ -81,6 +80,10 @@
eva_create_evaluation_detail_firstdoc_InitiateDataTable();
eva_create_evaluation_detail_firstdoc_InitialForm();
SetupValidationRemark("eva_create_evaluation_detail_firstdoc");
$("#s_eva_create_evaluation_detail_firstdoc_org_id").select2();
$("#s_eva_create_evaluation_detail_firstdoc_employee_id").select2();
$("#s_eva_create_evaluation_detail_firstdoc_evaluation_round_search").select2();
});
</script>
}

View File

@@ -26,16 +26,30 @@
<div class="row">
<input class="form-control" type="hidden" id="s_eva_create_evaluation_detail_process_create_evaluation_id" />
<div class="form-group col-md-5">
<div class="form-group col-md-3">
<label id='lab_s_eva_create_evaluation_detail_process_evaluation_round_search' for='s_eva_create_evaluation_detail_process_evaluation_round_search'>รอบการประเมิน</label>
<select class="form-control" id="s_eva_create_evaluation_detail_process_evaluation_round_search" iLabel="รอบการประเมิน" iRequire="false" iGroup="s_eva_create_evaluation_detail_process" title='รอบการประเมิน' placeholder='รอบการประเมิน'></select>
</div>
<div class="form-group col-md-3">
<label id='lab_s_eva_create_evaluation_detail_process_employee_id' for='s_eva_create_evaluation_detail_process_employee_id'>ชื่อ-สกุล</label>
<select class="form-control" id="s_eva_create_evaluation_detail_process_employee_id" iLabel="ชื่อ-สกุล พนักงาน" iRequire="true" iGroup="s_eva_create_evaluation_detail_process" title='ชื่อ-สกุล พนักงาน' placeholder='ชื่อ-สกุล พนักงาน'></select>
</div>
<div class="form-group col-md-4">
<label id='lab_s_eva_create_evaluation_detail_process_org_id' for='s_eva_create_evaluation_detail_process_org_id'>หน่วยงาน</label>
<select class="form-control" id="s_eva_create_evaluation_detail_process_org_id" iLabel="หน่วยงาน" iRequire="true" iGroup="s_eva_create_evaluation_detail_process" title='หน่วยงาน' placeholder='หน่วยงาน'></select>
</div>
<div class="form-group col-md-5">
<label id='lab_s_eva_create_evaluation_detail_process_employee_id' for='s_eva_create_evaluation_detail_process_employee_id'>ชื่อ-สกุล</label>
<select class="form-control" id="s_eva_create_evaluation_detail_process_employee_id" iLabel="ชื่อ-สกุล พนักงาน" iRequire="true" iGroup="s_eva_create_evaluation_detail_process" title='ชื่อ-สกุล พนักงาน' placeholder='ชื่อ-สกุล พนักงาน'></select>
<div class="col-md-2">
<br />
<button class="btn btn-info" onclick="javascript:eva_create_evaluation_detail_process_DoSearch();"><i class="fa fa-search" style="font-size: 14px;"></i> ค้นหา</button>
</div>
<div style="display:none;" class="form-group col-md-3">
<label id='lab_s_eva_create_evaluation_detail_process_search_employee_code' for='s_eva_create_evaluation_detail_process_search_employee_code'>รหัสพนักงาน</label>
<input class="form-control" type="text" id="s_eva_create_evaluation_detail_process_search_employee_code" iLabel="รหัสพนักงาน" iRequire="true" iGroup="s_eva_create_evaluation_detail_process" title='รหัสพนักงาน' placeholder='รหัสพนักงาน' />
@@ -46,11 +60,6 @@
<input class="form-control" type="text" id="s_eva_create_evaluation_detail_process_search_employee_fullname" iLabel="ชื่อ-สกุล" iRequire="true" iGroup="s_eva_create_evaluation_detail_process" title='ชื่อ-สกุล' placeholder='ชื่อ-สกุล' />
</div>
<div class="col-md-2">
<br />
<button class="btn btn-info" onclick="javascript:eva_create_evaluation_detail_process_DoSearch();"><i class="fa fa-search" style="font-size: 14px;"></i> ค้นหา</button>
</div>
</div>
</div>
<div style="overflow-x: auto;">
@@ -86,6 +95,7 @@
SetupValidationRemark("eva_create_evaluation_detail_process");
$("#s_eva_create_evaluation_detail_process_org_id").select2();
$("#s_eva_create_evaluation_detail_process_employee_id").select2();
$("#s_eva_create_evaluation_detail_process_evaluation_round_search").select2();
});
</script>
}

View File

@@ -169,7 +169,7 @@
<div class="row">
<div class="form-group col-md-12">
<button type="button" class="btn btn-outline" onclick="javascript:window_close()" style="background-color: #fff;">ยกเลิก</button>
<button type="button" class="btn btn-danger" onclick="javascript:window_close()"><i class="fa fa-repeat"></i> กลับ</button>
<button type="button" class="btn btn-submit" onclick="javascript:eva_limit_frame_group_PutUpdate()">บันทึก</button>
</div>
</div>

View File

@@ -75,12 +75,20 @@
</div>
</div>
<div class="row">
<div class="form-group col-md-12">
<button type="button" class="btn btn-danger" onclick="javascript:window_close()"><i class="fa fa-repeat"></i> กลับ</button>
</div>
</div>
</div>
</div>
</div>
</section>
<table id="eva_limit_frame_groupTable" class="display table table-bordered table-striped">
<thead>
<tr>
@@ -135,7 +143,7 @@
<div class="row mt-2">
<div class="form-group col-md-12">
<button type="button" class="btn btn-outline" onclick="javascript:window_close()" style="background-color: #fff;">ยกเลิก</button>
<button type="button" class="btn btn-submit" onclick="javascript:vw_limit_frame_plan_PutUpdate()">บันทึก</button>
<button class="btn btn-info" onclick="javascript:rep_eva_limit_frame_plan_DoSearch('pdf');">พิมพ์วงเงินที่ใช้ในการเลื่อนเงินเดือนของพนักงาน</button>
</div>

View File

@@ -7,8 +7,8 @@ function eva_create_evaluation_detail_firstdoc_GetSearchParameter() {
var eva_create_evaluation_detail_firstdocSearchObject = new Object();
eva_create_evaluation_detail_firstdocSearchObject.create_evaluation_id = $("#s_eva_create_evaluation_detail_firstdoc_create_evaluation_id").val();
eva_create_evaluation_detail_firstdocSearchObject.org_id = $("#s_eva_create_evaluation_detail_firstdoc_org_id").val();
eva_create_evaluation_detail_firstdocSearchObject.search_employee_code = $("#s_eva_create_evaluation_detail_firstdoc_search_employee_code").val();
eva_create_evaluation_detail_firstdocSearchObject.search_employee_fullname = $("#s_eva_create_evaluation_detail_firstdoc_search_employee_fullname").val();
eva_create_evaluation_detail_firstdocSearchObject.employee_id = $("#s_eva_create_evaluation_detail_firstdoc_employee_id").val();
eva_create_evaluation_detail_firstdocSearchObject.evaluation_round_search = $("#s_eva_create_evaluation_detail_firstdoc_evaluation_round_search").val();
return eva_create_evaluation_detail_firstdocSearchObject;
}
@@ -16,8 +16,8 @@ function eva_create_evaluation_detail_firstdoc_GetSearchParameter() {
function eva_create_evaluation_detail_firstdoc_FeedDataToSearchForm(data) {
$("#s_eva_create_evaluation_detail_firstdoc_create_evaluation_id").val(data.create_evaluation_id);
DropDownClearFormAndFeedWithData($("#s_eva_create_evaluation_detail_firstdoc_org_id"), data, "id", "external_name", "item_org_id", data.org_id);
$("#s_eva_create_evaluation_detail_firstdoc_search_employee_code").val(data.search_employee_code);
$("#s_eva_create_evaluation_detail_firstdoc_search_employee_fullname").val(data.search_employee_fullname);
DropDownClearFormAndFeedWithData($("#s_eva_create_evaluation_detail_firstdoc_employee_id"), data, "external_id", "external_name", "item_employee_id", data.employee_id);
DropDownClearFormAndFeedWithData($("#s_eva_create_evaluation_detail_firstdoc_evaluation_round_search"), data, "id_guid", "external_name", "item_evaluation_round_search", data.evaluation_round_search);
}

View File

@@ -10,6 +10,7 @@ function eva_create_evaluation_detail_process_GetSearchParameter() {
eva_create_evaluation_detail_processSearchObject.search_employee_code = $("#s_eva_create_evaluation_detail_process_search_employee_code").val();
eva_create_evaluation_detail_processSearchObject.search_employee_fullname = $("#s_eva_create_evaluation_detail_process_search_employee_fullname").val();
eva_create_evaluation_detail_processSearchObject.employee_id = $("#s_eva_create_evaluation_detail_process_employee_id").val();
eva_create_evaluation_detail_processSearchObject.evaluation_round_search = $("#s_eva_create_evaluation_detail_process_evaluation_round_search").val();
eva_create_evaluation_detail_processSearchObject.path = "d";
@@ -22,7 +23,7 @@ function eva_create_evaluation_detail_process_FeedDataToSearchForm(data) {
$("#s_eva_create_evaluation_detail_process_search_employee_code").val(data.search_employee_code);
$("#s_eva_create_evaluation_detail_process_search_employee_fullname").val(data.search_employee_fullname);
DropDownClearFormAndFeedWithData($("#s_eva_create_evaluation_detail_process_employee_id"), data, "id", "fullname", "item_employee_id", data.employee_id);
console.log(data.item_employee_id);
DropDownClearFormAndFeedWithData($("#s_eva_create_evaluation_detail_process_evaluation_round_search"), data, "id_guid", "external_name", "item_evaluation_round_search", data.evaluation_round_search);
}
//================= Form Data Customizaiton =========================================