import { communityselforganizationlist, getGridMemberListByAgencyId, icpartyunitList, publicWelfarePost, volunteer } from "../../utils/statisticsApi"; const App = getApp(); Component({ options: { styleIsolation: 'shared', }, properties: { visible: { type: Boolean, value: false }, agencyId: { type: String, value: '', observer: function (val) { this.typeChange() this.getList() } }, }, data: { options: [ { label: '人资源', children: [ { label: "网格员", value: "staffGrid", }, { label: "公益岗", value: "publicWelfareNum", }, { label: "志愿者", value: "volunteer", }, { label: "社区自组织", value: "4", }, { label: "联建单位", value: "5", }, /* { label: "15分钟生活圈商家", value: "6", }*/ ] }, { label: '物资源', children: [] }, { label: '场所资源', children: [] } ], typeIndex: 0, subTypeOptions: [], subTypeIndex: 0, isShowViews: false, pageNo: 1, viewData: {} }, ready: function () { this.typeChange() console.log(App.globalData.user.agencyId) this.getList(); }, methods: { close() { this.triggerEvent('close') }, typeChange() { this.setData({ subTypeIndex: 0, subTypeOptions: this.data.options[this.data.typeIndex].children }) }, handleViews(e) { let data = e.currentTarget.dataset.obj let peopleType = this.data.subTypeOptions[this.data.subTypeIndex].value let type = peopleType === 'volunteer' ? 1 : peopleType === '5' ? 2 : peopleType === '4' ? 3 : peopleType === 'staffGrid' ? 4 : peopleType === 'publicWelfareNum' ? 5 : '' this.setData({ viewData: { type, id: type === 3 ? data.orgId : data.id, data }, isShowViews: true, }) }, handleDispatchOrder(e) { let data = e.currentTarget.dataset.obj this.triggerEvent('dispatchOrder', data) }, handleCallPhone(e) { wx.makePhoneCall({ phoneNumber: e.currentTarget.dataset.mobile }) }, viewsClose() { this.setData({ isShowViews: false }) }, search() { this.setData({ pageNo: 1, list: [] }) this.getList() }, getList() { console.log(this.data.subTypeIndex) let subTypeIndex = this.data.subTypeOptions[this.data.subTypeIndex].value if (subTypeIndex === 'staffGrid' || subTypeIndex === 'publicWelfareNum' || subTypeIndex === 'volunteer') { this.getGridList() } if (subTypeIndex === '4') { this.getsqzz() } if (subTypeIndex === '5') { this.getljdw() } }, getsqzz() { communityselforganizationlist({ agencyId: this.data.agencyId || App.globalData.user.agencyId, pageNo: this.data.pageNo, pageSize: 5 }).then(res => { this.setData({ list: this.data.list.concat(res.data.list), total: res.data.total }) }) }, getljdw() { icpartyunitList({ agencyId: this.data.agencyId || App.globalData.user.agencyId, pageNo: this.data.pageNo, pageSize: 5 }).then(res => { this.setData({ list: this.data.list.concat(res.data.list), total: res.data.total }) }) }, getGridList() { getGridMemberListByAgencyId({ orgId: this.data.agencyId || App.globalData.user.agencyId, level: 'agency', personnelType: this.data.subTypeOptions[this.data.subTypeIndex].value }).then(res => { this.setData({ list: res.data.personnelInfoVOList }) }) }, scrolltolower() { let subTypeIndex = this.data.subTypeOptions[this.data.subTypeIndex].value if (subTypeIndex === '4' || subTypeIndex === '5') { if (this.data.list.length < this.data.total) { this.setData({ pageNo: this.data.pageNo + 1 }) this.getList() } } } } });