integralInfo.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. /**
  2. * 初始化人才认定申报详情对话框
  3. */
  4. var locked = false;
  5. var IntegralInfoDlg = {
  6. integralInfoData: {},
  7. validateFields: {
  8. name: {validators: {notEmpty: {message: '姓名不能为空'}}},
  9. card_type: {validators: {notEmpty: {message: '证件类型不能为空'}}},
  10. card_number: {
  11. validators: {
  12. notEmpty: {message: '证件号码不能为空'},
  13. regexp: {
  14. regexp: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
  15. message: "身份证号码格式不正确"
  16. }
  17. }
  18. },
  19. phone: {
  20. validators: {
  21. notEmpty: {
  22. message: '手机号码不能为空'
  23. },
  24. regexp: {
  25. regexp: /0?(13|14|15|17|18|19)[0-9]{9}/,
  26. message: "手机号码格式不正确"
  27. }
  28. }
  29. },
  30. email: {
  31. validators: {
  32. notEmpty: {
  33. message: '电子邮箱不能为空'
  34. },
  35. emailAddress: {
  36. message: "电子邮箱格式不正确"
  37. }
  38. }
  39. }
  40. }
  41. };
  42. /**
  43. * 清除数据
  44. */
  45. IntegralInfoDlg.clearData = function () {
  46. this.integralInfoData = {};
  47. }
  48. /**
  49. * 设置对话框中的数据
  50. *
  51. * @param key 数据的名称
  52. * @param val 数据的具体值
  53. */
  54. IntegralInfoDlg.set = function (key, val) {
  55. var dis = $("#" + key).attr("disabled");
  56. if (dis == "disabled") {
  57. $("#" + key).removeAttr("disabled");
  58. }
  59. this.integralInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
  60. if (dis == "disabled") {
  61. $("#" + key).prop("disabled", true);
  62. }
  63. return this;
  64. }
  65. /**
  66. * 设置对话框中的数据
  67. *
  68. * @param key 数据的名称
  69. * @param val 数据的具体值
  70. */
  71. IntegralInfoDlg.get = function (key) {
  72. return $("#" + key).val();
  73. }
  74. /**
  75. * 关闭此对话框
  76. */
  77. IntegralInfoDlg.close = function () {
  78. parent.layer.close(window.parent.TalentInfo.layerIndex);
  79. }
  80. /**
  81. * 收集数据
  82. */
  83. IntegralInfoDlg.collectData = function () {
  84. this
  85. .set('id')
  86. .set('type')
  87. .set('name')
  88. .set('card_type')
  89. .set('card_number')
  90. .set('phone')
  91. .set('email');
  92. }
  93. /**
  94. * 验证数据
  95. */
  96. IntegralInfoDlg.validate = function () {
  97. $('#integralInfoForm').data("bootstrapValidator").resetForm();
  98. $('#integralInfoForm').bootstrapValidator('validate');
  99. return $("#integralInfoForm").data('bootstrapValidator').isValid();
  100. }
  101. /**
  102. * 初始化表格的列
  103. */
  104. IntegralInfoDlg.initFileTypeColumn = function () {
  105. return [
  106. {field: 'selectItem', checkbox: false, visible: false},
  107. {title: '名称', field: 'name', visible: true, align: 'left', valign: 'middle', width: "82%", 'class': 'uitd_showTip',
  108. formatter: function (value, row, index) {
  109. let str = '<div class="word-wrap">';
  110. if (row.must == 1) {
  111. str = str + '<i class="fa fa-paste"></i><span style="font-weight:bold;color:red;font-size:14px;font-family:宋体"> * </span> ' + value;
  112. }
  113. if (row.must == 2) {
  114. str = str + '<i class="fa fa-paste"></i>' + value;
  115. }
  116. str = str + '<br /><span id="desc_' + row.rel + '">' + row.description + '</span></div>'
  117. return str;
  118. }
  119. },
  120. {title: '模板', field: 'templateUrl', visible: true, align: 'center', valign: 'middle', width: "8%",
  121. formatter: function (value, row, index) {
  122. if (value == null || value == '' || value == 'null') {
  123. return '无';
  124. }
  125. return "<button type='button' onclick=\"IntegralInfoDlg.downloadFile('" + row.id + "',3)\" style='margin-right: 10px' class=\"btn btn-xs btn-primary\">" +
  126. "<i class=\"fa fa-download\"></i>下载" +
  127. "</button>";
  128. }
  129. },
  130. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "10%",
  131. formatter: function (value, row, index) {
  132. return IntegralInfoDlg.validUploadButton(1, value, '');
  133. }
  134. }
  135. ]
  136. };
  137. IntegralInfoDlg.addItem = function () {
  138. var html = '<table style="width:100%;border-collapse: collapse;" class="table table-bordered">' +
  139. ' <tr>' +
  140. ' <td style="width:40px;">' +
  141. ' <div class="rowGroup">' +
  142. ' <label class="control-label spacing td-label">选择</label>' +
  143. ' <input type="checkbox" name="chk[]" class="form-control"/>' +
  144. ' </td>' +
  145. ' <td>' +
  146. ' <div class="rowGroup">' +
  147. ' <label class=" control-label spacing td-label"><span style="color: red">*</span>项目类别</label>' +
  148. ' <select class="form-control" name="projectType[]" value="" onchange="IntegralInfoDlg.onProjectTypeChange(this);">' +
  149. ' <option value="">请选择</option>' +
  150. ' <option value="1">基础分</option>' +
  151. ' <option value="2">贡献分</option>' +
  152. ' <option value="3">资历分</option>' +
  153. ' </select>' +
  154. ' </div>' +
  155. ' </td>' +
  156. ' <td>' +
  157. ' <div class="rowGroup">' +
  158. ' <label class=" control-label spacing td-label"><span style="color: red">*</span>积分项目</label>' +
  159. ' <select class="form-control" name="projectId[]" value="" onchange="IntegralInfoDlg.onProjectChange(this);">' +
  160. ' <option value="">请选择</option>' +
  161. ' </select>' +
  162. ' </div>' +
  163. ' </td>' +
  164. ' <td>' +
  165. ' <div class="rowGroup">' +
  166. ' <label class=" control-label spacing td-label"><span style="color: red">*</span>积分标准</label>' +
  167. ' <select class="form-control" name="item_id[]" value="" onchange="IntegralInfoDlg.onItemChange(this);">' +
  168. ' <option value="">请选择</option>' +
  169. ' </select>' +
  170. ' </div>' +
  171. ' </td>' +
  172. ' <td>' +
  173. ' <div class="rowGroup">' +
  174. ' <label class="control-label spacing td-label"><span style="color: red">*</span>数额<span class="unit"></span></label>' +
  175. ' <input type="text" class="form-control" name="amount[]" value=""/>' +
  176. ' </div>' +
  177. ' </td>' +
  178. ' </tr>' +
  179. ' </table>';
  180. /*
  181. *
  182. ' <tr>' +
  183. ' <td colspan="5">' +
  184. ' <table class="fileTable"></table>' +
  185. ' </td>' +
  186. ' </tr>' +
  187. *
  188. */
  189. $("#toolbar").before(html);
  190. }
  191. IntegralInfoDlg.changeAndLoadFile = function () {
  192. var table = $(".fileTable");
  193. var items = $("select[name='item_id[]']");
  194. var item_id = [];
  195. for (var i = 0; i < items.length; i++) {
  196. let _id = items.eq(i).val();
  197. if (_id) {
  198. item_id.push(_id);
  199. }
  200. }
  201. if (item_id.length == 0) {
  202. table.bootstrapTable("destroy");
  203. return;
  204. }
  205. var ajax = new $ax("/common/api/findCommonFileType", function (data) {
  206. if (data == null || data.length == 0) {
  207. return;
  208. }
  209. table.bootstrapTable("destroy");
  210. table.bootstrapTable({
  211. columns: IntegralInfoDlg.initFileTypeColumn(),
  212. data: data.rows,
  213. showHeader: true,
  214. rowStyle: function (row, index) {
  215. return {classes: ""};
  216. },
  217. onPostBody: function (data) {
  218. for (var k in data) {
  219. var files = data[k].files;
  220. var html = '<ul class="imgs"><li style="width: 70%;font-weight: bold;padding-top: 5px;">附件原名</li><li style="width: 10%;font-weight: bold;padding-top: 5px;">预览</li><li style="width: 20%;font-weight: bold;padding-top: 5px;">操作</li>';
  221. for (var key in files) {
  222. var btn = "";
  223. btn = IntegralInfoDlg.validUploadButton(2, data[k].id, files[key].id);
  224. var sn = files[key].url.lastIndexOf(".");
  225. var suffix = files[key].ext; //files[key].url.substring(sn + 1, files[key].url.length);
  226. var imgStr = "";
  227. if (suffix == "pdf" || suffix == "PDF") {
  228. imgStr = "<button type='button' onclick=\"Feng.showPdf('" + files[key].url + "','" + files[key].id + "','" + files[key].orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";
  229. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS' || suffix == 'docx' || suffix == 'doc' || suffix == 'DOCX' || suffix == 'DOC') {
  230. imgStr = "<button type='button' onclick=\"Feng.showExcel('" + files[key].url + "','" + files[key].id + "','" + files[key].orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-excel-o\" aria-hidden=\"true\"></i></button>";
  231. } else {
  232. imgStr = '<img class=\"imgUrl\" onclick=\"Feng.showImg(this)\" src=\"' + files[key].url + '\" style=\"width:25px;height:25px;\">';
  233. }
  234. html += '<li data-id="' + files[key].id + '">\n\
  235. <div>' + (data[k].step != 1 ? '<input type="hidden" name="uploadFiles[]" value="' + files[key].id + '">' : "") + '</div>\n' +
  236. '<div style="width: 70%;">' + files[key].orignName + '</div>\n' +
  237. '<div style="width: 10%;">' + imgStr + '</div>\n' +
  238. '<div style="width: 20%;">' + btn + '</div>\n\
  239. </li>';
  240. }
  241. html = html + '</ul>';
  242. table.find("tr[data-index='" + k + "']").after('<tr class="detail-view"><td colspan="5">' + html + '</td></tr>');
  243. }
  244. $("td.uitd_showTip").bind("mouseover", function () {
  245. var htm = $(this).html();
  246. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  247. });
  248. },
  249. });
  250. }, function (data) {
  251. Feng.error("查询失败!" + data.responseJSON.message + "!");
  252. });
  253. var queryData = {};
  254. queryData["mainId"] = $("#id").val();
  255. queryData['project'] = CONFIG.project_integral_apply;
  256. queryData['type'] = $("#type").val();
  257. queryData["itemId"] = item_id;
  258. queryData['checkState'] = $("#checkState").val();
  259. ajax.set(queryData);
  260. ajax.start();
  261. }
  262. IntegralInfoDlg.deleteItem = function () {
  263. var len = $("input[name='chk[]']:checked").length;
  264. if (len == 0) {
  265. Feng.info("请选择要移除的项目");
  266. }
  267. for (var i = 0; i < len; i++) {
  268. $("input[name='chk[]']:checked").eq(0).parents("table").remove();
  269. }
  270. IntegralInfoDlg.changeAndLoadFile();
  271. }
  272. IntegralInfoDlg.onProjectTypeChange = function (obj) {
  273. var projectType = $(obj).val();
  274. var projectObj = $(obj).parents("table").find("select[name='projectId[]']")
  275. Feng.addAjaxSelect({
  276. "obj": projectObj,
  277. "displayCode": "id",
  278. "displayName": "name",
  279. "type": "GET",
  280. "url": "/common/api/getIntegralProjectsByType/projectType/" + projectType
  281. });
  282. }
  283. IntegralInfoDlg.onProjectChange = function (obj) {
  284. var projectId = $(obj).val();
  285. var itemObj = $(obj).parents("table").find("select[name='item_id[]']")
  286. Feng.addAjaxSelect({
  287. "obj": itemObj,
  288. "displayCode": "id",
  289. "displayName": "name",
  290. "bindData": "unit",
  291. "type": "GET",
  292. "url": "/common/api/getIntegralItemsByProject/projectId/" + projectId
  293. });
  294. }
  295. IntegralInfoDlg.onItemChange = function (obj) {
  296. var unit = $(obj).find("option:selected").data("unit");
  297. var parent = $(obj).parents("table");
  298. if (typeof unit != "undefined" && unit) {
  299. parent.find(".unit").html("(" + unit + ")");
  300. } else {
  301. parent.find(".unit").html("");
  302. }
  303. IntegralInfoDlg.changeAndLoadFile();
  304. }
  305. /**
  306. * 提交添加
  307. */
  308. IntegralInfoDlg.addSubmit = function () {
  309. this.clearData();
  310. this.collectData();
  311. if (!IntegralInfoDlg.validate()) {
  312. return;
  313. }
  314. var id = $('#id').val();
  315. if (id != null && id != '') {
  316. if (!IntegralInfoDlg.validateIsEdit())
  317. return;
  318. }
  319. $("select").each(function () {
  320. $(this).removeAttr("disabled");
  321. });
  322. if (locked) {
  323. //return;
  324. }
  325. locked = true;
  326. $("#integralInfoForm").attr("action", "/enterprise/integral/apply");
  327. $("#integralInfoForm")[0].submit();
  328. }
  329. //回调
  330. IntegralInfoDlg.infoCallback = function (data) {
  331. console.log(data)
  332. locked = false;
  333. IntegralInfoDlg.setNoChangeField();
  334. Feng.info(data.msg);
  335. if (data.code == 200) {
  336. window.parent.Integral.table.refresh();
  337. $("#id").val(data.obj.id);
  338. $("#fileLi").removeAttr("style");
  339. $("#checkState").val(data.obj.checkState);
  340. }
  341. return;
  342. }
  343. //校验是否保存基础信息
  344. IntegralInfoDlg.validId = function () {
  345. var id = $("#id").val();
  346. if (id != null && id != '') {
  347. $("#fileLi").removeAttr("style");
  348. } else {
  349. $("#fileLi").attr("style", "pointer-events: none");
  350. }
  351. }
  352. var currentTable = null;
  353. var currentTr = null;
  354. //选择附件并显示附件名
  355. IntegralInfoDlg.checkFile = function (content, fileTypeId, fileId) {
  356. currentTable = $(content).parents(".fileTable");
  357. currentTr = $(content).parents("tr").data("index");
  358. if (!IntegralInfoDlg.validateIsEdit())
  359. return;
  360. $("#upload_file").unbind("change");
  361. $("#upload_file").change(function () {
  362. if (!Feng.chkFileInvalid(this.files[0], 5, 10))
  363. return;
  364. IntegralInfoDlg.upload(fileTypeId, fileId);
  365. });
  366. $('#upload_file').val("");
  367. $('#upload_file').click();
  368. }
  369. //上传附件
  370. IntegralInfoDlg.upload = function (fileTypeId, fileId) {
  371. var id = $("#id").val();
  372. if (!IntegralInfoDlg.validateIsEdit())
  373. return;
  374. if (fileId != null && fileId != 'null') {
  375. $("#fileId").val(fileId)
  376. } else {
  377. $("#fileId").val("");
  378. }
  379. $("#mainId").val(id);
  380. $("#fileTypeId").val(fileTypeId);
  381. var index = layer.load(0, {shade: false, time: 0});
  382. $("#index").val(index);
  383. $("#uploadForm").submit();
  384. }
  385. //删除附件
  386. IntegralInfoDlg.deleteFile = function (id, state) {
  387. if (!IntegralInfoDlg.validateIsEdit())
  388. return;
  389. var operation = function () {
  390. var ajax = new $ax(Feng.ctxPath + "/common/api/deleteFile", function (data) {
  391. if (data.code = 200) {
  392. Feng.success(data.msg);
  393. $("input[name='uploadFiles[]'][value='" + id + "']").parents("li").remove();
  394. //$("#fileTable").bootstrapTable("refresh", {});
  395. } else {
  396. Feng.error(data.msg);
  397. }
  398. }, function (data) {
  399. Feng.error("删除失败!" + data.responseJSON.message + "!");
  400. });
  401. ajax.set("id", id);
  402. ajax.set("type", 1);
  403. ajax.start();
  404. }
  405. Feng.confirm("删除后无法恢复,确认删除吗?", operation);
  406. }
  407. /**
  408. * 提交审核
  409. */
  410. IntegralInfoDlg.submitToCheck = function () {
  411. /*if (!IntegralInfoDlg.validate()) {
  412. return;
  413. }*/
  414. var id = $("#id").val();
  415. /*if (id == null || id == "") {
  416. Feng.info("请先填写基础信息并上传附件");
  417. return;
  418. }*/
  419. if (!IntegralInfoDlg.validateIsEdit())
  420. return;
  421. var operation = function () {
  422. IntegralInfoDlg.clearData();
  423. IntegralInfoDlg.collectData();
  424. /*if (!IntegralInfoDlg.validate()) {
  425. return;
  426. }*/
  427. var id = $('#id').val();
  428. if (id != null && id != '') {
  429. if (!IntegralInfoDlg.validateIsEdit())
  430. return;
  431. }
  432. $("select").each(function () {
  433. $(this).removeAttr("disabled");
  434. });
  435. if (locked) {
  436. return;
  437. }
  438. locked = true;
  439. $("#integralInfoForm").attr("action", "/enterprise/integral/submitToCheck");
  440. $("#integralInfoForm")[0].submit();
  441. }
  442. Feng.confirm("请确认积分申报内容已核对无误,相应附件已上传,一旦提交,无法修改", operation);
  443. }
  444. //回调
  445. IntegralInfoDlg.submitCallback = function (data) {
  446. locked = false;
  447. IntegralInfoDlg.setNoChangeField();
  448. if (data.code == 200) {
  449. Feng.success(data.msg);
  450. // $("#checkState").val(data.obj);
  451. window.parent.TalentInfo.table.refresh();
  452. IntegralInfoDlg.close();
  453. } else {
  454. Feng.error(data.msg);
  455. }
  456. }
  457. /**
  458. * 校验是否可以修改/提交审核
  459. */
  460. IntegralInfoDlg.validateIsEdit = function () {
  461. var checkState = $("#checkState").val();
  462. if (checkState != 0 && checkState != 1) {
  463. if (checkState == 5 || checkState == 8) {
  464. Feng.error("您的申报审核不通过,无法再修改");
  465. return false;
  466. } else if (checkState == 28) {
  467. Feng.error("申报已完成");
  468. return false;
  469. } else if (checkState == 6) {
  470. Feng.error("您的申报已审核通过,无法再修改");
  471. return false;
  472. } else if (checkState == 22 || checkState == 25 || checkState == 27) {
  473. Feng.error("该申报已终止");
  474. return false;
  475. } else {
  476. Feng.error("您的申报正在审核中,请耐心等待");
  477. return false;
  478. }
  479. }
  480. return true;
  481. }
  482. /**
  483. * 校验是否显示按钮
  484. * @param type 类型 1-上传按钮,2-修改删除按钮
  485. * @param row
  486. * @returns {string}
  487. */
  488. IntegralInfoDlg.validUploadButton = function (type, fileTypeId, fileId) {
  489. var files = $("#files").val();
  490. files = files.split(",");
  491. var checkState = $("#checkState").val();
  492. var realState = $("#realState").val();
  493. //console.log(checkState, realState);
  494. if (Feng.isEmptyStr(checkState) || checkState == 0 || (checkState == 1 && realState == 1) || (checkState == 11 && realState != 14) || (realState == 11 && files.indexOf(fileTypeId.toString()) != -1)) {
  495. if (type == 1) { //上传
  496. return "<button type='button' onclick=\"IntegralInfoDlg.checkFile(this," + fileTypeId + "," + null + ")\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
  497. "<i class=\"fa fa-upload\"></i>上传" +
  498. "</button>";
  499. } else {
  500. return "<button type=\'button\' onclick=\"IntegralInfoDlg.checkFile(this," + fileTypeId + "," + fileId + ")\" style=\'margin-right: 10px\' class=\"btn btn-xs btn-info\">" +
  501. "<i class=\"fa fa-paste\"></i>修改" +
  502. "</button>" +
  503. "<button type='button' onclick=\"IntegralInfoDlg.deleteFile(" + fileId + ")\" class=\"btn btn-xs btn-danger\">" +
  504. "<i class=\"fa fa-times\"></i>删除" +
  505. "</button>";
  506. }
  507. } else {
  508. return "";
  509. }
  510. }
  511. //回调
  512. IntegralInfoDlg.callBack = function (data) {
  513. layer.close(data.obj);
  514. Feng.info(data.msg);
  515. if (data.code == 200) {
  516. var sn = data.info.lastIndexOf(".");
  517. var suffix = data.ext; //data.info.substring(sn + 1, data.info.length);
  518. var imgStr = "";
  519. if (suffix == "pdf" || suffix == "PDF") {
  520. imgStr = "<button type='button' onclick=\"Feng.showPdf('" + data.info + "','" + data.id + "','" + data.orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";
  521. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS' || suffix == 'docx' || suffix == 'doc' || suffix == 'DOCX' || suffix == 'DOC') {
  522. imgStr = "<button type='button' onclick=\"Feng.showExcel('" + data.info + "','" + data.id + "','" + data.orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-excel-o\" aria-hidden=\"true\"></i></button>";
  523. } else {
  524. imgStr = '<img class="imgUrl" src="' + data.info + '" style="width:25px;height:25px;">';
  525. }
  526. var li = $("input[name='uploadFiles[]'][value='" + data.id + "'").parents("li");
  527. if (li.length > 0) {
  528. li.find("div").eq(1).html(data.orignName);
  529. li.find("div").eq(2).html(imgStr);
  530. } else {
  531. var html = '<li data-id="' + data.id + '">\n\
  532. <div><input type="hidden" name="uploadFiles[]" value="' + data.id + '"></div>\n\
  533. <div style="width: 70%;">' + data.orignName + '</div>\n\
  534. <div style="width: 10%;">' + imgStr + '</div>\n\
  535. <div style="width: 20%;">\n\
  536. <button type="button" onclick="IntegralInfoDlg.checkFile(this,' + data.typeId + ',' + data.id + ')" style="margin-right: 10px" class="btn btn-xs btn-info"><i class="fa fa-paste"></i>修改</button>\n\
  537. <button type="button" onclick="IntegralInfoDlg.deleteFile(' + data.id + ')" class="btn btn-xs btn-danger"><i class="fa fa-times"></i>删除</button>\n\
  538. </div></li></ul>';
  539. $(currentTable).find("tr[data-index='" + currentTr + "']").next("tr.detail-view").find(".imgs").append(html);
  540. }
  541. }
  542. }
  543. IntegralInfoDlg.downloadFile = function (id, type) {
  544. window.location.href = Feng.ctxPath + "/api/common/downloadFile?id=" + id + "&type=" + type;
  545. }
  546. //设置不可修改的字段
  547. IntegralInfoDlg.setNoChangeField = function () {
  548. var checkState = $("#checkState").val();
  549. var fields = $("#fields").val();
  550. var realState = $("#realState").val();
  551. if (realState == 4 || checkState == 2) {
  552. $("input,textarea").each(function () {
  553. $(this).attr("readonly", "readonly");
  554. });
  555. $("select,input[type=radio]").each(function () {
  556. $(this).attr("disabled", "disabled");
  557. });
  558. if (fields != null && fields != '') {
  559. var arr = fields.split(",");
  560. for (var key in arr) {
  561. if (arr[key] != "") {
  562. var name = $("#" + arr[key]).prop("tagName");
  563. if (name == 'select' || name == 'SELECT') {
  564. $("#" + arr[key]).removeAttr("disabled");
  565. } else if (name == "input" || name == 'textarea' || name == "INPUT" || name == 'TEXTAREA') {
  566. $("#" + arr[key]).removeAttr("readonly");
  567. } else {
  568. if (typeof name == "undefined") {
  569. $("input[name=" + arr[key] + "]").removeAttr("disabled").removeAttr("readonly");
  570. }
  571. }
  572. }
  573. }
  574. }
  575. }
  576. }
  577. $(function () {
  578. $('#integralInfoForm').bootstrapValidator({
  579. feedbackIcons: {
  580. valid: 'glyphicon glyphicon-ok',
  581. invalid: 'glyphicon glyphicon-remove',
  582. validating: 'glyphicon glyphicon-refresh'
  583. },
  584. container: 'tooltip',
  585. group: '.rowGroup',
  586. fields: IntegralInfoDlg.validateFields,
  587. live: 'enabled',
  588. message: '该字段不能为空'
  589. }).on('error.field.bv', function (e, data) {
  590. // Get the tooltip
  591. var $parent = data.element.parents('#integralInfoForm'),
  592. $icon = $parent.find('.form-control-feedback[data-bv-icon-for="' + data.field + '"]'),
  593. title = $icon.data('bs.tooltip').getTitle();
  594. $icon.tooltip('show').tooltip({
  595. html: true,
  596. placement: 'right',
  597. title: title,
  598. container: 'body'
  599. });
  600. });
  601. var id = $("#id").val();
  602. var checkState = $("#checkState").val();
  603. if (id != null && id != '') {
  604. //select初始化
  605. $("select").each(function () {
  606. $(this).val($(this).attr("value")).trigger("change");
  607. });
  608. Feng.getCheckLog("logTable", {"type": CONFIG.project_integral_apply, "mainId": id, "typeFileId": "", "active": 1})
  609. }
  610. $("#card_type").val($("#card_type").attr("value"));
  611. IntegralInfoDlg.validId();
  612. IntegralInfoDlg.setNoChangeField();
  613. //IntegralInfoDlg.changeAndLoadFile();
  614. });