更新数据关联查询,以及基本的数据的编辑,部分有待进一步完善。

This commit is contained in:
panx
2025-01-06 00:06:03 +08:00
parent d70fcccc1d
commit 018322d8c1
22 changed files with 1693 additions and 748 deletions

View File

@@ -126,10 +126,48 @@
<a class="layui-table-text" data-url="{:url('/PdmPartitemView/del')}?id={{d.id}}" lay-event="del">{:__('删除')}</a>
</script>
<script type="text/html" id="tableButton"></script>
<!-- 文件预览模板 -->
<!-- 内部模板的嵌套 {-{ }-} 会有问题-->
<script type="text/html" id="filepreviewtpl">
{{#
if(d.datasheet) {
var fileExt = d.datasheet.split('.').pop().toLowerCase();
var imageExts = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'];
if (imageExts.indexOf(fileExt) !== -1) {
}}
<!-- 图片文件显示图片并链接到原文件 -->
<a href="/upload/datasheet/{{d.datasheet}}" target="_blank">
<img class="filesuffix" src="/upload/datasheet/{{d.datasheet}}" alt="Image Preview" style="max-width: 100px; height: auto;" />
</a>
{{#
} else if (fileExt === 'pdf') {
}}
<!-- PDF 文件显示 PDF 图标并链接到 PDF 文件 -->
<a href="/upload/datasheet/{{d.datasheet}}" target="_blank" style="display: flex; align-items: center;">
<i class="layui-icon layui-icon-file" style="font-size: 24px; color: #e64340; margin-right: 5px;"></i>
<span>PDF{{d.datasheet}}</span>
</a>
{{#
} else {
}}
<!-- 其他文件类型显示通用文件图标并链接到文件 -->
<a href="/upload/datasheet/{{d.datasheet}}" target="_blank" style="display: flex; align-items: center;">
<i class="layui-icon layui-icon-file" style="font-size: 24px; color: #1E9FFF; margin-right: 5px;"></i>
<span>Other{{d.datasheet}}</span>
</a>
{{#
}
}
}}
</script>
<include file="/public/footer" />
<script>
layui.use(['admin', 'table'], function () {
@@ -145,24 +183,30 @@
, url: "{:url('/PdmPartitemView/index')}"
, toolbar: '#tableButton'
, defaultToolbar: ['filter', 'exports', 'print', 'search']
, cellMinWidth: 160
, cellMinWidth: 80
, page: true
, limit: 18
, cols: [[
<!-- {type: 'checkbox', width: 50}, -->
{ field: 'id', align: 'center', sort: true, width: 40, fixed: 'left', title: 'ID' },
{ field: 'partnumber', width: 80, fixed: 'left', title: '{:__("PartNumber")}' },
{ field: 'purchasecode', width: 80, title: '{:__("采购编码")}' },
{ field: 'parttype', sort: true,width: 80, title: '{:__("PartType")}' },
{ field: 'value', sort: true,width: 80, title: '{:__("Value")}' },
{ field: 'description', width: 200, title: '{:__("描述")}' },
{ field: 'mpn', sort: true, width: 80, title: '{:__("MPN")}' },
{ field: 'mfgname', sort: true, width: 80, title: '{:__("制造商名称")}' },
{ field: 'symbol', title: '{:__("SymbolName")}' },
{ field: 'footprint', sort: true, title: '{:__("Footprint")}' },
{ field: 'datasheet', title: '{:__("规格书")}' },
{ field: 'usernickname', sort: true, title: '{:__("用户昵称")}' },
{ field: 'department', sort: true, title: '{:__("部门名称")}' },
{ field: 'partnumber', width: 160, fixed: 'left', title: '{:__("PartNumber")}' },
{ field: 'purchasecode', width: 160, title: '{:__("采购编码")}' },
{ field: 'parttype', sort: true,width: 100, title: '{:__("PartType")}' },
{ field: 'value', sort: true,width: 160, title: '{:__("Value")}' },
{ field: 'description', width: 250, title: '{:__("描述")}' },
{ field: 'mpn', sort: true, width: 160, title: '{:__("MPN")}' },
{ field: 'mfgname', sort: true, width: 160, title: '{:__("制造商名称")}' },
{ field: 'symbol', width: 160, title: '{:__("SymbolName")}' },
{ field: 'footprint',width: 160, sort: true, title: '{:__("Footprint")}' },
//{ field: 'datasheet', title: '{:__("规格书")}' },
//{
// field: 'datasheet', templet: function (d) {
// return '<a href="/upload/datasheet/' + d.datasheet + '" target="_blank" ><img class="filesuffix" src="/upload/datasheet/' + d.datasheet + '"></a>';
// }, title: '{:__("规格书")}'
//},
{ field: 'datasheet', width: 160, templet: '#filepreviewtpl', title: '{:__("规格书")}' },
{ field: 'usernickname',width: 120, sort: true, title: '{:__("用户昵称")}' },
{ field: 'department',width: 120, sort: true, title: '{:__("部门名称")}' },
{ align: 'center', toolbar: '#tableBar', width: 160, fixed: 'right', title: '{:__("操作")}' },
]]
})