initiate.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. const _Http = getApp().globalData.http;
  2. let sa_projectid = 0;
  3. import {
  4. formatTime
  5. } from "../../../utils/getTime";
  6. Page({
  7. data: {
  8. disabled: true,
  9. loading: false
  10. },
  11. onLoad(options) {
  12. this.setData({
  13. form: [{
  14. label: "项目名称",
  15. error: false,
  16. errMsg: "",
  17. type: "number",
  18. value: options.projectname,
  19. placeholder: "项目名称",
  20. valueName: "projectname",
  21. checking: "base",
  22. required: true,
  23. disabled: true
  24. }, {
  25. label: "客户名称",
  26. error: false,
  27. errMsg: "",
  28. type: "route",
  29. url: "/packageA/select/setclient/select",
  30. value: "",
  31. params: {
  32. "id": 20221027143702,
  33. "content": {
  34. sa_projectid: options.sa_projectid,
  35. "pageSize": 20,
  36. "where": {
  37. "condition": "",
  38. }
  39. },
  40. },
  41. query: "&radio=true&idname=sys_enterpriseid",
  42. placeholder: "选择客户",
  43. valueName: "sys_enterpriseid",
  44. checking: "base",
  45. required: true
  46. }, {
  47. label: "有效期",
  48. error: false,
  49. errMsg: "",
  50. type: "dateRange",
  51. start: "",
  52. value: ["", ""],
  53. placeholder: ['生效日期', '截止日期'],
  54. valueName: "invaliddate",
  55. checking: "base",
  56. required: true
  57. }]
  58. })
  59. sa_projectid = options.sa_projectid;
  60. },
  61. /* 表单必填项是否完成 */
  62. onConfirm({
  63. detail
  64. }) {
  65. this.setData({
  66. disabled: detail
  67. })
  68. },
  69. cancel() {
  70. wx.showModal({
  71. title: '提示',
  72. content: '是否确定取消发起授权',
  73. complete: (res) => {
  74. if (res.confirm) wx.navigateBack()
  75. }
  76. })
  77. },
  78. preview() {
  79. let data = this.selectComponent("#Form").submit();
  80. _Http.basic({
  81. "id": 20221213094501,
  82. "content": {
  83. "sys_reportid": 104,
  84. "dataid": sa_projectid,
  85. sys_enterpriseid: data.sys_enterpriseid[1][0],
  86. }
  87. }).then(res => {
  88. if (res.msg != '成功') return wx.showToast({
  89. title: res.msg,
  90. icon: "none"
  91. })
  92. let url = `${_Http.baseUrl+res.data}&enterprisename=${data.sys_enterpriseid[0]}&begdate=${data.invaliddate[0]}&enddate=${data.invaliddate[1]}`
  93. wx.navigateTo({
  94. url: `/packageA/project/impower/webview`,
  95. })
  96. this.setData({
  97. url
  98. })
  99. })
  100. },
  101. submit() {
  102. let that = this;
  103. this.setData({
  104. loading: true
  105. })
  106. wx.showModal({
  107. title: '提示',
  108. content: '是否确定发起授权',
  109. complete: ({
  110. confirm
  111. }) => {
  112. if (confirm) {
  113. let data = this.selectComponent("#Form").submit();
  114. _Http.basic({
  115. "id": 20230810161704,
  116. "content": {
  117. sa_projectid,
  118. "begdate": data.invaliddate[0],
  119. "enddate": data.invaliddate[1],
  120. "sys_enterpriseid": data.sys_enterpriseid[1][0]
  121. }
  122. }).then(res => {
  123. console.log("发起授权", res)
  124. that.setData({
  125. loading: false
  126. })
  127. wx.showToast({
  128. title: res.msg != '成功' ? res.msg : "发起成功",
  129. icon: "none"
  130. });
  131. if (res.msg == '成功') return setTimeout(() => {
  132. wx.navigateBack()
  133. }, 500)
  134. })
  135. }
  136. }
  137. })
  138. }
  139. })