You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
242 lines
8.6 KiB
242 lines
8.6 KiB
@{
|
|
ViewData["Title"] = "單頭說明表維護";
|
|
Layout = "~/Views/Shared/_AMESLayout.cshtml";
|
|
}
|
|
<div class="layui-card">
|
|
<div class="layui-card-header">
|
|
<div class="layui-form">
|
|
<div class="layui-form-item ">
|
|
<div class="layui-inline"><i class="fa fa-file-text-o fa-fw"></i> @ViewBag.Title</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-card-body">
|
|
<table class="layui-hide" id="test" lay-filter="test"></table>
|
|
</div>
|
|
</div>
|
|
|
|
@section Scripts{
|
|
<script type="text/javascript">
|
|
|
|
//监听表单提交事件
|
|
hg.form.onsubmit('querysubmit', function (data) {
|
|
table && table.reload(data);
|
|
});
|
|
|
|
var tableCols = [[
|
|
{
|
|
field: 'rbu',
|
|
width: 160,
|
|
title: 'RBU'
|
|
},
|
|
{
|
|
field: 'id',
|
|
title: '代號'
|
|
},
|
|
{
|
|
field: 'typeName',
|
|
minWidth: 160,
|
|
title: '作業項目'
|
|
},
|
|
{
|
|
field: 'typeDesc',
|
|
title: '作業說明',
|
|
width: 160
|
|
},
|
|
{
|
|
field: 'source',
|
|
title: '來源',
|
|
},
|
|
{
|
|
field: 'prefixCode',
|
|
title: '開頭',
|
|
},
|
|
{
|
|
field: 'length',
|
|
title: '碼長',
|
|
},
|
|
{
|
|
field: 'status',
|
|
title: '狀態',
|
|
},
|
|
{
|
|
field: 'center',
|
|
width: 160,
|
|
title: '操作',
|
|
templet: function (item) {
|
|
var btn = '<a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="edit">修改</a>';
|
|
btn += ' <a class="layui-btn layui-btn-danger layui-btn-xs layui-icon layui-icon-delete" lay-event="del">刪除</a>';
|
|
return btn
|
|
}
|
|
}
|
|
]];
|
|
|
|
|
|
|
|
@*layui.use(['table', 'form'], function () {
|
|
var table = layui.table;
|
|
var form = layui.form;
|
|
table.render({
|
|
elem: '#test'
|
|
, url: "@Url.Action("GetRecordTypeInfo", "PTD")"
|
|
, title: '單頭說明維護'
|
|
, cellMinwidth: 80//全局定义常规单元格的最小宽度,1ayui 2.2.1 新增
|
|
, cols: [[
|
|
{
|
|
field: 'rbu',
|
|
width: 160,
|
|
title: 'RBU'
|
|
},
|
|
{
|
|
field: 'id',
|
|
width: 100,
|
|
title: '代號'
|
|
},
|
|
{
|
|
field: 'typeName',
|
|
minWidth: 160,
|
|
title: '作業項目'
|
|
},
|
|
{
|
|
field: 'typeDesc',
|
|
title: '作業說明',
|
|
width: 160
|
|
},
|
|
{
|
|
field: 'source',
|
|
title: '來源',
|
|
width: 160
|
|
},
|
|
{
|
|
field: 'prefixCode',
|
|
title: '開頭',
|
|
width: 160
|
|
},
|
|
{
|
|
field: 'length',
|
|
title: '碼長',
|
|
},
|
|
{
|
|
field: 'status',
|
|
title: '狀態',
|
|
},
|
|
{
|
|
field: 'center',
|
|
width: 160,
|
|
title: '操作',
|
|
templet: function (item) {
|
|
var btn = '<a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="edit">修改</a>';
|
|
btn += ' <a class="layui-btn layui-btn-danger layui-btn-xs layui-icon layui-icon-delete" lay-event="del">刪除</a>';
|
|
return btn
|
|
}
|
|
}
|
|
]]
|
|
, page: true
|
|
, limits: [2000]//一页选择显示3,5或10条数据
|
|
, limit: 2000 //一页显示10条数据
|
|
, parseData: function (res) { //将原始数据解析成tabe组件所规定的数据,res光
|
|
var result;
|
|
if (this.page.curr) {
|
|
result = res.data.slice(this.limit * (this.page.curr - 1), this.limit * this.page.curr)
|
|
}
|
|
else {
|
|
result = res.data.slice(0, this.limit);
|
|
}
|
|
return {
|
|
"code": res.code,//解析接口状态
|
|
"msg": res.msg,//解析提示文本
|
|
"count": res.count,//解析数据长度
|
|
"data": result//解析数据列表
|
|
};
|
|
}
|
|
});
|
|
|
|
table.on('tool(test)', function (obj) {
|
|
if (obj.event == 'edit') {
|
|
if (obj.data.id) {
|
|
hg.open('修改單頭說明', '/PTD/PTD004U/' + obj.data.id, 480, 480);
|
|
}
|
|
}
|
|
if (obj.event == 'del') {
|
|
if (obj.data.id) {
|
|
hg.confirm("系統:" + obj.data.typeName + ",確定要刪除嗎?", function () {
|
|
$.ajax({
|
|
url: '/PTD/PTD004D',
|
|
data: { id: obj.data.id },
|
|
type: 'POST',
|
|
success: function (res) {
|
|
if (res.success) {
|
|
hg.msghide("刪除成功!", {
|
|
icon: 6
|
|
});
|
|
layui.table.reload('test', { page: { curr: $(".layui-laypage-em").next().html() } })
|
|
}
|
|
else {
|
|
hg.msg(data.msg);
|
|
}
|
|
},
|
|
error: function () {
|
|
hg.msg("网络请求失败!");
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
// 重新渲染表單,以便使用最新的 layui 組件
|
|
form.render();
|
|
});*@
|
|
|
|
//通过行tool编辑,lay-event="edit"
|
|
function edit(obj) {
|
|
if (obj.data.seq) {
|
|
hg.open('修改單頭說明', '/PTD/PTD004U?seq=' + obj.data.seq, 480, 480);
|
|
}
|
|
}
|
|
|
|
//通过行tool删除,lay-event="del"
|
|
function del(obj) {
|
|
if (obj.data.seq) {
|
|
hg.confirm("系統:" + obj.data.typeName + ",確定要刪除嗎?", function () {
|
|
$.ajax({
|
|
url: '/PTD/PTD004D',
|
|
data: { id: obj.data.seq },
|
|
type: 'POST',
|
|
success: function (res) {
|
|
if (res.success) {
|
|
hg.msghide("刪除成功!", {
|
|
icon: 6
|
|
});
|
|
layui.table.reload('test')
|
|
//layui.table.reload('test', { page: { curr: $(".layui-laypage-em").next().html() } })
|
|
}
|
|
else {
|
|
hg.msg(data.msg);
|
|
}
|
|
},
|
|
error: function () {
|
|
hg.msg("网络请求失败!");
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
var toolbar = [{
|
|
text: '新增',
|
|
layuiicon: '',
|
|
class: 'layui-btn-normal',
|
|
handler: function () {
|
|
hg.open('新增單頭說明', '/PTD/PTD004C', 480, 480);
|
|
|
|
}
|
|
}
|
|
];
|
|
|
|
var table = hg.table.datatable('test', '檢驗類別維護', '/PTD/GetRecordTypeInfo', {}, tableCols, toolbar, false, 'full-100', ['filter', 'print', 'exports']);
|
|
|
|
</script>
|
|
|
|
|
|
}
|