Commit 2009e605 by mushishixian

修复bug

parent d791b15d
......@@ -54,10 +54,10 @@ class SupplierShareApplyApiController extends Controller
public function SaveSupplierShareApply($request)
{
$map = $request->only([
'department_id',
'apply_department_id',
'supplier_id',
]);
if (empty($map['department_id']) || empty($map['supplier_id'])) {
if (empty($map['apply_department_id']) || empty($map['supplier_id'])) {
$this->response(-1, '缺少参数');
}
$map['apply_code_id'] = $request->user->codeId;
......
......@@ -175,7 +175,23 @@ class SupplierContactService
$contact['supplier_id'] = $supplierId;
$contact['add_time'] = time();
$contact['admin_id'] = request()->user->userId;
return $contactModel->insert($contact);
$result = $contactModel->insert($contact);
if ($result) {
$channelUids = $contacts = $contactModel->where('supplier_id',$supplierId)->pluck('can_check_uids')->toArray();
$supplierModel = new SupplierChannelModel();
$result = $supplierModel->where('supplier_id',$supplierId)->update([
'channel_uid' => implode(',', $channelUids),
'update_time' => time(),
]);
$adminService = new AdminUserService();
$user = $adminService->getAdminUserInfoByCodeId($channelUid);
$channelUserName = array_get($user, 'name');
//还要记录日志
$logService = new LogService();
$content = "共用申请审核通过,添加采购员 : " . $channelUserName;
$logService->AddLog($supplierId, LogModel::UPDATE_OPERATE, '添加采购员', $content);
}
return $result;
}
}
\ No newline at end of file
......@@ -68,7 +68,10 @@ class SupplierShareApplyService
$data = $map;
$data['status'] = 0;
$data['create_time'] = time();
$data['create_uid'] = $map['apply_code_id'];
$data['create_uid'] = request()->user->userId;
$departmentService = new DepartmentService();
$department = $departmentService->getTopDepartmentByUserId($data['create_uid']);
$data['department_id'] = $department['department_id'];
$applyModel = new SupplierShareApplyModel();
return $applyModel->insert($data);
}
......@@ -78,8 +81,8 @@ class SupplierShareApplyService
{
$applyModel = new SupplierShareApplyModel();
$count = $applyModel->where('supplier_id', $map['supplier_id'])
->where('apply_code_id', $map['apply_code_id'])->where('department_id', $map['department_id'])
->whereNotIn('status', [$this::STATUS_AUDIT_REJECT, $this::STATUS_REVIEW_REJECT])->count();
->where('apply_code_id', $map['apply_code_id'])->where('department_id', $map['apply_department_id'])
->whereNotIn('status', [$applyModel::STATUS_AUDIT_REJECT, $applyModel::STATUS_REVIEW_REJECT])->count();
return $count;
}
......
......@@ -46,6 +46,15 @@ class SupplierTagService
return !empty($data['data']) ? $data['data'] : [];
}
//获取供应商对应的自定义标签
public function getCustomerTagsBySupplierId($supplierId)
{
// $supplierId = 1;
$response = $this->client->get('/get?tag_use=4&req_id=' . $supplierId);
$data = json_decode($response->getBody()->getContents(), true);
return !empty($data['data']) ? $data['data'] : [];
}
//新增/修改标签和供应商id对应关系到标签系统
public function saveTags($supplierId, $tagUse, $newTags, $oldTags)
{
......@@ -76,7 +85,7 @@ class SupplierTagService
'modifier_name' => 'admin',
'data' => [
[
'id' => $supplierId,
'id' => (int)$supplierId,
'tag_status' => 0,
]
]
......@@ -105,6 +114,9 @@ class SupplierTagService
RequestOptions::JSON => $params,
]);
$data = json_decode($response->getBody()->getContents(), true);
// if ($tagUse==4) {
// dd($params,$data);
// }
if (!empty($data['status']) && $data['status'] == 1) {
return true;
} else {
......
......@@ -45,5 +45,9 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () {
Route::match(['get', 'post'], '/test', function () {
$service = new \App\Http\Services\DataService();
// $service->initSystemTag();
$service->transferFileData();
// $service->transferFileData();
$tagService = new \App\Http\Services\SupplierTagService();
// $res = $tagService->getSystemTagsBySupplierId(12293);
$res = $tagService->getCustomerTagsBySupplierId(12293);
dd($res);
});
......@@ -40,7 +40,7 @@ class SupplierShareApplyModel extends Model
public function apply_user()
{
return $this->hasOne(UserInfoModel::class, 'userId', 'apply_code_id');
return $this->hasOne(UserInfoModel::class, 'userId', 'create_uid');
}
}
......@@ -47,7 +47,7 @@
$.each(res.data, function (index, value) {
optionHtml += "<option value='" + value.department_id + "'>" + value.department_name + "</option>"
})
$('#department_id').html(optionHtml);
$('#apply_department_id').html(optionHtml);
form.render('select');
} else {
layer.msg(res.err_msg, {icon: 5});
......@@ -55,17 +55,15 @@
});
form.on('submit(save_supplier_share_apply)', function (data) {
admin.btnLoading('.submit-loading');
let url = '/api/supplier_share_apply/SaveSupplierShareApply';
let res = ajax(url, data.field);
if (!res) {
layer.msg('网络错误,请重试', {icon: 6});
} else {
if (res.err_code === 0) {
// admin.closeThisDialog();
admin.closeThisDialog();
parent.layer.msg(res.err_msg, {icon: 6});
} else {
admin.btnLoading('.submit-loading', false);
parent.layer.msg(res.err_msg, {icon: 5});
}
}
......
......@@ -19,8 +19,8 @@
}
},
{
field: 'apply_department_name', title: '被申请部门', width: 150, align: 'center', templet: function (d) {
return d.apply_department ? d.apply_department.department_name : '';
field: 'department_name', title: '申请部门', width: 150, align: 'center', templet: function (d) {
return d.department ? d.department.department_name : '';
}
},
{
......@@ -29,8 +29,8 @@
}
},
{
field: 'department_name', title: '被申请部门', width: 150, align: 'center', templet: function (d) {
return d.department ? d.department.department_name : '';
field: 'apply_department_name', title: '被申请部门', width: 150, align: 'center', templet: function (d) {
return d.apply_department ? d.apply_department.department_name : '';
}
},
{field: 'create_time', title: '申请时间', width: 150, align: 'center'},
......
......@@ -28,7 +28,7 @@
<label class="layui-form-label"><span class="require">*</span>被申请部门 :
</label>
<div class="layui-inline" style="width: 250px">
<select name="department_id" lay-filter="department_id" id="department_id">
<select name="apply_department_id" lay-filter="apply_department_id" id="apply_department_id">
<option value="">请选择一个部门</option>
</select>
</div>
......
......@@ -36,7 +36,7 @@
@foreach($attachment[$name] as $k=>$item)
<span class="single_file_div">
<a href="{{$item['url']}}" target="_blank">
{{$item['file_name']}}
{{array_get($item,'file_name','未知文件名')}}
</a>
<i class="layui-icon delete_file"
style="font-size: 15px !important; color: red;cursor: pointer;margin-left: 3px;">X</i> &nbsp;
......
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