Commit 25191251 by 杨树贤

temp

parent 95e84e9d
......@@ -656,4 +656,21 @@ class SupplierApiController extends Controller
$this->response(0, '申请审核成功');
}
//批量新增标签
public function BatchAddTags($request)
{
$supplierIds = $request->get('supplier_ids');
$systemTags = $request->get('system_tags');
$customTags = $request->get('custom_tags');
$supplierIds = $supplierIds ? explode(',', $supplierIds) : [];
$systemTags = $systemTags ? explode(',', $systemTags) : [];
$customTags = $customTags ? explode(',', $customTags) : [];
$supplierService = new SupplierService();
if (empty($systemTags) && empty($customTags)) {
$this->response(-1, '请设置标签');
}
$supplierService->batchAddTags($supplierIds, $systemTags, $customTags);
$this->response(0, '批量新增标签成功');
}
}
......@@ -4,6 +4,7 @@
namespace App\Http\Services;
//后台用户相关信息服务
use App\Model\SupplierChannelModel;
use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;
use Illuminate\Support\Facades\DB;
......@@ -119,4 +120,15 @@ class SupplierTagService
Log::error('保存标签失败,' . json_encode($data));
}
}
//批量新增标签
public function batchAddTags($supplierIds, $addSysTags, $addCusTags)
{
$suppliers = SupplierChannelModel::whereIn('supplier_id', $supplierIds)->get()->toArray();
foreach ($suppliers as $supplier) {
$systemTags = $supplier['system_tags'] ? explode(',', $supplier['system_tags']) : [];
$customTags = $supplier['custom_tags'] ? explode(',', $supplier['custom_tags']) : [];
}
}
}
\ No newline at end of file
<script>
layui.use(['table', 'form', 'element', 'table', 'layer', 'admin'], function () {
let admin = layui.admin;
let form = layui.form;
let table = layui.table
let element = layui.element;
form.on('submit(auditSupplier)', function (data) {
admin.showLoading({
type: 3
});
let supplierIds = getQueryVariable('supplier_ids');
let url = '/api/supplier/BatchAllocatePurchaseUser?supplier_ids=' + supplierIds;
$.ajax({
url: url,
type: 'GET',
async: true,
data: data.field,
dataType: 'json',
timeout: 20000,
success: function (res) {
admin.removeLoading();
if (res.err_code === 0) {
admin.closeThisDialog();
parent.layer.msg(res.err_msg, {icon: 6});
} else {
parent.layer.msg(res.err_msg, {icon: 5});
}
},
error: function () {
admin.removeLoading();
parent.layer.msg('网络错误', {icon: 5});
}
});
return false;
});
form.on('submit(cancel)', function (data) {
admin.closeThisDialog();
});
});
</script>
\ No newline at end of file
<style>
.layui-form-item {
margin-bottom: 5px;
}
</style>
<div class="layui-card">
<div class="layui-card-header" style="height: 170px">
<blockquote class="layui-elem-quote layui-text">
<b>渠道开发员设置</b>
</blockquote>
<form class="layui-form" action="">
<input type="hidden" name="supplier_ids" value="{{$supplierIds}}">
<div class="layui-form-item">
<div class="layui-inline" style="margin-left: -30px">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('purchase_uid','渠道开发员',null,
$userCodes,['required'=>true,'width'=>'150px']) !!}
</div>
</div>
<div class="layui-form-item">
<div align="center" style="margin-top: 10px;text-align: right">
<button type="button" class="layui-btn layui-btn-sm layui-btn-info submit-loading" lay-submit
lay-filter="auditSupplier">确认
</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" lay-submit
lay-filter="cancel">取消
</button>
</div>
</div>
</form>
</div>
<div class="layui-card-body">
<blockquote class="layui-elem-quote layui-text">
<b>当前选中需要批量修改渠道员的供应商列表</b>
</blockquote>
<table class="layui-table">
<colgroup>
<col width="300">
<col width="100">
<col>
</colgroup>
<thead>
<tr>
<th>供应商名称</th>
<th>当前渠道开发员</th>
</tr>
</thead>
<tbody>
@foreach($suppliers as $supplier)
<tr>
<td>{{$supplier['supplier_name']}}</td>
<td>{{$supplier['purchase_username']}}</td>
</tr>
@endforeach
</tbody>
</table>
</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