index.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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. value: '审核'
  70. }]
  71. }, {
  72. label: "试用类型",
  73. index: null,
  74. showName: "value", //显示字段
  75. valueKey: "type", //返回Key
  76. selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
  77. value: "", //选中值
  78. list: await _Http.getTypes('testtype', _Http)
  79. }]
  80. this.setData({
  81. filter
  82. })
  83. },
  84. getList(init = false) {
  85. _Http.init(this.data.content, init).then(content => {
  86. _Http.basic({
  87. "id": 2025110710350702,
  88. content
  89. }).then(res => {
  90. console.log("安装列表", res)
  91. this.selectComponent('#ListBox').RefreshToComplete();
  92. if (res.code != '1') return wx.showToast({
  93. title: res.msg,
  94. icon: "none"
  95. })
  96. this.setData({
  97. content: _Http.paging(content, res),
  98. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
  99. })
  100. })
  101. })
  102. },
  103. /* 处理筛选 */
  104. handleFilter({
  105. detail
  106. }) {
  107. detail.condition = this.data.content.where.condition;
  108. detail.begindate = detail.startdate;
  109. detail.begindate2 = detail.periodstart;
  110. detail.enddate2 = detail.periodend;
  111. delete detail.startdate;
  112. delete detail.periodstart;
  113. delete detail.periodend;
  114. this.data.content.where = detail;
  115. this.data.content.where = detail;
  116. this.getList(true);
  117. },
  118. /* 顶部条件导航回调 */
  119. navClick({
  120. detail
  121. }) {
  122. switch (detail.id) {
  123. case '1':
  124. this.setData({
  125. classShow: true
  126. })
  127. break;
  128. case '2':
  129. this.setData({
  130. 'filterShow': true
  131. })
  132. break;
  133. case '3':
  134. this.setData({
  135. 'content.sort[0].reversed': this.data.content.sort[0].reversed == 0 ? 1 : 0
  136. });
  137. this.getList(true)
  138. break;
  139. }
  140. },
  141. /* 处理搜索 */
  142. onSearch({
  143. detail
  144. }) {
  145. this.data.content.where.condition = detail;
  146. this.getList(true);
  147. },
  148. classClose() {
  149. this.setData({
  150. classShow: false
  151. })
  152. },
  153. classSelect({
  154. detail
  155. }) {
  156. if (this.data.content.type == detail.index) return this.classClose();
  157. this.setData({
  158. "content.type": detail.index,
  159. 'navList[0].label': detail.name,
  160. classActions: this.data.classActions.map(v => {
  161. v.color = detail.i == v.i ? '#3874F6' : ''
  162. return v
  163. })
  164. })
  165. this.classClose();
  166. this.getList(true)
  167. },
  168. toAdd() {
  169. wx.navigateTo({
  170. url: '/prsx/tryOut/insert'
  171. })
  172. },
  173. })