Commit befd767b by 杨树贤

修改更新逻辑

parent 7d2f8a67
......@@ -6,15 +6,20 @@ namespace App\Presenters;
class DatePresenter
{
public function render($name, $text, $value)
public function render($name, $text, $value,$option = [])
{
$isRequired = array_get($option, 'required', false);
$isDisable = array_get($option, 'disable') === true ? 'disabled' : '';
$disableClass = $isDisable ? 'layui-disabled' : '';
$requiredHtml = $isRequired ? '<span class="require">*</span>' : "";
$time = $value;
return <<<EOF
<label class="layui-form-label">$text</label>
<label class="layui-form-label"> $requiredHtml $text</label>
<div class="layui-input-inline">
<input type="text" id="$name" name="$name"
placeholder="请输入$text"
class="layui-input"
class="layui-input $disableClass" $isDisable
value="$time">
</div>
<script>
......
......@@ -11,6 +11,55 @@
let whereCondition = initCondition;
let type = 'all';
$(document).on("click", ".layui-table-body table.layui-table tbody tr", function () {
let index = $(this).attr('data-index');
let tableBox = $(this).parents('.layui-table-box');
let tableDiv = null;
if (tableBox.find(".layui-table-fixed.layui-table-fixed-l").length > 0) {
tableDiv = tableBox.find(".layui-table-fixed.layui-table-fixed-l");
} else {
tableDiv = tableBox.find(".layui-table-body.layui-table-main");
}
let checkCell = tableDiv.find("tr[data-index=" + index + "]").find("td div.laytable-cell-checkbox div.layui-form-checkbox I");
if (checkCell.length > 0) {
checkCell.click();
}
});
$(document).on("click", "td div.laytable-cell-checkbox div.layui-form-checkbox", function (e) {
e.stopPropagation();
});
//监听复选框事件,被选中的行高亮显示
table.on('checkbox(supplierExaminationList)', function (obj) {
//拉黑就不用变色了
if (obj.data.status === -3) {
return
}
if (obj.checked === true && obj.type === 'all') {
//点击全选,拉黑的不用选上
$('.layui-table-body table.layui-table tbody tr:not(.block-class)').addClass('layui-table-click');
$('.layui-table-body table.layui-table tbody').find('.block-class').find('.layui-form-checkbox').remove();
$('.layui-table-body table.layui-table tbody tr .block-class').addClass('layui-table-click');
} else if (obj.checked === false && obj.type === 'all') {
//点击全不选
$('.layui-table-body table.layui-table tbody tr').removeClass('layui-table-click');
} else if (obj.checked === true && obj.type === 'one') {
//点击单行
if (obj.checked === true) {
obj.tr.addClass('layui-table-click');
} else {
obj.tr.removeClass('layui-table-click');
}
} else if (obj.checked === false && obj.type === 'one') {
//点击全选之后点击单行
if (obj.tr.hasClass('layui-table-click')) {
obj.tr.removeClass('layui-table-click');
}
}
});
let cols = [
{type: 'checkbox'},
{field: 'id', title: 'ID', align: 'center', width: 80},
......
......@@ -13,13 +13,13 @@
<div class="layui-col-xs6">
<input type="hidden" name="id" value="{{$examination['id']}}">
@inject('datePresenter','App\Presenters\DatePresenter')
{!! $datePresenter->render('examine_time','检货时间 : ',$examination['examine_time']) !!}
{!! $datePresenter->render('examine_time','检货时间 : ',$examination['examine_time'],['disable'=>true,'required'=>true]) !!}
</div>
<div class="layui-col-xs6">
@if(empty($supplierName))
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('purchase_name','采购员 : ',$examination['purchase_name'],
$purchaseUserNames,['required'=>true]) !!}
$purchaseUserNames,['required'=>true,'disable'=>true]) !!}
@else
<label class="layui-form-label"><span class="require">*</span>采购员 : </label>
<div class="layui-input-block" style="padding-top: 7px">
......@@ -35,8 +35,8 @@
<label class="layui-form-label"><span class="require">*</span>供应商 : </label>
<div class="layui-input-block">
<input type="text" name="supplier_name" id="supplier_name"
placeholder="请输入供应商名称" class="layui-input"
value="{{$examination['supplier_name'] or ''}}">
placeholder="请输入供应商名称" class="layui-input layui-disabled"
value="{{$examination['supplier_name'] or ''}}" disabled>
</div>
@else
<label class="layui-form-label"><span class="require">*</span>供应商 : </label>
......@@ -50,8 +50,8 @@
<label class="layui-form-label"><span class="require">*</span>数量 : </label>
<div class="layui-input-block">
<input type="text" name="amount" id="amount"
placeholder="请填写数量(个)" class="layui-input"
value="{{$examination['amount'] or ''}}">
placeholder="请填写数量(个)" class="layui-input layui-disabled"
value="{{$examination['amount'] or ''}}" disabled>
</div>
</div>
</div>
......@@ -60,16 +60,16 @@
<label class="layui-form-label"><span class="require">*</span>品牌 : </label>
<div class="layui-input-block">
<input type="text" name="brand_name" id="brand_name"
placeholder="请填写品牌" class="layui-input"
value="{{$examination['brand_name'] or ''}}">
placeholder="请填写品牌" class="layui-input layui-disabled"
value="{{$examination['brand_name'] or ''}}" disabled>
</div>
</div>
<div class="layui-col-xs6">
<label class="layui-form-label"><span class="require">*</span>型号 : </label>
<div class="layui-input-block">
<input type="text" name="sku_name" id="sku_name"
placeholder="请输入型号" class="layui-input"
value="{{$examination['sku_name'] or ''}}">
placeholder="请输入型号" class="layui-input layui-disabled"
value="{{$examination['sku_name'] or ''}}" disabled>
</div>
</div>
</div>
......@@ -78,16 +78,16 @@
<label class="layui-form-label"><span class="require">*</span>检测数量 : </label>
<div class="layui-input-block">
<input type="text" name="examine_amount" id="examine_amount"
placeholder="请填写检测数量(个)" class="layui-input"
value="{{$examination['examine_amount'] or ''}}">
placeholder="请填写检测数量(个)" class="layui-input layui-disabled"
value="{{$examination['examine_amount'] or ''}}" disabled>
</div>
</div>
<div class="layui-col-xs6">
<label class="layui-form-label"><span class="require">*</span>不良数 : </label>
<div class="layui-input-block">
<input type="text" name="unhealthy_amount" id="unhealthy_amount"
placeholder="请填写不良数(个)" class="layui-input"
value="{{$examination['unhealthy_amount'] or ''}}">
placeholder="请填写不良数(个)" class="layui-input layui-disabled"
value="{{$examination['unhealthy_amount'] or ''}}" disabled>
</div>
</div>
</div>
......@@ -96,16 +96,16 @@
<label class="layui-form-label"><span class="require">*</span>不良现象 : </label>
<div class="layui-input-block">
<input type="text" name="unhealthy_content" id="unhealthy_content"
placeholder="请填写不良现象" class="layui-input"
value="{{$examination['unhealthy_content'] or ''}}">
placeholder="请填写不良现象" class="layui-input layui-disabled"
value="{{$examination['unhealthy_content'] or ''}}" disabled>
</div>
</div>
<div class="layui-col-xs6">
<label class="layui-form-label"><span class="require">*</span>检验结果 : </label>
<div class="layui-input-block">
<input type="text" name="examine_result" id="examine_result"
placeholder="请填写检验结果" class="layui-input"
value="{{$examination['examine_result'] or ''}}">
placeholder="请填写检验结果" class="layui-input layui-disabled"
value="{{$examination['examine_result'] or ''}}" disabled>
</div>
</div>
</div>
......@@ -119,8 +119,8 @@
<label class="layui-form-label"><span class="require">*</span>处理方式 : </label>
<div class="layui-input-block">
<input type="text" name="handle_way" id="handle_way"
placeholder="请填写处理方式" class="layui-input"
value="{{$examination['handle_way'] or ''}}">
placeholder="请填写处理方式" class="layui-input layui-disabled"
value="{{$examination['handle_way'] or ''}}" disabled>
</div>
</div>
</div>
......@@ -128,8 +128,8 @@
<label class="layui-form-label">备注说明 : </label>
<div class="layui-input-block">
<input type="text" name="remark" id="remark"
placeholder="备注说明" class="layui-input"
value="{{$examination['remark'] or ''}}">
placeholder="备注说明" class="layui-input layui-disabled"
value="{{$examination['remark'] or ''}}" disabled>
</div>
</div>
<div class="layui-form-item">
......
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