Commit c896bae0 by 杨树贤

供应商入驻字段

parent 8239706f
...@@ -8,6 +8,7 @@ use App\Http\Services\ChainService; ...@@ -8,6 +8,7 @@ use App\Http\Services\ChainService;
use App\Http\Services\SupplierExaminationService; use App\Http\Services\SupplierExaminationService;
use App\Http\Transformers\SupplierLogTransformer; use App\Http\Transformers\SupplierLogTransformer;
use App\Http\Validators\SupplierExaminationValidator; use App\Http\Validators\SupplierExaminationValidator;
use App\Model\ChainModel;
use App\Model\LogModel; use App\Model\LogModel;
use App\Model\SupplierAccountModel; use App\Model\SupplierAccountModel;
use App\Model\SupplierApplyModel; use App\Model\SupplierApplyModel;
...@@ -30,4 +31,12 @@ class ChainApiController extends Controller ...@@ -30,4 +31,12 @@ class ChainApiController extends Controller
$list = $service->getChainList($request->all()); $list = $service->getChainList($request->all());
$this->response(0, 'ok', $list['data'], $list['total']); $this->response(0, 'ok', $list['data'], $list['total']);
} }
//获取芯链账号
public function GetChain($request)
{
$chainId = $request->input('chain_id');
$chain = ChainModel::where('chain_id', $chainId)->first()->toArray();
$this->response(0, 'ok', $chain);
}
} }
...@@ -115,7 +115,7 @@ class SupplierStatisticsService ...@@ -115,7 +115,7 @@ class SupplierStatisticsService
return $value; return $value;
}, $result); }, $result);
$redis->set($statisticsKey, json_encode($result)); $redis->set($statisticsKey, json_encode($result));
$redis->expire($statisticsKey, 600); $redis->expire($statisticsKey, 60);
return $result; return $result;
} }
......
...@@ -17,10 +17,26 @@ class ChainTransformer ...@@ -17,10 +17,26 @@ class ChainTransformer
$item['create_time'] = $item['create_time'] ? date('Y-m-d H:i:s', $item['create_time']) : ''; $item['create_time'] = $item['create_time'] ? date('Y-m-d H:i:s', $item['create_time']) : '';
$item['supplier_type_name'] = array_get(config('field.ChainSupplierType'), $item['supplier_type'], '无'); $item['supplier_type_name'] = array_get(config('field.ChainSupplierType'), $item['supplier_type'], '无');
$item['data_type_name'] = array_get(config('field.ChainDataType'), $item['data_type'], '无'); $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'], '无');
if (!empty($item['mobile'])) {
$item['mobile'] = substr($item['mobile'], 0, 3) . '****' . substr($item['mobile'], 7);
}
if (!empty($item['email'])) {
$emailTemp = explode('@', $item['email'])[0];
$replace = str_pad('*', strlen($emailTemp), '*');
$emailTemp = str_replace($emailTemp, $replace, $emailTemp);
if (count(explode('@', $item['email'])) > 1) {
$item['email'] = $emailTemp . '@' . explode('@', $item['email'])[1];
} else {
$item['email'] = $emailTemp;
}
}
} }
unset($item); unset($item);
return $list; return $list;
} }
} }
\ No newline at end of file
...@@ -290,4 +290,19 @@ return [ ...@@ -290,4 +290,19 @@ return [
2 => '联营供应商', 2 => '联营供应商',
3 => '国产推荐' 3 => '国产推荐'
], ],
'ChainCompanyNature' => [
7 => '原厂',
1 => '代理商',
2 => '现货商',
3 => '其它',
],
'ChainRegion' => [
1 => '欧美',
2 => '大陆',
3 => '日韩',
4 => '港台',
5 => '其它',
]
]; ];
...@@ -11,62 +11,41 @@ ...@@ -11,62 +11,41 @@
let whereCondition = initCondition; let whereCondition = initCondition;
let type = 'all'; let type = 'all';
$(document).on("click", ".layui-table-body table.layui-table tbody tr", function () {
let index = $(this).attr('data-index');
let tableBox = $(this).parents('.layui-table-box');
let tableDiv = null;
if (tableBox.find(".layui-table-fixed.layui-table-fixed-l").length > 0) {
tableDiv = tableBox.find(".layui-table-fixed.layui-table-fixed-l");
} else {
tableDiv = tableBox.find(".layui-table-body.layui-table-main");
}
let checkCell = tableDiv.find("tr[data-index=" + index + "]").find("td div.laytable-cell-checkbox div.layui-form-checkbox I");
if (checkCell.length > 0) {
checkCell.click();
}
});
$(document).on("click", "td div.laytable-cell-checkbox div.layui-form-checkbox", function (e) {
e.stopPropagation();
});
//监听复选框事件,被选中的行高亮显示 //监听复选框事件,被选中的行高亮显示
table.on('checkbox(chainList)', function (obj) { table.on('checkbox(chainList)', function (obj) {
//拉黑就不用变色了
if (obj.data.status === -3) {
return
}
if (obj.checked === true && obj.type === 'all') {
//点击全选,拉黑的不用选上
$('.layui-table-body table.layui-table tbody tr:not(.block-class)').addClass('layui-table-click');
$('.layui-table-body table.layui-table tbody').find('.block-class').find('.layui-form-checkbox').remove();
$('.layui-table-body table.layui-table tbody tr .block-class').addClass('layui-table-click');
} else if (obj.checked === false && obj.type === 'all') {
//点击全不选
$('.layui-table-body table.layui-table tbody tr').removeClass('layui-table-click');
} else if (obj.checked === true && obj.type === 'one') {
//点击单行
if (obj.checked === true) {
obj.tr.addClass('layui-table-click');
} else {
obj.tr.removeClass('layui-table-click');
}
} else if (obj.checked === false && obj.type === 'one') {
//点击全选之后点击单行
if (obj.tr.hasClass('layui-table-click')) {
obj.tr.removeClass('layui-table-click');
}
}
}); });
let cols = [ let cols = [
{field: 'chain_id', title: '序号', align: 'center', width: 80}, {field: 'chain_id', title: '序号', align: 'center', width: 80},
{field: 'com_name', title: '公司名称', align: 'center', width: 250}, {field: 'com_name', title: '公司名称', align: 'center', width: 250},
{field: 'company_nature', title: '公司性质', align: 'center', width: 100},
{field: 'region', title: '所在区域', align: 'center', width: 100},
{field: 'link_name', title: '联系人', align: 'center', width: 170}, {field: 'link_name', title: '联系人', align: 'center', width: 170},
{field: 'mobile', title: '联系方式', align: 'center', width: 160}, {field: 'position', title: '职位', align: 'center', width: 100},
{ {
field: 'main_brand', title: '主营产品', align: 'center' field: 'mobile', title: '联系方式', align: 'center', width: 160,
templet: function (data) {
let text = '查看';
return '<span>' + data.mobile + '</span><span style="color: dodgerblue;margin-left: 10px" class="viewChain" type="mobile" id="' + data.chain_id + '">' + text + '</span>';
}
},
{
field: 'email', title: '邮箱', align: 'center', width: 150,
templet: function (data) {
if (data.email) {
let text = '查看';
return '<span>' + data.email + '</span><span style="color: dodgerblue;margin-left: 10px" class="viewChain" type="email" id="' + data.chain_id + '">' + text + '</span>';
}
return '';
}
},
{
field: 'main_product_type', title: '主营产品', align: 'center'
},
{
field: 'main_brand', title: '主营品牌', align: 'center'
}, },
{field: 'supplier_type_name', title: '入驻类型', align: 'center', width: 100}, {field: 'supplier_type_name', title: '入驻类型', align: 'center', width: 100},
{field: 'data_type_name', title: '来源', align: 'center', width: 100}, {field: 'data_type_name', title: '来源', align: 'center', width: 100},
...@@ -99,92 +78,6 @@ ...@@ -99,92 +78,6 @@
}); });
$("#add_supplier_examination").click(function () {
layer.open({
type: 2,
content: '/supplier_examination/AddChain?view=iframe&supplier_id=' + getQueryVariable('supplier_id'),
area: ['80%', '90%'],
title: '添加IQC检测记录',
end: function () {
table.reload('chainList');
}
});
return false;
});
$("#update_supplier_examination").click(function () {
let checkStatus = table.checkStatus('chainList');
let data = checkStatus.data;
if (data.length > 1) {
layer.msg('该操作不支持多选', {icon: 5});
return;
}
if (!data.length) {
layer.msg('请先选择要操作的记录', {icon: 5});
} else {
let id = data[0].id;
layer.open({
type: 2,
content: '/supplier_examination/UpdateChain?view=iframe&id=' + id + '&supplier_id=' + getQueryVariable('supplier_id'),
area: ['80%', '90%'],
title: '添加IQC检测记录',
end: function () {
table.reload('chainList');
}
});
}
return false;
});
$("#batch_update_supplier_examination").click(function () {
let checkStatus = table.checkStatus('chainList');
let data = checkStatus.data;
let ids = [];
$.each(data, function (i, v) {
ids.push(v.id);
});
if (!ids) {
layer.msg('请先选择要操作的记录', {icon: 5});
} else {
ids = ids.join(',')
layer.open({
type: 2,
content: '/supplier_examination/BatchUpdateChain?view=iframe&ids=' + ids + '&supplier_id=' + getQueryVariable('supplier_id'),
area: ['80%', '90%'],
title: '批量修改IQC检测记录',
end: function () {
table.reload('chainList');
}
});
}
return false;
});
//启用
$("#delete_supplier_examination").click(function () {
let checkStatus = table.checkStatus('chainList');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的检测数据', {icon: 5})
} else {
layer.confirm('是否删除所选记录?', function (index) {
let ids = [];
$.each(data, function (index, value) {
ids.push(value.id);
});
ids = ids.join(',');
let res = ajax('/api/supplier_examination/DeleteChains', {ids: ids})
if (res.err_code === 0) {
table.reload('chainList');
layer.closeAll();
layer.msg(res.err_msg, {icon: 6})
} else {
layer.msg(res.err_msg, {icon: 5})
}
});
}
});
form.on('submit(load)', function (data) { form.on('submit(load)', function (data) {
whereCondition = $.extend(false, initCondition, data.field); whereCondition = $.extend(false, initCondition, data.field);
//执行重载 //执行重载
...@@ -203,35 +96,43 @@ ...@@ -203,35 +96,43 @@
}); });
//执行实例 $(document).on('click', '.viewChain', function (e) {
var uploadInst = upload.render({ if ($(this).text() === '隐藏') {
elem: '#import_supplier_examination', //绑定元素 $(this).prev().text($(this).attr('prev_text'));
url: '/api/supplier_examination/ImportChain', //上传接口 $(this).text('查看');
auto: true, } else {
exts: 'xlsx', let chainId = $(this).attr('id');
before: function (obj) { //obj参数包含的信息,跟 choose回调完全一致,可参见上文。 let type = $(this).attr('type');
layer.msg('上传中', {icon: 16}); //上传loading let resp = ajax('/api/chain/GetChain', {chain_id: chainId, type: type});
}, if (!resp) {
done: function (res) { layer.msg('网络连接失败', {'icon': 5});
if (!res) { return false;
return layui.msg('上传失败', {icon: 5});
} }
if (res.err_code === 0) { let prevText = $(this).prev().text();
layer.msg(res.err_msg, {icon: 6}); $(this).attr('prev_text', prevText);
table.reload('chainList'); if (resp.err_code === 0) {
} else { switch (type) {
let errMsg = res.err_msg; case 'mobile':
let msg = ''; $(this).prev().text(resp.data.mobile);
$.each(errMsg.split('&'), function (index, value) { break;
msg += "<span>" + value + "</span><br>" case 'email':
$(this).prev().text(resp.data.email);
break;
}
$.get(getLogDomain() + "/api/addSensitiveClick", {
uid: getCookie("oa_user_id") || 0,
sys_id: 4,
mask_type: type || 0,
origin_id: chainId || 0,
source_from: window.location.href
}); });
layer.msg(msg, {icon: 5, time: 5000}) $(this).text('隐藏');
} else {
layer.msg(resp.err_msg, {'icon': 5});
return false;
} }
},
error: function () {
return layer.msg('上传失败', {icon: 5});
} }
}); });
}); });
</script> </script>
\ No newline at end of file
...@@ -54,4 +54,3 @@ ...@@ -54,4 +54,3 @@
</div> </div>
<table class="layui-table" id="chainList" lay-filter="chainList"></table> <table class="layui-table" id="chainList" lay-filter="chainList"></table>
</div> </div>
@include('script.ChainListScript')
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