| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- const _Http = getApp().globalData.http;
- Page({
- data: {
- navList: [{
- label: "我负责的",
- icon: "icon-webxialaxuanxiangjiantou",
- color: "",
- width: "",
- id: "1"
- }, {
- label: "排序",
- icon: "icon-jiangxu1",
- color: "",
- width: "",
- id: "sort"
- }, {
- label: "筛选",
- icon: "icon-shaixuan",
- color: "",
- width: "",
- id: "2"
- }],
- content: {
- "type": 99,
- "pageNumber": 1,
- "pageSize": 20,
- "isExport": 0,
- "where": {
- "condition": "",
- "startdate": "",
- "enddate": "",
- "type": "",
- "stagename": ""
- }
- },
- filtratelist: []
- },
- async onLoad(options) {
- getApp().globalData.Language.getLanguagePackage(this);
- let templetList = wx.getStorageSync('templetList')
- this.setData({
- insert: wx.getStorageSync('auth').wdepartment.options.some(v => v == 'insert'), //查询新增权限
- classActions: templetList.map((v, i) => {
- return {
- name: v.templetname,
- index: v.templetid,
- color: i == 0 ? '#3874F6' : '',
- i: i,
- }
- }),
- 'navList[0].label': templetList[0].templetname,
- "content.type": templetList[0].templetid,
- });
- this.getList(true)
- getApp().globalData.Language.getLanguagePackage(this);
- let filtratelist = [{
- label: "营销区域",
- index: null,
- showName: "areaname", //显示字段
- valueKey: "sa_saleareaid", //返回Key
- selectKey: "sa_saleareaid", //传参 代表选着字段 不传参返回整个选择对象
- value: "", //选中值
- type: 'multilevelClass',
- list: await _Http.basic({
- "classname": "webmanage.sale.salearea.salearea",
- "method": "query_area",
- "content": {},
- }).then(res => {
- console.log("获取营销区域", res)
- return res.code == 1 ? res.data : []
- })
- }, {
- label: "医院等级",
- index: null,
- showName: "value", //显示字段
- valueKey: "grade", //返回Key
- selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
- value: "", //选中值
- list: await _Http.getTypes('hospitalgrade', _Http)
- }, {
- label: "医院类型",
- index: null,
- showName: "value", //显示字段
- valueKey: "type", //返回Key
- selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
- value: "", //选中值
- list: await _Http.getTypes('hospitaltype', _Http)
- }, {
- label: "开发状态",
- index: null,
- showName: "value", //显示字段
- valueKey: "status", //返回Key
- selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
- value: "", //选中值
- list: [{
- value: '未开发'
- }, {
- value: '已开发'
- }]
- }, {
- label: "标签",
- index: null,
- type: "checkbox",
- showName: "tag", //显示字段
- valueKey: "tag", //返回Key
- selectKey: "tag", //传参 代表选着字段 不传参返回整个选择对象
- value: "", //选中值
- list: await _Http.getTypes('tags', _Http)
- }]
- this.setData({
- filtratelist
- })
- },
- getList(init = false) {
- _Http.init(this.data.content, init).then(content => {
- _Http.basic({
- "id": 20221012164402,
- content
- }).then(res => {
- console.log("医院列表", res)
- this.selectComponent('#ListBox').RefreshToComplete();
- if (res.code != '1') return wx.showToast({
- title: res.msg,
- icon: "none"
- })
- res.data = res.data.map(v => {
- v.totalstage = v.stages.length
- v.stage = v.stages.findIndex(s => s.stagename == v.stagename) + 1
- v.progress = v.stage / v.totalstage * 100;
- return v
- })
- setTimeout(() => {
- if (res.pageNumber == 1 && res.data.length && !this.data.filtratelist.some(v => v.label == '开发阶段')) {
- this.data.filtratelist.push({
- label: "开发阶段",
- index: null,
- showName: "stagename", //显示字段
- valueKey: "stagename", //返回Key
- selectKey: "stagename", //传参 代表选着字段 不传参返回整个选择对象
- value: "", //选中值
- list: res.data[0].stages
- })
- this.setData({
- filtratelist: this.data.filtratelist
- })
- }
- }, 1500);
- this.setData({
- content: _Http.paging(content, res),
- list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
- })
- })
- })
- },
- toAdd() {
- wx.navigateTo({
- url: '/prsx/hospital/insert'
- })
- },
- /* 处理筛选 */
- handleFilter({
- detail
- }) {
- detail.condition = this.data.content.where.condition;
- this.data.content.where = detail;
- this.getList(true);
- },
- /* 顶部条件导航回调 */
- navClick({
- detail
- }) {
- switch (detail.id) {
- case '1':
- this.setData({
- classShow: true
- })
- break;
- case '2':
- this.setData({
- 'filterShow': true
- })
- break;
- case '3':
- this.setData({
- 'content.sort[0].reversed': this.data.content.sort[0].reversed == 0 ? 1 : 0
- });
- this.getList(true)
- break;
- }
- },
- /* 处理搜索 */
- onSearch({
- detail
- }) {
- this.data.content.where.condition = detail;
- this.getList(true);
- },
- classClose() {
- this.setData({
- classShow: false
- })
- },
- classSelect({
- detail
- }) {
- if (this.data.content.type == detail.index) return this.classClose();
- this.setData({
- "content.type": detail.index,
- 'navList[0].label': detail.name,
- classActions: this.data.classActions.map(v => {
- v.color = detail.i == v.i ? '#3874F6' : ''
- return v
- })
- })
- this.classClose();
- this.getList(true)
- }
- })
|