微信小程序
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

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