| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302 |
- //代办搜索
- $(".db").click(function() {
- initTable()
- })
- //导出
- $('.export').click(function() {
- var params = dataParam()
- params.isdc = 1;
- exportFileFun(apiUrl, params)
- })
- $("#workorderlist").on("click-row.bs.table", function(e, row, ele) {
- $('.success').removeClass('success'); //去除之前选中的行的,选中样式
- $(ele).addClass('success'); //添加当前选中的 success样式用于区别
- });
- function initTable() {
- $.ajax({
- url: huayi.config.callcenter_url + apiUrl,
- type: 'get',
- data: dataParam(),
- dataType: "json",
- async: true,
- success: function(data) {
- if(data.data && data.data.length > 0) {
- columnsArray = []
- var result = data.data[0]
- var key = Object.keys(result)
- for(var i = 0; i < key.length; i++) {
- var title = key[i];
- var obj = {
- title: title,
- align: 'center',
- field: title //这里循环时field是bean的属性,动态数据加载,这里是个坑 我的bean是两层嵌套的,得按列数来查里面一层的beanList的第几个。这里这样写达不到效果,是个大坑
- }
- if(columnsWidth) {
- obj.width = columnsWidth
- }
- columnsArray.push(obj);
- }
- } else {
- columnsArray = []
- data.data = []
- }
- $('#workorderlist').bootstrapTable('destroy');
- $('#workorderlist').bootstrapTable({
- columns: columnsArray,
- data: data.data
- });
- }
- });
- }
- // 导出列表
- function exportFileFun(api, params) {
- var url = huayi.config.callcenter_url + api;
- if(typeof(params) !== "object") {
- return
- }
- // 分页为空
- Object.keys(params).forEach(function(key, index) {
- if(index === 0) {
- url += `?${key}=${params[key]}`
- } else {
- url += `&${key}=${params[key]}`
- }
- })
- window.location.href = url;
- }
- function selectMultiple(obj) {
- var maindeptId = "";
- var maindeptId_ = obj.val(); //坐席
- if(maindeptId_ != null) {
- $(maindeptId_).each(function(i, n) {
- var obj2 = '';
- obj2 = n + ",";
- maindeptId += obj2;
- })
- maindeptId = maindeptId.substring(0, maindeptId.length - 1)
- } else {
- maindeptId = ""
- }
- return maindeptId
- }
- //来源
- function LY(obj) {
- obj.empty();
- obj.append(
- '<option selected="selected" value="">请选择</option>'
- );
- $.getJSON(
- huayi.config.callcenter_url +
- "Dictionary/GetDicValueListById", {
- token: $.cookie("token"),
- id: 1,
- },
- function(data) {
- if(data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function(i, n) {
- $(
- "<option value='" +
- n.F_ValueId +
- "'>" +
- n.F_Value +
- "</option>"
- ).appendTo(obj);
- });
- }
- }
- );
- }
- ///坐席
- function ZX(obj) {
- obj.empty();
- $.getJSON(
- huayi.config.callcenter_url + "UserAccount/GetSeatList", {
- token: $.cookie("token"),
- },
- function(data) {
- if(data.state.toLowerCase() == "success") {
- var content = data.data;
- $(
- "<option value=''>请选择</option>"
- ).appendTo(obj);
- $(content).each(function(i, n) {
- $(
- "<option value='" +
- n.F_UserCode +
- "'>" +
- n.F_UserName +
- "</option>"
- ).appendTo(obj);
- });
- obj.selectpicker({
- noneSelectedText: "请选择", //默认显示内容
- });
- obj.selectpicker("refresh");
- }
- }
- );
- }
- //下拉框开始
- $(".Closed").click(function() {
- $(".ckxq").addClass("Hidens");
- });
- /*tree下拉框效果*/
- $(".inpBox .tree").click(function() {
- if($(this).parent().find(".addTree").is(":hidden")) {
- $(this).parent().find(".addTree").show();
- } else {
- $(this).parent().find(".addTree").hide();
- }
- });
- /*普通下拉框效果*/
- $(".inpBox .select").click(function() {
- if($(this).parent().find(".xl_common").is(":hidden")) {
- $(this).parent().find(".xl_common").show();
- } else {
- $(this).parent().find(".xl_common").hide();
- }
- });
- $(".xl").click(function() {
- if($(this).parent().find(".addTree").is(":hidden")) {
- $(this).parent().find(".addTree").show();
- } else {
- $(this).parent().find(".addTree").hide();
- }
- if($(this).parent().find(".xl_common").is(":hidden")) {
- $(this).parent().find(".xl_common").show();
- } else {
- $(this).parent().find(".xl_common").hide();
- }
- });
- $(".inpBox").mouseleave(function() {
- $(this).children(".addTree").hide();
- $(this).children(".xl_common").hide();
- })
- $(".xl_box").on("click", "li", function() {
- var obj = $(this).parent().parent().parent();
- obj.find("input").eq(0).val($(this).text());
- obj.find("input").eq(1).val($(this).attr("itemid"));
- obj.find(".xl_common").hide();
- })
- // 承办单位搜索
- $(".inps").bind("input propertychange", function() {
- $(".xlAdd").css("display", "none");
- $(".selDpart1").css("display", "block");
- if($(".inps").val() == "") {
- $(".selDpart1").css("display", "none");
- return;
- }
- var debounceDepart = debounce(depart, 500);
- debounceDepart($(".inps").val());
- });
- $("#reflectCategoryList").on("click", "li", function() {
- $(".reflectCategoryList-wrapper").hide();
- $("#reflectCategory").val($(this).attr("indexName"));
- $("#keyid").val($(this).attr("index"));
- });
- $("#sponsor").on("click", "li", function() {
- $(".selDpart1").css("display", "none");
- $(".inps").val($(this).html());
- $("#PID").val($(this).attr("index"));
- $("#Dpment").val($(this).attr("index"));
- $(".Cleans").show();
- console.log($("#PID").val())
- });
- ///部门
- function depart(dept) {
- $("#sponsor").empty();
- $.getJSON(
- huayi.config.callcenter_url + "Department/GetDeptList", {
- token: $.cookie("token"),
- iscbdw:iscbdw,
- deptname: dept,
- },
- function(data) {
- if(data.state.toLowerCase() == "success") {
- var content = data.data;
- console.log(content)
- $(content).each(function(i, n) {
- $(
- "<li index='" +
- n.F_DeptId +
- "'>" +
- n.F_DeptName +
- "</li>"
- ).appendTo("#sponsor");
- });
- }
- }
- );
- }
- function tree() {
- $.get(
- huayi.config.callcenter_url + "Department/GetDeptList", {
- token: $.cookie("token"),
- iscbdw:iscbdw
- },
- function(result) {
- result = $.parseJSON(result);
- $.fn.zTree.init(
- $("#addTreeDemo"),
- setting1,
- result.data
- ); //实例化树形图
- }
- );
- }
- var setting1 = {
- data: {
- key: {
- name: "F_DeptName",
- },
- simpleData: {
- enable: true,
- idKey: "F_DeptId",
- pIdKey: "F_PartentId",
- rootPId: 0,
- },
- },
- callback: {
- onClick: zTreeOnClick,
- },
- };
- function zTreeOnClick(event, treeId, treeNode) {
- if(treeNode.level >= 0) {
- $(".inps").val(treeNode.F_DeptName);
- $("#PID").val(treeNode.F_DeptId);
- $("#Dpment").val(treeNode.F_DeptId);
- $(".Cleans").show();
- }
- }
- function Close() {
- $(".lyxz").removeClass("cx");
- if($("audio").length > 0) {
- $("audio")[0].pause();
- }
- }
- //清除
- $(".Cleans ").click(function() {
- $('.inps').val("");
- $("#PID").val("");
- $("#Dpment").val("");
- })
- // 防抖函数
- function debounce(fun, delay) {
- return function(args) {
- var that = this;
- var _args = args;
- clearTimeout(fun.id);
- fun.id = setTimeout(function() {
- fun.call(that, _args);
- }, delay);
- };
- }
- // 下拉框结束
|