更新:业绩模型

virtual
zwesy 2020-12-08 16:11:04 +08:00
parent 119154b229
commit 99655c7b76
18 changed files with 992 additions and 14 deletions

View File

@ -1,7 +1,7 @@
<?php
namespace app\controller;
use app\model\{Category, Block, Article, History, Model};
use app\model\{Achievement, AchievementInfo, Category, Block, Article, History, Model};
class Page extends Base
{
@ -121,7 +121,7 @@ class Page extends Base
$achievementCate = Category::getById(Category::$CIdList['achievement_manage']);
$achievementList = [];
if ($achievementCate) {
$achievementList = Article::getLatestByCategory($achievementCate['id'], $achievementCate['number'] ? $achievementCate['number'] : 10, 1);
$achievementList = Achievement::getListByCategoryId($achievementCate['id'], $achievementCate['number'] ? $achievementCate['number'] : 10, true);
}
$this->data['blocks'] = $blocks;
$this->data['achievementList'] = $achievementList;

View File

@ -0,0 +1,338 @@
<?php
namespace app\controller\manager;
use app\model\{AchievementInfo, Category, Achievement as MAchievement, Log};
use app\validate\Achievement as VAchievement;
use think\facade\Db;
/**
* 业绩管理
* Class Achievement
* @package app\controller\manager
*/
class Achievement extends Base
{
protected $validate;
public function initialize()
{
parent::initialize();
$this->validate = new VAchievement();
}
/****************************
* 业绩
****************************/
public function add()
{
$categoryId = input('param.category_id/d', 0);
$category = Category::getById($categoryId);
if(empty($category)) {
return $this->json(1, '无此栏目信息');
}
if(request()->isPost()) {
$params = input('post.item/a', []);
$params = arrayHtmlFilter($params);
if($this->validate->checkAchievement($params)) {
$data = [
'title' => $params['title'],
'visible' => $params['visible'],
'category_id' => $categoryId,
'summary' => $params['summary'] ?? '',
'description' => $params['description'] ?? '',
'create_time' => time(),
];
$newItem = MAchievement::create($data);
Log::write('achievement', 'add', '新增业绩ID:'.$newItem->id);
} else {
return $this->json(2, $this->validate->getError());
}
return $this->json();
} else {
$this->data['category'] = $category;
return $this->view();
}
}
public function edit()
{
$id = input('param.id/d', 0);
$item = MAchievement::getById($id);
if(count($item) == 0) {
return $this->json(1, '该业绩信息不存在');
}
if(request()->isPost()) {
$params = input('post.item/a', []);
$params = arrayHtmlFilter($params);
if($this->validate->checkAchievement($params)) {
$data = [
'title' => $params['title'],
'visible' => $params['visible'],
'summary' => $params['summary'] ?? '',
'description' => $params['description'] ?? '',
];
MAchievement::updateById($item['id'] ,$data);
Log::write('achievement', 'add', '修改业绩ID:'.$item['id']);
} else {
return $this->json(2, $this->validate->getError());
}
return $this->json();
} else {
$this->data['item'] = $item;
return $this->view();
}
}
public function sort()
{
if(request()->isPost()) {
$id = input('post.id/d');
$sort = input('post.sort');
$num = input('post.num/d', 1);
if($num <= 0){
$num = 1;
}
if(!in_array($sort, ['up', 'down'], true)){
return $this->json(2, '参数错误');
}
$item = MAchievement::getById($id);
if(empty($item)){
return $this->json(3, '该业绩信息不存在');
}
if($sort == 'up'){ // sort 变大
$where = "category_id='{$item['category_id']}' and sort > {$item['sort']}";
$order = "sort asc";
}else{ // sort 变小
$where = "category_id='{$item['category_id']}' and sort < {$item['sort']}";
$order = "sort desc";
}
$forSortItems = MAchievement::getListByWhereAndOrder($where, $order, $num);
if(!empty($forSortItems)){
$updateData = [];
$forSortCount = count($forSortItems);
for($i = 0; $i < $forSortCount; $i++){
if($i == 0){
$updateData[] = [
'id' => $forSortItems[$i]['id'],
'sort' => $item['sort']
];
}else{
$updateData[] = [
'id' => $forSortItems[$i]['id'],
'sort' => $forSortItems[$i - 1]['sort']
];
}
}
$updateData[] = [
'id' => $item['id'],
'sort' => $forSortItems[$i - 1]['sort']
];
if(!empty($updateData)){
$model = new MAchievement();
$model->saveAll($updateData);
$sortStr = $sort == 'up' ? '上移' : '下调';
Log::write('achievement', 'sort', "业绩排序ID{$id} {$sortStr}{$num}");
return $this->json();
}
}
return $this->json(4, '无须调整排序!');
}
return $this->json(1, '无此操作');
}
public function del()
{
if(request()->isPost()) {
$id = input('param.id/d', 0);
$item = MAchievement::getById($id);
if(count($item) == 0) {
return $this->json(2, '该业绩信息不存在');
}
Db::startTrans();
try {
MAchievement::destroy($id);
$hasInfo = AchievementInfo::hasByAchievementId($id);
if($hasInfo > 0) {
AchievementInfo::delByAchievementId($id);
}
Log::write('achievement','del', '删除业绩ID:'.$id);
Db::commit();
} catch (\Exception $e) {
Db::rollback();
return $this->json(3, '删除失败,'.$e->getMessage());
}
return $this->json();
}
return $this->json(1, '无此操作');
}
/****************************
* 业绩详情
****************************/
public function info()
{
$achievementId = input('param.achievement_id/d', 0);
$achievement = MAchievement::getById($achievementId);
$infoItems = [];
$categoryId = $achievement['category_id'] ?? 0;
if($achievement) {
$infoItems = AchievementInfo::getByAchievementId($achievementId);
}
$this->data['achievement'] = $achievement;
$this->data['categoryId'] = $categoryId;
$this->data['items'] = $infoItems;
return $this->view();
}
public function infoAdd()
{
$achievementId = input('param.achievement_id/d', 0);
$achievement = MAchievement::getById($achievementId);
if(empty($achievement)) {
return $this->json(2, '无此业绩信息');
}
if(request()->isPost()) {
$params = input('post.item/a', []);
$params = arrayHtmlFilter($params);
if($this->validate->checkAchievementInfo($params)) {
$data = [
'achievement_id' => $achievementId,
'title' => $params['title'],
'order_company' => $params['order_company'],
'goods_model' => $params['goods_model'],
'goods_amount' => $params['goods_amount'],
'visible' => $params['visible'],
'owner' => $params['owner'] ?? '',
'owner_tel' => $params['owner_tel'] ?? '',
'owner_email' => $params['owner_email'] ?? '',
'create_time' => time(),
];
$newItem = AchievementInfo::create($data);
Log::write('achievement', 'infoAdd', '新增业绩项目ID:'.$newItem->id);
} else {
return $this->json(2, $this->validate->getError());
}
return $this->json();
} else {
$this->data['achievementId'] = $achievementId;
$this->data['achievement'] = $achievement;
return $this->view();
}
}
public function infoEdit()
{
$id = input('param.id/d', 0);
$item = AchievementInfo::getById($id);
if(count($item) == 0) {
return $this->json(1, '该业务项目不存在');
}
if(request()->isPost()) {
$params = input('post.item/a', []);
$params = arrayHtmlFilter($params);
if($this->validate->checkAchievementInfo($params)) {
$data = [
'title' => $params['title'],
'order_company' => $params['order_company'],
'goods_model' => $params['goods_model'],
'goods_amount' => $params['goods_amount'],
'visible' => $params['visible'],
'owner' => $params['owner'] ?? '',
'owner_tel' => $params['owner_tel'] ?? '',
'owner_email' => $params['owner_email'] ?? '',
];
AchievementInfo::updateById($id, $data);
Log::write('achievement', 'infoEdit', '修改业绩项目ID:'.$id);
} else {
return $this->json(2, $this->validate->getError());
}
return $this->json();
} else {
$this->data['item'] = $item;
return $this->view();
}
}
public function infoSort()
{
if(request()->isPost()) {
$id = input('post.id/d');
$sort = input('post.sort');
$num = input('post.num/d', 1);
if($num <= 0){
$num = 1;
}
if(!in_array($sort, ['up', 'down'], true)){
return $this->json(2, '参数错误');
}
$item = AchievementInfo::getById($id);
if(empty($item)){
return $this->json(3, '该业绩项目信息不存在');
}
if($sort == 'up'){
$where = "history_id='{$item['history_id']}' and sort > {$item['sort']}";
$order = "sort asc";
}else{
$where = "history_id='{$item['history_id']}' and sort < {$item['sort']}";
$order = "sort desc";
}
$forSortItems = AchievementInfo::getListByWhereAndOrder($where, $order, $num);
if(!empty($forSortItems)){
$updateData = [];
$forSortCount = count($forSortItems);
for($i = 0; $i < $forSortCount; $i++){
if($i == 0){
$updateData[] = [
'id' => $forSortItems[$i]['id'],
'sort' => $item['sort']
];
}else{
$updateData[] = [
'id' => $forSortItems[$i]['id'],
'sort' => $forSortItems[$i - 1]['sort']
];
}
}
$updateData[] = [
'id' => $item['id'],
'sort' => $forSortItems[$i - 1]['sort']
];
if(!empty($updateData)){
$model = new AchievementInfo();
$model->saveAll($updateData);
$sortStr = $sort == 'up' ? '上移' : '下调';
Log::write('achievement', 'infoSort', "业绩项目排序ID{$id} {$sortStr}{$num}");
return $this->json();
}
}
return $this->json(4, '无须调整排序!');
}
return $this->json(1, '无此操作');
}
public function infoDel()
{
if(request()->isPost()) {
$infoIds = [];
$ids = input('post.ids', []);
$id = input('post.id', 0);
if(!empty($ids)) {
if(is_array($ids)) {
$infoIds = $ids;
} else {
$infoIds = explode(',', $ids);
}
} elseif($id > 0) {
$infoIds[] = $id;
}
if(count($infoIds) > 0) {
AchievementInfo::destroy($infoIds);
Log::write('achievement','infoDel', '删除业绩项目IDs:'.implode(',', $infoIds));
return $this->json();
}
return $this->json(2, '参数错误');
}
return $this->json(1, '无此操作');
}
}

View File

@ -1,7 +1,7 @@
<?php
namespace app\controller\manager;
use app\model\{Category, Article, Block, Log, History};
use app\model\{Category, Article, Block, Log, History, Achievement};
class Content extends Base
{
@ -170,4 +170,20 @@ class Content extends Base
$this->data['items'] = History::getPaginateList($categoryId, 20, false);
return $this->view();
}
// 主要业绩
public function achievement()
{
$categoryId = input('param.category_id/d', 0);
$category = Category::getById($categoryId);
if(empty($category)){
return $this->redirect(url('manager.content/index'));
}
$this->data['categoryId'] = $categoryId;
$this->data['category'] = $category;
$this->data['items'] = Achievement::getPaginateList($categoryId, 20, false);
return $this->view();
}
}

56
app/model/Achievement.php Normal file
View File

@ -0,0 +1,56 @@
<?php
namespace app\model;
/**
* 业绩管理
* Class Achievement
* @package app\model
*/
class Achievement extends Base
{
public static function onAfterInsert($achievement)
{
$achievement->sort = $achievement->id;
$achievement->save();
}
public static function getPaginateList($categoryId, $per = 20, $isSample = false , $onlyVisible = false, $order = [])
{
$paginate = [
'list_rows' => $per
];
if(empty($order)) {
$order = ['sort'=>'desc'];
}
return self::where('category_id', $categoryId)
->when($onlyVisible, function ($query) {
$query->where('visible', 1);
})
->order($order)
->paginate($paginate, $isSample);
}
public static function getListByCategoryId($categoryId, $per = 20, $onlyVisible = false, $order = [])
{
if(empty($order)) {
$order = ['sort'=>'desc'];
}
$items = self::where('category_id', $categoryId)
->when($onlyVisible, function ($query) {
$query->where('visible', 1);
})
->order($order)
->limit($per)
->column('*', 'id');
if(count($items) > 0) {
$ids = array_keys($items);
$infoList = AchievementInfo::getGroupByAchievementIds($ids, $onlyVisible);
foreach ($items as &$item) {
$item['infos'] = $infoList[$item['id']] ?? [];
}
unset($item);
}
return array_values($items);
}
}

View File

@ -0,0 +1,96 @@
<?php
namespace app\model;
/**
* 业绩详情
* Class AchievementInfo
* @package app\model
*/
class AchievementInfo extends Base
{
public static function onAfterInsert($achievementInfo)
{
$achievementInfo->sort = $achievementInfo->id;
$achievementInfo->save();
}
/**
* 根据业绩ID查询是否有关联的详情记录
* @param int $achievementId
* @return bool
*/
public static function hasByAchievementId($achievementId)
{
$resp = false;
$count = self::where('achievement_id', $achievementId)->count();
if($count) {
$resp = true;
}
return $resp;
}
/**
* 删除业绩相关的详情记录
* @param $achievementId
* @return bool
*/
public static function delByAchievementId($achievementId)
{
return self::where('achievement_id', $achievementId)->delete();
}
/**
* 获取业绩相关的详情记录
* @param int $achievementId
* @param bool $onlyVisible
* @param array $order
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public static function getByAchievementId($achievementId, $onlyVisible = false, $order = [])
{
if(empty($order)) {
$order = ['sort'=>'desc'];
}
return self::where('achievement_id', $achievementId)
->when($onlyVisible, function ($query) {
$query->where('visible', 1);
})
->order($order)
->select()
->toArray();
}
/**
* 查询业绩相关的项目并以业绩ID进行分组返回
* @param array $achievementIds
* @param bool $onlyVisible
* @param array $order
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public static function getGroupByAchievementIds($achievementIds, $onlyVisible = false, $order = [])
{
$data = [];
if(empty($order)) {
$order = ['sort'=>'desc'];
}
$items = self::whereIn('achievement_id', $achievementIds)
->when($onlyVisible, function ($query) {
$query->where('visible', 1);
})
->order($order)
->select()
->toArray();
if(count($items) > 0) {
foreach ($items as $item) {
$data[$item['achievement_id']][] = $item;
}
}
return $data;
}
}

View File

@ -26,7 +26,7 @@ class Category extends Base
'network' => 16, // 营销网络
'achievement' => 17, // 主要业绩
],
'achievement_manage' => 30, // 主要业绩管理
'achievement_manage' => 34, // 主要业绩管理 30
'news' => 18, // 新闻动态
'news_children' => [
'enterprise' => 20, // 企业新闻

View File

@ -12,7 +12,10 @@ class History extends Base
public static function getPaginateList($categoryId, $per = 20, $isSample = false)
{
$paginate = [
'list_rows' => $per
'list_rows' => $per,
'query' => [
'category_id' => $categoryId
]
];
$items = self::where('category_id', $categoryId)->order('sort', 'desc')->paginate($paginate, $isSample);
if(!$items->isEmpty()) {

View File

@ -0,0 +1,56 @@
<?php
namespace app\validate;
use think\Validate;
class Achievement extends Validate
{
protected $achievementRule = [
'title' => 'require|length:1,60',
'visible' => 'require|in:0,1',
];
protected $achievementMessage = [
'title.require' => '标题不能为空',
'name.length' => '标题长度限制为60个字符以内',
'visible.require' => '历程状态必须设置',
'visible.in' => '状态参数错误',
];
protected $achievementInfoRule = [
'title' => 'require|length:1,60',
'order_company' => 'require|length:1,100',
'goods_model' => 'require|length:1,300',
'goods_amount' => 'require|length:1,500',
'visible' => 'require|in:0,1',
];
protected $achievementInfoMessage = [
'title.require' => '标题不能为空',
'name.length' => '标题长度限制为60个字符以内',
'visible.require' => '历程状态必须设置',
'visible.in' => '状态参数错误',
];
/**
* 校验业绩数据
* @param array $data
* @return bool
*/
public function checkAchievement(array $data)
{
$this->rule = $this->achievementRule;
$this->message = $this->achievementMessage;
return $this->check($data);
}
/**
* 校验业绩详情数据
* @param array $data
* @return bool
*/
public function checkAchievementInfo(array $data)
{
$this->rule = $this->achievementInfoRule;
$this->message = $this->achievementInfoMessage;
return $this->check($data);
}
}

View File

@ -186,6 +186,16 @@ tr.table-lv2:nth-child(1){ border:none;}
.layui-form .layui-detail{line-height: 38px}
.top-operate{margin-bottom: 10px;}
/*paginate*/
.pageing{ display: flex; justify-content: center; flex-wrap: wrap;}
.pageing li{ display: inline-block;}
.pageing li a,.pageing li span{ display: block; min-width: 14px; height: 22px; border: 1px solid #d1d1d1; background: #fff; text-align: center; line-height: 22px; font-size: 14px; color: #565656; margin: 0 3px; transition: all 0.5s; padding: 0 5px;}
.pageing li a:hover{ color: #0677ce;}
.pageing li.prev a:hover, .pageing li.next a:hover{ color: #fff; background: #999; border-color: #999;}
.pageing li.cur a,.pageing li.cur span{ background: #0677ce; border-color: #0677ce; color: #fff;}
.pageing li.cur a:hover{ color: #fff;}
.pageing li.disabled{ cursor: not-allowed;}
/* 富文本编辑区与底层代码冲突 */
#edui_fixedlayer{position: relative !important;z-index: 99999999008 !important;top: -45px !important;}
@media screen and (max-width: 1440px){

View File

@ -31,13 +31,7 @@
<a href="{:url('article/detail', ['id' => $next.id, 'source'=>$currentCateId])}">下一篇</a>
{/if}
</p>
{php}
$backUrl = url('article/index', ['category_id'=>$currentCateId]);
if($currentCateId != $topCategory['id']) {
$backUrl = url('products.search', ['category_id'=>$currentCateId]);
}
{/php}
<a href="{$backUrl}" class="btns">返回</a>
<a href="{:url('article/index', ['category_id'=>$currentCateId])}" class="btns">返回</a>
</div>
</div>
</div>

View File

@ -0,0 +1,39 @@
<div class="layui-card layui-col-md12">
<div class="layui-card-body">
<form class="layui-form" data-action="{:url('manager.achievement/add')}">
<input type="hidden" name="_token" value="{$_token ?? ''}"/>
<strong style="color: #f20000; font-size: 12px; display: block; line-height: 1;">注意*号为必填选项!</strong>
<hr style="margin: 20px 0;">
<div class="layui-form-itemBox3 between">
<div class="layui-form-item">
<label class="layui-form-label">业绩标题<em>*</em></label>
<div class="layui-input-block">
<input class="layui-input" type="text" name="item[title]" maxlength="60" />
<p class="layui-form-mid layui-word-aux">标题请勿超过60个字符</p>
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">业绩概述</label>
<div class="layui-input-block">
<textarea class="layui-textarea" name="item[summary]" maxlength="300" onkeyup="limitContentLength(this, 300)"></textarea>
<p class="layui-form-mid layui-word-aux">请勿超过300个字符</p>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">业绩状态</label>
<div class="layui-inline">
<input type="radio" name="item[visible]" value="0" title="隐藏" />
<input type="radio" name="item[visible]" value="1" title="正常" checked />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"></label>
<div class="layui-inline">
<button type="button" class="layui-btn layui-btn-normal" lay-submit lay-filter="submitAll">保存</button>
</div>
</div>
<input type="hidden" class="layui-input" name="category_id" value="{$category.id}" />
</form>
</div>
</div>

View File

@ -0,0 +1,39 @@
<div class="layui-card layui-col-md12">
<div class="layui-card-body">
<form class="layui-form" data-action="{:url('manager.achievement/edit')}">
<input type="hidden" name="_token" value="{$_token ?? ''}"/>
<strong style="color: #f20000; font-size: 12px; display: block; line-height: 1;">注意*号为必填选项!</strong>
<hr style="margin: 20px 0;">
<div class="layui-form-itemBox3 between">
<div class="layui-form-item">
<label class="layui-form-label">业绩标题<em>*</em></label>
<div class="layui-input-block">
<input class="layui-input" type="text" name="item[title]" maxlength="60" value="{$item['title']}"/>
<p class="layui-form-mid layui-word-aux">标题请勿超过60个字符</p>
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">业绩概述</label>
<div class="layui-input-block">
<textarea class="layui-textarea" name="item[summary]" maxlength="300" onkeyup="limitContentLength(this, 300)">{$item['summary']}</textarea>
<p class="layui-form-mid layui-word-aux">请勿超过300个字符</p>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">业绩状态</label>
<div class="layui-inline">
<input type="radio" name="item[visible]" value="0" title="隐藏" {if $item['visible'] == 0}checked{/if} />
<input type="radio" name="item[visible]" value="1" title="正常" {if $item['visible'] == 1}checked{/if} />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"></label>
<div class="layui-inline">
<button type="button" class="layui-btn layui-btn-normal" lay-submit lay-filter="submitAll">保存</button>
</div>
</div>
<input type="hidden" class="layui-input" name="id" value="{$item.id}" />
</form>
</div>
</div>

View File

@ -0,0 +1,75 @@
{php}
use app\service\Image as CImage;
{/php}
{layout name="manager/layout" /}
{if isset($achievement) && count($achievement) > 0}
<div class="layui-card layui-col-md12">
<div class="layui-card-body">
<div class="layui-col-xs12 between-center">
<div class="layui-inline">
<a id="add-article" class="layui-btn layui-btn-normal" data-href="{:url('manager.achievement/infoAdd',['achievement_id'=>$achievement['id']])}" title="添加业绩项目" data-width="1000"><i class="layui-icon layui-icon-add-1"></i>添加业绩项目</a>
</div>
</div>
<div class="layui-clear"></div>
<hr style="margin: 20px 0;">
<div class="mgb15"><strong>业绩:</strong>{$achievement.title}</div>
{empty name="items"}
<div class="empty-404">该业绩暂无相关项目信息!</div>
{else /}
<table class="layui-table layui-form">
<colgroup>
<col width="75px">
<col width="400px">
<col >
<col width="175px">
<col width="75px">
<col width="310px">
</colgroup>
<thead>
<tr>
<td>ID</td>
<td>项目名称</td>
<td>订货单位</td>
<td>创建日期</td>
<td>状态</td>
<td>操作</td>
</tr>
</thead>
{foreach $items as $item}
<tbody class="table-lv1" data-id="{$item.id}" data-url="{:url('manager.achievement/infoSort')}">
<tr>
<td>{$item.id}</td>
<td>{$item.title}</td>
<td>{$item.order_company}</td>
<td>{$item.create_time|date="Y-m-d H:i"}</td>
<td>{:$item.visible == 0 ? '<span class="text-warning">隐藏</span>' : '<span class="text-green">正常</span>'}</td>
<td >
<a class="sort layui-btn layui-btn-primary layui-btn-xs" data-id="{$item.id}" data-sort="up" data-url="{:url('manager.achievement/infoSort')}" href="javascript:;">
<i class=""></i>向上
</a>
<a class="sort layui-btn layui-btn-primary layui-btn-xs" data-id="{$item.id}" data-sort="down" data-url="{:url('manager.achievement/infoSort')}" href="javascript:;">
<i class=""></i>向下
</a>
<a data-href="{:url('manager.achievement/infoEdit',['id' => $item['id']])}" class="layui-btn layui-btn-warm layui-btn-xs" title="编辑">
<i class=""></i>编辑
</a>
<a class="del layui-btn layui-btn-danger layui-btn-xs" data-id="{$item.id}" data-url="{:url('manager.achievement/infoDel')}" href="javascript:;" >
<i class=""></i>删除
</a>
</td>
</tr>
</tbody>
{/foreach}
</table>
{/empty}
</div>
</div>
{else /}
<div class="layui-card layui-col-md12">
<div class="layui-card-body">
<div class="empty-404">该业绩信息不存在!</div>
</div>
</div>
{/if}

View File

@ -0,0 +1,86 @@
<div class="layui-card layui-col-md12">
<div class="layui-card-body">
<form class="layui-form" data-action="{:url('manager.achievement/infoAdd')}">
<input type="hidden" name="_token" value="{$_token ?? ''}"/>
<strong style="color: #f20000; font-size: 12px; display: block; line-height: 1;">注意*号为必填选项!</strong>
<hr style="margin: 20px 0;">
<div class="layui-form-itemBox3 between">
<div class="layui-form-item">
<label class="layui-form-label">项目名称<em>*</em></label>
<div class="layui-input-block">
<input class="layui-input" name="item[title]" maxlength="60" />
<p class="layui-form-mid layui-word-aux">请勿超过60个字符</p>
</div>
</div>
</div>
<div class="layui-form-itemBox3 between">
<div class="layui-form-item">
<label class="layui-form-label">订货单位<em>*</em></label>
<div class="layui-input-block">
<input class="layui-input" name="item[order_company]" maxlength="100" />
<p class="layui-form-mid layui-word-aux">请勿超过100个字符</p>
</div>
</div>
</div>
<div class="layui-form-itemBox3 between">
<div class="layui-form-item">
<label class="layui-form-label">货物名称<br/>及型号规格<em>*</em></label>
<div class="layui-input-block">
<textarea class="layui-textarea" name="item[goods_model]" maxlength="300" onkeyup="limitContentLength(this, 300)"></textarea>
<p class="layui-form-mid layui-word-aux">请勿超过300个字符</p>
</div>
</div>
</div>
<div class="layui-form-itemBox3 between">
<div class="layui-form-item">
<label class="layui-form-label">订货数量<em>*</em></label>
<div class="layui-input-block">
<textarea class="layui-textarea" name="item[goods_amount]" maxlength="500" onkeyup="limitContentLength(this, 500)"></textarea>
<p class="layui-form-mid layui-word-aux">请勿超过500个字符</p>
</div>
</div>
</div>
<div class="layui-form-itemBox3 between">
<div class="layui-form-item">
<label class="layui-form-label">业务员姓名</label>
<div class="layui-input-block">
<input class="layui-input" name="item[owner]" maxlength="20" />
<p class="layui-form-mid layui-word-aux">选填项请勿超过20个字符</p>
</div>
</div>
</div>
<div class="layui-form-itemBox3 between">
<div class="layui-form-item">
<label class="layui-form-label">业务员电话</label>
<div class="layui-input-block">
<input class="layui-input" name="item[owner_tel]" maxlength="20" />
<p class="layui-form-mid layui-word-aux">选填项请勿超过20个字符</p>
</div>
</div>
</div>
<div class="layui-form-itemBox3 between">
<div class="layui-form-item">
<label class="layui-form-label">业务员邮箱</label>
<div class="layui-input-block">
<input class="layui-input" name="item[owner_email]" maxlength="30"/>
<p class="layui-form-mid layui-word-aux">选填项请勿超过30个字符</p>
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">状态</label>
<div class="layui-inline">
<input type="radio" name="item[visible]" value="0" title="隐藏" />
<input type="radio" name="item[visible]" value="1" title="正常" checked />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"></label>
<div class="layui-inline">
<button type="button" class="layui-btn layui-btn-normal" lay-submit lay-filter="submitAll">保存</button>
</div>
</div>
<input type="hidden" class="layui-input" name="achievement_id" value="{$achievementId}" />
</form>
</div>
</div>

View File

@ -0,0 +1,86 @@
<div class="layui-card layui-col-md12">
<div class="layui-card-body">
<form class="layui-form" data-action="{:url('manager.achievement/infoEdit')}">
<input type="hidden" name="_token" value="{$_token ?? ''}"/>
<strong style="color: #f20000; font-size: 12px; display: block; line-height: 1;">注意*号为必填选项!</strong>
<hr style="margin: 20px 0;">
<div class="layui-form-itemBox3 between">
<div class="layui-form-item">
<label class="layui-form-label">项目名称<em>*</em></label>
<div class="layui-input-block">
<input class="layui-input" name="item[title]" maxlength="60" value="{$item.title}"/>
<p class="layui-form-mid layui-word-aux">请勿超过60个字符</p>
</div>
</div>
</div>
<div class="layui-form-itemBox3 between">
<div class="layui-form-item">
<label class="layui-form-label">订货单位<em>*</em></label>
<div class="layui-input-block">
<input class="layui-input" name="item[order_company]" maxlength="100" value="{$item.order_company}" />
<p class="layui-form-mid layui-word-aux">请勿超过100个字符</p>
</div>
</div>
</div>
<div class="layui-form-itemBox3 between">
<div class="layui-form-item">
<label class="layui-form-label">货物名称及型号规格<em>*</em></label>
<div class="layui-input-block">
<textarea class="layui-textarea" name="item[goods_model]" maxlength="300" onkeyup="limitContentLength(this, 300)">{$item.goods_model}</textarea>
<p class="layui-form-mid layui-word-aux">请勿超过300个字符</p>
</div>
</div>
</div>
<div class="layui-form-itemBox3 between">
<div class="layui-form-item">
<label class="layui-form-label">订货数量<em>*</em></label>
<div class="layui-input-block">
<textarea class="layui-textarea" name="item[goods_amount]" maxlength="500" onkeyup="limitContentLength(this, 500)">{$item.goods_amount}</textarea>
<p class="layui-form-mid layui-word-aux">请勿超过500个字符</p>
</div>
</div>
</div>
<div class="layui-form-itemBox3 between">
<div class="layui-form-item">
<label class="layui-form-label">业务员姓名</label>
<div class="layui-input-block">
<input class="layui-input" name="item[owner]" maxlength="20" value="{$item.owner}"/>
<p class="layui-form-mid layui-word-aux">选填项请勿超过20个字符</p>
</div>
</div>
</div>
<div class="layui-form-itemBox3 between">
<div class="layui-form-item">
<label class="layui-form-label">业务员联系电话</label>
<div class="layui-input-block">
<input class="layui-input" name="item[owner_tel]" maxlength="20" value="{$item.owner_tel}"/>
<p class="layui-form-mid layui-word-aux">选填项请勿超过20个字符</p>
</div>
</div>
</div>
<div class="layui-form-itemBox3 between">
<div class="layui-form-item">
<label class="layui-form-label">业务员联系邮箱</label>
<div class="layui-input-block">
<input class="layui-input" name="item[owner_email]" maxlength="30" value="{$item.owner_email}"/>
<p class="layui-form-mid layui-word-aux">选填项请勿超过30个字符</p>
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">状态</label>
<div class="layui-inline">
<input type="radio" name="item[visible]" value="0" title="隐藏" {if $item['visible'] == 0}checked{/if} />
<input type="radio" name="item[visible]" value="1" title="正常" {if $item['visible'] == 1}checked{/if} />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"></label>
<div class="layui-inline">
<button type="button" class="layui-btn layui-btn-normal" lay-submit lay-filter="submitAll">保存</button>
</div>
</div>
<input type="hidden" class="layui-input" name="id" value="{$item.id}" />
</form>
</div>
</div>

View File

@ -0,0 +1,65 @@
{layout name="manager/layout" /}
<div class="layui-card layui-col-md12">
<div class="layui-card-body">
<div class="layui-col-xs12 between-center">
<div class="layui-inline">
<a id="add-article" class="layui-btn layui-btn-normal" data-href="{:url('manager.achievement/add',['category_id'=>$category['id']])}" title="添加业绩" data-width="1000"><i class="layui-icon layui-icon-add-1"></i>添加业绩</a>
</div>
</div>
<div class="layui-clear"></div>
<hr style="margin: 20px 0;">
{empty name="items"}
无记录
{else /}
<table class="layui-table">
<colgroup>
<col width="75px">
<col >
<col width="125px">
<col width="75px">
<col width="410px">
</colgroup>
<thead>
<tr>
<td>ID</td>
<td>业绩标题</td>
<td>创建日期</td>
<td>状态</td>
<td>操作</td>
</tr>
</thead>
{foreach $items as $item}
<tbody class="table-lv1" data-id="{$item.id}" data-url="{:url('manager.achievement/sort')}">
<tr>
<td>{$item.id}</td>
<td>{$item.title}</td>
<td>{$item.create_time|date="Y-m-d H:i"}</td>
<td>{:$item.visible == 0 ? '<span class="text-warning">隐藏</span>' : '<span class="text-green">正常</span>'}</td>
<td >
<a href="{:url('manager.achievement/info',['achievement_id' => $item['id']])}" class="layui-btn layui-btn-primary layui-btn-xs" title="业绩项目">
<i class=""></i>业绩项目
</a>
<a class="sort layui-btn layui-btn-primary layui-btn-xs" data-id="{$item.id}" data-sort="up" data-url="{:url('manager.achievement/sort')}" href="javascript:;">
<i class=""></i>向上
</a>
<a class="sort layui-btn layui-btn-primary layui-btn-xs" data-id="{$item.id}" data-sort="down" data-url="{:url('manager.achievement/sort')}" href="javascript:;">
<i class=""></i>向下
</a>
<a data-href="{:url('manager.achievement/edit',['id' => $item['id']])}" class="layui-btn layui-btn-warm layui-btn-xs" title="编辑">
<i class=""></i>编辑
</a>
<a class="del layui-btn layui-btn-danger layui-btn-xs" data-id="{$item.id}" data-url="{:url('manager.achievement/del')}" href="javascript:;" >
<i class=""></i>删除
</a>
</td>
</tr>
</tbody>
{/foreach}
</table>
<div class="page top30">{$items->render()|raw}</div>
{/empty}
</div>
</div>

View File

@ -37,7 +37,26 @@
<div class="pull-left"><i>{:str_pad(($k+1), 2, '0', STR_PAD_LEFT)}</i><span>{$achievement.title ?? ''}</span></div>
<div class="pull-right">展开</div>
</div>
<div class="lower-box w-100">{$achievement.content|raw}</div>
<div class="lower-box w-100">
<table class="table table-bordered">
<tr>
<th>项目名称</th>
<th>订货单位</th>
<th>货物名称及型号规格</th>
<th>数量</th>
</tr>
{if isset($achievement.infos) && count($achievement.infos) > 0}
{foreach $achievement.infos as $info}
<tr>
<td>{$info.title}</td>
<td>{$info.order_company}</td>
<td>{:nl2br($info.goods_model)}</td>
<td>{:nl2br($info.goods_amount)}</td>
</tr>
{/foreach}
{/if}
</table>
</div>
</li>
{/foreach}
{/if}

View File

@ -21,7 +21,7 @@
{$system['company_name_en'] ?? ''}<br>
{$system['company_type_en'] ?? ''}
</p>
<p><i>{$system['company_copyright'] ?? ''}{$system['company_copy'] ?? ''}</i></p>
<p><i>{$system['company_copyright']|raw}{$system['company_copy']|raw}</i></p>
</div>
<div class="column-between">
<p><span>电话/Tel: {$system['company_tel'] ?? ''}</span></p>