Commit b7cff4a0 by 杨树贤

供应商入驻跟进

parent 2fb2c330
......@@ -39,4 +39,25 @@ class ChainApiController extends Controller
$chain = ChainModel::where('chain_id', $chainId)->first()->toArray();
$this->response(0, 'ok', $chain);
}
//跟进
public function checkChain($request)
{
$map = $request->only([
'status',
'check_content',
'chain_id',
]);
if (empty($map['check_content']) && $map['status'] == 3) {
$this->response(-1, '跟进内容不能为空');
}
if (empty($map['status'])) {
$this->response(-1, '跟进结果不能为空');
}
$result = (new ChainService())->checkChain($map);
if (!$result) {
$this->response(0, '跟进出错,请联系管理员');
}
$this->response(0, '跟进成功');
}
}
......@@ -46,4 +46,11 @@ class ChainController extends Controller
$this->data['view'] = 'ChainList';
return $this->view('供应商申请列表');
}
}
\ No newline at end of file
public function CheckChain($request)
{
$this->data['title'] = '供应商入驻跟进';
$this->data['view'] = 'CheckChain';
return $this->view('供应商入驻跟进');
}
}
......@@ -10,10 +10,8 @@ use App\Model\SupplierChannelModel;
class ChainFilter
{
//查询条件
public function listFilter($map)
public function listFilter($query, $map)
{
$model = new ChainModel();
$query = $model->orderBy('chain_id', 'desc');
if (!empty($map['com_name'])) {
$query->where('com_name', 'like', "%${map['com_name']}%");
......@@ -32,6 +30,22 @@ class ChainFilter
if (!empty($map['supplier_type'])) {
$query->where('supplier_type', $map['supplier_type']);
}
if (!empty($map['check_status'])) {
$query->where('check_status', $map['check_status']);
}
if ((isset($map['is_entity']) && $map['is_entity'] === '0') || !empty($map['is_entity'])) {
$query->where('is_entity', $map['is_entity']);
}
if (!empty($map['has_supplier'])) {
$supplierNames = SupplierChannelModel::where('is_type', 0)->pluck('supplier_name')->toArray();
if ($map['has_supplier'] == 1) {
$query->whereIn('com_name', $supplierNames);
} else {
$query->whereNotIn('com_name', $supplierNames);
}
}
if (!empty($map['create_time'])) {
$times = explode('~', $map['create_time']);
......@@ -42,4 +56,4 @@ class ChainFilter
return $query;
}
}
\ No newline at end of file
}
......@@ -6,6 +6,8 @@ namespace App\Http\Services;
//后台用户相关信息服务
use App\Http\Controllers\Filter\ChainFilter;
use App\Http\Transformers\ChainTransformer;
use App\Model\ChainCheckModel;
use App\Model\ChainModel;
class ChainService
{
......@@ -14,11 +16,37 @@ class ChainService
public function getChainList($map)
{
$limit = array_get($map, 'limit', 10);
$model = new ChainModel();
$query = $model->with(['chain_check', 'supplier' => function ($q) {
$q->select(['supplier_name', 'supplier_id']);
}])->orderBy('chain_id', 'desc');
$filter = new ChainFilter();
$query = $filter->listFilter($map);
$query = $filter->listFilter($query, $map);
$list = $query->paginate($limit)->toArray();
$transformer = new ChainTransformer();
$list['data'] = $transformer->transformList($list['data']);
return $list;
}
}
\ No newline at end of file
//跟进
public function checkChain($map)
{
$data = [
'chain_id' => $map['chain_id'],
'check_status' => $map['status'],
'check_name' => request()->user->name,
'check_time' => time(),
'check_uid' => request()->user->userId,
'check_content' => $map['check_content']
];
$result = ChainCheckModel::insert($data);
if ($result) {
ChainModel::where('chain_id', $map['chain_id'])->update([
'check_status' => $map['status'],
]);
}
return $result;
}
}
......@@ -19,6 +19,8 @@ class ChainTransformer
$item['data_type_name'] = array_get(config('field.ChainDataType'), $item['data_type'], '无');
$item['company_nature'] = array_get(config('field.ChainCompanyNature'), $item['company_nature'], '无');
$item['region'] = array_get(config('field.ChainRegion'), $item['region'], '无');
$item['check_status_name'] = array_get(config('field.ChainCheckStatus'),$item['check_status']);
$item['is_entity_name'] = array_get(config('field.IsEntity'),$item['is_entity']);
if (!empty($item['mobile'])) {
$item['mobile'] = substr($item['mobile'], 0, 3) . '****' . substr($item['mobile'], 7);
}
......@@ -33,6 +35,14 @@ class ChainTransformer
$item['email'] = $emailTemp;
}
}
if (!empty($item['chain_check'])) {
foreach ($item['chain_check'] as &$value) {
$value['check_status_name'] = array_get(config('field.ChainCheckStatus'),$value['check_status']);
}
unset($value);
}
$item['sub'] = $item['chain_check'];
}
unset($item);
......
<?php
namespace App\Model;
use App\Http\Services\AdminUserService;
use App\Http\Services\DepartmentService;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Redis;
class ChainCheckModel extends Model
{
protected $connection = 'liexin';
protected $table = 'chain_check';
protected $primaryKey = 'id';
public $timestamps = false;
}
......@@ -13,4 +13,14 @@ class ChainModel extends Model
protected $table = 'chain';
protected $primaryKey = 'chain_id';
public $timestamps = false;
public function chain_check()
{
return $this->hasMany(ChainCheckModel::class, 'chain_id', 'chain_id');
}
public function supplier()
{
return $this->hasOne(SupplierChannelModel::class, 'supplier_name', 'com_name');
}
}
......@@ -312,5 +312,13 @@ return [
0 => '待确认',
1 => '是',
-2 => '驳回'
],
'ChainCheckStatus' => [
0 => '待跟进',
1 => '渠道已跟进',
2 => '采购已通过',
3 => '采购未通过',
4 => '采购未反馈',
]
];
This diff could not be displayed because it is too large.
/**
*
* @name: 子表格扩展
* @author: yelog
* @link: https://github.com/yelog/layui-soul-table
* @license: MIT
* @version: v1.6.2
*/
layui.define(['table'], function (exports) {
var $ = layui.jquery;
// 封装方法
var mod = {
/**
* 渲染入口
* @param myTable
*/
render: function (myTable) {
var tableBox = $(myTable.elem).next().children('.layui-table-box'),
$main = $(tableBox.children('.layui-table-body').children('table').children('tbody').children('tr').toArray().reverse()),
$fixLeft = $(tableBox.children('.layui-table-fixed-l').children('.layui-table-body').children('table').children('tbody').children('tr').toArray().reverse()),
$fixRight = $(tableBox.children('.layui-table-fixed-r').children('.layui-table-body').children('table').children('tbody').children('tr').toArray().reverse()),
mergeRecord = {};
layui.each(myTable.cols, function (i1, item1) {
layui.each(item1, function (i2, item2) {
if (item2.merge && item2.field) {
var mergeField = [item2.field];
if (item2.merge !== true) {
if (typeof item2.merge === 'string') {
mergeField = [item2.merge]
} else {
mergeField = item2.merge
}
}
mergeRecord[myTable.index + '-' + i1 + '-' + i2] = {mergeField: mergeField, rowspan: 1}
}
})
})
$main.each(function (i) {
for (var item in mergeRecord) {
if (i === $main.length - 1 || isMaster(i, item)) {
var tdHeight = $(this).children('[data-key="' + item + '"]').outerHeight(), patchHeight = 0; // 获取td高度
if ($main.eq(i).data('index') === 0) {
patchHeight = 1
}
$(this).children('[data-key="' + item + '"]').attr('rowspan', mergeRecord[item].rowspan).css({
'position': 'static',
'height': tdHeight * mergeRecord[item].rowspan + patchHeight
}).children().css({
height: 'auto',
'white-space': 'normal',
'max-height': tdHeight * mergeRecord[item].rowspan + patchHeight - 10
});
$fixLeft.eq(i).children('[data-key="' + item + '"]').attr('rowspan', mergeRecord[item].rowspan).css({
'position': 'static',
'height': tdHeight * mergeRecord[item].rowspan + patchHeight
}).children().css({
height: 'auto',
'white-space': 'normal',
'max-height': tdHeight * mergeRecord[item].rowspan + patchHeight - 10
});
$fixRight.eq(i).children('[data-key="' + item + '"]').attr('rowspan', mergeRecord[item].rowspan).css({
'position': 'static',
'height': tdHeight * mergeRecord[item].rowspan + patchHeight
}).children().css({
height: 'auto',
'white-space': 'normal',
'max-height': tdHeight * mergeRecord[item].rowspan + patchHeight - 10
});
mergeRecord[item].rowspan = 1;
} else {
$(this).children('[data-key="' + item + '"]').remove();
$fixLeft.eq(i).children('[data-key="' + item + '"]').remove();
$fixRight.eq(i).children('[data-key="' + item + '"]').remove();
mergeRecord[item].rowspan += 1;
}
}
})
function isMaster(index, item) {
var mergeField = mergeRecord[item].mergeField;
var dataLength = layui.table.cache[myTable.id].length;
for (var i = 0; i < mergeField.length; i++) {
if (layui.table.cache[myTable.id][dataLength - 2 - index][mergeField[i]]
!== layui.table.cache[myTable.id][dataLength - 1 - index][mergeField[i]]) {
return true;
}
}
return false;
}
}
};
// 输出
exports('tableMerge', mod);
});
This diff could not be displayed because it is too large.
/**
*
* @name: 子表格扩展
* @author: yelog
* @link: https://github.com/yelog/layui-soul-table
* @license: MIT
* @version: v1.6.2
*/
layui.define(['table'], function (exports) {
var $ = layui.jquery;
// 封装方法
var mod = {
/**
* 渲染入口
* @param myTable
*/
render: function (myTable) {
var tableBox = $(myTable.elem).next().children('.layui-table-box'),
$main = $(tableBox.children('.layui-table-body').children('table').children('tbody').children('tr').toArray().reverse()),
$fixLeft = $(tableBox.children('.layui-table-fixed-l').children('.layui-table-body').children('table').children('tbody').children('tr').toArray().reverse()),
$fixRight = $(tableBox.children('.layui-table-fixed-r').children('.layui-table-body').children('table').children('tbody').children('tr').toArray().reverse()),
mergeRecord = {};
layui.each(myTable.cols, function (i1, item1) {
layui.each(item1, function (i2, item2) {
if (item2.merge && item2.field) {
var mergeField = [item2.field];
if (item2.merge !== true) {
if (typeof item2.merge === 'string') {
mergeField = [item2.merge]
} else {
mergeField = item2.merge
}
}
mergeRecord[myTable.index + '-' + i1 + '-' + i2] = {mergeField: mergeField, rowspan: 1}
}
})
})
$main.each(function (i) {
for (var item in mergeRecord) {
if (i === $main.length - 1 || isMaster(i, item)) {
var tdHeight = $(this).children('[data-key="' + item + '"]').outerHeight(), patchHeight = 0; // 获取td高度
if ($main.eq(i).data('index') === 0) {
patchHeight = 1
}
$(this).children('[data-key="' + item + '"]').attr('rowspan', mergeRecord[item].rowspan).css({
'position': 'static',
'height': tdHeight * mergeRecord[item].rowspan + patchHeight
}).children().css({
height: 'auto',
'white-space': 'normal',
'max-height': tdHeight * mergeRecord[item].rowspan + patchHeight - 10
});
$fixLeft.eq(i).children('[data-key="' + item + '"]').attr('rowspan', mergeRecord[item].rowspan).css({
'position': 'static',
'height': tdHeight * mergeRecord[item].rowspan + patchHeight
}).children().css({
height: 'auto',
'white-space': 'normal',
'max-height': tdHeight * mergeRecord[item].rowspan + patchHeight - 10
});
$fixRight.eq(i).children('[data-key="' + item + '"]').attr('rowspan', mergeRecord[item].rowspan).css({
'position': 'static',
'height': tdHeight * mergeRecord[item].rowspan + patchHeight
}).children().css({
height: 'auto',
'white-space': 'normal',
'max-height': tdHeight * mergeRecord[item].rowspan + patchHeight - 10
});
mergeRecord[item].rowspan = 1;
} else {
$(this).children('[data-key="' + item + '"]').remove();
$fixLeft.eq(i).children('[data-key="' + item + '"]').remove();
$fixRight.eq(i).children('[data-key="' + item + '"]').remove();
mergeRecord[item].rowspan += 1;
}
}
})
function isMaster(index, item) {
var mergeField = mergeRecord[item].mergeField;
var dataLength = layui.table.cache[myTable.id].length;
for (var i = 0; i < mergeField.length; i++) {
if (layui.table.cache[myTable.id][dataLength - 2 - index][mergeField[i]]
!== layui.table.cache[myTable.id][dataLength - 1 - index][mergeField[i]]) {
return true;
}
}
return false;
}
}
};
// 输出
exports('tableMerge', mod);
});
......@@ -16,7 +16,8 @@ layui.config({ // common.js是配置layui扩展模块的目录,每个页面
citypicker: 'city-picker/city-picker',
introJs: 'introJs/introJs',
zTree: 'zTree/zTree',
xmSelect: 'xmSelect/xm-select'
xmSelect: 'xmSelect/xm-select',
soulTable: 'soulTable'
}).use(['layer', 'admin'], function () {
var $ = layui.jquery;
var layer = layui.layer;
......
<script>
layui.use(['table', 'form', 'element', 'table', 'layer', 'admin'], function () {
let table = layui.table
table.render({
elem: '#list'
, url: '/api/chain/GetChainCheckList'
, method: 'post'
, size: 'sm'
, limit: 20
, cellMinWidth: 80 //全局定义常规单元格的最小宽度
, where: {}
, loading: true
, first: true //不显示首页
, last: false //不显示尾页
, cols: [[
{
field: 'status_name', title: '跟进结果', align: 'center',
},
{field: 'check_content', title: '跟进内容', align: 'center'},
{field: 'create_time', title: '跟进时间', width: 150, align: 'center'},
{field: 'create_name', title: '跟进人', width: 150, align: 'center'},
]]
, id: 'list'
, page: {}
});
});
</script>
<script>
layui.use(['table', 'form', 'element', 'upload', 'layer', 'Split', 'admin', 'xmSelect'], function () {
layui.use(['table', 'form', 'element', 'upload', 'layer', 'Split', 'soulTable', 'admin', 'xmSelect'], function () {
let $ = layui.jquery;
let Split = layui.Split;
let table = layui.table;
......@@ -10,6 +10,8 @@
let initCondition = {source_type: 'all'};
let whereCondition = initCondition;
let type = 'all';
var soulTable = layui.soulTable;
//监听复选框事件,被选中的行高亮显示
table.on('checkbox(chainList)', function (obj) {
......@@ -17,8 +19,47 @@
});
let cols = [
{type: 'checkbox', fixed: true},
{field: 'chain_id', title: '序号', align: 'center', width: 80},
{field: 'com_name', title: '公司名称', align: 'center', width: 250},
{field: 'is_entity_name', title: '实体名单', align: 'center', width: 100},
{field: 'check_status_name', title: '跟进结果', align: 'center', width: 100},
{
field: 'chain_check',
title: '跟进记录',
align: 'center',
width: 100,
childTitle: '跟进记录',
show: 2,
layerOption: {title: '跟进记录', area: '1000px',},
children: [
{
title: '子表',
height: 300,
data: function (row) {
return row.sub;
},
size: 'sm',
page: true,
cols: [[
{field: 'check_status_name', title: '跟进结果', width: 100},
{field: 'check_time', title: '跟进时间', width: 150},
{field: 'check_content', title: '跟进内容'},
{field: 'check_name', title: '跟进人', width: 150},
]],
toolEvent: function (obj, pobj) {
},
}
],
templet: function () {
return '<span style="color: dodgerblue" class="view_check">查看记录</span>';
},
},
{
field: 'has_supplier', title: '是否建档', align: 'center', width: 100, templet: function (data) {
return data.supplier && data.com_name ? '是' : '否';
}
},
{field: 'company_nature', title: '公司性质', align: 'center', width: 100},
{field: 'region', title: '所在区域', align: 'center', width: 100},
{field: 'link_name', title: '联系人', align: 'center', width: 170},
......@@ -73,10 +114,18 @@
, id: 'chainList'
, page: {}
, done: function (res, curr, count) {
soulTable.render(this);
currentPage = curr;
}
});
$(function () {
$('.view_check').click(function () {
alert(123);
$(this).prev().click();
});
});
form.on('submit(load)', function (data) {
whereCondition = $.extend(false, initCondition, data.field);
......@@ -133,6 +182,29 @@
}
}
});
//审批供应商弹窗
$("#checkStatus").click(function () {
let checkStatus = table.checkStatus('chainList');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
if (data.length > 1) {
layer.msg('该操作不支持多选', {icon: 5})
return;
}
let chainId = data[0].chain_id;
let status = data[0].status;
layer.open({
type: 2,
content: '/chain/CheckChain?view=iframe&chain_id=' + chainId,
area: ['800px', '65%'],
title: '跟进情况',
end: function () {
table.reload('chainList');
}
});
}
})
});
</script>
<script>
layui.use(['table', 'form', 'element', 'layer', 'admin'], function () {
let admin = layui.admin;
let form = layui.form;
let element = layui.element;
form.on('submit(checkChain)', function (data) {
admin.showLoading({type: 3});
let chainId = getQueryVariable('chain_id');
let url = '/api/chain/checkChain?chain_id=' + chainId;
$.ajax({
url: url,
type: 'post',
data: data.field,
dataType: 'json',
timeout: 20000,
success: function (res) {
if (!res) return layer.msg('网络错误,请重试', {icon: 5});
if (res.err_code === 0) {
admin.removeLoading();
admin.closeThisDialog();
parent.layer.msg(res.err_msg, {icon: 6});
} else {
admin.removeLoading();
parent.layer.msg(res.err_msg, {icon: 5});
}
},
error: function () {
admin.removeLoading();
return layer.msg('网络错误,请重试', {icon: 5});
}
});
return false;
});
form.on('submit(cancel)', function (data) {
admin.closeThisDialog();
});
});
</script>
<blockquote class="layui-elem-quote layui-text">
<b>审核列表 : </b> (只要申请部门或者被申请部门和你是同一个部门的,具有审核权限的你都可以看到申请)
</blockquote>
<table class="layui-table" id="list" lay-filter="list"></table>
<script type="text/html" id="operate">
<div>
<button type="button" value="@{{ d.id}}" status="pass" class="layui-btn layui-btn-xs audit_supplier_share_apply" lay-event="pass">同意
</button>
<button type="button" value="@{{ d.id}}" status="reject" class="layui-btn layui-btn-xs layui-btn-danger audit_supplier_share_apply" lay-event="reject">拒绝
</button>
</div>
</script>
......@@ -31,6 +31,18 @@
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('supplier_type','入驻类型',request()->get('data_type'),config('field.ChainSupplierType')) !!}
</div>
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('is_entity','实体名单',request()->get('is_entity'),config('field.IsEntity')) !!}
</div>
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('has_supplier','是否建档',request()->get('has_supplier'),[1=>'是',-1=>'否']) !!}
</div>
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('check_status','跟进结果',request()->get('check_status'),config('field.ChainCheckStatus')) !!}
</div>
</div>
<div class="layui-row">
<div class="layui-inline" style="width: 600px">
......@@ -50,7 +62,7 @@
</div>
<div style="margin-left: 20px;margin-right: 20px">
<div class="layui-btn-group demoTable" style="margin-top: 15px">
<button type="button" class="layui-btn layui-btn-sm layui-btn" lay-filter="checkStatus" id="checkStatus">跟进情况</button>
</div>
<table class="layui-table" id="chainList" lay-filter="chainList"></table>
</div>
<style>
.layui-form-item {
margin-bottom: 5px;
}
</style>
<div class="layui-card">
<div class="layui-card-body">
<form class="layui-form" action="">
<div class="layui-form-item">
<label class="layui-form-label"><span style="color: red">*</span>跟进结果 : </label>
<div class="layui-input-block">
<input type="radio" name="status" value="1" title="渠道已跟进">
<input type="radio" name="status" value="2" title="采购已通过">
<input type="radio" name="status" value="3" title="采购未通过">
<input type="radio" name="status" value="4" title="采购未反馈">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label"><span style="color: red">*</span>跟进内容 : </label>
<div class="layui-input-block">
<textarea name="check_content" placeholder="" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item">
<div align="center" style="margin-top: 20px;text-align: right">
<button type="button" class="layui-btn layui-btn-sm layui-btn-info submit-loading" lay-submit
lay-filter="checkChain">确定
</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" lay-submit
lay-filter="cancel">取消
</button>
</div>
</div>
</form>
</div>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment