talentInfo_ic_select.js 8.9 KB

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