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

expenditureAudit.js 11 KiB

3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  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. console.log(that.data.instanceId)
  239. // 查询现金审批事项流转进度
  240. UTIL.httpRequest(API.URL_GET_REVIEWPROCESS+that.data.instanceId , {method:'GET'}, {
  241. success: (res) => {
  242. console.log(res);
  243. if(res.data.processSchedule.spsx){
  244. that.setData({spsxOptions:res.data.processSchedule.spsx})
  245. }
  246. that.setData({instanceId:res.data.instanceId})
  247. }
  248. })
  249. },
  250. goDis(){
  251. var that = this ;
  252. console.log()
  253. let data = {
  254. taskId:that.data.taskId,
  255. instanceId:that.data.instanceId,
  256. variables:JSON.stringify({
  257. comment:that.data.comment == '' ? '驳回':that.data.comment,
  258. pass:false,
  259. }),
  260. method:'POST'
  261. };
  262. UTIL.httpRequest(API.URL_GET_PROCESSCOMPLETE , data, {
  263. success: (res) => {
  264. console.log(res);
  265. if (res.code == API.SUCCESS_CODE) {
  266. wx.showToast({
  267. title: '审批成功',
  268. icon: 'success',
  269. duration: 2000,
  270. complete(){
  271. setTimeout(function(){
  272. that.back();
  273. },2000)
  274. }
  275. })
  276. }else{
  277. wx.showToast({
  278. title: '操作失败',
  279. icon: 'error',
  280. duration: 2000
  281. })
  282. }
  283. }
  284. })
  285. },
  286. goAgree(){
  287. var that = this ;
  288. let data = {
  289. taskId:that.data.taskId,
  290. instanceId:that.data.instanceId,
  291. variables:JSON.stringify({
  292. "comment":that.data.comment == '' ? '同意':that.data.comment,
  293. "pass":true,
  294. }),
  295. method:'POST'
  296. };
  297. UTIL.httpRequest(API.URL_GET_PROCESSCOMPLETE ,data, {
  298. success: (res) => {
  299. console.log(res);
  300. if (res.code == API.SUCCESS_CODE) {
  301. wx.showToast({
  302. title: '审批成功',
  303. icon: 'success',
  304. duration: 2000,
  305. complete(){
  306. setTimeout(function(){
  307. that.back();
  308. },2000)
  309. }
  310. })
  311. }else{
  312. wx.showToast({
  313. title: '操作失败',
  314. icon: 'error',
  315. duration: 2000
  316. })
  317. }
  318. }
  319. })
  320. },
  321. commentInput(e){
  322. console.log(e);
  323. var that = this;
  324. that.setData({
  325. comment:e.detail.value
  326. })
  327. },
  328. /**
  329. * 生命周期函数--监听页面初次渲染完成
  330. */
  331. onReady: function () {
  332. },
  333. /**
  334. * 生命周期函数--监听页面显示
  335. */
  336. onShow: function () {
  337. },
  338. back:function(){
  339. wx.navigateBack({
  340. delta: 1
  341. })
  342. },
  343. /**
  344. * 生命周期函数--监听页面隐藏
  345. */
  346. onHide: function () {
  347. },
  348. /**
  349. * 生命周期函数--监听页面卸载
  350. */
  351. onUnload: function () {
  352. },
  353. /**
  354. * 页面相关事件处理函数--监听用户下拉动作
  355. */
  356. onPullDownRefresh: function () {
  357. },
  358. /**
  359. * 页面上拉触底事件的处理函数
  360. */
  361. onReachBottom: function () {
  362. },
  363. /**
  364. * 用户点击右上角分享
  365. */
  366. onShareAppMessage: function () {
  367. }
  368. })