talentInfo_select.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. /**
  2. * 初始化人才认定申报详情对话框
  3. */
  4. var TalentInfoInfoDlg = {
  5. talentInfoInfoData : {},
  6. };
  7. /**
  8. * 获取人才认定
  9. */
  10. TalentInfoInfoDlg.getIdentifyCondition = function() {
  11. var level = $("#talentArrange").val();
  12. var type = $("#type").val();
  13. var source = $("#source").val();
  14. var talentType = $("#talentType").val();
  15. if(level==null||level==''){
  16. $("#identifyCondition").empty();
  17. $("#identifyCondition").trigger('chosen:updated');
  18. return;
  19. }
  20. if(type==null||type==''){
  21. Feng.info("请先选择申报类别");
  22. return ;
  23. }
  24. if(source==null||source==''){
  25. $("#identifyCondition").empty();
  26. $("#identifyCondition").trigger('chosen:updated');
  27. $("#talentArrange").val("");
  28. Feng.info("请先选择申报来源");
  29. return ;
  30. }
  31. if(talentType==null||talentType==''){
  32. $("#identifyCondition").empty();
  33. $("#identifyCondition").trigger('chosen:updated');
  34. $("#talentArrange").val("");
  35. Feng.info("请先选择人才标签");
  36. return ;
  37. }
  38. if(source == 2){
  39. source = 1;
  40. }
  41. Feng.addAjaxSelect({
  42. "id": "identifyCondition",
  43. "displayCode": "id",
  44. "displayName": "name",
  45. "type": "GET",
  46. "url": Feng.ctxPath + "/api/common/findIdentifyConditionByLevel?talentLevel="+level+"&type="+type+"&source="+source+"&talentType="+talentType
  47. });
  48. $("#identifyCondition").trigger('chosen:updated');
  49. }
  50. TalentInfoInfoDlg.bankChange = function () {
  51. var bank = $("#bank").val();
  52. if($.trim(bank)=='中国工商银行'){
  53. $("#bankNumber").val('102391050013');
  54. }else {
  55. $("#bankNumber").val('');
  56. }
  57. }
  58. /**
  59. * 加载市
  60. */
  61. TalentInfoInfoDlg.afterSelectProvince = function () {
  62. var province = $("#provinceCode").val();
  63. $("#cityCode").empty();
  64. $("#countyCode").empty();
  65. if(province==null||province==''){
  66. return;
  67. }
  68. Feng.addAjaxSelect({
  69. "id": "cityCode",
  70. "displayCode": "code",
  71. "displayName": "name",
  72. "type": "GET",
  73. "url": Feng.ctxPath + "/api/commonLocation/findCityByProvinceSelect/"+province
  74. });
  75. }
  76. /**
  77. * 加载县
  78. */
  79. TalentInfoInfoDlg.afterSelectCity = function (){
  80. var city = $("#cityCode").val();
  81. $("#countyCode").empty();
  82. if(city==null||city==''){
  83. return;
  84. }
  85. Feng.addAjaxSelect({
  86. "id": "countyCode",
  87. "displayCode": "code",
  88. "displayName": "name",
  89. "type": "GET",
  90. "url": Feng.ctxPath + "/api/commonLocation/findCountyByCitySelect/"+city
  91. });
  92. }
  93. //人才标签变化
  94. TalentInfoInfoDlg.typeChange = function(context){
  95. var talentType = $(context).val();
  96. if(talentType=='gbwszb' || talentType=='zzbsh' || talentType == 'sydw'){
  97. $("#letterTime").parent().attr("style","display:block");
  98. // }else if(talentType=='gyqyl' || talentType=="gyqyh"){
  99. // $("#letterTime").parent().attr("style","display:none");
  100. // $("#letterTime").val('');
  101. }else{
  102. $("#letterTime").parent().attr("style","display:none");
  103. $("#letterTime").val('');
  104. }
  105. }
  106. TalentInfoInfoDlg.sourceChange = function(){
  107. var source = $("#source").val();
  108. if(source==1){
  109. $("#fromCity").parent().attr("style","display:none");
  110. $("#qzBatch").parent().attr("style","display:block");
  111. $("#qzgccrcActiveTime").parent().attr("style","display:block");
  112. $("#certificateStartTime").parent().attr("style","display:block");
  113. $("#ourCitySource").parent().attr("style","display:block");
  114. $("#fromCity").val("");
  115. }
  116. if(source==2){
  117. $("#qzgccrcActiveTime").parent().attr("style","display:block");
  118. $("#certificateStartTime").parent().attr("style","display:block");
  119. $("#fromCity").parent().attr("style","display:block");
  120. $("#qzBatch").parent().attr("style","display:block");
  121. $("#ourCitySource").parent().attr("style","display:none");
  122. $("#ourCitySource").val("");
  123. }
  124. if(source==3||source==null||source==''){
  125. $("#qzgccrcActiveTime").parent().attr("style","display:none");
  126. $("#certificateStartTime").parent().attr("style","display:none");
  127. $("#fromCity").parent().attr("style","display:none");
  128. $("#qzBatch").parent().attr("style","display:none");
  129. $("#ourCitySource").parent().attr("style","display:none");
  130. $("#ourCitySource").val("");
  131. $("#qzgccrcActiveTime").val('');
  132. $("#certificateStartTime").val('');
  133. $("#fromCity").val("");
  134. $("#qzBatch").val("");
  135. }
  136. $("#talentArrange").val("").trigger("change");
  137. // $("#identifyCondition").empty();
  138. // $("#identifyCondition").trigger('chosen:updated');
  139. }
  140. //初始化附件类别表单
  141. TalentInfoInfoDlg.initFileTable = function (){
  142. var queryData = {};
  143. queryData['project'] = CONFIG.project_rcrd;
  144. queryData['type'] = $("#type").val();
  145. $("#fileTable").bootstrapTable({
  146. url: Feng.ctxPath + "/api/talentInfo/findUnCommonFileType",
  147. method: 'POST',
  148. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  149. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  150. showRefresh: false, // 是否显示刷新按钮
  151. clickToSelect: true, // 是否启用点击选中行
  152. singleSelect: true, // 设置True 将禁止多选
  153. striped: true, // 是否显示行间隔色
  154. escape: true,
  155. pagination: false, // 设置为 true 会在表格底部显示分页条
  156. paginationHAlign: "left",
  157. paginationDetailHAlign: "right",
  158. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  159. showColumns: false,
  160. detailView: true, //是否显示父子表
  161. pageList: [10, 30, 50],
  162. queryParams: function (params) {
  163. return $.extend(queryData,params)
  164. },
  165. rowStyle: function (row, index) {
  166. return {classes:"info"};
  167. },
  168. columns: TalentInfoInfoDlg.initFileTypeColumn(),
  169. onPostBody: function () {
  170. $("td.uitd_showTip").bind("mouseover", function () {
  171. var htm = $(this).html();
  172. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  173. });
  174. },
  175. onLoadSuccess: function (data) {
  176. $("#fileTable").bootstrapTable('expandAllRows');
  177. },
  178. onExpandRow: function (index, row, $detail) {
  179. var ajax = new $ax(Feng.ctxPath + "/api/talentInfo/listTalentFile", function (data) {
  180. if(data==null||data.length==0){
  181. return;
  182. }
  183. 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>';
  184. for(var key in data){
  185. var sn = data[key].url.lastIndexOf(".");
  186. var suffix = data[key].url.substring(sn+1,data[key].url.length);
  187. var imgStr = "";
  188. if(suffix=="pdf"||suffix=="PDF"){
  189. 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>";
  190. }else if(suffix == "xlsx" || suffix=="XLSX" || suffix == 'xls' || suffix == 'XLS'){
  191. 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>";
  192. }else{
  193. imgStr = '<img class=\"imgUrl\" src=\"'+data[key].url+'\" style=\"width:25px;height:25px;\">';
  194. }
  195. html = html + '<li style="display: none">'+data[key].id+'</li>\n'+
  196. '<li style="width: 80%;padding-top: 5px;">'+data[key].orignName+'</li>\n'+
  197. '<li style="width: 10%;">'+imgStr+'</li>\n';
  198. }
  199. html = html + '</ul>';
  200. $detail.html(html);
  201. $(".imgs").viewer({ fullscreen:false});
  202. }, function (data) {
  203. Feng.error("查询失败!" + data.responseJSON.message + "!");
  204. });
  205. var queryData = {};
  206. queryData["mainId"] = $("#id").val();
  207. queryData["fileTypeId"] = row.id;
  208. ajax.set(queryData);
  209. ajax.start();
  210. }
  211. });
  212. }
  213. //校验是否保存基础信息
  214. TalentInfoInfoDlg.validId = function (){
  215. var id = $("#id").val();
  216. if(id!=null && id!=''){
  217. $("#fileLi").removeAttr("style");
  218. }else{
  219. $("#fileLi").attr("style","pointer-events: none");
  220. }
  221. }
  222. /**
  223. * 初始化表格的列
  224. */
  225. TalentInfoInfoDlg.initFileTypeColumn = function () {
  226. return [
  227. {field: 'selectItem', checkbox:false,visible:false},
  228. {title: '名称', field: 'name', visible: true, align: 'center', valign: 'middle',width:"30%",'class': 'uitd_showTip',
  229. formatter : function(value,row,index){
  230. if(row.must==1){
  231. return '<i class="fa fa-paste"></i><span style="font-weight:bold;color:red;font-size:14px;font-family:宋体"> * </span> '+ value;
  232. }if(row.must==2){
  233. return '<i class="fa fa-paste"></i>'+value;
  234. }
  235. }
  236. },
  237. {title: '模板', field: 'templateUrl', visible: true, align: 'center', valign: 'middle',width:"8%",
  238. formatter : function(value,row,index){
  239. if(value==null||value==''||value=='null'){
  240. return '无';
  241. }
  242. return "<button type='button' onclick=\"TalentInfoInfoDlg.downloadFile('"+row.id+"',3)\" style='margin-right: 10px' class=\"btn btn-xs btn-primary\">" +
  243. "<i class=\"fa fa-download\"></i>下载" +
  244. "</button>";
  245. }
  246. },
  247. {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle',width:"52%",'class': 'uitd_showTip'},
  248. ]
  249. };
  250. TalentInfoInfoDlg.downloadFile = function (id,type){
  251. window.location.href = Feng.ctxPath + "/api/common/downloadFile?id=" + id + "&type="+type;
  252. }
  253. $(function() {
  254. var hand = $("#hand").val();
  255. var id = $("#id").val();
  256. var checkState = $("#checkState").val();
  257. //批量加载字典表数据
  258. var arr = [
  259. {"name":"nation","code":"un_nation"},
  260. {"name":"talentArrange","code":"un_talentLevel"},
  261. {"name":"nationality","code":"un_nationality"},
  262. {"name":"politics","code":"un_political"},
  263. {"name":"highEducation","code":"un_education"},
  264. {"name":"introductionMode","code":"un_introduction_mode"},
  265. {"name":"industryField","code":"un_industryField"},
  266. {"name":"address","code":"un_street"},
  267. {"name":"talentType","code":"un_jbt_talentType"}];
  268. Feng.findChildDictBatch(JSON.stringify(arr))
  269. //加载省份
  270. Feng.addAjaxSelect({
  271. "id": "provinceCode",
  272. "displayCode": "code",
  273. "displayName": "name",
  274. "type": "GET",
  275. "url": Feng.ctxPath + "/api/commonLocation/getProvinceSelect"
  276. });
  277. //加载福建省泉州的县
  278. Feng.addAjaxSelect({
  279. "id": "fromCity",
  280. "displayCode": "code",
  281. "displayName": "name",
  282. "type": "GET",
  283. "url": Feng.ctxPath + "/api/commonLocation/findCountyByCitySelect/350500"
  284. });
  285. if(hand == 'add' || (hand == 'update' && (checkState == 1 || checkState == 10))){
  286. //加载人才标签
  287. Feng.addAjaxSelect({
  288. "id": "talentType",
  289. "displayCode": "code",
  290. "displayName": "name",
  291. "type": "GET",
  292. "url": Feng.ctxPath + "/api/talentInfo/findTalentTypeByEnterprise"
  293. });
  294. }
  295. var batchHtml = "<option value=''>请选择</option>";
  296. for(var i=1;i<101;i++){
  297. batchHtml = batchHtml + "<option value='"+i+"'>"+i+"</option>";
  298. }
  299. $("#qzBatch").append(batchHtml);
  300. //批量加载时间控件
  301. $(".date").each(function(){
  302. laydate.render({
  303. elem: this
  304. ,type: 'date'
  305. ,trigger: 'click'
  306. });
  307. });
  308. if(id!=null && id!=''){
  309. //select初始化
  310. $("select").each(function () {
  311. $(this).val($(this).attr("value")).trigger("change");
  312. });
  313. Feng.getCheckLog("logTable",{"type":CONFIG.project_rcrd,"mainId":id,"typeFileId":"","active":1})
  314. }
  315. $("#address").val($("#address").attr("value"));
  316. $("#industryField").val($("#industryField").attr("value"));
  317. $("#provinceCode").val($("#provinceCode").attr("value"));
  318. TalentInfoInfoDlg.afterSelectProvince();
  319. $("#cityCode").val($("#cityCode").attr("value"));
  320. TalentInfoInfoDlg.afterSelectCity();
  321. $("#countyCode").val($("#countyCode").attr("value"));
  322. $("#talentArrange").val($("#talentArrange").attr("value"));
  323. TalentInfoInfoDlg.getIdentifyCondition();
  324. $("#talentArrange").val($("#talentArrange").attr("value"));
  325. $("#identifyCondition").val($("#identifyCondition").attr("value"));
  326. TalentInfoInfoDlg.validId();
  327. $("input,select,textarea").not("input[type='hidden']").not("input[type='file']").attr("style","pointer-events: none;background-color: #eee;");
  328. });