Commit 62c0ef2e by 杨树贤

删除IQC检测

parent 08ec2664
......@@ -61,6 +61,7 @@ class SupplierExaminationApiController extends Controller
public function UpdateSupplierExamination($request)
{
$params = $request->only([
'id',
'supplier_name',
'examine_time',
'purchase_name',
......@@ -82,17 +83,20 @@ class SupplierExaminationApiController extends Controller
}
$result = (new SupplierExaminationService())->saveSupplierExamination($params);
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');
$model = new SupplierLogModel();
$result = $model->where('id', $logId)->delete();
$ids = $request->get('ids');
$ids = explode(',', trim($ids));
if (empty($ids)) {
$this->response(-1, '请选择需要删除的数据');
}
$result = (new SupplierExaminationService())->deleteSupplierExaminations($ids);
if ($result) {
$this->response(0, '删除成功');
}
......
......@@ -35,10 +35,16 @@ class SupplierExaminationService
$data['examine_time'] = strtotime($data['examine_time']);
if (!empty($data['id'])) {
$data['update_time'] = time();
return SupplierExaminationModel::where($data['id'])->update($data);
return SupplierExaminationModel::where('id', $data['id'])->update($data);
} else {
$data['create_time'] = time();
return SupplierExaminationModel::insert($data);
}
}
//删除
public function deleteSupplierExaminations($ids)
{
return SupplierExaminationModel::whereIn('id', $ids)->delete();
}
}
\ No newline at end of file
......@@ -11,7 +11,7 @@
let type = 'all';
let cols = [
{type: 'radio'},
{type: 'checkbox'},
{field: 'id', title: 'ID', align: 'center', width: 80},
{
field: 'examine_time', title: '检货时间', align: 'center', width: 150
......@@ -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 () {
layer.open({
type: 2,
......@@ -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) {
whereCondition = $.extend(false, initCondition, data.field);
......
......@@ -11,6 +11,7 @@
<form class="layui-form" action="">
<div class="layui-form-item">
<div class="layui-col-md6">
<input type="hidden" name="id" value="{{$examination['id']}}">
@inject('datePresenter','App\Presenters\DatePresenter')
{!! $datePresenter->render('examine_time','检货时间 : ',$examination['examine_time']) !!}
</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