index.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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. "type": 99,
  25. "pageNumber": 1,
  26. "pageSize": 20,
  27. "where": {
  28. "condition": "",
  29. "startdate": "",
  30. "enddate": "",
  31. "type": "",
  32. "stagename": ""
  33. }
  34. }
  35. },
  36. async onLoad() {
  37. getApp().globalData.Language.getLanguagePackage(this);
  38. let templetList = wx.getStorageSync('templetList')
  39. this.setData({
  40. insert: wx.getStorageSync('auth').wdoctors.options.some(v => v == 'insert'), //查询新增权限
  41. classActions: templetList.map((v, i) => {
  42. return {
  43. name: v.templetname,
  44. index: v.templetid,
  45. color: i == 0 ? '#3874F6' : '',
  46. i: i,
  47. }
  48. }),
  49. 'navList[0].label': templetList[0].templetname,
  50. "content.type": templetList[0].templetid,
  51. });
  52. this.getList(true)
  53. _Http.basic({
  54. "id": 20220929085401,
  55. "content": {
  56. "ownertable": "sa_doctor",
  57. "ownerid": ""
  58. }
  59. }).then(res => {
  60. if (res.code == 1) {
  61. let filtratelist = [{
  62. label: "标签",
  63. index: null,
  64. type: "checkbox",
  65. showName: "tag", //显示字段
  66. valueKey: "tag", //返回Key
  67. selectKey: "tag", //传参 代表选着字段 不传参返回整个选择对象
  68. value: "", //选中值
  69. list: res.data.option
  70. }]
  71. this.setData({
  72. filtratelist
  73. })
  74. }
  75. })
  76. },
  77. getList(init = false) {
  78. _Http.init(this.data.content, init).then(content => {
  79. _Http.basic({
  80. "id": 2025102208523002,
  81. content
  82. }).then(res => {
  83. console.log("医生列表", res)
  84. this.selectComponent('#ListBox').RefreshToComplete();
  85. if (res.code != '1') return wx.showToast({
  86. title: res.msg,
  87. icon: "none"
  88. })
  89. setTimeout(() => {
  90. if (res.pageNumber == 1 && res.data.length && !this.data.filtratelist.some(v => v.label == '开发阶段')) {
  91. this.data.filtratelist.push({
  92. label: "开发阶段",
  93. index: null,
  94. showName: "stagename", //显示字段
  95. valueKey: "stagename", //返回Key
  96. selectKey: "stagename", //传参 代表选着字段 不传参返回整个选择对象
  97. value: "", //选中值
  98. list: res.data[0].stages
  99. })
  100. this.setData({
  101. filtratelist: this.data.filtratelist
  102. })
  103. }
  104. }, 1500);
  105. this.setData({
  106. content: _Http.paging(content, res),
  107. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
  108. })
  109. })
  110. })
  111. },
  112. toAdd() {
  113. wx.navigateTo({
  114. url: '/prsx/doctors/insert'
  115. })
  116. },
  117. /* 处理筛选 */
  118. handleFilter({
  119. detail
  120. }) {
  121. detail.condition = this.data.content.where.condition;
  122. this.data.content.where = detail;
  123. this.getList(true);
  124. },
  125. /* 顶部条件导航回调 */
  126. navClick({
  127. detail
  128. }) {
  129. switch (detail.id) {
  130. case '1':
  131. this.setData({
  132. classShow: true
  133. })
  134. break;
  135. case '2':
  136. this.setData({
  137. 'filterShow': true
  138. })
  139. break;
  140. case '3':
  141. this.setData({
  142. 'content.sort[0].reversed': this.data.content.sort[0].reversed == 0 ? 1 : 0
  143. });
  144. this.getList(true)
  145. break;
  146. }
  147. },
  148. /* 处理搜索 */
  149. onSearch({
  150. detail
  151. }) {
  152. this.data.content.where.condition = detail;
  153. this.getList(true);
  154. },
  155. classClose() {
  156. this.setData({
  157. classShow: false
  158. })
  159. },
  160. classSelect({
  161. detail
  162. }) {
  163. if (this.data.content.type == detail.index) return this.classClose();
  164. this.setData({
  165. "content.type": detail.index,
  166. 'navList[0].label': detail.name,
  167. classActions: this.data.classActions.map(v => {
  168. v.color = detail.i == v.i ? '#3874F6' : ''
  169. return v
  170. })
  171. })
  172. this.classClose();
  173. this.getList(true)
  174. }
  175. })