81 lines
3.1 KiB
PHP
81 lines
3.1 KiB
PHP
@extends($layout)
|
||
@section('content')
|
||
|
||
<div class="pageheader">
|
||
<div class="pageicon"><span class="fa fa-fw fa-link"></span></div>
|
||
<div class="pagetitle">
|
||
<h1>项目引用的主数据</h1>
|
||
<p>本项目已关联的全局主数据(BOM / 工艺文件 / 工具清单),可在详情中追加项目级列</p>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="maincontent">
|
||
<div class="maincontentinner">
|
||
|
||
<div class="row" style="margin-bottom:16px;">
|
||
<div class="col-md-12">
|
||
<a href="{{ BASE_URL }}/bom/show" class="btn btn-primary"><i class="fa fa-plus"></i> 关联主数据(去主数据列表选择)</a>
|
||
</div>
|
||
</div>
|
||
|
||
@if (empty($refs))
|
||
<div class="alert alert-info">本项目尚未关联任何主数据。点击上方按钮前往主数据列表。</div>
|
||
@else
|
||
<div class="table-responsive">
|
||
<table class="table table-striped table-bordered">
|
||
<thead>
|
||
<tr>
|
||
<th>类型</th>
|
||
<th>编号</th>
|
||
<th>名称</th>
|
||
<th>规格型号</th>
|
||
<th>版本</th>
|
||
<th style="width:160px;">操作</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
@foreach ($refs as $ref)
|
||
@php $m = $ref['master'] ?? []; $typeNames = ['bom'=>'BOM','process'=>'工艺文件','tooling'=>'工具清单']; @endphp
|
||
<tr>
|
||
<td><span class="label label-info">{{ $typeNames[$m['type'] ?? 'bom'] ?? 'BOM' }}</span></td>
|
||
<td>{{ $m['bomNo'] ?? '' }}</td>
|
||
<td>{{ $m['productName'] ?? '' }}</td>
|
||
<td>{{ $m['specification'] ?? '' }}</td>
|
||
<td>{{ $m['version'] ?? '' }}</td>
|
||
<td>
|
||
<a class="btn btn-xs btn-default" href="{{ BASE_URL }}/bom/refs/{{ $ref['id'] }}">打开</a>
|
||
<button class="btn btn-xs btn-danger btnUnlinkRef" data-id="{{ $ref['id'] }}">取消关联</button>
|
||
</td>
|
||
</tr>
|
||
@endforeach
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
@endif
|
||
|
||
</div>
|
||
</div>
|
||
|
||
@once
|
||
@push('scripts')
|
||
<script>
|
||
jQuery(document).ready(function () {
|
||
var csrf = function () { return jQuery('meta[name="csrf-token"]').attr('content') || ''; };
|
||
jQuery('.btnUnlinkRef').on('click', function () {
|
||
var id = jQuery(this).data('id');
|
||
if (!confirm('确定取消关联?项目级追加的列和数据将被删除。')) { return; }
|
||
jQuery.ajax({
|
||
url: '{{ BASE_URL }}/bom/api/ref/' + id,
|
||
method: 'DELETE',
|
||
headers: { 'X-CSRF-TOKEN': csrf() },
|
||
success: function () { location.reload(); },
|
||
error: function () { alert('取消失败'); }
|
||
});
|
||
});
|
||
});
|
||
</script>
|
||
@endpush
|
||
@endonce
|
||
|
||
@endsection
|