微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

704 lines
20 KiB

  1. // pages/handle/expenditureAudit/expenditureAudit.js
  2. import * as UTIL from '../../../utils/util.js';
  3. import * as API from '../../../utils/API.js';
  4. let EVN_CONFIG = require('../../../env/env');
  5. const app = getApp();
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. isIPX: app.globalData.isIPX,
  12. active:0,
  13. spsxOptions:[],
  14. paymentPatternOptions:[],
  15. transferStatusOptions:[],
  16. nickName:'',
  17. comment:'',
  18. activeNames: 0,
  19. transferTypeOption:[
  20. {
  21. dictLabel:'银行转账',
  22. dictValue:'1'
  23. },
  24. {
  25. dictLabel:'信用卡转账',
  26. dictValue:'2'
  27. }
  28. ],
  29. showSteps:false,
  30. activeStepsNames:''
  31. },
  32. showS(){
  33. this.setData({
  34. showSteps:!this.data.showSteps,
  35. })
  36. },
  37. /**
  38. * 生命周期函数--监听页面加载
  39. */
  40. onLoad: function (options) {
  41. var that = this;
  42. that.setData({
  43. taskId:options.taskId,
  44. pageType:options.type
  45. })
  46. wx.showLoading({
  47. title: '正在加载模板',
  48. mask:true
  49. })
  50. //所属银行
  51. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, {
  52. success: (res) => {
  53. this.setData({
  54. bankTypeOptions:res.data
  55. });
  56. }
  57. })
  58. //所属银行
  59. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'transfer_status', {method:'GET'}, {
  60. success: (res) => {
  61. this.setData({
  62. transferStatusOptions:res.data
  63. });
  64. }
  65. })
  66. //所属银行
  67. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'audit_status', {method:'GET'}, {
  68. success: (res) => {
  69. }
  70. })
  71. // 资金支出类别字典查询
  72. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'capital_expenditure_type', {method:'GET'}, {
  73. success: (res) => {
  74. that.setData({
  75. capitalExpenditureTypeOptions:res.data,
  76. })
  77. }
  78. })
  79. // 汇票列表查询
  80. UTIL.httpRequest(API.URL_GET_GETMONEYORDERLIST, {method:'GET'}, {
  81. success: (res) => {
  82. that.setData({
  83. moneyOrderOptions:res.rows,
  84. })
  85. }
  86. })
  87. // 付款方式类型字典查询 (2.0)
  88. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'yn_pay_type', {method:'GET'}, {
  89. success: (res) => {
  90. that.setData({
  91. transferTypeOptions:res.data,
  92. })
  93. }
  94. })
  95. // 项目工程列表
  96. UTIL.httpRequest(API.URL_GET_GETPROJECTLIST , {method:'GET'}, {
  97. success: (res) => {
  98. that.setData({
  99. projectOptions:res.rows,
  100. })
  101. }
  102. })
  103. // 工程款类型字典查询
  104. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'project_fund_type', {method:'GET'}, {
  105. success: (res) => {
  106. that.setData({
  107. projectFundTypeOptions:res.data,
  108. })
  109. }
  110. })
  111. // 获取合同信息列表
  112. UTIL.httpRequest(API.URL_GET_CONTRACTIONLIST , {method:'GET',contractionStatus:1}, {
  113. success: (res) => {
  114. that.setData({
  115. contractionOptions:res.rows,
  116. })
  117. }
  118. })
  119. let templateQueryParams = {
  120. // 分页
  121. method:'GET',
  122. pageNum: 1,
  123. pageSize: 999,
  124. type:'1'
  125. };
  126. // 审批流程列表
  127. UTIL.httpRequest(API.URL_GET_TEMPLATELIST , templateQueryParams, {
  128. success: (res) => {
  129. that.setData({
  130. approvalTemplateNameOptions:res.rows,
  131. ["form.approvalTemplateId"]:res.rows[0].id,
  132. ["form.approvalTemplateName"]:res.rows[0].name,
  133. })
  134. }
  135. })
  136. UTIL.showLoadingHaveMask();
  137. var perames = {
  138. pageNum:1,
  139. pageSize:999,
  140. accountType:'102',
  141. method:'POST'
  142. }
  143. // 付款方列表
  144. UTIL.httpRequest(API.URL_GET_SELECTACCOUNTLIST , perames, {
  145. success: (res) => {
  146. console.log(res);
  147. that.setData({
  148. accountOptions:res.rows,
  149. })
  150. }
  151. })
  152. setTimeout(function(){
  153. UTIL.httpRequest(API.URL_GET_APPROVALITEMS+options.id, {method:'GET'}, {
  154. success: (res) => {
  155. if (res.code == API.SUCCESS_CODE) {
  156. // 审批模板
  157. UTIL.httpRequest(API.URL_GET_selectApprovalByTemplateId+res.data.approvalTemplateId, {method:'GET'}, {
  158. success: (rres) => {
  159. that.setData({
  160. steps:rres.approvalDetails
  161. })
  162. }
  163. })
  164. res.data.capitalExpenditureTypeText = UTIL.getTransform(res.data.capitalExpenditureType,that.data.capitalExpenditureTypeOptions);
  165. res.data.transferTypeText = UTIL.getTransform(res.data.transferType,that.data.transferTypeOption);
  166. if(res.data.capitalExpenditureType == 2){
  167. let prames = {
  168. outId:res.data.id,
  169. ynType: res.data.transferType=='1'||res.data.transferType=='2'||res.data.transferType=='4'?'1':'2'
  170. }
  171. // 工程项目查询
  172. UTIL.httpRequest(API.URL_GET_GETPROJECTTO , prames, {
  173. success: (res) => {
  174. res.data.projectFundTypeText = UTIL.getTransform(res.data.projectFundType,that.data.projectFundTypeOptions);
  175. that.setData({
  176. ["form.projectForm"]:res.data,
  177. })
  178. }
  179. })
  180. }
  181. if(res.data.capitalExpenditureType == 4){
  182. let prames = {
  183. transferId:res.data.id,
  184. }
  185. // 关联合同查询
  186. UTIL.httpRequest(API.URL_GET_GETSELECTINFOBYOUTID , prames, {
  187. success: (res) => {
  188. that.setData({
  189. ["form.contractionForm"]:res.data,
  190. })
  191. }
  192. })
  193. }
  194. that.setData({
  195. ["form.fileNum"]:0,
  196. })
  197. UTIL.httpRequest(
  198. API.URL_GET_FINDLIST,
  199. {
  200. method:'GET',
  201. tableName:'t_yinnong_transfer',
  202. tableId:res.data.id,
  203. fileType:1
  204. },
  205. {
  206. success: (res) => {
  207. let list = [];
  208. res.data.forEach((item2,index2)=>{
  209. let fileForm = res.data.fileForm?res.data.fileForm:[];
  210. fileForm.push({
  211. file: wx.getStorageSync('dressCode')+item2.fileUrl,
  212. fileType:'1',
  213. bizPath:'transfer',
  214. tableName:'t_yinnong_transfer',
  215. tableId:''
  216. })
  217. list.push({
  218. tempFilePath:wx.getStorageSync('dressCode')+item2.fileUrl,
  219. id:item2.id
  220. })
  221. that.setData({
  222. ["form.fileNum"]:that.data.form.fileNum+1,
  223. ["form.SJimage"]:list,
  224. ["form.fileForm"]:fileForm
  225. });
  226. })
  227. }
  228. })
  229. //发票
  230. UTIL.httpRequest(
  231. API.URL_GET_FINDLIST,
  232. {
  233. method:'GET',
  234. tableName:'t_yinnong_transfer',
  235. tableId:res.data.id,
  236. fileType:2
  237. },
  238. {
  239. success: (res) => {
  240. let list = [];
  241. res.data.forEach((item2,index2)=>{
  242. let fileForm = res.data.fileForm?res.data.fileForm:[];
  243. fileForm.push({
  244. file: wx.getStorageSync('dressCode')+item2.fileUrl,
  245. fileType:'2',
  246. bizPath:'transfer',
  247. tableName:'t_yinnong_transfer',
  248. tableId:res.data.id
  249. })
  250. list.push({
  251. tempFilePath:wx.getStorageSync('dressCode')+item2.fileUrl,
  252. id:item2.id
  253. })
  254. that.setData({
  255. ["form.fileNum"]:that.data.form.fileNum+1,
  256. ["form.FPimage"]:list,
  257. ["form.fileForm"]:fileForm
  258. });
  259. })
  260. }
  261. })
  262. //其他
  263. UTIL.httpRequest(
  264. API.URL_GET_FINDLIST,
  265. {
  266. method:'GET',
  267. tableName:'t_yinnong_transfer',
  268. tableId:res.data.id,
  269. fileType:3
  270. },
  271. {
  272. success: (res) => {
  273. let list = [];
  274. res.data.forEach((item2,index2)=>{
  275. let fileForm = res.data.fileForm?res.data.fileForm:[];
  276. fileForm.push({
  277. file: wx.getStorageSync('dressCode')+item2.fileUrl,
  278. fileType:'3',
  279. bizPath:'transfer',
  280. tableName:'t_yinnong_transfer',
  281. tableId:res.data.id
  282. })
  283. list.push({
  284. tempFilePath:wx.getStorageSync('dressCode')+item2.fileUrl,
  285. id:item2.id
  286. })
  287. that.setData({
  288. ["form.fileNum"]:that.data.form.fileNum+1,
  289. ["form.QTimage"]:list,
  290. ["form.fileForm"]:fileForm
  291. });
  292. })
  293. }
  294. })
  295. //四议两公开
  296. UTIL.httpRequest(
  297. API.URL_GET_FINDLIST,
  298. {
  299. method:'GET',
  300. tableName:'t_yinnong_transfer',
  301. tableId:res.data.id,
  302. fileType:4
  303. },
  304. {
  305. success: (res) => {
  306. let list = [];
  307. res.data.forEach((item2,index2)=>{
  308. let fileForm = res.data.fileForm?res.data.fileForm:[];
  309. fileForm.push({
  310. file: wx.getStorageSync('dressCode')+item2.fileUrl,
  311. fileType:'4',
  312. bizPath:'transfer',
  313. tableName:'t_yinnong_transfer',
  314. tableId:res.data.id
  315. })
  316. list.push({
  317. tempFilePath:wx.getStorageSync('dressCode')+item2.fileUrl,
  318. id:item2.id
  319. })
  320. that.setData({
  321. ["form.fileNum"]:that.data.form.fileNum+1,
  322. ["form.SYLGKimage"]:list,
  323. ["form.fileForm"]:fileForm
  324. });
  325. })
  326. }
  327. })
  328. let query = {
  329. method:'GET',
  330. // accountType:res.data.accountType,
  331. // status:"0",
  332. // orderByColumn: "id",
  333. // isAsc: "desc",
  334. }
  335. UTIL.httpRequest(API.URL_GET_TRANSFERINFOS+options.id, query, {
  336. success: (response) => {
  337. if (res.code == API.SUCCESS_CODE) {
  338. for(let i = 0 ; i < response.rows.length ; i++){
  339. response.rows[i].bankTypeText = UTIL.getTransform(response.rows[i].bankType,that.data.bankTypeOptions);
  340. response.rows[i].transferStatusText = UTIL.getTransform(response.rows[i].transferStatus,that.data.transferStatusOptions);
  341. }
  342. that.setData({
  343. ["form.payeeList"]:response.rows
  344. })
  345. }
  346. }
  347. })
  348. that.setData({
  349. form:res.data,
  350. isUpdate:true,
  351. showFile:true,
  352. activeNames:null
  353. })
  354. UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, {
  355. success: (res) => {
  356. if (res.code == API.SUCCESS_CODE) {
  357. that.setData({
  358. ["form.approvalItemTemplate.submitCompany"]:res.user.bookName,
  359. ["form.approvalItemTemplate.submitDate"]:UTIL.js_date_time(new Date()),
  360. ["form.approvalItemTemplate.submitter"]:res.user.nickName,
  361. ["form.approvalItemTemplate.telephone"]:res.user.phonenumber,
  362. })
  363. }
  364. }
  365. })
  366. // 查询审批事项流转进度
  367. UTIL.httpRequest(API.URL_GET_GETPROCESSNEW+options.id , {method:'GET'}, {
  368. success: (res) => {
  369. console.log(res);
  370. for (let i = 0; i < res.data.length; i++) {
  371. const element = res.data.processSchedule.审批事项[i];
  372. if (element.electronicSignature!=null) {
  373. element.electronicSignature = wx.getStorageSync('dressCode')+element.electronicSignature;
  374. }
  375. }
  376. const arr = [];
  377. for (let key in res.data) {
  378. if (res.data.hasOwnProperty(key)) { // 确保键在对象自身上,而不是从原型链继承
  379. for (let i = 0; i < res.data[key].length; i++) {
  380. const element = res.data[key][i];
  381. console.log(`Key: ${key}, Value: ${res.data[key][i].electronicSignature}`);
  382. if (element.electronicSignature!=null) {
  383. element.electronicSignature = wx.getStorageSync('dressCode')+element.electronicSignature;
  384. }
  385. }
  386. arr.push([key,res.data[key]])
  387. // that.setData({instanceId:res.data.instanceId})
  388. }
  389. }
  390. that.setData({spsxOptions:arr})
  391. // if(options.business == 'xj'){
  392. // console.log(that.data.instanceId)
  393. // // 查询现金审批事项流转进度
  394. // UTIL.httpRequest(API.URL_GET_REVIEWPROCESS+that.data.instanceId , {method:'GET'}, {
  395. // success: (res) => {
  396. // console.log(res);
  397. // if(res.data.processSchedule.审批事项){
  398. // that.setData({spsxOptions:res.data.processSchedule.审批事项})
  399. // }
  400. // that.setData({instanceId:res.data.instanceId})
  401. // }
  402. // })
  403. // }
  404. }
  405. })
  406. UTIL.hideLoadingHaveMask();
  407. }
  408. }
  409. })
  410. },1000)
  411. },
  412. onChangePayee(event) {
  413. console.log(event);
  414. this.setData({
  415. ["form.transfers["+event.currentTarget.dataset.index+"].activeName"]:event.detail
  416. });
  417. },
  418. onClosePayee(event){
  419. console.log("aaa");
  420. this.setData({
  421. ["form.transfers["+event.currentTarget.dataset.index+"].activeName"]:''
  422. });
  423. console.log(this.data.form.transfers[event.currentTarget.dataset.index]);
  424. },
  425. goDis(){
  426. var that = this ;
  427. console.log()
  428. let data = {
  429. taskId:that.data.taskId,
  430. instanceId:that.data.instanceId,
  431. variables:JSON.stringify({
  432. comment:that.data.comment == '' ? '驳回':that.data.comment,
  433. pass:false,
  434. }),
  435. method:'POST'
  436. };
  437. UTIL.httpRequest(API.URL_GET_PROCESSCOMPLETE , data, {
  438. success: (res) => {
  439. console.log(res);
  440. if (res.code == API.SUCCESS_CODE) {
  441. wx.showToast({
  442. title: '审批成功',
  443. icon: 'success',
  444. duration: 2000,
  445. complete(){
  446. setTimeout(function(){
  447. that.back();
  448. },2000)
  449. }
  450. })
  451. }else{
  452. wx.showToast({
  453. title: '操作失败',
  454. icon: 'error',
  455. duration: 2000
  456. })
  457. }
  458. }
  459. })
  460. },
  461. goAgree(){
  462. var that = this ;
  463. let data = {
  464. taskId:that.data.taskId,
  465. instanceId:that.data.instanceId,
  466. variables:JSON.stringify({
  467. "comment":that.data.comment == '' ? '同意':that.data.comment,
  468. "pass":true,
  469. }),
  470. method:'POST'
  471. };
  472. UTIL.httpRequest(API.URL_GET_PROCESSCOMPLETE ,data, {
  473. success: (res) => {
  474. console.log(res);
  475. if (res.code == API.SUCCESS_CODE) {
  476. wx.showToast({
  477. title: '审批成功',
  478. icon: 'success',
  479. duration: 2000,
  480. complete(){
  481. setTimeout(function(){
  482. that.back();
  483. },2000)
  484. }
  485. })
  486. }else{
  487. wx.showToast({
  488. title: '操作失败',
  489. icon: 'error',
  490. duration: 2000
  491. })
  492. }
  493. }
  494. })
  495. },
  496. goAgreeNew(){//2024-7-15审批功能修改 字段名称、接口地址、请求参数格式发生变动
  497. var that = this ;
  498. let data = {
  499. taskId:that.data.taskId,
  500. auditbatchNo:that.data.form.auditbatchNo,
  501. pass:true,
  502. remark:that.data.comment == '' ? '同意':that.data.comment,
  503. deptId:JSON.parse(wx.getStorageSync('user')).deptId,
  504. method:'POST'
  505. };
  506. console.log(data);
  507. UTIL.httpRequest(API.A_audit ,data, {
  508. success: (res) => {
  509. console.log(res);
  510. if (res.code == API.SUCCESS_CODE) {
  511. wx.showToast({
  512. title: '审批成功',
  513. icon: 'success',
  514. duration: 2000,
  515. complete(){
  516. setTimeout(function(){
  517. that.back();
  518. },2000)
  519. }
  520. })
  521. }else{
  522. wx.showToast({
  523. title: '操作失败',
  524. icon: 'error',
  525. duration: 2000
  526. })
  527. }
  528. }
  529. })
  530. },
  531. goDisNew(){//2024-7-15审批功能修改 字段名称、接口地址、请求参数格式发生变动
  532. var that = this ;
  533. let data = {
  534. taskId:that.data.taskId,
  535. auditbatchNo:that.data.form.auditbatchNo,
  536. pass:false,
  537. remark:that.data.comment == '' ? '驳回':that.data.comment,
  538. deptId:JSON.parse(wx.getStorageSync('user')).deptId,
  539. method:'POST'
  540. };
  541. console.log(data);
  542. UTIL.httpRequest(API.A_audit ,data, {
  543. success: (res) => {
  544. console.log(res);
  545. if (res.code == API.SUCCESS_CODE) {
  546. wx.showToast({
  547. title: '审批成功',
  548. icon: 'success',
  549. duration: 2000,
  550. complete(){
  551. setTimeout(function(){
  552. that.back();
  553. },2000)
  554. }
  555. })
  556. }else{
  557. wx.showToast({
  558. title: '操作失败',
  559. icon: 'error',
  560. duration: 2000
  561. })
  562. }
  563. }
  564. })
  565. },
  566. commentInput(e){
  567. console.log(e);
  568. var that = this;
  569. that.setData({
  570. comment:e.detail.value
  571. })
  572. },
  573. onChangeBox(event) {
  574. console.log(event);
  575. this.setData({
  576. activeNames: event.detail,
  577. });
  578. },
  579. onCloseSecond(e){
  580. var that = this ;
  581. console.log(e);
  582. that.setData({
  583. ["form.showTitle"]:false
  584. })
  585. },
  586. onChangeSteps(event) {
  587. console.log(event);
  588. this.setData({
  589. activeStepsNames:event.detail
  590. });
  591. },
  592. onCloseSteps(event){
  593. console.log("aaa");
  594. this.setData({
  595. activeStepsNames:''
  596. });
  597. },
  598. onOpen(e){
  599. var that = this ;
  600. that.setData({
  601. ["form.showTitle"]:true
  602. })
  603. },
  604. openPreview(e){
  605. let array = [];
  606. console.log(e);
  607. e.currentTarget.dataset.option.forEach(item=>{
  608. array.push(item.tempFilePath)
  609. })
  610. console.log(array);
  611. wx.previewImage({
  612. urls: array,
  613. showmenu:true,
  614. current:array[e.currentTarget.dataset.index]
  615. })
  616. },
  617. goPayee(event){
  618. wx.navigateTo({
  619. url: '/pages/pay/payee/payee?options='+JSON.stringify(event.currentTarget.dataset.option)
  620. })
  621. },
  622. /**
  623. * 生命周期函数--监听页面初次渲染完成
  624. */
  625. onReady: function () {
  626. },
  627. /**
  628. * 生命周期函数--监听页面显示
  629. */
  630. onShow: function () {
  631. },
  632. back:function(){
  633. wx.navigateBack({
  634. delta: 1
  635. })
  636. },
  637. /**
  638. * 生命周期函数--监听页面隐藏
  639. */
  640. onHide: function () {
  641. },
  642. /**
  643. * 生命周期函数--监听页面卸载
  644. */
  645. onUnload: function () {
  646. },
  647. /**
  648. * 页面相关事件处理函数--监听用户下拉动作
  649. */
  650. onPullDownRefresh: function () {
  651. },
  652. /**
  653. * 页面上拉触底事件的处理函数
  654. */
  655. onReachBottom: function () {
  656. },
  657. /**
  658. * 用户点击右上角分享
  659. */
  660. onShareAppMessage: function () {
  661. }
  662. })