Performance.cshtml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. @using ShwasherSys
  2. @using ShwasherSys.Authorization.Permissions
  3. @using ShwasherSys.Models.Layout
  4. @using ShwasherSys.Models.Modal
  5. @using ShwasherSys.Views.Shared.New.Table
  6. @{
  7. ViewBag.Title = "员工绩效考核查询";
  8. string activeMenu = PermissionNames.PagesCompanyEmployeePerformance; //The menu item will be active for this page.
  9. ViewBag.ActiveMenu = activeMenu;
  10. List<SelectListItem> workType = ViewBag.WorkType;
  11. var searchForm = new SearchFormViewModal(new List<SearchItem>()
  12. {
  13. new SearchItem("employeeNo", "工号"),
  14. new SearchItem("employeeName", "姓名"),
  15. new SearchItem("productOrderNo","排产单号"),
  16. new SearchItem("creationTime","记录时间",FiledType.D,ExpType.GreaterOrEqual),
  17. new SearchItem("creationTime","至",FiledType.D,ExpType.LessOrEqual),
  18. //new SearchItem("workType","工作类型",FiledType.I,ExpType.Equal).SetSearchItem(workType),
  19. },"search-form",false);
  20. var table = new TableViewModel( "/api/services/app/Performance/GetAll", activeMenu, searchForm)
  21. .SetFields(new List<FieldItem>()
  22. {
  23. new FieldItem("performanceNo", "编号"),
  24. new FieldItem("employeeNo", "工号"),
  25. new FieldItem("employeeName", "姓名"),
  26. //new FieldItem("relatedNo", "关联编号"),
  27. new FieldItem("workType", "工作类型","WorkTypeFormatter"),
  28. new FieldItem("performance", "绩效量化","PerformanceFormatter"),
  29. new FieldItem("performanceDesc", "绩效描述"),
  30. new FieldItem("productOrderNo", "排产单号"),
  31. new FieldItem("creationTime", "记录时间"),
  32. });
  33. }
  34. @section css{
  35. <style>
  36. .control-label {
  37. text-align: right;
  38. }
  39. </style>
  40. }
  41. @Html.Partial("New/Table/_Table", table)
  42. @section modal{
  43. <section>
  44. <!--Main Modal-->
  45. <div class="modal fade" id="modal" role="dialog" tabindex="-1">
  46. <div class="modal-dialog modal-dialog-centered" role="document">
  47. <div class="modal-content" style="min-width: 550px;">
  48. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("员工绩效汇总", ""))
  49. <div class="modal-body" style="padding: 5px;">
  50. <form id="form">
  51. <input id="employeeId" name="employeeId" type="hidden" value="">
  52. <div class="form-group-sm">
  53. <label class="iwb-label col-md-2 control-label iwb-label-required" for="employeeName">姓名</label>
  54. <div class="col-md-10">
  55. <div class="input-group" style="width: 100%">
  56. <input class="form-control" id="employeeName" name="employeeName" type="text" required="" placeholder="请输入员工姓名..." value="" style="" readonly="">
  57. <div class="input-group-addon" onclick="ShowQueryModal('query_employee_modal','#modal');">
  58. <i class="iconfont icon-search"></i>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. <div class="form-group-sm">
  64. <label class="iwb-label col-md-2 control-label iwb-label-required" for="workType">类型</label>
  65. <div class="col-md-10">
  66. @Html.DropDownList("workType", workType, "请选择类型", new { style = "width:100%;" })
  67. </div>
  68. </div>
  69. <div class="form-group-sm">
  70. <label class="iwb-label col-md-2 control-label iwb-label-required" for="year">年份</label>
  71. <div class="col-md-10">
  72. <select class="form-control" id="year" name="year" type="text" required="" placeholder="" value="" style="width:100%;">
  73. <option value="">请选择年份</option>
  74. @for (int i = DateTime.Now.Year; i >= 2019; i--)
  75. {
  76. <option value="@(i)">@(i)年</option>
  77. }
  78. </select>
  79. </div>
  80. </div>
  81. <div class="form-group-sm">
  82. <label class="iwb-label col-md-2 control-label" for="month">月份</label>
  83. <div class="col-md-10">
  84. <select class="form-control" id="month" name="month" type="text" placeholder="" value="" style="width:100%;">
  85. <option value="">请选择月份</option>
  86. @for (int j = 1; j <= 12; j++)
  87. {
  88. <option value="@(j)">@(j)月</option>
  89. }
  90. </select>
  91. </div>
  92. </div>
  93. <div class="form-group-sm">
  94. <label class="iwb-label col-md-9 control-label" for="">绩效:<span id="PerformanceTotal" style="color: red; padding: 5px; border: none; font-weight: 600; padding-left: 10px; padding-right: 20px;">0</span></label>
  95. <button class="col-md-3 btn btn-info btn-sm" style="" type="button" onclick="PerformanceTotalQuery()">查询</button>
  96. </div>
  97. </form>
  98. </div>
  99. @Html.Partial("Modals/_ModalFooter", "1")
  100. </div>
  101. </div>
  102. </div>
  103. </section>
  104. @Html.Partial("Modals/Query/_Employee","1:employeeName,employeeId")
  105. }
  106. @section scripts
  107. {
  108. <script type="text/javascript">
  109. var $table;
  110. $(function () {
  111. $table = LoadTable();
  112. var funs = window.iwbfuns || { none: function () { console.log("No type"); } };
  113. funs["btnCreate"] = function() { BtnCreate({ data: { id: "" } }); }
  114. funs["btnUpdate"] = function () { BtnUpdate({ disabled: "" }); };
  115. $("#Tool1").append(
  116. '<div class="btn-group btn-group-sm"><button class="btn btn-default" type="button" style="border-radius: 4px;" onclick="QueryPerformance()"><i class="iconfont icon-search"></i>员工绩效</button></div>'+
  117. '<div class="tool-radio"><input name="radioType" type="radio" id="radioType1" checked value=""/><label for="radioType1">全部</label></div>' +
  118. '<div class="tool-radio"><input name="radioType" type="radio" id="radioType2" value="@(WorkTypeDefinition.Product)"/><label for="radioType2">生产绩效</label></div>'+
  119. '<div class="tool-radio"><input name="radioType" type="radio" id="radioType3" value="@(WorkTypeDefinition.VerifyPackage)"/><label for="radioType3">包装核件绩效</label></div>'+
  120. '<div class="tool-radio"><input name="radioType" type="radio" id="radioType4" value="@(WorkTypeDefinition.Package)"/><label for="radioType4">包装负责绩效</label></div>'+
  121. '<div class="tool-radio"><input name="radioType" type="radio" id="radioType5" value="@(WorkTypeDefinition.MoldMg)"/><label for="radioType5">模具维护绩效</label></div>'+
  122. '<div class="tool-radio"><input name="radioType" type="radio" id="radioType6" value="@(WorkTypeDefinition.DeviceMg)"/><label for="radioType6">设备维护绩效</label></div>');
  123. $(".tool-radio input[type='radio']").on('click', function (e) {
  124. document.getElementById("SearchForm").reset();
  125. GetSearchList();
  126. RefreshTable();
  127. });
  128. });
  129. function GetSearchList() {
  130. var count = $("#SearchForm").find(".KeyWords").length;
  131. window._searchList = [];
  132. var radioType = $('input[name="radioType"]:checked').val();
  133. if (radioType) {
  134. window._searchList.push({ KeyWords: radioType, KeyField: "workType", FieldType: "1", ExpType: "0" });
  135. }
  136. for (var i = 1; i <= count; i++) {
  137. var keyWords = $("#KeyWords-" + i).val();
  138. if (keyWords) {
  139. var keyField = $("#KeyField-" + i).val();
  140. var fieldType = $("#FieldType-" + i).val();
  141. var expType = $("#ExpType-" + i).val();
  142. window._searchList.push({
  143. KeyWords: keyWords,
  144. KeyField: keyField,
  145. FieldType: fieldType,
  146. ExpType: expType
  147. });
  148. }
  149. }
  150. }
  151. </script>
  152. <script>
  153. function QueryPerformance() {
  154. var row = $('#table').bootstrapTable("getSelections")[0], data = {year:@(DateTime.Now.Year)};
  155. if (row) {
  156. data = $.extend({},data,row);
  157. }
  158. $('#PerformanceTotal').html("0");
  159. OpenModal({
  160. data: data,
  161. modal: $('#modal')
  162. });
  163. }
  164. function PerformanceTotalQuery() {
  165. $.iwbAjax2({
  166. isRefresh: false,
  167. url: window.appUrl + 'Performance/PerformanceTotalQuery',
  168. form:'form',
  169. modal: null,
  170. success: function (res) {
  171. if (res) {
  172. $('#PerformanceTotal').html(res);
  173. } else {
  174. $('#PerformanceTotal').html("未查询到数据");
  175. }
  176. }
  177. });
  178. }
  179. </script>
  180. <!--格式化-->
  181. <script id="formatter-script" type="text/javascript">
  182. function PerformanceFormatter(v,r) {
  183. return v + ' ' + r.performanceUnit;
  184. }
  185. function WorkTypeFormatter(v) {
  186. var name = $('#hid-workType option[value="' + v + '"]').text();
  187. return '<span class="label label-info">' + name +'</span>';
  188. }
  189. // function TypeFormatter(v) {
  190. // var name = $('#hid-type option[value="' + v + '"]').text();
  191. // switch (v) {
  192. // case 0:
  193. // return '<span class="label label-danger">' + name +'</span>';
  194. // default:
  195. // return '<span class="label label-info">' + name +'</span>';
  196. // }
  197. //}
  198. </script>
  199. }
  200. <section style="display: none">
  201. <select id="hid-type">
  202. <option value=""></option>
  203. </select>
  204. @Html.DropDownList("hid-workType", workType)
  205. </section>