From 93601a33029df40a469f591d851c29256ef13d7c Mon Sep 17 00:00:00 2001 From: yulingwei <2436953959@qq.com> Date: Fri, 12 Jun 2020 16:18:13 +0800 Subject: [PATCH] upt --- .../PromoteCompanyController.class.php | 30 ++++++++++++++----- .../Admin/View/PromoteCompany/lists.html | 21 +++++++++++-- .../service_agreement_list.html | 20 ++++++++----- 3 files changed, 54 insertions(+), 17 deletions(-) diff --git a/Application/Admin/Controller/PromoteCompanyController.class.php b/Application/Admin/Controller/PromoteCompanyController.class.php index 54fb16bb2..512e9206b 100644 --- a/Application/Admin/Controller/PromoteCompanyController.class.php +++ b/Application/Admin/Controller/PromoteCompanyController.class.php @@ -305,6 +305,12 @@ class PromoteCompanyController extends ThinkController $this->assign('data', $data); $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('更新失败'); + } //编辑 @@ -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); diff --git a/Application/Admin/View/PromoteCompany/lists.html b/Application/Admin/View/PromoteCompany/lists.html index 27564e782..d2a55b961 100644 --- a/Application/Admin/View/PromoteCompany/lists.html +++ b/Application/Admin/View/PromoteCompany/lists.html @@ -34,14 +34,18 @@ padding: 3px; height: 30px; } - + .clearfix:after { + content:""; + display: block; + clear:both; + }
说明:该功能是用于录入工会所属的推广公司名称 / 如需删除公司请先将公司底下会长移走后方可操作