123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699 |
- {extend name="public/layout" /} {block name="title"}资源库管理{/block} {block name="body"}
- <link rel="stylesheet" href="__LAYUI__/layui/css/layui.css" media="all">
- <link rel="stylesheet" " href=" /static/css/common.css">
- <script src="/static/js/jquery.min.js"></script>
- <style type="text/css">
- body {
- padding-bottom: 40px;
- }
- body {
- font-size: 12px;
- font-family: "宋体";
- }
- .layui-table-body::-webkit-scrollbar {
- height: 8px;
- }
- .layui-table-body::-webkit-scrollbar-thumb {
- border-radius: 10px;
- -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
- background: #DFDFDF;
- }
- .layui-table-body::-webkit-scrollbar-track {
- -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
- border-radius: 10px;
- background: #f5f5f5;
- }
- .layui-table-view{
- margin-top: 0 !important;
- }
- .layui-table{
- color: #000000;
- }
- .layui-table-box,.layui-table-view{
- height: max-content !important;
- }
- .layui-box.layui-laypage.layui-laypage-default{
- float: right;
- }
- label,select,option,input,a{
- color: #000000;
- }
- .searchtitlebox {
- display: block;
- padding: 15px 10px;
- border: 1px solid #F0F0F0;
- background: #FCFCFC;
- margin-top: 5px;
- margin-bottom: 10px;
- /* position: relative; */
- min-width: 800px;
- }
- .searchbox {
- display: block;
- margin-top: 8px;
- text-align: center;
- }
- .searchbox input {
- display: inline-block;
- height: 26px;
- line-height: 26px;
- padding-left: 3px;
- vertical-align: middle;
- }
- .searchbox .searchbtn {
- display: inline-block;
- float: right;
- border: none;
- width: 98px;
- height: 30px;
- color: #fff;
- font-size: 14px;
- font-weight: bold;
- text-align: center;
- background: url(__STATIC__/img/icon-sub.png) no-repeat;
- cursor: pointer;
- vertical-align: middle;
- }
- .selectbox {
- float: left;
- display: flex;
- }
- .leftselect {
- float: left;
- height: 26px;
- line-height: 26px;
- }
- .selectbox select {
- float: left;
- height: 26px;
- }
- .searchtext {
- border: 1px solid #ccc;
- background: #fff url(__STATIC__/img/icon071402.png) no-repeat;
- padding: 1px 2px;
- height: 24px;
- line-height: 24px;
- vertical-align: middle;
- text-indent: 3px;
- margin-left: 4px;
- }
- .searchbtn1 {
- margin-left: 4px;
- cursor: pointer;
- color: #000;
- background: url(__STATIC__/img/btn_bg.gif) repeat-x;
- border: 1px solid #C0C0C0;
- padding: 0 12px;
- *padding: 0 6px;
- height: 26px;
- }
- .input-indent-box-small {
- display: inline;
- width: 20%;
- }
-
- .namelink {
- color: #3483d5;
- }
- .namelink:hover {
- color: mediumblue;
- text-decoration-line: underline;
- cursor: pointer;
- }
- .layui-input-inline-right {
- float: right;
- /*width: 190px;*/
- margin-right: 10px;
- display: flex;
- }
-
- .layui-col-md2.layui-col-xs2.layui-col-sm2 {
- min-width: 200px;
- }
- .layui-col-md12.layui-col-xs12.layui-col-sm12 {
- display: flex;
- }
- .layui-btn-primary {
- color: #249EFB;
- border: 1px solid #249EFB;
- }
- .layui-btn-primary:hover {
- background-color: #E3F7FF;
- color: #249EFB;
- }
- .layui-btn-xs,
- .layui-btn-xs:hover {
- border: 1px solid #249EFB;
- background-color: #fff;
- color: #249EFB;
- padding: 0px 10px;
- }
- .layui-table-body {
- max-height: 670px !important;
- height: auto !important;
- }
- </style>
- <body>
- <iframe id="customer_detail" style="display: none;" src=""></iframe>
- <div class="resourcebox">
- <form id="newform" class="layui-form">
- <div class="searchtitlebox">
- <div style="margin-bottom:8px;">您当前的操作 · <b>资源库分配</b> </div>
- <div class="searchbox clearfix">
- <div class="selectbox">
- <div class="leftselect">检索:</div>
- <select name="state" lay-filter="state" id="state" >
- <option value="">==分配情况==</option>
- <option value=0>未分配</option>
- <option value=1>已分配</option>
- </select>
-
- <select name="source" lay-filter="source" id="source" lay-search>
- <option value="">==渠道来源==</option>
- {volist name='source' id='v'}
- <option value="{$v.id}">{$v.source}</option>
- {/volist}
- </select>
- <input class="left searchtext" type="text" name="addtime" id="addtime" style="width: 170px;"
- placeholder="请选择添加时间" readonly>
- <button class="left searchbtn1" type="button" id="search" lay-filter="LAY-app-contlist-search">搜索</button>
- </div>
- <button class="searchbtn" type="button" id="importcustomer">添加资源</button>
- </div>
- </div>
- </form>
- <div class="crmsearchlist">
- <table id="pool_customer_table" lay-filter="pool_customer_table"></table>
- </div>
- </div>
- </body>
- <script src="__LAYUI__/layui/layui.js"></script>
- {/block} {block name="js"}
- <script type="text/html" id="op">
- {{# if(d.status == 2||d.status == 0){ }}
- {{# if(d.left_num > 0){ }}
- <!-- <a class="layui-btn layui-btn-xs layui-btn-success" lay-event="patchdistribute">批量分配</a>
- <a class="layui-btn layui-btn-xs layui-btn-warm" lay-event="distribute" href="{:url('crm/resourcepool')}?cilid={{d.id}}">手动分配</a> -->
- <a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="distribution">批量分配</a> <!--新版本-->
- <a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="handdistribution">手动分配</a> <!--新版本-->
- {{# }else{ }}
- <!-- <a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="details">详情</a> 旧版本-->
- {{# } }}
-
- <a class="layui-btn layui-btn-xs" lay-event="read">详情</a> <!--新版本-->
- {{# if(d.pid == 0){ }}
- <a class="layui-btn layui-btn-xs" lay-event="delete_new">删除</a> <!--新版本-->
- {{# }else{ }}
- <a class="layui-btn layui-btn-xs" style="color: #cccccc; border-color: #cccccc;">删除</a>
- {{# } }}
- {{# } }}
- {{# if(d.status == 3){ }}
- <a class="layui-btn layui-btn-xs" lay-event="delete_new">删除</a> <!--新版本-->
- {{# } }}
-
- {{# if(d.status == 1){ }}
- <span>资源正在上传中,请稍后刷新页面...</span>
- {{# } }}
- <!-- <a class="layui-btn layui-btn-xs layui-btn-warm" lay-event="withdrawl">回收</a>-->
- <!-- <a class="layui-btn layui-btn-xs " lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>-->
-
- </script>
- <script type="text/html" id="empTpl">
- {{# if(d.employee_name){ }}
- <span>{{d.employee_name}}</span>
- {{# }else{ }}
- <span>无</span>
- {{# } }}
- </script>
- <script type="text/html" id="stateTpl">
- {{# if(d.state == 0){ }}
- <span style="color:green">未分配</span>
- {{# }else{ }}
- <span>已分配</span>
- {{# } }}
- </script>
- <script type="text/html" id="nameTpl">
- {{# if(d.left_num > 0){ }}
- <p class="namelink" lay-event="read">{{d.name}}</p>
- <!-- <a class="namelink" lay-event="distribute" href="{:url('crm/resourcepool')}?cilid={{d.id}}">{{d.name}}</a> -->
- {{# }else{ }}
- <span>{{d.name}}</span>
- {{# } }}
- </script>
- <script type="text/html" id="sources">
- {{# if(d.source != ''){ }}
- <span>{{d.source_name}}</span>
- {{# }else{ }}
- <span style="color: #cccccc;">无</span>
- {{# } }}
- </script>
- <script>
- var opoo=function(){};
- var orgids_str = '{:$orgids}';
- var orgids = JSON.parse(orgids_str);
- var pool = eval('{$pool|raw}');
- var org = eval('{$org|raw}');
- var reload = null, resizefun = null, assignCustomerFunc=null;
- layui.config({
- base: '__LAYUI__/' //静态资源所在路径
- , urlbase: '/sys'
- }).extend({
- index: 'lib/index' //主入口模块
- }).use(['index', 'table', 'layedit', 'element', 'upload', 'laydate'], function () {
- var $ = layui.$,
- table = layui.table,
- element = layui.element,
- upload = layui.upload,
- laydate = layui.laydate,
- form = layui.form;
- $('#pool').append(setOrgOption(pool, ''));
- form.render('select');
- laydate.render({
- elem: '#addtime'
- , type: 'date'
- , range: '--'
- , format: 'yyyy-MM-dd'
- , trigger: 'click'
- });
- $('#pool_struc').append(setOrgPoolTree(org, 'space', 'wrap'));
- form.render();
- let empid = '{:$empid}';
-
- $('#resetBtn').on('click',function(){
- $('#newform')[0].reset();
- table.reload('pool_customer_table', {
- page: {
- curr: 1 //重新从第 1 页开始
- }
- , where: {
- state: '', //在表格中进行搜索
- source: '',
- person: '',
- start_date: '',
- end_date: ''
- }
- });
- })
- reload=function(){
- table.reload('pool_customer_table')
- }
- document.onkeydown=function(event){
- var e = event || window.event || arguments.callee.caller.arguments[0];
- if(e && e.keyCode==13){
- $(".submitbtn").trigger("click");
- }
- };
- table.render({
- elem: '#pool_customer_table'
- , url: '{:url("resource")}' //数据接口
- , page: true //开启分页
- , limits: [17]
- , limit: 17 //每页默认显示的数量,
- , height: 'full-150'
- , autoSort: false
- , cols: [[ //表头
- // { type: 'checkbox', fixed: 'left', minWidth: 80},
- { type: 'numbers', field: 'id', title: '编号', minWidth: 60, fixed: 'left' }
- , { field: 'name', title: '资源名称', templet: '#nameTpl', minWidth: 260, fixed: 'left' }
- , { field: 'source', title: '来源渠道', minWidth: 100, templet: '#sources' }
- , { field: 'employee_id', title: '导入人员', minWidth: 100, templet: '#empTpl' }
- , { field: 'count', title: '资源数', minWidth: 80 }
- , { field: 'avaliable_count', title: '可分资源', minWidth: 80 }
- , { field: 'bad_phone_num', title: '问题客资', minWidth: 80 }
- // , { field: 'repeat_phone_number', title: '重复数', minWidth: 80 }
- , { field: 'state_name', title: '分配情况', minWidth: 80 }
- , { field: 'y_count', title: '已分配', minWidth: 80 }
- , { field: 'left_num', title: '未分配', minWidth: 80 }
- , { field: 'addtime', title: '添加时间', sort: true, minWidth: 170 }
- , { templet: '#op', title: '操作', minWidth: 320, fixed: 'right' }
- ]]
- , done: function (res, curr, count) {
- //隐藏列
- if (res.org != 0) {
- $(".layui-table-box").find("[data-field='avaliable_count']").css("display", "none");
- $(".layui-table-box").find("[data-field='bad_phone_num']").css("display", "none");
- $(".layui-table-box").find("[data-field='repeat_phone_num']").css("display", "none");
- $(".layui-table-box").find("[data-field='error_phone_num']").css("display", "none");
- }
- }
- });
- assignCustomerFunc = function (id, count, str) {
- window.parent.openbuildfun('{:url("manager_emp/distribution")}?id=' + id + '&distribution={:url("manager_emp/read_new")}&count=' + count + '&customer_id=' + str);
- /**layer.open({
- type: 2,
- title: ['批量分配', 'color:#333333;background-color:#D8E6F1;'],
- content: '{:url("manager_emp/distribution")}?id=' + id + '&count=' + count + '&customer_id=' + str,
- resize: false,
- area: ['90%', '90%'],
- });**/
- }
-
-
- window.call_cuslist = function(id){
- layer.open({
- type: 2,
- title: ['外呼电话', 'color:#333333;background-color:#D8E6F1;'],
- content: '{:url("manager_emp/call_cuslist")}?customer_id=' + id ,
- resize: false,
- area: ['90%', '90%'],
- });
- }
-
- table.on('tool(pool_customer_table)', function (obj) {
- var id = obj.data.id;
- var empname = obj.data.employee_name;
- var layEvent = obj.event;
- if (layEvent === 'tracking') {
- layer.open({
- type: 2,
- title: ['跟进记录', 'color:#333333;background-color:#D8E6F1;'],
- content: '{:url("crm/tracking")}?id=' + id,
- resize: false,
- area: ['80%', '80%']
- });
- } else if (layEvent === 'foot') {
- layer.open({
- type: 2,
- title: ['客户足迹', 'color:#333333;background-color:#D8E6F1;'],
- content: '{:url("crm/foot")}?id=' + id,
- resize: false,
- area: ['80%', '80%']
- });
- } else if (layEvent === 'details') {
- layer.open({
- type: 2,
- title: ['分配详情', 'color:#333333;background-color:#D8E6F1;'],
- content: '{:url("manager_emp/cil_detail")}?cilid=' + id,
- resize: false,
- area: ['80%', '80%']
- });
- } else if (layEvent === 'patchdistribute') {
- // $('#patchdistribute').on('click', function () {
- layer.open({
- type: 2,
- title: ['批量分配客户', 'color:#333333;background-color:#D8E6F1;'],
- content: '{:url("manager_emp/patchdistribute")}?empid=' + empid + '&cilid=' + id,
- resize: false,
- area: ['80%', '80%'],
- });
- // });
- } else if (layEvent == 'distribution') {
- window.parent.openbuildfun('{:url("manager_emp/distribution")}?id=' + id + '&distribution={:url("manager_emp/resource")}&count=' + obj.data.left_num);
- //迭代分配页面
- /**layer.open({
- type: 2,
- title: ['批量分配', 'color:#333333;background-color:#D8E6F1;'],
- content: '{:url("manager_emp/distribution")}?id=' + id + '&count=' + obj.data.left_num,
- resize: false,
- area: ['80%', '80%'],
- });**/
- } else if (layEvent == 'read') {
- window.parent.openbuildfun('{:url("manager_emp/read_new")}?id=' + id + '&empname=' + empname + '&readistribution={:url("manager_emp/resource")}');
- /**layer.open({
- type: 2,
- skin: 'read_new',
- title: ['详情', 'color:#333333;background-color:#D8E6F1;'],
- content: '{:url("manager_emp/read_new")}?id=' + id,
- resize: false,
- shade: 0,
- offset: 'r',
- area: ['80%', '100%'],
- success: function (layero, index) {
- $('.read_new').animate({ 'right': '0' }, 500);
- },
- cancel: function (layero, index) {
- $('.read_new').animate({ 'right': '-80%' }, 500);
- setTimeout(function () {
- $('.read_new').remove();
- }, 500)
- return false;
- }
- });**/
- } else if (layEvent == 'delete_new') {
- //删除资源,,只能删除一次都没有分配过的资源
- layer.confirm('确定删除这条资源?', { title: ['信息', 'color:#333333;background-color:#D8E6F1;'], }, function (index) {
- $.ajax({
- type: 'post',
- url: "{:url('manager_emp/delete_new')}",
- data: {
- id: id
- },
- success: function (res) {
- if (res.code == 0) {
- layer.msg(res.msg, {
- anim: 0
- }, function () {
- //执行重载
- table.reload('pool_customer_table');
- // obj.del();
- // layer.close(index);
- });
- }else if(res.code == 403){
- $(".exitbtn").trigger("click");
- }else {
- layer.msg(res.msg, {
- anim: 6
- });
- }
- }
- });
- });
- } else if (layEvent == 'handdistribution') {
- //手动分配跳转到详情页未分配页面
- window.parent.openbuildfun('{:url("manager_emp/read_new")}?type=1&id=' + id+'&handdistribution={:url("manager_emp/resource")}' );
- /**layer.open({
- type: 2,
- title: ['详情', 'color:#333333;background-color:#D8E6F1;'],
- content: '{:url("manager_emp/read_new")}?type=1&id=' + id,
- resize: false,
- area: ['80%', '80%'],
- });**/
- }
- });
-
-
- table.on('sort(pool_customer_table)', function (obj) {
- table.reload('pool_customer_table', {
- initSort: obj
- , where: {
- order: obj.field + ' ' + obj.type
- }
- });
- });
- $('.treenodetext').on('click', function () {
- $('.treenodetext').each(function () {
- if ($(this).hasClass('tree-node-current')) {
- $(this).removeClass('tree-node-current');
- }
- });
- $(this).addClass('tree-node-current');
- //console.log( $(this).data('value'));
- table.reload('pool_customer_table', {
- where: { org_pool: $(this).data('value') }
- });
- return false;
- })
- // form.on('select(org_select_pool)', function (data) {
- // console.log(data)
- // table.reload('pool_customer_table', {
- // where: {org_pool:data.value}
- // });
- // return false;
- // });
- // form.on('submit(search)', function (data) {
- // table.reload('pool_customer_table', {
- // where: data.field
- // });
- // return false;
- // });
- $('#importcustomer').on('click', function () {
- window.parent.openbuildfun('{:url("manager_emp/importing")}?weburl={:url("manager_emp/resource")}');
- //layer.open({
- // type: 2,
- // title: ['公海客户添加', 'color:#333333;background-color:#D8E6F1;'],
- // content: '{:url("manager_emp/importing")}',
- // resize: false,
- // area: ['50%', '600px'],
- //});
- });
- $('#label_setting').on('click', function () {
- layer.open({
- type: 2,
- title: ['标识设置', 'color:#333333;background-color:#D8E6F1;'],
- content: '{:url("crm/label")}',
- resize: false,
- area: ['50%', '600px']
- });
- });
- $('#addpool').on('click', function () {
- layer.open({
- type: 2,
- title: ['公海设置', 'color:#333333;background-color:#D8E6F1;'],
- content: '{:url("crm/addpool")}?empid=' + empid,
- resize: false,
- area: ['80%', '80%']
- });
- });
- //日期范围
- laydate.render({
- elem: '#start_date',
- trigger: 'click'//呼出事件改成click
- });
- laydate.render({
- elem: '#end_date',
- trigger: 'click'//呼出事件改成click
- });
- //搜索
- $('#search').click(function () {
- var state = $('#state').val();
- var source = $('#source').val();
- var person = $('#person').val();
- var time=$('#addtime').val();
- var start_date = time.split('--')[0];
- var end_date = time.split('--')[1];
- //执行重载
- table.reload('pool_customer_table', {
- page: {
- curr: 1 //重新从第 1 页开始
- }
- , where: {
- state: state, //在表格中进行搜索
- source: source,
- person: person,
- start_date: start_date? start_date:'',
- end_date: end_date? end_date:''
- }
- });
- });
- });
- function setOrgPoolTree(opt, sj, wr, ch) {
- var html = '';
- var i = 0;
- opt.forEach(element => {
- if (ch == 1) {
- 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>';
- if (element.children.length > 0) html += setOrgPoolTree(element.children, sj + 'o', wr + 'o', 1);
- html += '</div>';
- } else {
- if (i == 0) {
- 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>';
- } else {
- 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>';
- }
- if (element.children.length > 0) html += setOrgPoolTree(element.children, sj + 'o', wr + 'o', 1);
- }
- i++;
- });
- return html;
- }
- // function setOrgPoolTree(opt, sj) {
- // var html = '';
- // opt.forEach(element => {
- //
- // html += '<p class="tree"><span class="treenode '+ sj +'" data-value="' + element.id + '">'+ element.title + ' 资源库</span></p>';
- //
- // if (element.children.length > 0) html += setOrgPoolTree(element.children, sj + 'o');
- //
- // });
- //
- // return html;
- // }
- function setOrgPoolOption(opt, sj) {
- var html = '';
- opt.forEach(element => {
- // if(orgids.length > 0){
- // if(in_array(element.id,orgids)) {
- html += '<p><span class="treenode" data-value="' + element.id + '">' + sj + element.title + ' 资源库</span></p>';
- // }
- // }
- if (element.children.length > 0) html += setOrgPoolOption(element.children, sj + '-');
- });
- return html;
- }
- function setOrgOption(opt, sj) {
- var html = '';
- opt.forEach(element => {
- if (orgids.length > 0) {
- if (in_array(element.org_id, orgids)) {
- // html += '<option value="' + element.id + '">' + sj + element.name + '</option>';
- if (element.level > 0) {
- var gapstr = '';
- for (let i = 0; i < element.level; i++) {
- gapstr += '-';
- };
- html += '<option value="' + element.id + '">' + gapstr + element.name + '</option>';
- }
- }
- }
- // if (element.children.length > 0) html += setOrgOption(element.children, sj + '-');
- });
- return html;
- }
- function in_array(search, array) {
- for (var i in array) {
- if (array[i] == search) {
- return true;
- }
- }
- return false;
- }
- </script>
- {/block}
|