index.js 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. filtrate: false,
  5. content: {
  6. "isExport": 0,
  7. "nocache": true,
  8. "version": 1,
  9. "pageNumber": 1,
  10. "pageSize": 20,
  11. "where": {
  12. "condition": "",
  13. },
  14. "sort": []
  15. }
  16. },
  17. onLoad(options) {
  18. getApp().globalData.Language.getLanguagePackage(this, '公海线索');
  19. this.setData({
  20. "content.type": wx.getStorageSync('templetList')[0].templetid,
  21. insert: wx.getStorageSync('auth').worderclue_public.options.some(v => v == 'insert'), //查询新增权限
  22. allot: wx.getStorageSync('auth').worderclue_public.options.some(v => v == 'allot')
  23. });
  24. this.getList();
  25. let filtratelist = [];
  26. _Http.basic({
  27. "id": 20221223141802,
  28. "content": {
  29. "pageNumber": 1,
  30. "pageSize": 9999,
  31. "where": {
  32. "condition": ""
  33. }
  34. }
  35. }, false).then(res => {
  36. console.log("获取领域", res)
  37. if (res.code == '1') {
  38. filtratelist.push({
  39. label: "领域",
  40. index: null,
  41. showName: "tradefield", //显示字段
  42. valueKey: "tradefield", //返回Key
  43. selectKey: "tradefield", //传参 代表选着字段 不传参返回整个选择对象
  44. value: "", //选中值
  45. list: res.data
  46. })
  47. this.setData({
  48. filtratelist
  49. })
  50. }
  51. })
  52. _Http.basic({
  53. "id": 20221013104401,
  54. "content": {
  55. "nochace": true,
  56. "isExport": 1,
  57. "pageNumber": 1,
  58. sys_systemtagid: 14,
  59. "pageSize": 1000,
  60. "where": {
  61. "condition": ""
  62. }
  63. }
  64. }, false).then(res => {
  65. console.log("获取标签", res)
  66. if (res.code == '1') {
  67. filtratelist.push({
  68. label: "标签",
  69. index: null,
  70. type: "checkbox",
  71. showName: "tag", //显示字段
  72. valueKey: "tag", //返回Key
  73. selectKey: "tag", //传参 代表选着字段 不传参返回整个选择对象
  74. value: "", //选中值
  75. list: res.data
  76. })
  77. this.setData({
  78. filtratelist
  79. })
  80. }
  81. })
  82. _Http.basic({
  83. "classname": "sysmanage.develop.optiontype.optiontype",
  84. "method": "optiontypeselect",
  85. "content": {
  86. "typename": "cluesource"
  87. }
  88. }).then(res => {
  89. console.log("获取来源", res)
  90. if (res.code == '1') {
  91. filtratelist.push({
  92. label: "来源",
  93. index: null,
  94. showName: "value", //显示字段
  95. valueKey: "cluesource", //返回Key
  96. selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
  97. value: "", //选中值
  98. list: res.data
  99. })
  100. this.setData({
  101. filtratelist
  102. })
  103. }
  104. })
  105. },
  106. onClick() {
  107. this.setData({
  108. filtrate: true
  109. })
  110. },
  111. /* 处理筛选 */
  112. handleFilter({
  113. detail
  114. }) {
  115. detail.condition = this.data.content.where.condition;
  116. this.data.content.where = detail;
  117. this.getList(true)
  118. },
  119. /* 获取列表 */
  120. getList(init = false) {
  121. _Http.init(this.data.content, init).then(content => {
  122. _Http.basic({
  123. "id": 20221101094402,
  124. content
  125. }).then(res => {
  126. console.log("公海线索", res)
  127. this.selectComponent('#ListBox').RefreshToComplete();
  128. if (res.code != '1') return wx.showToast({
  129. title: res.data,
  130. icon: "none"
  131. })
  132. this.setData({
  133. content: _Http.paging(content, res),
  134. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  135. loading: false,
  136. })
  137. this.getTags();
  138. })
  139. })
  140. },
  141. /* 处理搜索 */
  142. onSearch({
  143. detail
  144. }) {
  145. this.setData({
  146. "content.where.condition": detail
  147. });
  148. this.getList(true);
  149. },
  150. /* 获取列表标签 */
  151. getTags() {
  152. let list = this.data.list,
  153. ownerids = list.map(v => v.sat_orderclueid);
  154. _Http.basic({
  155. "id": 20221018102001,
  156. "content": {
  157. nocache: true,
  158. "ownertable": "sat_orderclue",
  159. ownerids
  160. }
  161. }).then(res => {
  162. console.log("标签", res)
  163. for (let key in res.data) {
  164. let index = list.findIndex(v => v.sat_orderclueid == key);
  165. list[index].tags = res.data[key]
  166. };
  167. this.setData({
  168. list
  169. })
  170. })
  171. },
  172. /* 去添加 */
  173. openType() {
  174. wx.navigateTo({
  175. url: '/packageA/publicClue/addClue',
  176. })
  177. },
  178. /* 选择添加报价形式 */
  179. typeSelect({
  180. detail
  181. }) {
  182. wx.navigateTo({
  183. url: detail.name == '项目报价' ? '/packageA/offers/addProjectOffer' : '/packageA/offers/addSetclientOffer',
  184. });
  185. this.typeCancel();
  186. }
  187. })