| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- /**
- * 综合查询
- * */
- $(function() {
- $('.tool_bars').authorizeButton();
- //省市二级联动
- helper.getDropList.getProLocation($('#sc_province'), $('#sc_city'));
- //工单来源
- helper.getDropList.getlistDropByDic($('#sc_source'), 'GDLY');
- //工单类型
- helper.getDropList.getlistDropByDic($('#sc_type'), 'GDLX');
- laydate.render({
- elem: '#sc_times',
- range: '~',
- theme: '#249fea',
- });
- initTable();
- //搜索
- $("#sc_btns").click(function() {
- initTable();
- });
- });
- function initTable() {
- //先销毁表格
- $('#table_all').bootstrapTable('destroy');
- //初始化表格,动态从服务器加载数据
- $('#table_all').bootstrapTable({
- method: "get", //使用get请求到服务器获取数据
- url: huayi.config.callcenter_url + "callcenterapi/api/BusOrder/getlistbypage", //获取数据的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 = {
- pageindex: params.pageNumber, //int 页码
- pagesize: params.pageSize, //int 条数
- ordercode: $('#sc_ordercode').val(), // 否 string 模糊查询(工单编号)
- phone: $('#sc_tel').val(), // 否 string 模糊查询(号码)
- province: $('#sc_province').val(), // 否 string 省code
- citycode: $('#sc_city').val(), // 否 string 市code
- sourceid: $('#sc_source').val(), // 否 string 来源id
- typeid: $('#sc_type').val(), // 否 string 类型id
- stime: $('#sc_times').val() && $('#sc_times').val().split(' ~ ')[0], //开始时间
- etime: $('#sc_times').val() && $('#sc_times').val().split(' ~ ')[1], //结束时间
- //key 否 string 模糊查询(工单标题内容)
- };
- return param;
- },
- responseHandler: function(res) {
- return {
- "total": res.data && res.data.total, //总页数
- "rows": res.data && res.data.rows //数据
- };
- },
- onLoadSuccess: function(res) { //加载成功时执行
- //layer.msg("加载成功");
- $('.tool_downs').authorizeOperateButton();
- },
- onLoadError: function() { //加载失败时执行
- //layer.msg("加载数据失败", { time: 1500, icon: 2 });
- }
- });
- }
- //格式化操作
- function formatterOperate(val, row) {
- return '<ul class="tool_downs">' +
- '<li><a class="aBtn" authorize="yes" id="HY_detail_' + row.ordercode + '" onclick="btn_details(\'' + row.ordercode + '\')">详情</a></li>' +
- '<li><a class="aBtn" authorize="yes" id="HY_edit_' + row.ordercode + '" onclick="btn_edit(\'' + row.ordercode + '\')">编辑</a></li>' +
- '<li><a class="aBtn" authorize="yes" id="HY_delete_' + row.id + '" onclick="btn_delete(\'' + row.id + '\')">删除</a></li>' +
- '</ul>';
- }
- //格式化地址
- function formatterAddress(val, row) {
- var locations = '';
- var address = '';
- if(val){
- locations = val + row.cityname;
- }
- if(row.address){
- address = row.address;
- }
- return locations + address;
- }
- //格式化内容
- function formatterContent(val, row) {
- if(val) {
- var codeContent = decodeURIComponent(val);
- codeContent = helper.filter.delHtmlTag(codeContent);
- codeContent = $.trim(codeContent);
- var cc = codeContent.length > 20 ? codeContent.substr(0, 20) + '...' : codeContent;
- return '<div title="' + codeContent + '">' + cc + '</div>';
- } else {
- return '-';
- }
- }
- //格式化创建人
- function formatterCreateuser(val, row){
- return val + '-' + row.createusername;
- }
- //查看工单详情
- function btn_details(rcode) {
- layer.open({
- type: 2,
- content: "template/seeOrderDetails.html?edit_id=" + rcode, //iframe的url,no代表不显示滚动条
- title: '查看工单详情',
- resize: false,
- area: ['80%', '90%'], //宽高
- });
- }
- //编辑
- function btn_edit(edit_id) {
- layer.open({
- type: 2,
- content: "template/addOrEditOrder.html?edit_id=" + edit_id, //iframe的url,no代表不显示滚动条
- title: '编辑工单',
- resize: false,
- area: ['80%', '90%'], //宽高
- });
- }
- //批量删除
- function btn_deletes() {
- var ids = $.map($('#table_all').bootstrapTable('getSelections'),
- function(row) {
- return row.id;
- });
- /*判断长度*/
- if(ids.length <= 0) {
- layer.confirm('请选择要删除的选项', {
- icon: 7,
- btn: ['确定'] //按钮
- });
- return;
- }
- btn_delete(ids);
- }
- //删除
- function btn_delete(del_id) {
- /*发送请求*/
- layer.confirm('您确定要删除当前工单吗?', {
- icon: 7,
- btn: ['确定', '取消'],
- yes: function(index, layero) {
- $.post(huayi.config.callcenter_url + "callcenterapi/api/BusOrder/delete", {
- ids: del_id,
- }, function(result) {
- result = JSON.parse(result);
- if(result.state.toLowerCase() == "success") {
- layer.msg("删除成功");
- $('#table_all').bootstrapTable('refresh');
- }
- })
- },
- });
- }
|