SupplierAttachmentScript.blade.php
3.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<script>
layui.use(['table', 'form', 'element', 'layer', 'admin', 'upload'], function () {
let table = layui.table;
let form = layui.form;
let admin = layui.admin;
let element = layui.element;
let upload = layui.upload;
let supplierId = getQueryVariable('supplier_id')
table.render({
elem: '#attachmentList',
url: '/api/supplier_attachment/getSupplierAttachmentList?supplier_id=' + supplierId,
method: 'post',
size: 'sm',
cellMinWidth: 80,//全局定义常规单元格的最小宽度
where: {
supplier_id: supplierId
},
width: '70%',
loading: true,
first: true,//不显示首页
last: false,//不显示尾页
cols: [[
@if($operate=='update')
{
type: 'radio',
},
@endif
{
field: 'type_name', title: '<span class="require">* </span>附件类型', align: 'center', width: 150
},
{field: 'file_name', title: '<span class="require">* </span>附件名称', align: 'center', width: 200},
{field: 'description', title: '附件说明', align: 'center', width: 250},
{field: 'validity_period', title: '<span class="require">* </span>有效期', align: 'center', width: 250},
{field: 'create_name', title: '上传人', align: 'center', width: 100},
{field: 'create_time', title: '上传时间', align: 'center', width: 150},
]],
id: 'attachmentList',
page: {},
});
//新增银行弹窗
$("#add_attachment").click(function () {
layer.open({
type: 2,
content: '/supplier_attachment/AddSupplierAttachment?view=iframe&supplier_id=' + supplierId,
area: ['50%', '70%'],
title: '新增银行',
end: function () {
table.reload('attachmentList');
}
});
})
//修改银行弹窗
$("#update_attachment").click(function () {
let checkStatus = table.checkStatus('attachmentList');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的附件', {icon: 5})
} else {
let attachment_id = data[0].attachment_id;
let supplierId = data[0].supplier_id;
layer.open({
type: 2,
content: '/supplier_attachment/UpdateSupplierAttachment?view=iframe&supplier_id=' + supplierId + '&attachment_id=' + attachment_id,
area: ['50%', '70%'],
title: '修改附件',
end: function () {
table.reload('attachmentList');
}
});
}
})
$("#delete_attachment").click(function () {
let checkStatus = table.checkStatus('attachmentList');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的附件', {icon: 5})
} else {
layer.confirm('确定要删除选中的附件吗?', function (index) {
let attachmentId = data[0].attachment_id;
let res = ajax('/api/supplier_attachment/DeleteSupplierAttachment', {attachment_id: attachmentId})
if (res.err_code === 0) {
table.reload('attachmentList')
layer.msg(res.err_msg, {icon: 6})
openLogView();
} else {
layer.msg(res.err_msg, {icon: 5})
}
});
}
});
});
</script>