地铁二期项目正式开始

losttransfer.js 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. 
  2. layui.use(['form', 'upload', 'layer', 'jquery', 'laydate'], function () {
  3. var form = layui.form,
  4. layer = parent.layer === undefined ? layui.layer : parent.layer,
  5. $ = layui.jquery,
  6. laydate = layui.laydate
  7. , upload = layui.upload;
  8. //日期
  9. laydate.render({
  10. elem: '#date'
  11. });
  12. //绑定原始文件域
  13. upload.render({
  14. elem: '#test10'
  15. , url: '/LostGoods/UploadFile/'
  16. , done: function (res) {
  17. //如果上传失败
  18. if (res.code > 0) {
  19. return layer.msg(res.msg);
  20. } else {
  21. console.log(res.src)
  22. $("#imgShow").attr('src', res.src);
  23. $("#F_OwerCardPath").val(res.src);
  24. $(".mengban").css('z-index', '-1');
  25. }
  26. //上传成功
  27. }
  28. });
  29. //监听提交
  30. form.on('submit(SubmitData)', function (data) {
  31. //所有表单数据
  32. var dataArr = new Array();
  33. dataArr = data.field;
  34. if (dataArr["types"] == 0) {
  35. if (dataArr["F_RecivedUserID"] == null || dataArr["F_RecivedUserID"] == "") {
  36. layui.layer.alert("接收人不能为空!", {
  37. icon: 3
  38. });
  39. return false;
  40. }
  41. //存放地点
  42. dataArr["F_RecivedUserName"] = $("#F_RecivedUserID").find("option:selected").text();
  43. }
  44. else if (dataArr["types"] == 1) {
  45. if (dataArr["F_OtherDeptName"] == null || dataArr["F_OtherDeptName"] == "") {
  46. layui.layer.alert("单位名称不能为空!", {
  47. icon: 3
  48. });
  49. return false;
  50. }
  51. }
  52. $.ajax({
  53. url: "/LostGoods/SaveLostTransferData",
  54. type: "post",
  55. async: false,//同步请求
  56. contentType: "application/json",
  57. dataType: "text",
  58. cache: false,
  59. data: JSON.stringify(dataArr),
  60. // data: dataArr,
  61. success: function (thisResult, result) {
  62. if (thisResult == "True") {
  63. layer.open({
  64. content: '保存成功'
  65. , btn: ['确定']
  66. , yes: function (index, layero) {
  67. layer.close(index);
  68. ////刷新父窗体
  69. var thisindex = parent.layer.getFrameIndex(window.name); //获取窗口索引
  70. parent.layer.close(thisindex);
  71. }
  72. , cancel: function () {
  73. var thisindex = parent.layer.getFrameIndex(window.name); //获取窗口索引
  74. parent.layer.close(thisindex);
  75. }
  76. });
  77. return false;
  78. } else {
  79. layer.open({
  80. title: '提示'
  81. , content: '保存失败!'
  82. });
  83. return false;
  84. }
  85. },
  86. error: function (error) {
  87. return false;
  88. }
  89. });
  90. return false;
  91. });
  92. form.on('radio(defaultSelect)', function (data) {
  93. if (data.value == 0) {
  94. $(".outdept").css("display", "none");
  95. $(".indept").css("display", "block");
  96. }
  97. else {
  98. $(".outdept").css("display", "block");
  99. $(".indept").css("display", "none");
  100. }
  101. });
  102. //.监听当前 select,动态改变子项
  103. form.on('select(fcoptype)', function (d) {
  104. $.ajax({
  105. url: "/CallRecord/GetDeptUsers",
  106. type: "get",
  107. contentType: "application/json",
  108. dataType: "text",
  109. cache: false,
  110. data: { "deptId": d.value },
  111. success: function (result, status) {
  112. if (status) {
  113. $("#F_RecivedUserID").empty();
  114. $("#F_RecivedUserID").append("<option value='' ></option>");
  115. var list = eval("(" + result + ")");
  116. if (list.length > 0) {
  117. for (var i = 0; i < list.length; i++) {
  118. $("#F_RecivedUserID").append("<option value='" + list[i].F_UserId + "'>" + list[i].F_UserName + "</option>");
  119. }
  120. }
  121. form.render('select');
  122. }
  123. else {
  124. layui.layer.alert("获取该部门下用户信息失败!", {
  125. icon: 2
  126. });
  127. }
  128. }
  129. });
  130. });
  131. })
  132. $('.DicSelect').on('click', function () {
  133. layer.open({
  134. type: 2,
  135. scrollbar: false,
  136. content: '/LostGoods/GetPathInfo',
  137. area: ['700px', '500px'],
  138. id: 'GetPathInfo',
  139. title: '选择'
  140. })
  141. });
  142. function saveParams(code1, name1) {
  143. $("#F_PlaceId").val(code1);
  144. $("#F_PlaceName").val(name1);
  145. }
  146. //关闭当前页
  147. $('.closeThisPage').on('click', function () {
  148. var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
  149. parent.layer.close(index);
  150. });