Commit 40b064d7 by 杨树贤

标签操作

parent f44c641c
...@@ -5,7 +5,7 @@ APP_URL=http://localhost ...@@ -5,7 +5,7 @@ APP_URL=http://localhost
WEB_NAME=供应商系统 WEB_NAME=供应商系统
//CMS MYSQL配置 #CMS MYSQL配置
DB_CONNECTION=mysql DB_CONNECTION=mysql
DB_HOST=192.168.1.252 DB_HOST=192.168.1.252
DB_PORT=3306 DB_PORT=3306
...@@ -13,56 +13,63 @@ DB_DATABASE=ichuntcms ...@@ -13,56 +13,63 @@ DB_DATABASE=ichuntcms
DB_USERNAME=ichuntcms DB_USERNAME=ichuntcms
DB_PASSWORD=ichuntcms#zsyM DB_PASSWORD=ichuntcms#zsyM
//联营供应商系统数据库 #联营供应商系统数据库
WEB_DB_HOST=192.168.1.252 WEB_DB_HOST=192.168.1.252
WEB_DB_PORT=3306 WEB_DB_PORT=3306
WEB_DB_DATABASE=liexin_ass WEB_DB_DATABASE=liexin_ass
WEB_DB_USERNAME=liexin_ass WEB_DB_USERNAME=liexin_ass
WEB_DB_PASSWORD=liexin_ass#zsyM WEB_DB_PASSWORD=liexin_ass#zsyM
//采购系统数据库 #采购系统数据库
WMS_DB_HOST=192.168.1.252 WMS_DB_HOST=192.168.1.252
WMS_DB_PORT=3306 WMS_DB_PORT=3306
WMS_DB_DATABASE=liexin_wms WMS_DB_DATABASE=liexin_wms
WMS_DB_USERNAME=liexin_wms WMS_DB_USERNAME=liexin_wms
WMS_DB_PASSWORD=liexin_wms#zsyM WMS_DB_PASSWORD=liexin_wms#zsyM
//主站3.0的数据库 #主站3.0的数据库
LIEXIN_DB_HOST=192.168.1.252 LIEXIN_DB_HOST=192.168.1.252
LIEXIN_DB_PORT=3306 LIEXIN_DB_PORT=3306
LIEXIN_DB_DATABASE=liexin LIEXIN_DB_DATABASE=liexin
LIEXIN_DB_USERNAME=liexin LIEXIN_DB_USERNAME=liexin
LIEXIN_DB_PASSWORD=liexin#zsyM LIEXIN_DB_PASSWORD=liexin#zsyM
//自营基石数据库 #自营基石数据库
DB_SELF_HOST=192.168.1.238 DB_SELF_HOST=192.168.1.238
DB_SELF_DATABASE=liexin_data DB_SELF_DATABASE=liexin_data
DB_SELF_USERNAME=spu DB_SELF_USERNAME=spu
DB_SELF_PASSWORD=spu DB_SELF_PASSWORD=spu
DB_SELF_PORT=3306 DB_SELF_PORT=3306
//云芯 MYSQL配置 #云芯 MYSQL配置
DB_HOST_YUNXIN=192.168.1.252 DB_HOST_YUNXIN=192.168.1.252
DB_DATABASE_YUNXIN=liexin_yunxin DB_DATABASE_YUNXIN=liexin_yunxin
DB_USERNAME_YUNXIN=liexin_yunxin DB_USERNAME_YUNXIN=liexin_yunxin
DB_PASSWORD_YUNXIN=liexin_yunxin#zsyM DB_PASSWORD_YUNXIN=liexin_yunxin#zsyM
DB_YUNXIN_PORT=3306 DB_YUNXIN_PORT=3306
//采购 MYSQL配置 #采购 MYSQL配置
DB_HOST_PURCHASE=192.168.1.238 DB_HOST_PURCHASE=192.168.1.238
DB_DATABASE_PURCHASE=liexin_purchase DB_DATABASE_PURCHASE=liexin_purchase
DB_USERNAME_PURCHASE=liexin_purchase DB_USERNAME_PURCHASE=liexin_purchase
DB_PASSWORD_PURCHASE=liexin_purchase#zsyM DB_PASSWORD_PURCHASE=liexin_purchase#zsyM
DB_PURCHASE_PORT=3306 DB_PURCHASE_PORT=3306
//联营sku数据库01 #标签 MYSQL配置
DB_HOST_TAG=192.168.1.252
DB_DATABASE_TAG=liexin_tags
DB_USERNAME_TAG=liexin_tags
DB_PASSWORD_TAG=liexin_tags#zsyM
DB_TAG_PORT=3306
#联营sku数据库01
DB_SKU_HOST=192.168.1.238 DB_SKU_HOST=192.168.1.238
DB_SKU_DATABASE=liexin_sku_1 DB_SKU_DATABASE=liexin_sku_1
DB_SKU_USERNAME=spu DB_SKU_USERNAME=spu
DB_SKU_PASSWORD=spu DB_SKU_PASSWORD=spu
DB_SKU_PORT=3306 DB_SKU_PORT=3306
//联营SPU数据库 #联营SPU数据库
DB_SPU_HOST=192.168.1.238 DB_SPU_HOST=192.168.1.238
DB_SPU_DATABASE=liexin_spu DB_SPU_DATABASE=liexin_spu
DB_SPU_USERNAME=spu DB_SPU_USERNAME=spu
......
...@@ -173,4 +173,11 @@ class SkuApiController extends Controller ...@@ -173,4 +173,11 @@ class SkuApiController extends Controller
} }
$this->response(-1, '请求同步失败,请联系管理员'); $this->response(-1, '请求同步失败,请联系管理员');
} }
//批量新增标签
public function BatchAddSkuTag($request)
{
$skuIds = $request->get('sku_ids');
$this->response(0, '批量新增标签成功');
}
} }
...@@ -5,11 +5,14 @@ namespace App\Http\Controllers; ...@@ -5,11 +5,14 @@ namespace App\Http\Controllers;
use App\Http\Controllers\Filter\LogFilter; use App\Http\Controllers\Filter\LogFilter;
use App\Http\Controllers\Filter\SupplierLogFilter; use App\Http\Controllers\Filter\SupplierLogFilter;
use App\Http\Services\LogService; use App\Http\Services\LogService;
use App\Http\Services\SupplierTagService;
use App\Model\BrandModel; use App\Model\BrandModel;
use App\Model\IntracodeModel; use App\Model\IntracodeModel;
use App\Model\LogModel; use App\Model\LogModel;
use App\Model\SupplierChannelModel; use App\Model\SupplierChannelModel;
use App\Model\SupplierLogModel; use App\Model\SupplierLogModel;
use App\Model\TagsModel;
use GuzzleHttp\Client;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use DB; use DB;
...@@ -41,6 +44,9 @@ class SkuController extends Controller ...@@ -41,6 +44,9 @@ class SkuController extends Controller
public function SkuList($request) public function SkuList($request)
{ {
$skuTags = TagsModel::where('tag_use', 16)->where('tag_type', 2)->pluck('tag_name', 'tag_name')->toArray();
$this->data['skuTags'] = $skuTags;
//获取筛选框的品牌数据 //获取筛选框的品牌数据
$brandSelectValue = []; $brandSelectValue = [];
$selectBrandIds = $request->get('brand_id/condition'); $selectBrandIds = $request->get('brand_id/condition');
...@@ -93,4 +99,12 @@ class SkuController extends Controller ...@@ -93,4 +99,12 @@ class SkuController extends Controller
{ {
return $this->view('批量上架'); return $this->view('批量上架');
} }
//批量打标签
public function BatchAddSkuTag($request)
{
$this->data['title'] = '批量修改Sku标签';
return $this->view('批量修改Sku标签');
}
} }
...@@ -41,7 +41,7 @@ class SupplierTagController extends Controller ...@@ -41,7 +41,7 @@ class SupplierTagController extends Controller
} }
//供应商详情 //供应商标签
public function BatchAddTag($request) public function BatchAddTag($request)
{ {
$suppliers = (new SupplierChannelModel())->where('is_type', 0) $suppliers = (new SupplierChannelModel())->where('is_type', 0)
......
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
class TagsModel extends Model
{
protected $connection = 'tag';
protected $table='tags';
protected $primaryKey = 'id';
public $timestamps = false;
}
...@@ -211,6 +211,19 @@ return [ ...@@ -211,6 +211,19 @@ return [
'strict' => false, 'strict' => false,
], ],
'tag' => [
'driver' => 'mysql',
'host' => env('DB_HOST_TAG', ''),
'database' => env('DB_DATABASE_TAG', ''),
'username' => env('DB_USERNAME_TAG', ''),
'password' => env('DB_PASSWORD_TAG', ''),
'port' => env('DB_TAG_PORT', 3306),
'charset' => 'utf8',
'collation' => 'utf8_general_ci',
'prefix' => 'lie_',
'strict' => false,
],
'rabbitmq' => [ 'rabbitmq' => [
'driver' => 'rabbitmq', 'driver' => 'rabbitmq',
'host' => env('RABBITMQ_HOST', '127.0.0.1'), 'host' => env('RABBITMQ_HOST', '127.0.0.1'),
......
<script>
layui.use(['table', 'form', 'element', 'table', 'xmSelect', 'tagsInput', 'layer', 'admin'], function () {
let admin = layui.admin;
let form = layui.form;
let table = layui.table
let element = layui.element;
let xmSelect = layui.xmSelect;
let tagsInput = layui.tagsInput;
form.on('submit(auditSupplier)', function (data) {
admin.showLoading({
type: 3
});
let supplierIds = getQueryVariable('supplier_ids');
let url = '/api/supplier_tag/BatchAddTag?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();
});
function getTagOption(element) {
//获取系统标签列表
let url = '/api/supplier_tag/GetSystemTagList';
let tagResult = ajax(url);
let tagList = tagResult.data;
return {
el: '#' + element,
filterable: true,
paging: true,
height: '250px',
size: 'small',
direction: 'auto',
autoRow: true,
prop: {
name: 'tag_name',
value: 'tag_id',
},
pageSize: 30,
data: tagList,
on: function (tagList) {
let arr = tagList.arr;
let tagIds = '';
for (let i in arr) {
tagIds += arr[i].tag_id + ',';
}
let idName = 'system_tags';
$('#' + idName).val(tagIds);
},
};
}
let systemTagOption = getTagOption('system_tags_selector', 2);
let tagSelector = xmSelect.render(systemTagOption);
//自定义标签
$('#customer_tags').tagsInput({});
//点击添加选择的供应商到待修改列表
$(document).on('click', '#addSupplierToList', function () {
let supplierCode = $('#supplier_selector').val();
if (!supplierCode) {
layer.msg('请先选择需要操作的供应商', {icon: 5});
return;
}
let suppliers = {!! json_encode($suppliers) !!};
let supplier = suppliers[supplierCode];
let selectedSupplierIds = $('#supplier_ids').val();
selectedSupplierIds = selectedSupplierIds ? selectedSupplierIds.split(',') : [];
if (jQuery.inArray(supplier['supplier_id'].toString(), selectedSupplierIds) === 0) {
layer.msg('列表已经有该供应商,请重新选择', {icon: 6});
return;
}
let appendHtml = `
<tr>
<td>${supplier['supplier_name']}</td>
<td>${supplier['system_tags']}</td>
<td>${supplier['customer_tags']}</td>
<td><button type="button" class="layui-btn layui-btn-xs deleteSupplier" value="${supplier['supplier_id']}">删除</button> </td>
</tr>
`;
selectedSupplierIds.push(supplier['supplier_id']);
$('#supplier_ids').val(selectedSupplierIds.join(','));
$('#operateSupplierList').append(appendHtml);
//清空
$('#supplier_selector').val('');
form.render();
});
$(document).on('click', '.deleteSupplier', function () {
let selectedSupplierIds = $('#supplier_ids').val();
let deleteSupplierId = $(this).attr('value');
selectedSupplierIds = selectedSupplierIds ? selectedSupplierIds.split(',') : [];
selectedSupplierIds.splice(jQuery.inArray(deleteSupplierId, selectedSupplierIds), 1);
$('#supplier_ids').val(selectedSupplierIds.join(','));
$(this).parents('tr').remove();
});
});
</script>
\ No newline at end of file
...@@ -386,5 +386,18 @@ ...@@ -386,5 +386,18 @@
location.reload(); location.reload();
}); });
$("#set_sku_tag").click(function () {
layer.open({
type: 2,
content: '/sku/BatchSetSkuTag?view=iframe',
area: ['800px', '600px'],
title: '批量设置SKU标签',
end: function () {
table.reload('skuList');
// supplierStatistics();
}
});
});
}); });
</script> </script>
\ No newline at end of file
<style>
.layui-form-item {
margin-bottom: 5px;
}
</style>
<form class="layui-form" action="">
<div class="layui-card">
<div class="layui-card-header" style="height: 230px">
<blockquote class="layui-elem-quote layui-text">
<b>标签新增</b>
</blockquote>
<input type="hidden" name="supplier_ids" id="supplier_ids">
<div class="layui-form-item">
<div class="layui-input-block" style="margin-left: -30px">
<div class="layui-form-item">
<label class="layui-form-label">
系统标签 : </label>
<div class="layui-input-block" style="margin-top: 15px">
<div id="system_tags_selector" class="layui-input-inline" style="width: 100%;">
</div>
<input type="hidden" name="system_tags"
id="system_tags">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">
自定义标签 : </label>
<div class="layui-input-block" style="margin-top: 15px">
<input name="customer_tags" id="customer_tags">
</div>
</div>
</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>
</div>
<div class="layui-card-body">
<blockquote class="layui-elem-quote layui-text">
<b>选择需要新增标签的供应商</b>
</blockquote>
<div class="layui-row" style="margin-bottom: 12px">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('supplier_selector','供应商选择 : ',null,
$supplierCodes,['width'=> '500px']) !!}
<button type="button" class="layui-btn-sm layui-btn" style="margin-top: 5px;margin-left: 5px;" id="addSupplierToList">确认添加到操作列表</button>
</div>
<table class="layui-table">
<colgroup>
<col width="300">
<col width="400">
<col width="400">
<col width="200">
</colgroup>
<thead>
<tr>
<th>供应商名称</th>
<th>系统标签</th>
<th>自定义标签</th>
<th>操作</th>
</tr>
</thead>
<tbody id="operateSupplierList">
</tbody>
</table>
</div>
</div>
</form>
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<button type="button" class="layui-btn layui-btn-sm" id="set_prefer">设置精选</button> <button type="button" class="layui-btn layui-btn-sm" id="set_prefer">设置精选</button>
<button type="button" class="layui-btn layui-btn-sm" id="cancel_set_prefer">取消精选</button> <button type="button" class="layui-btn layui-btn-sm" id="cancel_set_prefer">取消精选</button>
<button type="button" class="layui-btn layui-btn-sm" id="sync_erp_rate">同步ERP汇率</button> <button type="button" class="layui-btn layui-btn-sm" id="sync_erp_rate">同步ERP汇率</button>
<button type="button" class="layui-btn layui-btn-sm" id="set_sku_tag">设置标签</button>
</div> </div>
<table class="layui-table" id="skuList" lay-filter="skuList"></table> <table class="layui-table" id="skuList" lay-filter="skuList"></table>
......
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
@inject('statusPresenter','App\Presenters\StatusPresenter') @inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('tags/condition','是否精选',request()->get('tags/condition'),[1=>'是',0=>'否']) !!} {!! $statusPresenter->render('tags/condition','是否精选',request()->get('tags/condition'),[1=>'是',0=>'否']) !!}
</div> </div>
{{-- <div class="layui-inline">--}} {{-- <div class="layui-inline">--}}
{{-- @inject('statusPresenter','App\Presenters\StatusPresenter')--}} {{-- @inject('statusPresenter','App\Presenters\StatusPresenter')--}}
{{-- {!! $statusPresenter->render('status/condition','是否过期',request()->get('status/condition'),[0=>'是',1=>'否']) !!}--}} {{-- {!! $statusPresenter->render('status/condition','是否过期',request()->get('status/condition'),[0=>'是',1=>'否']) !!}--}}
...@@ -118,7 +119,10 @@ ...@@ -118,7 +119,10 @@
{!! $statusPresenter->render('encoded/condition','上传人',request()->get('encoded/condition'), {!! $statusPresenter->render('encoded/condition','上传人',request()->get('encoded/condition'),
$userCodes) !!} $userCodes) !!}
</div> </div>
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('tags/condition','标签',null,$skuTags) !!}
</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