合作方

master
liuweiwen 5 years ago
parent 3b47c94b1e
commit e15460b08f

@ -31,44 +31,81 @@ class PartnerController extends ThinkController
$map['tab_partner.status'] = $status;
$parameter['status'] = $status;
}
if (!empty(I('company_type'))) {
$map['company_type'] = I('company_type');
}
if (!empty(I('partner'))) {
$map['partner'] = ['like', '%' . I('partner') . '%'];
}
if (!empty(I('timestart'))) {
$timestart = strtotime(I('timestart'));
$map['_string'] = "contract_start_time >= {$timestart}";
}
if (!empty(I('timeend'))) {
$timeend = strtotime(I('timeend') . ' 23:59:59');
if (!empty($map['_string'])) {
$map['_string'] .= " and ";
}
$map['_string'] .= " contract_end_time < {$timeend}";
}
$page = intval(I('get.p', 0));
$page = $page ? $page : 1; //默认显示第一页数据
$row = intval(I('row', 0));
$row = empty($row) ? 10 : $row;//每页条数
$is_export= false;
if (isset($_REQUEST['export']) && $_REQUEST['export']==1){
$is_export = true;
}
//获取分页数据
$partners = $model->alias('p')
$query = $model->alias('p')
->field("p.partner,p.matche_platform,p.invoice_rate,p.settlement_type,p.bank_account,
p.opening_bank,p.id,p.contract_start_time,p.contract_end_time,p.remark")
->where($map)
->order("id desc")
->page($page,$row)
->select();
->order("id desc");
if($is_export){
$partners = $query
->select();
}else{
$partners = $query
->page($page,$row)
->select();
}
//获取公司id
$partner_ids = array_column($partners, 'id');
$partner_ids = $partner_ids ? $partner_ids : [0];
$game_map['partner_id'] = ["in",$partner_ids];
$games = M("game","tab_")->alias('g')
->field("g.game_type_name,g.relation_game_name,g.original_package_name,g.partner_id,g.id")
->field("g.game_type_name,g.relation_game_name,g.original_package_name,g.partner_id,g.relation_game_id as id")
->where($game_map)
->group('relation_game_id')
->select();
$game_ids = array_column($games, 'id');
$game_ids = $game_ids ? $game_ids : [0];
$cp_game_ratio_map['game_id'] = ["in", $game_ids];
$cp_game_ratio_map['is_del'] = '0';
//获取游戏比例
$gameradiores = M("cp_game_ratio","tab_")
->alias("cg")
->join("tab_game ga ON cg.game_id = ga.id")
->field("cg.ratio,cg.instanceof,cg.game_id,cg.begin_total_amount")
->where($cp_game_ratio_map)
->group('relation_game_id,begin_total_amount')
->select();
// dd($cp_game_ratio_map);
$parseGameRadiores = array();
foreach ($gameradiores as $key =>$val) {
$val['row'] = 1;
if ($val['begin_total_amount'] == 0) {
$val['name'] = '默认比例';
if (isset($parseGameRadiores[$val['game_id']])) {
$parseGameRadiores[$val['game_id']] = [];
}
} else {
if($val['instanceof']=='1'){
$val['name']="月流水≥".$val['begin_total_amount'];
@ -76,7 +113,6 @@ class PartnerController extends ThinkController
$val['name']="月流水>".$val['begin_total_amount'];
}
}
$val['row'] = 1;
$parseGameRadiores[$val['game_id']][] = $val;
}
// dd($parseGameRadiores);
@ -117,128 +153,16 @@ class PartnerController extends ThinkController
}
$parseData = array_values($parseData);
/* 查询记录总数 */
$count = $model
->where($map)
->count();
//分页
$parameter['p'] = $page;
$parameter['row'] = $row;
$page = set_pagination($count, $row, $parameter);
if ($page) {
$this->assign('_page', $page);
}
// dd($parseData[0]);
$this->assign('listData', $parseData[0]);
$this->assign('count', $count);
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Partner/lists'])->find());
$this->meta_title = '合作方管理';
$this->display();
}
//列表
public function lists2()
{
$model = M($this->modelName, 'tab_');
$map = [];
$id = intval(I('id', 0));
if (!empty($id)) {
$map['tab_partner.id'] = $id;
$parameter['id'] = $id;
}
if (isset($_REQUEST['status']) && $_REQUEST['status'] !== '') {
$status = intval($_REQUEST['status']);
$map['tab_partner.status'] = $status;
$parameter['status'] = $status;
if($is_export){
$this->assign('listData', $parseData[0]);
$this->display("export");
die();
}
$page = intval(I('get.p', 0));
$page = $page ? $page : 1; //默认显示第一页数据
$row = intval(I('row', 0));
$row = empty($row) ? 10 : $row;//每页条数
//获取分页数据
$partners = $model->alias('p')
->field("p.partner,p.matche_platform,p.invoice_rate,p.settlement_type,p.bank_account,
p.opening_bank,p.id,p.contract_start_time,p.contract_end_time,p.remark")
->where($map)
->order("id desc")
->page($page,$row)
->select();
//获取公司id
$partner_ids = implode(',', array_column($partners, 'id'));
$game_map['partner_id'] = ["in",$partner_ids];
$games = M("game","tab_")->alias('g')
->field("g.game_type_name,g.relation_game_name,g.original_package_name,g.partner_id,g.id")
->where($game_map)
->select();
$game_ids = implode(',', array_column($games, 'id'));
$cp_game_ratio_map['game_id'] = ["in",$game_ids];
//获取游戏比例
$gameradiores = M("cp_game_ratio","tab_")
->alias("cg")
->field("cg.ratio,cg.instanceof,cg.game_id")
->join("tab_game ga ON cg.game_id = ga.id")
->where($cp_game_ratio_map)
->where(['is_del' => 0])
->group("game_id")
->select();
$parseGameRadiores = array();
foreach ($gameradiores as $key =>$val) {
$val['row'] = 1;
$parseGameRadiores[$val['game_id']][] = $val;
}
$parseGames = array();
foreach ($games as $key =>$val) {
$val['game_ratio'] = $parseGameRadiores[$val['id']];
if(array_key_exists($val['id'],$parseGameRadiores)){//游戏有比例
$row = array_sum(array_column($val['game_ratio'], 'row')) ;
$val['row'] = empty($row) ? 1: $row;
} else {
$val["row"] = 1;
}
$parseGames[$val['partner_id']][] = $val;
}
$parseData = array();
foreach ($partners as $key =>$value) {
$value['game'] = $parseGames[$value['id']];
$value['has_game_evidence'] = $parseGames['has_game_evidence'] ? '有' : '没有';
$value['is_sign_contract'] = $parseGames['is_sign_contract'] ? '是' : '否';
if ($value['settlement_type'] == 0) {
$value['settlement_type'] = '未配置';
} elseif ($value['settlement_type'] == 1) {
$value['settlement_type'] = '周结';
} elseif ($value['settlement_type'] == 2) {
$value['settlement_type'] = '月结';
}
$value['contract_time'] = time_format($value['contract_start_time'], 'Y/m/d') . '-' .
time_format($value['contract_end_time'], 'Y/m/d');
$row = array_sum(array_column($value['game'], 'row')) ;
$value['row'] = empty($row) ? 1: $row;
$parseData[$value['partner_id']][] = $value;
}
$parseData = array_values($parseData);
// dd($parseData);
/* 查询记录总数 */
$count = $model
->where($map)
->count();
//分页
$parameter['p'] = $page;
$parameter['row'] = $row;
@ -246,7 +170,7 @@ class PartnerController extends ThinkController
if ($page) {
$this->assign('_page', $page);
}
// dd($parseData[0]);
$this->assign('listData', $parseData[0]);
$this->assign('count', $count);
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Partner/lists'])->find());
@ -264,15 +188,26 @@ class PartnerController extends ThinkController
if (empty($partner)) {
$this->error('请输入合作方名称');
}
if (!strlen(I('is_sign_contract'))) {
$this->error('请选择是否签署合同');
}
if (empty(I('settlement_type'))) {
$this->error('请选择结算方式');
}
if (empty(I('company_type'))) {
$this->error('请输入公司性质');
}
if (!strlen(I('has_game_evidence'))) {
$this->error('请选择是否有游戏资质');
}
if (empty(I('link_man'))) {
$this->error('请输入联系人');
}
if (empty(I('link_phone'))) {
$this->error('请输入联系电话');
}
if (!in_array($status, [0, 1])) {
$this->error('参数异常');
}
$model = M($this->modelName, 'tab_');
$map['partner'] = $partner;
@ -308,6 +243,7 @@ class PartnerController extends ThinkController
$save['is_sign_contract'] = I('is_sign_contract');
$save['settlement_type'] = I('settlement_type');
$save['has_game_evidence'] = I('has_game_evidence');
$save['company_type'] = I('company_type');
$save['remark'] = I('remark');
if (!empty(I('file_info'))) {
$save['file_info'] = I('file_info');
@ -344,6 +280,18 @@ class PartnerController extends ThinkController
if (empty($partner)) {
$this->error('请输入合作方名称');
}
if (!strlen(I('is_sign_contract'))) {
$this->error('请选择是否签署合同');
}
if (empty(I('settlement_type'))) {
$this->error('请选择结算方式');
}
if (empty(I('company_type'))) {
$this->error('请输入公司性质');
}
if (!strlen(I('has_game_evidence'))) {
$this->error('请选择是否有游戏资质');
}
if (empty(I('link_man'))) {
$this->error('请输入联系人');
}
@ -360,7 +308,6 @@ class PartnerController extends ThinkController
$map['partner'] = $partner;
$res = $model->where($map)->getField('id');
dd($res);
if ($res && $res != $id) {
$this->error('合作方已存在');
}
@ -396,6 +343,7 @@ class PartnerController extends ThinkController
$save['is_sign_contract'] = I('is_sign_contract');
$save['settlement_type'] = I('settlement_type');
$save['has_game_evidence'] = I('has_game_evidence');
$save['company_type'] = I('company_type');
$save['remark'] = I('remark');
if (!empty(I('file_info'))) {
$save['file_info'] = I('file_info');

@ -90,7 +90,18 @@
</tr>
<tr>
<td class="l noticeinfo"><i class="mustmark" style="margin-left:-7px">*</i>是否签署合同:</td>
<td class="l noticeinfo"><i class="mustmark" style="margin-left:-7px">*</i>公司性质:</td>
<td class="r">
<select name="company_type" class="select_gallery">
<option value="0">请选择公司性质</option>
<option value="1" <if condition="$data['company_type'] eq '1'"> selected="selected"</if>>公司</option>
<option value="2" <if condition="$data['company_type'] eq '2'"> selected="selected"</if>>个人</option>
</select>
</td>
</tr>
<tr>
<td class="l noticeinfo"><i class="mustmark" style="margin-left:-7px">*</i>是否有游戏资质:</td>
<td class="r">
<select name="has_game_evidence" class="select_gallery">
<option value="">请选择是否有游戏资质</option>
@ -186,7 +197,7 @@
</table>
</div>
<div class="form-item cf">
<input class="submit_btn ajax-post" type="button" value="保存" id="submit" target-form="form-horizontal" style="margin-left:210px;">
<input class="submit_btn" type="button" value="保存" id="submit" target-form="form-horizontal" style="margin-left:210px;">
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="{:U('Partner/lists')}" >
返回
</a>
@ -295,7 +306,6 @@
if(doc.length > 0){
cres.push({"name":"file_info", "value":JSON.stringify(doc)});
}
console.log(cres)
//添加
$.ajax({
url:"{:U('partner/add')}",

@ -89,6 +89,17 @@
</td>
</tr>
<tr>
<td class="l noticeinfo"><i class="mustmark" style="margin-left:-7px">*</i>公司性质:</td>
<td class="r">
<select name="company_type" class="select_gallery">
<option value="0">请选择公司性质</option>
<option value="1" <if condition="$data['company_type'] eq '1'"> selected="selected"</if>>公司</option>
<option value="2" <if condition="$data['company_type'] eq '2'"> selected="selected"</if>>个人</option>
</select>
</td>
</tr>
<tr>
<td class="l noticeinfo"><i class="mustmark" style="margin-left:-7px">*</i>是否签署合同:</td>
<td class="r">
@ -186,11 +197,12 @@
</table>
</div>
<div class="form-item cf">
<input class="submit_btn ajax-post" type="button" value="保存" id="submit" target-form="form-horizontal" style="margin-left:210px;">
<input class="submit_btn" type="button" value="保存" id="submit2" target-form="form-horizontal" style="margin-left:210px;">
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="{:U('Partner/lists')}" >
返回
</a>
</div>
<input type="hidden" name="id" value="{$data.id}">
</form>
</div>
</div>
@ -295,13 +307,12 @@
content: url
});
});
$("#submit").on("click",function(){
$("#submit2").on("click",function(){
var cres = $('form').serializeArray();
//验证通过
if(doc.length > 0){
cres.push({"name":"file_info", "value":JSON.stringify(doc)});
}
console.log(cres)
//添加
$.ajax({
url:"{:U('partner/edit')}",

@ -0,0 +1,202 @@
<extend name="Public/base"/>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script src="__STATIC__/table2excel.js"></script>
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
.data_list table td{
text-indent:0;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">{$meta_title}</h3>
</div>
<!-- 数据列表 -->
<div class="data_list data_game_list">
<div class="">
<table border="1" id="exporttable" style="opacity: 0;">
<!-- 表头 -->
<thead>
<tr>
<th style="width:5%;min-width:10px;">操作</th>
<th>合同合作方名称</th>
<th>对应平台</th>
<th>合同期限</th>
<th>开票税点</th>
<th>结算周期</th>
<th>银行账号</th>
<th>开户行</th>
<th>备注</th>
<th>是否有游戏资质</th>
<th>是否签署合同</th>
<th>产品类型</th>
<th>原包名</th>
<th>现包名</th>
<th colspan="2">合作方分成比例</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<empty name ="listData">
<td colspan="15" class="text-center">aOh! 暂时还没有内容!</td>
<else />
<volist name="listData" id="data">
<tr>
<td rowspan="{$data.row}">
<a href="{:U('edit',array('id'=>$data['id']))}">编辑</a>
<a href="{:U('edit',array('id'=>$data['id'],'action' => 'show'))}">查看</a>
<a href="{:U('del',array('id'=>$data['id']))}" class="confirm ajax-get">删除</a>
</td>
<td rowspan="{$data.row}">{$data.partner}</td>
<td rowspan="{$data.row}">{$data.matche_platform}</td>
<td rowspan="{$data.row}">{$data.contract_time}</td>
<td rowspan="{$data.row}">{$data.invoice_rate}%</td>
<td rowspan="{$data.row}">{$data.settlement_type}</td>
<td rowspan="{$data.row}">{$data.bank_account}</td>
<td rowspan="{$data.row}">{$data.opening_bank}</td>
<td rowspan="{$data.row}">{$data.remark}</td>
<td rowspan="{$data.row}">{$data.has_game_evidence}</td>
<td rowspan="{$data.row}">{$data.is_sign_contract}</td>
<notempty name="data.game">
<foreach name="data['game']" item="game" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td rowspan="{$game.row}">{$game['game_type_name']}</td>
<td rowspan="{$game.row}">{$game['original_package_name']}</td>
<td rowspan="{$game.row}">{$game['relation_game_name']}</td>
<notempty name="game.game_ratio">
<foreach name="game['game_ratio']" item="ratio" key="ratiokey">
<if condition="$ratiokey gt 0">
<tr>
<td>{$ratio['name']}</td>
<td>{$ratio['ratio']}</td>
</tr>
<else />
<td>{$ratio['name']}</td>
<td>{$ratio['ratio']}</td>
</if>
</foreach>
<else />
<td >-</td>
<td>-</td>
</notempty>
</tr>
<else />
<td rowspan="{$game.row}">{$game['game_type_name']}</td>
<td rowspan="{$game.row}">{$game['original_package_name']}</td>
<td rowspan="{$game.row}">{$game['relation_game_name']}</td>
<notempty name="game.game_ratio">
<foreach name="game['game_ratio']" item="ratio" key="ratiokey">
<if condition="$ratiokey gt 0">
<tr>
<td>{$ratio['name']}</td>
<td>{$ratio['ratio']}</td>
</tr>
<else />
<td>{$ratio['name']}</td>
<td>{$ratio['ratio']}</td>
</if>
</foreach>
<else />
<td >-</td>
<td>-</td>
</notempty>
</if>
</foreach>
<else />
<td rowspan="{$data.row}">-</td>
<td rowspan="{$data.row}">-</td>
<td rowspan="{$data.row}">-</td>
<td rowspan="{$data.row}">-</td>
<td rowspan="{$data.row}">-</td>
</notempty>
</tr>
</volist>
</empty>
</tbody>
</table>
</div>
</div>
<div class="page">
{$_page|default=''}
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$meta_title}">
<input type="hidden" name="url" value="Partner/lists">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
</block>
<block name="script">
<script src="__STATIC__/layer/layer.js"></script>
<script src="__STATIC__/layer/extend/layer.ext.js"></script>
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<style>
.layui-layer-demo .layui-layer-title {background:#F0F5F7;font-weight:bold;}
.layui-layer-demo .layui-layer-content {}
.layui-layer-demo .layui-layer-content table{width:100%;border:0;border-spacing:0;padding:0;}
.layui-layer-demo .layui-layer-content td {height:42px;padding-left:20px;}
.layui-layer-demo .layui-layer-content tr:hover {background:#F0F5F7;}
.layui-layer-demo .layui-layer-content tr~tr {border-top:1px solid #ccc;}
.layui-layer-demo .layui-layer-content td~td {border-left:1px solid #ccc;}
.layui-layer-demo .layui-layer-content tr:last-child td {}
</style>
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript">
$("#exporttable").table2excel({
filename: "合作方.xls", // do include extension
preserveColors: false // set to true if you want background colors and font colors preserved
});
</script>
</block>

@ -42,23 +42,41 @@
<!--<a class="ajax-post confirm " target-form="ids" url="{:U('del')}"><span class="button_icon button_icon2"></span>删除</a>-->
</div>
</div>
<!-- <div class="jssearch fl cf search_list" >-->
<!-- <div class="input-list search-title-box">-->
<!-- <label>搜索:</label>-->
<!-- </div>-->
<!-- <div class="input-list input-list-platform">-->
<!-- <select id="status" name="status" >-->
<!-- <option value="">显示状态</option>-->
<!-- <option value="1">已开启</option>-->
<!-- <option value="0">已关闭</option>-->
<!-- </select>-->
<!-- </div>-->
<!-- <div class="input-list">-->
<!-- <a class="sch-btn" href="javascript:;" id="search" url="{:U('lists','model='.$model['name'] .'&row='.I('row'),false)}">搜索</a>-->
<!-- </div>-->
<!-- </div>-->
<div class="jssearch fl cf search_list" >
<div class="input-list search-title-box">
<label>搜索:</label>
</div>
<div class="input-list">
<input style="width: 200px;" type="text" name="partner" class="search-input" value="{:I('partner')}" placeholder="请输入公司名称搜索">&nbsp;
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="company_type" name="company_type" class="select_gallery" >
<option value="">请选择公司性质</option>
<option value="1">公司</option>
<option value="2">个人</option>
</select>
</div>
<div class="input-list">
<input type="text" id="time-start" name="timestart" class="" value="{$startDate}"
placeholder="开始时间"/>
-
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" id="time-end" name="timeend" class="" value="{$endDate}"
placeholder="结束时间"/>
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('lists','model='.$model['name'] .'&row='.I('row'),false)}">搜索</a>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="downloadexcel" url="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['export'=>1],I('get.')))}">导出excel</a>
</div>
</div>
</div>
<!-- 数据列表 -->
@ -92,7 +110,7 @@
<!-- 列表 -->
<tbody>
<empty name ="listData">
<td colspan="6" class="text-center">aOh! 暂时还没有内容!</td>
<td colspan="15" class="text-center">aOh! 暂时还没有内容!</td>
<else />
<volist name="listData" id="data">
<tr>
@ -196,6 +214,11 @@
<block name="script">
<script src="__STATIC__/layer/layer.js"></script>
<script src="__STATIC__/layer/extend/layer.ext.js"></script>
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<style>
.layui-layer-demo .layui-layer-title {background:#F0F5F7;font-weight:bold;}
.layui-layer-demo .layui-layer-content {}
@ -217,6 +240,52 @@
//导航高亮
highlight_subnav("{:U('lists')}");
$(function(){
$("#downloadexcel").on("click",function(){
var url = $(this).attr("url");
var title = '合作方导出';
layer.open({
type: 2,
title: title,
shadeClose: true,
shade: 0.8,
area: ['40%', '60%'],
content: url
});
})
$('#time-start').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
showMeridian:true,
pickDate:true,
minView: 2,
autoclose: true,
pickTime:true,
todayBtn:true,
}).on('change',function(ev){
var val = new Date($.trim($(this).val())).getTime();
var end = new Date($.trim($('#time-end').val())).getTime();
if (val>end) {
layer.msg('开始时间大于结束时间!');$(this).val('');
}
return false;
});
$("#time-end").datetimepicker({
format:"yyyy-mm-dd",
language: "zh-CN",
showMeridian:true,
minView:2,
autoclose:true,
todayBtn:true,
}).on('change',function(ev){
var val = new Date($.trim($(this).val())).getTime();
var start = new Date($.trim($('#time-start').val())).getTime();
if (val<start) {
layer.msg('开始时间大于结束时间!');$(this).val('');
}
return false;
});
//搜索功能
$("#search").click(function(){
var url = $(this).attr('url');

@ -1189,4 +1189,6 @@ ALTER TABLE tab_partner
ADD COLUMN `remark` varchar(255) DEFAULT NULL COMMENT '备注';
ALTER TABLE tab_partner
ADD COLUMN `file_info` text COMMENT '文档信息json格式';
ALTER TABLE tab_partner
ADD COLUMN `company_type` TINYINT (3) NOT NULL DEFAULT '1' COMMENT '公司性质1-公司 2-个人';

@ -0,0 +1 @@
(function($,window,document,undefined){var pluginName="table2excel",defaults={exclude:".noExl",name:"Table2Excel",filename:"table2excel",fileext:".xls",exclude_img:true,exclude_links:true,exclude_inputs:true,preserveColors:false};function Plugin(element,options){this.element=element;this.settings=$.extend({},defaults,options);this._defaults=defaults;this._name=pluginName;this.init()}Plugin.prototype={init:function(){var e=this;var utf8Heading='<meta http-equiv="content-type" content="application/vnd.ms-excel; charset=UTF-8">';e.template={head:'<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">'+utf8Heading+"<head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets>",sheet:{head:"<x:ExcelWorksheet><x:Name>",tail:"</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet>"},mid:"</x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body>",table:{head:"<table>",tail:"</table>"},foot:"</body></html>"};e.tableRows=[];var additionalStyles="";var compStyle=null;$(e.element).each(function(i,o){var tempRows="";$(o).find("tr").not(e.settings.exclude).each(function(i,p){additionalStyles="";if(e.settings.preserveColors){compStyle=getComputedStyle(p);additionalStyles+=(compStyle&&compStyle.backgroundColor?"background-color: "+compStyle.backgroundColor+";":"");additionalStyles+=(compStyle&&compStyle.color?"color: "+compStyle.color+";":"")}tempRows+="<tr style='"+additionalStyles+"'>";$(p).find("td,th").not(e.settings.exclude).each(function(i,q){additionalStyles="";if(e.settings.preserveColors){compStyle=getComputedStyle(q);additionalStyles+=(compStyle&&compStyle.backgroundColor?"background-color: "+compStyle.backgroundColor+";":"");additionalStyles+=(compStyle&&compStyle.color?"color: "+compStyle.color+";":"")}var rc={rows:$(this).attr("rowspan"),cols:$(this).attr("colspan"),flag:$(q).find(e.settings.exclude)};if(rc.flag.length>0){tempRows+="<td> </td>"}else{tempRows+="<td";if(rc.rows>0){tempRows+=" rowspan='"+rc.rows+"' "}if(rc.cols>0){tempRows+=" colspan='"+rc.cols+"' "}if(additionalStyles){tempRows+=" style='"+additionalStyles+"'"}tempRows+=">"+$(q).html()+"</td>"}});tempRows+="</tr>"});if(e.settings.exclude_img){tempRows=exclude_img(tempRows)}if(e.settings.exclude_links){tempRows=exclude_links(tempRows)}if(e.settings.exclude_inputs){tempRows=exclude_inputs(tempRows)}e.tableRows.push(tempRows)});e.tableToExcel(e.tableRows,e.settings.name,e.settings.sheetName)},tableToExcel:function(table,name,sheetName){var e=this,fullTemplate="",i,link,a;e.format=function(s,c){return s.replace(/{(\w+)}/g,function(m,p){return c[p]})};sheetName=typeof sheetName==="undefined"?"Sheet":sheetName;e.ctx={worksheet:name||"Worksheet",table:table,sheetName:sheetName};fullTemplate=e.template.head;if($.isArray(table)){Object.keys(table).forEach(function(i){fullTemplate+=e.template.sheet.head+sheetName+i+e.template.sheet.tail})}fullTemplate+=e.template.mid;if($.isArray(table)){Object.keys(table).forEach(function(i){fullTemplate+=e.template.table.head+"{table"+i+"}"+e.template.table.tail})}fullTemplate+=e.template.foot;for(i in table){e.ctx["table"+i]=table[i]}delete e.ctx.table;var isIE=navigator.appVersion.indexOf("MSIE 10")!==-1||(navigator.userAgent.indexOf("Trident")!==-1&&navigator.userAgent.indexOf("rv:11")!==-1);if(isIE){if(typeof Blob!=="undefined"){fullTemplate=e.format(fullTemplate,e.ctx);fullTemplate=[fullTemplate];var blob1=new Blob(fullTemplate,{type:"text/html"});window.navigator.msSaveBlob(blob1,getFileName(e.settings))}else{txtArea1.document.open("text/html","replace");txtArea1.document.write(e.format(fullTemplate,e.ctx));txtArea1.document.close();txtArea1.focus();sa=txtArea1.document.execCommand("SaveAs",true,getFileName(e.settings))}}else{var blob=new Blob([e.format(fullTemplate,e.ctx)],{type:"application/vnd.ms-excel"});window.URL=window.URL||window.webkitURL;link=window.URL.createObjectURL(blob);a=document.createElement("a");a.download=getFileName(e.settings);a.href=link;document.body.appendChild(a);a.click();document.body.removeChild(a)}return true}};function getFileName(settings){return(settings.filename?settings.filename:"table2excel")}function exclude_img(string){var _patt=/(\s+alt\s*=\s*"([^"]*)"|\s+alt\s*=\s*'([^']*)')/i;return string.replace(/<img[^>]*>/gi,function myFunction(x){var res=_patt.exec(x);if(res!==null&&res.length>=2){return res[2]}else{return""}})}function exclude_links(string){return string.replace(/<a[^>]*>|<\/a>/gi,"")}function exclude_inputs(string){var _patt=/(\s+value\s*=\s*"([^"]*)"|\s+value\s*=\s*'([^']*)')/i;return string.replace(/<input[^>]*>|<\/input>/gi,function myFunction(x){var res=_patt.exec(x);if(res!==null&&res.length>=2){return res[2]}else{return""}})}$.fn[pluginName]=function(options){var e=this;e.each(function(){if(!$.data(e,"plugin_"+pluginName)){$.data(e,"plugin_"+pluginName,new Plugin(this,options))}});return e}})(jQuery,window,document);
Loading…
Cancel
Save