Commit 063befa4 by 杨树贤

筛选部分改成多选

parent 01373727
......@@ -25,8 +25,8 @@ class SupplierFilter
if (!empty($map['supplier_id'])) {
$query->where('supplier_channel.supplier_id', $map['supplier_id']);
}
if (!empty($map['supplier_type'])) {
$query->where('supplier_channel.supplier_type', $map['supplier_type']);
if ((isset($map['supplier_type']) && $map['supplier_type'] === "0") || !empty($map['supplier_type'])) {
$query->whereIn('supplier_type', explode(',', $map['supplier_type']));
}
if (!empty($map['supplier_name'])) {
$query->where('supplier_name', 'like', "%{$map['supplier_name']}%");
......@@ -45,8 +45,11 @@ class SupplierFilter
$query->where('company_nature', $map['company_nature']);
}
if (!empty($map['stockup_type'])) {
$query->where('stockup_type', 'like', "%{$map['stockup_type']}%");
$regexStr = '(' . str_replace(',', '|', $map['stockup_type']) . ')';
// $query->where('stockup_type', 'like', "%{$map['stockup_type']}%");
$query->whereRaw("stockup_type REGEXP '${regexStr}'");
}
if (!empty($map['purchase_uid'])) {
$query->where('purchase_uid', $map['purchase_uid']);
}
......@@ -70,11 +73,9 @@ class SupplierFilter
if (!empty($map['is_type'])) {
$query->where('is_type', $map['is_type']);
}
if (!empty($map['level'])) {
$query->where('level', $map['level']);
if ((isset($map['level']) && $map['level'] === "0") || !empty($map['level'])) {
$query->whereIn('level', explode(',', $map['level']));
}
if (isset($map['is_type']) && $map['is_type'] === "0") {
$query->where('is_type', $map['is_type']);
}
......
......@@ -74,6 +74,30 @@ class SupplierController extends Controller
];
}
$this->data['statusData'] = $statusData;
$stockupTypeData = [];
foreach (config('fixed.StockupType') as $key=>$value) {
$stockupTypeData[] = [
'name' => $value,
'value' => $key,
];
}
$this->data['stockupTypeData'] = $stockupTypeData;
$levelData = [];
foreach (config('field.LevelMap') as $key=>$value) {
$levelData[] = [
'name' => $value,
'value' => $key,
];
}
$this->data['levelData'] = $levelData;
$supplierTypeData = [];
foreach (config('field.SupplierType') as $key=>$value) {
$supplierTypeData[] = [
'name' => $value,
'value' => $key,
];
}
$this->data['supplierTypeData'] = $supplierTypeData;
return $this->view('供应商列表');
}
......
......@@ -18,12 +18,11 @@ class MultiSelectorPresenter
$requiredHtml
$text</label>
<div class="layui-input-inline" style="margin-top: 0">
<div id="$elemId" class="layui-input-inline" value="$value" style="width: 155px;">
<div id="$elemId" class="layui-input-inline" value="$value" style="width: 158px;">
</div>
<input type="hidden" name="$name" id="$name" value="$value">
</div>
<script>
window.onload = function(){
layui.use(['xmSelect', 'element'], function () {
let xmSelect = layui.xmSelect;
//渲染多选
......@@ -57,10 +56,8 @@ class MultiSelectorPresenter
let values = $('#$elemId').attr('value');
selector.setValue(values.split(','));
});
}
</script>
EOF;
return $html;
}
}
\ No newline at end of file
......@@ -84,7 +84,7 @@ return [
//账期-周期结算
1 => '账期',
//账期-定期结算
2 => '货到付款',
2 => '验货付款',
// 4 => '定金'
],
......
......@@ -156,8 +156,8 @@
{!! $multiSelectorPresenter->render('status','供应商状态','',$statusData) !!}
</div>
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('stockup_type','合作类型','',config('fixed.StockupType')) !!}
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('stockup_type','合作类型','',$stockupTypeData) !!}
</div>
<div class="layui-inline">
@inject('transformableSelectPresenter','App\Presenters\Filter\TransformableSelectPresenter')
......@@ -170,17 +170,14 @@
{!! $multiTransformableSelectPresenter->render(['has_sku'=>'SKU上传','sku_tag'=>'SKU标准','sku_mode'=>'SKU模式','uploaded_sku' => '历史SKU合作','outside_contact_type' => 'SKU上传方式'],
['has_sku'=>[1=>'是',-1=>'否'],'sku_tag'=>config('field.SkuTag'),'sku_mode'=>config('field.SkuMode'),'outside_contact_type'=>config('field.OutsideContactType')]) !!}
</div>
{{-- @if(checkPerm('ViewFakeSupplier'))--}}
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('supplier_type','供应商类别','',config('field.SupplierType')) !!}
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('supplier_type','供应商类型','',$supplierTypeData) !!}
</div>
{{-- @endif--}}
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('level','等级','',config('field.LevelMap')) !!}
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('level','等级','',$levelData) !!}
</div>
<div class="layui-inline" style="width: 600px">
@inject('transformableTimeIntervalPresenter','App\Presenters\Filter\TransformableTimeIntervalPresenter')
{!! $transformableTimeIntervalPresenter->render(['update_time'=>'更新时间','create_time'=>'创建时间']) !!}
......
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