Commit 62c0ef2e by 杨树贤

删除IQC检测

parent 08ec2664
...@@ -61,6 +61,7 @@ class SupplierExaminationApiController extends Controller ...@@ -61,6 +61,7 @@ class SupplierExaminationApiController extends Controller
public function UpdateSupplierExamination($request) public function UpdateSupplierExamination($request)
{ {
$params = $request->only([ $params = $request->only([
'id',
'supplier_name', 'supplier_name',
'examine_time', 'examine_time',
'purchase_name', 'purchase_name',
...@@ -82,17 +83,20 @@ class SupplierExaminationApiController extends Controller ...@@ -82,17 +83,20 @@ class SupplierExaminationApiController extends Controller
} }
$result = (new SupplierExaminationService())->saveSupplierExamination($params); $result = (new SupplierExaminationService())->saveSupplierExamination($params);
if ($result) { if ($result) {
$this->response(0, '添加成功'); $this->response(0, '修改成功');
} }
$this->response(-1, '添加失败', $result); $this->response(-1, '修改失败', $result);
} }
//删除 //删除
public function DeleteSupplierLog($request) public function DeleteSupplierExaminations($request)
{ {
$logId = $request->get('id'); $ids = $request->get('ids');
$model = new SupplierLogModel(); $ids = explode(',', trim($ids));
$result = $model->where('id', $logId)->delete(); if (empty($ids)) {
$this->response(-1, '请选择需要删除的数据');
}
$result = (new SupplierExaminationService())->deleteSupplierExaminations($ids);
if ($result) { if ($result) {
$this->response(0, '删除成功'); $this->response(0, '删除成功');
} }
......
...@@ -35,10 +35,16 @@ class SupplierExaminationService ...@@ -35,10 +35,16 @@ class SupplierExaminationService
$data['examine_time'] = strtotime($data['examine_time']); $data['examine_time'] = strtotime($data['examine_time']);
if (!empty($data['id'])) { if (!empty($data['id'])) {
$data['update_time'] = time(); $data['update_time'] = time();
return SupplierExaminationModel::where($data['id'])->update($data); return SupplierExaminationModel::where('id', $data['id'])->update($data);
} else { } else {
$data['create_time'] = time(); $data['create_time'] = time();
return SupplierExaminationModel::insert($data); return SupplierExaminationModel::insert($data);
} }
} }
//删除
public function deleteSupplierExaminations($ids)
{
return SupplierExaminationModel::whereIn('id', $ids)->delete();
}
} }
\ No newline at end of file
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
let type = 'all'; let type = 'all';
let cols = [ let cols = [
{type: 'radio'}, {type: 'checkbox'},
{field: 'id', title: 'ID', align: 'center', width: 80}, {field: 'id', title: 'ID', align: 'center', width: 80},
{ {
field: 'examine_time', title: '检货时间', align: 'center', width: 150 field: 'examine_time', title: '检货时间', align: 'center', width: 150
...@@ -52,27 +52,6 @@ ...@@ -52,27 +52,6 @@
}); });
//删除
$("#delete_supplier_examination").click(function () {
let checkStatus = table.checkStatus('supplierExaminationList');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的数据', {icon: 5})
} else {
layer.confirm('确定要禁用该数据吗?', function (index) {
let id = data[0].id;
let res = ajax('/api/supplier_account/DisableSupplierExamination', {id: id})
if (res.err_code === 0) {
table.reload('supplierExaminationList');
layer.closeAll();
layer.msg(res.err_msg, {icon: 6})
} else {
layer.msg(res.err_msg, {icon: 5})
}
});
}
});
$("#add_supplier_examination").click(function () { $("#add_supplier_examination").click(function () {
layer.open({ layer.open({
type: 2, type: 2,
...@@ -104,6 +83,30 @@ ...@@ -104,6 +83,30 @@
} }
}); });
//启用
$("#delete_supplier_examination").click(function () {
let checkStatus = table.checkStatus('supplierExaminationList');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的检测数据', {icon: 5})
} else {
layer.confirm('确定要删除检测数据吗?', function (index) {
let ids = [];
$.each(data, function (index, value) {
ids.push(value.id);
});
ids = ids.join(',');
let res = ajax('/api/supplier_examination/DeleteSupplierExaminations', {ids: ids})
if (res.err_code === 0) {
table.reload('supplierExaminationList');
layer.closeAll();
layer.msg(res.err_msg, {icon: 6})
} else {
layer.msg(res.err_msg, {icon: 5})
}
});
}
});
form.on('submit(load)', function (data) { form.on('submit(load)', function (data) {
whereCondition = $.extend(false, initCondition, data.field); whereCondition = $.extend(false, initCondition, data.field);
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<form class="layui-form" action=""> <form class="layui-form" action="">
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-col-md6"> <div class="layui-col-md6">
<input type="hidden" name="id" value="{{$examination['id']}}">
@inject('datePresenter','App\Presenters\DatePresenter') @inject('datePresenter','App\Presenters\DatePresenter')
{!! $datePresenter->render('examine_time','检货时间 : ',$examination['examine_time']) !!} {!! $datePresenter->render('examine_time','检货时间 : ',$examination['examine_time']) !!}
</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