Commit de503a64 by mushishixian

离职判断

parent 5384ad1e
......@@ -7,6 +7,7 @@ use App\Http\Services\LogService;
use App\Http\Services\SupplierContactService;
use App\Http\Transformers\SupplierContactTransformer;
use App\Http\Validators\SupplierContactValidator;
use App\Model\LogModel;
use App\Model\SupplierChannelModel;
use App\Model\SupplierContactModel;
use Illuminate\Http\Request;
......@@ -85,16 +86,16 @@ class SupplierContactApiController extends Controller
if ($userNum === 1) {
//如果只有一个,那就可以去主表删除对应的采购员了
$supplierModel = new SupplierChannelModel();
$supplier = $supplierModel->where('supplier_id',$contact['supplier_id'])->first();
$channelUid = explode(',',$supplier['channel_uid']);
$supplier = $supplierModel->where('supplier_id', $contact['supplier_id'])->first();
$channelUid = explode(',', $supplier['channel_uid']);
if (in_array($canCheckUids, $channelUid)) {
//删除
$channelUid = array_filter($channelUid, function ($value)use($canCheckUids) {
$channelUid = array_filter($channelUid, function ($value) use ($canCheckUids) {
return $value != $canCheckUids;
});
$supplierModel->where('supplier_id',$contact['supplier_id'])->update([
$supplierModel->where('supplier_id', $contact['supplier_id'])->update([
'channel_uid' => implode(',', $channelUid),
'update_time'=> time(),
'update_time' => time(),
]);
}
}
......@@ -108,6 +109,10 @@ class SupplierContactApiController extends Controller
'update_time' => time(),
'status' => 1,
]);
$logService = new LogService();
$content = '删除联系人';
$remark = json_encode($contact);
$logService->AddLog($contact['supplier_id'], LogModel::UPDATE_OPERATE, '修改供应商基本资料', $content, $remark);
$this->response(0, '删除成功');
}
$this->response(-1, '找不到删除对象');
......
......@@ -124,8 +124,8 @@ class LogService
$newFee = json_decode($newSupplier['extra_fee'], true);
$content = "采购附加费由 [商品总价不满" . $oldFee['cn']['max'] . "元,收取" . $oldFee['cn']['price'] . "元;商品总价不满" .
$oldFee['cn']['max'] . "美金,收取" . $oldFee['cn']['price'] .
"元;] 修改为 [商品总价不满" . $newFee['cn']['max'] . "元,收取" . $newFee['cn']['price'] . "元;商品总价不满" .
$newFee['cn']['max'] . "美金,收取" . $newFee['cn']['price'] . "元;]";
"元;] 修改为 [商品总价不满" . $newFee['hk']['max'] . "元,收取" . $newFee['hk']['price'] . "元;商品总价不满" .
$newFee['hk']['max'] . "美金,收取" . $newFee['hk']['price'] . "元;]";
$result[] = $content;
}
}
......
......@@ -24,12 +24,14 @@ class LogTransformer
$item['type'] = array_get(config('fixed.LogType'), $item['type']);
//如果action是修改供应商,就要做对比处理
if ($item['action'] === '修改供应商基本资料') {
$logService = new LogService();
$remark = json_decode($item['remark'], true);
$oldSupplier = array_get($remark, 'old_supplier');
$newSupplier = array_get($remark, 'new_supplier');
$content = $logService->compareSupplierChange($newSupplier, $oldSupplier);
$item['content'] = $content;
if ($item['content'] === '修改供应商') {
$logService = new LogService();
$remark = json_decode($item['remark'], true);
$oldSupplier = array_get($remark, 'old_supplier');
$newSupplier = array_get($remark, 'new_supplier');
$content = $logService->compareSupplierChange($newSupplier, $oldSupplier);
$item['content'] = $content;
}
}
return $item;
}
......
......@@ -30,7 +30,7 @@
, page: {}
});
form.on('submit(auditSupplier)', function (data) {
// admin.btnLoading('.submit-loading');
admin.btnLoading('.submit-loading');
let supplierId = getQueryVariable('supplier_id');
let url = '/api/supplier/AllocatePurchaseUser?supplier_id=' + supplierId;
let res = ajax(url, data.field);
......@@ -42,6 +42,7 @@
//修改罗盘显示数量(cao)
parent.layer.msg(res.err_msg, {icon: 6});
} else {
admin.btnLoading('.submit-loading',false);
parent.layer.msg(res.err_msg, {icon: 5});
}
}
......
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