| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- Page({
- data: {
- active: "",
- page: null,
- ops: [],
- unfolds: [],
- showFiltrate: false,
- type: 0,
- isleave: 1,
- },
- onLoad(options) {
- getApp().globalData.Language.getLanguagePackage(this, '数据总览');
- let organization = this.selectComponent("#organization");
- organization.initDepAndUser()
- const ops = wx.getStorageSync('auth').wdataoverview.options.filter(v => ["Clue", "Client", "Project", "Cost"].includes(v))
- this.setData({
- active: ops[0],
- unfolds: [ops[0]],
- dataid: wx.getStorageSync('userMsg').userid,
- username: wx.getStorageSync('userMsg').name,
- })
- this.setData({
- ops: ops.map(v => {
- return {
- name: v,
- title: {
- "Clue": "线索",
- "Client": "客户",
- "Project": "项目",
- "Cost": "营销费用"
- } [v]
- }
- }),
- })
- },
- onChange(event) {
- const active = event.detail.name;
- if (!this.data.unfolds.includes(active)) {
- this.data.unfolds.push(active);
- }
- this.setData({
- active,
- unfolds: this.data.unfolds
- });
- this.getList({
- detail: active
- });
- },
- getList({
- detail
- }) {
- if (detail && this.data.active == "") return setTimeout(() => {
- this.getList({
- detail: detail
- })
- })
- if (detail && this.data.active != detail) return;
- const page = this.selectComponent("#" + this.data.active);
- if (page) {
- const {
- dataid,
- type,
- username,
- isleave
- } = this.data;
- let content = {};
- try {
- content = page.data.model.data.content;
- } catch (error) {
- content = page.getContent()
- }
- if (content.dataid != dataid || content.type != type || content.where.isleave != isleave) page.data.init = false
- content.dataid = dataid;
- content.type = type;
- content.username = username;
- content.where.isleave = isleave;
- if (!page.data.init) page.getList();
- }
- },
- openFiltrate() {
- this.setData({
- showFiltrate: true
- })
- },
- handleFilter({
- detail
- }) {
- if (detail.name == "close") return;
- if (detail.name == 'reset') {
- this.selectComponent("#organization").setData({
- isleave: 1
- })
- this.selectComponent("#organization").initDepAndUser()
- this.setData({
- dataid: wx.getStorageSync('userMsg').userid,
- 'type': 0,
- isleave: 1,
- username: wx.getStorageSync('userMsg').name
- })
- } else {
- let active = this.selectComponent("#organization").data.result,
- isleave = this.selectComponent("#organization").data.isleave;
- let type = active.userid ? 0 : 1,
- dataid = type == 0 ? active.userid : active.sa_saleareaid
- this.setData({
- isleave,
- dataid,
- type,
- username: active.name
- })
- }
- this.getList({
- detail: this.data.active
- });
- },
- })
|