From 6b78ee29cfd5e0ce8f47d97e973042dae9b61f60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=BF=97=E5=BC=BA?= <357099073@qq.com> Date: Wed, 25 Jun 2025 11:52:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=91=BD=E5=90=8D=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/Businessinfo.php | 2 +- app/api/controller/Index.php | 77 +- app/api/middleware.php | 2 - app/api/view/project/view_schedule.html | 3 +- app/api/view/project/view_task.html | 4 +- app/apiout/BaseController.php | 89 ++- app/apiout/controller/Businessinfo.php | 106 +++ app/apiout/controller/Download.php | 49 ++ app/apiout/middleware.php | 15 +- app/apiout/middleware/Auth.php | 30 + app/{application => applications}/common.php | 0 .../controller/Index.php | 4 +- .../controller/Nav.php | 4 +- app/{application => applications}/event.php | 0 .../middleware.php | 0 .../validate/ApplicationCheck.php | 2 +- .../view/index/add.html | 0 .../view/index/edit.html | 0 .../view/index/index.html | 0 .../view/index/view.html | 0 .../view/nav/index.html | 13 + app/base/BaseController.php | 2 +- app/business/middleware/Auth.php | 32 +- app/business/view/index/index.html | 4 +- app/business/view/supplier/index.html | 6 +- app/download/common.php | 12 + app/download/controller/Index.php | 311 ++++++++ app/download/event.php | 5 + app/download/middleware.php | 13 + app/download/validate/DownloadCheck.php | 33 + app/download/view/index/add.html | 175 +++++ app/download/view/index/edit.html | 185 +++++ app/download/view/index/index.html | 311 ++++++++ app/download/view/index/view.html | 261 +++++++ app/information/controller/Index.php | 128 ++-- app/information/view/index/conversion.html | 0 app/information/view/index/follow.html | 0 app/information/view/index/index.html | 270 ++++--- app/information/view/index/view.html | 680 ++++++------------ app/model/Download.php | 34 + app/model/DownloadCate.php | 40 ++ app/model/Information.php | 52 +- app/product/controller/Index.php | 6 +- app/product/view/index/index.html | 95 +-- app/project/controller/Index.php | 254 ++++--- app/project/view/index/add.html | 156 ++-- app/project/view/index/edit.html | 2 +- app/project/view/index/index.html | 3 +- app/project/view/index/view.html | 370 +++++----- app/reimbursement/controller/Index.php | 107 ++- app/reimbursement/view/index/edititem.html | 349 +++++++++ app/reimbursement/view/index/index.html | 24 +- app/reimbursement/view/index/view.html | 186 +++-- app/schedule/view/index/index.html | 47 +- app/task/controller/Index.php | 3 +- app/task/view/index/index.html | 25 +- composer.json | 2 +- 57 files changed, 3295 insertions(+), 1288 deletions(-) create mode 100644 app/apiout/controller/Businessinfo.php create mode 100644 app/apiout/controller/Download.php create mode 100644 app/apiout/middleware/Auth.php rename app/{application => applications}/common.php (100%) rename app/{application => applications}/controller/Index.php (99%) rename app/{application => applications}/controller/Nav.php (82%) rename app/{application => applications}/event.php (100%) rename app/{application => applications}/middleware.php (100%) rename app/{application => applications}/validate/ApplicationCheck.php (95%) rename app/{application => applications}/view/index/add.html (100%) rename app/{application => applications}/view/index/edit.html (100%) rename app/{application => applications}/view/index/index.html (100%) rename app/{application => applications}/view/index/view.html (100%) rename app/{application => applications}/view/nav/index.html (92%) create mode 100644 app/download/common.php create mode 100644 app/download/controller/Index.php create mode 100644 app/download/event.php create mode 100644 app/download/middleware.php create mode 100644 app/download/validate/DownloadCheck.php create mode 100644 app/download/view/index/add.html create mode 100644 app/download/view/index/edit.html create mode 100644 app/download/view/index/index.html create mode 100644 app/download/view/index/view.html create mode 100644 app/information/view/index/conversion.html create mode 100644 app/information/view/index/follow.html create mode 100644 app/model/Download.php create mode 100644 app/model/DownloadCate.php create mode 100644 app/reimbursement/view/index/edititem.html diff --git a/app/api/controller/Businessinfo.php b/app/api/controller/Businessinfo.php index c6d6737..f2746b7 100644 --- a/app/api/controller/Businessinfo.php +++ b/app/api/controller/Businessinfo.php @@ -26,7 +26,7 @@ class BusinessInfo extends BaseController $name = isset($_POST['name']) ? $_POST['name'] : ''; $email = isset($_POST['email']) ? $_POST['email'] : ''; $phone = isset($_POST['phone']) ? $_POST['phone'] : ''; - $ip = isset($_POST['IP']) ? $_POST['IP'] : ''; + $ip = isset($_POST['ip']) ? $_POST['ip'] : ''; $message = isset($_POST['message']) ? $_POST['message'] : ''; $product = isset($_POST['product']) ? $_POST['product'] : ''; $company = isset($_POST['company']) ? $_POST['company'] : ''; diff --git a/app/api/controller/Index.php b/app/api/controller/Index.php index 26b016d..75e1168 100644 --- a/app/api/controller/Index.php +++ b/app/api/controller/Index.php @@ -92,6 +92,74 @@ class Index extends BaseController } } + // 上传程序 + public function upload_files() + { + if (request()->file('file')) { + // 获取文件信息 + $file = request()->file('file'); + $file_name = $file->getOriginalName(); + $file_size = $file->getSize(); + $file_extension = pathinfo($file->getOriginalName(), PATHINFO_EXTENSION); + + // 文件大小限制(单位:字节) + $max_file_size = 500 * 1024 * 1024; // 500MB + + // 检查文件大小 + if ($file_size > $max_file_size) { + return json([ + 'code' => 2, + 'msg' => '文件过大,已经超过500MB,请联系管理员!', + 'max_size' => $max_file_size, + 'file_size' => $file_size + ]); + } + + // 创建文件夹 + $upload_dir = 'upload/programes/' . date('Y-m-d') . '/'; + if (!is_dir($upload_dir)) { + if (!mkdir($upload_dir, 0777, true) && !is_dir($upload_dir)) { + throw new \RuntimeException(sprintf('Directory "%s" was not created', $upload_dir)); + } + } + + // 生成新文件名 + $new_name = $this->generateRandomName(5) . '.' . $file_extension; + + // 保存文件 + $file->move($upload_dir, $new_name); + + // 添加数据到数据库 + $data = [ + 'path' => $upload_dir . $new_name, + 'uid' => $this->uid, + 'create_time' => date('Y-m-d H:i:s', time()) + ]; + Db::name('DownloadFiles')->insert($data); + + // 获取文件上传域名 + $fileDomain = $_SERVER['HTTP_HOST']; + + // 构建文件访问地址 + $url = $fileDomain . '/upload/programes/' . date('Y-m-d') . '/' . $new_name; + + // 返回 JSON 数据 + return json([ + 'code' => 200, + 'msg' => '文件上传成功!', + 'fileDomain' => $fileDomain, + 'filename' => $file_name, + 'filepath' => $upload_dir . $new_name, + 'file_size'=> $file_size, + 'file_extension'=> $file_extension, + 'url' => $url, + 'admin_id' => $this->uid + ]); + } else { + return json(['code' => 400, 'msg' => '未选择上传文件!']); + } + } + // 图床上传 public function upload_picbed() { @@ -563,7 +631,7 @@ class Index extends BaseController header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Headers: Content-Type'); - $images = Db::name('PicbedImages')->order('id', 'desc')->select()->toArray(); + $images = Db::name('PicbedImages')->order('id', 'desc')->select()->toArray(); // 获取当前请求的域名 $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; @@ -574,14 +642,15 @@ class Index extends BaseController $images = array_map(function ($image) use ($baseUrl) { return [ 'name' => htmlspecialchars($image['name'], ENT_QUOTES), - 'path' => $baseUrl . '/' . $image['path'], + 'path' => $baseUrl . '/' . $image['path'], ]; }, $images); - return json(['code' => 0, 'msg' => '', 'data' => $images]); + return json(['code' => 0, 'msg' => '', 'data' => $images]); } - public function getallstaff(){ + public function getallstaff() + { $employees = Db::name('admin') ->field('id, name, status') // 根据需要选择字段 ->where('status', 1) // 只获取在职员工 diff --git a/app/api/middleware.php b/app/api/middleware.php index 4ecb7bc..dce057f 100644 --- a/app/api/middleware.php +++ b/app/api/middleware.php @@ -5,6 +5,4 @@ return [ //'think\middleware\SessionInit', //验证勾股cms是否完成安装 \app\home\middleware\Install::class, - // 跳过登录验证 AuthMiddleware - \app\api\middleware\Auth::class, ]; \ No newline at end of file diff --git a/app/api/view/project/view_schedule.html b/app/api/view/project/view_schedule.html index 2fea52c..80ba7bc 100644 --- a/app/api/view/project/view_schedule.html +++ b/app/api/view/project/view_schedule.html @@ -1,6 +1,7 @@
+
@@ -24,7 +25,7 @@ title: '工作记录列表', cellMinWidth: 200, url: "/api/schedule/index", //数据接口 - where: { 'tid': project_id }, + where: { 'tid': project_id}, page: true, //开启分页 limit: 20, cols: [[ //表头 diff --git a/app/api/view/project/view_task.html b/app/api/view/project/view_task.html index 9304d4e..443ff1c 100644 --- a/app/api/view/project/view_task.html +++ b/app/api/view/project/view_task.html @@ -19,7 +19,6 @@ \ No newline at end of file diff --git a/app/download/view/index/edit.html b/app/download/view/index/edit.html new file mode 100644 index 0000000..028c812 --- /dev/null +++ b/app/download/view/index/edit.html @@ -0,0 +1,185 @@ + +

软件信息

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
软件名称* + + + 软件分类 + + +
软件版本 + + +
上传文件 + + 文件路径 + +
文件类型 + + + 文件大小 + +
下载链接 + + + 分享码 + +
软件描述 + + + +
+ +
+ + +
+ + + \ No newline at end of file diff --git a/app/download/view/index/index.html b/app/download/view/index/index.html new file mode 100644 index 0000000..c986da0 --- /dev/null +++ b/app/download/view/index/index.html @@ -0,0 +1,311 @@ +{extend name="../../base/view/common/base" /} + +{block name="breadcrumb"} + + 江苏美天科技 + + 应用 + + + 软件管理 + + +{/block} +{block name="body"} +
+
+ + +
+
+
+
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+ +
+
+ + +
+
+
+
+{/block} + + + +{block name="script"} + + + +{/block} + \ No newline at end of file diff --git a/app/download/view/index/view.html b/app/download/view/index/view.html new file mode 100644 index 0000000..b917daa --- /dev/null +++ b/app/download/view/index/view.html @@ -0,0 +1,261 @@ + + + + + + + + + + + + + + + + + +
+
+
+
+

+ 供应商详情 - {$detail.supplier_name} +

+
+
创建日期:{$detail.create_time}
+
+
+
+
+
基础信息
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
供应商名称 + + {$detail.supplier_name|default="-"} + 注册地址 + + {$detail.registered_address|default="-"} +
联系人名称 + + {$detail.contact_name|default="-"} + 联系电话 + + {$detail.contact_phone|default="-"} +
电子邮件 + + {$detail.contact_email|default="-"} + 微信 + + {$detail.contact_wechat|default="-"} +
规模 + +
业务范围 + + {$detail.business_scope|default="-"} +
+
+ +
+
开票信息
+ + + + + + + + + + + + + + + + + + + +
开票企业名称 + + {$detail.invoice_company_name|default="-"} + 纳税人识别号 + + {$detail.taxpayer_id|default="-"} +
开票地址 + + {$detail.invoice_address|default="-"} + 开票电话 + + {$detail.invoice_phone|default="-"} +
开户行 + + {$detail.bank_name|default="-"} + 开户帐号 + + {$detail.bank_account|default="-"} +
+
+ +
+
其他
+ + + + + + + + + +
备注 + + {$detail.remarks|default="-"} +
合作意向 + + {$detail.intention|default="-"} +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/app/information/controller/Index.php b/app/information/controller/Index.php index 6547dcc..1f92955 100644 --- a/app/information/controller/Index.php +++ b/app/information/controller/Index.php @@ -11,12 +11,57 @@ namespace app\information\controller; use app\base\BaseController; use app\model\Information as InformationList; use app\business_info\validate\InformationCheck; +use Error; use think\exception\ValidateException; use think\facade\Db; use think\facade\View; class Index extends BaseController { + // 查询 IP 地址 + public function ipquery($ip) + { + $url = "https://cn.apihz.cn/api/ip/chaapi.php?ip={$ip}&id=10001344&key=3cffc3ad20630afffe65c3b908d6ebd4"; + $response = @file_get_contents($url); + if ($response) { + $ipData = json_decode($response, true); + if ($ipData && isset($ipData['ip'])) { + $q = "{$ipData['msg']}({$ipData['ip']})"; + if (is_string($q)) { + return $q; + } + } + } + return '接口每分钟查询次数用完,请稍后再试'; + } + + public function translateToChinese($q) + { + $id = 10001344; + $key = '3cffc3ad20630afffe65c3b908d6ebd4 '; + + // 构造请求URL + $url = "https://cn.apihz.cn/api/zici/fanyiapihz.php?id=" . $id . "&key=" . $key . "&words=" . $q . "&ytype=1&etype=2&htype=0"; + + //调试输出语句 + var_dump($url); + + // 发送请求并获取响应 + $response = @file_get_contents($url); + + // 处理响应 + if ($response) { + $data = json_decode($response, true); + if (isset($data['translation'][0])) { + return $data['translation'][0]; // 返回翻译结果 + } + } + + // 返回错误信息 + return $q; + } + + public function index() { if (request()->isAjax()) { @@ -28,21 +73,23 @@ class Index extends BaseController ->order('id desc') ->paginate($rows, false, ['query' => $param]) ->each(function ($item, $key) { - $bi = Db::name('Information')->where(['id' => $item->id])->find(); - - // 获取对应product id的name - $product = Db::name('Product')->where(['id' => $bi['product']])->find(); - $productName = $product ? $product['name'] : ''; - - $item->name = $bi['name']; - $item->email = $bi['email']; - $item->phone = $bi['phone']; - $item->message = $bi['message']; - $item->product = $productName; // 将产品名称传递给前端 - $item->company = $bi['company']; - $item->create_time = $bi['create_time']; - $item->update_time = $bi['update_time']; - $item->delete_time = $bi['delete_time']; + // 这里简化查询逻辑,避免重复查询 + $item->product = Db::name('Product')->where('id', $item->product)->value('name') ?: ''; + $item->ip = $this->ipquery($item->ip); // 调用 ipquery 方法查询 IP 数据 + switch ($item->status) { + case 0: + $item->status = '新商机'; + break; + case 1: + $item->status = '已跟进'; + break; + case 2: + $item->status = '已转化'; + break; + case 3: + $item->status = '已关闭'; + break; + } }) ->filter(function ($item) { return $item->delete_time === null; @@ -60,7 +107,7 @@ class Index extends BaseController try { // 查询数据,分页设置每页10条 $list = Db::name('Information') -// ->field('id, title, content, create_time, update_time') // 选择所需字段 + // ->field('id, title, content, create_time, update_time') // 选择所需字段 ->order('id desc') // 按 id 倒序排序 ->paginate(10); // 每页10条记录 @@ -186,54 +233,12 @@ class Index extends BaseController $param = get_params(); $id = isset($param['id']) ? $param['id'] : 0; $detail = (new InformationList())->detail($id); - // print_r($id); + // print_r($id); if (empty($detail)) { - return to_assign(1, '2.信息不存在'); + return to_assign(1, '无法查询到详情信息'); } else { - if ($this->uid != $detail['admin_id']) { // 当前登录用户必须是上传者才能查看 - return to_assign(1, '您没权限查看该信息'); - } - $role_uid = [$detail['admin_id'], $detail['director_uid']]; - $role_edit = 'edit'; - $view_uid = $role_uid; - // if (!empty($detail['check_admin_ids'])) { - // $view_uid = array_merge($role_uid, explode(",", $detail['check_admin_ids'])); - // } - if (!in_array($this->uid, $view_uid) && $detail['is_open'] == 1) { - return to_assign(1, '您没权限查看该信息'); - } - $contact_array = Db::name('Businesscontact') - ->field('i.id,i.business_id,i.contact,i.post,i.phone,i.email,i.wechat,i.qq,a.name as admin_name') - ->alias('i') - ->join('Admin a', 'i.admin_id = a.id', 'LEFT') - ->join('Information b', 'i.business_id = b.id', 'LEFT') - ->order('i.create_time desc') - ->where(array('i.business_id' => $id)) - ->where('i.delete_time', null) - ->select()->toArray(); - - $file_array = Db::name('FileInterfix') - ->field('i.id,i.topic_id,i.admin_id,f.name,f.filesize,f.filepath,a.name as admin_name') - ->alias('i') - ->join('File f', 'i.file_id = f.id', 'LEFT') - ->join('Admin a', 'i.admin_id = a.id', 'LEFT') - ->order('i.create_time desc') - ->where(array('i.topic_id' => $id, 'i.module' => 'picbed')) - ->select()->toArray(); - - $link_array = Db::name('LinkInterfix') - ->field('i.id,i.topic_id,i.admin_id,i.desc,i.url,a.name as admin_name') - ->alias('i') - ->join('Admin a', 'i.admin_id = a.id', 'LEFT') - ->order('i.create_time desc') - ->where(array('i.topic_id' => $id, 'i.module' => 'picbed', 'delete_time' => 0)) - ->select()->toArray(); View::assign('detail', $detail); - View::assign('contact_array', $contact_array); - View::assign('file_array', $file_array); - View::assign('link_array', $link_array); - View::assign('role_edit', $role_edit); - View::assign('id', $id); + // print_r($detail); return view(); } } @@ -267,4 +272,5 @@ class Index extends BaseController return to_assign(1, "错误的请求"); } } + } \ No newline at end of file diff --git a/app/information/view/index/conversion.html b/app/information/view/index/conversion.html new file mode 100644 index 0000000..e69de29 diff --git a/app/information/view/index/follow.html b/app/information/view/index/follow.html new file mode 100644 index 0000000..e69de29 diff --git a/app/information/view/index/index.html b/app/information/view/index/index.html index 93d081f..e876e79 100644 --- a/app/information/view/index/index.html +++ b/app/information/view/index/index.html @@ -3,7 +3,9 @@ {block name="breadcrumb"} 江苏美天科技 - CRM + + 应用 + 商机管理 {/block} {block name="body"} @@ -20,82 +22,22 @@ {block name="script"} {/block} \ No newline at end of file diff --git a/app/information/view/index/view.html b/app/information/view/index/view.html index b4ac8a6..c11ca1c 100644 --- a/app/information/view/index/view.html +++ b/app/information/view/index/view.html @@ -1,467 +1,255 @@ -
-
-

- 商务信息 - - {$detail.name} - -

-
- #B{$detail.id} - {$detail.admin_name} - 创建于{$detail.times}{gt name="$detail.update_time" value="0"},最近更新于 {:time_trans($detail.update_time)}{/gt} - - {eq name="$detail.admin_id" value="$params.uid"} - - 删除 - - {/eq} -
-
-
-
- - - - - - - - - - - - - -
创建人 - {$detail.admin_name} - 访问权限 - - {eq name="$detail.is_open" value="1" } - 内部 (仅创建人、对接人、可访问) - {/eq} - {eq name="$detail.is_open" value="2" }公开 (有对接权限员工均可访问){/eq} - - -
主要对接人 - {$detail.director_name} - - 内部可对接人员 - {$detail.check_admin_names} - -
-
-
备注信息
-
{$detail.md_content|raw}
-
-
-
联系人 - - 新增 - -
- - - - - - - - - - - - - - - {volist name="contact_array" id="vo"} - - - - - - - - - - - {/volist} - {empty name="$contact_array" } - - - - {/empty} - -
联系人职务电话邮箱微信QQ创建人操作
{$vo.contact}{$vo.post}{$vo.phone}{$vo.email}{$vo.wechat}{$vo.qq}{$detail.admin_name} - - 编辑 - 删除 -
暂无其他联系人
-
-
-
文件附件
+ + + + + + + + + + + + + + + + + +
+
+
- {eq name="$role_edit" value="edit"} - - 上传前,请规范命名,最大只能上传{:get_system_info('upload_max_filesize')}的文件,超过请压缩成多个文件上传。 -
- - - - - - - - - - - {volist name="file_array" id="vo"} - - - - - - - {/volist} - -
文件名文件大小上传人操作
{$vo.name}{$vo.filesize/1048576|round=2}MB{$vo.admin_name} -
- 下载 - 删除 -
-
+

+ 商机详情 - {$detail.company} +

- {else/} - - - - - - - - - - - {volist name="file_array" id="vo"} - - - - - - - {/volist} - {empty name="$file_array" } - - - - {/empty} - -
文件名文件大小上传人操作
{$vo.name}{$vo.filesize/1048576|round=2}MB{$vo.admin_name} - 下载 -
暂无附件
- {/eq} +
创建日期:{$detail.create_time}
- - -
-
-
    -
  • 互动评论({$detail.comments})
  • -
  • 操作日志({$detail.logs})
  • -
-
-
-
- -
-
-
-
-
-
-
-
-
- + + \ No newline at end of file + + // //状态转换 + // document.addEventListener('DOMContentLoaded', function () { + // var Status = '{$detail.status|default="-"}'; + // var sizeText; + + // switch (Status) { + // case '0': + // sizeText = '新商机'; + // break; + // case '1': + // sizeText = '已跟进'; + // break; + // case '2': + // sizeText = '已转化'; + // break; + // case '3': + // sizeText = '已关闭'; + // break; + // default: + // sizeText = '-'; // 默认值 + // } + + // document.getElementById('status').textContent = sizeText; + // }); + + + + \ No newline at end of file diff --git a/app/model/Download.php b/app/model/Download.php new file mode 100644 index 0000000..f1b895f --- /dev/null +++ b/app/model/Download.php @@ -0,0 +1,34 @@ + '关闭', + self::ONE => '开启', + ]; + //详情 + public function detail($id) + { + $detail = Db::name('Download')->where(['id' => $id])->find(); + if (!empty($detail)) { + $detail['name'] = Db::name('Download')->where(['id' => $detail['id']])->value('name'); + $detail['cid'] = Db::name('Download')->where('id', $detail['id'])->value('cid'); + $detail['uid'] = Db::name('Download')->where('id', $detail['id'])->value('uid'); + $detail['name'] = Db::name('Download')->where(['id' => $detail['id']])->value('name'); + $detail['version'] = Db::name('Download')->where(['id' => $detail['id']])->value('version'); + $detail['description'] = Db::name('Download')->where(['id' => $detail['id']])->value('description'); + $detail['path'] = Db::name('Download')->where(['id' => $detail['id']])->value('path'); + $detail['download_url'] = Db::name('Download')->where(['id' => $detail['id']])->value('download_url'); + $detail['download_code'] = Db::name('Download')->where(['id' => $detail['id']])->value('download_code'); + $detail['create_time'] = Db::name('Download')->where(['id' => $detail['id']])->value('create_time'); + } + return $detail; + } +} diff --git a/app/model/DownloadCate.php b/app/model/DownloadCate.php new file mode 100644 index 0000000..0638b80 --- /dev/null +++ b/app/model/DownloadCate.php @@ -0,0 +1,40 @@ + '关闭', + self::ONE => '开启', + ]; + //详情 + public function detail($id) + { + $detail = Db::name('Supplier')->where(['id' => $id])->find(); + if (!empty($detail)) { + $detail['supplier_name'] = Db::name('Supplier')->where(['id' => $detail['id']])->value('supplier_name'); + $detail['contact_name'] = Db::name('Supplier')->where('id', $detail['id'])->value('contact_name'); + $detail['contact_phone'] = Db::name('Supplier')->where('id', $detail['id'])->value('contact_phone'); + $detail['contact_email'] = Db::name('Supplier')->where(['id' => $detail['id']])->value('contact_email'); + $detail['contact_wechat'] = Db::name('Supplier')->where(['id' => $detail['id']])->value('contact_wechat'); + $detail['registered_address'] = Db::name('Supplier')->where(['id' => $detail['id']])->value('registered_address'); + $detail['business_scope'] = Db::name('Supplier')->where(['id' => $detail['id']])->value('business_scope'); + $detail['company_size'] = Db::name('Supplier')->where(['id' => $detail['id']])->value('company_size'); + $detail['invoice_company_name'] = Db::name('Supplier')->where(['id' => $detail['id']])->value('invoice_company_name'); + $detail['taxpayer_id'] = Db::name('Supplier')->where(['id' => $detail['id']])->value('taxpayer_id'); + $detail['invoice_address'] = Db::name('Supplier')->where(['id' => $detail['id']])->value('invoice_address'); + $detail['invoice_phone'] = Db::name('Supplier')->where(['id' => $detail['id']])->value('invoice_phone'); + $detail['bank_name'] = Db::name('Supplier')->where(['id' => $detail['id']])->value('bank_name'); + $detail['bank_account'] = Db::name('Supplier')->where(['id' => $detail['id']])->value('bank_account'); + $detail['remarks'] = Db::name('Supplier')->where(['id' => $detail['id']])->value('remarks'); + $detail['create_time'] = Db::name('Supplier')->where(['id' => $detail['id']])->value('create_time'); + } + return $detail; + } +} diff --git a/app/model/Information.php b/app/model/Information.php index 2b52f17..3ef4c63 100644 --- a/app/model/Information.php +++ b/app/model/Information.php @@ -1,8 +1,8 @@ where('id', $id)->find(); + $detail = Db::name('Information')->where(['id' => $id])->find(); if (!empty($detail)) { - $detail['admin_name'] = Db::name('Admin')->where(['id' => $detail['admin_id']])->value('name'); - $detail['director_name'] = Db::name('Admin')->where(['id' => $detail['director_uid']])->value('name'); - $check_admin_names = Db::name('Admin')->where('id', 'in', $detail['check_admin_ids'])->column('name'); - $detail['check_admin_names'] = implode(',', $check_admin_names); - $detail['times'] = time_trans($detail['create_time']); - $detail['logs'] = Db::name('Log')->where(['module' => 'business', 'business_id' => $detail['id']])->count(); - $detail['comments'] = Db::name('Comment')->where(['module' => 1, 'delete_time' => 0, 'topic_id' => $detail['id']])->count(); - $detail['projects'] = Db::name('Project')->where(['delete_time' => 0, 'id' => $detail['id']])->count(); - $detail['md_content'] = Db::name('Business')->where(['id' => $detail['id']])->value('md_content'); - $detail['content'] = Db::name('Business')->where(['id' => $detail['id']])->value('content'); - // print_r($detail['md_content']); -// $task_map = []; -// $task_map[] = ['delete_time', '=', 0]; - - //任务 - $task_cate = Db::name('TaskCate')->where(['status' => 1])->select()->toArray(); - foreach ($task_cate as $k => $v) { - $task_map[] = ['type', '=', $v['id']]; - $task_cate[$k]['count'] = Db::name('Task')->where($task_map)->count(); + $detail['name'] = Db::name('Information')->where(['id' => $detail['id']])->value('name'); + $detail['email'] = Db::name('Information')->where('id', $detail['id'])->value('email'); + $detail['phone'] = Db::name('Information')->where('id', $detail['id'])->value('phone'); + $detail['message'] = Db::name('Information')->where(['id' => $detail['id']])->value('message'); + $productId = Db::name('Information')->where(['id' => $detail['id']])->value('product'); + $detail['product'] = Db::name('Product')->where(['id' => $productId])->value('name'); + $detail['company'] = Db::name('Information')->where(['id' => $detail['id']])->value('company'); + $detail['ip'] = Db::name('Information')->where(['id' => $detail['id']])->value('ip'); + $status = Db::name('Information')->where(['id' => $detail['id']])->value('status'); + switch ($status) { + case 0: + $detail['status'] = '新商机'; + break; + case 1: + $detail['status'] = '已跟进'; + break; + case 2: + $detail['status'] = '已转化'; + break; + case 3: + $detail['status'] = '已关闭'; + break; + } + $timestamp = Db::name('Information')->where(['id' => $detail['id']])->value('create_time'); + $detail['create_time'] = date('Y-m-d H:i:s', $timestamp); } - $detail['task_cate'] = $task_cate; - } return $detail; } -} \ No newline at end of file +} diff --git a/app/product/controller/Index.php b/app/product/controller/Index.php index a5a39d6..80cc205 100644 --- a/app/product/controller/Index.php +++ b/app/product/controller/Index.php @@ -39,9 +39,9 @@ class Index extends BaseController $rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit']; $list = ProductList::withoutField('content,md_content') - ->where(function ($query) use ($map1, $map2, $map3, $map4) { - $query->where($map1)->whereor($map2)->whereor($map3)->whereor($map4); - }) + // ->where(function ($query) use ($map1, $map2, $map3, $map4) { + // $query->where($map1)->whereor($map2)->whereor($map3)->whereor($map4); + // }) ->where('delete_time', 0) ->order('id desc') ->paginate($rows, false, ['query' => $param]) diff --git a/app/product/view/index/index.html b/app/product/view/index/index.html index fc434f9..9158b72 100644 --- a/app/product/view/index/index.html +++ b/app/product/view/index/index.html @@ -18,55 +18,60 @@ {block name="script"} {/block} \ No newline at end of file diff --git a/app/project/controller/Index.php b/app/project/controller/Index.php index 0487e0b..1556303 100644 --- a/app/project/controller/Index.php +++ b/app/project/controller/Index.php @@ -32,8 +32,22 @@ class Index extends BaseController ->paginate($rows, false, ['query' => $param]) ->each(function ($item, $key) { $item->director_name = Db::name('Admin')->where(['id' => $item->director_uid])->value('name'); - $item->plan_time = date('Y-m-d', $item->start_time) . ' 至 ' . date('Y-m-d', $item->end_time); - $item->status_name = ProjectList::$Status[(int)$item->status]; + // 判断时间戳是否为空,如果为空则返回“-” + $item->plan_time = $item->start_time && $item->end_time + ? date('Y-m-d', $item->start_time) . ' ~ ' . date('Y-m-d', $item->end_time) + : '-'; + $item->project_plan_time = $item->project_start_time + ? ( + $item->project_end_time + ? ( + date('Y-m-d', $item->project_end_time) === '1970-01-01' + ? date('Y-m-d', $item->project_start_time) . ' ~ 至今' + : date('Y-m-d', $item->project_start_time) . ' ~ ' . date('Y-m-d', $item->project_end_time) + ) + : date('Y-m-d', $item->project_start_time) . ' ~ 至今' + ) + : '-'; + $item->status_name = ProjectList::$Status[(int) $item->status]; $business = BusinessList::where('id', $item->business_id)->find(); $item->business_id = $business ? ($business->name_short ?: $business->name) : null; @@ -100,7 +114,7 @@ class Index extends BaseController $flowNameData = isset($param['flowName']) ? $param['flowName'] : ''; $flowUidsData = isset($param['chargeIds']) ? $param['chargeIds'] : ''; $flowIdsData = isset($param['membeIds']) ? $param['membeIds'] : ''; -// $flowDateData = isset($param['cycleDate']) ? $param['cycleDate'] : ''; + // $flowDateData = isset($param['cycleDate']) ? $param['cycleDate'] : ''; $flow = []; $time_1 = $param['start_time']; $time_2 = $param['end_time']; @@ -108,7 +122,7 @@ class Index extends BaseController if (!$value) { continue; } -// $flowDate = explode('到', $flowDateData[$key]); + // $flowDate = explode('到', $flowDateData[$key]); // $start_time = strtotime(urldecode(trim($flowDate[0]))); // $end_time = strtotime(urldecode(trim($flowDate[1]))); // if ($start_time < $time_1) { @@ -131,7 +145,7 @@ class Index extends BaseController $item['flow_uid'] = $flowUidsData[$key]; $item['flow_ids'] = $flowIdsData[$key]; $item['sort'] = $key; -// $item['start_time'] = $start_time; + // $item['start_time'] = $start_time; // $item['end_time'] = $end_time; $item['create_time'] = time(); $flow[] = $item; @@ -155,7 +169,7 @@ class Index extends BaseController if (!empty($param['team_admin_ids'])) { $project_users .= "," . $param['team_admin_ids']; } - $project_array = explode(",", (string)$project_users); + $project_array = explode(",", (string) $project_users); $project_array = array_unique($project_array); $project_user_array = []; foreach ($project_array as $k => $v) { @@ -209,137 +223,143 @@ class Index extends BaseController //编辑 public function edit() -{ - $param = get_params(); - $id = isset($param['id']) ? $param['id'] : 0; - $detail = (new ProjectList())->detail($id); + { + $param = get_params(); + $id = isset($param['id']) ? $param['id'] : 0; + $detail = (new ProjectList())->detail($id); - if (request()->isPost()) { - if ($this->uid == $detail['admin_id'] || $this->uid == $detail['director_uid']) { - try { - validate(ProjectCheck::class)->scene('edit')->check($param); - } catch (ValidateException $e) { - return json(['code' => 1, 'msg' => $e->getError()]); - } - - // Convert start_time and end_time from date string to Unix timestamp - if (!empty($param['start_time'])) { - $param['start_time'] = strtotime($param['start_time']); - } - if (!empty($param['end_time'])) { - $param['end_time'] = strtotime($param['end_time']); - } - - $param['update_time'] = time(); - $res = ProjectList::where('id', $param['id'])->strict(false)->field(true)->update($param); - if ($res) { - // 新增 team_admin_ids 处理逻辑 - $project_users = $this->uid; - if (!empty($param['director_uid'])) { - $project_users .= "," . $param['director_uid']; + if (request()->isPost()) { + if ($this->uid == $detail['admin_id'] || $this->uid == $detail['director_uid']) { + try { + validate(ProjectCheck::class)->scene('edit')->check($param); + } catch (ValidateException $e) { + return json(['code' => 1, 'msg' => $e->getError()]); } - // 如果 team_admin_ids 存在,则拆解并加入到 $project_users - if (!empty($param['team_admin_ids'])) { - $project_users .= "," . $param['team_admin_ids']; + // 将时间从日期字符串转换为Unix时间戳 + if (!empty($param['start_time'])) { + $param['start_time'] = strtotime($param['start_time']); + } + if (!empty($param['end_time'])) { + $param['end_time'] = strtotime($param['end_time']); + } + if (!empty($param['project_start_time'])) { + $param['project_start_time'] = strtotime($param['project_start_time']); + } + if (!empty($param['project_end_time'])) { + $param['project_end_time'] = strtotime($param['project_end_time']); } - // 将 $project_users 拆解为数组,去重 - $project_array = explode(",", (string)$project_users); - $project_array = array_unique($project_array); + $param['update_time'] = time(); + $res = ProjectList::where('id', $param['id'])->strict(false)->field(true)->update($param); + if ($res) { + // 新增 team_admin_ids 处理逻辑 + $project_users = $this->uid; + if (!empty($param['director_uid'])) { + $project_users .= "," . $param['director_uid']; + } - // 获取当前已有的项目用户 - $existing_users = Db::name('ProjectUser')->where('project_id', $param['id'])->column('uid'); - $delete_users = array_diff($existing_users, $project_array); // 找出要删除的用户 + // 如果 team_admin_ids 存在,则拆解并加入到 $project_users + if (!empty($param['team_admin_ids'])) { + $project_users .= "," . $param['team_admin_ids']; + } - // 删除用户,将 `delete_time` 设置为当前时间 - if (!empty($delete_users)) { - Db::name('ProjectUser')->where('project_id', $param['id']) - ->whereIn('uid', $delete_users) - ->update(['delete_time' => time()]); - } + // 将 $project_users 拆解为数组,去重 + $project_array = explode(",", (string) $project_users); + $project_array = array_unique($project_array); - // 插入新用户(如果之前没有的话) - $project_user_array = []; - foreach ($project_array as $k => $v) { - if (is_numeric($v)) { - $project_user_array[] = array( - 'uid' => $v, + // 获取当前已有的项目用户 + $existing_users = Db::name('ProjectUser')->where('project_id', $param['id'])->column('uid'); + $delete_users = array_diff($existing_users, $project_array); // 找出要删除的用户 + + // 删除用户,将 `delete_time` 设置为当前时间 + if (!empty($delete_users)) { + Db::name('ProjectUser')->where('project_id', $param['id']) + ->whereIn('uid', $delete_users) + ->update(['delete_time' => time()]); + } + + // 插入新用户(如果之前没有的话) + $project_user_array = []; + foreach ($project_array as $k => $v) { + if (is_numeric($v)) { + $project_user_array[] = array( + 'uid' => $v, + 'admin_id' => $this->uid, + 'project_id' => $param['id'], + 'create_time' => time(), + ); + } + } + + // 插入或更新 ProjectUser 表 + Db::name('ProjectUser')->strict(false)->field(true)->insertAll($project_user_array); + + // 更新阶段的处理逻辑(保持不变) + if (isset($param['director_uid'])) { + $project_user = [ + 'uid' => $param['director_uid'], 'admin_id' => $this->uid, 'project_id' => $param['id'], 'create_time' => time(), - ); + 'delete_time' => 0, + ]; + $has = Db::name('ProjectUser')->where(['uid' => $param['director_uid'], 'project_id' => $param['id']])->find(); + if (empty($has)) { + Db::name('ProjectUser')->strict(false)->field(true)->insert($project_user); + } else { + Db::name('ProjectUser')->where(['id' => $has['id']])->strict(false)->field(true)->update($project_user); + } } + + add_log('edit', $param['id'], $param, $detail); + } + return json(['code' => 0, 'msg' => '编辑成功']); + } else { + return json(['code' => 1, 'msg' => '只有创建人或者负责人才有权限编辑']); + } + } else { + if (empty($detail)) { + return json(['code' => 1, 'msg' => '项目不存在']); + } else { + $step_array = Db::name('Step') + ->field('s.*,a.name as check_name') + ->alias('s') + ->join('Admin a', 'a.id = s.flow_uid', 'LEFT') + ->order('s.sort asc') + ->where(['s.action_id' => $id, 's.type' => 1, 's.delete_time' => 0]) + ->select()->toArray(); + foreach ($step_array as &$vv) { + $flow_names = Db::name('Admin')->where([['id', 'in', $vv['flow_ids']]])->column('name'); + $vv['flow_names'] = implode(',', $flow_names); } - // 插入或更新 ProjectUser 表 - Db::name('ProjectUser')->strict(false)->field(true)->insertAll($project_user_array); + $file_array = Db::name('FileInterfix') + ->field('mf.id,mf.topic_id,mf.admin_id,f.name,f.filesize,f.filepath,a.name as admin_name') + ->alias('mf') + ->join('File f', 'mf.file_id = f.id', 'LEFT') + ->join('Admin a', 'mf.admin_id = a.id', 'LEFT') + ->order('mf.create_time desc') + ->where(['mf.topic_id' => $id, 'mf.module' => 'project']) + ->select()->toArray(); - // 更新阶段的处理逻辑(保持不变) - if (isset($param['director_uid'])) { - $project_user = [ - 'uid' => $param['director_uid'], - 'admin_id' => $this->uid, - 'project_id' => $param['id'], - 'create_time' => time(), - 'delete_time' => 0, - ]; - $has = Db::name('ProjectUser')->where(['uid' => $param['director_uid'], 'project_id' => $param['id']])->find(); - if (empty($has)) { - Db::name('ProjectUser')->strict(false)->field(true)->insert($project_user); - } else { - Db::name('ProjectUser')->where(['id' => $has['id']])->strict(false)->field(true)->update($project_user); - } - } - - add_log('edit', $param['id'], $param, $detail); + return json([ + 'code' => 0, + 'msg' => '成功', + 'data' => [ + 'detail' => $detail, + 'step_array' => $step_array, + 'file_array' => $file_array, + ] + ]); } - return json(['code' => 0, 'msg' => '编辑成功']); - } else { - return json(['code' => 1, 'msg' => '只有创建人或者负责人才有权限编辑']); - } - } else { - if (empty($detail)) { - return json(['code' => 1, 'msg' => '项目不存在']); - } else { - $step_array = Db::name('Step') - ->field('s.*,a.name as check_name') - ->alias('s') - ->join('Admin a', 'a.id = s.flow_uid', 'LEFT') - ->order('s.sort asc') - ->where(['s.action_id' => $id, 's.type' => 1, 's.delete_time' => 0]) - ->select()->toArray(); - foreach ($step_array as &$vv) { - $flow_names = Db::name('Admin')->where([['id', 'in', $vv['flow_ids']]])->column('name'); - $vv['flow_names'] = implode(',', $flow_names); - } - - $file_array = Db::name('FileInterfix') - ->field('mf.id,mf.topic_id,mf.admin_id,f.name,f.filesize,f.filepath,a.name as admin_name') - ->alias('mf') - ->join('File f', 'mf.file_id = f.id', 'LEFT') - ->join('Admin a', 'mf.admin_id = a.id', 'LEFT') - ->order('mf.create_time desc') - ->where(['mf.topic_id' => $id, 'mf.module' => 'project']) - ->select()->toArray(); - - return json([ - 'code' => 0, - 'msg' => '成功', - 'data' => [ - 'detail' => $detail, - 'step_array' => $step_array, - 'file_array' => $file_array, - ] - ]); } } -} -// public function edit() + // public function edit() // { // $param = get_params(); // $id = isset($param['id']) ? $param['id'] : 0; @@ -434,7 +454,7 @@ class Index extends BaseController $param = get_params(); $id = isset($param['id']) ? $param['id'] : 0; -// print_r('id是:'.$id); + // print_r('id是:'.$id); // 获取项目详细信息 $detail = (new ProjectList())->detail($id); @@ -473,7 +493,7 @@ class Index extends BaseController View::assign('detail', $detail); // 传递 detail return view(); -// return json([ + // return json([ // 'code' => 1, // 'msg' => '获取项目阶段信息成功', // 'data' => [ diff --git a/app/project/view/index/add.html b/app/project/view/index/add.html index 33bbe17..4d72dda 100644 --- a/app/project/view/index/add.html +++ b/app/project/view/index/add.html @@ -1,46 +1,45 @@

新建项目

- + + - - - - - - - - - - - + + + + + + + + - - + @@ -77,7 +105,8 @@ - + - + diff --git a/app/project/view/index/index.html b/app/project/view/index/index.html index a6ed5c5..235ca91 100644 --- a/app/project/view/index/index.html +++ b/app/project/view/index/index.html @@ -71,7 +71,8 @@ } } , { field: 'director_name', title: '负责人', align: 'center', width: 80, rowspan: 2 } - , { field: 'plan_time', title: '项目周期', align: 'center', width: 240, rowspan: 2 } + , { field: 'plan_time', title: '合同周期', align: 'center', width: 240, rowspan: 2 } + , { field: 'project_plan_time', title: '项目周期', align: 'center', width: 240, rowspan: 2 } , { align: 'center', title: '关联任务', colspan: 3 } , { align: 'center', title: 'BUG缺陷', colspan: 3 } ], [ diff --git a/app/project/view/index/view.html b/app/project/view/index/view.html index 39cbba6..f1a46f0 100644 --- a/app/project/view/index/view.html +++ b/app/project/view/index/view.html @@ -105,17 +105,17 @@
{eq name="$role" value="2"} {eq name="$detail.status" value="4"} {else/} {/eq} {/eq} @@ -127,42 +127,57 @@ 项目ID: {$detail.id} - - + +

客户名称: {$detail.business_id} - - + data-val="{$detail.business_id}">{$detail.business_id} + +

- 计划完成周期: + 合同周期: {$detail.start_time|date='Y-m-d'} - 至     {$detail.end_time| + ~   {$detail.end_time| date='Y-m-d'}

+
+ 项目周期: + {$detail.project_start_time|date='Y-m-d'} + ~   + + {if $detail.project_end_time == '1970-01-01' || $detail.project_end_time == 0 || + $detail.project_end_time == ''} + 至今 + {else} + {$detail.project_end_time|date='Y-m-d'} + {/if} + +
+
创建人:{$detail.admin_name} 负责人: {$detail.director_name} - - + data-val="{$detail.director_uid}">{$detail.director_name} + + 项目成员:{$detail.team_admin_names}

项目简介: {$detail.content} - - + +
@@ -180,7 +195,7 @@ {neq name="$detail.status" value="4"}
编辑项目阶段 + class="layui-btn layui-btn-normal layui-btn-sm open-a fr">编辑项目阶段
{/neq} {/gt} @@ -191,16 +206,16 @@ 当前阶段:{$step.flow_name} 负责人:{$step.check_name} 成员:{$step.flow_names} - - + + {eq name="$step.flow_uid" value="$login_user"} {neq name="$detail.status" value="4"}
确认 + data-check="1">确认 {gt name="$detail.step_sort" value="0"} 退回 + data-check="2">退回 {/gt}
{/neq} @@ -215,7 +230,7 @@ {/gt} {eq name="$vo.sort" value="$detail.step_sort"} - + {/eq} {lt name="$vo.sort" value="$detail.step_sort"} @@ -271,7 +286,7 @@
@@ -288,11 +303,11 @@
@@ -319,36 +334,36 @@
项目名称*项目名称* + - + + 项目简称* 项目简称* - + 计划完成周期 -
- -
- - -
- -
+
项目类型*
负责人* - - - 项目成员* - - - 项目类型*
负责人* + + + + 项目成员* + + + 关联客户 + +
关联产品 - {volist name=":get_product()" id="v"} {/volist} 关联客户 - + 合同周期 +
+ +
+ - +
+ +
项目阶段*项目阶段* +
@@ -91,7 +120,7 @@ @@ -99,14 +128,18 @@
- +
- +
@@ -119,7 +152,7 @@ @@ -127,14 +160,18 @@
- +
- +
@@ -143,7 +180,8 @@ {/eq} {/volist} - + 添加固定阶段+ 添加自定义阶段 + + 添加固定阶段+ 添加自定义阶段

温馨提示

1、项目开始流转前,请确保已完善好各项目信息。

@@ -171,11 +209,11 @@ form.render(); function fetchCustomers() { - tool.get('/business/index/getlistsmore', {}, function(response) { + tool.get('/business/index/getlistsmore', {}, function (response) { if (response.code == 1) { var customers = response.data; var customerSelect = document.getElementById('business_id'); - customers.forEach(function(customer) { + customers.forEach(function (customer) { var option = document.createElement('option'); option.value = customer.id; option.text = customer.name; @@ -209,13 +247,13 @@ }); }); - $('.add-flow').on('click',function(){ + $('.add-flow').on('click', function () { let len = $('#flowList').find('.layui-form-item').length; - let index = len+1; + let index = len + 1; let type = $(this).data('type');; - let tem=['
\ + let tem = ['
\
\ - \ + \
\ \
\ @@ -281,12 +319,12 @@ }); }); }); - $('#flowList').on('click','.layui-btn-danger',function(){ + $('#flowList').on('click', '.layui-btn-danger', function () { $(this).parents('.layui-form-item').remove(); var items = $('.label-index').length; - if(items>0){ - $('.label-index').each(function(index,item){ - $(this).html('第'+(index+2)+'阶段'); + if (items > 0) { + $('.label-index').each(function (index, item) { + $(this).html('第' + (index + 2) + '阶段'); }) } }); @@ -299,7 +337,7 @@ tool.close(1000); } } - tool.post("/project/index/add",data.field,callback); + tool.post("/project/index/add", data.field, callback); return false; }); } diff --git a/app/project/view/index/edit.html b/app/project/view/index/edit.html index 1128146..c6a0d8c 100644 --- a/app/project/view/index/edit.html +++ b/app/project/view/index/edit.html @@ -11,7 +11,7 @@
项目名称* {$detail.name}计划完成周期合同周期 {$detail.start_time|date='Y-m-d'} - {$detail.end_time|date='Y-m-d'}
- - - - - - + + + + + + - {volist name="link_array" id="vo"} - - - - - + + + - - {/volist} - {empty name="$link_array" } - - - - {/empty} + + + + {/volist} + {empty name="$link_array" } + + + + {/empty}
链接URL链接说明添加人操作
链接URL链接说明添加人操作
{$vo.url}{$vo.desc}{$vo.admin_name} -
-
{$vo.url}{$vo.desc}{$vo.admin_name} +
+ - + -
-
暂无链接
暂无链接
@@ -417,7 +432,7 @@
+ data-tips="任务数:{$detail.tasks},已完成:{$detail.tasks_finish},未完成:{$detail.tasks_unfinish}">
@@ -467,7 +482,7 @@ if (deleteFilePaths) { $.ajax({ url: basePath + 'deleteFile.do', - data: {deleteFilePaths: deleteFilePaths}, + data: { deleteFilePaths: deleteFilePaths }, dataType: 'JSON', Type: 'POST', async: false, @@ -551,71 +566,71 @@ var $ = layui.jquery , upload = layui.upload , uploadListIns = upload.render({ - elem: '#testList' - , url: basePath + 'upload.do' - , data: {fileDir: fileDirIndex} - , accept: 'file' - , multiple: true - , auto: false - , bindAction: '#testListAction' - , choose: function (obj) { - files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列 - //读取本地文件 - obj.preview(function (index, file, result) { - var tr = $(['' - , '' + file.name + '' - , '' + (file.size / 1024).toFixed(1) + 'kb' - , '等待上传' - , '' - , '' - , '' - , '' - , ''].join('')); + elem: '#testList' + , url: basePath + 'upload.do' + , data: { fileDir: fileDirIndex } + , accept: 'file' + , multiple: true + , auto: false + , bindAction: '#testListAction' + , choose: function (obj) { + files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列 + //读取本地文件 + obj.preview(function (index, file, result) { + var tr = $(['' + , '' + file.name + '' + , '' + (file.size / 1024).toFixed(1) + 'kb' + , '等待上传' + , '' + , '' + , '' + , '' + , ''].join('')); - //单个重传 - tr.find('.demo-reload').on('click', function () { - obj.upload(index, file); - }); + //单个重传 + tr.find('.demo-reload').on('click', function () { + obj.upload(index, file); + }); - //删除 - tr.find('.notUpload-delete').on('click', function () { - delete files[index]; //删除对应的文件 - tr.remove(); - uploadListIns.config.elem.next()[0].value = ''; //清空 input file 值,以免删除后出现同名文件不可选 + //删除 + tr.find('.notUpload-delete').on('click', function () { + delete files[index]; //删除对应的文件 + tr.remove(); + uploadListIns.config.elem.next()[0].value = ''; //清空 input file 值,以免删除后出现同名文件不可选 + }); + demoListView.append(tr); }); - demoListView.append(tr); - }); - } - , allDone: function (obj) { //当文件全部被提交后,才触发 - $("#" + id + "State").text("已上传"); - layer.closeAll('page'); //关闭所有页面层 - } - , done: function (res, index, upload) { - if (res.code == 0) { //上传成功 + } + , allDone: function (obj) { //当文件全部被提交后,才触发 + $("#" + id + "State").text("已上传"); + layer.closeAll('page'); //关闭所有页面层 + } + , done: function (res, index, upload) { + if (res.code == 0) { //上传成功 + var tr = demoListView.find('tr#upload-' + index) + , tds = tr.children(); + tds.eq(2).html('上传成功'); + tds.eq(3).html(''); //清空操作 + + //赋值给弹出框对应的input + var value = JSON.stringify(res); + if ($("#" + id).val() == '') { + $("#" + id).val(value); + } else { + $("#" + id).val($("#" + id).val() + ";" + value); + } + + return delete this.files[index]; //删除文件队列已经上传成功的文件 + } + this.error(index, upload); + } + , error: function (index, upload) { var tr = demoListView.find('tr#upload-' + index) , tds = tr.children(); - tds.eq(2).html('上传成功'); - tds.eq(3).html(''); //清空操作 - - //赋值给弹出框对应的input - var value = JSON.stringify(res); - if ($("#" + id).val() == '') { - $("#" + id).val(value); - } else { - $("#" + id).val($("#" + id).val() + ";" + value); - } - - return delete this.files[index]; //删除文件队列已经上传成功的文件 + tds.eq(2).html('上传失败'); + tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示重传 } - this.error(index, upload); - } - , error: function (index, upload) { - var tr = demoListView.find('tr#upload-' + index) - , tds = tr.children(); - tds.eq(2).html('上传失败'); - tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示重传 - } - }); + }); }); //添加已上传文件列表 @@ -655,10 +670,10 @@ var project_start_time = '{$detail.start_time| date="Y-m-d"}'; const opsData = { status: [ - {'id': 1, 'title': '未开始'}, - {'id': 2, 'title': '进行中'}, - {'id': 3, 'title': '已完成'}, - {'id': 4, 'title': '已关闭'} + { 'id': 1, 'title': '未开始' }, + { 'id': 2, 'title': '进行中' }, + { 'id': 3, 'title': '已完成' }, + { 'id': 4, 'title': '已关闭' } ] } @@ -698,8 +713,8 @@ show: false }, data: [ - {value: 1048, name: '待处理'}, - {value: 735, name: '已完成'} + { value: 1048, name: '待处理' }, + { value: 735, name: '已完成' } ] } ] @@ -748,13 +763,13 @@ color: "#ED6666", } }, - { - value: 735, - name: '按时完成', - itemStyle: { - color: "#91CC75", - } + { + value: 735, + name: '按时完成', + itemStyle: { + color: "#91CC75", } + } ] } ] @@ -782,11 +797,11 @@ radius: ['25%', '75%'], center: ['60%', '50%'], data: [ - {value: 40, name: '待解决'}, - {value: 38, name: '进行中'}, - {value: 32, name: '已解决'}, - {value: 28, name: '不解决'}, - {value: 26, name: '已关闭'} + { value: 40, name: '待解决' }, + { value: 38, name: '进行中' }, + { value: 32, name: '已解决' }, + { value: 28, name: '不解决' }, + { value: 26, name: '已关闭' } ] } ] @@ -897,7 +912,7 @@ itemStyle: { borderWidth: 0.5 }, - yearLabel: {show: false}, + yearLabel: { show: false }, monthLabel: { nameMap: 'cn', fontSize: 12 @@ -962,7 +977,7 @@ itemStyle: { borderWidth: 0.5 }, - yearLabel: {show: false}, + yearLabel: { show: false }, monthLabel: { nameMap: 'cn', fontSize: 12 @@ -1005,7 +1020,7 @@ data.push([this_date, 0]); } } - var res = {'range': rangeArray, 'data': data}; + var res = { 'range': rangeArray, 'data': data }; return res; } @@ -1061,7 +1076,7 @@ yArray = tem_y_array.concat(yArray); yArray2 = tem_y_array.concat(yArray2); } - return {'x': xArray, 'y': yArray, 'y2': yArray2}; + return { 'x': xArray, 'y': yArray, 'y2': yArray2 }; } function cross_recursion(start, end, arr) { @@ -1121,7 +1136,7 @@ }, 1000) } } - let postData = {id: id}; + let postData = { id: id }; postData[name] = real_val; tool.post("/project/index/edit", postData, callback); } @@ -1157,7 +1172,7 @@ $('#delProject').on('click', function () { - layer.confirm('确定要删除该项目吗?请慎重', {icon: 3, title: '提示'}, function (index) { + layer.confirm('确定要删除该项目吗?请慎重', { icon: 3, title: '提示' }, function (index) { let callback = function (e) { layer.closeAll(); layer.msg(e.msg); @@ -1167,7 +1182,7 @@ }, 1000) } } - let postData = {"id": project_id}; + let postData = { "id": project_id }; tool.delete("/project/index/delete", postData, callback); }); }) @@ -1253,23 +1268,40 @@
- +
-
- +
-
- +
+
+ +
+ +
+
+
+ +
+ +
+
+
@@ -1290,6 +1322,8 @@ laydate.render({ elem: '#start_time', type: 'date', format: 'yyyy-MM-dd' }); laydate.render({ elem: '#end_time', type: 'date', format: 'yyyy-MM-dd' }); + laydate.render({ elem: '#project_start_time', type: 'date', format: 'yyyy-MM-dd' }); + laydate.render({ elem: '#project_end_time', type: 'date', format: 'yyyy-MM-dd' }); form.on('submit(saveProject)', function (data) { $.ajax({ @@ -1339,11 +1373,11 @@ //关闭项目 $('#closeProject').on('click', function () { - layer.confirm('确定要关闭该项目吗?请慎重', {icon: 3, title: '提示'}, function (index) { + layer.confirm('确定要关闭该项目吗?请慎重', { icon: 3, title: '提示' }, function (index) { $.ajax({ url: "/project/index/close", type: "POST", - data: {"id": project_id}, + data: { "id": project_id }, success: function (e) { layer.closeAll(); layer.msg(e.msg); @@ -1362,11 +1396,11 @@ //开启项目 $('#reopenProject').on('click', function () { - layer.confirm('确定要开启该项目吗?请慎重', {icon: 3, title: '提示'}, function (index) { + layer.confirm('确定要开启该项目吗?请慎重', { icon: 3, title: '提示' }, function (index) { $.ajax({ url: "/project/index/open", type: "POST", // 根据实际情况调整请求类型 - data: {"id": project_id}, + data: { "id": project_id }, success: function (e) { layer.closeAll(); layer.msg(e.msg); @@ -1416,11 +1450,11 @@ }) } else { layer.confirm('确认已完成该阶段工作,进入下个阶段?', { - icon: 3, - title: '提示' - }, + icon: 3, + title: '提示' + }, function (index) { - tool.post("/api/project/step_check", {id: project_id, check: check}, callback); + tool.post("/api/project/step_check", { id: project_id, check: check }, callback); }) } }); @@ -1434,7 +1468,7 @@ //,multiple: true , bindAction: '#test9' , before: function (obj) { - layer.msg('上传中...', {time: 3600000}); + layer.msg('上传中...', { time: 3600000 }); } , done: function (res, index, upload) { let callback = function (e) { @@ -1460,7 +1494,7 @@ $('#fileList').on('click', '.btn-delete', function () { let id = $(this).data('id'); - layer.confirm('确定要删除该附件吗?', {icon: 3, title: '提示'}, function (index) { + layer.confirm('确定要删除该附件吗?', { icon: 3, title: '提示' }, function (index) { let callback = function (e) { layer.closeAll(); layer.msg(e.msg); @@ -1468,7 +1502,7 @@ location.reload(); }, 2000) } - let postData = {"id": id}; + let postData = { "id": id }; tool.delete("/api/appendix/delete", postData, callback); }); }) @@ -1484,7 +1518,7 @@ }) $('#linkList').on('click', '.link-delete', function () { let id = $(this).data('id'); - layer.confirm('确定要删除该链接吗?', {icon: 3, title: '提示'}, function (index) { + layer.confirm('确定要删除该链接吗?', { icon: 3, title: '提示' }, function (index) { let callback = function (e) { layer.closeAll(); layer.msg(e.msg); @@ -1492,7 +1526,7 @@ location.reload(); }, 2000) } - let postData = {"id": id}; + let postData = { "id": id }; tool.delete("/api/appendix/delete_link", postData, callback); }); }) @@ -1510,8 +1544,8 @@ show: false }, data: [ - {value: res.data.task_pie.count - res.data.task_pie.count_ok, name: '待处理'}, - {value: res.data.task_pie.count_ok, name: '已完成'} + { value: res.data.task_pie.count - res.data.task_pie.count_ok, name: '待处理' }, + { value: res.data.task_pie.count_ok, name: '已完成' } ] } ]; @@ -1534,13 +1568,13 @@ color: "#ED6666", } }, - { - value: res.data.task_pie.count - res.data.task_pie.delay, - name: '按时完成', - itemStyle: { - color: "#91CC75", - } + { + value: res.data.task_pie.count - res.data.task_pie.delay, + name: '按时完成', + itemStyle: { + color: "#91CC75", } + } ] } ]; @@ -1553,11 +1587,11 @@ radius: ['25%', '75%'], center: ['60%', '50%'], data: [ - {value: res.data.bug_status.status_a, name: '待解决'}, - {value: res.data.bug_status.status_b, name: '进行中'}, - {value: res.data.bug_status.status_c, name: '已解决'}, - {value: res.data.bug_status.status_d, name: '不解决'}, - {value: res.data.bug_status.status_e, name: '已关闭'} + { value: res.data.bug_status.status_a, name: '待解决' }, + { value: res.data.bug_status.status_b, name: '进行中' }, + { value: res.data.bug_status.status_c, name: '已解决' }, + { value: res.data.bug_status.status_d, name: '不解决' }, + { value: res.data.bug_status.status_e, name: '已关闭' } ] } ] @@ -1588,7 +1622,7 @@ type: 'line', showSymbol: false, markLine: { - data: [{type: 'average', name: 'Avg'}], + data: [{ type: 'average', name: 'Avg' }], }, lineStyle: { width: 2 @@ -1603,7 +1637,7 @@ opacity: 0.1 }, markLine: { - data: [{type: 'average', name: 'Avg'}], + data: [{ type: 'average', name: 'Avg' }], }, lineStyle: { width: 2 @@ -1634,7 +1668,7 @@ } } } - tool.get('/api/project/get_chart_data', {'project_id': project_id}, callback); + tool.get('/api/project/get_chart_data', { 'project_id': project_id }, callback); window.onresize = function () { progressChart.resize(); diff --git a/app/reimbursement/controller/Index.php b/app/reimbursement/controller/Index.php index 563d2ff..7a0ac00 100644 --- a/app/reimbursement/controller/Index.php +++ b/app/reimbursement/controller/Index.php @@ -168,26 +168,28 @@ class Index extends BaseController } } - //编辑条目 + //编辑条目(查看) public function edititem($id) { - $param = get_params(); - // 编辑逻辑 - $reimbursementLists = ReimbursementList::where('id', $param['id']) + $reimbursementLists = ReimbursementList::where('id', $id) ->field('id, pid, times, department, project, cate, price, creater, haveticket, tickets, remark, create_time') ->find(); + // print_r($reimbursementLists); if ($reimbursementLists) { - // 获取项目名称 - $project = ProjectList::where('id', $reimbursementLists['project'])->value('name_short'); + // 获取发生时间 + $times = $reimbursementLists['times']; // 获取部门名称 $department = DepartmentList::where('id', $reimbursementLists['department'])->value('title'); // 获取创建者名称 $creater = Admin::where('id', $reimbursementLists['creater'])->value('name'); + // print_r($creater); - if ($project) { - $reimbursementLists['project'] = $project; + if ($times) { + $timesDate = date('Y年m月d日', strtotime($times)); + $reimbursementLists['times'] = $timesDate; } + if ($department) { $reimbursementLists['department'] = $department; } @@ -195,23 +197,49 @@ class Index extends BaseController $reimbursementLists['creater'] = $creater; } - View::assign('detail', $reimbursementLists); - } else { - return json(["code" => 1, "msg" => "信息不存在"]); // 返回JSON格式数据 + if ($reimbursementLists) { + View::assign('detail', $reimbursementLists); + } else { + View::assign('message', '没有详细数据'); + } } - $param['update_time'] = date('Y-m-d H:i:s', time()); - $param['update_time'] = date('Y-m-d', time()); - $res = ReimbursementList::where('id', $param['id'])->strict(false)->field(true)->update($param); - if ($res) { - add_log('edit', $param['id'], $param, $reimbursementLists); - return json(["code" => 0, "msg" => "编辑成功"]); // 返回JSON格式数据 - } else { - return json(["code" => -1, "msg" => "编辑失败"]); // 返回JSON格式数据 + return view(); + // return $reimbursementLists; + } + + // 编辑条目详情 + public function editdetailitem() + { + $param = get_params(); + if (request()->isPost()) { + $id = $param['id']; + $reimbursementLists = ReimbursementList::where('id', $id) + ->field('id, pid, times, department, project, cate, price, creater, haveticket, tickets, remark, create_time') + ->find(); + + if ($reimbursementLists) { + $dateString = $param['times']; + $dateString = str_replace(['年', '月', '日'], '-', $dateString); + $dateString = rtrim($dateString, '-'); + + $reimbursementLists->department = $param['department']; + $reimbursementLists->project = $param['project']; + $reimbursementLists->cate = $param['cate']; + $reimbursementLists->price = $param['price']; + $reimbursementLists->haveticket = $param['haveticket']; + $reimbursementLists->tickets = $param['tickets']; + $reimbursementLists->remark = $param['remark']; + $reimbursementLists->save(); + return json(["code" => 0, "msg" => "编辑成功"]); + } else { + return json(["code" => 1, "msg" => "信息不存在"]); + } } } + //添加 public function add() { @@ -298,7 +326,7 @@ class Index extends BaseController } // 查看报销详情 - public function viewitem($id) + public function viewitemlist($id) { $reimbursementLists = ReimbursementList::where('pid', $id) ->whereNull('delete_time') @@ -457,45 +485,6 @@ class Index extends BaseController } } - public function editdetailitem($id) - { - $reimbursementLists = ReimbursementList::where('id', $id) - ->field('id, pid, times, department, project, cate, price, creater, haveticket, tickets, remark, create_time') - ->find(); -// print_r($reimbursementLists); - - if ($reimbursementLists) { - // 获取发生时间 - $times = $reimbursementLists['times']; - // 获取部门名称 - $department = DepartmentList::where('id', $reimbursementLists['department'])->value('title'); - // 获取创建者名称 - $creater = Admin::where('id', $reimbursementLists['creater'])->value('name'); - // print_r($creater); - - if ($times) { - $timesDate = date('Y年m月d日', strtotime($times)); - $reimbursementLists['times'] = $timesDate; - } - - if ($department) { - $reimbursementLists['department'] = $department; - } - if ($creater) { - $reimbursementLists['creater'] = $creater; - } - - if ($reimbursementLists) { - View::assign('detail', $reimbursementLists); - } else { - View::assign('message', '没有详细数据'); - } - } - - return view(); - // return $reimbursementLists; - } - //编辑锁定状态 public function editlock($id, $lock) { diff --git a/app/reimbursement/view/index/edititem.html b/app/reimbursement/view/index/edititem.html new file mode 100644 index 0000000..47768c3 --- /dev/null +++ b/app/reimbursement/view/index/edititem.html @@ -0,0 +1,349 @@ + + + + + + + + + + + + + + + + + +
+
+

+ 报销编号 - {$detail.id} +

+ + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
费用类型 + + 隶属项目 + +
报销金额 + + 是否有票 + +
发生时间 +
+ +
+
上传票据 + +
当前无票,不可上传
+
+ +
点击上传,或将文件拖拽到此处
+
+
+ 上传成功后渲染 +
+
+
上传附件 +
+ +
+ + + + + + + + + + + + + + +
文件名大小上传进度操作
+
+ +
+
备注 + +
+
+
+
+ +
+ + + + + + + \ No newline at end of file diff --git a/app/reimbursement/view/index/index.html b/app/reimbursement/view/index/index.html index b8cfa61..108db4e 100644 --- a/app/reimbursement/view/index/index.html +++ b/app/reimbursement/view/index/index.html @@ -59,19 +59,17 @@ // console.log(data); if (obj.event === 'view') { - var id = data.id; // 获取当前行数据的id + var id = data.id; // console.log(id); - // 使用layer弹出层来显示详情页面 layui.layer.open({ - type: 2, // iframe层 + type: 2, title: '报销详情', shadeClose: true, shade: 0.8, - area: ['70%', '90%'], // 宽高 + area: ['70%', '90%'], content: '/reimbursement/index/view?id=' + id, end: function () { - // 弹出层关闭时刷新当前页面 layui.table.reload('reimbursement'); } }); @@ -168,7 +166,7 @@ cols: [ [ { type: 'checkbox' }, - { field: 'id', width: 80, title: '编号', sort: true, align: "center", totalRowText: '合计:' }, + { field: 'id', width: 100, title: '编号', sort: true, align: "center"}, { field: "order", title: "账单编号", @@ -195,13 +193,13 @@ width: 120, rowspan: 2, }, - { - field: "lock", - title: "账单状态", - align: "center", - width: 120, - rowspan: 2, - }, + // { + // field: "lock", + // title: "账单状态", + // align: "center", + // width: 120, + // rowspan: 2, + // }, { field: "department", title: "隶属部门", diff --git a/app/reimbursement/view/index/view.html b/app/reimbursement/view/index/view.html index dd82e3b..87854f8 100644 --- a/app/reimbursement/view/index/view.html +++ b/app/reimbursement/view/index/view.html @@ -33,80 +33,74 @@ -
-
-

- 基本信息 -

+
+
+
+
+

+ 基本信息 +

+
+
+ 创建时间:{$detail.create_time} +
+
+
+ +
+ + + + + + + + + + + + + + + + + +
账单号 + + {$detail.order} + 创建者 + + {$detail.creater} +
隶属部门 + + {$detail.department} + 报销状态 + + {$detail.status} + 修改 +
备注 + + {$detail.remark} +
+
+
+

+ 详细信息 + + 增加报销 + 编辑 + 删除 + +

+
+
+
+
- -
- - - - - - - - - - - - - - - - - - - - - - - -
账单号 - - {$detail.order} - 创建时间 - - {$detail.create_time} -
隶属部门 - - {$detail.department} - 报销状态 - - {$detail.status} - 修改 -
创建者 - - {$detail.creater} - 账单状态 - - {$detail.lock} - 修改 -
备注 - - {$detail.remark} -
+
+ +
-
-

- 详细信息 - - 增加报销 - 编辑 - 删除 - -

-
-
-
-
-
-
- - -
{/block} - + \ No newline at end of file diff --git a/app/task/controller/Index.php b/app/task/controller/Index.php index c63b55b..252da58 100644 --- a/app/task/controller/Index.php +++ b/app/task/controller/Index.php @@ -29,7 +29,7 @@ class Index extends BaseController View::assign('type', get_task_cate()); View::assign('cate', get_work_cate()); View::assign('task_cate', get_task_cate()); - View::assign('project', get_project($this->uid)); + View::assign('project', get_project()); View::assign('creater', get_admin_name()); View::assign('user_info', get_login_admin()); return view(); @@ -254,6 +254,7 @@ class Index extends BaseController if (isset($param['project_id'])) { View::assign('project_id', $param['project_id']); } + View::assign('project', get_project()); View::assign('cate', get_work_cate()); View::assign('type', get_task_cate()); View::assign('id', $id); diff --git a/app/task/view/index/index.html b/app/task/view/index/index.html index 898a193..383dc02 100644 --- a/app/task/view/index/index.html +++ b/app/task/view/index/index.html @@ -136,7 +136,7 @@ [ { field: "id", - title: "任务编号", + title: "ID", width: 80, align: "center", templet: function (d) { @@ -145,9 +145,8 @@ }, { field: "type_name", - title: "紧急程度", + title: "优先级", width: 80, - align: "center", templet: function (d) { var html = ' 0) { @@ -386,12 +378,13 @@ tableReload(); }, 10); }); + //只看我按钮代码 $("#taskForm").on("click", '[lay-filter="onlyme"]', function () { - let loginuser = $("#loginusers").val(); // 从隐藏的输入字段中获取loginuser的值 + let loginuser = $("#loginusers").val(); - $("#taskForm").find('[name="director_uid"]').val(loginuser); // 将director_uid的值设置为loginuser + $("#taskForm").find('[name="director_uid"]').val(loginuser); let postData = { type: $("#taskForm").find('[name="type"]').val(), @@ -410,7 +403,7 @@ }); - + //重新加载表格 function tableReload() { let postData = { type: $("#taskForm").find('[name="type"]').val(), diff --git a/composer.json b/composer.json index 4bba611..5f5dc7d 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "topthink/framework": "^6.1", "topthink/think-filesystem": "^2.0", "topthink/think-orm": "^2.0", - "topthink/think-multi-app": "^1.0", + "topthink/think-multi-app": "^1.1", "topthink/think-view": "^1.0", "topthink/think-captcha": "^3.0", "phpmailer/phpmailer": "^6.7",