微信小程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

393 строки
11 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 DISTRIBUTE_ENVIROMENT = 'IMGURL';
  6. let {
  7. URL_PREFIX,
  8. } = EVN_CONFIG[DISTRIBUTE_ENVIROMENT];
  9. const app = getApp();
  10. Page({
  11. /**
  12. * 页面的初始数据
  13. */
  14. data: {
  15. isIPX: app.globalData.isIPX,
  16. active:0,
  17. spsxOptions:[],
  18. nickName:app.globalData.user,
  19. comment:''
  20. },
  21. /**
  22. * 生命周期函数--监听页面加载
  23. */
  24. onLoad: function (options) {
  25. var that = this;
  26. console.log(options);
  27. that.setData({
  28. taskId:options.taskId,
  29. pageType:options.type
  30. })
  31. UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, {
  32. success: (res) => {
  33. if (res.code == API.SUCCESS_CODE) {
  34. that.setData({
  35. ["form.approvalItemTemplate.submitCompany"]:res.user.bookName,
  36. ["form.approvalItemTemplate.submitDate"]:UTIL.js_date_time(new Date()),
  37. ["form.approvalItemTemplate.submitter"]:res.user.nickName,
  38. ["form.approvalItemTemplate.telephone"]:res.user.phonenumber,
  39. nickName:res.user.nickName
  40. })
  41. }
  42. }
  43. })
  44. //所属银行
  45. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'bank_type', {method:'GET'}, {
  46. success: (res) => {
  47. this.setData({
  48. bankTypeOptions:res.data
  49. });
  50. }
  51. })
  52. // 资金支出类别字典查询
  53. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'capital_expenditure_type', {method:'GET'}, {
  54. success: (res) => {
  55. that.setData({
  56. capitalExpenditureTypeOptions:res.data,
  57. })
  58. }
  59. })
  60. // 付款方式类型字典查询
  61. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'transfer_type', {method:'GET'}, {
  62. success: (res) => {
  63. that.setData({
  64. transferTypeOptions:res.data,
  65. })
  66. }
  67. })
  68. // 项目工程列表
  69. UTIL.httpRequest(API.URL_GET_GETPROJECTLIST , {method:'GET'}, {
  70. success: (res) => {
  71. that.setData({
  72. projectOptions:res.rows,
  73. })
  74. }
  75. })
  76. // 工程款类型字典查询
  77. UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'project_fund_type', {method:'GET'}, {
  78. success: (res) => {
  79. that.setData({
  80. projectFundTypeOptions:res.data,
  81. })
  82. }
  83. })
  84. // 获取合同信息列表
  85. UTIL.httpRequest(API.URL_GET_CONTRACTIONLIST , {method:'GET'}, {
  86. success: (res) => {
  87. that.setData({
  88. contractionOptions:res.rows,
  89. })
  90. }
  91. })
  92. UTIL.httpRequest(API.URL_GET_APPROVALITEMS+options.id, {method:'GET'}, {
  93. success: (res) => {
  94. if (res.code == API.SUCCESS_CODE) {
  95. console.log(that.data.capitalExpenditureTypeOptions);
  96. if(res.data.approvalItemTemplate == null){return;}
  97. res.data.transfers.forEach( (item,index) => {
  98. res.data.transfers[index].capitalExpenditureTypeText = UTIL.getTransform(item.capitalExpenditureType,that.data.capitalExpenditureTypeOptions);
  99. res.data.transfers[index].transferTypeText = UTIL.getTransform(item.transferType,that.data.transferTypeOptions);
  100. res.data.transfers[index].bankTypeText = UTIL.getTransform(item.bankType,that.data.bankTypeOptions);
  101. res.data.transfers[index].payeeList.forEach( (response,i) => {
  102. res.data.transfers[index].payeeList[i].bankTypeText = UTIL.getTransform(response.bankType,that.data.bankTypeOptions);
  103. })
  104. UTIL.httpRequest(
  105. API.URL_GET_FINDLIST,
  106. {
  107. method:'GET',
  108. tableName:'t_yinnong_transfer',
  109. tableId:item.id,
  110. fileType:1
  111. },
  112. {
  113. success: (res) => {
  114. let list = [];
  115. res.data.forEach((item2,index2)=>{
  116. wx.downloadFile({
  117. url: URL_PREFIX+item2.fileUrl, //仅为示例,并非真实的资源
  118. success (response) {
  119. if (response.statusCode === 200) {
  120. let fileForm = item.fileForm?item.fileForm:[];
  121. fileForm.push({
  122. file: response.tempFilePath,
  123. fileType:'1',
  124. bizPath:'transfer',
  125. tableName:'t_yinnong_transfer',
  126. tableId:''
  127. })
  128. console.log("--------------fileForm2 start----------------");
  129. console.log(fileForm);
  130. console.log("--------------fileForm2 end----------------");
  131. list.push({
  132. tempFilePath:response.tempFilePath
  133. })
  134. that.setData({
  135. ["form.transfers["+index+"].SJimage"]:list,
  136. ["form.transfers["+index+"].fileForm"]:fileForm
  137. });
  138. }
  139. }
  140. })
  141. })
  142. }
  143. })
  144. //发票
  145. UTIL.httpRequest(
  146. API.URL_GET_FINDLIST,
  147. {
  148. method:'GET',
  149. tableName:'t_yinnong_transfer',
  150. tableId:item.id,
  151. fileType:2
  152. },
  153. {
  154. success: (res) => {
  155. let list = [];
  156. res.data.forEach((item2,index2)=>{
  157. wx.downloadFile({
  158. url: URL_PREFIX+item2.fileUrl, //仅为示例,并非真实的资源
  159. success (response) {
  160. if (response.statusCode === 200) {
  161. let fileForm = item.fileForm?item.fileForm:[];
  162. fileForm.push({
  163. file: response.tempFilePath,
  164. fileType:'2',
  165. bizPath:'transfer',
  166. tableName:'t_yinnong_transfer',
  167. tableId:item.id
  168. })
  169. list.push({
  170. tempFilePath:response.tempFilePath
  171. })
  172. that.setData({
  173. ["form.transfers["+index+"].FPimage"]:list,
  174. ["form.transfers["+index+"].fileForm"]:fileForm
  175. });
  176. }
  177. }
  178. })
  179. })
  180. }
  181. })
  182. //其他
  183. UTIL.httpRequest(
  184. API.URL_GET_FINDLIST,
  185. {
  186. method:'GET',
  187. tableName:'t_yinnong_transfer',
  188. tableId:item.id,
  189. fileType:3
  190. },
  191. {
  192. success: (res) => {
  193. let list = [];
  194. let fileForm = item.fileForm?item.fileForm:[];
  195. res.data.forEach((item2,index2)=>{
  196. wx.downloadFile({
  197. url: URL_PREFIX+item2.fileUrl, //仅为示例,并非真实的资源
  198. success (response) {
  199. if (response.statusCode === 200) {
  200. let fileForm = item.fileForm?item.fileForm:[];
  201. fileForm.push({
  202. file: response.tempFilePath,
  203. fileType:'3',
  204. bizPath:'transfer',
  205. tableName:'t_yinnong_transfer',
  206. tableId:item.id
  207. })
  208. list.push({
  209. tempFilePath:response.tempFilePath
  210. })
  211. that.setData({
  212. ["form.transfers["+index+"].QTimage"]:list,
  213. ["form.transfers["+index+"].fileForm"]:fileForm
  214. });
  215. }
  216. }
  217. })
  218. })
  219. }
  220. })
  221. })
  222. that.setData({
  223. form:res.data
  224. })
  225. }
  226. }
  227. })
  228. // 查询审批事项流转进度
  229. UTIL.httpRequest(API.URL_GET_GETPROCESS+options.id , {method:'GET'}, {
  230. success: (res) => {
  231. console.log(res);
  232. if(res.data.processSchedule != null){
  233. that.setData({spsxOptions:res.data.processSchedule.spsx})
  234. }
  235. that.setData({instanceId:res.data.instanceId})
  236. }
  237. })
  238. // 查询现金审批事项流转进度
  239. UTIL.httpRequest(API.URL_GET_REVIEWPROCESS+options.id , {method:'GET'}, {
  240. success: (res) => {
  241. console.log(res);
  242. if(res.data.processSchedule.spsx){
  243. that.setData({spsxOptions:res.data.processSchedule.spsx})
  244. }
  245. that.setData({instanceId:res.data.instanceId})
  246. }
  247. })
  248. },
  249. goDis(){
  250. var that = this ;
  251. console.log()
  252. let data = {
  253. taskId:that.data.taskId,
  254. instanceId:that.data.instanceId,
  255. variables:JSON.stringify({
  256. comment:that.data.comment == '' ? '驳回':that.data.comment,
  257. pass:false,
  258. }),
  259. method:'POST'
  260. };
  261. UTIL.httpRequest(API.URL_GET_PROCESSCOMPLETE , data, {
  262. success: (res) => {
  263. console.log(res);
  264. if (res.code == API.SUCCESS_CODE) {
  265. wx.showToast({
  266. title: '审批成功',
  267. icon: 'success',
  268. duration: 2000,
  269. complete(){
  270. setTimeout(function(){
  271. that.back();
  272. },2000)
  273. }
  274. })
  275. }else{
  276. wx.showToast({
  277. title: '操作失败',
  278. icon: 'error',
  279. duration: 2000
  280. })
  281. }
  282. }
  283. })
  284. },
  285. goAgree(){
  286. var that = this ;
  287. let data = {
  288. taskId:that.data.taskId,
  289. instanceId:that.data.instanceId,
  290. variables:JSON.stringify({
  291. "comment":that.data.comment == '' ? '同意':that.data.comment,
  292. "pass":true,
  293. }),
  294. method:'POST'
  295. };
  296. UTIL.httpRequest(API.URL_GET_PROCESSCOMPLETE ,data, {
  297. success: (res) => {
  298. console.log(res);
  299. if (res.code == API.SUCCESS_CODE) {
  300. wx.showToast({
  301. title: '审批成功',
  302. icon: 'success',
  303. duration: 2000,
  304. complete(){
  305. setTimeout(function(){
  306. that.back();
  307. },2000)
  308. }
  309. })
  310. }else{
  311. wx.showToast({
  312. title: '操作失败',
  313. icon: 'error',
  314. duration: 2000
  315. })
  316. }
  317. }
  318. })
  319. },
  320. commentInput(e){
  321. console.log(e);
  322. var that = this;
  323. that.setData({
  324. comment:e.detail.value
  325. })
  326. },
  327. /**
  328. * 生命周期函数--监听页面初次渲染完成
  329. */
  330. onReady: function () {
  331. },
  332. /**
  333. * 生命周期函数--监听页面显示
  334. */
  335. onShow: function () {
  336. },
  337. back:function(){
  338. wx.navigateBack({
  339. delta: 1
  340. })
  341. },
  342. /**
  343. * 生命周期函数--监听页面隐藏
  344. */
  345. onHide: function () {
  346. },
  347. /**
  348. * 生命周期函数--监听页面卸载
  349. */
  350. onUnload: function () {
  351. },
  352. /**
  353. * 页面相关事件处理函数--监听用户下拉动作
  354. */
  355. onPullDownRefresh: function () {
  356. },
  357. /**
  358. * 页面上拉触底事件的处理函数
  359. */
  360. onReachBottom: function () {
  361. },
  362. /**
  363. * 用户点击右上角分享
  364. */
  365. onShareAppMessage: function () {
  366. }
  367. })