shenpi.js 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030
  1. 'use strict';
  2. /**
  3. *
  4. *
  5. * @author Ellisran
  6. * @date 2020/10/09
  7. * @version
  8. */
  9. const tenderTree = [];
  10. let parentId = 0;
  11. // 查询方法
  12. function findNode (key, value, arr) {
  13. for (const a of arr) {
  14. if (a[key] && a[key] === value) {
  15. return a;
  16. }
  17. }
  18. }
  19. // 初始化TenderTree数据
  20. function initTenderTree () {
  21. const levelCategory = category.filter(function (c) {
  22. return c.level && c.level > 0;
  23. });
  24. function findCategoryNode(cid, value, array) {
  25. for (const a of array) {
  26. if (a.cid === cid && a.vid === value) {
  27. return a;
  28. }
  29. }
  30. }
  31. function getCategoryNode(category, value, parent, i = null) {
  32. const array = parent ? parent.children : tenderTree;
  33. let cate = findCategoryNode(category.id, value, array);
  34. if (!cate) {
  35. const cateValue = findNode('id', value, category.value);
  36. if (!cateValue) return null;
  37. cate = {
  38. cid: category.id,
  39. vid: value,
  40. name: cateValue.value,
  41. children: [],
  42. level: i ? i : category.level,
  43. sort_id: ++parentId,
  44. sort: cateValue.sort,
  45. };
  46. array.push(cate);
  47. }
  48. return cate;
  49. }
  50. function loadTenderCategory (tender) {
  51. let tenderCategory = null;
  52. for (const [index,lc] of levelCategory.entries()) {
  53. const tenderCate = findNode('cid', lc.id, tender.category);
  54. if (tenderCate) {
  55. tenderCategory = getCategoryNode(lc, tenderCate.value, tenderCategory);
  56. } else {
  57. if (index === 0 && tender.category) {
  58. for (const [i,c] of tender.category.entries()) {
  59. const cate = findNode('id', c.cid, category);
  60. tenderCategory = getCategoryNode(cate, c.value, tenderCategory, i+1);
  61. }
  62. }
  63. return tenderCategory;
  64. }
  65. }
  66. return tenderCategory;
  67. }
  68. function calculateTender(tender) {
  69. if (tender.lastStage) {
  70. tender.gather_tp = ZhCalc.add(tender.lastStage.contract_tp, tender.lastStage.qc_tp);
  71. tender.end_contract_tp = ZhCalc.add(tender.lastStage.pre_contract_tp, tender.lastStage.contract_tp);
  72. tender.end_qc_tp = ZhCalc.add(tender.lastStage.pre_qc_tp, tender.lastStage.qc_tp);
  73. tender.end_gather_tp = ZhCalc.add(tender.end_contract_tp, tender.end_qc_tp);
  74. tender.pre_gather_tp = ZhCalc.add(tender.lastStage.pre_contract_tp, tender.lastStage.pre_qc_tp);
  75. tender.yf_tp = ZhCalc.add(tender.lastStage.yf_tp);
  76. tender.end_yf_tp = ZhCalc.add(tender.lastStage.pre_yf_tp, tender.yf_tp);
  77. }
  78. }
  79. tenderTree.splice(0, tenderTree.length);
  80. for (const t of tenders) {
  81. calculateTender(t);
  82. t.valid = true;
  83. delete t.level;
  84. if (t.category && levelCategory.length > 0) {
  85. const parent = loadTenderCategory(t);
  86. if (parent) {
  87. t.level = parent.level + 1;
  88. parent.children.push(t);
  89. } else {
  90. tenderTree.push(t);
  91. }
  92. } else {
  93. tenderTree.push(t);
  94. }
  95. }
  96. sortTenderTree();
  97. }
  98. function recursiveGetTenderNodeHtml (node, arr, pid, this_code, this_status, aidList = []) {
  99. const html = [];
  100. html.push('<tr pid="' + pid + '">');
  101. // 名称
  102. html.push('<td class="in-' + node.level + '">');
  103. if (node.cid) {
  104. html.push('<i class="fa fa-folder-o"></i> ', node.name);
  105. } else {
  106. html.push('<span class="text-muted mr-2">');
  107. html.push(arr.indexOf(node) === arr.length - 1 ? '└' : '├');
  108. html.push('</span>');
  109. //html.push('<a href="/tender/' + node.id + '">', node[c.field], '</a>');
  110. html.push('<a href="javascript: void(0)" id="' + node.id + '">', node.name, '</a>');
  111. }
  112. html.push('</td>');
  113. // 创建人
  114. // html.push('<td>', sp_status_list[node.shenpiInfo[shenpi_type]].name, '</td>');
  115. html.push('<td>');
  116. if (!node.cid) {
  117. let auditList = [];
  118. let tender_status = 1;
  119. if(cur_tenderid === node.id) {
  120. html.push(sp_status_list[this_status].name);
  121. auditList = aidList;
  122. tender_status = this_status;
  123. } else {
  124. console.log(node);
  125. html.push(sp_status_list[node.shenpiInfo[this_code]].name);
  126. auditList = node.shenpiauditList[this_code];
  127. tender_status = node.shenpiInfo[this_code];
  128. }
  129. if(tender_status === sp_status.gdspl || tender_status === sp_status.gdzs) {
  130. const nameList = [];
  131. if(auditList) {
  132. for (const uid of auditList) {
  133. const user = _.find(accountList, { id: uid });
  134. nameList.push(user.name);
  135. }
  136. }
  137. html.push('<i class="fa fa-question-circle text-primary" data-container="body" data-toggle="tooltip" data-placement="bottom" ' +
  138. 'data-original-title="'+ (nameList.length > 0 ? nameList.join('-') : '') +'"></i>');
  139. }
  140. }
  141. html.push('</td>');
  142. html.push('<td>');
  143. if (!node.cid) {
  144. html.push('<input data-tid="'+ node.id +'" type="checkbox"'+ (cur_tenderid === node.id ? ' checked disabled' : '') +'>');
  145. }
  146. html.push('</td>');
  147. html.push('</tr>');
  148. if (node.children) {
  149. for (const c of node.children) {
  150. html.push(recursiveGetTenderNodeHtml(c, node.children, node.sort_id, this_code, this_status, aidList));
  151. }
  152. }
  153. return html.join('');
  154. }
  155. // 根据TenderTree数据获取Html代码
  156. function getTenderTreeHtml (this_code, this_status, aidList = []) {
  157. if (tenderTree.length > 0) {
  158. const html = [];
  159. html.push('<table class="table table-hover table-bordered">');
  160. html.push('<thead>', '<tr>');
  161. html.push('<th>名称</th>');
  162. html.push('<th width="100">审批流程</th>');
  163. html.push('<th width="40">选择</th>');
  164. html.push('</tr>', '</thead>');
  165. parentId = 0;
  166. for (const t of tenderTree) {
  167. html.push(recursiveGetTenderNodeHtml(t, tenderTree, '', this_code, this_status, aidList));
  168. }
  169. html.push('</table>');
  170. return html.join('');
  171. } else {
  172. return EmptyTenderHtml.join('');
  173. }
  174. }
  175. function getShenpiHtml (this_code) {
  176. const html = [];
  177. html.push('<table class="table table-hover table-bordered">');
  178. html.push('<thead>', '<tr>');
  179. html.push('<th>名称</th>');
  180. html.push('<th width="100">审批流程</th>');
  181. html.push('<th width="40">选择</th>');
  182. html.push('</tr>', '</thead>');
  183. for (const sp of sp_lc) {
  184. html.push('<tr>');
  185. html.push('<td>', sp.name, '</td>');
  186. html.push('<td>');
  187. const this_status = parseInt($('.' + sp.code + '_div').children('.lc-show').siblings('.form-group').find('input:checked').val());
  188. html.push(sp_status_list[this_status].name);
  189. if(this_status !== sp_status.sqspr) {
  190. const nameList = [];
  191. const aid_num = $('.' + sp.code + '_div').children('.lc-show').children('ul').find('.remove-audit').length;
  192. const aidList = [];
  193. for (let i = 0; i < aid_num; i++) {
  194. const aid = parseInt($('.' + sp.code + '_div').children('.lc-show').children('ul').find('.remove-audit').eq(i).data('id'));
  195. aidList.push(aid);
  196. }
  197. if(aidList.length > 0) {
  198. for (const uid of aidList) {
  199. const user = _.find(accountList, { id: uid });
  200. nameList.push(user.name);
  201. }
  202. }
  203. html.push('<i class="fa fa-question-circle text-primary" data-container="body" data-toggle="tooltip" data-placement="bottom" ' +
  204. 'data-original-title="'+ (nameList.length > 0 ? nameList.join('-') : '') +'"></i>');
  205. }
  206. html.push('</td>');
  207. html.push('<td>', this_code !== sp.code ? '<input type="checkbox" data-code="'+ sp.code +'">' : '', '</td>');
  208. html.push('</tr>');
  209. }
  210. html.push('</table>');
  211. return html.join('');
  212. }
  213. $(document).ready(function () {
  214. let timer = null;
  215. let oldSearchVal = null;
  216. const needYB = ['ledger', 'revise', 'change'];
  217. $('body').on('input propertychange', '.gr-search', function(e) {
  218. oldSearchVal = e.target.value;
  219. timer && clearTimeout(timer);
  220. timer = setTimeout(() => {
  221. const newVal = $(this).val();
  222. const code = $(this).attr('data-code');
  223. let html = '';
  224. if (newVal && newVal === oldSearchVal) {
  225. accountList.filter(item => item && (item.id !== cur_uid || (item.id === cur_uid && needYB.indexOf(code) !== -1)) && (item.name.indexOf(newVal) !== -1 || (item.mobile && item.mobile.indexOf(newVal) !== -1))).forEach(item => {
  226. html += `<dd class="border-bottom p-2 mb-0 " data-id="${item.id}" >
  227. <p class="mb-0 d-flex"><span class="text-primary">${item.name}</span><span
  228. class="ml-auto">${item.mobile || ''}</span></p>
  229. <span class="text-muted">${item.role || ''}</span>
  230. </dd>`
  231. });
  232. $('#' + code + '_dropdownMenu .book-list').empty();
  233. $('#' + code + '_dropdownMenu .book-list').append(html);
  234. } else {
  235. if (!$('#' + code + '_dropdownMenu .acc-btn').length) {
  236. accountGroup.forEach((group, idx) => {
  237. if (!group) return;
  238. html += `<dt><a href="javascript: void(0);" class="acc-btn" data-groupid="${idx}" data-type="hide"><i class="fa fa-plus-square"></i>
  239. </a> ${group.groupName}</dt>
  240. <div class="dd-content" data-toggleid="${idx}">`;
  241. group.groupList.forEach(item => {
  242. if ((item.id !== cur_uid || (item.id === cur_uid && needYB.indexOf(code) !== -1))) {
  243. html += `<dd class="border-bottom p-2 mb-0 " data-id="${item.id}" >
  244. <p class="mb-0 d-flex"><span class="text-primary">${item.name}</span><span
  245. class="ml-auto">${item.mobile || ''}</span></p>
  246. <span class="text-muted">${item.role || ''}</span>
  247. </dd>`;
  248. }
  249. });
  250. html += '</div>';
  251. });
  252. $('#' + code + '_dropdownMenu .book-list').empty();
  253. $('#' + code + '_dropdownMenu .book-list').append(html);
  254. }
  255. }
  256. }, 400);
  257. });
  258. // 添加审批流程按钮逻辑
  259. $('body').on('click', '.book-list dt', function () {
  260. const idx = $(this).find('.acc-btn').attr('data-groupid');
  261. const type = $(this).find('.acc-btn').attr('data-type');
  262. if (type === 'hide') {
  263. $(this).parent().find(`div[data-toggleid="${idx}"]`).show(() => {
  264. $(this).children().find('i').removeClass('fa-plus-square').addClass('fa-minus-square-o');
  265. $(this).find('.acc-btn').attr('data-type', 'show');
  266. })
  267. } else {
  268. $(this).parent().find(`div[data-toggleid="${idx}"]`).hide(() => {
  269. $(this).children().find('i').removeClass('fa-minus-square-o').addClass('fa-plus-square');
  270. $(this).find('.acc-btn').attr('data-type', 'hide');
  271. })
  272. }
  273. return false;
  274. });
  275. // 更改审批流程状态
  276. $('.form-check input').on('change', function () {
  277. // 获取所有审批的checked值并更新
  278. const this_status = parseInt($(this).val());
  279. const this_code = $(this).data('code');
  280. const spt = sp_status_list[this_status];
  281. $(this).parents('.form-group').siblings('.alert-warning').text(spt.name + ':' + spt.msg);
  282. // 拼接post json
  283. const prop = {
  284. code: this_code,
  285. status: this_status
  286. };
  287. const _self = $(this);
  288. postData('/tender/' + cur_tenderid + '/shenpi/save', prop, function (data) {
  289. if (this_status === sp_status.sqspr) {
  290. _self.parents('.form-group').siblings('.lc-show').html('');
  291. } else if (this_status === sp_status.gdspl) {
  292. let addhtml = '<ul class="list-unstyled">\n';
  293. if (data.length !== 0) {
  294. for(const [i, audit] of data.entries()) {
  295. addhtml += makeAudit(audit, transFormToChinese(i+1));
  296. }
  297. addhtml += '<li class="pl-3"><a href="javascript:void(0);" class="add-audit"><i class="fa fa-plus"></i> 添加流程</a></li>';
  298. } else {
  299. addhtml += makeSelectAudit(this_code, '一');
  300. }
  301. addhtml += '</ul>\n';
  302. _self.parents('.form-group').siblings('.lc-show').html(addhtml);
  303. } else if (this_status === sp_status.gdzs) {
  304. let addhtml = '<ul class="list-unstyled">\n' +
  305. ' <li class="d-flex justify-content-start mb-3">\n' +
  306. ' <span class="col-auto">授权审批人</span>\n' +
  307. ' <span class="col-7">\n' +
  308. ' <span class="d-inline-block"></span>\n' +
  309. ' </span>\n' +
  310. ' </li>\n';
  311. addhtml += data ? makeAudit(data) : makeSelectAudit(this_code);
  312. addhtml += '</ul>\n';
  313. _self.parents('.form-group').siblings('.lc-show').html(addhtml);
  314. }
  315. if(this_code === 'stage') {
  316. if(this_status === sp_status.gdspl) {
  317. $('#stage_cooperation').show();
  318. } else {
  319. $('#stage_cooperation').hide();
  320. }
  321. }
  322. });
  323. });
  324. // 选中审批人
  325. $('body').on('click', 'dl dd', function () {
  326. const id = parseInt($(this).data('id'));
  327. if (id) {
  328. const user = _.find(accountList, function (item) {
  329. return item.id === id;
  330. });
  331. const this_status = parseInt($(this).parents('.lc-show').siblings('.form-group').find('input:checked').val());
  332. const this_code = $(this).parents('.lc-show').siblings('.form-group').find('input:checked').data('code');
  333. if (this_status === sp_status.gdspl) {
  334. // 判断是否已存在审批人
  335. const aid_num = $(this).parents('ul').find('.remove-audit').length;
  336. for (let i = 0; i < aid_num; i++) {
  337. const aid = parseInt($(this).parents('ul').find('.remove-audit').eq(i).data('id'));
  338. if (aid === id) {
  339. toastr.warning('该审核人已存在,请勿重复添加');
  340. return;
  341. }
  342. }
  343. }
  344. const prop = {
  345. status: this_status,
  346. code: sp_type[this_code],
  347. audit_id: id,
  348. type: 'add',
  349. };
  350. const _self = $(this);
  351. postData('/tender/' + cur_tenderid + '/shenpi/audit/save', prop, function (data) {
  352. if (this_status === sp_status.gdspl) {
  353. _self.parents('ul').append('<li class="pl-3"><a href="javascript:void(0);" class="add-audit"><i class="fa fa-plus"></i> 添加流程</a></li>');
  354. }
  355. _self.parents('.spr-span').html('<span class="d-inline-block"></span>\n' +
  356. '<span class="d-inline-block"><span class="badge badge-light">'+ user.name +' <a href="javascript:void(0);" class="remove-audit btn-sm text-danger px-1" title="移除" data-id="'+ user.id +'"><i class="fa fa-remove"></i></a></span> </span>');
  357. });
  358. }
  359. });
  360. // 移除审批人
  361. $('body').on('click', '.remove-audit', function () {
  362. const id = parseInt($(this).data('id'));
  363. const this_status = parseInt($(this).parents('.lc-show').siblings('.form-group').find('input:checked').val());
  364. const this_code = $(this).parents('.lc-show').siblings('.form-group').find('input:checked').data('code');
  365. const prop = {
  366. status: this_status,
  367. code: sp_type[this_code],
  368. audit_id: id,
  369. type: 'del',
  370. };
  371. const _self = $(this);
  372. postData('/tender/' + cur_tenderid + '/shenpi/audit/save', prop, function (data) {
  373. if (this_status === sp_status.gdspl) {
  374. const _selflc = _self.parents('.lc-show');
  375. _self.parents('li').remove();
  376. const aid_num = parseInt(_selflc.children('ul').find('li.d-flex').length);
  377. if (aid_num === 0) {
  378. let addhtml = '<ul class="list-unstyled">\n';
  379. addhtml += makeSelectAudit(this_code, '一');
  380. addhtml += '</ul>\n';
  381. _selflc.html(addhtml);
  382. } else {
  383. for (let i = 0; i < aid_num; i++) {
  384. _selflc.find('li.d-flex').eq(i).find('.col-auto').text(transFormToChinese(i+1) + '审');
  385. }
  386. }
  387. } else if (this_status === sp_status.gdzs) {
  388. let addhtml = '<ul class="list-unstyled">\n' +
  389. ' <li class="d-flex justify-content-start mb-3">\n' +
  390. ' <span class="col-auto">授权审批人</span>\n' +
  391. ' <span class="col-7">\n' +
  392. ' <span class="d-inline-block"></span>\n' +
  393. ' </span>\n' +
  394. ' </li>\n';
  395. addhtml += makeSelectAudit(this_code);
  396. addhtml += '</ul>\n';
  397. _self.parents('.lc-show').html(addhtml);
  398. }
  399. })
  400. });
  401. // 固定审批流-添加流程
  402. $('body').on('click', '.add-audit', function () {
  403. const num = $(this).parents('ul').children('li').length;
  404. const this_code = $(this).parents('.lc-show').siblings('.form-group').find('input:checked').data('code');
  405. const addhtml = makeSelectAudit(this_code, transFormToChinese(num));
  406. $(this).parents('ul').append(addhtml);
  407. $(this).parents('li').remove();
  408. });
  409. // 审批流程-审批人html 生成
  410. function makeAudit(audit, i = '终') {
  411. return '<li class="d-flex justify-content-start mb-3">\n' +
  412. ' <span class="col-auto">'+ i +'审</span>\n' +
  413. ' <span class="col-7 spr-span">\n' +
  414. ' <span class="d-inline-block"></span>\n' +
  415. ' <span class="d-inline-block"><span class="badge badge-light">'+ audit.name +' <a href="javascript:void(0);" class="remove-audit btn-sm text-danger px-1" title="移除" data-id="'+ audit.audit_id +'"><i class="fa fa-remove"></i></a></span> </span>\n' +
  416. ' </span>\n' +
  417. ' </li>';
  418. }
  419. // 审批流程-选择审批人html 生成
  420. function makeSelectAudit(code, i = '终') {
  421. let divhtml = '';
  422. accountGroup.forEach((group, idx) => {
  423. let didivhtml = '';
  424. if(group) {
  425. group.groupList.forEach(item => {
  426. didivhtml += (item.id !== cur_uid || (item.id === cur_uid && needYB.indexOf(code) !== -1)) ? '<dd class="border-bottom p-2 mb-0 " data-id="' + item.id + '" >\n' +
  427. '<p class="mb-0 d-flex"><span class="text-primary">' + item.name + '</span><span\n' +
  428. ' class="ml-auto">' + item.mobile + '</span></p>\n' +
  429. ' <span class="text-muted">' + item.role + '</span>\n' +
  430. ' </dd>\n' : '';
  431. });
  432. divhtml += '<dt><a href="javascript: void(0);" class="acc-btn" data-groupid="' + idx + '" data-type="hide"><i class="fa fa-plus-square"></i></a> ' + group.groupName + '</dt>\n' +
  433. ' <div class="dd-content" data-toggleid="' + idx + '">\n' + didivhtml +
  434. ' </div>\n';
  435. }
  436. });
  437. let html = '<li class="d-flex justify-content-start mb-3">\n' +
  438. ' <span class="col-auto">' + i + '审</span>\n' +
  439. ' <span class="col-7 spr-span">\n' +
  440. ' <span class="d-inline-block">\n' +
  441. ' <div class="dropdown text-right">\n' +
  442. ' <button class="btn btn-outline-primary btn-sm dropdown-toggle" type="button" id="' + code + '_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">\n' +
  443. ' 选择审批人\n' +
  444. ' </button>\n' +
  445. ' <div class="dropdown-menu dropdown-menu-right" id="' + code + '_dropdownMenu" aria-labelledby="' + code + '_dropdownMenuButton" style="width:220px">\n' +
  446. ' <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"\n' +
  447. ' placeholder="姓名/手机 检索" autocomplete="off" data-code="' + code + '"></div>\n' +
  448. ' <dl class="list-unstyled book-list">\n' + divhtml +
  449. ' </dl>\n' +
  450. ' </div>\n' +
  451. ' </div>\n' +
  452. ' </span>\n' +
  453. ' </span>\n' +
  454. ' </li>';
  455. return html;
  456. }
  457. initTenderTree();
  458. $('.set-otherTender').on('click', function () {
  459. const this_code = $(this).data('code');
  460. const this_status = parseInt($(this).siblings('.lc-show').siblings('.form-group').find('input:checked').val());
  461. const aid_num = $(this).siblings('.lc-show').children('ul').find('.remove-audit').length;
  462. const aidList = [];
  463. for (let i = 0; i < aid_num; i++) {
  464. const aid = parseInt($(this).siblings('.lc-show').children('ul').find('.remove-audit').eq(i).data('id'));
  465. aidList.push(aid);
  466. }
  467. const html = getTenderTreeHtml(this_code, this_status, aidList);
  468. $('#shenpi-name').text($(this).data('name'));
  469. $('#shenpi_code').val(this_code);
  470. $('#shenpi_status').val(this_status);
  471. $('#shenpi_auditors').val(aidList.join(','));
  472. $('#tender-list').html(html);
  473. setTimeout(function () { $("#tender-list [data-toggle='tooltip']").tooltip(); },800);
  474. });
  475. $('#save-other-tender').click(function () {
  476. $(this).attr('disabled', true);
  477. const num = $('#tender-list input:checked').length;
  478. if (num < 2) {
  479. toastr.warning('请选择需要设置审批同步的标段');
  480. return;
  481. }
  482. const data = {
  483. type: 'copy2ot',
  484. status: parseInt($('#shenpi_status').val()),
  485. code: $('#shenpi_code').val(),
  486. };
  487. if(data.status !== shenpi_status.gdspl) {
  488. data.aidList = $('#shenpi_auditors').val();
  489. }
  490. // 获取已选中的标段
  491. const tenderList = [];
  492. for (let i = 0; i < num; i++) {
  493. const tid = parseInt($('#tender-list input:checked').eq(i).data('tid'));
  494. if (tid !== cur_tenderid) {
  495. tenderList.push(tid);
  496. }
  497. }
  498. data.tidList = tenderList.join(',');
  499. postData('/tender/' + cur_tenderid + '/shenpi/audit/save', data, function () {
  500. toastr.success('设置成功');
  501. setTimeout(function () {
  502. window.location.reload();
  503. }, 1000)
  504. })
  505. });
  506. $('.set-otherShenpi').on('click', function () {
  507. const this_code = $(this).data('code');
  508. const this_status = parseInt($(this).siblings('.lc-show').siblings('.form-group').find('input:checked').val());
  509. const aid_num = $(this).siblings('.lc-show').children('ul').find('.remove-audit').length;
  510. const aidList = [];
  511. for (let i = 0; i < aid_num; i++) {
  512. const aid = parseInt($(this).siblings('.lc-show').children('ul').find('.remove-audit').eq(i).data('id'));
  513. aidList.push(aid);
  514. }
  515. const html = getShenpiHtml(this_code);
  516. $('#shenpi-name2').text($(this).data('name'));
  517. $('#shenpi_code2').val(this_code);
  518. $('#shenpi_status2').val(this_status);
  519. $('#shenpi_auditors2').val(aidList.join(','));
  520. $('#shenpi-list').html(html);
  521. setTimeout(function () { $("#shenpi-list [data-toggle='tooltip']").tooltip(); },800);
  522. });
  523. $('#save-other-shenpi').click(function () {
  524. $(this).attr('disabled', true);
  525. const num = $('#shenpi-list input:checked').length;
  526. if (num < 1) {
  527. toastr.warning('请选择需要设置审批同步的流程');
  528. return;
  529. }
  530. const data = {
  531. type: 'copy2os',
  532. status: parseInt($('#shenpi_status2').val()),
  533. code: $('#shenpi_code2').val(),
  534. };
  535. if(data.status !== shenpi_status.gdspl) {
  536. data.aidList = $('#shenpi_auditors2').val();
  537. }
  538. // 获取已选中的标段
  539. const shenpiList = [];
  540. for (let i = 0; i < num; i++) {
  541. const code = $('#shenpi-list input:checked').eq(i).data('code');
  542. shenpiList.push(code);
  543. }
  544. data.shenpiList = shenpiList.join(',');
  545. postData('/tender/' + cur_tenderid + '/shenpi/audit/save', data, function () {
  546. toastr.success('设置成功');
  547. setTimeout(function () {
  548. window.location.reload();
  549. }, 1000)
  550. })
  551. });
  552. const ledgerSpread = SpreadJsObj.createNewSpread($('#ledger-spread')[0]);
  553. const treeSetting = {
  554. id: 'ledger_id',
  555. pid: 'ledger_pid',
  556. order: 'order',
  557. level: 'level',
  558. rootId: -1,
  559. fullPath: 'full_path',
  560. };
  561. const ledgerTree = createNewPathTree('base', treeSetting);
  562. const ledgerSpreadSetting = {
  563. cols: [
  564. {title: '编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 165, formatter: '@', readOnly: true, cellType: 'tree'},
  565. {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 185, formatter: '@', readOnly: true},
  566. {title: '密码', colSpan: '1', rowSpan: '2', field: 'pwd', hAlign: 0, width: 100, formatter: '@', getValue:'getValue.pwd', readOnly: 'readOnly.pwd'},
  567. ],
  568. emptyRows: 0,
  569. headRows: 1,
  570. headRowHeight: [25, 25],
  571. defaultRowHeight: 21,
  572. headerFont: '12px 微软雅黑',
  573. font: '12px 微软雅黑',
  574. // readOnly: true,
  575. localCache: {
  576. key: 'ledger-cooperation',
  577. colWidth: true,
  578. }
  579. };
  580. const ledgerCol = {
  581. getValue: {
  582. pwd: function (data) {
  583. let txt = '';
  584. if (data.is_leaf) {
  585. if (data.pwd && data.pwd !== '' && data.pwd !== null) {
  586. txt = data.pwd;
  587. } else {
  588. txt = '请输入密码';
  589. }
  590. }
  591. return txt;
  592. }
  593. },
  594. readOnly: {
  595. pwd: function (data) {
  596. return !data.is_leaf;
  597. },
  598. },
  599. };
  600. const ledgerSpreadObj = {
  601. setFontColor: function(row = null) {
  602. if(row) {
  603. const value = ledgerSpread.getActiveSheet().getValue(row, 2);
  604. if (value === '请输入密码') {
  605. ledgerSpread.getActiveSheet().getCell(row, 2).foreColor('#007bff');
  606. } else {
  607. ledgerSpread.getActiveSheet().getCell(row, 2).foreColor('#000');
  608. }
  609. } else {
  610. const rowCount = ledgerSpread.getActiveSheet().getRowCount();
  611. for(let i = 0; i < rowCount; i++){
  612. const value = ledgerSpread.getActiveSheet().getValue(i, 2);
  613. if (value === '请输入密码') {
  614. ledgerSpread.getActiveSheet().getCell(i, 2).foreColor('#007bff');
  615. } else {
  616. ledgerSpread.getActiveSheet().getCell(i, 2).foreColor('#000');
  617. }
  618. }
  619. }
  620. },
  621. setAllRightPwd: function(uid) {
  622. const selects = [];
  623. for (const l of ledgerTree.datas) {
  624. const coo = _.find(ledger_cooperation_list, { 'ledger_id': l.ledger_id, 'user_id': parseInt(uid) });
  625. if (l.pwd && !coo) {
  626. delete l.pwd;
  627. selects.push(l);
  628. } else if(coo) {
  629. l.pwd = coo.pwd;
  630. selects.push(l);
  631. }
  632. }
  633. if(selects.length > 0) {
  634. const refreshNode = ledgerTree.loadPostData({update: selects});
  635. ledgerSpreadObj.refreshTree(ledgerSpread.getActiveSheet(), refreshNode);
  636. ledgerSpreadObj.setFontColor();
  637. }
  638. },
  639. refreshTree: function (sheet, data) {
  640. SpreadJsObj.massOperationSheet(sheet, function () {
  641. const tree = sheet.zh_tree;
  642. // 处理删除
  643. if (data.delete) {
  644. data.delete.sort(function (x, y) {
  645. return y.deleteIndex - x.deleteIndex;
  646. });
  647. for (const d of data.delete) {
  648. sheet.deleteRows(d.deleteIndex, 1);
  649. }
  650. }
  651. // 处理新增
  652. if (data.create) {
  653. const newNodes = data.create;
  654. if (newNodes) {
  655. newNodes.sort(function (a, b) {
  656. return a.index - b.index;
  657. });
  658. for (const node of newNodes) {
  659. sheet.addRows(node.index, 1);
  660. SpreadJsObj.reLoadRowData(sheet, tree.nodes.indexOf(node), 1);
  661. }
  662. }
  663. }
  664. // 处理更新
  665. if (data.update) {
  666. const rows = [];
  667. for (const u of data.update) {
  668. rows.push(tree.nodes.indexOf(u));
  669. }
  670. SpreadJsObj.reLoadRowsData(sheet, rows);
  671. }
  672. // 处理展开
  673. if (data.expand) {
  674. const expanded = [];
  675. for (const e of data.expand) {
  676. if (expanded.indexOf(e) === -1) {
  677. const posterity = tree.getPosterity(e);
  678. for (const p of posterity) {
  679. sheet.setRowVisible(tree.nodes.indexOf(p), p.visible);
  680. expanded.push(p);
  681. }
  682. }
  683. }
  684. }
  685. });
  686. },
  687. enterCell: function(e, info) {
  688. if (info.sheet.zh_setting && info.col === 2) {
  689. if (ledgerSpread.getActiveSheet().getValue(info.row, info.col) !== '') {
  690. const col = info.sheet.zh_setting.cols[info.col];
  691. info.sheet.setActiveCell(info.row, 2);
  692. info.sheet.startEdit(true);
  693. }
  694. }
  695. },
  696. editStarting: function (e, info) {
  697. if (info.sheet.zh_setting) {
  698. const select = SpreadJsObj.getSelectObject(info.sheet);
  699. const col = info.sheet.zh_setting.cols[info.col];
  700. ledgerSpread.getActiveSheet().getCell(info.row, 2).foreColor('#000');
  701. if(col.getValue(select) === '请输入密码') {
  702. ledgerSpread.getActiveSheet().setValue(info.row, 2, '');
  703. }
  704. }
  705. },
  706. editEnded: function (e, info) {
  707. if (info.sheet.zh_setting) {
  708. const select = SpreadJsObj.getSelectObject(info.sheet);
  709. const col = info.sheet.zh_setting.cols[info.col];
  710. const validText = trimInvalidChar(info.editingText);
  711. const user_id = parseInt($('#stage_audits').val());
  712. const orgValue = select[col.field];
  713. const reg = /^[0-9a-zA-Z]+$/;
  714. if(validText !== '' && !reg.test(validText)) {
  715. toastr.error('不能输入非数字和字母的字符');
  716. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  717. ledgerSpreadObj.setFontColor(info.row);
  718. return;
  719. }
  720. if((validText === '' && orgValue === undefined) || validText == orgValue) {
  721. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  722. ledgerSpreadObj.setFontColor(info.row);
  723. return;
  724. }
  725. const num = _.filter(ledger_cooperation_list, { pwd: validText, status: 1, user_id });
  726. if(num.length > 0) {
  727. toastr.error('同一个审批人密码不能相同');
  728. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  729. ledgerSpreadObj.setFontColor(info.row);
  730. return;
  731. }
  732. select.pwd = validText;
  733. const data = {
  734. type: 'pwd',
  735. ledger_id: select.ledger_id,
  736. user_id,
  737. pwd: validText,
  738. };
  739. postData('/tender/' + cur_tenderid + '/shenpi/audit/save', data, function (result) {
  740. const lcindex = _.findIndex(ledger_cooperation_list, { ledger_id: select.ledger_id, user_id });
  741. if(lcindex !== -1) {
  742. validText === '' ? ledger_cooperation_list.splice(lcindex, 1) : ledger_cooperation_list.splice(lcindex, 1, result);
  743. } else {
  744. ledger_cooperation_list.push(result);
  745. }
  746. $('#cooperation-num').text(ledger_cooperation_list.length);
  747. setLeftTable(ledgerTree.datas, ledger_cooperation_list, user_id, $('#stage_audits option:selected').text());
  748. const refreshNode = ledgerTree.loadPostData({update: select});
  749. ledgerSpreadObj.refreshTree(info.sheet, refreshNode);
  750. ledgerSpreadObj.setFontColor();
  751. });
  752. }
  753. },
  754. deletePress: function (sheet) {
  755. return;
  756. },
  757. clipboardPasted(e, info) {
  758. // 禁止复制粘贴
  759. SpreadJsObj.reLoadSheetHeader(ledgerSpread.getActiveSheet());
  760. SpreadJsObj.reLoadSheetData(ledgerSpread.getActiveSheet());
  761. return;
  762. }
  763. };
  764. sjsSettingObj.setFxTreeStyle(ledgerSpreadSetting, sjsSettingObj.FxTreeStyle.jz);
  765. if (thousandth) sjsSettingObj.setTpThousandthFormat(ledgerSpreadSetting);
  766. SpreadJsObj.initSpreadSettingEvents(ledgerSpreadSetting, ledgerCol);
  767. SpreadJsObj.initSheet(ledgerSpread.getActiveSheet(), ledgerSpreadSetting);
  768. SpreadJsObj.selChangedRefreshBackColor(ledgerSpread.getActiveSheet());
  769. ledgerSpread.bind(spreadNS.Events.EditStarting, ledgerSpreadObj.editStarting);
  770. ledgerSpread.bind(spreadNS.Events.EditEnded, ledgerSpreadObj.editEnded);
  771. SpreadJsObj.addDeleteBind(ledgerSpread, ledgerSpreadObj.deletePress);
  772. ledgerSpread.bind(spreadNS.Events.ClipboardPasted, ledgerSpreadObj.clipboardPasted);
  773. ledgerSpread.bind(spreadNS.Events.EnterCell, ledgerSpreadObj.enterCell);
  774. let ledger_data, ledger_cooperation_list = [];
  775. // 多人协同
  776. $('#cooperation').on('shown.bs.modal', function () {
  777. // 执行一些动作...
  778. // 更新新的多人协同表格信息
  779. const newUidList = [];
  780. $('.stage_div ul li').each(function (k, v) {
  781. const uid = $(v).find('a').data('id');
  782. if(uid) newUidList.push(uid);
  783. });
  784. const oldUidList = [];
  785. $('#stage_audits option').each(function (k, v) {
  786. const uid = parseInt($(v).val());
  787. if(k !== 0) oldUidList.push(uid);
  788. });
  789. if (!_.isEqual(oldUidList, newUidList)) {
  790. const yb = _.find(accountList, { 'id': cur_uid });
  791. let newhtml = '<option value="' + yb.id + '">' + yb.name + '(原报)</option>';
  792. if(newUidList.length > 0) {
  793. for (const [i,id] of newUidList.entries()) {
  794. const audit = _.find(accountList, { 'id': id });
  795. newhtml += '<option value="' + audit.id + '">' + audit.name + '(' + transFormToChinese(i+1) + '审)</option>';
  796. }
  797. }
  798. $('#stage_audits').html(newhtml);
  799. if(ledger_data) {
  800. setLeftTable(ledgerTree.datas, ledger_cooperation_list, cur_uid, yb.name + '(原报)');
  801. ledgerSpreadObj.setAllRightPwd(cur_uid);
  802. }
  803. }
  804. if(!ledger_data) {
  805. postData('/tender/' + cur_tenderid + '/shenpi/ledger/load', {}, function (data) {
  806. ledger_data = true;
  807. const ledgerList = setRightData(data.ledgerList, data.ledgerCooperationList);
  808. ledgerTree.loadDatas(ledgerList);
  809. ledger_cooperation_list = data.ledgerCooperationList;
  810. const yb = _.find(accountList, { 'id': cur_uid });
  811. setLeftTable(ledgerList, ledger_cooperation_list, cur_uid, yb.name + '(原报)');
  812. // treeCalc.calculateAll(ledgerTree);
  813. console.log(ledgerTree);
  814. SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), SpreadJsObj.DataType.Tree, ledgerTree);
  815. ledgerSpreadObj.setFontColor();
  816. }, null, true);
  817. }
  818. ledgerSpread.refresh();
  819. });
  820. $('#stage_audits').change(function () {
  821. const uid = $(this).val();
  822. const title = $("#stage_audits option:selected").text();
  823. setLeftTable(ledgerTree.datas, ledger_cooperation_list, uid, title);
  824. ledgerSpreadObj.setAllRightPwd(uid);
  825. });
  826. $('body').on('click', '.del-pwd', function () {
  827. const ledger_id = parseInt($(this).data('lid'));
  828. const user_id = parseInt($(this).data('uid'));
  829. const data = {
  830. type: 'pwd',
  831. user_id,
  832. ledger_id,
  833. pwd: '',
  834. };
  835. postData('/tender/' + cur_tenderid + '/shenpi/audit/save', data, function (result) {
  836. const lcindex = _.findIndex(ledger_cooperation_list, { ledger_id, user_id });
  837. ledger_cooperation_list.splice(lcindex, 1);
  838. setLeftTable(ledgerTree.datas, ledger_cooperation_list, user_id, $('#stage_audits option:selected').text());
  839. const select = _.find(ledgerTree.datas, { ledger_id });
  840. delete select.pwd;
  841. const refreshNode = ledgerTree.loadPostData({update: select});
  842. ledgerSpreadObj.refreshTree(ledgerSpread.getActiveSheet(), refreshNode);
  843. ledgerSpreadObj.setFontColor();
  844. $('#cooperation-num').text(ledger_cooperation_list.length);
  845. });
  846. });
  847. $('body').on('click', '.edit-pwd', function () {
  848. const pwd = $(this).data('pwd');
  849. const html = `<div class="input-group input-group-sm">
  850. <input type="text" class="form-control" value="${pwd}" placeholder="输入新密码" aria-describedby="button-${$(this).data('lid')}" style="width:50px">
  851. <div class="input-group-append" id="button-${$(this).data('lid')}">
  852. <button class="btn btn-outline-primary confirm-btn" data-pwd="${pwd}" data-lid="${$(this).data('lid')}" data-uid="${$(this).data('uid')}" type="button">确认</button>
  853. <button class="btn btn-outline-secondary cancel-btn" data-pwd="${pwd}" data-lid="${$(this).data('lid')}" data-uid="${$(this).data('uid')}" type="button">取消</button>
  854. </div>
  855. </div>`;
  856. $(this).parents('td').html(html);
  857. });
  858. $('body').on('click', '.cancel-btn', function () {
  859. const html = `<p class="mb-0">${$(this).data('pwd')}</p><a href="javascript:void(0);" data-lid="${$(this).data('lid')}" data-uid="${$(this).data('uid')}" data-pwd="${$(this).data('pwd')}" class="edit-pwd">修改</a> <a href="javascript:void(0)" data-lid="${$(this).data('lid')}" data-uid="${$(this).data('uid')}" class="del-pwd text-danger">移除</a>`;
  860. $(this).parents('td').html(html);
  861. });
  862. $('body').on('click', '.confirm-btn', function () {
  863. const validText = $(this).parents('td').find('input').val();
  864. const orgValue = $(this).data('pwd');
  865. const ledger_id = parseInt($(this).data('lid'));
  866. const user_id = parseInt($(this).data('uid'));
  867. const reg = /^[0-9a-zA-Z]+$/;
  868. if(!reg.test(validText)) {
  869. toastr.error('不能输入非数字和字母的字符');
  870. return;
  871. }
  872. if(validText == orgValue) {
  873. const html = `<p class="mb-0">${$(this).data('pwd')}</p><a href="javascript:void(0);" data-lid="${$(this).data('lid')}" data-uid="${$(this).data('uid')}" data-pwd="${$(this).data('pwd')}" class="edit-pwd">修改</a> <a href="javascript:void(0)" data-lid="${$(this).data('lid')}" data-uid="${$(this).data('uid')}" class="del-pwd text-danger">移除</a>`;
  874. $(this).parents('td').html(html);
  875. return;
  876. }
  877. const num = _.filter(ledger_cooperation_list, { pwd: validText, status: 1, user_id });
  878. if(num.length > 0) {
  879. toastr.error('同一个审批人密码不能相同');
  880. return;
  881. }
  882. const data = {
  883. type: 'pwd',
  884. ledger_id,
  885. user_id,
  886. pwd: validText,
  887. };
  888. postData('/tender/' + cur_tenderid + '/shenpi/audit/save', data, function (result) {
  889. const lcindex = _.findIndex(ledger_cooperation_list, { ledger_id, user_id });
  890. ledger_cooperation_list.splice(lcindex, 1, result);
  891. setLeftTable(ledgerTree.datas, ledger_cooperation_list, user_id, $('#stage_audits option:selected').text());
  892. const select = _.find(ledgerTree.datas, { ledger_id });
  893. select.pwd = validText;
  894. const refreshNode = ledgerTree.loadPostData({update: select});
  895. ledgerSpreadObj.refreshTree(ledgerSpread.getActiveSheet(), refreshNode);
  896. ledgerSpreadObj.setFontColor();
  897. });
  898. });
  899. // 上传图片
  900. $('body').on('click', '.upload-img', function () {
  901. $(this).siblings('input').trigger('click');
  902. // $('.upload-img-file').trigger('click');
  903. });
  904. $('body').on('change', '.upload-img-file', function () {
  905. const file = this.files[0];
  906. const ext = file.name.toLowerCase().split('.').splice(-1)[0];
  907. const imgStr = /(png|PNG)$/;
  908. if (!imgStr.test(ext)) {
  909. toastr.error('请上传签名大小为600x300,格式PNG透明背景。');
  910. return
  911. }
  912. if ($(this).val()) {
  913. var _self = $(this);
  914. const formData = new FormData();
  915. formData.append('id', $(this).data('id'));
  916. formData.append('file', this.files[0]);
  917. postDataWithFile(window.location.pathname + '/save-sign', formData, function (result) {
  918. _self.siblings('img').attr('src', '/' + result);
  919. _self.siblings('img').show();
  920. _self.siblings('a').removeClass('btn btn-outline-primary btn-sm').addClass('d-inline-flex').text('更改');
  921. _self.val('');
  922. const lcindex = _.findIndex(ledger_cooperation_list, { id: _self.data('id') });
  923. ledger_cooperation_list[lcindex].sign_path = result;
  924. ledger_cooperation_list.splice(lcindex, 1, ledger_cooperation_list[lcindex]);
  925. });
  926. }
  927. });
  928. $.subMenu({
  929. menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
  930. toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
  931. key: 'menu.1.0.0',
  932. miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1',
  933. callback: function (info) {
  934. if (info.mini) {
  935. $('.panel-title').addClass('fluid');
  936. $('#sub-menu').removeClass('panel-sidebar');
  937. } else {
  938. $('.panel-title').removeClass('fluid');
  939. $('#sub-menu').addClass('panel-sidebar');
  940. }
  941. autoFlashHeight();
  942. }
  943. });
  944. });
  945. function setRightData(datas, coolist) {
  946. const newdatas = [];
  947. const reg = /(^GD([a-zA-Z0-9\-]+))|(^([0-9\-]+)$)/;
  948. for (const l of datas) {
  949. if (reg.test(l.code) && l.level <= 4) {
  950. if(l.level === 4 && l.is_leaf === false) {
  951. l.is_leaf = true;
  952. }
  953. if(l.is_leaf) {
  954. const coo = _.find(coolist, { 'ledger_id': l.ledger_id, 'user_id': cur_uid });
  955. if(coo) {
  956. l.pwd = coo.pwd;
  957. }
  958. }
  959. newdatas.push(l);
  960. }
  961. }
  962. return newdatas;
  963. }
  964. function setLeftTable(ledgerList, coolist, uid, title) {
  965. $('#stage_audit').text(title);
  966. const showCooList = _.filter(coolist, { 'user_id': parseInt(uid) });
  967. const removeList = [];
  968. for (const sc of showCooList) {
  969. const info = _.find(ledgerList, { 'ledger_id': sc.ledger_id });
  970. if (info) {
  971. sc.code = info.code;
  972. sc.name = info.name;
  973. } else {
  974. removeList.push(sc);
  975. }
  976. }
  977. if (removeList.length > 0) {
  978. // 移除
  979. _.pull(showCooList, ...removeList);
  980. console.log(removeList);
  981. }
  982. let html = '';
  983. for (const sc of showCooList) {
  984. const pichtml = sc.sign_path ? `<img src="/${sc.sign_path}" width="60"><input type="file" data-id="${sc.id}" class="upload-img-file" style="display: none;"><a href="javascript: void(0);" class="d-inline-flex upload-img">更改</a>`
  985. : `<img src="" style="display: none" width="60"><input type="file" data-id="${sc.id}" class="upload-img-file" style="display: none;"><a href="javascript: void(0);" class="btn btn-outline-primary btn-sm upload-img">上传签名</a>`;
  986. html += `<tr>` +
  987. `<td>${sc.code} ${sc.name}</td>` +
  988. `<td><p class="mb-0">${sc.pwd}</p><a href="javascript:void(0);" data-lid="${sc.ledger_id}" data-uid="${sc.user_id}" data-pwd="${sc.pwd}" class="edit-pwd">修改</a> <a href="javascript:void(0)" data-lid="${sc.ledger_id}" data-uid="${sc.user_id}" class="del-pwd text-danger">移除</a></td>` +
  989. `<td>${pichtml}</td>` +
  990. `</tr>`;
  991. }
  992. $('#coo_table').html(html);
  993. }