master
yulingwei 4 years ago
parent e6c8b51127
commit 93601a3302

@ -306,6 +306,12 @@ class PromoteCompanyController extends ThinkController
$this->display();
}
public function marketingDirectorShow($ids=[], $isShow=0)
{
$upt = M('promote_company','tab_')->where(['id'=>['in', $ids]])->save(['marketing_director_show'=>$isShow]);
return $upt ? $this->success('更新成功'): $this->error('更新失败');
}
//编辑
public function edit()
@ -577,7 +583,7 @@ WHERE old_change_promote_id in ({$promoteData})";
}
$list = M('service_agreement', 'tab_')
->field("tab_service_agreement.*, group_concat(distinct(tab_promote_company.company_name)) as company_name")
->join('tab_promote_company on tab_promote_company.service_agreement_show = tab_service_agreement.id', 'LEFT')->where($map)->page($p, $row)->order("status desc")->select();
->join('tab_promote_company on tab_promote_company.service_agreement_show = tab_service_agreement.id', 'LEFT')->where($map)->group('tab_service_agreement.id asc')->page($p, $row)->order("status desc")->select();
$count = M('service_agreement', 'tab_')->where($map)->count();
$page = set_pagination($count, $row);
if ($page) {
@ -590,6 +596,20 @@ WHERE old_change_promote_id in ({$promoteData})";
public function serviceAgreementSave($id=0, $delete=0)
{
if (IS_POST) {
if (!empty(I('ids'))) {
$ids = is_array(I('ids')) ? I('ids') : [I('ids')];
if ($delete) {
// 获取默认合同id
$defaultService = M('service_agreement', 'tab_')->where(['status'=>2])->find();
if(in_array($defaultService['id'], $ids)) {
return $this->error('无法删除默认模板');
}
$useingService = M('promote_company', 'tab_')->where(['service_agreement_show'=>['in', $ids]])->find();
if (!empty($useingService)) return $this->error('有正在使用该服务合同的公司,无法删除');
$result = M('service_agreement', 'tab_')->where(['id'=>['in', $ids]])->delete();
return $result ? $this->success('删除完成') : $this->error('删除失败');
}
}
if (empty($_POST['name']) || empty($_POST['content'])) {
return $this->error('请填写完整内容');
}
@ -604,13 +624,7 @@ WHERE old_change_promote_id in ({$promoteData})";
return $result ? $this->success('生成协议完成') : $this->error('生成协议失败');
}
} else {
if ($id) {
if ($delete) {
$useingService = M('promote_company', 'tab_')->where(['service_agreement_show'=>$id])->find();
if (!empty($useingService)) return $this->error('有正在使用该服务协议的公司,无法删除');
$result = M('service_agreement', 'tab_')->where(['id'=>$id])->delete();
return $result ? $this->success('删除完成') : $this->error('删除失败');
}
if (!empty($id)) {
$info = M('service_agreement', 'tab_')->where(['id'=>$id])->find();
if (empty($info)) return $this->error('未找到协议');
$this->assign('info', $info);

@ -34,14 +34,18 @@
padding: 3px;
height: 30px;
}
.clearfix:after {
content:"";
display: block;
clear:both;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">{$meta_title}</h3>
<p class="description_text">说明:该功能是用于录入工会所属的推广公司名称 / 如需删除公司请先将公司底下会长移走后方可操作</p>
</div>
<div class="cf top_nav_list">
<div class="cf top_nav_list clearfix" style="display: inline;">
<div class="fl button_list">
<div class="tools">
<a class="" href="{:U('add')}"><span class="button_icon button_icon1"></span>新增</a>
@ -91,6 +95,15 @@
</div>
</div>
<div class="cf top_nav_list clearfix">
<div class="fl button_list">
<div class="tools">
<a class="ajax-post" target-form="ids" url="{:U('PromoteCompany/marketingDirectorShow', ['isShow'=>1])}"><span class="button_icon "></span>展示市场总监信息</a>
<a class="ajax-post" target-form="ids" url="{:U('PromoteCompany/marketingDirectorShow', ['isShow'=>2])}"><span class="button_icon "></span>隐藏市场总监信息</a>
</div>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list data_game_list">
<div class="">
@ -98,6 +111,9 @@
<!-- 表头 -->
<thead>
<tr>
<th class="">
<input class="check-all" type="checkbox">
</th>
<th style="width:10%;min-width:150px;">操作</th>
<th>合作方名称</th>
<th>对应平台</th>
@ -125,6 +141,7 @@
<else />
<volist name="listData" id="data" key="companykey">
<tr>
<td rowspan="{$data.row}"><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]"></td>
<td rowspan="{$data.row}">
<a href="{:U('view',array('id'=>$data['id']))}">查看</a>
<a href="{:U('edit',array('id'=>$data['id']))}">编辑</a>

@ -34,9 +34,9 @@
<div class="cf top_nav_list">
<!-- <div class="fl button_list">
<a class="confirm ajax-post" id="dtnn" target-form="ids" url="{:U('Member/delprovide')}"><span class="button_icon button_icon2 "></span>批量删除</a>
</div> -->
<div class="fl button_list">
<a class="confirm ajax-post" id="dtnn" target-form="ids" url="{:U('PromoteCompany/serviceAgreementSave', ['delete'=>1])}"><span class="button_icon button_icon2 "></span>批量删除</a>
</div>
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list">
<div class="input-list">
@ -55,9 +55,9 @@
<!-- 表头 -->
<thead>
<tr>
<!-- <th class="">
<th class="">
<input class="check-all" type="checkbox">
</th> -->
</th>
<th>ID</th>
<th>标题</th>
<th>是否默认合同</th>
@ -74,11 +74,15 @@
<else/>
<volist name="list_data" id="data">
<tr>
<!-- <td><input class="ids" type="checkbox" value="{$data['id']}" name="ids"></td> -->
<td><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]"></td>
<td>{$data.id}</td>
<td>{$data.name}</td>
<td>{$data.status}</td>
<td><textarea disabled>{$data.company_name}</textarea></td>
<td style="width: 500px;">
<div style="height: 100px;overflow-x: hidden;overflow-y: scroll;">
{$data.company_name}
</div>
</td>
<td>{:get_admin_nickname($data['creator'])}</td>
<td>{$data.created_time|date='Y-m-d H:i:s',###}</td>
<td>
@ -203,5 +207,7 @@
});
})
</script>
</block>

Loading…
Cancel
Save