微信小程序
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.

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