index.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. navList: [{
  5. label: "我负责的",
  6. icon: "icon-webxialaxuanxiangjiantou",
  7. color: "",
  8. width: "",
  9. id: "1"
  10. }, {
  11. label: "排序",
  12. icon: "icon-jiangxu1",
  13. color: "",
  14. width: "",
  15. id: "sort"
  16. }, {
  17. label: "筛选",
  18. icon: "icon-shaixuan",
  19. color: "",
  20. width: "",
  21. id: "2"
  22. }],
  23. content: {
  24. "pageNumber": 1,
  25. "pageSize": 20,
  26. "where": {
  27. "condition": "",
  28. "status": "",
  29. "type": "",
  30. "begindate": "", //申请日期
  31. "enddate": "", //申请日期
  32. "begindate2": "", //发货日期
  33. "enddate2": "" //发货日期
  34. },
  35. },
  36. filtratelist: [],
  37. list: []
  38. },
  39. async onLoad(options) {
  40. getApp().globalData.Language.getLanguagePackage(this);
  41. let templetList = wx.getStorageSync('templetList')
  42. this.setData({
  43. insert: wx.getStorageSync('auth').wTrialApplication.options.some(v => v == 'insert'), //查询新增权限
  44. classActions: templetList.map((v, i) => {
  45. return {
  46. name: v.templetname,
  47. index: v.templetid,
  48. color: i == 0 ? '#3874F6' : '',
  49. i: i,
  50. }
  51. }),
  52. 'navList[0].label': templetList[0].templetname,
  53. "content.type": templetList[0].templetid,
  54. });
  55. this.getList(true)
  56. getApp().globalData.Language.getLanguagePackage(this);
  57. let filter = [{
  58. label: "状态",
  59. index: null,
  60. showName: "value", //显示字段
  61. valueKey: "status", //返回Key
  62. selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
  63. value: "", //选中值
  64. list: [{
  65. value: '新建'
  66. }, {
  67. value: '审核'
  68. }]
  69. }, {
  70. label: "试用类型",
  71. index: null,
  72. showName: "value", //显示字段
  73. valueKey: "type", //返回Key
  74. selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
  75. value: "", //选中值
  76. list: await _Http.getTypes('testtype', _Http)
  77. }]
  78. this.setData({
  79. filter
  80. })
  81. },
  82. getList(init = false) {
  83. _Http.init(this.data.content, init).then(content => {
  84. _Http.basic({
  85. "id": 2025110710350702,
  86. content
  87. }).then(res => {
  88. console.log("安装列表", res)
  89. this.selectComponent('#ListBox').RefreshToComplete();
  90. if (res.code != '1') return wx.showToast({
  91. title: res.msg,
  92. icon: "none"
  93. })
  94. this.setData({
  95. content: _Http.paging(content, res),
  96. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
  97. })
  98. })
  99. })
  100. },
  101. /* 处理筛选 */
  102. handleFilter({
  103. detail
  104. }) {
  105. detail.condition = this.data.content.where.condition;
  106. detail.begindate = detail.startdate;
  107. detail.begindate2 = detail.periodstart;
  108. detail.enddate2 = detail.periodend;
  109. delete detail.startdate;
  110. delete detail.periodstart;
  111. delete detail.periodend;
  112. this.data.content.where = detail;
  113. this.data.content.where = detail;
  114. this.getList(true);
  115. },
  116. /* 顶部条件导航回调 */
  117. navClick({
  118. detail
  119. }) {
  120. switch (detail.id) {
  121. case '1':
  122. this.setData({
  123. classShow: true
  124. })
  125. break;
  126. case '2':
  127. this.setData({
  128. 'filterShow': true
  129. })
  130. break;
  131. case '3':
  132. this.setData({
  133. 'content.sort[0].reversed': this.data.content.sort[0].reversed == 0 ? 1 : 0
  134. });
  135. this.getList(true)
  136. break;
  137. }
  138. },
  139. /* 处理搜索 */
  140. onSearch({
  141. detail
  142. }) {
  143. this.data.content.where.condition = detail;
  144. this.getList(true);
  145. },
  146. classClose() {
  147. this.setData({
  148. classShow: false
  149. })
  150. },
  151. classSelect({
  152. detail
  153. }) {
  154. if (this.data.content.type == detail.index) return this.classClose();
  155. this.setData({
  156. "content.type": detail.index,
  157. 'navList[0].label': detail.name,
  158. classActions: this.data.classActions.map(v => {
  159. v.color = detail.i == v.i ? '#3874F6' : ''
  160. return v
  161. })
  162. })
  163. this.classClose();
  164. this.getList(true)
  165. },
  166. toAdd() {
  167. wx.navigateTo({
  168. url: '/prsx/tryOut/insert'
  169. })
  170. },
  171. })