Files

70 lines
2.2 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
@NamelayuiAdmin 工单系统
@Authorstar1029
@Sitehttp://www.layui.com/admin/
@LicenseGPL-2
*/
layui.define(['table', 'form', 'element'], function(exports){
var $ = layui.$
,admin = layui.admin
,view = layui.view
,table = layui.table
,form = layui.form
,element = layui.element;
table.render({
elem: '#LAY-app-workorder'
,url: './json/workorder/demo.js' //模拟接口
,cols: [[
{type: 'numbers', fixed: 'left'}
,{field: 'orderid', width: 100, title: '工单号', sort: true}
,{field: 'attr', width: 100, title: '业务性质'}
,{field: 'title', width: 100, title: '工单标题', width: 300}
,{field: 'progress', title: '进度', width: 200, align: 'center', templet: '#progressTpl'}
,{field: 'submit', width: 100, title: '提交者'}
,{field: 'accept', width: 100, title: '受理人员'}
,{field: 'state', title: '工单状态', templet: '#buttonTpl', minWidth: 80, align: 'center'}
,{title: '操作', align: 'center', fixed: 'right', toolbar: '#table-system-order'}
]]
,page: true
,limit: 10
,limits: [10, 15, 20, 25, 30]
,text: '对不起,加载出现异常!'
,done: function(){
element.render('progress');
}
});
//监听工具条
table.on('tool(LAY-app-workorder)', function(obj){
var data = obj.data;
if(obj.event === 'edit'){
admin.popup({
title: '编辑工单'
,area: ['450px', '450px']
,id: 'LAY-popup-workorder-add'
,success: function(layero, index){
view(this.id).render('app/workorder/listform').done(function(){
form.render(null, 'layuiadmin-form-workorder');
//监听提交
form.on('submit(LAY-app-workorder-submit)', function(data){
var field = data.field; //获取提交的字段
//提交 Ajax 成功后,关闭当前弹层并重载表格
//$.ajax({});
layui.table.reload('LAY-app-workorder'); //重载表格
layer.close(index); //执行关闭
});
});
}
});
}
});
exports('workorder', {})
});