IndexScript.blade.php
5.33 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<script>
layui.use(['table', 'form', 'element', 'layer'], function () {
var table = layui.table;
var form = layui.form;
table.render({
elem: '#list'
, url: '/api/supplier/GetSupplierList'
, method: 'post'
, cellMinWidth: 80 //全局定义常规单元格的最小宽度
, where: {
status: 1
}
, size: 'sm'
, limit: 8
, loading: true
, first: true //不显示首页
, last: false //不显示尾页
, cols: [[
{field: 'supplier_code', title: '供应商编码', align: 'center'},
{field: 'supplier_name', title: '供应商名称', align: 'center'},
{field: 'supplier_group', title: '供应商性质', align: 'center'},
{field: 'stockup_type', title: '合作类型', align: 'center'},
{field: 'channel_username', title: '渠道开发员', align: 'center'},
{field: 'create_name', title: '创建人', align: 'center'},
{field: 'create_time', title: '创建时间', align: 'center'},
{field: 'status_name', title: '状态', align: 'center'},
{field: 'operate', title: '操作', templet: '#operate', align: 'center'},
]]
, id: 'SupplierList'
, page: false
});
form.on('submit(load)', function (data) {
form.render();
//执行重载
table.reload('SupplierList', {
page: {
curr: 1
}
, where: data.field
});
return false;
});
table.on('tool(list)', function (obj) {
let data = obj.data;
let layEvent = obj.event;
let datas = {
group_id: data.group_id,
id: data.id
};
if (layEvent === 'edit') {
window.location = '/supplier'
} else if (layEvent === 'Del') {
datas.status = 3;
up_status(datas, '删除');
}
});
function up_status(data, info) {
layer.confirm('确定' + info + '组成员吗', {
title: info + '组成员'
, btn: ['确定', '取消']
}, function () {
layer.closeAll('dialog'); // 确定时关闭弹框
let res = ajax('/api/save_group_user', data);
if (!res) {
return layer.msg('禁用失败', {icon: 6});
} else {
layer.msg(res.errmsg, {icon: 6});
$('.load').click();
}
}, function () {
layer.close();
});
}
//我的供应商----------------------------------------------------
table.render({
elem: '#own'
, url: '/api/supplier/GetSupplierList'
, method: 'post'
, cellMinWidth: 80 //全局定义常规单元格的最小宽度
, where: {
source_type: 'own'
}
, limit: 8
, loading: true
, first: true //不显示首页
, last: false //不显示尾页
, cols: [[
{field: 'supplier_code', title: '供应商编码', align: 'center', width: 120},
{field: 'supplier_name', title: '供应商名称', align: 'center'},
{field: 'supplier_group', title: '供应商性质', align: 'center', width: 120},
{field: 'stockup_type', title: '合作类型', align: 'center', width: 100},
{field: 'channel_username', title: '采购员', align: 'center', width: 130},
{field: 'create_time', title: '创建时间', align: 'center', width: 170},
{field: 'purchase_username', title: '渠道开发员', align: 'center', width: 130},
{field: 'audit_time', title: '审批时间', align: 'center', width: 170},
{
field: 'status_name', title: '状态', align: 'center', width: 80, templet: function (data) {
if (data.status_name === "驳回") {
return "<span style='color: red' title='" + data.reject_reason + "'>" + data.status_name + "</sspan>";
}
return data.status_name;
}
},
{field: 'operate', title: '操作', templet: '#operate_own', align: 'center', width: 180},
]]
, id: 'SupplierList'
, page: false
});
form.on('submit(load)', function (data) {
form.render();
//执行重载
table.reload('SupplierList', {
page: {
curr: 1
}
, where: data.field
});
return false;
});
table.on('tool(own)', function (obj) {
let data = obj.data;
let layEvent = obj.event;
if (layEvent === 'draft') {
let map = {
supplier_id: data.supplier_id,
status: -1
};
updateStatus(map, '转为草稿');
}
});
});
</script>