talentInfo_gj_select.js 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. /**
  2. * 初始化人才认定申报详情对话框
  3. */
  4. var locked = false;
  5. var TalentInfoInfoDlg = {
  6. talentInfoInfoData : {},
  7. };
  8. /**
  9. * 获取人才认定
  10. */
  11. TalentInfoInfoDlg.getIdentifyCondition = function() {
  12. var level = $("#talent_arrange").val();
  13. var type = $("#type").val();
  14. if(level==null||level==''){
  15. $("#talent_condition").empty();
  16. $("#talent_condition").trigger('chosen:updated');
  17. return;
  18. }
  19. Feng.addAjaxSelect({
  20. "id": "talent_condition",
  21. "displayCode": "id",
  22. "displayName": "name",
  23. "type": "GET",
  24. "url": Feng.ctxPath + "/common/api/findIdentifyConditionByLevel?level=" + level + "&type=" + type
  25. });
  26. $("#talent_condition").trigger('chosen:updated');
  27. }
  28. TalentInfoInfoDlg.bankChange = function () {
  29. var bank = $("#bank").val();
  30. if($.trim(bank)=='中国工商银行'){
  31. $("#bank_number").val('102391050013');
  32. }else {
  33. $("#bank_number").val('');
  34. }
  35. }
  36. /**
  37. * 加载市
  38. */
  39. TalentInfoInfoDlg.afterSelectProvince = function () {
  40. var province = $("#province").val();
  41. $("#city").empty();
  42. $("#county").empty();
  43. if(province==null||province==''){
  44. return;
  45. }
  46. Feng.addAjaxSelect({
  47. "id": "city",
  48. "displayCode": "code",
  49. "displayName": "name",
  50. "type": "GET",
  51. "url": Feng.ctxPath + "/common/tool/findCityByProvinceSelect/code/" + province
  52. });
  53. }
  54. /**
  55. * 加载县
  56. */
  57. TalentInfoInfoDlg.afterSelectCity = function (){
  58. var city = $("#city").val();
  59. $("#county").empty();
  60. if(city==null||city==''){
  61. return;
  62. }
  63. Feng.addAjaxSelect({
  64. "id": "county",
  65. "displayCode": "code",
  66. "displayName": "name",
  67. "type": "GET",
  68. "url": Feng.ctxPath + "/common/tool/findCountyByCitySelect/code/" + city
  69. });
  70. }
  71. //初始化附件类别表单
  72. TalentInfoInfoDlg.initFileTable = function (){
  73. var queryData = {};
  74. queryData['project'] = CONFIG.project_rcrd;
  75. queryData['type'] = $("#type").val();
  76. queryData["talent_condition"] = $("#talent_condition").val();
  77. queryData['checkState'] = $("#checkState").val();
  78. queryData['isMix'] = 1;
  79. $("#fileTable").bootstrapTable({
  80. url: Feng.ctxPath + "/common/api/findCommonFileType",
  81. method: 'POST',
  82. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  83. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  84. showRefresh: false, // 是否显示刷新按钮
  85. clickToSelect: true, // 是否启用点击选中行
  86. singleSelect: true, // 设置True 将禁止多选
  87. striped: true, // 是否显示行间隔色
  88. escape: true,
  89. pagination: false, // 设置为 true 会在表格底部显示分页条
  90. paginationHAlign: "left",
  91. paginationDetailHAlign: "right",
  92. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  93. showColumns: false,
  94. detailView: true, //是否显示父子表
  95. pageList: [10, 30, 50],
  96. queryParams: function (params) {
  97. return $.extend(queryData,params)
  98. },
  99. rowStyle: function (row, index) {
  100. return {classes:"info"};
  101. },
  102. columns: TalentInfoInfoDlg.initFileTypeColumn(),
  103. onPostBody: function () {
  104. $("td.uitd_showTip").bind("mouseover", function () {
  105. var htm = $(this).html();
  106. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  107. });
  108. },
  109. onLoadSuccess: function (data) {
  110. $("#fileTable").bootstrapTable('expandAllRows');
  111. },
  112. onExpandRow: function (index, row, $detail) {
  113. var ajax = new $ax(Feng.ctxPath + "/common/api/listTalentFile", function (data) {
  114. if(data==null||data.length==0){
  115. return;
  116. }
  117. 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>';
  118. var files = $("#files").val();
  119. var checkState = $("#checkState").val();
  120. for(var key in data){
  121. var sn = data[key].url.lastIndexOf(".");
  122. var suffix = data[key].url.substring(sn+1,data[key].url.length);
  123. var imgStr = "";
  124. if(suffix=="pdf"||suffix=="PDF"){
  125. 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>";
  126. }else if(suffix == "xlsx" || suffix=="XLSX" || suffix == 'xls' || suffix == 'XLS'){
  127. 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>";
  128. }else{
  129. imgStr = '<img class=\"imgUrl\" src=\"'+data[key].url+'\" style=\"width:25px;height:25px;\">';
  130. }
  131. html = html + '<li style="display: none">'+data[key].id+'</li>\n'+
  132. '<li style="width: 80%;padding-top: 5px;">'+data[key].orignName+'</li>\n'+
  133. '<li style="width: 10%;">'+imgStr+'</li>\n';
  134. }
  135. html = html + '</ul>';
  136. $detail.html(html);
  137. $(".imgs").viewer({ fullscreen:false});
  138. }, function (data) {
  139. Feng.error("查询失败!" + data.responseJSON.message + "!");
  140. });
  141. var queryData = {};
  142. queryData["mainId"] = $("#id").val();
  143. queryData["fileTypeId"] = row.id;
  144. ajax.set(queryData);
  145. ajax.start();
  146. }
  147. });
  148. }
  149. /**
  150. * 初始化表格的列
  151. */
  152. TalentInfoInfoDlg.initFileTypeColumn = function () {
  153. return [
  154. {field: 'selectItem', checkbox:false,visible:false},
  155. {title: '名称', field: 'name', visible: true, align: 'center', valign: 'middle',width:"30%",'class': 'uitd_showTip',
  156. formatter : function(value,row,index){
  157. if(row.must==1){
  158. return '<i class="fa fa-paste"></i><span style="font-weight:bold;color:red;font-size:14px;font-family:宋体"> * </span> '+ value;
  159. }if(row.must==2){
  160. return '<i class="fa fa-paste"></i>'+value;
  161. }
  162. }
  163. },
  164. {title: '模板', field: 'templateUrl', visible: true, align: 'center', valign: 'middle',width:"8%",
  165. formatter : function(value,row,index){
  166. if(value==null||value==''||value=='null'){
  167. return '无';
  168. }
  169. return "<button type='button' onclick=\"TalentInfoInfoDlg.downloadFile('"+row.id+"',5)\" style='margin-right: 10px' class=\"btn btn-xs btn-primary\">" +
  170. "<i class=\"fa fa-download\"></i>下载" +
  171. "</button>";
  172. }
  173. },
  174. {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle',width:"52%",'class': 'uitd_showTip'},
  175. ]
  176. };
  177. TalentInfoInfoDlg.downloadFile = function (id,type){
  178. window.location.href = Feng.ctxPath + "/common/api/downloadFile?id=" + id + "&type="+type;
  179. }
  180. $(function() {
  181. //批量加载字典表数据
  182. var arr = [
  183. {"name": "nation", "code": "nation"},
  184. {"name": "talent_arrange", "code": "talent_arrange"},
  185. {"name": "nationality", "code": "nationality"},
  186. {"name": "politics", "code": "politics"},
  187. {"name": "highest_degree", "code": "highest_degree"}];
  188. Feng.findChildDictBatch(JSON.stringify(arr));
  189. //加载省份
  190. Feng.addAjaxSelect({
  191. "id": "province",
  192. "displayCode": "code",
  193. "displayName": "name",
  194. "type": "GET",
  195. "url": "/common/tool/getProvinceSelect"
  196. });
  197. var id = $("#id").val();
  198. if(id!=null && id!=''){
  199. $("select").each(function () {
  200. $(this).val($(this).attr("value")).trigger("change");
  201. });
  202. Feng.getCheckLog("logTable",{"type":CONFIG.project_rcrd,"mainId":id,"typeFileId":"","active":1})
  203. }
  204. $("#address").val($("#address").attr("value"));
  205. $("#province").val($("#province").attr("value"));
  206. TalentInfoInfoDlg.afterSelectProvince();
  207. $("#city").val($("#city").attr("value"));
  208. TalentInfoInfoDlg.afterSelectCity();
  209. $("#county").val($("#county").attr("value"));
  210. $("#talent_arrange").val($("#talent_arrange").attr("value"));
  211. TalentInfoInfoDlg.getIdentifyCondition();
  212. $("#talent_arrange").val($("#talent_arrange").attr("value"));
  213. $("#talent_condition").val($("#talent_condition").attr("value"));
  214. $("input,select,textarea").not("input[type='hidden']").not("input[type='file']").attr("style","pointer-events: none;background-color: #eee;");
  215. });