Commit 2f18cce7 by 杨树贤

供应商入驻页面迁移

parent 4d494e0a
<?php
namespace App\Http\Controllers\Filter;
use App\Model\SupplierAccountModel;
use App\Model\ChainModel;
use App\Model\SupplierChannelModel;
class ChainFilter
{
//查询条件
public function listFilter($map)
{
$model = new ChainModel();
$query = $model->orderBy('chain_id', 'desc');
if (!empty($map['com_name'])) {
$query->where('com_name', 'like', "%${map['com_name']}%");
}
if (!empty($map['link_name'])) {
$query->where('link_name', 'like', "%${map['link_name']}%");
}
if (!empty($map['mobile'])) {
$query->where('mobile', 'like', "%${map['mobile']}%");
}
if (!empty($map['data_type'])) {
$query->where('data_type', $map['data_type']);
}
if (!empty($map['supplier_type'])) {
$query->where('supplier_type', $map['supplier_type']);
}
if (!empty($map['create_time'])) {
$times = explode('~', $map['create_time']);
$startTime = strtotime($times[0]);
$endTime = strtotime($times[1]);
$query->whereBetween('create_time', [$startTime, $endTime]);
}
return $query;
}
}
\ No newline at end of file
<script>
layui.use(['table', 'form', 'element', 'upload', 'layer', 'Split', 'admin', 'xmSelect'], function () {
let $ = layui.jquery;
let Split = layui.Split;
let table = layui.table;
let upload = layui.upload;
let form = layui.form;
let admin = layui.admin;
let xmSelect = layui.xmSelect;
let initCondition = {source_type: 'all'};
let whereCondition = initCondition;
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) {
//拉黑就不用变色了
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 = [
{field: 'chain_id', title: '序号', align: 'center', width: 80},
{field: 'com_name', title: '公司名称', align: 'center', width: 250},
{field: 'link_name', title: '联系人', align: 'center', width: 170},
{field: 'mobile', title: '联系方式', align: 'center', width: 160},
{
field: 'main_brand', title: '主营产品', align: 'center'
},
{field: 'supplier_type_name', title: '入驻类型', align: 'center', width: 100},
{field: 'data_type_name', title: '来源', align: 'center', width: 100},
{field: 'ip_address', title: 'IP地址', align: 'center', width: 150},
{field: 'create_time', title: '创建时间', align: 'center', width: 150},
];
let currentPage = 0;
let url = '/api/chain/GetChainList';
$('#three_days_button').remove();
table.render({
elem: '#chainList'
, url: url
, method: 'post'
, size: 'sm'
, limit: 20
, height: 600
, cellMinWidth: 50 //全局定义常规单元格的最小宽度
, where: whereCondition
, loading: true
, first: true //不显示首页
, last: false //不显示尾页
, cols: [cols]
, id: 'chainList'
, page: {}
, done: function (res, curr, count) {
currentPage = curr;
}
});
$("#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) {
whereCondition = $.extend(false, initCondition, data.field);
//执行重载
table.reload('chainList', {
page: {
curr: 1
}
, where: whereCondition
});
return false;
});
form.on('submit(reset)', function (data) {
layer.load(1);
location.reload();
});
//执行实例
var uploadInst = upload.render({
elem: '#import_supplier_examination', //绑定元素
url: '/api/supplier_examination/ImportChain', //上传接口
auto: true,
exts: 'xlsx',
before: function (obj) { //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
layer.msg('上传中', {icon: 16}); //上传loading
},
done: function (res) {
if (!res) {
return layui.msg('上传失败', {icon: 5});
}
if (res.err_code === 0) {
layer.msg(res.err_msg, {icon: 6});
table.reload('chainList');
} else {
let errMsg = res.err_msg;
let msg = '';
$.each(errMsg.split('&'), function (index, value) {
msg += "<span>" + value + "</span><br>"
});
layer.msg(msg, {icon: 5, time: 5000})
}
},
error: function () {
return layer.msg('上传失败', {icon: 5});
}
});
});
</script>
\ No newline at end of file
<div class="layui-collapse">
<form class="layui-form" style="margin-top: 15px">
<div class="layui-row">
<div class="layui-inline">
<label class="layui-form-label">公司名称</label>
<div class="layui-input-inline">
<input type="text" value="" name="com_name" placeholder="支持模糊匹配" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">联系人</label>
<div class="layui-input-inline">
<input type="text" value="" name="link_name" placeholder="支持模糊匹配" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">联系方式</label>
<div class="layui-input-inline">
<input type="text" value="" name="mobile" placeholder="支持模糊匹配" autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('data_type','平台来源',request()->get('data_type'),config('field.ChainDataType')) !!}
</div>
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('supplier_type','入驻类型',request()->get('data_type'),config('field.ChainSupplierType')) !!}
</div>
</div>
<div class="layui-row">
<div class="layui-inline" style="width: 600px">
@inject('transformableTimeIntervalPresenter','App\Presenters\Filter\TransformableTimeIntervalPresenter')
{!! $transformableTimeIntervalPresenter->render(['create_time'=>'创建时间']) !!}
</div>
</div>
<div class="layui-row" style="margin-top:10px;margin-bottom: 10px;margin-left: 20px;">
<button class="layui-btn layui-btn-sm layui-btn load" id="getSupplierListButton" lay-submit=""
lay-filter="load">查询
</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn" lay-submit="" lay-filter="reset">重置
</button>
</div>
</form>
</div>
<div style="margin-left: 20px;margin-right: 20px">
<div class="layui-btn-group demoTable" style="margin-top: 15px">
</div>
<table class="layui-table" id="chainList" lay-filter="chainList"></table>
</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