地铁二期项目正式开始

lostgoodsList.js 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. layui.use('laydate', function () {
  2. var laydate = layui.laydate;
  3. //日期时间范围
  4. laydate.render({
  5. elem: '#test10'
  6. , range: true
  7. });
  8. });
  9. layui.use(['table', 'jquery'], function () {
  10. var table = layui.table;
  11. var form = layui.form,
  12. layer = parent.layer === undefined ? layui.layer : parent.layer,
  13. $ = layui.jquery;
  14. //监听表格复选框选择
  15. table.on('checkbox(demo)', function (obj) {
  16. console.log(obj)
  17. });
  18. //监听工具条
  19. table.on('tool(demo)', function (obj) {
  20. var data = obj.data;
  21. if (obj.event === 'edit') {
  22. if (data.F_Status == 0) {
  23. layer.open({
  24. type: 2,
  25. anim: 4,
  26. scrollbar: false,
  27. content: '/LostGoods/RebackLost/?fid=' + data.F_Id,
  28. area: ['1000px', '600px'],
  29. id: 'RebackLost',
  30. title: '失物归还',
  31. end: function () {
  32. LoadDataList();
  33. }
  34. });
  35. }
  36. else {
  37. layui.layer.alert("不能归还该物品!", {
  38. icon: 3
  39. });
  40. }
  41. }
  42. else if (obj.event === 'view') {
  43. layer.open({
  44. type: 2,
  45. anim: 4,
  46. scrollbar: false,
  47. content: '/LostGoods/LostGoodsView/?fid=' + data.F_Id,
  48. area: ['1000px', '90%'],
  49. id: 'RebackLost',
  50. title: '失物详情',
  51. });
  52. }
  53. });
  54. var $ = layui.$, active = {
  55. //查询按钮
  56. reload: function () {
  57. LoadDataList();
  58. }
  59. //录入
  60. , newadd: function () {
  61. layer.open({
  62. type: 2,
  63. anim: 4,
  64. scrollbar: false,
  65. content: '/LostGoods/LostGoodsRegist',
  66. area: ['1000px', '600px'],
  67. id: 'LostGoodsRegist',
  68. title: '失物录入'
  69. , end: function () {
  70. LoadDataList();
  71. }
  72. });
  73. }
  74. //批量转移
  75. , transfer: function () {
  76. var checkStatus = table.checkStatus('recordtable')
  77. , data = checkStatus.data;
  78. if (data.length == 0) {
  79. layui.layer.alert("请先选中要转移的数据行!", {
  80. icon: 3
  81. });
  82. }
  83. else {
  84. var strId = "";
  85. for (var i = 0; i < data.length; i++) {
  86. if (data[i].F_Status == 0) {
  87. if (i == 0) {
  88. strId += data[i].F_Id;
  89. }
  90. else {
  91. strId += "," + data[i].F_Id;
  92. }
  93. }
  94. else {
  95. layui.layer.alert("不能转移其他状态的物品!", {
  96. icon: 3
  97. });
  98. return;
  99. }
  100. }
  101. //判断是否包含有需要转移的数据
  102. if (strId != "") {
  103. layer.open({
  104. type: 2,
  105. anim: 4,
  106. scrollbar: false,
  107. content: '/LostGoods/LostTransfer/?keyList=' + strId,
  108. area: ['500px', '500px'],
  109. id: 'LostGoodsRegist',
  110. title: '失物转移'
  111. , end: function () {
  112. LoadDataList();
  113. }
  114. });
  115. }
  116. else {
  117. layui.layer.alert("请先选中要转移的数据行!", {
  118. icon: 3
  119. });
  120. }
  121. }
  122. }
  123. //批量撤回
  124. , reback: function () {
  125. var checkStatus = table.checkStatus('recordtable')
  126. , data = checkStatus.data;
  127. if (data.length == 0) {
  128. layui.layer.alert("请先选中要操作的数据行!", {
  129. icon: 3
  130. });
  131. }
  132. else {
  133. var strId = "";
  134. for (var i = 0; i < data.length; i++) {
  135. if (data[i].F_Status == 1) {
  136. if (i == 0) {
  137. strId += data[i].rowKey;
  138. }
  139. else {
  140. strId += "," + data[i].rowKey;
  141. }
  142. }
  143. else {
  144. layui.layer.alert("不能撤回其他状态的物品!", {
  145. icon: 3
  146. });
  147. return;
  148. }
  149. }
  150. layer.confirm('确认要撤销选中行的数据?', function (index) {
  151. $.ajax({
  152. url: "/LostGoods/SaveReceivedData",
  153. type: "get",
  154. async: false,//同步请求
  155. contentType: "application/json",
  156. dataType: "text",
  157. cache: false,
  158. data: "keyList=" + strId + "&status=3",
  159. success: function (thisResult, result) {
  160. if (thisResult == "True") {
  161. layer.open({
  162. content: '操作成功'
  163. , icon: 1
  164. , btn: ['确定']
  165. , yes: function (index, layero) {
  166. LoadDataList();
  167. layer.close(index);
  168. }
  169. });
  170. } else {
  171. layui.layer.alert("撤销失败!", {
  172. icon: 2
  173. });
  174. }
  175. },
  176. error: function (error) {
  177. return false;
  178. }
  179. });
  180. layer.close(index);
  181. });
  182. }
  183. }
  184. //批量销毁
  185. , redelete: function () {
  186. var checkStatus = table.checkStatus('recordtable')
  187. , data = checkStatus.data;
  188. if (data.length == 0) {
  189. layui.layer.alert("请先选中要操作的数据行!", {
  190. icon: 3
  191. });
  192. }
  193. else {
  194. var strId = "";
  195. for (var i = 0; i < data.length; i++) {
  196. if (data[i].F_Status == 0) {
  197. if (i == 0) {
  198. strId += data[i].F_Id;
  199. }
  200. else {
  201. strId += "," + data[i].F_Id;
  202. }
  203. }
  204. else {
  205. layui.layer.alert("不能销毁其他状态的物品!", {
  206. icon: 3
  207. });
  208. return;
  209. }
  210. if (data[i].F_PropertyId == 546) {
  211. layui.layer.alert("常规物品不能销毁!", {
  212. icon: 3
  213. });
  214. return;
  215. }
  216. }
  217. layer.confirm('确认要销毁选中行的数据?', function (index) {
  218. $.ajax({
  219. url: "/LostGoods/LostDelete",
  220. type: "get",
  221. async: false,//同步请求
  222. contentType: "application/json",
  223. dataType: "text",
  224. cache: false,
  225. data: "keyList=" + strId,
  226. success: function (thisResult, result) {
  227. if (thisResult == "True") {
  228. layer.open({
  229. content: '操作成功'
  230. , icon: 1
  231. , btn: ['确定']
  232. , yes: function (index, layero) {
  233. LoadDataList();
  234. layer.close(index);
  235. }
  236. });
  237. } else {
  238. layui.layer.alert("销毁失败!", {
  239. icon: 2
  240. });
  241. }
  242. },
  243. error: function (error) {
  244. return false;
  245. }
  246. });
  247. layer.close(index);
  248. });
  249. }
  250. }
  251. };
  252. function LoadDataList() {
  253. //执行重载
  254. table.reload('recordtable', {
  255. page: {
  256. curr: 1 //重新从第 1 页开始
  257. }
  258. , where: {
  259. NowDateTime: new Date()
  260. , getDate: $("#test10").val()
  261. , goodsName: $("#goodsName").val()
  262. , goodsProty: $("#goodsProty").val()
  263. , goodsKinds: $("#goodsKinds").val()
  264. , getPlace: $("#getPlace").val()
  265. , getDetail: $("#getDetail").val()
  266. , goodsStatus: $("#goodsStatus").val()
  267. }
  268. });
  269. }
  270. //回车执行
  271. document.onkeydown = function (event) {
  272. var e = event || window.event || arguments.callee.caller.arguments[0];
  273. if (e && e.keyCode == 13) {
  274. LoadDataList();
  275. }
  276. };
  277. $('.searchfilter .layui-btn').on('click', function () {
  278. var type = $(this).data('type');
  279. active[type] ? active[type].call(this) : '';
  280. });
  281. //高级查询折叠
  282. $('#advanceBtn').on('click', function () {
  283. $('.collapsible_box').slideToggle(200);
  284. })
  285. });