jsglCtrl.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. "use strict";
  2. //器材信息
  3. angular.module('app.business')
  4. .controller("jsglCtrl", function($scope, $http, $state, $rootScope, jsglService, warehouseService, $stateParams, APP_CONFIG) {
  5. // 获取列表数据
  6. $scope.jslx = $stateParams.jslx;
  7. $scope.ywlx = $stateParams.ywlx;
  8. if ($scope.jslx == "0" && $scope.ywlx == '1') {
  9. $scope.top_title = "入库结算列表";
  10. } else if ($scope.jslx == "1" && $scope.ywlx == '1') {
  11. $scope.top_title = "出库结算列表";
  12. } else {
  13. $scope.top_title = "散粮入库结算列表";
  14. }
  15. $scope.pageInfo = {pageNum : 1, pageSize : 10};
  16. $scope.search = {houseId:null, wareId: null, ywlx: $scope.ywlx};
  17. $scope.loadData = function() {
  18. jsglService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize, $stateParams.jslx, $scope.search).then(function(data){
  19. $scope.pageInfo = data;
  20. },function(data){
  21. console.log(data);
  22. });
  23. }
  24. $scope.loadData();
  25. $scope.loadWare = function(houseId) {
  26. //按照单位获取单位下的仓房信息
  27. if (null == houseId) {
  28. $scope.warehouseList = null;
  29. } else {
  30. var orgId = $rootScope.orgInfo.orgId;
  31. warehouseService.getStorehouse(orgId, houseId, "0").then(function(data){
  32. $scope.warehouseList = data.wareList; //下拉列表数据
  33. },function (data) {
  34. console.log(data);
  35. });
  36. }
  37. }
  38. // 翻页
  39. $scope.goPage = function(pageNum) {
  40. $scope.pageInfo.pageNum = pageNum;
  41. $scope.loadData();
  42. }
  43. /**
  44. * 新增、查看、修改
  45. * jslx: 0是入库,1是出库
  46. */
  47. $scope.edit = function(id, butType) {
  48. if ($scope.ywlx == "0") {
  49. $state.go('app.business.rkjs-sl-list.edit',{id:id, butType:butType, jslx: $stateParams.jslx});
  50. } else {
  51. $state.go('app.business.rkjslist.edit',{id:id, butType:butType, jslx: $stateParams.jslx});
  52. }
  53. }
  54. //删除
  55. $scope.remove = function(id) {
  56. if (!confirm("确定要删除吗?")) {
  57. return;
  58. }
  59. jsglService.remove(id).then(function(data){
  60. $scope.loadData();
  61. },function(data){
  62. console.log(data);
  63. });
  64. }
  65. })
  66. .controller("jsglEditCtrl", function($scope, $http, $filter, $state, $rootScope, $stateParams, $uibModal, APP_CONFIG, jsglService, warehouseService, customerService, commonUtilService) {
  67. var id = $stateParams.id;
  68. var butType = $stateParams.butType;
  69. $scope.jslx = $stateParams.jslx;
  70. if ($scope.jslx == "0") {
  71. $scope.top_title = "入库结算详情";
  72. $scope.sectionHide = true;
  73. } else if ($scope.jslx == "1") {
  74. $scope.top_title = "出库结算详情";
  75. $scope.sectionHide = false;
  76. // 非必填
  77. $scope.isNotHide = true;
  78. }
  79. var isNotEdit = false;//大多数文本框
  80. var isEdit = false;//少数要控制的文本框
  81. $scope.jsgl = {};
  82. // 获取列表数据
  83. $scope.loadData = function() {
  84. jsglService.findBykey($stateParams.id).then(function(data){
  85. $scope.jsgl = data;
  86. $scope.jsgl.orgId = $rootScope.orgInfo.orgId;
  87. $scope.loadWare($scope.jsgl.houseId);
  88. $scope.remarksChange();
  89. if ("" != id) {
  90. if (butType != "show") {
  91. $scope.jsgl.commitPeople = $rootScope.userInfo.realName; // 提交人
  92. $scope.jsgl.commitTime = $filter('date')(new Date(), "yyyy-MM-dd HH:mm:ss");// 提交时间
  93. }
  94. }
  95. },function(data){
  96. console.log(data);
  97. });
  98. }
  99. $scope.loadWare = function(houseId) {
  100. //按照单位获取单位下的仓房信息
  101. var orgId = $rootScope.orgInfo.orgId;
  102. warehouseService.getStorehouse(orgId, houseId, "0").then(function(data){
  103. $scope.warehouseList = data.wareList; //下拉列表数据
  104. },function (data) {
  105. console.log(data);
  106. });
  107. }
  108. if ("" != id) {
  109. if (butType == "show") {//查看
  110. $scope.isNotEdit = true;
  111. $scope.isEdit = true;
  112. } else {
  113. $scope.isEdit = true;
  114. }
  115. $scope.loadData();
  116. } else {
  117. $scope.jsgl.bcjssj = $filter('date')(new Date(), "yyyy-MM-dd HH:mm:ss");
  118. $scope.jsgl.fkdw = $rootScope.orgInfo.orgName;
  119. $scope.jsgl.orgId = $rootScope.orgInfo.orgId;
  120. $scope.jsgl.jslx = $scope.jslx;
  121. $scope.jsgl.fpzt = "1"; //发票状态默认1正常
  122. $scope.jsgl.bcjsfs = "1"; //付款方式默认1转账
  123. $scope.jsgl.ywlx = "1"; //业务类型是非散粮类型
  124. $scope.jsgl.commitPeople = $rootScope.userInfo.realName; // 提交人
  125. $scope.jsgl.commitTime = $filter('date')(new Date(), "yyyy-MM-dd HH:mm:ss");// 提交时间
  126. }
  127. $scope.getReceiveContract = function() {
  128. var params = [];
  129. if ($scope.jslx == "0") {//入库
  130. params.htlx = "0";
  131. // 非字段条件-业务特殊需求(剩余数量为“0”的合同不展示在列表中)
  132. params.surplus = "0";
  133. } else if ($scope.jslx == "1") {//出库
  134. params.htlx = "1";
  135. params.surplus = "1";
  136. } else {
  137. alert("系统异常,请联系管理员!");
  138. return;
  139. }
  140. var uibModalInstance = $uibModal.open({
  141. size:'lg',
  142. templateUrl: 'app/business/deliveryStorageNotice/views/receiveContract-list-modal.html',
  143. controller: 'receiveContractListModalCtrl',
  144. resolve: {
  145. // items是一个回调函数
  146. items: function () {
  147. // 这个值会被模态框的控制器获取到
  148. return params;
  149. }
  150. }
  151. });
  152. uibModalInstance.result.then(function (result) {
  153. if (result != null) {
  154. // 获取明细信息.
  155. $scope.jsgl.htid = result.id;
  156. $scope.jsgl.htbh = result.htbh;
  157. $scope.jsgl.htzsl = result.htzsl;
  158. $scope.jsgl.yjssl = result.yjssl;
  159. $scope.jsgl.houseId = result.houseId;
  160. $scope.jsgl.warehouseId = result.warehouseId;
  161. if (result.warehouseId != null) {
  162. $scope.loadWare(result.houseId);
  163. }
  164. $scope.jsgl.lypz = result.lypz;
  165. $scope.jsgl.mxpz = result.mxpz;
  166. $scope.jsgl.lyxz = result.lyxz;
  167. $scope.jsgl.bcjsdj = result.htdj;
  168. $scope.getCustomer(result.khid);
  169. }
  170. }, function (reason) {
  171. console.log(reason);
  172. });
  173. }
  174. /**
  175. * 获取客户信息
  176. * @param khid 客户ID
  177. */
  178. $scope.getCustomer = function(khid) {
  179. customerService.loadDataById(khid).then(function(data){
  180. $scope.jsgl.customerId = data.id;
  181. // 收付款人赋值客户姓名.
  182. $scope.jsgl.sfkr = data.name;
  183. //开户行名称
  184. $scope.jsgl.khhmc = data.bankName;
  185. //开户行号
  186. $scope.jsgl.khhh = data.khhh;
  187. //银行账号
  188. $scope.jsgl.yhzh = data.accountNumber;
  189. //收付款人身份证号赋值社会信用代码
  190. $scope.jsgl.skrsfzh = data.socialCreditCode;
  191. //付款单位
  192. $scope.jsgl.fkdw = $rootScope.orgInfo.orgName;
  193. }, function (data) {
  194. console.log(data);
  195. });
  196. };
  197. $scope.calculate = function() {
  198. var bcjssl = $scope.jsgl.bcjssl;
  199. var bcjsdj = $scope.jsgl.bcjsdj;
  200. var re = /^([0-9]+.[0-9]{3})[0-9]*/;
  201. if(bcjssl !== undefined && bcjssl !== "" && bcjssl != null) {
  202. bcjssl = bcjssl.toString().replace(re,"$1");
  203. bcjssl = parseFloat(bcjssl);
  204. $scope.jsgl.bcjssl = bcjssl;
  205. } else {
  206. return;
  207. }
  208. if(bcjsdj !== undefined && bcjsdj !== "" && bcjsdj != null) {
  209. bcjsdj = bcjsdj.toString().replace(re,"$1");
  210. bcjsdj = parseFloat(bcjsdj);
  211. $scope.jsgl.bcjsdj = bcjsdj;
  212. } else {
  213. return;
  214. }
  215. /**
  216. *
  217. */
  218. var bcjsje = $scope.jsgl.bcjssl * 1000 * $scope.jsgl.bcjsdj * 1000 / 1000000;
  219. //将v四舍五入,且保留n位小数
  220. $scope.jsgl.bcjsje = commonUtilService.getMath_N(bcjsje, 2);
  221. // 备注必填效验
  222. $scope.remarksChange();
  223. };
  224. // 备注必填效验
  225. $scope.remarksChange = function() {
  226. // 本次结算单价,本次结算金额
  227. if ($scope.jsgl.bcjsdj==='0' || $scope.jsgl.bcjsje==='0' || $scope.jsgl.bcjsje==='0.00') {
  228. // 备注必填
  229. $('#remarks').attr("required", "false");
  230. $scope.isNotHide = false;
  231. } else {
  232. // 非必填
  233. $("#remarks").removeAttr("required");
  234. $scope.isNotHide = true;
  235. }
  236. };
  237. // 返回.
  238. $scope.retList = function () {
  239. if ($rootScope.previousState_name != '') {
  240. $rootScope.back();
  241. } else {
  242. if ($scope.jslx=="0") {
  243. $state.go('app.business.rkjslist');
  244. } else if ($scope.jslx=="1") {
  245. $state.go('app.business.ckjslist');
  246. }
  247. }
  248. }
  249. var validator = $("#jsgl-form").validate();
  250. //保存(0:保存,1:提交)
  251. $scope.save = function(czlx) {
  252. $scope.jsgl.dataStatus = czlx;
  253. var fp_s = $scope.jsgl.fpStart;
  254. var fp_e = $scope.jsgl.fpEnd;
  255. var fps = $scope.jsgl.fps;
  256. var bcjsje_check = $scope.jsgl.bcjsje;
  257. if (bcjsje_check!=0 || bcjsje_check!=0.00) {
  258. if (fp_s == null && fp_e == null && fps == null) {
  259. alert("连续发票号和不连续发票号至少要录入一种,不能都为空值!");
  260. return;
  261. } else {
  262. if ((fp_s == null && fp_e != null) || (fp_s != null && fp_e == null)) {
  263. alert("连续发票号码不能只录入起始值或只录入终止值!");
  264. return;
  265. }
  266. }
  267. }
  268. if ($scope.jsgl.yhzh == null) {
  269. alert("请补全对应客户档案信息!");
  270. return;
  271. }
  272. if (validator.form()) {
  273. //本次结算时间
  274. $("input[name='bcjssj']").each(function(j,item){
  275. if(item.value != '' && item.value != null && typeof item.value != 'undefined'){
  276. $scope.jsgl.bcjssj = $filter('date')(item.value, "yyyy-MM-dd HH:mm:ss");
  277. }
  278. });
  279. jsglService.saveData($scope.jsgl).then(function(data){
  280. if (data.status == "200") {
  281. alert("操作成功!");
  282. } else {
  283. alert("操作失败!");
  284. }
  285. if ($scope.jslx=="0") {
  286. $state.go('app.business.rkjslist');
  287. } else if ($scope.jslx=="1") {
  288. $state.go('app.business.ckjslist');
  289. }
  290. },function(data){
  291. console.log(data);
  292. });
  293. }
  294. }
  295. })
  296. .controller("jsglSlEditCtrl", function($scope, $http, $filter, $state, $rootScope, $stateParams, $uibModal, APP_CONFIG, jsglService, warehouseService, customerService, commonUtilService ) {
  297. var id = $stateParams.id;
  298. var butType = $stateParams.butType;
  299. $scope.jslx = $stateParams.jslx;
  300. if ($scope.jslx == "0") {
  301. $scope.top_title = "入库结算详情";
  302. } else if ($scope.jslx == "1") {
  303. $scope.top_title = "出库结算详情";
  304. }
  305. var isNotEdit = false;//大多数文本框
  306. var isEdit = false;//少数要控制的文本框
  307. $scope.jsgl = {};
  308. // 获取列表数据
  309. $scope.loadData = function() {
  310. jsglService.findBykey($stateParams.id).then(function(data){
  311. $scope.jsgl = data;
  312. $scope.jsgl.orgId = $rootScope.orgInfo.orgId;
  313. $scope.sfkr_list = $scope.jsgl.khxxlist;
  314. $scope.loadWare($scope.jsgl.houseId);
  315. if ("" != id) {
  316. if (butType != "show") {
  317. $scope.jsgl.commitPeople = $rootScope.userInfo.realName; // 提交人
  318. $scope.jsgl.commitTime = $filter('date')(new Date(), "yyyy-MM-dd HH:mm:ss");// 提交时间
  319. }
  320. }
  321. },function(data){
  322. console.log(data);
  323. });
  324. }
  325. $scope.loadWare = function(houseId) {
  326. //按照单位获取单位下的仓房信息
  327. var orgId = $rootScope.orgInfo.orgId;
  328. warehouseService.getStorehouse(orgId, houseId, "0").then(function(data){
  329. $scope.warehouseList = data.wareList; //下拉列表数据
  330. },function (data) {
  331. console.log(data);
  332. });
  333. }
  334. if ("" != id) {
  335. if (butType == "show") {//查看
  336. $scope.isNotEdit = true;
  337. $scope.isEdit = true;
  338. } else {
  339. $scope.isEdit = true;
  340. }
  341. $scope.loadData();
  342. } else {
  343. $scope.jsgl.bcjssj = $filter('date')(new Date(), "yyyy-MM-dd HH:mm:ss");
  344. $scope.jsgl.fkdw = $rootScope.orgInfo.orgName;
  345. $scope.jsgl.orgId = $rootScope.orgInfo.orgId;
  346. $scope.jsgl.jslx = $scope.jslx;
  347. $scope.jsgl.fpzt = "1"; //发票状态默认1正常
  348. $scope.jsgl.bcjsfs = "1"; //付款方式默认1转账
  349. $scope.jsgl.ywlx = "0"; //业务类型是散粮类型
  350. $scope.jsgl.commitPeople = $rootScope.userInfo.realName; // 提交人
  351. $scope.jsgl.commitTime = $filter('date')(new Date(), "yyyy-MM-dd HH:mm:ss");// 提交时间
  352. }
  353. //获取储备粮外面的自建通知单列表
  354. $scope.getDeliveryStorageNotice = function() {
  355. var params = [];
  356. if ($scope.jslx == "0") {//入库
  357. params.billType = "1";//查询入库类型的通知单
  358. } else if ($scope.jslx == "1") {//出库
  359. params.billType = "3";
  360. } else {
  361. alert("系统异常,请联系管理员!");
  362. return;
  363. }
  364. params.orgId = $scope.jsgl.orgId;
  365. var uibModalInstance = $uibModal.open({
  366. size:'lg',
  367. templateUrl: 'app/business/jsgl/views/tzd-zj-model.html',
  368. controller: 'tzdZjCtrl',
  369. resolve: {
  370. // items是一个回调函数
  371. items: function () {
  372. // 这个值会被模态框的控制器获取到
  373. return params;
  374. }
  375. }
  376. });
  377. uibModalInstance.result.then(function (result) {
  378. if (result != null) {
  379. // 获取明细信息.
  380. $scope.jsgl.htid = result.id;
  381. $scope.jsgl.htbh = result.billNumber;
  382. $scope.jsgl.htzsl = parseInt(result.shipingCount);
  383. $scope.jsgl.yjssl = result.yjssl;
  384. $scope.jsgl.houseId = result.houseId;
  385. $scope.jsgl.warehouseId = result.warehouseId;
  386. if (result.warehouseId != null) {
  387. $scope.loadWare(result.houseId);
  388. }
  389. $scope.jsgl.lypz = result.lypz;
  390. $scope.jsgl.mxpz = result.mxpz;
  391. $scope.jsgl.lyxz = result.lyxz;
  392. $scope.jsgl.bcjsdj = result.dj;
  393. //$scope.getCustomer(result.khid);
  394. }
  395. }, function (result) {
  396. console.log(result);
  397. });
  398. }
  399. // 选择收款人信息.
  400. $scope.getSkrData = function(id) {
  401. if ($scope.jsgl.htbh != null) {
  402. var params = [];
  403. params.tzdbh = $scope.jsgl.htbh; //通知单编号
  404. var uibModalInstance = $uibModal.open({
  405. size:'lg',
  406. templateUrl: 'app/business/jsgl/views/crkjl-model-list.html',
  407. controller: 'selectCyrDataModalCtrl',
  408. resolve: {
  409. // items是一个回调函数
  410. items: function () {
  411. // 这个值会被模态框的控制器获取到
  412. return params;
  413. }
  414. }
  415. });
  416. uibModalInstance.result.then(function (result) {
  417. if (result != null) {
  418. $scope.sfkr_list = result;
  419. $scope.jsgl.khxxlist = result;
  420. $scope.jsgl.khxxlist.forEach(obj => {
  421. delete obj.bizno;
  422. delete obj.checked;
  423. });
  424. //计算本次结算数量
  425. var bcjssl = 0;
  426. bcjssl = $scope.sfkr_list.reduce((sum, slkhxx) => sum + slkhxx.crksl, 0);
  427. $scope.jsgl.bcjssl = bcjssl/1000;
  428. $scope.calculate();//计算本次结算金额
  429. }
  430. // 关闭模态框时刷新页面数据
  431. }, function (reason) {
  432. console.log(reason);
  433. });
  434. }
  435. }
  436. $.validator.addMethod("checkKhhh",function(value,element, params) {
  437. var checkNumber = /(^[0-9]{1,12}$)/g;
  438. return this.optional(element)||(checkNumber.test(value));
  439. },"请输入正确的开户行号");
  440. $.validator.addMethod("checkSfzhm",function(value,element, params) {
  441. var checkNumber = /(^\d{18}$)|(^\d{17}(\d|X)$)/g;
  442. return this.optional(element)||(checkNumber.test(value));
  443. },"请输入正确的身份证号码,且不能重复!");
  444. $.validator.addMethod("checkYhzh",function(value,element, params) {
  445. var checkNumber = /^[0-9]{1,30}$/g;
  446. return this.optional(element)||(checkNumber.test(value));
  447. },"请输入正确的银行账号!");
  448. //散粮客户信息保存
  449. $scope.saveKhxx = function(ite) {
  450. if (ite.sfkr != null && ite.skrsfzh != null && ite.sfkr != undefined && ite.skrsfzh != undefined) {
  451. var obj = {};
  452. obj.khmc = ite.sfkr;
  453. obj.sfzhm = ite.skrsfzh;
  454. obj.khhmc = ite.khhmc;
  455. obj.yhhbdm = ite.yhhbdm;
  456. obj.khhh = ite.khhh;
  457. obj.yhzh = ite.yhzh;
  458. jsglService.saveOrUpdateSlkhxx(obj).then(function(data){
  459. if (data.status == "200") {
  460. alert("操作成功!");
  461. } else {
  462. alert("操作失败!");
  463. }
  464. },function(data){
  465. console.log(data);
  466. });
  467. } else {
  468. alert("收款人和身份证号不能为空");
  469. }
  470. }
  471. //点击收款人或身份证号码带出散粮客户信息
  472. $scope.checkSlKhxx = function(ite) {
  473. if (ite.sfkr != null && ite.skrsfzh != null && ite.sfkr != undefined && ite.skrsfzh != undefined) {
  474. jsglService.queryStorageSlkhxx(ite.sfkr, ite.skrsfzh).then(function(data){
  475. if (data.status == "200") {
  476. var slkhxx = data.msg;
  477. ite.khhmc = slkhxx.khhmc;
  478. ite.yhhbdm = slkhxx.yhhbdm;
  479. ite.khhh = slkhxx.khhh;
  480. ite.yhzh = slkhxx.yhzh;
  481. }
  482. },function(data){
  483. console.log(data);
  484. });
  485. }
  486. }
  487. /**
  488. * 计算本次结算金额 = 本次结算数量 * 本次结算单价
  489. * 保留两位小数
  490. */
  491. $scope.calculate = function() {
  492. var bcjssl = $scope.jsgl.bcjssl;
  493. var bcjsdj = $scope.jsgl.bcjsdj;
  494. var re = /^([0-9]+.[0-9]{3})[0-9]*/;
  495. if(bcjssl !== undefined && bcjssl !== "" && bcjssl != null) {
  496. bcjssl = bcjssl.toString().replace(re,"$1");
  497. bcjssl = parseFloat(bcjssl);
  498. $scope.jsgl.bcjssl = bcjssl;
  499. } else {
  500. return;
  501. }
  502. if(bcjsdj !== undefined && bcjsdj !== "" && bcjsdj != null) {
  503. bcjsdj = bcjsdj.toString().replace(re,"$1");
  504. bcjsdj = parseFloat(bcjsdj);
  505. $scope.jsgl.bcjsdj = bcjsdj;
  506. } else {
  507. return;
  508. }
  509. /**
  510. *
  511. */
  512. var bcjsje = $scope.jsgl.bcjssl * 1000 * $scope.jsgl.bcjsdj * 1000 / 1000000;
  513. $scope.jsgl.bcjsje = commonUtilService.getMath(bcjsje);
  514. }
  515. // 返回.
  516. $scope.retList = function () {
  517. if ($rootScope.previousState_name != '') {
  518. $rootScope.back();
  519. } else {
  520. $state.go('app.business.rkjs-sl-list');
  521. }
  522. }
  523. //保存(0:保存,1:提交)
  524. $scope.save = function(czlx) {
  525. $scope.jsgl.dataStatus = czlx;
  526. $scope.isCustomerEdit = $scope.jsgl.bcjsfs=='0'?false:true;
  527. if (null === $scope.jsgl.khxxlist || $scope.jsgl.khxxlist == undefined) {
  528. alert("至少要有一条客户信息!");
  529. return;
  530. }
  531. let sfkr = $scope.jsgl.khxxlist.filter(item => !item.sfkr);
  532. let skrsfzh = $scope.jsgl.khxxlist.filter(item => !item.skrsfzh);
  533. let khhmc = $scope.jsgl.khxxlist.filter(item => !item.khhmc);
  534. let yhzh = $scope.jsgl.khxxlist.filter(item => !item.yhzh);
  535. if ($scope.isCustomerEdit) {//转账
  536. if (sfkr.length != 0 || skrsfzh.length != 0 || khhmc.length != 0 || yhzh.length != 0) {
  537. alert("收款人、身份证号、开户行名称、银行账号不能为空!");
  538. return;
  539. }
  540. } else {
  541. if (sfkr.length != 0 || skrsfzh.length != 0) {
  542. alert("收款人、身份证号不能为空!");
  543. return;
  544. }
  545. }
  546. var validator = $("#jsgl-sl-form").validate();
  547. if (validator.form()) {
  548. //本次结算时间
  549. $("input[name='bcjssj']").each(function(j,item){
  550. if(item.value != '' && item.value != null && typeof item.value != 'undefined'){
  551. $scope.jsgl.bcjssj = $filter('date')(item.value, "yyyy-MM-dd HH:mm:ss");
  552. }
  553. });
  554. jsglService.saveData($scope.jsgl).then(function(data){
  555. if (data.status == "200") {
  556. alert("操作成功!");
  557. } else {
  558. alert("操作失败!");
  559. }
  560. $state.go('app.business.rkjs-sl-list');
  561. },function(data){
  562. console.log(data);
  563. });
  564. }
  565. };
  566. })
  567. .controller("selectCyrDataModalCtrl", function($scope, $uibModalInstance, $filter, $http, $uibModal, $rootScope, jsglService, APP_CONFIG, items) {
  568. $scope.search = {tzdbh: items.tzdbh, cph: null, startTime: null, endTime: null};
  569. // 获取列表数据
  570. $scope.loadData = function() {
  571. var startTime = $("#startTime").val();
  572. var endTime = $("#endTime").val();
  573. $scope.search.startTime = startTime;
  574. $scope.search.endTime = endTime;
  575. jsglService.queryCrkywData($scope.search).then(function(data) {
  576. $scope.list = data;
  577. }).catch(function(data) {
  578. if (data.status == 601) {
  579. // session失效,关闭模态框.
  580. $uibModalInstance.close();
  581. }
  582. });
  583. }
  584. $scope.loadData();
  585. //勾选或取消勾选一条数据
  586. $scope.selectData = function(index, obj) {
  587. $scope.list[index].checked = obj.checked;
  588. if (!obj.checked) {
  589. $scope.checkeds = false;
  590. }
  591. }
  592. // 关闭模态窗口
  593. $scope.cancel = function() {
  594. $uibModalInstance.close();
  595. }
  596. // 选择后点下一步.
  597. $scope.closeModal = function() {
  598. var arr = $scope.list.filter(item => item.checked); //检索被选中的数据
  599. $uibModalInstance.close(arr);
  600. }
  601. });