workorder.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /**
  2. @Name:layuiAdmin 工单系统
  3. @Author:star1029
  4. @Site:http://www.layui.com/admin/
  5. @License:GPL-2
  6. */
  7. layui.define(['table', 'form', 'element'], function(exports){
  8. var $ = layui.$
  9. ,table = layui.table
  10. ,form = layui.form
  11. ,element = layui.element;
  12. table.render({
  13. elem: '#LAY-app-system-order'
  14. ,url: layui.setter.base + 'json/workorder/demo.js' //模拟接口
  15. ,cols: [[
  16. {type: 'numbers', fixed: 'left'}
  17. ,{field: 'orderid', width: 100, title: '工单号', sort: true}
  18. ,{field: 'attr', width: 100, title: '业务性质'}
  19. ,{field: 'title', width: 100, title: '工单标题', width: 300}
  20. ,{field: 'progress', title: '进度', width: 200, align: 'center', templet: '#progressTpl'}
  21. ,{field: 'submit', width: 100, title: '提交者'}
  22. ,{field: 'accept', width: 100, title: '受理人员'}
  23. ,{field: 'state', title: '工单状态', templet: '#buttonTpl', minWidth: 80, align: 'center'}
  24. ,{title: '操作', align: 'center', fixed: 'right', toolbar: '#table-system-order'}
  25. ]]
  26. ,page: true
  27. ,limit: 10
  28. ,limits: [10, 15, 20, 25, 30]
  29. ,text: '对不起,加载出现异常!'
  30. ,done: function(){
  31. element.render('progress')
  32. }
  33. });
  34. //监听工具条
  35. table.on('tool(LAY-app-system-order)', function(obj){
  36. var data = obj.data;
  37. if(obj.event === 'edit'){
  38. var tr = $(obj.tr);
  39. layer.open({
  40. type: 2
  41. ,title: '编辑工单'
  42. ,content: '../../../views/app/workorder/listform.html'
  43. ,area: ['450px', '450px']
  44. ,btn: ['确定', '取消']
  45. ,yes: function(index, layero){
  46. var iframeWindow = window['layui-layer-iframe'+ index]
  47. ,submitID = 'LAY-app-workorder-submit'
  48. ,submit = layero.find('iframe').contents().find('#'+ submitID);
  49. //监听提交
  50. iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
  51. var field = data.field; //获取提交的字段
  52. //提交 Ajax 成功后,静态更新表格中的数据
  53. //$.ajax({});
  54. table.reload('LAY-user-front-submit'); //数据刷新
  55. layer.close(index); //关闭弹层
  56. });
  57. submit.trigger('click');
  58. }
  59. ,success: function(layero, index){
  60. }
  61. });
  62. }
  63. });
  64. exports('workorder', {})
  65. });