Commit 063befa4 by 杨树贤

筛选部分改成多选

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