talentInfo_wj_select.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. /**
  2. * 初始化人才认定申报详情对话框
  3. */
  4. var locked = false;
  5. var TalentInfoInfoDlg = {
  6. talentInfoInfoData: {},
  7. };
  8. //初始化附件类别表单
  9. TalentInfoInfoDlg.initFileTable = function () {
  10. var queryData = {};
  11. queryData['project'] = CONFIG.project_rcrd;
  12. queryData['type'] = $("#type").val();
  13. queryData["talent_condition"] = $("#talent_condition").val();
  14. queryData['checkState'] = $("#checkState").val();
  15. queryData['isMix'] = 1;
  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: TalentInfoInfoDlg.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: 75%;font-weight: bold;padding-top: 5px;">附件原名</li><li style="width: 10%;font-weight: bold;padding-top: 5px;">预览</li><li style="width:15%;font-weight: bold;padding-top: 5px;">操作</li>';
  55. var files = $("#files").val();
  56. var checkState = $("#checkState").val();
  57. var realState = $("#realState").val();
  58. for (var key in data) {
  59. var btn = "";
  60. if (Feng.isEmptyStr(checkState) || (checkState == 8 && (realState == 8 || Feng.isEmptyStr(realState))) || (checkState == 11 && realState != 14) || (realState == 11 && files.indexOf(row.id) != -1)) {
  61. btn = "<button type=\'button\' onclick=\"TalentInfoInfoDlg.checkFile(this,'" + row.fState + "','" + row.id + "','" + data[key].id + "')\" style=\'margin-right: 10px\' class=\"btn btn-xs btn-info\">" +
  62. "<i class=\"fa fa-paste\"></i>修改" +
  63. "</button>" +
  64. "<button type='button' onclick=\"TalentInfoInfoDlg.deleteFile('" + data[key].id + "','" + row.fState + "')\" class=\"btn btn-xs btn-danger\">" +
  65. "<i class=\"fa fa-times\"></i>删除" +
  66. "</button>";
  67. } else {
  68. btn = "";
  69. }
  70. var sn = data[key].url.lastIndexOf(".");
  71. var suffix = data[key].url.substring(sn + 1, data[key].url.length);
  72. var imgStr = "";
  73. if (suffix == "pdf" || suffix == "PDF") {
  74. 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>";
  75. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS') {
  76. 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>";
  77. } else {
  78. imgStr = '<img class=\"imgUrl\" src=\"' + data[key].url + '\" style=\"width:25px;height:25px;\">';
  79. }
  80. html = html + '<li style="display: none">' + data[key].id + '</li>\n' +
  81. '<li style="width: 75%;padding-top: 5px;">' + data[key].orignName + '</li>\n' +
  82. '<li style="width: 10%;">' + imgStr + '</li>\n' +
  83. '<li style="width: 15%;padding-top: 2px;">' + btn + '</li>';
  84. }
  85. html = html + '</ul>';
  86. $detail.html(html);
  87. $(".imgs").viewer({fullscreen: false});
  88. }, function (data) {
  89. Feng.error("查询失败!" + data.responseJSON.message + "!");
  90. });
  91. var queryData = {};
  92. queryData["mainId"] = $("#id").val();
  93. queryData["fileTypeId"] = row.id;
  94. ajax.set(queryData);
  95. ajax.start();
  96. }
  97. });
  98. }
  99. /**
  100. * 初始化表格的列
  101. */
  102. TalentInfoInfoDlg.initFileTypeColumn = function () {
  103. return [
  104. {field: 'selectItem', checkbox: false, visible: false},
  105. {title: '名称', field: 'name', visible: true, align: 'center', valign: 'middle', width: "30%", 'class': 'uitd_showTip',
  106. formatter: function (value, row, index) {
  107. if (row.must == 1) {
  108. return '<i class="fa fa-paste"></i><span style="font-weight:bold;color:red;font-size:14px;font-family:宋体"> * </span> ' + value;
  109. }
  110. if (row.must == 2) {
  111. return '<i class="fa fa-paste"></i>' + value;
  112. }
  113. }
  114. },
  115. {title: '模板', field: 'templateUrl', visible: true, align: 'center', valign: 'middle', width: "8%",
  116. formatter: function (value, row, index) {
  117. if (value == null || value == '' || value == 'null') {
  118. return '无';
  119. }
  120. return "<button type='button' onclick=\"TalentInfoInfoDlg.downloadFile('" + row.id + "',5)\" style='margin-right: 10px' class=\"btn btn-xs btn-primary\">" +
  121. "<i class=\"fa fa-download\"></i>下载" +
  122. "</button>";
  123. }
  124. },
  125. {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle', width: "52%", 'class': 'uitd_showTip'},
  126. ]
  127. };
  128. /**
  129. * 显示初审审核模态框
  130. */
  131. TalentInfoInfoDlg.showFirstCheckModal = function () {
  132. var ajax = new $ax("/enterprise/talent/validateIsCheck", function (data) {
  133. if (data.code == 200) {
  134. layer.open({
  135. type: 1,
  136. id: "neewFieldFormModel",
  137. title: '审核',
  138. area: ['800px', '450px'], //宽高
  139. fix: false, //不固定
  140. shade: 0,
  141. maxmin: true,
  142. content: TalentInfoInfoDlg.creatFieldCheckModal(),
  143. btn: ['<i class="fa fa-save"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  144. btnAlign: 'c',
  145. zIndex: layer.zIndex,
  146. success: function (layero, index) {
  147. layer.setTop(layero);
  148. var obj = data.obj.talentInfo;
  149. var fileList = data.obj.fileList;
  150. if (typeof data.obj.fieldList != "undefined" && data.obj.fieldList.length > 0) {
  151. var fieldList = data.obj.fieldList;
  152. var html1 = '';
  153. for (var key in fieldList) {
  154. html1 = html1 + '<li style="float:left;margin:0 10px 10px 0;"><input type="checkbox" value="' + fieldList[key]["key"] + '"><span>' + fieldList[key]["value"] + '</span></li>';
  155. }
  156. }
  157. var html2 = '';
  158. for (var key in fileList) {
  159. html2 = html2 + '<ul><li style="width: 100%"><input type="checkbox" value="' + fileList[key].id + '"><span>' + fileList[key].name + '</span></li></ul>';
  160. }
  161. $("#field_info ul").css("overflow", "hidden").empty().append(html1);
  162. $("#field_file").css("overflow", "hidden").empty().append(html2);
  163. $("#firstCheckForm")[0].reset();
  164. $("#checkStateFirstModal").val(data.obj.check.checkState);
  165. $("#checkStateFirstModal").trigger("change");
  166. $("#checkMsgFirst").val(data.obj.check.msg);
  167. if (obj.fields != null && obj.fields != '') {
  168. $("#field_info input").each(function () {
  169. for (var key in obj.fields) {
  170. if ($(this).val() == obj.fields[key]) {
  171. this.checked = true;
  172. }
  173. }
  174. });
  175. }
  176. if (obj.files != null && obj.files != '') {
  177. $("#field_file input").each(function () {
  178. for (var key in obj.files) {
  179. if ($(this).val() == obj.files[key]) {
  180. this.checked = true;
  181. }
  182. }
  183. });
  184. }
  185. },
  186. yes: function (index, layero) {
  187. TalentInfoInfoDlg.firstCheck(index);
  188. }
  189. });
  190. } else {
  191. Feng.error(data.msg);
  192. }
  193. }, function (data) {
  194. Feng.error("校验失败!" + data.responseJSON.message + "!");
  195. });
  196. ajax.setData({"id": $("#id").val()})
  197. ajax.start();
  198. }
  199. /**
  200. * 初审提交
  201. */
  202. TalentInfoInfoDlg.firstCheck = function (i) {
  203. var checkState = $("#checkStateFirstModal").val();
  204. var checkMsg = $("#checkMsgFirst").val();
  205. if (checkState == null || checkState == '') {
  206. Feng.info("请选择审核状态");
  207. return;
  208. }
  209. if (checkMsg == null || checkMsg == '') {
  210. Feng.info("请填写审核意见");
  211. return;
  212. }
  213. var fields = '';
  214. var files = '';
  215. $("#field_info li input").each(function (index) {
  216. if ($(this).is(":checked")) {
  217. fields = fields + $(this).val() + ",";
  218. }
  219. });
  220. $("#field_file li input").each(function (index) {
  221. if ($(this).is(":checked")) {
  222. files = files + $(this).val() + ",";
  223. }
  224. });
  225. if (checkState == 2 && fields == '' && files == '') {
  226. Feng.info("请选择可修改的字段或附件!");
  227. return;
  228. }
  229. if (locked)
  230. return;
  231. locked = true;
  232. var ajax = new $ax("/enterprise/talent/check", function (data) {
  233. if (data.code == 200) {
  234. // $("#firstModal").modal("hide");
  235. layer.close(i);
  236. Feng.success(data.msg);
  237. } else {
  238. Feng.error(data.msg);
  239. }
  240. locked = false;
  241. }, function (data) {
  242. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  243. locked = false;
  244. });
  245. ajax.setData({"id": $("#id").val(), "checkState": checkState, "checkMsg": checkMsg,
  246. "fields": fields, "files": files})
  247. ajax.start();
  248. }
  249. TalentInfoInfoDlg.submitCheck = function () {
  250. var operation = function () {
  251. var ajax = new $ax(Feng.ctxPath + "/enterprise/talent/submitCheck", function (data) {
  252. if (data.code == 200) {
  253. Feng.success(data.msg);
  254. window.parent.TalentInfo.table.refresh();
  255. TalentInfoInfoDlg.close();
  256. } else {
  257. Feng.error(data.msg);
  258. }
  259. }, function (data) {
  260. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  261. });
  262. ajax.setData({"id": $("#id").val()});
  263. ajax.start();
  264. }
  265. Feng.confirm("一旦提交无法修改,是否审核完毕且无误?", operation);
  266. }
  267. TalentInfoInfoDlg.creatFieldCheckModal = function () {
  268. return '<form id="firstCheckForm">\n' +
  269. ' <div class="form-group" style="margin: 10px;">\n' +
  270. ' <label for="checkState" class="control-label">审核状态</label>\n' +
  271. ' <select class="form-control" id="checkStateFirstModal" onchange="TalentInfoInfoDlg.toggleField()">\n' +
  272. ' <option value="">请选择</option>\n' +
  273. ' <option value="3">审核通过</option>\n' +
  274. ' <option value="2">审核驳回</option>\n' +
  275. ' </select>\n' +
  276. ' </div>\n' +
  277. ' <div class="form-group" style="margin: 10px;">\n' +
  278. ' <label for="checkMsg" class="control-label" >审核意见</label>\n' +
  279. ' <textarea class="form-control" id="checkMsgFirst" placeholder="审核状态属“审核通过”的,仅代表此步骤已操作完成,不代表用户提交的信息符合认定条件。若不符合认定条件的,请写明不符合原因。" rows="6"></textarea>\n' +
  280. ' <div id="field" style="padding-top: 5px;display: none">\n' +
  281. ' <label for="checkMsg" class="control-label">可修改字段</label>\n' +
  282. ' <div id="field_info">\n' +
  283. ' <ul style="overflow:hidden;list-style:none;">\n' +
  284. ' </ul>\n' +
  285. ' </div>\n' +
  286. ' <label for="checkMsg" class="control-label">可修改附件</label>\n' +
  287. ' <div id="field_file">\n' +
  288. ' </div>\n' +
  289. ' <div class="form-group" style="text-align: center">\n' +
  290. ' <button type="button" class="btn btn-primary" onclick="TalentInfoInfoDlg.checkAll()">全选</button>\n' +
  291. ' <button type="button" class="btn btn-success" onclick="TalentInfoInfoDlg.unCheckAll()">反选</button>\n' +
  292. ' </div>\n' +
  293. ' </div>\n' +
  294. ' </div>\n' +
  295. ' </form>';
  296. }
  297. TalentInfoInfoDlg.addSubmit = function () {
  298. Feng.error("当前状态不能修改");
  299. }
  300. TalentInfoInfoDlg.submitToCheck = function () {
  301. Feng.error("当前状态不能修改");
  302. }
  303. /**
  304. * 显示字段或者隐藏字段选择
  305. */
  306. TalentInfoInfoDlg.toggleField = function () {
  307. var checkState = $("#checkStateFirstModal").val();
  308. var checkMsgFirst = $("#checkMsgFirst").val();
  309. if (checkState == 2) {
  310. $("#field").show();
  311. $("#checkMsgFirst").val("");
  312. } else if (checkState == 3) {
  313. $("#field").hide();
  314. $("#field").find("input[type=checkbox]").removeAttr("checked");
  315. if (checkMsgFirst == null || checkMsgFirst == '') {
  316. $("#checkMsgFirst").val("审核通过");
  317. }
  318. }
  319. }
  320. TalentInfoInfoDlg.downloadFile = function (id, type) {
  321. window.location.href = Feng.ctxPath + "/common/api/downloadFile?id=" + id + "&type=" + type;
  322. }
  323. $(function () {
  324. var id = $("#id").val();
  325. if (id != null && id != '') {
  326. Feng.getCheckLog("logTable", {"type": CONFIG.project_rcrd, "mainId": id, "typeFileId": "", "active": 1})
  327. }
  328. $("input,select,textarea").not("input[type='hidden']").not("input[type='file']").attr("style", "pointer-events: none;background-color: #e2ecf2;;");
  329. TalentInfoInfoDlg.initFileTable();
  330. });