talentAllowanceInfo_select.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. /**
  2. * 初始化人才认定申报详情对话框
  3. */
  4. var TalentAllowanceInfoDlg = {
  5. talentAllowanceData : {},
  6. validateFields: {
  7. talentId: {validators: {notEmpty: {message: '申报对象不能为空' }}}
  8. }
  9. };
  10. //初始化附件类别表单
  11. TalentAllowanceInfoDlg.initFileTable = function (){
  12. TalentAllowanceInfoDlg.initContract();
  13. var queryData = {};
  14. queryData['project'] = CONFIG.project_jbt;
  15. queryData['type'] = $("#type").val();
  16. $("#fileTable").bootstrapTable({
  17. url: Feng.ctxPath + "/common/api/findCommonFileType",
  18. method: 'POST',
  19. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  20. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  21. showRefresh: false, // 是否显示刷新按钮
  22. clickToSelect: true, // 是否启用点击选中行
  23. singleSelect: true, // 设置True 将禁止多选
  24. striped: true, // 是否显示行间隔色
  25. escape: true,
  26. pagination: false, // 设置为 true 会在表格底部显示分页条
  27. paginationHAlign: "left",
  28. paginationDetailHAlign: "right",
  29. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  30. showColumns: false,
  31. detailView: true, //是否显示父子表
  32. pageList: [10, 30, 50],
  33. queryParams: function (params) {
  34. return $.extend(queryData,params)
  35. },
  36. rowStyle: function (row, index) {
  37. return {classes:"info"};
  38. },
  39. columns: TalentAllowanceInfoDlg.initFileTypeColumn(),
  40. onPostBody: function () {
  41. $("td.uitd_showTip").bind("mouseover", function () {
  42. var htm = $(this).html();
  43. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  44. });
  45. },
  46. onLoadSuccess: function (data) {
  47. $("#fileTable").bootstrapTable('expandAllRows');
  48. },
  49. onExpandRow: function (index, row, $detail) {
  50. var ajax = new $ax(Feng.ctxPath + "/common/api/listTalentFile", function (data) {
  51. if(data==null||data.length==0){
  52. return;
  53. }
  54. var html = '<ul class="imgs"><li style="width: 80%;font-weight: bold;padding-top: 5px;">附件原名</li><li style="width: 10%;font-weight: bold;padding-top: 5px;">预览</li>';
  55. for(var key in data){
  56. var sn = data[key].url.lastIndexOf(".");
  57. var suffix = data[key].url.substring(sn+1,data[key].url.length);
  58. var imgStr = "";
  59. if(suffix=="pdf"||suffix=="PDF"){
  60. imgStr = "<button type='button' onclick=\"Feng.showPdf('"+data[key].url+"','"+data[key].id+"','"+data[key].orignName+"')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";
  61. }else if(suffix == "xlsx" || suffix=="XLSX" || suffix == 'xls' || suffix == 'XLS'){
  62. imgStr = "<button type='button' onclick=\"Feng.showExcel('"+data[key].url+"','"+data[key].id+"','"+data[key].orignName+"')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-excel-o\" aria-hidden=\"true\"></i></button>";
  63. }else{
  64. imgStr = '<img class=\"imgUrl\" src=\"'+data[key].url+'\" style=\"width:25px;height:25px;\">';
  65. }
  66. html = html + '<li style="display: none">'+data[key].id+'</li>\n'+
  67. '<li style="width: 80%;padding-top: 5px;">'+data[key].orignName+'</li>\n'+
  68. '<li style="width: 10%;">'+imgStr+'</li>\n';
  69. }
  70. html = html + '</ul>';
  71. $detail.html(html);
  72. $(".imgs").viewer({
  73. fullscreen:false
  74. });
  75. }, function (data) {
  76. Feng.error("查询失败!" + data.responseJSON.message + "!");
  77. });
  78. var queryData = {};
  79. queryData["mainId"] = $("#id").val();
  80. queryData["fileTypeId"] = row.id;
  81. ajax.set(queryData);
  82. ajax.start();
  83. }
  84. });
  85. }
  86. /**
  87. * 初始化工作单位及核查项目情况表
  88. */
  89. TalentAllowanceInfoDlg.initContract = function(){
  90. $("#projectTable").bootstrapTable("destroy",{});
  91. $("#projectTable").bootstrapTable({
  92. url: Feng.ctxPath + "/enterprise/talentAllowance/findAllowanceContractDetail",
  93. method: 'POST',
  94. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  95. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  96. showRefresh: false, // 是否显示刷新按钮
  97. clickToSelect: true, // 是否启用点击选中行
  98. singleSelect: true, // 设置True 将禁止多选
  99. striped: true, // 是否显示行间隔色
  100. escape: true,
  101. pagination: false, // 设置为 true 会在表格底部显示分页条
  102. paginationHAlign: "left",
  103. paginationDetailHAlign: "right",
  104. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  105. showColumns: false,
  106. detailView: true,//父子表
  107. queryParams: function (params) {
  108. return $.extend({"mainId":$("#id").val()},params)
  109. },
  110. columns: TalentAllowanceInfoDlg.initContractColumns(),
  111. onPostBody: function () {
  112. $("td.uitd_showTip").bind("mouseover", function () {
  113. var htm = $(this).html();
  114. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  115. });
  116. },
  117. onLoadSuccess: function (data) {
  118. $("#projectTable").bootstrapTable('expandAllRows');
  119. },
  120. onExpandRow: function (index, row, $detail) {
  121. var enterpriseId = row.enterpriseId;
  122. var cur_table = $detail.html('<table id="'+enterpriseId+'" class="mytable-hover"></table>').find('table');
  123. $(cur_table).bootstrapTable("destroy",{});
  124. $(cur_table).bootstrapTable({
  125. url: Feng.ctxPath + "/enterprise/talentAllowance/findAllowanceProject",
  126. method: 'POST',
  127. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  128. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  129. showRefresh: false, // 是否显示刷新按钮
  130. clickToSelect: true, // 是否启用点击选中行
  131. singleSelect: true, // 设置True 将禁止多选
  132. escape: true,
  133. pagination: false, // 设置为 true 会在表格底部显示分页条
  134. paginationHAlign: "left",
  135. paginationDetailHAlign: "right",
  136. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  137. showColumns: false,
  138. queryParams: function (params) {
  139. return $.extend({"mainId":$("#id").val(),"baseId":row.id},params)
  140. },
  141. columns: TalentAllowanceInfoDlg.initProjectColumns(),
  142. });
  143. }
  144. });
  145. }
  146. //初始化工作单位表的列
  147. TalentAllowanceInfoDlg.initContractColumns = function(){
  148. var type = $("#type").val();
  149. if(type==1){
  150. return [
  151. {field: 'selectItem', checkbox:false,visible:false},
  152. {title: '企业名称', field: 'enterpriseName', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip'},
  153. {title: '合同起始时间', field: 'startTime', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip'},
  154. {title: '合同截止时间', field: 'endTime', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip'},
  155. {title: '入职时间', field: 'entryTime', visible: true, align: 'center', valign: 'middle',width:"100px"},
  156. {title: '离职时间', field: 'quitTime', visible: true, align: 'center', valign: 'middle',width:"100px"},
  157. {title: '人才标签', field: 'talentTypeName', visible: true, align: 'center', valign: 'middle',width:"100px",'class': 'uitd_showTip'},
  158. {title: '首次来晋行政介绍信时间', field: 'letterTime', visible: true, align: 'center', valign: 'middle',width:"120px"},
  159. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle',width:"120px",
  160. formatter : function(value,row,index){
  161. return "<button type='button' onclick='TalentAllowanceInfoDlg.showLog(\""+row.id+"\")' style='margin-right: 10px' class='btn btn-xs btn-success'>" +
  162. "<i class=\"fa fa-book\"></i>日志" +
  163. "</button>";
  164. }
  165. }
  166. ];
  167. }
  168. if(type==2){
  169. return [
  170. {field: 'selectItem', checkbox:false,visible:false},
  171. {title: '企业名称', field: 'enterpriseName', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip'},
  172. {title: '合同起始时间', field: 'startTime', visible: true, align: 'center', valign: 'middle',width:"120px"},
  173. {title: '合同截止时间', field: 'endTime', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip'},
  174. {title: '入职时间', field: 'entryTime', visible: true, align: 'center', valign: 'middle',width:"100px"},
  175. {title: '离职时间', field: 'quitTime', visible: true, align: 'center', valign: 'middle',width:"100px"},
  176. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle',width:"120px",
  177. formatter : function(value,row,index){
  178. return "<button type='button' onclick='TalentAllowanceInfoDlg.showLog(\""+row.id+"\")' style='margin-right: 10px' class='btn btn-xs btn-success'>" +
  179. "<i class=\"fa fa-book\"></i>日志" +
  180. "</button>"
  181. }
  182. }
  183. ];
  184. }
  185. }
  186. //初始化项目表的列
  187. TalentAllowanceInfoDlg.initProjectColumns = function () {
  188. return [
  189. {field: 'selectItem', checkbox:false,visible:false},
  190. {title: '核查项目名称', field: 'projectName', visible: true, align: 'center', valign: 'middle',width:"15%",'class': 'uitd_showTip'},
  191. {title: '详情', field: 'months', visible: true, align: 'center', valign: 'middle',width:"35%",
  192. formatter : function(value,row,index){
  193. if(value!=null && value!=''){
  194. return value;
  195. }else if(row.days!=null && row.days!=''){
  196. return row.days + "天";
  197. }else{
  198. return "";
  199. }
  200. }
  201. },
  202. {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle',width:"35%",'class': 'uitd_showTip'},
  203. {title: '操作', field: 'project', visible: true, align: 'center', valign: 'middle',width:"15%",
  204. formatter : function(value,row,index){
  205. return "<button type='button' onclick='TalentAllowanceInfoDlg.showLog(\""+row.id+"\")' style='margin-right: 10px' class='btn btn-xs btn-success'><i class=\"fa fa-book\"></i>日志</button>";
  206. }
  207. }
  208. ];
  209. }
  210. /**
  211. * 初始化附件类别表的列
  212. */
  213. TalentAllowanceInfoDlg.initFileTypeColumn = function () {
  214. return [
  215. {field: 'selectItem', checkbox:false,visible:false},
  216. {title: '名称', field: 'name', visible: true, align: 'center', valign: 'middle',width:"30%",'class': 'uitd_showTip',
  217. formatter : function(value,row,index){
  218. if(row.must==1){
  219. return '<i class="fa fa-paste"></i><span style="font-weight:bold;color:red;font-size:14px;font-family:宋体"> * </span> '+ value;
  220. }if(row.must==2){
  221. return '<i class="fa fa-paste"></i>'+value;
  222. }
  223. }
  224. },
  225. {title: '模板', field: 'templateUrl', visible: true, align: 'center', valign: 'middle',width:"8%",
  226. formatter : function(value,row,index){
  227. if(value==null||value==''||value=='null'){
  228. return '无';
  229. }
  230. return "<button type='button' onclick=\"Feng.downloadFile('"+row.id+"',3)\" style='margin-right: 10px' class=\"btn btn-xs btn-primary\">" +
  231. "<i class=\"fa fa-download\"></i>下载" +
  232. "</button>";
  233. }
  234. },
  235. {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle',width:"52%",'class': 'uitd_showTip'},
  236. ]
  237. };
  238. TalentAllowanceInfoDlg.showLog = function (id) {
  239. layer.open({
  240. type: 1,
  241. title:"日志",
  242. fixed:false,
  243. content: '<table id="'+id+'"></table>',
  244. area: ['80%', '80%'],
  245. maxmin: true,
  246. success :function (layero, index) {
  247. $('#'+id).bootstrapTable({
  248. url: Feng.ctxPath + "/common/api/getJbtCheckLog",
  249. method: 'POST',
  250. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  251. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  252. showRefresh: false, // 是否显示刷新按钮
  253. clickToSelect: true, // 是否启用点击选中行
  254. singleSelect: true, // 设置True 将禁止多选
  255. striped: true, // 是否显示行间隔色
  256. pagination: false, // 设置为 true 会在表格底部显示分页条
  257. paginationHAlign: "left",
  258. paginationDetailHAlign: "right",
  259. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  260. showColumns: false,
  261. queryParams: function (params) {
  262. return {"type":CONFIG.project_jbt,"mainId":$("#id").val(),"typeFileId":id,"active":1}
  263. },
  264. columns:
  265. [
  266. {title: '步骤', field: 'stepName', visible: true, align: 'center', valign: 'middle',width:"10%",
  267. formatter : function (value,row,index) {
  268. return ""+value;
  269. }
  270. },
  271. {title: '操作人', field: 'createUser', visible: true, align: 'center', valign: 'middle',width:"15%"},
  272. {title: '操作时间', field: 'createTime', visible: true, align: 'center', valign: 'middle',width:"20%"},
  273. {title: '描述', field: 'description', visible: true, align: 'center', valign: 'middle',width:"45%",
  274. formatter : function (value,row,index) {
  275. return '<span data-toggle="tooltip" title="'+ value +'">"'+value+'"</span>';
  276. }
  277. }
  278. ]
  279. ,
  280. onPostBody: function () {
  281. $('#'+id+"td.uitd_showTip").bind("mouseover", function () {
  282. var htm = $(this).html();
  283. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  284. });
  285. }
  286. });
  287. }
  288. });
  289. }
  290. //回调
  291. TalentAllowanceInfoDlg.callBack = function (data){
  292. layer.close(data.obj);
  293. Feng.info(data.msg);
  294. if (data.code == 200) {
  295. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/updateSuppleState", function(data){
  296. if(data.code == 200){
  297. }else{
  298. }
  299. },function(data){
  300. Feng.error("修改失败!" + data.responseJSON.message + "!");
  301. });
  302. ajax.set("id",$("#id").val());
  303. ajax.start();
  304. $("#fileTable").bootstrapTable("refresh", {});
  305. }
  306. }
  307. TalentAllowanceInfoDlg.showAllLog = function(){
  308. var id = $("#id").val();
  309. if(Feng.isNotEmptyStr(id)){
  310. Feng.getCheckLog("logTable",{"type":CONFIG.project_jbt,"mainId":id,"typeFileId":"","active":1})
  311. }
  312. }
  313. $(function() {
  314. Feng.initValidatorTip("talentAllowanceForm",TalentAllowanceInfoDlg.validateFields);
  315. Feng.addAjaxSelect({
  316. "id": 'name',
  317. "displayCode": "id",
  318. "displayName": "name",
  319. "type": "GET",
  320. "url": Feng.ctxPath + "/enterprise/talent/findTalentByEnterpriseInLibrary?type=1&year="+$("#year").val()
  321. });
  322. if($("#type").val()==2){
  323. $("#bankNumberSpan,#talentTypeSpan,#introductionModeSpan,#firstInJJTimeSpan").attr("style","display:none");
  324. }
  325. if ($("#allowanceType").val() == 1) {
  326. $("#wageDiv").css("display", "block");
  327. }
  328. //批量加载时间控件
  329. $(".date").each(function(){
  330. laydate.render({elem: "#"+$(this).attr("id"),type: 'date',trigger: 'click'});
  331. });
  332. $("select").each(function () {
  333. $(this).val($(this).attr("value"));
  334. });
  335. TalentAllowanceInfoDlg.showAllLog();
  336. });