| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- var token = $.cookie("token");
- var table = $('#table1');
- function LB(obj) {
- obj.empty();
- $("<option value='-1'>所有分类</option>").appendTo(obj);
- $.getJSON(huayi.config.callcenter_url + "CallPlan/GetCategoryAllList2", {
- "token": $.cookie("token")
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.id + "'>" + n.name + "</option>").appendTo(obj);
- })
- }
- })
- }
- $(document).ready(function () {
- LB($('#leiBie')); //类别
- initTable();
- //搜索
- $('.searchGo').click(function () {
- initTable();
- })
- //添加
- $('.return').click(function () {
- top.$("iframe:visible")[0].src = "VoiceNotification/addTongZhi.html";
- })
- })
- function initTable() {
- //先销毁表格
- table.bootstrapTable('destroy');
- //初始化表格,动态从服务器加载数据
- table.bootstrapTable({
- method: "get", //使用get请求到服务器获取数据
- url: huayi.config.callcenter_url + "Callplan/getlist", //获取数据的Servlet地址
- contentType: "application/x-www-form-urlencoded",
- striped: true, //表格显示条纹
- pagination: true, //启动分页
- pageSize: 10, //每页显示的记录数
- pageNumber: 1, //当前第几页
- pageList: [10, 20, 50, 100], //记录数可选列表
- search: false, //是否启用查询
- showColumns: false, //显示下拉框勾选要显示的列
- showRefresh: false, //显示刷新按钮
- sidePagination: "server", //表示服务端请求
- //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
- //设置为limit可以获取limit, offset, search, sort, order
- queryParamsType: "undefined",
- queryParams: function queryParams(params) { //设置查询参数
- var param = {
- page: params.pageNumber,
- pagesize: params.pageSize,
- token: $.cookie("token"),
- name: $('.keyw').val(),
- categoryid: $('#leiBie').val()
- };
- return param;
- },
- onLoadSuccess: function () { //加载成功时执行
- //layer.msg("加载成功");
- },
- onLoadError: function () { //加载失败时执行
- //layer.msg("加载数据失败", { time: 1500, icon: 2 });
- }
- });
- }
- function caoZuo(val, row) {
- if (row.id == -10001)
- return '<div><a title="号码详情" style="margin-right:5px;" onclick="detail(' + row.id + ')"><i class="fa fa-file-text-o" aria-hidden="true"></i> </div>'
- else if (row.id == -10002)
- return '<div><a title="号码详情" style="margin-right:5px;" onclick="detail(' + row.id + ')"><i class="fa fa-file-text-o" aria-hidden="true"></i><a title="编辑" style="margin-right:5px;" onclick="XG(' + row.id + ')"><i class="fa fa-pencil-square-o"></i></a> </div>'
- else
- return '<div><a title="号码详情" style="margin-right:5px;" onclick="detail(' + row.id + ')"><i class="fa fa-file-text-o" aria-hidden="true"></i></a><a title="编辑" style="margin-right:5px;" onclick="XG(' + row.id + ')"><i class="fa fa-pencil-square-o"></i></a><a title="删除" onclick="del(' + row.id + ')"><i class="fa fa-remove"></i></a> </div>'
- }
- function detail(id) {
- top.$("iframe:visible")[0].src = "VoiceNotification/phonelist.html?id=" + id;
- }
- //删除
- function del(id) {
- var laye = layer.confirm('您确定要删除吗?', {
- btn: ['确定', '取消'] //可以无限个按钮
- }, function (index, layero) {
- //按钮【按钮一】的回调
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "Callplan/Delete",
- async: true,
- dataType: 'json',
- data: {
- token: $.cookie("token"),
- id: id
- },
- success: function (data) {
- if (data.state.toLowerCase() == 'success') {
- layer.msg("删除成功!");
- layer.close(laye);
- initTable();
- }
- }
- });
- }, function (index) {
- //按钮【按钮二】的回调
- layer.close(laye)
- });
- }
- //修改
- function XG(id) {
- top.$("iframe:visible")[0].src = "VoiceNotification/changeTongZhi.html?id=" + id;
- }
|