index.html 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341
  1. {extend name="public/layout" /}
  2. {block name="title"}组织结构{/block}
  3. {block name="body"}
  4. <style>
  5. html,
  6. body {
  7. min-width: 900px;
  8. }
  9. .layui-fluid {
  10. display: block;
  11. box-shadow: 0 0 4px 0 #B6CADE;
  12. border-radius: 5px;
  13. margin: 15px;
  14. background-color: #ffffff;
  15. }
  16. .cardheader {
  17. padding-left: 10px;
  18. }
  19. .laytable-cell-1-0-1 {
  20. height: 32px !important;
  21. line-height: 32px !important;
  22. }
  23. .layui-tree-set,
  24. .layui-tree-entry {
  25. margin-top: 5px !important;
  26. }
  27. .layui-table tr {
  28. height: 7vh;
  29. }
  30. @media screen and (min-width: 992px) {
  31. .layui-col-md9 {
  32. margin-left: 1%;
  33. width: 74%;
  34. }
  35. }
  36. .layui-table thead tr,
  37. .layui-table-header {
  38. background-color: #D8E6F1 !important;
  39. }
  40. #root-list {
  41. border-right: 1px solid #f6f6f6;
  42. }
  43. #addRoot {
  44. border-top: 1px solid #f6f6f6;
  45. }
  46. .root {
  47. cursor: pointer;
  48. text-align: center;
  49. padding: 10px 1px;
  50. font-size: 1rem;
  51. font-weight: bold;
  52. }
  53. .root.selected {
  54. font-size: x-large;
  55. color: #269efb;
  56. }
  57. .root:hover {
  58. font-size: x-large;
  59. color: #269efb;
  60. }
  61. .layui-form-label {
  62. width: 150px;
  63. }
  64. .layui-input-block {
  65. margin-left: 180px;
  66. }
  67. .strucinfo {
  68. cursor: pointer;
  69. }
  70. .setleader {
  71. float: right;
  72. }
  73. .setleader:hover {
  74. display: block;
  75. }
  76. .employee {
  77. width: 24px;
  78. height: 24px;
  79. background: #71C4FF;
  80. text-align: center;
  81. border-radius: 50%;
  82. line-height: 22px;
  83. margin-right: 4px;
  84. }
  85. .employee>i {
  86. color: white;
  87. }
  88. .leader {
  89. float: right;
  90. }
  91. /*重要 样式*/
  92. .layui-tree-entry.tree-node-current .layui-tree-main {
  93. background-color: #d7edbf87;
  94. }
  95. /*重要 样式*/
  96. .layui-btn.layui-btn-success {
  97. background-color: #009688;
  98. }
  99. .filterbutton {
  100. float: right;
  101. }
  102. .layui-layer-content {
  103. overflow: inherit !important;
  104. }
  105. .layui-zz-box {
  106. border: 1px solid #f2f2f2;
  107. margin-right: 5px;
  108. }
  109. .list>ul:first-child>li>div {
  110. background-color: #f2f2f2;
  111. display: block;
  112. padding: 5px
  113. }
  114. .list li {
  115. min-width: 150px;
  116. }
  117. .list li div {
  118. padding: 3px;
  119. padding-right: 5px;
  120. }
  121. .list>ul ul {
  122. margin-left: 15px;
  123. }
  124. .list .op {
  125. float: right;
  126. margin-left: 2px;
  127. }
  128. .list i.op:hover,
  129. .list i.group:hover,
  130. .list span:hover {
  131. cursor: pointer;
  132. }
  133. .list span {
  134. overflow: hidden;
  135. text-overflow: ellipsis;
  136. white-space: nowrap;
  137. display: inline-block;
  138. }
  139. .list span.title{
  140. max-width: 85px;
  141. }
  142. .list li i:first-child {
  143. position: relative;
  144. top: -6px;
  145. margin-right: 5px;
  146. }
  147. @media screen and (min-width: 768px){
  148. }
  149. .operate {
  150. position: absolute;
  151. display: none;
  152. background-color: white;
  153. text-align: center;
  154. box-shadow: 0 0 3px 3px #edededcf;
  155. z-index: 9;
  156. }
  157. .operate li {
  158. padding: 5px 10px;
  159. cursor: pointer;
  160. }
  161. .operate li:hover {
  162. color: #249efb;
  163. }
  164. .layerbox {
  165. position: absolute;
  166. display: none;
  167. background-color: transparent;
  168. width: 100%;
  169. height: 100%;
  170. top: 0;
  171. left: 0;
  172. z-index: 8;
  173. }
  174. .leader-select {
  175. display: none;
  176. margin: 10px;
  177. }
  178. .leader-select .selected {
  179. border: 1px solid #f2f2f2;
  180. width: fit-content;
  181. padding: 5px;
  182. display: flex;
  183. min-height: 28px;
  184. }
  185. .leader-select .selected ul {
  186. width: 195px;
  187. }
  188. .leader-select .select {
  189. border: 1px solid #f2f2f2;
  190. width: auto;
  191. width: 221px;
  192. display: none;
  193. background-color: #f3f3f3;
  194. position: absolute;
  195. }
  196. .leader-select .select li {
  197. padding: 5px;
  198. width: auto;
  199. }
  200. .leader-select .select li:hover {
  201. cursor: pointer;
  202. background-color: #249efb;
  203. color: white;
  204. }
  205. /* 设置滚动条的样式 */
  206. .layui-zz-box::-webkit-scrollbar {
  207. width: 10px;
  208. }
  209. /* 滚动槽 */
  210. .layui-zz-box::-webkit-scrollbar-track {
  211. -webkit-box-shadow: inset006pxrgba(0, 0, 0, 0.3);
  212. }
  213. /* 滚动条滑块 */
  214. .layui-zz-box::-webkit-scrollbar-thumb {
  215. background: rgba(0, 0, 0, 0.1);
  216. -webkit-box-shadow: inset006pxrgba(0, 0, 0, 0.5);
  217. }
  218. .leader-select .selected li {
  219. display: inline-block;
  220. background-color: #D4E4ED;
  221. border-radius: 10%;
  222. padding: 3px 4px;
  223. font-size: xx-small;
  224. margin: 3px;
  225. }
  226. .leader-select .selected li>i {
  227. cursor: pointer;
  228. }
  229. .leader-select .selected>i {
  230. position: relative;
  231. top: 6px;
  232. }
  233. .leader-select .selected li>i {
  234. font-size: 12px;
  235. }
  236. .addspancolor>div span {
  237. color: #249efb !important;
  238. }
  239. .addspancolor>div .layui-icon {
  240. color: #249efb !important;
  241. }
  242. .layui-btn-primary {
  243. color: #249EFB;
  244. border: 1px solid #249EFB;
  245. }
  246. .layui-btn-primary:hover {
  247. background-color: #E3F7FF;
  248. color: #249EFB;
  249. }
  250. .org-type {
  251. color: #F54D64 !important;
  252. border-radius: 50%;
  253. padding: 2px;
  254. font-style: normal;
  255. background-color: #FFC6CE;
  256. display: inline-block;
  257. width: 16px;
  258. text-align: center;
  259. height: 16px;
  260. font-size: 14px;
  261. line-height: 16px;
  262. margin-left: 5px;
  263. }
  264. .org-oranger {
  265. background-color: #FFD933 !important;
  266. color: #FFAD33 !important;
  267. }
  268. .org-blue {
  269. background-color: #A7D7F9 !important;
  270. color: #249EFB !important;
  271. }
  272. .layui-btn-xs,
  273. .layui-btn-xs:hover {
  274. border: 1px solid #249EFB;
  275. background-color: #fff;
  276. color: #249EFB;
  277. padding: 0px 10px;
  278. }
  279. .layui-btn-danger,
  280. .layui-btn-danger:hover {
  281. color: #FF5722;
  282. background-color: #fff;
  283. border: 1px solid #FF5722;
  284. padding: 0px 10px;
  285. }
  286. .layui-tab-title .layui-this {
  287. color: #249EFB !important;
  288. }
  289. .layui-tab-title .layui-this:after {
  290. width: 50px;
  291. height: 4px;
  292. top: 37px;
  293. background-color: #249EFB;
  294. border: none;
  295. left: 50%;
  296. transform: translateX(-50%);
  297. }
  298. .layui-tab-title li {
  299. margin: 0px 5px;
  300. }
  301. .layui-card {
  302. padding: 0px;
  303. }
  304. .layui-card-body {
  305. padding: 10px 0px;
  306. }
  307. .link {
  308. display: inline-block;
  309. width: 100%;
  310. height: 100%;
  311. }
  312. .xl {
  313. height: auto;
  314. overflow-y: scroll;
  315. max-height: 200px;
  316. }
  317. .xl li {
  318. background-color: white;
  319. height: 28px;
  320. line-height: 200%;
  321. }
  322. .layui-tab-title {
  323. border-bottom: 1px solid #f5f5f5;
  324. }
  325. </style>
  326. <body>
  327. <div class="layui-fluid">
  328. <div class="layui-card">
  329. <div class="layui-tab">
  330. <ul class="layui-tab-title">
  331. <li class="layui-this" style="margin-left: -5px;">
  332. 组织架构
  333. </li>
  334. <li>
  335. <a href="{:url('org/designer')}" class="link">设计师管理</a>
  336. </li>
  337. <li>
  338. <a href="{:url('recruitment/index')}" class="link">招聘管理</a>
  339. </li>
  340. </ul>
  341. </div>
  342. <div class="layui-card-body">
  343. <div class="layui-row">
  344. <div class="layui-col-md12 layui-col-xs12 layui-col-sm12">
  345. <div class="layui-tab layui-tab-brief" lay-filter="component-tabs-hash">
  346. <div class="layui-tab-content">
  347. <div class="layui-tab-item layui-show">
  348. <div class="layui-col-md3 layui-col-xs3 layui-col-sm3" style="min-width: 200px;">
  349. <div class="layui-inline" style="height: 38px;">
  350. <p class="cardheader"
  351. style="font-size:22px;font-weight: bold;color: #111;margin-top:10px;">
  352. <span>组织结构</span>
  353. </p>
  354. </div>
  355. <div class="layui-zz-box"
  356. style="margin-top:15px;overflow: auto;height: 74.2vh;">
  357. <div class="tree">
  358. <div class="list">
  359. </div>
  360. </div>
  361. </div>
  362. </div>
  363. <div class="layui-col-md9 layui-col-xs9 layui-col-sm9">
  364. <div class="layui-inline" style="width:100%;">
  365. <button class="layui-btn layuiadmin-btn-admin layui-btn-primary"
  366. data-type="invite">邀请人员</button>
  367. <!--<button id="verifyapplier"
  368. class="layui-btn layuiadmin-btn-admin layui-btn-warm filterbutton rander"
  369. data-type="verifyapplier">人员审核</button>-->
  370. <button id="verifyapplier"
  371. class="layui-btn layuiadmin-btn-admin layui-btn-warm rander"
  372. data-type="verifyapplier">人员审核</button>
  373. <button id="employeelist"
  374. class="layui-btn layuiadmin-btn-admin layui-btn-success rander"
  375. data-type="employeelist" style="display: none">员工管理</button>
  376. <button id="employeelist_all"
  377. class="layui-btn layui-btn-warm {if condition=" $count <=0"}
  378. layui-btn-disabled {/if}" data-type="employeelist" style="display:none"
  379. {if condition="$count <= 0" } disabled="disabled" {/if}>一键审核通过</button>
  380. <div style="float:right;" class="flexRow layui-form">
  381. <div class="layui-inline" style="width: 100px;">
  382. <div class="layui-input-inline">
  383. <select name="disable" id="disable">
  384. <option value="">程序准入</option>
  385. <option value="0">准入</option>
  386. <option value="1">禁止</option>
  387. </select>
  388. </div>
  389. </div>
  390. <div class="layui-inline" style="margin-left: 10px;">
  391. <div class="layui-input-inline">
  392. <input type="text" name="keyword" id=""
  393. class="layui-input keyword" autocomplete="off"
  394. placeholder="请输入员工名称" />
  395. </div>
  396. </div>
  397. <div class="layui-inline">
  398. <button class="layui-btn layuiadmin-btn-useradmin searchBtn"
  399. lay-submit lay-filter="search">
  400. <i
  401. class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
  402. </button>
  403. </div>
  404. </div>
  405. </div>
  406. <table id="LAY-employee-list" lay-filter="LAY-employee-list"
  407. style="margin-top:15px;"></table>
  408. </div>
  409. </div>
  410. </div>
  411. </div>
  412. </div>
  413. </div>
  414. </div>
  415. </div>
  416. </div>
  417. <div class="layui-form" id="jiaojie" style="margin: 10px 20px;display: none;">
  418. <div class="layui-form-item">
  419. <select name="" id="jjselect">
  420. <option value="">请选择接收部门</option>
  421. </select>
  422. </div>
  423. </div>
  424. <div class="layerbox"></div>
  425. <div id="first" class="operate">
  426. <ul>
  427. <li data-event="leader">设置负责人</li>
  428. <li data-event="edit">修改名称</li>
  429. </ul>
  430. </div>
  431. <div id="structOp" class="operate">
  432. <ul>
  433. <li data-event="leader">设置负责人</li>
  434. <li data-event='transfer'>转移层级</li>
  435. <li data-event="edit">修改名称</li>
  436. <li data-event="delete">删除节点</li>
  437. </ul>
  438. </div>
  439. <div class="leader-select" data-id="0">
  440. <div class="selected">
  441. <ul>
  442. </ul>
  443. <i class="layui-icon layui-icon-triangle-d show"></i>
  444. </div>
  445. <div class="select xl">
  446. <ul>
  447. </ul>
  448. </div>
  449. </div>
  450. {/block}
  451. {block name="js"}
  452. <script type="text/html" id="headTpl">
  453. {{# if(d.user){ }}
  454. {{# if(d.user.headimgurl){ }}
  455. <span><img src="{{d.user.headimgurl}}" alt="" width="30" height="30" style="border-radius: 50%"/></span>
  456. {{# } }}
  457. {{# if(!d.user.headimgurl){ }}
  458. <span><img src="https://o.nczyzs.com/xcx/default.png" alt="" width="30" height="30" style="border-radius: 50%"/></span>
  459. {{# } }}
  460. {{# } }}
  461. </script>
  462. <script type="text/html" id="strucTpl">
  463. {{# if(d.verified === 1){ }}
  464. {{# if(d.is_manager){ }}
  465. <p class="strucinfo" data-leader="{{d.is_manager}}"><span>{{d.org.info}}</span><span class="leader" lay-event="removeleader"><img src="__STATIC__/img/managericon.png" style="width:80%" alt="" /></span></p>
  466. {{# }else{ }}
  467. <p class="strucinfo" data-leader="{{d.is_manager}}"><span>{{d.org.info}}</span><span class="setleader employee" lay-event="setleader"><i class="layui-icon layui-icon-friends"></i></span></p>
  468. {{# } }}
  469. {{# }else{ }}
  470. {{# if(d.is_manager){ }}
  471. <p class="strucinfo" data-leader="{{d.is_manager}}"><span>{{d.org.info}}</span>
  472. <span class="leader" lay-event="removeleader"><img src="__STATIC__/img/managericon.png" style="width:80%" alt="" /></span>
  473. </p>
  474. {{# }else{ }}
  475. <p class="strucinfo" data-leader="{{d.is_manager}}"><span>{{d.org.info}}</span></p>
  476. {{# } }}
  477. {{# } }}
  478. </script>
  479. <script type="text/html" id="grantTpl">
  480. {{# if(d.grant){ }}
  481. <span>{{d.grant.name}}</span>
  482. {{# }else{ }}
  483. <span>未绑定</span>
  484. {{# } }}
  485. </script>
  486. <script type="text/html" id="operateTpl">
  487. {{# if(d.state === '在职'){ }}
  488. <a class="layui-btn layui-btn-info layui-btn-xs" lay-event="details">详情</a>
  489. <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="hr">操作</a>
  490. {{# }else{ }}
  491. {{# if(d.state === '驳回'){ }}
  492. <span>已驳回</span>
  493. {{# }else{ }}
  494. <a class="layui-btn layui-btn-xs" lay-event="verify_pass">通过</a>
  495. <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="verify_reject">驳回</a>
  496. {{# } }}
  497. {{# } }}
  498. </script>
  499. <script type="text/html" id="disTpl">
  500. {{# if(d.disable === 0){ }}
  501. <input type="checkbox" value="{{d.id}}" lay-skin="switch" lay-text="ON|OFF" lay-filter="open" checked>
  502. {{# }else{ }}
  503. <input type="checkbox" value="{{d.id}}" lay-skin="switch" lay-text="ON|OFF" lay-filter="open">
  504. {{# } }}
  505. </script>
  506. <script type="text/html" id="disTpl-PC">
  507. {{# if(d.empcrm_disable === 0){ }}
  508. <input type="checkbox" value="{{d.id}}" lay-skin="switch" lay-text="ON|OFF" lay-filter="empcrm-open" checked>
  509. {{# }else{ }}
  510. <input type="checkbox" value="{{d.id}}" lay-skin="switch" lay-text="ON|OFF" lay-filter="empcrm-open">
  511. {{# } }}
  512. </script>
  513. <script type="text/html" id="disTpl-She">
  514. {{# if(d.community_disable === 0){ }}
  515. <input type="checkbox" value="{{d.id}}" lay-skin="switch" lay-text="ON|OFF" lay-filter="she-open" checked>
  516. {{# }else{ }}
  517. <input type="checkbox" value="{{d.id}}" lay-skin="switch" lay-text="ON|OFF" lay-filter="she-open">
  518. {{# } }}
  519. </script>
  520. <script type="text/html" id="disTpl-clue">
  521. {{# if(d.clue_disable === 0){ }}
  522. <input type="checkbox" value="{{d.id}}" lay-skin="switch" lay-text="ON|OFF" lay-filter="clue-open" checked>
  523. {{# }else{ }}
  524. <input type="checkbox" value="{{d.id}}" lay-skin="switch" lay-text="ON|OFF" lay-filter="clue-open">
  525. {{# } }}
  526. </script>
  527. <script>
  528. layui.config({
  529. base: '__LAYUI__/',
  530. }).extend({
  531. index: 'lib/index' //主入口模块
  532. }).use(['index', 'jquery', 'table', 'tree', 'layer'], function () {
  533. var table = layui.table,
  534. tree = layui.tree,
  535. layer = layui.layer,
  536. $ = layui.jquery,
  537. element = layui.element,
  538. form = layui.form;
  539. var field = {};
  540. form.on('submit(search)', function (data) {
  541. var disable = $('#disable').val();
  542. var keyword = $('.keyword').val();
  543. field['disable'] = disable;
  544. field['keyword'] = keyword;
  545. //执行重载
  546. table.reload('LAY-employee-list', {
  547. where: field
  548. , page: { curr: 1 }
  549. });
  550. });
  551. var orgstrucUrl = '{:url("employee/list")}';
  552. var colss = [
  553. { type: 'numbers', width: 80, title: '序号', fixed: 'left', align: 'center' },
  554. { title: '头像', templet: '#headTpl', width: 60, fixed: 'left', align: 'center' },
  555. { field: 'name', title: '姓名', fixed: 'left', width: 100, align: 'center' },
  556. { field: 'org_id', title: '部门', templet: '#strucTpl', fixed: 'left', width: 180, align: 'center' },
  557. { field: 'disable', title: '小程序准入', templet: '#disTpl', width: 110,align: 'center' },
  558. { field: 'empcrm_disable', title: 'PC-CRM准入', templet: '#disTpl-PC', width: 110,align: 'center' },
  559. { field: 'community_disable', title: '社群CRM准入', width: 110,templet: '#disTpl-She', align: 'center' },
  560. { field: 'last_login_time', width: 170,title: '最后登录时间' },
  561. { field: 'org_id', title: '操作', templet: '#operateTpl', fixed: 'right', width: 180, align: 'center'}
  562. ];
  563. {if $root == 2319 || $root == 994}
  564. var colss = [
  565. { type: 'numbers', width: 80, title: '序号', fixed: 'left', align: 'center' },
  566. { title: '头像', templet: '#headTpl', width: 60, fixed: 'left', align: 'center' },
  567. { field: 'name', title: '姓名', fixed: 'left', width: 100, align: 'center' },
  568. { field: 'org_id', title: '部门', templet: '#strucTpl', fixed: 'left', width: 180, align: 'center' },
  569. { field: 'disable', title: '小程序准入', templet: '#disTpl',width: 110, align: 'center' },
  570. { field: 'empcrm_disable', title: 'PC-CRM准入', width: 110,templet: '#disTpl-PC', align: 'center' },
  571. { field: 'community_disable', title: '社群CRM准入',width: 110, templet: '#disTpl-She', align: 'center' },
  572. { field: 'clue_disable',title: '线索',templet: '#disTpl-clue',width: 110,align: 'center'},
  573. { field: 'last_login_time', width: 170,title: '最后登录时间' },
  574. { field: 'org_id', title: '操作', templet: '#operateTpl', fixed: 'right', width: 180, align: 'center'}
  575. ];
  576. {/if}
  577. table.render({
  578. elem: '#LAY-employee-list',
  579. url: orgstrucUrl,
  580. cols: [colss],
  581. page: true,
  582. limit: 10,
  583. limits: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
  584. height: 'full-200',
  585. text: '对不起,加载出现异常!'
  586. });
  587. //事件
  588. var active = {
  589. invite: function () {
  590. var id = $('#root-list').find('.selected').data('id');
  591. layer.open({
  592. type: 2,
  593. title: ['邀请人员', 'color:#333333;background-color:#D8E6F1;'],
  594. content: '{:url("employee/invite")}?id=' + id,
  595. resize: false,
  596. area: ['80%', '80%']
  597. });
  598. },
  599. verifyapplier: function () {
  600. table.reload('LAY-employee-list', {
  601. where: {
  602. verified: 0
  603. }
  604. , page: { curr: 1 }
  605. });
  606. $('#verifyapplier').hide();
  607. $('#employeelist').show();
  608. $('#employeelist_all').show();
  609. },
  610. employeelist: function () {
  611. table.reload('LAY-employee-list', {
  612. where: {
  613. verified: 1
  614. }
  615. , page: { curr: 1 }
  616. });
  617. $('#verifyapplier').show();
  618. $('#employeelist').hide();
  619. $('#employeelist_all').hide();
  620. }
  621. }
  622. $('.layui-btn.layuiadmin-btn-admin').on('click', function () {
  623. var type = $(this).data('type');
  624. active[type] ? active[type].call(this) : '';
  625. });
  626. //////
  627. table.on('tool(LAY-employee-list)', function (obj) {
  628. var data = obj.data;
  629. if (obj.event === 'details') {
  630. layer.open({
  631. type: 2,
  632. title: ['人员详情', 'color:#333333;background-color:#D8E6F1;'],
  633. content: '{:url("employee/details")}?employeeid=' + data.id,
  634. resize: false,
  635. area: ['80%', '80%']
  636. });
  637. }
  638. if (obj.event === 'grant') {
  639. layer.open({
  640. type: 2,
  641. title: ['关联权限组', 'color:#333333;background-color:#D8E6F1;'],
  642. content: '{:url("employee/grant")}?employeeid=' + data.id,
  643. resize: false,
  644. area: ['80%', '80%']
  645. });
  646. }
  647. if (obj.event === 'hr') {
  648. layer.open({
  649. type: 2,
  650. title: ['人员异动', 'color:#333333;background-color:#D8E6F1;'],
  651. content: '{:url("employee/hr")}?employeeid=' + data.id,
  652. resize: false,
  653. area: ['80%', '80%']
  654. });
  655. }
  656. if (obj.event === 'delete') {
  657. layer.confirm('确定删除此员工?', { title: ['信息', 'color:#333333;background-color:#D8E6F1;'] }, function (index) {
  658. $.ajax({
  659. url: '{:url("employee/delete")}',
  660. data: {
  661. empid: data.id
  662. },
  663. type: 'post',
  664. success: function (res) {
  665. if (res.code === 0) {
  666. layer.msg(res.msg, { anim: 0 });
  667. } else {
  668. layer.msg(res.msg, { anim: 6 });
  669. }
  670. }
  671. });
  672. obj.del();
  673. layer.close(index);
  674. });
  675. }
  676. if (obj.event === 'setleader' || obj.event === 'removeleader') {
  677. let isLeader = 'checked';
  678. isEmployee = 'checked';
  679. if (data.is_manager == 1) {
  680. isEmployee = '';
  681. } else {
  682. isLeader = ''
  683. }
  684. layer.open({
  685. title: ['职位设置', 'color:#333333;background-color:#D8E6F1;'],
  686. content: `<div class="layer-set-leader" style="display:flex;align-items:center;">员工设置:<input type="radio" name="empid" id="gl" value="1" ${isLeader}/><label for="gl" style="margin-left:5px;">管理员</label> <input type="radio" name="empid" value="0" id="yg" style="margin:0px 5px;" ${isEmployee}/><label for="yg">普通员工</label></div>`,
  687. yes: function (index, layero) {
  688. let is_manager = $(layero).find('input[type="radio"]:checked').val();
  689. let url = '{:url("employee/setleader")}';
  690. if (is_manager == 0) url = '{:url("employee/removeleader")}';
  691. if (data.is_manager == is_manager) {
  692. layer.close(index); return;
  693. }
  694. $.ajax({
  695. url: url,
  696. data: {
  697. empid: data.id,
  698. is_manager: is_manager
  699. },
  700. type: 'post',
  701. success: function (res) {
  702. if (res.code === 0) {
  703. layer.msg(res.msg, { anim: 0 });
  704. table.reload('LAY-employee-list');
  705. } else {
  706. layer.msg(res.msg, { anim: 6 });
  707. }
  708. }
  709. });
  710. }
  711. });
  712. }
  713. if (obj.event === 'verify_pass') {
  714. layer.confirm('确定通过此人员?', { title: ['信息', 'color:#333333;background-color:#D8E6F1;'] }, function (index) {
  715. $.ajax({
  716. url: '{:url("employee/verifypass")}',
  717. data: {
  718. empid: data.id
  719. },
  720. type: 'post',
  721. success: function (res) {
  722. if (res.code === 0) {
  723. layer.msg(res.msg, { anim: 0 });
  724. table.reload('LAY-employee-list');
  725. } else {
  726. layer.msg(res.msg, { anim: 6 });
  727. }
  728. }
  729. });
  730. layer.close(index);
  731. });
  732. }
  733. if (obj.event === 'verify_reject') {
  734. layer.confirm('确定驳回此人员?', { title: ['信息', 'color:#333333;background-color:#D8E6F1;'] }, function (index) {
  735. $.ajax({
  736. url: '{:url("employee/verifyreject")}',
  737. data: {
  738. empid: data.id
  739. },
  740. type: 'post',
  741. success: function (res) {
  742. if (res.code === 0) {
  743. layer.msg(res.msg, { anim: 0 });
  744. table.reload('LAY-employee-list');
  745. } else {
  746. layer.msg(res.msg, { anim: 6 });
  747. }
  748. }
  749. });
  750. layer.close(index);
  751. });
  752. }
  753. });
  754. var jiaojie = function (from, to, callback) {
  755. return $.ajax({
  756. type: 'post',
  757. url: '{:url("org/receive")}',
  758. data: { from: from, to: to },
  759. success: function (res) {
  760. callback(res)
  761. }
  762. })
  763. }
  764. $('.list').off("click").on('click', '.group', function () {
  765. var that = $(this);
  766. var li = that.closest('li');
  767. if (that.hasClass('layui-icon-triangle-d')) {
  768. that.addClass('layui-icon-triangle-r');
  769. that.removeClass('layui-icon-triangle-d');
  770. li.find('ul').hide();
  771. } else {
  772. that.addClass('layui-icon-triangle-d');
  773. that.removeClass('layui-icon-triangle-r');
  774. li.find('ul').show();
  775. }
  776. });
  777. $('.list').off("mouseout").on("mouseout", "li", function (event) {
  778. $(this).eq(0).find('.layui-icon').css({ 'color': '#666' })
  779. $(this).eq(0).find('span').css({ 'color': '#666' })
  780. })
  781. $('.list').off("mouseover").on("mouseover", "li", function (event) {
  782. $(this).eq(0).find('.layui-icon').eq(0).css({ 'color': '#249efb' })
  783. $(this).eq(0).find('span').eq(0).css({ 'color': '#249efb' })
  784. event.stopPropagation();
  785. })
  786. var operate = {
  787. struct: function () {
  788. var that = this;
  789. that.send([], '{:url("org/struct")}', function (res) {
  790. if (res.code == 0) {
  791. $('.list').html(that.setStruct(res.data, '', 1));
  792. } else {
  793. $('.list').html('<span>' + res.msg + '</span>');
  794. }
  795. });
  796. },
  797. delete: function (id) {
  798. var that = this;
  799. $('.list').find('li').each(function () {
  800. if ($(this).data('id') !== id) return;
  801. orgObjSpan = $(this).find('span')[0];
  802. });
  803. this.send({ id: id }, '{:url("org/removenode")}', function (res) {
  804. if (res.code == 0) {
  805. that.struct();
  806. } else if (res.code == 2) {
  807. var html = '<option value="" >请选择接收部门</option>';
  808. var allUlLentth = $('.list ul').length;
  809. $('.list li').each(function () {
  810. var lid = $(this).data('id');
  811. if (lid == id) return;
  812. var thisUlLength = $(this).find('ul').length;
  813. var qz = '';
  814. for (var i = allUlLentth - thisUlLength; i > 1; i--) qz += '-';
  815. html += '<option value="' + lid + '" >' + qz + $(this).find('span').html() + '</option>';
  816. });
  817. $('#jjselect').html(html);
  818. form.render('select');
  819. layer.open({
  820. title: [res.msg, 'color:#333333;background-color:#D8E6F1;'],
  821. type: 1,
  822. content: $('#jiaojie'),
  823. btn: ['确定'],
  824. yes: function (index) {
  825. var jieshou = $('#jjselect').val();
  826. if (jieshou == '') {
  827. layer.msg('请选择接收部门', { anim: 6 });
  828. return false;
  829. }
  830. layer.close(index);
  831. jiaojie(id, jieshou, function (res) {
  832. if (res.code == 0) {
  833. that.struct();
  834. }
  835. });
  836. }
  837. });
  838. } else {
  839. layer.msg(res.msg, { anim: 6 });
  840. }
  841. });
  842. },
  843. add: function (data, jdom) {
  844. var that = this;
  845. this.send(data, '{:url("org/addnode")}', function (res) {
  846. if (res.code == 0) {
  847. that.struct();
  848. } else {
  849. layer.msg(res.msg, { anim: 6 });
  850. }
  851. });
  852. },
  853. edit: function (id) {
  854. var that = this;
  855. var orgObjSpan;
  856. $('.list').find('li').each(function () {
  857. if ($(this).data('id') !== id) return;
  858. orgObjSpan = $(this).find('span')[0];
  859. });
  860. var orgName = $(orgObjSpan).html();
  861. layer.prompt({ title: ['部门<span style="color:red">' + orgName + '</span>修改', 'color:#333333;background-color:#D8E6F1;'], value: orgName }, function (value, index) {
  862. that.send({ id: id, name: value }, '{:url("org/addnode")}', function (res) {
  863. if (res.code == 0) {
  864. $(orgObjSpan).html(value);
  865. table.reload('LAY-employee-list');
  866. } else {
  867. layer.msg(res.msg, { anim: 6 });
  868. }
  869. layer.close(index);
  870. });
  871. });
  872. },
  873. leader: function (id) {
  874. $('.leader-select').data('id', id);
  875. var that = this;
  876. that.send({ id: id }, '{:url("employee/orgEmployee")}', function (res) {
  877. if (res.code == 0) {
  878. var selected = $('.leader-select .selected ul');
  879. selected.html('');
  880. var select = $('.leader-select .select ul');
  881. select.html('');
  882. $('.leader-select .select').hide();
  883. res.data.forEach(function (elem) {
  884. if (elem.is_manager == 1) {
  885. selected.append('<li data-id="' + elem.id + '">' + elem.name + '<i class="layui-icon layui-icon-close"></i></li>');
  886. }
  887. select.append('<li data-id="' + elem.id + '">' + elem.name + '</li>');
  888. });
  889. layer.open({
  890. type: 1,
  891. title: ['设置负责人', 'color:#333333;background-color:#D8E6F1;'],
  892. content: $('.leader-select'),
  893. resize: false,
  894. btn: ['确认', '取消'],
  895. yes: function (index) {
  896. var id = $('.leader-select').data('id');
  897. var leader = [];
  898. $('.leader-select .selected li').each(function () {
  899. leader.push($(this).data('id'));
  900. });
  901. that.send({ id: id, leader: leader }, '{:url("org/leaders")}', function (res) {
  902. if (res.code == 0) {
  903. layer.msg(res.msg, { anim: 0 });
  904. } else {
  905. layer.msg(res.msg, { anim: 6 });
  906. }
  907. });
  908. layer.close(index);
  909. }
  910. });
  911. } else {
  912. layer.msg('员工信息获取失败', { anim: 6 });
  913. }
  914. });
  915. },
  916. transfer: function (id) {
  917. var that = this;
  918. var html = '<option value="" >请选择上级层级</option>';
  919. var allUlLentth = $('.list ul').length;
  920. var transferOrg;
  921. var child = [];
  922. $('.list li').each(function () {
  923. var lid = $(this).data('id');
  924. var level = $(this).data('level');
  925. if (child.indexOf(lid) >= 0) return;
  926. if (lid == id) {
  927. transferOrg = $(this);
  928. $(this).find('li').each(function () {
  929. child.push($(this).data('id'));
  930. });
  931. return;
  932. }
  933. var qz = '';
  934. for (var i = level; i > 0; i--) qz += '-';
  935. html += '<option value="' + lid + '" >' + qz + $(this).find('span').html() + '</option>';
  936. });
  937. $('#jjselect').html(html);
  938. form.render('select');
  939. layer.open({
  940. title: [transferOrg.find('span').html() + '部门转移层级', 'color:#333333;background-color:#D8E6F1;'],
  941. type: 1,
  942. content: $('#jiaojie'),
  943. resize: false,
  944. btn: ['确定'],
  945. yes: function (index) {
  946. var jieshou = $('#jjselect').val();
  947. if (jieshou == '') {
  948. layer.msg('请选择上级层级', { anim: 6 });
  949. return false;
  950. }
  951. layer.close(index);
  952. that.send({ id: id, pid: jieshou }, '{:url("org/transfer")}', function (res) {
  953. if (res.code == 0) {
  954. that.struct();
  955. table.reload('LAY-employee-list');
  956. } else {
  957. layer.msg(res.msg, { anim: 6 });
  958. }
  959. });
  960. }
  961. });
  962. },
  963. send: function (data, url, callback) {
  964. if (data.length == 0) {
  965. return $.ajax({
  966. type: 'get',
  967. url: url,
  968. success: function (res) {
  969. callback(res)
  970. }
  971. })
  972. }
  973. return $.ajax({
  974. type: 'post',
  975. url: url,
  976. data: data,
  977. success: function (res) {
  978. callback(res)
  979. }
  980. })
  981. },
  982. setStruct: function (data, org_type = 0,num) {
  983. var that = this;
  984. var html = '<ul>';
  985. data.forEach(function (elem, index) {
  986. let numstr=85;
  987. if(num==1){
  988. if (elem.all_count > 1000) {
  989. numstr =100
  990. }else{
  991. numstr=92;
  992. }
  993. }else{
  994. if(elem.children.length==0&& org_type == 0){
  995. if (elem.all_count > 1000) {
  996. numstr = 105;
  997. } else if (elem.all_count > 100) {
  998. numstr = 95;
  999. } else {
  1000. numstr = 95;
  1001. }
  1002. }else{
  1003. if (elem.all_count > 1000){
  1004. numstr = 124;
  1005. }else if (elem.all_count > 100) {
  1006. numstr = 115;
  1007. } else {
  1008. numstr = 115;
  1009. }
  1010. }
  1011. }
  1012. html += `<li data-id="${elem.id}" data-level="${elem.level}" data-type="${org_type}" data-istype="${elem.org_type}"><div>`;
  1013. if (elem.children.length !== 0)
  1014. html += '<i class="group layui-icon layui-icon-triangle-r layui-icon-triangle-d"></i>';
  1015. else if (org_type !== 0)
  1016. html += '<i class="layui-icon layui-icon-user"></i>';
  1017. html += '<span class="title " style="max-width: calc( 100% - '+ numstr +'px ) ;">' + elem.title + '</span>';
  1018. html += '<span>(' + elem.all_count + ')</span>';
  1019. // if (org_type == 0) {
  1020. if (elem.org_type == 1) {
  1021. html += '<span class="org-type">销</span>';
  1022. } else if (elem.org_type == 2) {
  1023. html += '<span class="org-type org-blue">设</span>';
  1024. }
  1025. // }
  1026. html += '<i class="op layui-icon layui-icon-add-1"></i>';
  1027. html += '<i class="op layui-icon layui-icon-more"></i></div>';
  1028. if (elem.children.length > 0) {
  1029. html += that.setStruct(elem.children, elem.org_type, num * 1 + 1);
  1030. }
  1031. html += '</li>';
  1032. });
  1033. html += '</ul>';
  1034. return html
  1035. }
  1036. }
  1037. // 结构初始化
  1038. operate.struct();
  1039. // 菜单操作
  1040. $('.tree').on('click', '.op', function (event) {
  1041. var that = $(this);
  1042. var li = that.closest('li');
  1043. var id = li.data('id');
  1044. var title = that.siblings('.title').html();
  1045. if (that.hasClass('layui-icon-more')) {
  1046. if ($('.list li').length == li.find('li').length + 1) {
  1047. var opdiv = $('#first');
  1048. } else {
  1049. var opdiv = $('#structOp');
  1050. }
  1051. opdiv.data('id', id);
  1052. opdiv.css('top', event.clientY);
  1053. opdiv.css('left', event.clientX - 90);
  1054. opdiv.show();
  1055. $('.layerbox').show();
  1056. } else {
  1057. let mOrgType = li.data('istype');
  1058. let selectHtml = '';
  1059. var root = '{$root}';
  1060. if (mOrgType != 2)
  1061. selectHtml = `<div style="display:flex;align-items:center;margin-bottom: 10px;">选择部门:<input name="org_type" value="1" type="radio" checked style="margin-right:5px;" id="xs"/><label for="xs" style="margin-right:15px;">销售部</label><input name="org_type" value="2" type="radio" id="sjs"/><label for="sjs" style="padding-left:5px;">设计师部</label></div>`
  1062. layer.open({
  1063. title: ['添加<span style="color:red;">' + title + '</span>的子部门', 'color:#333333;background-color:#D8E6F1;'],
  1064. content: `${selectHtml}<div class="">部门名称:<input type="text"/></div>`,
  1065. resize: false,
  1066. yes: function (index, layero) {
  1067. let org_type = $(layero).find('input[type="radio"]:checked').val();
  1068. let name = $(layero).find('input[type="text"]').val();
  1069. operate.add({ org_type, name, pid: id }, li);
  1070. layer.close(index);
  1071. }
  1072. });
  1073. }
  1074. });
  1075. $('.layerbox').on('click', function () {
  1076. var opdiv = $('.operate');
  1077. opdiv.hide();
  1078. $('.layerbox').hide();
  1079. opdiv.data('id', 0);
  1080. })
  1081. $('.operate li').off('click').on('click', function () {
  1082. var id = $(this).closest('div').data('id');
  1083. var event = $(this).data('event');
  1084. operate[event] ? operate[event](id) : '';
  1085. var opdiv = $('.operate');
  1086. opdiv.hide();
  1087. $('.layerbox').hide();
  1088. opdiv.data('id', 0);
  1089. });
  1090. $('.list').on('click', 'span', function () {
  1091. $('.list li').removeClass('addspancolor');
  1092. var id = $(this).closest('li').data('id');
  1093. $(this).closest('li').eq(0).addClass('addspancolor');
  1094. table.reload('LAY-employee-list', {
  1095. where: {
  1096. orgid: id
  1097. }
  1098. , page: { curr: 1 }
  1099. });
  1100. });
  1101. $('.leader-select .selected .show').click(function () {
  1102. var select = $('.leader-select .select');
  1103. if (select.is(':hidden')) {
  1104. select.show();
  1105. } else {
  1106. select.hide();
  1107. }
  1108. });
  1109. $('.leader-select .select').on('click', 'li', function () {
  1110. var selected = $('.leader-select .selected ul');
  1111. var id = $(this).data('id');
  1112. var name = $(this).text();
  1113. var had = false;
  1114. $('.leader-select .selected li').each(function () {
  1115. if ($(this).data('id') !== id) return;
  1116. had = true;
  1117. });
  1118. if (!had)
  1119. selected.append('<li data-id="' + id + '">' + name + '<i class="layui-icon layui-icon-close"></i></li>');
  1120. })
  1121. $('.leader-select .selected').on('click', 'li i', function () {
  1122. $(this).closest('li').remove();
  1123. })
  1124. //一键审核
  1125. $("#employeelist_all").click(function () {
  1126. // 单击之后提交按钮不可选,防止重复提交
  1127. var DISABLED = 'layui-btn-disabled';
  1128. var target = '#employeelist_all';
  1129. $(target).addClass(DISABLED);
  1130. $(target).attr('disabled', 'disabled');
  1131. $.ajax({
  1132. url: '{:url("employee/verifypass_all")}',
  1133. type: 'post',
  1134. success: function (res) {
  1135. if (res.code === 0) {
  1136. layer.msg(res.msg, { anim: 0 });
  1137. table.reload('LAY-employee-list');
  1138. // $(target).removeClass(DISABLED);
  1139. // $(target).removeAttr('disabled');
  1140. } else {
  1141. layer.msg(res.msg, { anim: 6 });
  1142. }
  1143. },
  1144. error: function (res) {
  1145. $(target).removeClass(DISABLED);
  1146. $(target).removeAttr('disabled');
  1147. }
  1148. });
  1149. });
  1150. $(".rander").click(function () {
  1151. $.ajax({
  1152. url: '{:url("employee/verifypass_count")}',
  1153. type: 'post',
  1154. success: function (res) {
  1155. var DISABLED = 'layui-btn-disabled';
  1156. var target = '#employeelist_all';
  1157. if (res > 0) {
  1158. $(target).removeClass(DISABLED);
  1159. $(target).removeAttr('disabled');
  1160. } else {
  1161. $(target).addClass(DISABLED);
  1162. $(target).attr('disabled', 'disabled');
  1163. }
  1164. },
  1165. error: function (res) {
  1166. }
  1167. });
  1168. });
  1169. form.on('switch(open)', function (data) {
  1170. var id = data.value;
  1171. $.ajax({
  1172. type: "post",
  1173. url: '{:url("employee/disable")}',
  1174. data: {
  1175. id: id,
  1176. disable: data.elem.checked,
  1177. type: 1
  1178. },
  1179. success: function (res) {
  1180. layer.msg(res.msg, { time: 2000 });
  1181. }
  1182. });
  1183. });
  1184. form.on('switch(empcrm-open)', function (data) {
  1185. var id = data.value;
  1186. $.ajax({
  1187. type: "post",
  1188. url: '{:url("employee/disable")}',
  1189. data: {
  1190. id: id,
  1191. disable: data.elem.checked,
  1192. type: 2
  1193. },
  1194. success: function (res) {
  1195. layer.msg(res.msg, { time: 2000 });
  1196. }
  1197. });
  1198. });
  1199. form.on('switch(she-open)', function (data) {
  1200. var id = data.value;
  1201. $.ajax({
  1202. type: "post",
  1203. url: '{:url("employee/disable")}',
  1204. data: {
  1205. id: id,
  1206. disable: data.elem.checked,
  1207. type: 3
  1208. },
  1209. success: function (res) {
  1210. layer.msg(res.msg, { time: 2000 });
  1211. }
  1212. });
  1213. });
  1214. form.on('switch(clue-open)', function (data) {
  1215. var id = data.value;
  1216. $.ajax({
  1217. type: "post",
  1218. url: '{:url("employee/disable")}',
  1219. data: {
  1220. id: id,
  1221. disable: data.elem.checked,
  1222. type: 4
  1223. },
  1224. success: function (res) {
  1225. layer.msg(res.msg, { time: 2000 });
  1226. }
  1227. });
  1228. });
  1229. });
  1230. </script>
  1231. </body>
  1232. {/block}