Commit 9898f02a by 杨树贤

完善禁用逻辑

parent 3f40a276
...@@ -174,7 +174,6 @@ class SupplierApiController extends Controller ...@@ -174,7 +174,6 @@ class SupplierApiController extends Controller
} }
$channelMap = array_merge($this->channelMap, config('field.AttachmentFields')); $channelMap = array_merge($this->channelMap, config('field.AttachmentFields'));
$channel = $request->only($channelMap); $channel = $request->only($channelMap);
dd($channel);
$service = new SupplierService(); $service = new SupplierService();
$result = $service->saveSupplier($channel); $result = $service->saveSupplier($channel);
if (!$result) { if (!$result) {
......
...@@ -15,17 +15,19 @@ class CompanyService ...@@ -15,17 +15,19 @@ class CompanyService
public function getCompanyInfo($supplierName, $taxNumber, $regionType = 1) public function getCompanyInfo($supplierName, $taxNumber, $regionType = 1)
{ {
$params = [ $params = [
'keyword' => $supplierName ?: $taxNumber, 'company_name' => $supplierName,
'region' => $regionType, 'region' => $regionType,
'select_type' => 1, 'company_type' => 1,
'company_tax_no' => $taxNumber,
]; ];
$url = config('website.InternalApiDomain') . '/companyInfo'; $url = config('website.UnitedDataDomain') . '/sync/Company/getCompanyInfoByName';
$result = curl($url, $params, true); $result = curl($url, $params);
$result = json_decode($result, true); $result = json_decode($result, true);
$company = []; $company = [];
if (array_get($result, 'code') === 0) { if (array_get($result, 'code') === 0) {
$companyInfo = array_get(array_get($result['data'], 'company_info_list'), 0); $companyInfoList = array_get(array_get($result['data'], 'tycList'), 'company_info_list');
if (!empty($companyInfo)) { if (!empty($companyInfoList)) {
$companyInfo = $companyInfoList[0];
$company = [ $company = [
'supplier_name' => $companyInfo['com_name'], 'supplier_name' => $companyInfo['com_name'],
'registered_capital' => (int)$companyInfo['registered_capital'], 'registered_capital' => (int)$companyInfo['registered_capital'],
......
...@@ -247,13 +247,16 @@ class SupplierService ...@@ -247,13 +247,16 @@ class SupplierService
$oldSystemTags); $oldSystemTags);
$tagService->saveTags($supplierId, SupplierTagService::TAG_TYPE_CUSTOMER, $channel['customer_tags'], $tagService->saveTags($supplierId, SupplierTagService::TAG_TYPE_CUSTOMER, $channel['customer_tags'],
$oldCustomerTags); $oldCustomerTags);
return $supplierId;
} }
//重新生成外部显示的编码 //重新生成外部显示的编码
$this->generateSupplierSn($supplierId, $channel['supplier_group']); $this->generateSupplierSn($supplierId, $channel['supplier_group']);
//保存和搜索相关的标签情况 //保存和搜索相关的标签情况
$supplierSearchTagService = new SupplierSearchTagService(); $supplierSearchTagService = new SupplierSearchTagService();
$supplierSearchTagService->saveSupplierSearchTags($supplierId); $supplierSearchTagService->saveSupplierSearchTags($supplierId);
return $supplierId;
}); });
//保存日志 //保存日志
......
...@@ -17,7 +17,6 @@ class SupplierValidator ...@@ -17,7 +17,6 @@ class SupplierValidator
//因为控制器那边已经被之前的人魔改的难用的一比,而且控制器那边还接收了一大堆统一变量 //因为控制器那边已经被之前的人魔改的难用的一比,而且控制器那边还接收了一大堆统一变量
public function checkSave($validateData, $isAudit) public function checkSave($validateData, $isAudit)
{ {
dd($validateData['tax_number']);
//整理下请求数据 //整理下请求数据
$validateData = $this->transformRequestData($validateData); $validateData = $this->transformRequestData($validateData);
//这个supplierId是用来判断是新增还是修改的 //这个supplierId是用来判断是新增还是修改的
......
...@@ -22,6 +22,7 @@ return [ ...@@ -22,6 +22,7 @@ return [
'UploadKey' => 'fh6y5t4rr351d2c3bryi', 'UploadKey' => 'fh6y5t4rr351d2c3bryi',
'QueueDomain' => 'http://192.168.1.252:16590/mq/push', 'QueueDomain' => 'http://192.168.1.252:16590/mq/push',
'InternalApiDomain' => 'http://192.168.1.252:8200', 'InternalApiDomain' => 'http://192.168.1.252:8200',
'UnitedDataDomain' => 'http://united_data.liexindev.net',
'WarningRobot' => 'https://oapi.dingtalk.com/robot/send?access_token=7ff88e1ee208e3a637c17bc51c1c879bccbf101fef5885d22ad70d21ea2f966a', 'WarningRobot' => 'https://oapi.dingtalk.com/robot/send?access_token=7ff88e1ee208e3a637c17bc51c1c879bccbf101fef5885d22ad70d21ea2f966a',
'CSWarningRobot' => 'https://oapi.dingtalk.com/robot/send?access_token=92917a6e090a8a39832c4843a579d6c6f9dfecc46fa275f8753ddee2b4399045', 'CSWarningRobot' => 'https://oapi.dingtalk.com/robot/send?access_token=92917a6e090a8a39832c4843a579d6c6f9dfecc46fa275f8753ddee2b4399045',
......
...@@ -86,43 +86,53 @@ function inArray(needle, haystack) { ...@@ -86,43 +86,53 @@ function inArray(needle, haystack) {
return false; return false;
} }
function attachmentsUploadedChangeSupplierType(supplierType, supplierGroup, fieldName) { function attachmentsUploadedChangeSupplierType(supplierType, supplierGroup, fieldNameList) {
if (fieldNameList.length === 0) {
return true;
}
let msg = ''; let msg = '';
let radioObj = $('input[name="supplier_type"]'); let radioObj = $('input[name="supplier_type"]');
//已经上传品质保证协议(代理商则提示为“已经上传代理证”),是否切换为正式供应商? //已经上传品质保证协议(代理商则提示为“已经上传代理证”),是否切换为正式供应商?
if (supplierType === '2') { if (supplierType === '2') {
//如果已经上传品质保证协议,并且供应商性质不是代理商(代理商要代理证) //如果已经上传品质保证协议,并且供应商性质不是代理商(代理商要代理证)
if ('quality_assurance_agreement' === fieldName && supplierGroup !== '1') { if (inArray('quality_assurance_agreement', fieldNameList) && supplierGroup !== '1') {
msg = '已经上传品质保证协议,是否切换为正式供应商?' msg = '已经上传品质保证协议,是否切换为正式供应商?'
layer.confirm(msg, function (index) { layer.confirm(msg, function (index) {
radioObj.get(0).checked = true; radioObj.get(0).checked = true;
radioObj.get(1).checked = false; radioObj.get(1).checked = false;
layui.form.render('radio');
layer.closeAll();
}); });
} }
if ('proxy_certificate' === fieldName && supplierGroup === '1') { if (inArray('proxy_certificate', fieldNameList) && supplierGroup === '1') {
msg = '该供应商为代理供应商,已经上传代理证,是否切换为正式供应商?' msg = '该供应商为代理供应商,已经上传代理证,是否切换为正式供应商?'
layer.confirm(msg, function (index) { layer.confirm(msg, function (index) {
radioObj.get(0).checked = true; radioObj.get(0).checked = true;
radioObj.get(1).checked = false; radioObj.get(1).checked = false;
layui.form.render('radio');
layer.closeAll();
}); });
} }
} else { } else {
if ('quality_assurance_agreement' === fieldName && supplierGroup !== '1') { if (!inArray('quality_assurance_agreement', fieldNameList) && supplierGroup !== '1') {
msg = '未上传品质保证协议,是否切换为临时供应商?' msg = '未上传品质保证协议,是否切换为临时供应商?'
layer.confirm(msg, function (index) { layer.confirm(msg, function (index) {
radioObj.get(0).checked = false; radioObj.get(0).checked = false;
radioObj.get(1).checked = true; radioObj.get(1).checked = true;
layui.form.render('radio');
layer.closeAll();
}); });
} }
if ('proxy_certificate' === fieldName && supplierGroup === '1') { if (!inArray('proxy_certificate', fieldNameList) && supplierGroup === '1') {
msg = '该供应商为代理供应商,但是未上传代理证,是否切换为临时供应商?' msg = '该供应商为代理供应商,但是未上传代理证,是否切换为临时供应商?'
layer.confirm(msg, function (index) { layer.confirm(msg, function (index) {
radioObj.get(0).checked = false; radioObj.get(0).checked = false;
radioObj.get(1).checked = true; radioObj.get(1).checked = true;
layui.form.render('radio');
layer.closeAll();
}); });
} }
} }
layui.form.render('radio');
return msg; return true;
} }
...@@ -55,10 +55,6 @@ function getQueryVariable(variable) { ...@@ -55,10 +55,6 @@ function getQueryVariable(variable) {
} }
function ajax(url,data){ function ajax(url,data){
layer.msg('加载中', {
icon: 16
,shade: 0.01
});
var result=false; var result=false;
$.ajax({ $.ajax({
url:url, url:url,
...@@ -73,6 +69,5 @@ function ajax(url,data){ ...@@ -73,6 +69,5 @@ function ajax(url,data){
} }
} }
}) })
layer.closeAll();
return result; return result;
} }
\ No newline at end of file
...@@ -107,6 +107,7 @@ ...@@ -107,6 +107,7 @@
}); });
form.on('submit(addAndApplySupplier)', function (data) { form.on('submit(addAndApplySupplier)', function (data) {
//去找出附件的所有数据 //去找出附件的所有数据
let file_name = []; let file_name = [];
let file_url = []; let file_url = [];
...@@ -130,6 +131,58 @@ ...@@ -130,6 +131,58 @@
data.field.validity_period = validity_period; data.field.validity_period = validity_period;
data.field.apply_audit_reason = $('#apply_audit_reason').val(); data.field.apply_audit_reason = $('#apply_audit_reason').val();
let fieldNameList = field_name;
//提交先提示是否要转换供应商类型
let radioObj = $('input[name="supplier_type"]');
//已经上传品质保证协议(代理商则提示为“已经上传代理证”),是否切换为正式供应商?
let supplierGroup = data.field.supplier_group;
let msg;
let obj1Checked = 0;
let obj2Checked = 0;
if (data.field.supplier_type === '2') {
//如果已经上传品质保证协议,并且供应商性质不是代理商(代理商要代理证)
if (inArray('quality_assurance_agreement', fieldNameList) && supplierGroup !== '1') {
msg = '已经上传品质保证协议,是否切换为正式供应商?'
obj1Checked = true;
obj2Checked = false;
}
if (inArray('proxy_certificate', fieldNameList) && supplierGroup === '1') {
msg = '该供应商为代理供应商,已经上传代理证,是否切换为正式供应商?'
obj1Checked = true;
obj2Checked = false;
}
} else {
if (!inArray('quality_assurance_agreement', fieldNameList) && supplierGroup !== '1') {
msg = '未上传品质保证协议,是否切换为临时供应商?'
obj1Checked = false;
obj2Checked = true;
}
if (!inArray('proxy_certificate', fieldNameList) && supplierGroup === '1') {
msg = '该供应商为代理供应商,但是未上传代理证,是否切换为临时供应商?'
obj1Checked = false;
obj2Checked = true;
}
}
if (msg) {
layer.confirm(msg, function (index) {
if (obj1Checked !== 0) {
radioObj.get(0).checked = obj1Checked;
radioObj.get(1).checked = obj2Checked;
layui.form.render('radio');
data.field.supplier_type = obj1Checked ? 1 : 2;
layer.closeAll();
}
auditAndAddSupplier(data);
});
} else {
auditAndAddSupplier(data);
}
return false;
});
function auditAndAddSupplier(data) {
if (data.field.supplier_type === '2') { if (data.field.supplier_type === '2') {
layer.open({ layer.open({
type: 1, type: 1,
...@@ -152,9 +205,7 @@ ...@@ -152,9 +205,7 @@
addSupplier(data); addSupplier(data);
}); });
} }
}
return false;
});
function addSupplier(data) { function addSupplier(data) {
admin.showLoading({ admin.showLoading({
...@@ -163,6 +214,7 @@ ...@@ -163,6 +214,7 @@
let url = '/api/supplier/AddSupplier?direct_apply=1'; let url = '/api/supplier/AddSupplier?direct_apply=1';
let res = ajax(url, data.field); let res = ajax(url, data.field);
if (!res) { if (!res) {
admin.removeLoading();
layer.msg('网络错误,请重试', {icon: 6}); layer.msg('网络错误,请重试', {icon: 6});
} else { } else {
if (res.err_code === 0) { if (res.err_code === 0) {
......
<script> <script>
layui.use(['table', 'form', 'element', 'layer', 'admin', 'index', 'laydate', 'xmSelect'], function () { layui.use(['table', 'form', 'element', 'layer', 'admin', 'index', 'laydate', 'xmSelect'], function () {
let admin = layui.admin; let admin = layui.admin;
let index = layui.index;
let form = layui.form; let form = layui.form;
let table = layui.table; let table = layui.table;
let element = layui.element;
$('#supplierDetailUrl').click(function () { $('#supplierDetailUrl').click(function () {
admin.showLoading({ admin.showLoading({
...@@ -37,6 +35,61 @@ ...@@ -37,6 +35,61 @@
}); });
form.on('submit(applyAuditSupplier)', function (data) { form.on('submit(applyAuditSupplier)', function (data) {
let fieldNameList = [];
$('.attachment_fields').each(function () {
fieldNameList.push($(this).text());
});
//提交先提示是否要转换供应商类型
let radioObj = $('input[name="supplier_type"]');
//已经上传品质保证协议(代理商则提示为“已经上传代理证”),是否切换为正式供应商?
let supplierGroup = data.field.supplier_group;
let msg;
let obj1Checked = 0;
let obj2Checked = 0;
if (data.field.supplier_type === '2') {
//如果已经上传品质保证协议,并且供应商性质不是代理商(代理商要代理证)
if (inArray('quality_assurance_agreement', fieldNameList) && supplierGroup !== '1') {
msg = '已经上传品质保证协议,是否切换为正式供应商?'
obj1Checked = true;
obj2Checked = false;
}
if (inArray('proxy_certificate', fieldNameList) && supplierGroup === '1') {
msg = '该供应商为代理供应商,已经上传代理证,是否切换为正式供应商?'
obj1Checked = true;
obj2Checked = false;
}
} else {
if (!inArray('quality_assurance_agreement', fieldNameList) && supplierGroup !== '1') {
msg = '未上传品质保证协议,是否切换为临时供应商?'
obj1Checked = false;
obj2Checked = true;
}
if (!inArray('proxy_certificate', fieldNameList) && supplierGroup === '1') {
msg = '该供应商为代理供应商,但是未上传代理证,是否切换为临时供应商?'
obj1Checked = false;
obj2Checked = true;
}
}
if (msg) {
layer.confirm(msg, function (index) {
if (obj1Checked !== 0) {
radioObj.get(0).checked = obj1Checked;
radioObj.get(1).checked = obj2Checked;
layui.form.render('radio');
data.field.supplier_type = obj1Checked ? "1" : "2";
layer.closeAll();
}
auditAndUpdateSupplier(data);
});
} else {
auditAndUpdateSupplier(data);
}
return false;
});
function auditAndUpdateSupplier(data) {
data.field.is_audit = 1; data.field.is_audit = 1;
if (data.field.supplier_type === '2') { if (data.field.supplier_type === '2') {
layer.open({ layer.open({
...@@ -62,12 +115,10 @@ ...@@ -62,12 +115,10 @@
updateSupplier(data); updateSupplier(data);
}); });
} }
}); }
function updateSupplier(data) { function updateSupplier(data) {
admin.showLoading({ admin.showLoading('.layui-layer-btn0');
type: 3,
});
let res = ajax('/api/supplier/UpdateSupplier', data.field); let res = ajax('/api/supplier/UpdateSupplier', data.field);
if (res.err_code === 0) { if (res.err_code === 0) {
admin.putTempData("needFreshList", 1) admin.putTempData("needFreshList", 1)
...@@ -76,13 +127,14 @@ ...@@ -76,13 +127,14 @@
layer.msg(res.err_msg, {icon: 6}) layer.msg(res.err_msg, {icon: 6})
} else { } else {
let errMsg = res.err_msg; let errMsg = res.err_msg;
console.log(res);
let msg = ''; let msg = '';
$.each(errMsg.split('|'), function (index, value) { $.each(errMsg.split('|'), function (index, value) {
msg += "<span>" + value + "</span><br>" msg += "<span>" + value + "</span><br>"
}); });
layer.msg(msg, {icon: 5}) layer.msg(msg, {icon: 5})
} }
admin.removeLoading(); admin.removeLoading('.layui-layer-btn0');
} }
}); });
</script> </script>
\ No newline at end of file
...@@ -33,11 +33,11 @@ ...@@ -33,11 +33,11 @@
field: 'file_name', field: 'file_name',
title: '<span class="require">* </span>附件名称', align: 'center', width: 270, title: '<span class="require">* </span>附件名称', align: 'center', width: 270,
templet: function (data) { templet: function (data) {
return "<a style='color: blue' href='" + data.file_url + "' target='_blank'>" + data.file_name + "</a>"; return "<a style='color: blue' href='" + data.file_url + "' target='_blank'>" + data.file_name + "<div style='display:none' class='attachment_fields'>" + data.field_name + "</div></a>";
} }
}, },
{field: 'description', title: '附件说明', align: 'center', width: 250}, {field: 'description', title: '附件说明', align: 'center', width: 250},
{field: 'validity_period', title: '<span class="require">* </span>有效期', align: 'center', width: 250}, {field: 'validity_period', title: '<span class="require">* </span>有效期', align: 'center', width: 220},
{field: 'create_name', title: '上传人', align: 'center', width: 100}, {field: 'create_name', title: '上传人', align: 'center', width: 100},
{field: 'create_time', title: '上传时间', align: 'center', width: 150}, {field: 'create_time', title: '上传时间', align: 'center', width: 150},
]], ]],
......
...@@ -97,9 +97,7 @@ ...@@ -97,9 +97,7 @@
}); });
}); });
delete this.files[index]; delete this.files[index];
let supplierType = $('input[name="supplier_type"]:checked').val();
layer.close(loadIndex); layer.close(loadIndex);
attachmentsUploadedChangeSupplierType(supplierType, $('#supplier_group').val(), fieldName)
}, },
}); });
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<blockquote class="layui-elem-quote layui-text"> <blockquote class="layui-elem-quote layui-text">
<b>基本信息</b> <b>基本信息</b>
</blockquote> </blockquote>
<form class="layui-form" action=""> <form class="layui-form" action="" lay-filter="supplier_form">
<input type="hidden" name="apply_audit_reason" id="apply_audit_reason"> <input type="hidden" name="apply_audit_reason" id="apply_audit_reason">
...@@ -61,14 +61,14 @@ ...@@ -61,14 +61,14 @@
<label class="layui-form-label"><span class="require">*</span>供应商名称 : </label> <label class="layui-form-label"><span class="require">*</span>供应商名称 : </label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="supplier_name" id="supplier_name" <input type="text" name="supplier_name" id="supplier_name"
placeholder="请输入供应商名称,选择所在区域才允许输入" class="layui-input layui-disabled" value="" disabled> placeholder="选择所在区域才允许输入供应商名称" class="layui-input layui-disabled" value="" disabled>
</div> </div>
</div> </div>
<div class="layui-col-md5"> <div class="layui-col-md5">
<div class="layui-block" id="tax_number_div"> <div class="layui-block" id="tax_number_div">
<label class="layui-form-label"><span class="require">*</span>公司税号</label> <label class="layui-form-label"><span class="require">*</span>公司税号</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="tax_number" id="tax_number" placeholder="请输入公司税号,选择所在区域才允许输入" <input type="text" name="tax_number" id="tax_number" placeholder="选择所在区域才允许输入公司税号"
class="layui-input layui-disabled" disabled value=""> class="layui-input layui-disabled" disabled value="">
</div> </div>
</div> </div>
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
} }
</style> </style>
<div class="layui-card"> <div class="layui-card">
<form class="layui-form" action=""> <form class="layui-form" action="" lay-filter="supplier_form">
<div class="layui-card-header fix-top"> <div class="layui-card-header fix-top">
<div class="layui-row"> <div class="layui-row">
<div class="layui-col-md2"> <div class="layui-col-md2">
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<b>基本信息</b> <b>基本信息</b>
</blockquote> </blockquote>
@if($operate=='add') @if($operate=='add')
<form class="layui-form" action=""> <form class="layui-form" action="" lay-filter="supplier_form">
@endif @endif
<?php <?php
$supplierType = config('field.SupplierType'); $supplierType = config('field.SupplierType');
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
layui-disabled layui-disabled
@endif" @endif"
value="{{$supplier['supplier_name'] or ''}}" value="{{$supplier['supplier_name'] or ''}}"
@if ($supplier['sync_united_status']==1) readonly @endif> @if ($supplier['sync_united_status']==1) disabled @endif>
</div> </div>
</div> </div>
<div class="layui-col-md5"> <div class="layui-col-md5">
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
<label class="layui-form-label"><span class="require">*</span>公司税号</label> <label class="layui-form-label"><span class="require">*</span>公司税号</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="tax_number" id="tax_number" placeholder="请输入公司税号,选择所在区域才允许输入" <input type="text" name="tax_number" id="tax_number" placeholder="请输入公司税号,选择所在区域才允许输入"
class="layui-input layui-disabled" readonly value="{{$supplier['tax_number'] or ''}}"> class="layui-input layui-disabled" disabled value="{{$supplier['tax_number'] or ''}}">
</div> </div>
</div> </div>
</div> </div>
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
<div class="layui-row"> <div class="layui-row">
<div class="layui-col-md3"> <div class="layui-col-md3">
@inject('statusPresenter','App\Presenters\StatusPresenter') @inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('purchase_uid','渠道开发员 : ','',$userCodes,['required'=>true,'width'=>'150px']) !!} {!! $statusPresenter->render('purchase_uid','渠道开发员 : ',$supplier['purchase_uid'],$userCodes,['required'=>true,'width'=>'150px']) !!}
</div> </div>
<div class="layui-col-md3"> <div class="layui-col-md3">
<label class="layui-form-label"><span class="require">*</span>注册资金(万): </label> <label class="layui-form-label"><span class="require">*</span>注册资金(万): </label>
......
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