XMSMZQFX.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. const _Http = getApp().globalData.http,
  2. currency = require("../../../utils/currency"),
  3. CNY = (value, symbol = "¥", precision = 2) => currency(value, {
  4. symbol,
  5. precision
  6. }).format();
  7. Component({
  8. options: {
  9. addGlobalClass: true
  10. },
  11. lifetimes: {
  12. attached: function () {
  13. getApp().globalData.Language.getLanguagePackage(this)
  14. this.setData({
  15. "content.dataid": wx.getStorageSync('userMsg').userid,
  16. "content.username": wx.getStorageSync('userMsg').name,
  17. })
  18. }
  19. },
  20. data: {
  21. "content": {
  22. dataType: "",
  23. where: {
  24. type: "",
  25. tradingstatus: "",
  26. tradefield: "",
  27. grade: "",
  28. sa_projectid: ""
  29. },
  30. pageNumber: 1,
  31. pageSize: 20,
  32. pageTotal: 1
  33. },
  34. grades: [],
  35. tradefields: [],
  36. projecttypes: [],
  37. nodes: [{
  38. remarks: '全部',
  39. value: ''
  40. }, {
  41. remarks: '立项',
  42. value: '立项'
  43. }, {
  44. remarks: '报备',
  45. value: '报备'
  46. }, {
  47. remarks: '报价',
  48. value: '报价'
  49. }, {
  50. remarks: '合同',
  51. value: '合同'
  52. }, {
  53. remarks: '订单',
  54. value: '订单'
  55. }, {
  56. remarks: '结案',
  57. value: '结案'
  58. }],
  59. },
  60. methods: {
  61. async getList() {
  62. let content = this.data.content;
  63. if (this.data.tradefields.length == 0) {
  64. _Http.basic({
  65. "classname": "sysmanage.develop.optiontype.optiontype",
  66. "method": "optiontypeselect",
  67. "content": {
  68. "pageNumber": 1,
  69. "pageSize": 1000,
  70. "typename": "tradefield",
  71. "parameter": {}
  72. },
  73. }).then(res => {
  74. console.log("领域", res)
  75. if (res.code == 1) {
  76. res.data = res.data.map(v => {
  77. v.remarks = v.value
  78. return v
  79. })
  80. res.data.unshift({
  81. remarks: '全部',
  82. value: ''
  83. })
  84. this.setData({
  85. tradefields: res.data
  86. })
  87. }
  88. })
  89. }
  90. if (this.data.projecttypes.length == 0) await _Http.basic({
  91. "classname": "sysmanage.develop.optiontype.optiontype",
  92. "method": "optiontypeselect",
  93. "content": {
  94. "pageNumber": 1,
  95. "pageSize": 1000,
  96. "typename": "projecttype",
  97. "parameter": {}
  98. },
  99. }).then(res => {
  100. console.log("项目类型", res)
  101. if (res.code == 1) {
  102. res.data = res.data.map((v, i) => {
  103. if (i == 0) content.where.projecttype = v.value;
  104. v.remarks = v.value + '-' + getApp().globalData.Language.getMapText(v.remarks)
  105. return v
  106. })
  107. res.data.unshift({
  108. remarks: '全部',
  109. value: ''
  110. })
  111. this.setData({
  112. content,
  113. projecttypes: res.data
  114. })
  115. }
  116. })
  117. if (this.data.grades.length == 0) {
  118. _Http.basic({
  119. "classname": "sysmanage.develop.optiontype.optiontype",
  120. "method": "optiontypeselect",
  121. "content": {
  122. "pageNumber": 1,
  123. "pageSize": 1000,
  124. "typename": "projectgrade",
  125. "parameter": {}
  126. },
  127. }).then(res => {
  128. console.log("项目等级", res)
  129. if (res.code == 1) {
  130. res.data = res.data.map(v => {
  131. v.remarks = v.value + '-' + getApp().globalData.Language.getMapText(v.remarks)
  132. return v
  133. })
  134. res.data.unshift({
  135. remarks: '全部',
  136. value: ''
  137. })
  138. this.setData({
  139. grades: res.data
  140. })
  141. }
  142. })
  143. }
  144. const {
  145. dataid,
  146. type,
  147. username,
  148. isleave
  149. } = getCurrentPages()[getCurrentPages().length - 1].data;
  150. content.dataid = dataid;
  151. content.type = type;
  152. content.username = username;
  153. content.where.isleave = isleave;
  154. _Http.basic({
  155. "id": 20231023092304,
  156. content
  157. }).then(res => {
  158. console.log("项目生命周期分析", res)
  159. if (res.code != '1') return wx.showToast({
  160. title: res.data,
  161. icon: "none"
  162. })
  163. this.setData({
  164. list: res.data.map(v => {
  165. v.bgColor = {
  166. "报备": "#3874F6",
  167. "报价": "#00B32B",
  168. "合同": "#FFAE02",
  169. "订单": "#F53F3F",
  170. } [v.end]
  171. v.tips = {
  172. "报价": "项目报价审核",
  173. "订单": "项目订单审核",
  174. } [v.start] || "项目报备审核"
  175. v.dateavg = v.dateavg.toFixed(2)
  176. return v
  177. })
  178. })
  179. try {
  180. this.selectAllComponents("#Filtrate").forEach(v => v.onCancel())
  181. } catch (error) {}
  182. })
  183. },
  184. changeType1(e) {
  185. this.setData({
  186. [`content.${e.currentTarget.dataset.node}`]: e.detail,
  187. })
  188. this.getList(true)
  189. },
  190. changeType2(e) {
  191. this.setData({
  192. [`content.where.${e.currentTarget.dataset.node}`]: e.detail,
  193. })
  194. this.getList(true)
  195. },
  196. changeType3({
  197. detail
  198. }) {
  199. this.setData({
  200. "content.where.tradefield": detail,
  201. })
  202. this.getList(true)
  203. },
  204. showTips() {
  205. getApp().globalData.Language.showToast('统计项目生命周期中的各个关键节点之间平均周期')
  206. },
  207. toSelectProject({
  208. detail
  209. }) {
  210. if (detail) {
  211. this.setData({
  212. "content.where.sa_projectid": ''
  213. })
  214. this.getList(true);
  215. } else {
  216. _Http.data = JSON.parse(JSON.stringify(this.data));
  217. delete _Http.data.list;
  218. delete _Http.data.language;
  219. delete _Http.data.sColors;
  220. delete _Http.data.nodes;
  221. wx.navigateTo({
  222. url: '/salesPanel/dataOverview/Project/projectList'
  223. })
  224. function selectItem(item) {
  225. this.setData({
  226. "content.where.sa_projectid": item.sa_projectid,
  227. })
  228. this.selectComponent("#Filtrate1").setShowArrText([item.projectname]);
  229. this.getList(true);
  230. wx.navigateBack()
  231. delete _Http.selectItem;
  232. }
  233. _Http.selectItem = selectItem.bind(this);
  234. }
  235. }
  236. }
  237. })