addOutUserHC.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. define(function (require) {
  2. return function (context) {
  3. var $dlg, $form, isEdit = false;
  4. return {
  5. xtype: 'dialog',
  6. dialogId: 'dialogEnvLog',
  7. title: context.isEdit ? '编辑特殊人员信息' : '新增特殊人员信息',
  8. width: 450,
  9. height: 300,
  10. onOpen: function () {
  11. $dlg = $(this);
  12. if (context.isEdit) {
  13. $.yvan.ajax({
  14. loadingMask: false,
  15. url: api('/qrImg/getDoorById'),
  16. type: 'GET',
  17. data: {tuId: context.tuId},
  18. success: function (data) {
  19. $dlg.find('form');
  20. $form.formSet(data.data);
  21. }
  22. });
  23. }
  24. },
  25. center: {
  26. items: {
  27. width: 450,
  28. height: 756,
  29. autoSizeColumns: true,
  30. xtype: 'formgroup',
  31. onRender: function () {
  32. $form = $(this);
  33. },
  34. items: [
  35. [
  36. {name: 'tuId', xtype: 'hidden'},
  37. {
  38. name: 'phone',
  39. label: '电话',
  40. required: true,
  41. validType: 'phoneNum',
  42. maxlength: 60,
  43. width: 350,
  44. },
  45. {
  46. name: 'name',
  47. label: '联系人姓名',
  48. required: true,
  49. maxlength: 60,
  50. width: 350,
  51. },
  52. ]
  53. ],
  54. }
  55. },
  56. buttons: [
  57. {
  58. text: "检查电话", iconCls: "fa fa-save", onClick: function () {
  59. var queryForm = $form.formGet();
  60. if (queryForm.phone == "") {
  61. $.yvan.msg('请先选输入电话号码');
  62. return;
  63. }
  64. $.yvan.ajax({
  65. url: api('/OutUser/getUptownHomeByPhone'),
  66. data: {phone: queryForm.phone},
  67. method: 'post',
  68. async: false,
  69. success: function (data) {
  70. if (data.data.linkman != null) {
  71. $form.formSet({name: data.data.linkman});
  72. }
  73. }
  74. });
  75. }
  76. },
  77. {
  78. text: "保存", iconCls: "fa fa-save", onClick: function () {
  79. $.yvan.postForm($form, {
  80. url: api('/OutUser/saveOutUserHC'),
  81. success: function (data) {
  82. if (data.data == 1) {
  83. $.yvan.msg('保存成功');
  84. $dlg.window('close');
  85. if ($.type(context.confirm) === 'function') {
  86. context.confirm();
  87. }
  88. }
  89. }
  90. });
  91. }
  92. }, {
  93. text: "关闭", iconCls: "fa fa-times", onClick: function () {
  94. $dlg.dialog('close');
  95. }
  96. }
  97. ]
  98. };
  99. };
  100. });