1
0

resource.html 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  1. {extend name="public/layout" /} {block name="title"}资源库管理{/block} {block name="body"}
  2. <link rel="stylesheet" href="__LAYUI__/layui/css/layui.css" media="all">
  3. <link rel="stylesheet" " href=" /static/css/common.css">
  4. <script src="/static/js/jquery.min.js"></script>
  5. <style type="text/css">
  6. body {
  7. padding-bottom: 40px;
  8. }
  9. body {
  10. font-size: 12px;
  11. font-family: "宋体";
  12. }
  13. .layui-table-body::-webkit-scrollbar {
  14. height: 8px;
  15. }
  16. .layui-table-body::-webkit-scrollbar-thumb {
  17. border-radius: 10px;
  18. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  19. background: #DFDFDF;
  20. }
  21. .layui-table-body::-webkit-scrollbar-track {
  22. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  23. border-radius: 10px;
  24. background: #f5f5f5;
  25. }
  26. .layui-table-view{
  27. margin-top: 0 !important;
  28. }
  29. .layui-table{
  30. color: #000000;
  31. }
  32. .layui-table-box,.layui-table-view{
  33. height: max-content !important;
  34. }
  35. .layui-box.layui-laypage.layui-laypage-default{
  36. float: right;
  37. }
  38. label,select,option,input,a{
  39. color: #000000;
  40. }
  41. .searchtitlebox {
  42. display: block;
  43. padding: 15px 10px;
  44. border: 1px solid #F0F0F0;
  45. background: #FCFCFC;
  46. margin-top: 5px;
  47. margin-bottom: 10px;
  48. /* position: relative; */
  49. min-width: 800px;
  50. }
  51. .searchbox {
  52. display: block;
  53. margin-top: 8px;
  54. text-align: center;
  55. }
  56. .searchbox input {
  57. display: inline-block;
  58. height: 26px;
  59. line-height: 26px;
  60. padding-left: 3px;
  61. vertical-align: middle;
  62. }
  63. .searchbox .searchbtn {
  64. display: inline-block;
  65. float: right;
  66. border: none;
  67. width: 98px;
  68. height: 30px;
  69. color: #fff;
  70. font-size: 14px;
  71. font-weight: bold;
  72. text-align: center;
  73. background: url(__STATIC__/img/icon-sub.png) no-repeat;
  74. cursor: pointer;
  75. vertical-align: middle;
  76. }
  77. .selectbox {
  78. float: left;
  79. display: flex;
  80. }
  81. .leftselect {
  82. float: left;
  83. height: 26px;
  84. line-height: 26px;
  85. }
  86. .selectbox select {
  87. float: left;
  88. height: 26px;
  89. }
  90. .searchtext {
  91. border: 1px solid #ccc;
  92. background: #fff url(__STATIC__/img/icon071402.png) no-repeat;
  93. padding: 1px 2px;
  94. height: 24px;
  95. line-height: 24px;
  96. vertical-align: middle;
  97. text-indent: 3px;
  98. margin-left: 4px;
  99. }
  100. .searchbtn1 {
  101. margin-left: 4px;
  102. cursor: pointer;
  103. color: #000;
  104. background: url(__STATIC__/img/btn_bg.gif) repeat-x;
  105. border: 1px solid #C0C0C0;
  106. padding: 0 12px;
  107. *padding: 0 6px;
  108. height: 26px;
  109. }
  110. .input-indent-box-small {
  111. display: inline;
  112. width: 20%;
  113. }
  114. .namelink {
  115. color: #3483d5;
  116. }
  117. .namelink:hover {
  118. color: mediumblue;
  119. text-decoration-line: underline;
  120. cursor: pointer;
  121. }
  122. .layui-input-inline-right {
  123. float: right;
  124. /*width: 190px;*/
  125. margin-right: 10px;
  126. display: flex;
  127. }
  128. .layui-col-md2.layui-col-xs2.layui-col-sm2 {
  129. min-width: 200px;
  130. }
  131. .layui-col-md12.layui-col-xs12.layui-col-sm12 {
  132. display: flex;
  133. }
  134. .layui-btn-primary {
  135. color: #249EFB;
  136. border: 1px solid #249EFB;
  137. }
  138. .layui-btn-primary:hover {
  139. background-color: #E3F7FF;
  140. color: #249EFB;
  141. }
  142. .layui-btn-xs,
  143. .layui-btn-xs:hover {
  144. border: 1px solid #249EFB;
  145. background-color: #fff;
  146. color: #249EFB;
  147. padding: 0px 10px;
  148. }
  149. .layui-table-body {
  150. max-height: 670px !important;
  151. height: auto !important;
  152. }
  153. </style>
  154. <body>
  155. <iframe id="customer_detail" style="display: none;" src=""></iframe>
  156. <div class="resourcebox">
  157. <form id="newform" class="layui-form">
  158. <div class="searchtitlebox">
  159. <div style="margin-bottom:8px;">您当前的操作 · <b>资源库分配</b>&nbsp;&nbsp;</div>
  160. <div class="searchbox clearfix">
  161. <div class="selectbox">
  162. <div class="leftselect">检索:</div>
  163. <select name="state" lay-filter="state" id="state" >
  164. <option value="">==分配情况==</option>
  165. <option value=0>未分配</option>
  166. <option value=1>已分配</option>
  167. </select>
  168. &nbsp;
  169. <select name="source" lay-filter="source" id="source" lay-search>
  170. <option value="">==渠道来源==</option>
  171. {volist name='source' id='v'}
  172. <option value="{$v.id}">{$v.source}</option>
  173. {/volist}
  174. </select>
  175. <input class="left searchtext" type="text" name="addtime" id="addtime" style="width: 170px;"
  176. placeholder="请选择添加时间" readonly>
  177. <button class="left searchbtn1" type="button" id="search" lay-filter="LAY-app-contlist-search">搜索</button>
  178. </div>
  179. <button class="searchbtn" type="button" id="importcustomer">添加资源</button>
  180. </div>
  181. </div>
  182. </form>
  183. <div class="crmsearchlist">
  184. <table id="pool_customer_table" lay-filter="pool_customer_table"></table>
  185. </div>
  186. </div>
  187. </body>
  188. <script src="__LAYUI__/layui/layui.js"></script>
  189. {/block} {block name="js"}
  190. <script type="text/html" id="op">
  191. {{# if(d.status == 2||d.status == 0){ }}
  192. {{# if(d.left_num > 0){ }}
  193. <!-- <a class="layui-btn layui-btn-xs layui-btn-success" lay-event="patchdistribute">批量分配</a>
  194. <a class="layui-btn layui-btn-xs layui-btn-warm" lay-event="distribute" href="{:url('crm/resourcepool')}?cilid={{d.id}}">手动分配</a> -->
  195. <a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="distribution">批量分配</a> <!--新版本-->
  196. <a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="handdistribution">手动分配</a> <!--新版本-->
  197. {{# }else{ }}
  198. <!-- <a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="details">详情</a> 旧版本-->
  199. {{# } }}
  200. <a class="layui-btn layui-btn-xs" lay-event="read">详情</a> <!--新版本-->
  201. {{# if(d.pid == 0){ }}
  202. <a class="layui-btn layui-btn-xs" lay-event="delete_new">删除</a> <!--新版本-->
  203. {{# }else{ }}
  204. <a class="layui-btn layui-btn-xs" style="color: #cccccc; border-color: #cccccc;">删除</a>
  205. {{# } }}
  206. {{# } }}
  207. {{# if(d.status == 3){ }}
  208. <a class="layui-btn layui-btn-xs" lay-event="delete_new">删除</a> <!--新版本-->
  209. {{# } }}
  210. {{# if(d.status == 1){ }}
  211. <span>资源正在上传中,请稍后刷新页面...</span>
  212. {{# } }}
  213. <!-- <a class="layui-btn layui-btn-xs layui-btn-warm" lay-event="withdrawl">回收</a>-->
  214. <!-- <a class="layui-btn layui-btn-xs " lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>-->
  215. </script>
  216. <script type="text/html" id="empTpl">
  217. {{# if(d.employee_name){ }}
  218. <span>{{d.employee_name}}</span>
  219. {{# }else{ }}
  220. <span>无</span>
  221. {{# } }}
  222. </script>
  223. <script type="text/html" id="stateTpl">
  224. {{# if(d.state == 0){ }}
  225. <span style="color:green">未分配</span>
  226. {{# }else{ }}
  227. <span>已分配</span>
  228. {{# } }}
  229. </script>
  230. <script type="text/html" id="nameTpl">
  231. {{# if(d.left_num > 0){ }}
  232. <p class="namelink" lay-event="read">{{d.name}}</p>
  233. <!-- <a class="namelink" lay-event="distribute" href="{:url('crm/resourcepool')}?cilid={{d.id}}">{{d.name}}</a> -->
  234. {{# }else{ }}
  235. <span>{{d.name}}</span>
  236. {{# } }}
  237. </script>
  238. <script type="text/html" id="sources">
  239. {{# if(d.source != ''){ }}
  240. <span>{{d.source_name}}</span>
  241. {{# }else{ }}
  242. <span style="color: #cccccc;">无</span>
  243. {{# } }}
  244. </script>
  245. <script>
  246. var opoo=function(){};
  247. var orgids_str = '{:$orgids}';
  248. var orgids = JSON.parse(orgids_str);
  249. var pool = eval('{$pool|raw}');
  250. var org = eval('{$org|raw}');
  251. var reload = null, resizefun = null, assignCustomerFunc=null;
  252. layui.config({
  253. base: '__LAYUI__/' //静态资源所在路径
  254. , urlbase: '/sys'
  255. }).extend({
  256. index: 'lib/index' //主入口模块
  257. }).use(['index', 'table', 'layedit', 'element', 'upload', 'laydate'], function () {
  258. var $ = layui.$,
  259. table = layui.table,
  260. element = layui.element,
  261. upload = layui.upload,
  262. laydate = layui.laydate,
  263. form = layui.form;
  264. $('#pool').append(setOrgOption(pool, ''));
  265. form.render('select');
  266. laydate.render({
  267. elem: '#addtime'
  268. , type: 'date'
  269. , range: '--'
  270. , format: 'yyyy-MM-dd'
  271. , trigger: 'click'
  272. });
  273. $('#pool_struc').append(setOrgPoolTree(org, 'space', 'wrap'));
  274. form.render();
  275. let empid = '{:$empid}';
  276. $('#resetBtn').on('click',function(){
  277. $('#newform')[0].reset();
  278. table.reload('pool_customer_table', {
  279. page: {
  280. curr: 1 //重新从第 1 页开始
  281. }
  282. , where: {
  283. state: '', //在表格中进行搜索
  284. source: '',
  285. person: '',
  286. start_date: '',
  287. end_date: ''
  288. }
  289. });
  290. })
  291. reload=function(){
  292. table.reload('pool_customer_table')
  293. }
  294. document.onkeydown=function(event){
  295. var e = event || window.event || arguments.callee.caller.arguments[0];
  296. if(e && e.keyCode==13){
  297. $(".submitbtn").trigger("click");
  298. }
  299. };
  300. table.render({
  301. elem: '#pool_customer_table'
  302. , url: '{:url("resource")}' //数据接口
  303. , page: true //开启分页
  304. , limits: [17]
  305. , limit: 17 //每页默认显示的数量,
  306. , height: 'full-150'
  307. , autoSort: false
  308. , cols: [[ //表头
  309. // { type: 'checkbox', fixed: 'left', minWidth: 80},
  310. { type: 'numbers', field: 'id', title: '编号', minWidth: 60, fixed: 'left' }
  311. , { field: 'name', title: '资源名称', templet: '#nameTpl', minWidth: 260, fixed: 'left' }
  312. , { field: 'source', title: '来源渠道', minWidth: 100, templet: '#sources' }
  313. , { field: 'employee_id', title: '导入人员', minWidth: 100, templet: '#empTpl' }
  314. , { field: 'count', title: '资源数', minWidth: 80 }
  315. , { field: 'avaliable_count', title: '可分资源', minWidth: 80 }
  316. , { field: 'bad_phone_num', title: '问题客资', minWidth: 80 }
  317. // , { field: 'repeat_phone_number', title: '重复数', minWidth: 80 }
  318. , { field: 'state_name', title: '分配情况', minWidth: 80 }
  319. , { field: 'y_count', title: '已分配', minWidth: 80 }
  320. , { field: 'left_num', title: '未分配', minWidth: 80 }
  321. , { field: 'addtime', title: '添加时间', sort: true, minWidth: 170 }
  322. , { templet: '#op', title: '操作', minWidth: 320, fixed: 'right' }
  323. ]]
  324. , done: function (res, curr, count) {
  325. //隐藏列
  326. if (res.org != 0) {
  327. $(".layui-table-box").find("[data-field='avaliable_count']").css("display", "none");
  328. $(".layui-table-box").find("[data-field='bad_phone_num']").css("display", "none");
  329. $(".layui-table-box").find("[data-field='repeat_phone_num']").css("display", "none");
  330. $(".layui-table-box").find("[data-field='error_phone_num']").css("display", "none");
  331. }
  332. }
  333. });
  334. assignCustomerFunc = function (id, count, str) {
  335. window.parent.openbuildfun('{:url("manager_emp/distribution")}?id=' + id + '&distribution={:url("manager_emp/read_new")}&count=' + count + '&customer_id=' + str);
  336. /**layer.open({
  337. type: 2,
  338. title: ['批量分配', 'color:#333333;background-color:#D8E6F1;'],
  339. content: '{:url("manager_emp/distribution")}?id=' + id + '&count=' + count + '&customer_id=' + str,
  340. resize: false,
  341. area: ['90%', '90%'],
  342. });**/
  343. }
  344. window.call_cuslist = function(id){
  345. layer.open({
  346. type: 2,
  347. title: ['外呼电话', 'color:#333333;background-color:#D8E6F1;'],
  348. content: '{:url("manager_emp/call_cuslist")}?customer_id=' + id ,
  349. resize: false,
  350. area: ['90%', '90%'],
  351. });
  352. }
  353. table.on('tool(pool_customer_table)', function (obj) {
  354. var id = obj.data.id;
  355. var empname = obj.data.employee_name;
  356. var layEvent = obj.event;
  357. if (layEvent === 'tracking') {
  358. layer.open({
  359. type: 2,
  360. title: ['跟进记录', 'color:#333333;background-color:#D8E6F1;'],
  361. content: '{:url("crm/tracking")}?id=' + id,
  362. resize: false,
  363. area: ['80%', '80%']
  364. });
  365. } else if (layEvent === 'foot') {
  366. layer.open({
  367. type: 2,
  368. title: ['客户足迹', 'color:#333333;background-color:#D8E6F1;'],
  369. content: '{:url("crm/foot")}?id=' + id,
  370. resize: false,
  371. area: ['80%', '80%']
  372. });
  373. } else if (layEvent === 'details') {
  374. layer.open({
  375. type: 2,
  376. title: ['分配详情', 'color:#333333;background-color:#D8E6F1;'],
  377. content: '{:url("manager_emp/cil_detail")}?cilid=' + id,
  378. resize: false,
  379. area: ['80%', '80%']
  380. });
  381. } else if (layEvent === 'patchdistribute') {
  382. // $('#patchdistribute').on('click', function () {
  383. layer.open({
  384. type: 2,
  385. title: ['批量分配客户', 'color:#333333;background-color:#D8E6F1;'],
  386. content: '{:url("manager_emp/patchdistribute")}?empid=' + empid + '&cilid=' + id,
  387. resize: false,
  388. area: ['80%', '80%'],
  389. });
  390. // });
  391. } else if (layEvent == 'distribution') {
  392. window.parent.openbuildfun('{:url("manager_emp/distribution")}?id=' + id + '&distribution={:url("manager_emp/resource")}&count=' + obj.data.left_num);
  393. //迭代分配页面
  394. /**layer.open({
  395. type: 2,
  396. title: ['批量分配', 'color:#333333;background-color:#D8E6F1;'],
  397. content: '{:url("manager_emp/distribution")}?id=' + id + '&count=' + obj.data.left_num,
  398. resize: false,
  399. area: ['80%', '80%'],
  400. });**/
  401. } else if (layEvent == 'read') {
  402. window.parent.openbuildfun('{:url("manager_emp/read_new")}?id=' + id + '&empname=' + empname + '&readistribution={:url("manager_emp/resource")}');
  403. /**layer.open({
  404. type: 2,
  405. skin: 'read_new',
  406. title: ['详情', 'color:#333333;background-color:#D8E6F1;'],
  407. content: '{:url("manager_emp/read_new")}?id=' + id,
  408. resize: false,
  409. shade: 0,
  410. offset: 'r',
  411. area: ['80%', '100%'],
  412. success: function (layero, index) {
  413. $('.read_new').animate({ 'right': '0' }, 500);
  414. },
  415. cancel: function (layero, index) {
  416. $('.read_new').animate({ 'right': '-80%' }, 500);
  417. setTimeout(function () {
  418. $('.read_new').remove();
  419. }, 500)
  420. return false;
  421. }
  422. });**/
  423. } else if (layEvent == 'delete_new') {
  424. //删除资源,,只能删除一次都没有分配过的资源
  425. layer.confirm('确定删除这条资源?', { title: ['信息', 'color:#333333;background-color:#D8E6F1;'], }, function (index) {
  426. $.ajax({
  427. type: 'post',
  428. url: "{:url('manager_emp/delete_new')}",
  429. data: {
  430. id: id
  431. },
  432. success: function (res) {
  433. if (res.code == 0) {
  434. layer.msg(res.msg, {
  435. anim: 0
  436. }, function () {
  437. //执行重载
  438. table.reload('pool_customer_table');
  439. // obj.del();
  440. // layer.close(index);
  441. });
  442. }else if(res.code == 403){
  443. $(".exitbtn").trigger("click");
  444. }else {
  445. layer.msg(res.msg, {
  446. anim: 6
  447. });
  448. }
  449. }
  450. });
  451. });
  452. } else if (layEvent == 'handdistribution') {
  453. //手动分配跳转到详情页未分配页面
  454. window.parent.openbuildfun('{:url("manager_emp/read_new")}?type=1&id=' + id+'&handdistribution={:url("manager_emp/resource")}' );
  455. /**layer.open({
  456. type: 2,
  457. title: ['详情', 'color:#333333;background-color:#D8E6F1;'],
  458. content: '{:url("manager_emp/read_new")}?type=1&id=' + id,
  459. resize: false,
  460. area: ['80%', '80%'],
  461. });**/
  462. }
  463. });
  464. table.on('sort(pool_customer_table)', function (obj) {
  465. table.reload('pool_customer_table', {
  466. initSort: obj
  467. , where: {
  468. order: obj.field + ' ' + obj.type
  469. }
  470. });
  471. });
  472. $('.treenodetext').on('click', function () {
  473. $('.treenodetext').each(function () {
  474. if ($(this).hasClass('tree-node-current')) {
  475. $(this).removeClass('tree-node-current');
  476. }
  477. });
  478. $(this).addClass('tree-node-current');
  479. //console.log( $(this).data('value'));
  480. table.reload('pool_customer_table', {
  481. where: { org_pool: $(this).data('value') }
  482. });
  483. return false;
  484. })
  485. // form.on('select(org_select_pool)', function (data) {
  486. //  console.log(data)
  487. // table.reload('pool_customer_table', {
  488. // where: {org_pool:data.value}
  489. // });
  490. // return false;
  491. // });
  492. // form.on('submit(search)', function (data) {
  493. // table.reload('pool_customer_table', {
  494. // where: data.field
  495. // });
  496. // return false;
  497. // });
  498. $('#importcustomer').on('click', function () {
  499. window.parent.openbuildfun('{:url("manager_emp/importing")}?weburl={:url("manager_emp/resource")}');
  500. //layer.open({
  501. // type: 2,
  502. // title: ['公海客户添加', 'color:#333333;background-color:#D8E6F1;'],
  503. // content: '{:url("manager_emp/importing")}',
  504. // resize: false,
  505. // area: ['50%', '600px'],
  506. //});
  507. });
  508. $('#label_setting').on('click', function () {
  509. layer.open({
  510. type: 2,
  511. title: ['标识设置', 'color:#333333;background-color:#D8E6F1;'],
  512. content: '{:url("crm/label")}',
  513. resize: false,
  514. area: ['50%', '600px']
  515. });
  516. });
  517. $('#addpool').on('click', function () {
  518. layer.open({
  519. type: 2,
  520. title: ['公海设置', 'color:#333333;background-color:#D8E6F1;'],
  521. content: '{:url("crm/addpool")}?empid=' + empid,
  522. resize: false,
  523. area: ['80%', '80%']
  524. });
  525. });
  526. //日期范围
  527. laydate.render({
  528. elem: '#start_date',
  529. trigger: 'click'//呼出事件改成click
  530. });
  531. laydate.render({
  532. elem: '#end_date',
  533. trigger: 'click'//呼出事件改成click
  534. });
  535. //搜索
  536. $('#search').click(function () {
  537. var state = $('#state').val();
  538. var source = $('#source').val();
  539. var person = $('#person').val();
  540. var time=$('#addtime').val();
  541. var start_date = time.split('--')[0];
  542. var end_date = time.split('--')[1];
  543. //执行重载
  544. table.reload('pool_customer_table', {
  545. page: {
  546. curr: 1 //重新从第 1 页开始
  547. }
  548. , where: {
  549. state: state, //在表格中进行搜索
  550. source: source,
  551. person: person,
  552. start_date: start_date? start_date:'',
  553. end_date: end_date? end_date:''
  554. }
  555. });
  556. });
  557. });
  558. function setOrgPoolTree(opt, sj, wr, ch) {
  559. var html = '';
  560. var i = 0;
  561. opt.forEach(element => {
  562. if (ch == 1) {
  563. html += '<div class="tree ' + wr + '"><div class="treenode ' + sj + '" ><i class="layui-icon layui-icon-file"></i><span class="treenodetext" data-value="' + element.id + '"> ' + element.title + ' 资源库</span></div>';
  564. if (element.children.length > 0) html += setOrgPoolTree(element.children, sj + 'o', wr + 'o', 1);
  565. html += '</div>';
  566. } else {
  567. if (i == 0) {
  568. html += '<div class="tree ' + wr + '"><div class="treenode ' + sj + '" ><i class="layui-icon layui-icon-file"></i><span class="treenodetext tree-node-current" data-value="' + element.id + '"> ' + element.title + ' 资源库</span></div></div>';
  569. } else {
  570. html += '<div class="tree ' + wr + '"><div class="treenode ' + sj + '" ><i class="layui-icon layui-icon-file"></i><span class="treenodetext" data-value="' + element.id + '"> ' + element.title + ' 资源库</span></div></div>';
  571. }
  572. if (element.children.length > 0) html += setOrgPoolTree(element.children, sj + 'o', wr + 'o', 1);
  573. }
  574. i++;
  575. });
  576. return html;
  577. }
  578. // function setOrgPoolTree(opt, sj) {
  579. // var html = '';
  580. // opt.forEach(element => {
  581. //
  582. // html += '<p class="tree"><span class="treenode '+ sj +'" data-value="' + element.id + '">'+ element.title + ' 资源库</span></p>';
  583. //
  584. // if (element.children.length > 0) html += setOrgPoolTree(element.children, sj + 'o');
  585. //
  586. // });
  587. //
  588. // return html;
  589. // }
  590. function setOrgPoolOption(opt, sj) {
  591. var html = '';
  592. opt.forEach(element => {
  593. // if(orgids.length > 0){
  594. // if(in_array(element.id,orgids)) {
  595. html += '<p><span class="treenode" data-value="' + element.id + '">' + sj + element.title + ' 资源库</span></p>';
  596. // }
  597. // }
  598. if (element.children.length > 0) html += setOrgPoolOption(element.children, sj + '-');
  599. });
  600. return html;
  601. }
  602. function setOrgOption(opt, sj) {
  603. var html = '';
  604. opt.forEach(element => {
  605. if (orgids.length > 0) {
  606. if (in_array(element.org_id, orgids)) {
  607. // html += '<option value="' + element.id + '">' + sj + element.name + '</option>';
  608. if (element.level > 0) {
  609. var gapstr = '';
  610. for (let i = 0; i < element.level; i++) {
  611. gapstr += '-';
  612. };
  613. html += '<option value="' + element.id + '">' + gapstr + element.name + '</option>';
  614. }
  615. }
  616. }
  617. // if (element.children.length > 0) html += setOrgOption(element.children, sj + '-');
  618. });
  619. return html;
  620. }
  621. function in_array(search, array) {
  622. for (var i in array) {
  623. if (array[i] == search) {
  624. return true;
  625. }
  626. }
  627. return false;
  628. }
  629. </script>
  630. {/block}