enterprise_change_edit.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. var locked = false;
  2. var EpChangeEdit = {
  3. epChangeEditData: {},
  4. validateFields1: {
  5. newName: {validators: {notEmpty: {message: '企业名称不能为空'}, regexp: {regexp: /^([\u4E00-\u9FA5]|\(|\)){1,100}$/, message: "单位名称只允许中文"}}},
  6. newIdCard: {validators: {notEmpty: {message: '统一社会信用代码不能为空'}}},
  7. newEnterpriseTag: {validators: {notEmpty: {message: '企业标签不能为空'}}},
  8. newEnterpriseType: {validators: {notEmpty: {message: '企业类型不能为空'}}},
  9. newLegal: {validators: {notEmpty: {message: '法人代表不能为空'}, regexp: {regexp: /^[\u4e00-\u9fa5]{1,50}$/, message: "法人代表只允许中文"}}},
  10. newAddress: {validators: {notEmpty: {message: '企业地址不能为空'}}},
  11. newStreet: {validators: {notEmpty: {message: '所属街道不能为空'}}},
  12. newAgentName: {validators: {notEmpty: {message: '人才联络员不能为空'}}},
  13. newEphone: {
  14. validators: {
  15. notEmpty: {
  16. message: '企业电话不能为空'
  17. },
  18. regexp: {
  19. regexp: /(^(\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})))$/,
  20. message: "企业电话格式不正确"
  21. }
  22. }
  23. },
  24. newAgentPhone: {
  25. validators: {
  26. notEmpty: {
  27. message: '人才联络员电话不能为空'
  28. },
  29. regexp: {
  30. regexp: /(^(\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})))$/,
  31. message: "人才联络员电话格式不正确"
  32. }
  33. }
  34. },
  35. newAgentEmail: {
  36. validators: {
  37. notEmpty: {
  38. message: '电子邮箱不能为空'
  39. },
  40. emailAddress: {
  41. message: "电子邮箱格式不正确"
  42. }
  43. }
  44. },
  45. newBankCard: {
  46. validators: {
  47. notEmpty: {
  48. message: '企业银行账号不能为空'
  49. }
  50. }
  51. },
  52. newBank: {
  53. validators: {
  54. notEmpty: {
  55. message: '企业开户银行不能为空'
  56. }
  57. }, regexp: {regexp: /^([\u4E00-\u9FA5]|\(|\)|\(|\)){1,100}$/, message: "开户银行只允许中文"}
  58. },
  59. newBankNetwork: {
  60. validators: {notEmpty: {message: '开户银行网点不能为空'},
  61. regexp: {
  62. regexp: /^[\u4e00-\u9fa5]*银行[\u4e00-\u9fa5]*$/,
  63. message: "开户银行网点格式不正确"
  64. }}
  65. }
  66. },
  67. validateFields2: {
  68. newName: {validators: {notEmpty: {message: '单位名称不能为空'}, regexp: {regexp: /^[\u4e00-\u9fa5]{1,100}$/, message: "单位名称只允许中文"}}},
  69. newAddress: {validators: {notEmpty: {message: '单位地址不能为空'}}},
  70. newStreet: {validators: {notEmpty: {message: '所属街道不能为空'}}},
  71. newAgentName: {validators: {notEmpty: {message: '人才联络员不能为空'}}},
  72. newEphone: {
  73. validators: {
  74. notEmpty: {
  75. message: '单位电话不能为空'
  76. },
  77. regexp: {
  78. regexp: /(^(\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})))$/,
  79. message: "单位电话格式不正确"
  80. }
  81. }
  82. },
  83. newAgentPhone: {
  84. validators: {
  85. notEmpty: {
  86. message: '人才联络员电话不能为空'
  87. },
  88. regexp: {
  89. regexp: /(^(\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})))$/,
  90. message: "人才联络员电话格式不正确"
  91. }
  92. }
  93. },
  94. newAgentEmail: {
  95. validators: {
  96. notEmpty: {
  97. message: '电子邮箱不能为空'
  98. },
  99. emailAddress: {
  100. message: "电子邮箱格式不正确"
  101. }
  102. }
  103. }
  104. }
  105. };
  106. /**
  107. * 清除数据
  108. */
  109. EpChangeEdit.clearData = function () {
  110. this.epChangeEditData = {};
  111. }
  112. /**
  113. * 设置对话框中的数据
  114. *
  115. * @param key 数据的名称
  116. * @param val 数据的具体值
  117. */
  118. EpChangeEdit.set = function (key, val) {
  119. this.epChangeEditData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
  120. return this;
  121. }
  122. /**
  123. * 设置对话框中的数据
  124. *
  125. * @param key 数据的名称
  126. * @param val 数据的具体值
  127. */
  128. EpChangeEdit.get = function (key) {
  129. return $("#" + key).val();
  130. }
  131. /**
  132. * 关闭此对话框
  133. */
  134. EpChangeEdit.close = function () {
  135. parent.layer.close(window.parent.EnterpriseCenter.layerIndex);
  136. }
  137. /**
  138. * 收集数据
  139. */
  140. EpChangeEdit.collectData = function () {
  141. this
  142. .set('id')
  143. .set('type')
  144. .set('newAgencyType')
  145. .set('newName')
  146. .set('newIdCard')
  147. .set('newEnterpriseTag')
  148. .set('newEnterpriseType')
  149. .set('newLegal')
  150. .set('newStreet')
  151. .set('newAddress')
  152. .set('newEphone')
  153. .set('newAgentName')
  154. .set('newAgentPhone')
  155. .set('newAgentEmail')
  156. .set('newIndustryFieldNew')
  157. .set('newIndustryFieldOld')
  158. .set('newBankCard')
  159. .set('newBank')
  160. .set('newBankNetwork')
  161. .set('enterprise_id');
  162. }
  163. /**
  164. * 验证数据
  165. */
  166. EpChangeEdit.validate = function () {
  167. $('#ecr_form').data("bootstrapValidator").resetForm();
  168. $('#ecr_form').bootstrapValidator('validate');
  169. return $("#ecr_form").data('bootstrapValidator').isValid();
  170. }
  171. EpChangeEdit.initFileTable = function () {
  172. $("#fileTable").bootstrapTable({
  173. url: Feng.ctxPath + "/common/api/listCurrencyFileType",
  174. method: 'POST',
  175. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  176. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  177. showRefresh: false, // 是否显示刷新按钮
  178. clickToSelect: true, // 是否启用点击选中行
  179. singleSelect: true, // 设置True 将禁止多选
  180. striped: true, // 是否显示行间隔色
  181. escape: true,
  182. pagination: false, // 设置为 true 会在表格底部显示分页条
  183. paginationHAlign: "left",
  184. paginationDetailHAlign: "right",
  185. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  186. showColumns: false,
  187. detailView: true, //是否显示父子表
  188. pageList: [10, 30, 50],
  189. queryParams: function (params) {
  190. return $.extend({"type": "enterpriseChange"}, params)
  191. },
  192. rowStyle: function (row, index) {
  193. return {classes: "info"};
  194. },
  195. columns: EpChangeEdit.initFileTypeColumn(),
  196. onPostBody: function () {
  197. $("td.uitd_showTip").bind("mouseover", function () {
  198. var htm = $(this).html();
  199. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  200. });
  201. },
  202. onLoadSuccess: function (data) {
  203. $("#fileTable").bootstrapTable('expandAllRows');
  204. },
  205. onExpandRow: function (index, row, $detail) {
  206. var ajax = new $ax(Feng.ctxPath + "/common/api/listTalentCommonFile", function (data) {
  207. if (data == null || data.length == 0) {
  208. return;
  209. }
  210. var checkState = $("#checkState").length > 0 ? $("#checkState").val() : 1;
  211. var files = "";
  212. if (checkState != 1) {
  213. files = $("#files").val().split(",");
  214. }
  215. 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><li style="width: 10%;font-weight: bold;padding-top: 5px;">操作</li>';
  216. for (var key in data) {
  217. var sn = data[key].url.lastIndexOf(".");
  218. var suffix = data[key].ext;//data[key].url.substring(sn+1,data[key].url.length);
  219. var imgStr = "";
  220. if (suffix == "pdf" || suffix == "PDF") {
  221. 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>";
  222. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS' || suffix == 'docx' || suffix == 'doc' || suffix == 'DOCX' || suffix == 'DOC') {
  223. 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>";
  224. } else {
  225. imgStr = '<img class=\"imgUrl\" src=\"' + data[key].url + '\" style=\"width:25px;height:25px;\">';
  226. }
  227. var btn = "<button type=\'button\' onclick=\"EpChangeEdit.checkFile('" + row.id + "','" + data[key].id + "')\" style=\'margin-right: 10px\' class=\"btn btn-xs btn-info\"><i class=\"fa fa-paste\"></i>修改</button>" +
  228. "<button type='button' onclick=\"EpChangeEdit.deleteFile('" + data[key].id + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-times\"></i>删除</button>";
  229. html = html + '<li style="display: none">' + data[key].id + '</li>\n' +
  230. '<li style="width: 80%;padding-top: 5px;">' + data[key].orignName + '</li>\n' +
  231. '<li style="width: 10%;">' + imgStr + '</li>\n' +
  232. '<li style="width: 10%;padding-top: 2px;">' + (checkState == 1 ? btn : (files.indexOf(data[key].typeId.toString()) > -1 ? btn : "")) + '</li>';
  233. }
  234. html = html + '</ul>';
  235. $detail.html(html);
  236. $(".imgs").viewer({
  237. // toolbar:false,
  238. fullscreen: false
  239. });
  240. }, function (data) {
  241. Feng.error("查询失败!" + data.responseJSON.message + "!");
  242. });
  243. var queryData = {};
  244. queryData["mainId"] = $("#id").val();
  245. queryData["typeId"] = row.id;
  246. ajax.set(queryData);
  247. ajax.start();
  248. }
  249. });
  250. }
  251. EpChangeEdit.initFileTypeColumn = function () {
  252. return [
  253. {field: 'selectItem', checkbox: false, visible: false},
  254. {title: '名称', field: 'name', visible: true, align: 'center', valign: 'middle', width: "30%", 'class': 'uitd_showTip',
  255. formatter: function (value, row, index) {
  256. if (row.must == 1) {
  257. return '<i class="fa fa-paste"></i><span style="font-weight:bold;color:red;font-size:14px;font-family:宋体"> * </span> ' + value;
  258. }
  259. if (row.must == 2) {
  260. return '<i class="fa fa-paste"></i>' + value;
  261. }
  262. }
  263. },
  264. {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle', width: "50%", 'class': 'uitd_showTip',
  265. formatter: function (value, row, index) {
  266. return '<span style="color: red">' + value + '</span>';
  267. }
  268. },
  269. {title: '模板', field: 'templateUrl', visible: true, align: 'center', valign: 'middle', width: "10%",
  270. formatter: function (value, row, index) {
  271. if (value == null || value == '' || value == 'null') {
  272. return '无';
  273. }
  274. return "<button type='button' onclick=\"Feng.downloadFile('" + row.id + "',3)\" style='margin-right: 10px' class=\"btn btn-xs btn-primary\">" +
  275. "<i class=\"fa fa-download\"></i>下载" +
  276. "</button>";
  277. }
  278. },
  279. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "10%",
  280. formatter: function (value, row, index) {
  281. var checkState = $("#checkState").length > 0 ? $("#checkState").val() : 1;
  282. if (checkState == 1) {
  283. return "<button type='button' onclick=\"EpChangeEdit.checkFile('" + value + "','" + null + "')\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
  284. "<i class=\"fa fa-upload\"></i>上传" +
  285. "</button>";
  286. } else {
  287. var files = $("#files").val().split(",");
  288. if (files.indexOf(value.toString()) != -1) {
  289. return "<button type='button' onclick=\"EpChangeEdit.checkFile('" + value + "','" + null + "')\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
  290. "<i class=\"fa fa-upload\"></i>上传" +
  291. "</button>";
  292. } else {
  293. return "";
  294. }
  295. }
  296. }
  297. }
  298. ]
  299. }
  300. //选择附件并显示附件名
  301. EpChangeEdit.checkFile = function (fileTypeId, fileId) {
  302. var checkState = $("#checkState").val();
  303. if (checkState == 2) {
  304. Feng.error("正在审核中,无法修改");
  305. return;
  306. }
  307. if (checkState == 4) {
  308. Feng.error("审核通过,无法修改");
  309. return;
  310. }
  311. $("#upload_file").unbind("change");
  312. $("#upload_file").change(function () {
  313. if (!Feng.chkFileInvalid(this.files[0], 5, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "只允许上传PDF或图片"))
  314. return;
  315. EpChangeEdit.upload(fileTypeId, fileId);
  316. });
  317. $('#upload_file').val("");
  318. $('#upload_file').click()
  319. }
  320. //上传附件
  321. EpChangeEdit.upload = function (fileTypeId, fileId) {
  322. if (fileId != null && fileId != 'null') {
  323. $("#fileId").val(fileId)
  324. } else {
  325. $("#fileId").val("");
  326. }
  327. $("#mainId").val($("#id").val());
  328. $("#typeId").val(fileTypeId);
  329. var index = layer.load(0, {shade: false, time: 0});
  330. $("#index").val(index);
  331. $("#uploadForm").submit();
  332. }
  333. //删除附件
  334. EpChangeEdit.deleteFile = function (id) {
  335. var checkState = $("#checkState").val();
  336. if (checkState == 2) {
  337. Feng.error("正在审核中,无法修改");
  338. return;
  339. }
  340. if (checkState == 4) {
  341. Feng.error("审核通过,无法删除");
  342. return;
  343. }
  344. var operation = function () {
  345. var ajax = new $ax("/common/api/deleteTalentCommonFile", function (data) {
  346. if (data.code = 200) {
  347. Feng.success(data.msg);
  348. $("#fileTable").bootstrapTable("refresh", {});
  349. } else {
  350. Feng.error(data.msg);
  351. }
  352. }, function (data) {
  353. Feng.error("删除失败!" + data.responseJSON.message + "!");
  354. });
  355. ajax.set("id", id);
  356. ajax.start();
  357. }
  358. Feng.confirm("删除后无法恢复,确认删除吗?", operation);
  359. }
  360. EpChangeEdit.addSubmit = function () {
  361. this.clearData();
  362. this.collectData();
  363. if (!this.validate()) {
  364. return;
  365. }
  366. var checkState = $("#checkState").val();
  367. if (checkState == 2 || checkState == 5) {
  368. Feng.info("正在审核中,无法修改")
  369. return;
  370. }
  371. if (checkState == 4) {
  372. Feng.info("已审核通过,无法修改")
  373. return;
  374. }
  375. // $(".layui-layer-btn0",parent.document).css("pointer-events","none");
  376. if (locked) {
  377. Feng.info("保存进行中,请耐心等候")
  378. return;
  379. }
  380. locked = true;
  381. layer.load(0, {shade: false, time: 0});
  382. /*var ajax = new $ax(Feng.ctxPath + "/enterprise/api/upsert", function (data) {
  383. if (data.code == "200") {
  384. Feng.success(data.msg);
  385. $("#fileLi").removeAttr("style");
  386. $("#id").val(data.obj.id);
  387. $("#checkState").val(data.obj.checkState);
  388. window.parent.EnterpriseCenter.table.refresh();
  389. } else {
  390. Feng.info(data.msg);
  391. }
  392. // $(".layui-layer-btn0",parent.document).css("pointer-events","block");
  393. locked = false;
  394. }, function (data) {
  395. Feng.error("添加失败!" + data.responseJSON.msg + "!");
  396. locked = false;
  397. });
  398. ajax.set(this.epChangeEditData);
  399. ajax.start();*/
  400. $("#ecr_form :input").removeAttr("disabled");
  401. $("#ecr_form").attr("action", "/enterprise/api/upsert");
  402. $("#ecr_form")[0].submit();
  403. };
  404. /**
  405. * 提交审核
  406. */
  407. EpChangeEdit.submitToCheck = function () {
  408. if (locked) {
  409. Feng.info("保存进行中,请耐心等候")
  410. return;
  411. }
  412. var id = $("#id").val();
  413. if (id == null || id == "") {
  414. Feng.info("请先填写基础信息并上传附件");
  415. return;
  416. }
  417. var checkState = $("#checkState").val();
  418. if (checkState == 2 || checkState == 5) {
  419. Feng.error("正在审核中,无法修改");
  420. return;
  421. }
  422. if (checkState == 4) {
  423. Feng.error("审核通过,无法修改");
  424. return;
  425. }
  426. $(".layui-layer-btn1", parent.document).css("pointer-events", "none");
  427. var operation = function () {
  428. var ajax = new $ax(Feng.ctxPath + "/enterprise/api/submitToCheck", function (data) {
  429. if (data.code == 200) {
  430. Feng.success(data.msg);
  431. window.parent.EnterpriseCenter.table.refresh();
  432. EpChangeEdit.close();
  433. } else {
  434. Feng.error(data.msg);
  435. }
  436. $(".layui-layer-btn1", parent.document).css("pointer-events", "block");
  437. }, function (data) {
  438. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  439. $(".layui-layer-btn1", parent.document).css("pointer-events", "block");
  440. });
  441. ajax.set("id", id);
  442. ajax.start();
  443. }
  444. Feng.confirm("请确认基础信息已核对无误,相应附件已上传,一旦提交,无法修改", operation);
  445. }
  446. EpChangeEdit.setFieldDisabled = function () {
  447. var checkState = $("#checkState").length > 0 ? $("#checkState").val() : 1;
  448. if (checkState != 1) {
  449. //注释变更驳回$("#ecr_form :input").prop("disabled", true);
  450. //注释变更驳回$("#ecr_form :button").css("display", "none");
  451. var fields = $("#fields").val().split(",");
  452. for (var i in fields) {
  453. $("#" + fields[i]).removeAttr("disabled");
  454. }
  455. var files = $("#files").val().split(",");
  456. for (var i in files) {
  457. switch (files[i]) {
  458. case "newImgurl":
  459. $("#imgurl").removeAttr("disabled");
  460. $("#imgurl").parent().find("button").removeAttr("disabled").css("display", "block");
  461. break;
  462. case "newBankImg":
  463. $("#bankImg").removeAttr("disabled");
  464. $("#bankImg").parent().find("button").removeAttr("disabled").css("display", "block");
  465. break;
  466. case "newDomainImg":
  467. $("#domainImg").removeAttr("disabled");
  468. $("#domainImg").parent().find("button").removeAttr("disabled").css("display", "block");
  469. break;
  470. case "newTypeImg":
  471. $("#typeImg").removeAttr("disabled");
  472. $("#typeImg").parent().find("button").removeAttr("disabled").css("display", "block");
  473. break;
  474. case "newBeian":
  475. $("#beian").removeAttr("disabled");
  476. $("#beian").parent().find("button").removeAttr("disabled").css("display", "block");
  477. break;
  478. }
  479. }
  480. }
  481. }
  482. EpChangeEdit.callBack = function (data) {
  483. layer.closeAll();
  484. EpChangeEdit.setFieldDisabled();
  485. locked = false;
  486. Feng.info(data.msg);
  487. if (data.code == 200) {
  488. $("#id").val(data.id);
  489. $("input[type=file]").val("");
  490. window.parent.EnterpriseCenter.table.refresh();
  491. }
  492. };
  493. EpChangeEdit.downloadFile = function (id) {
  494. window.location.href = Feng.ctxPath + '/enterprisechangeRecord/downloadFile?id=' + id;
  495. };
  496. EpChangeEdit.industryChange = function () {
  497. var industryNew = $("#newIndustryFieldNew").val();
  498. var arr = [{"name": "newIndustryFieldOld", "code": industryNew + "_field"}];
  499. Feng.findChildDictBatch(JSON.stringify(arr));
  500. }
  501. EpChangeEdit.changeEnterpriseType = function () {
  502. var enterpriseType = $("#newEnterpriseType").val();
  503. switch (enterpriseType) {
  504. case "guishang":
  505. case "gaoxinjishu":
  506. case "zhuanjingtexin":
  507. $("td.typeUploader").css("display", "table-cell");
  508. break;
  509. default:
  510. $("td.typeUploader").css("display", "none");
  511. break;
  512. }
  513. };
  514. $("#imgurl,#bankImg,#beian,#domainImg,#typeImg").change(function (e) {
  515. var that = this;
  516. if (!Feng.chkFileInvalid(that.files[0], 5, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "只允许上传PDF或图片")) {
  517. return;
  518. }
  519. var file = that.files[0];
  520. var imgSrc;
  521. var reader = new FileReader();
  522. reader.readAsDataURL(file);
  523. reader.onload = function () {
  524. if (Feng.isImg(file.type)) {
  525. imgSrc = this.result;
  526. $(that).prev("img").attr("src", imgSrc);
  527. } else {
  528. $(that).prev("img").attr("src", Feng.ctxPath + "/static/img/Pdf.png");
  529. }
  530. };
  531. });
  532. EpChangeEdit.agencyTypeChange = function () {
  533. var agencyType = $("#newAgencyType").val();
  534. switch (agencyType) {
  535. case "1":
  536. $("#typeGroup").attr("style", "display:block");
  537. $(".agencyType1").attr("style", "");
  538. $(".agencyType2").attr("style", "");
  539. break;
  540. case "2":
  541. $("#typeGroup").attr("style", "display:block");
  542. $(".agencyType1").attr("style", "display:none");
  543. $(".agencyType2").attr("style", "");
  544. $("#newIndustryFieldNew").val("");
  545. $("#newIndustryFieldOld").val("");
  546. break;
  547. default:
  548. $("#typeGroup").attr("style", "display:none");
  549. break;
  550. }
  551. }
  552. $(function () {
  553. EpChangeEdit.setFieldDisabled();
  554. var special = parseInt($("#special").val());
  555. $('#ecr_form').bootstrapValidator({
  556. feedbackIcons: {
  557. valid: 'glyphicon glyphicon-ok',
  558. invalid: 'glyphicon glyphicon-remove',
  559. validating: 'glyphicon glyphicon-refresh'
  560. },
  561. group: '.rowGroup',
  562. fields: special == 1 ? EpChangeEdit.validateFields2 : EpChangeEdit.validateFields1,
  563. live: 'enabled',
  564. message: '该字段不能为空'
  565. });
  566. //Feng.initValidator("ecr_form", EpChangeEdit.validateFields);
  567. var industryNew = $("#newIndustryFieldNew").attr("value");
  568. var arr = [
  569. {"name": "newStreet", "code": "street"},
  570. {"name": "newEnterpriseTag", "code": "enterprise_tag"},
  571. {"name": "newOrganizationTag", "code": "organization_tag"},
  572. {"name": "newInstitutionTag", "code": "institution_tag"},
  573. {"name": "newEnterpriseType", "code": "enterprise_type"},
  574. {"name": "newIndustryFieldNew", "code": "industry_field"},
  575. {"name": "newIndustryFieldOld", "code": industryNew + "_field"},
  576. {"name": "newAgencyType", "code": "agency_type"}];
  577. Feng.findChildDictBatch(JSON.stringify(arr));
  578. $("select").each(function () {
  579. $(this).val($(this).attr("value"));
  580. })
  581. if ($("#type").val() == 1) {
  582. $("#newEnterpriseTag,#newIndustryFieldNew,#newIndustryFieldOld,#newEnterpriseType").parent().parent().attr("style", "display:cell");
  583. $("#newEnterpriseTag").val($("#newEnterpriseTag").attr("value"));
  584. $("#newIndustryFieldNew").val($("#newIndustryFieldNew").attr("value"));
  585. $("#newIndustryFieldOld").val($("#newIndustryFieldOld").attr("value"));
  586. } else {
  587. $("#newEnterpriseTag,#newIndustryFieldNew,#newIndustryFieldOld,#newEnterpriseType").parent().parent().attr("style", "display:none");
  588. $("#newEnterpriseTag").val("");
  589. $("#newIndustryFieldNew").val("");
  590. }
  591. var id = $("#id").val();
  592. if (id != null && id != '') {
  593. $("#fileLi").removeAttr("style");
  594. } else {
  595. $("#fileLi").attr("style", "pointer-events: none");
  596. }
  597. });