|
@@ -4,6 +4,8 @@ var chart1;
|
|
|
var chart2;
|
|
|
var chart3;
|
|
|
var AParse = require('../../../Component/aParse/aParse.js');
|
|
|
+import 'dingtalk-jsapi/entry/union';
|
|
|
+import { contactAdminToUseApp } from 'dingtalk-design-libs';
|
|
|
Page({
|
|
|
data: {
|
|
|
userData: {},
|
|
@@ -16,7 +18,7 @@ Page({
|
|
|
getRole_four: app.globalData.isCreator,//是否创始人
|
|
|
setECharts: [],//柱形图数据
|
|
|
pieTotal: 1,
|
|
|
- total:'',
|
|
|
+ total: '',
|
|
|
menuList: [
|
|
|
{ name: '审批', imgUrl: '../../../image/sp.png', url: '../my_approve/my_approve', code: 'creator admin' },
|
|
|
{ name: '任务', imgUrl: '../../../image/a7.png', url: '../../statistics/my_task/my_task', code: 'admin employee' },
|
|
@@ -29,9 +31,12 @@ Page({
|
|
|
{ name: '发放奖票', imgUrl: '../../../image/add_ticket.png', url: '../../statistics/grant/grant', code: 'creator admin' },
|
|
|
{ name: '全部', imgUrl: '../../../image/all2.png', url: 'all', code: 'creator admin employee' },
|
|
|
],
|
|
|
- isUpdate:false,
|
|
|
- title:'',//系统消息标题
|
|
|
- textId:''//系统消息ID
|
|
|
+ isUpdate: false,
|
|
|
+ title: '',//系统消息标题
|
|
|
+ textId: '',//系统消息ID
|
|
|
+
|
|
|
+ isSubject:false,//判断是否是个人版进入
|
|
|
+ mainCorpId:'',//如果是个人版,这个企业ID是登录者所在的企业ID,不是钉钉那边提供的隐藏企业ID
|
|
|
},
|
|
|
onLoad() {
|
|
|
that = this;
|
|
@@ -42,19 +47,27 @@ Page({
|
|
|
that.getUserData();
|
|
|
that.getGg();
|
|
|
that.setData({ isAdministrator: app.globalData.isAdministrator, getRole_four: app.globalData.isCreator })
|
|
|
+ that.setData({
|
|
|
+ isSubject:app.globalData.is_personal==1? true:false,
|
|
|
+ mainCorpId:app.globalData.main_corp_id
|
|
|
+ })
|
|
|
} else {
|
|
|
app.login(app.globalData.corpId, function (is) {
|
|
|
if (is) {
|
|
|
- if(app.globalData.isCreator){
|
|
|
+ if (app.globalData.isCreator) {
|
|
|
that.setMenuList("creator");
|
|
|
- }else if(app.globalData.isAdministrator){
|
|
|
+ } else if (app.globalData.isAdministrator) {
|
|
|
that.setMenuList("admin");
|
|
|
- }else if(!app.globalData.isCreator&&!app.globalData.isAdministrator){
|
|
|
+ } else if (!app.globalData.isCreator && !app.globalData.isAdministrator) {
|
|
|
that.setMenuList("employee");
|
|
|
}
|
|
|
that.getGg();
|
|
|
that.getUserData();
|
|
|
that.setData({ isAdministrator: app.globalData.isAdministrator, getRole_four: app.globalData.isCreator })
|
|
|
+ that.setData({
|
|
|
+ isSubject:app.globalData.is_personal==1? true:false,
|
|
|
+ mainCorpId:app.globalData.main_corp_id
|
|
|
+ })
|
|
|
} else {
|
|
|
dd.reLaunch({
|
|
|
url: '../noJurisdiction/noJurisdiction'
|
|
@@ -63,9 +76,16 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- openUrl(e){
|
|
|
+ openGly() {
|
|
|
+ contactAdminToUseApp({ id: '55493', corpId: that.data.mainCorpId})
|
|
|
+ .catch((err) => {
|
|
|
+ // 入参不正确,或者遇到技术异常时才会进入这个链路
|
|
|
+ console.error(err);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ openUrl(e) {
|
|
|
var url = e.target.dataset.url;
|
|
|
- if(url=='all'){
|
|
|
+ if (url == 'all') {
|
|
|
dd.switchTab({
|
|
|
url: '../../statistics/index/index'
|
|
|
})
|
|
@@ -75,10 +95,10 @@ Page({
|
|
|
url: url
|
|
|
})
|
|
|
},
|
|
|
- openText(){
|
|
|
+ openText() {
|
|
|
that.colseText();
|
|
|
dd.navigateTo({
|
|
|
- url: '../../deploy/upgradeDetail/upgradeDetail?id='+that.data.textId
|
|
|
+ url: '../../deploy/upgradeDetail/upgradeDetail?id=' + that.data.textId
|
|
|
})
|
|
|
},
|
|
|
//获取缓存的公告
|
|
@@ -95,41 +115,41 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
// 获取公告
|
|
|
- getGg(){
|
|
|
- if(that.data.title){
|
|
|
+ getGg() {
|
|
|
+ if (that.data.title) {
|
|
|
return
|
|
|
}
|
|
|
- app.$get("api/announcement/list", {page: 1, page_size: 1}).then((res) => {
|
|
|
+ app.$get("api/announcement/list", { page: 1, page_size: 1 }).then((res) => {
|
|
|
var data = res.data.data.list[0];
|
|
|
- AParse.aParse('article', 'html', data.focus, that, 5);
|
|
|
+ AParse.aParse('article', 'html', data.focus, that, 5);
|
|
|
that.setData({
|
|
|
- title:data.title,
|
|
|
- textId:data.id
|
|
|
+ title: data.title,
|
|
|
+ textId: data.id
|
|
|
});
|
|
|
- that.getReviewerObj(function(res){
|
|
|
- if(res!=data.id){
|
|
|
- that.colseText();
|
|
|
- dd.setStorage({
|
|
|
- key: 'isShowMessage',
|
|
|
- data: data.id,
|
|
|
- });
|
|
|
- }
|
|
|
+ that.getReviewerObj(function (res) {
|
|
|
+ if (res != data.id) {
|
|
|
+ that.colseText();
|
|
|
+ dd.setStorage({
|
|
|
+ key: 'isShowMessage',
|
|
|
+ data: data.id,
|
|
|
+ });
|
|
|
+ }
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
- setMenuList(str){
|
|
|
- var arr=[];
|
|
|
- that.data.menuList.forEach(item=>{
|
|
|
- if(item.code.indexOf(str)>=0){
|
|
|
- arr.push(item)
|
|
|
- }
|
|
|
- })
|
|
|
- that.setData({
|
|
|
- menuList:arr
|
|
|
- })
|
|
|
+ setMenuList(str) {
|
|
|
+ var arr = [];
|
|
|
+ that.data.menuList.forEach(item => {
|
|
|
+ if (item.code.indexOf(str) >= 0) {
|
|
|
+ arr.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ that.setData({
|
|
|
+ menuList: arr
|
|
|
+ })
|
|
|
},
|
|
|
- colseText(){
|
|
|
- this.setData({isUpdate: !this.data.isUpdate })
|
|
|
+ colseText() {
|
|
|
+ this.setData({ isUpdate: !this.data.isUpdate })
|
|
|
},
|
|
|
showText() {
|
|
|
this.setData({ isBh: !this.data.isBh })
|
|
@@ -178,7 +198,7 @@ Page({
|
|
|
{ url: '../../statistics/prizeBuckleDetail/prizeBuckleDetail', query: '' },
|
|
|
{ url: '../../statistics/integralEvent/integralEvent', query: '' },
|
|
|
{ url: '../../statistics/userRamking/userRamking', query: '' },
|
|
|
- { url: '../../statistics/glz_execute/glz_execute', query: '' },
|
|
|
+ { url: '../../statistics/glz_execute/glz_execute', query: '' },
|
|
|
];
|
|
|
}
|
|
|
dd.navigateTo({
|
|
@@ -313,17 +333,17 @@ Page({
|
|
|
//获取个人统计
|
|
|
getUserData() {
|
|
|
var http1 = app.$get2("api/integral/statistics", { employee_id: 0, month: app.globalData.month })
|
|
|
- var http2 = app.$get2("api/integral/statistics/integral", {
|
|
|
- month: app.globalData.month,
|
|
|
- page: 1,
|
|
|
- page_size: 5,
|
|
|
- employee_ids:app.globalData.isCreator ? '':app.globalData.userData.id
|
|
|
+ var http2 = app.$get2("api/integral/statistics/integral", {
|
|
|
+ month: app.globalData.month,
|
|
|
+ page: 1,
|
|
|
+ page_size: 5,
|
|
|
+ employee_ids: app.globalData.isCreator ? '' : app.globalData.userData.id
|
|
|
})
|
|
|
- var http3 = app.$get2("api/integral/review/list", { type: 'waiting',source_type:0, page: 1, pt_id: 0 })
|
|
|
+ var http3 = app.$get2("api/integral/review/list", { type: 'waiting', source_type: 0, page: 1, pt_id: 0 })
|
|
|
var ranking = app.$get('api/integral/statistics/ranking/list', { page: 1, page_size: 5 })// 获取排行榜
|
|
|
var task = app.$get('api/integral/statistics/task/pie', { month: app.globalData.month })// 管理者奖扣任务柱状图
|
|
|
- var work = app.$get('api/integral/work/list', { status: 'running',page: 1,pt_id: 0, source_type: 0})// 管理者奖扣任务柱状图
|
|
|
- Promise.all([http1, http2, http3, ranking, task,work]).then(function (values) {
|
|
|
+ var work = app.$get('api/integral/work/list', { status: 'running', page: 1, pt_id: 0, source_type: 0 })// 管理者奖扣任务柱状图
|
|
|
+ Promise.all([http1, http2, http3, ranking, task, work]).then(function (values) {
|
|
|
if (values[0]) {
|
|
|
let data = values[0].data.data;
|
|
|
var task = data.task;
|
|
@@ -398,7 +418,7 @@ Page({
|
|
|
},
|
|
|
//获取积分事件
|
|
|
getIncidentLsit() {
|
|
|
-
|
|
|
+
|
|
|
app.$get("api/integral/statistics/integral", { month: app.globalData.month, page: 1, page_size: 5, employee_ids: app.globalData.userData.id }).then((res) => {
|
|
|
var data = res.data.data.list;
|
|
|
data.map((item) => {
|