|
@@ -5,6 +5,7 @@ var chart2;
|
|
var chart3;
|
|
var chart3;
|
|
var AParse = require('../../../Component/aParse/aParse.js');
|
|
var AParse = require('../../../Component/aParse/aParse.js');
|
|
import 'dingtalk-jsapi/entry/union';
|
|
import 'dingtalk-jsapi/entry/union';
|
|
|
|
+import { setCache, getCache } from '../../../utils/util'
|
|
import { contactAdminToUseApp } from 'dingtalk-design-libs';
|
|
import { contactAdminToUseApp } from 'dingtalk-design-libs';
|
|
Page({
|
|
Page({
|
|
data: {
|
|
data: {
|
|
@@ -41,6 +42,8 @@ Page({
|
|
mainCorpId: '',//如果是个人版,这个企业ID是登录者所在的企业ID,不是钉钉那边提供的隐藏企业ID
|
|
mainCorpId: '',//如果是个人版,这个企业ID是登录者所在的企业ID,不是钉钉那边提供的隐藏企业ID
|
|
|
|
|
|
noticeTitle:'',
|
|
noticeTitle:'',
|
|
|
|
+ isGz:false,
|
|
|
|
+ islog:true,
|
|
},
|
|
},
|
|
onLoad() {
|
|
onLoad() {
|
|
that = this;
|
|
that = this;
|
|
@@ -48,6 +51,7 @@ Page({
|
|
},
|
|
},
|
|
onShow() {
|
|
onShow() {
|
|
if (app.globalData.userData) {
|
|
if (app.globalData.userData) {
|
|
|
|
+ dd.setNavigationBar({ title: app.globalData.userData.name });
|
|
that.getUserData();
|
|
that.getUserData();
|
|
that.getGg();
|
|
that.getGg();
|
|
that.getNotice();
|
|
that.getNotice();
|
|
@@ -57,6 +61,9 @@ Page({
|
|
isSubject: app.globalData.userData.is_personal == 1 ? true : false,
|
|
isSubject: app.globalData.userData.is_personal == 1 ? true : false,
|
|
mainCorpId: app.globalData.userData.main_corp_id
|
|
mainCorpId: app.globalData.userData.main_corp_id
|
|
})
|
|
})
|
|
|
|
+ if(!getCache('init_rule_check')){
|
|
|
|
+ app.globalData.userData.init_rule_check? '':that.setData({ isGz: true})
|
|
|
|
+ }
|
|
if (app.globalData.isCreator) {
|
|
if (app.globalData.isCreator) {
|
|
that.setMenuList("creator");
|
|
that.setMenuList("creator");
|
|
} else if (app.globalData.isAdministrator) {
|
|
} else if (app.globalData.isAdministrator) {
|
|
@@ -67,6 +74,7 @@ Page({
|
|
} else {
|
|
} else {
|
|
app.login(app.globalData.corpId,function (is) {
|
|
app.login(app.globalData.corpId,function (is) {
|
|
if (is) {
|
|
if (is) {
|
|
|
|
+ dd.setNavigationBar({ title: app.globalData.userData.name });
|
|
if (app.globalData.isCreator) {
|
|
if (app.globalData.isCreator) {
|
|
that.setMenuList("creator");
|
|
that.setMenuList("creator");
|
|
} else if (app.globalData.isAdministrator) {
|
|
} else if (app.globalData.isAdministrator) {
|
|
@@ -77,6 +85,10 @@ Page({
|
|
that.getUserData();
|
|
that.getUserData();
|
|
that.getGg();
|
|
that.getGg();
|
|
that.getNotice();
|
|
that.getNotice();
|
|
|
|
+ if(!getCache('init_rule_check')){
|
|
|
|
+ app.globalData.userData.init_rule_check? '':that.setData({ isGz: true})
|
|
|
|
+ }
|
|
|
|
+
|
|
that.setData({
|
|
that.setData({
|
|
isAdministrator: app.globalData.isAdministrator,
|
|
isAdministrator: app.globalData.isAdministrator,
|
|
getRole_four: app.globalData.isCreator,
|
|
getRole_four: app.globalData.isCreator,
|
|
@@ -91,58 +103,46 @@ Page({
|
|
},function(){},true)
|
|
},function(){},true)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- activeA(){
|
|
|
|
- dd.createDing({
|
|
|
|
- users: ["102250695436416908"], //默认选中用户工号列表;类型: Array<String>
|
|
|
|
- corpId: app.globalData.corpId, // 类型: String
|
|
|
|
- alertType: 2, // 钉发送方式 0:电话, 1:短信, 2:应用内;类型 Number
|
|
|
|
- alertDate: {"format":"yyyy-MM-dd HH:mm", "value":"2019-08-29 08:25"}, // 非必选,定时发送时间, 非定时DING不需要填写
|
|
|
|
- type: 1,// 附件类型 1:image, 2:link;类型: Number
|
|
|
|
-
|
|
|
|
- // 非必选
|
|
|
|
- // 附件信息
|
|
|
|
- attachment: {
|
|
|
|
- images: ["https://www.baidu.com/img/bd_logo1.png?where=super"], // 图片附件, type=1时, 必选;类型: Array<String>
|
|
|
|
- // image: "https://www.baidu.com/img/bd_logo1.png?where=super", // 链接附件, type=2时, 必选;类型: String
|
|
|
|
- title: "这是一个测试", // 链接附件, type=2时, 必选;类型: String
|
|
|
|
- url: "https://www.baidu.com/", // 链接附件, type=2时, 必选;类型 String
|
|
|
|
- text: "测试发钉成功" // 链接附件, type=2时, 必选;类型: String
|
|
|
|
- },
|
|
|
|
- text: '测试ding', // 正文
|
|
|
|
- bizType :0, // 业务类型 0:通知DING;1:任务;2:会议;
|
|
|
|
-
|
|
|
|
- // 任务信息
|
|
|
|
- // bizType=1的时候选填
|
|
|
|
- taskInfo: {
|
|
|
|
- ccUsers: ['100', '101'],// 抄送用户列表, 工号,类型: Array<String>
|
|
|
|
- deadlineTime: {"format":"yyyy-MM-dd HH:mm", "value":"2015-05-09 08:00"}, // 任务截止时间
|
|
|
|
- taskRemind: 30 // 任务提醒时间, 单位分钟;支持参数: 0:不提醒;15:提前15分钟;60:提前1个小时;180:提前3个小时;1440:提前一天;类型: Number
|
|
|
|
- },
|
|
|
|
- // 日程信息
|
|
|
|
- // bizType=2的时候选填
|
|
|
|
- confInfo: {
|
|
|
|
- bizSubType: 0, // 子业务类型如会议: 0:预约会议, 1:预约电话会议, 2:预约视频会议;类型: Number (注: 目前只有会议才有子业务类型);
|
|
|
|
- location: '某某会议室', // 会议地点(非必选),类型: String
|
|
|
|
- startTime: {"format":"yyyy-MM-dd HH:mm", "value":"2015-05-09 08:00"},// 会议开始时间
|
|
|
|
- endTime: {"format":"yyyy-MM-dd HH:mm", "value":"2015-05-09 08:00"},// 会议结束时间
|
|
|
|
- remindMinutes: 30, // 会前提醒。单位分钟;1:不提醒, 0:事件发生时提醒, 5:提前5分钟, 15:提前15分钟, 30:提前30分钟, 60:提前1个小时, 1440:提前一天
|
|
|
|
- remindType: 2 // 会议提前提醒方式;0:电话, 1:短信, 2:应用内;类型: Number
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- success:function(res){
|
|
|
|
- /*
|
|
|
|
- {
|
|
|
|
- "dingId": "1_1_a09f167xxx",
|
|
|
|
- "text": "钉正文内容",
|
|
|
|
- "result": true
|
|
|
|
- }
|
|
|
|
- */
|
|
|
|
- },
|
|
|
|
- fail:function(err){
|
|
|
|
- }
|
|
|
|
|
|
+ gettrees(fn) {
|
|
|
|
+ app.$get2("api/integral/rule/trees", {cycle_type: 1 }).then((res)=>{
|
|
|
|
+ var rule_tree = res.data.data.rule_tree
|
|
|
|
+ if(rule_tree.length==0&&app.globalData.isCreator){
|
|
|
|
+ fn(false)
|
|
|
|
+ }else{
|
|
|
|
+ fn(true)
|
|
|
|
+ }
|
|
})
|
|
})
|
|
},
|
|
},
|
|
-
|
|
|
|
|
|
+ openWs(){
|
|
|
|
+ if(!that.data.islog){
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ that.setData({
|
|
|
|
+ islog:false
|
|
|
|
+ })
|
|
|
|
+ app.globalData.socketApi.sendData({type:'init_rule'}, function(e){
|
|
|
|
+ console.log(e)
|
|
|
|
+ that.setData({
|
|
|
|
+ islog:true
|
|
|
|
+ })
|
|
|
|
+ if (e.type == 'init_rule') {
|
|
|
|
+ if(e.code==1&&e.result.done){
|
|
|
|
+ that.setData({ isGz:false})
|
|
|
|
+ app.globalData.showToast('已导入');
|
|
|
|
+ app.globalData.socketApi.closewebsocket();
|
|
|
|
+ }else{
|
|
|
|
+ app.globalData.showToast(e.msg);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ openWs2(){
|
|
|
|
+ app.$post("api/integral/employee/init_rule_notice").then((res) => {
|
|
|
|
+ app.globalData.showToast('已发送通知');
|
|
|
|
+ setCache('init_rule_check',true)
|
|
|
|
+ that.setData({ isGz:false})
|
|
|
|
+ }, (err) => { })
|
|
|
|
+ },
|
|
openGly() {
|
|
openGly() {
|
|
contactAdminToUseApp({ id: '55493', corpId: that.data.mainCorpId })
|
|
contactAdminToUseApp({ id: '55493', corpId: that.data.mainCorpId })
|
|
.catch((err) => {
|
|
.catch((err) => {
|
|
@@ -411,7 +411,6 @@ Page({
|
|
console.error(e)
|
|
console.error(e)
|
|
})
|
|
})
|
|
},
|
|
},
|
|
-
|
|
|
|
//获取个人统计
|
|
//获取个人统计
|
|
getUserData() {
|
|
getUserData() {
|
|
var http1 = app.$get2("api/integral/statistics", { employee_id: 0, month: app.globalData.month })
|
|
var http1 = app.$get2("api/integral/statistics", { employee_id: 0, month: app.globalData.month })
|
|
@@ -419,6 +418,7 @@ Page({
|
|
month: app.globalData.month,
|
|
month: app.globalData.month,
|
|
page: 1,
|
|
page: 1,
|
|
page_size: 5,
|
|
page_size: 5,
|
|
|
|
+ order_key:'update_time',
|
|
employee_ids: app.globalData.isCreator ? '' : app.globalData.userData.id
|
|
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 })
|
|
@@ -432,7 +432,6 @@ Page({
|
|
if (values[0]) {
|
|
if (values[0]) {
|
|
let data = values[0].data.data;
|
|
let data = values[0].data.data;
|
|
var task = data.task;
|
|
var task = data.task;
|
|
- dd.setNavigationBar({ title: data.name });
|
|
|
|
var ratio = task.reward.point === 0 || task.deduction.point === 0 ? '-' : `${task.ratio.ratio}:1`
|
|
var ratio = task.reward.point === 0 || task.deduction.point === 0 ? '-' : `${task.ratio.ratio}:1`
|
|
var target_ratio = task.ratio.target_ratio <= 0 ? '0:0' : `${task.ratio.target_ratio}:1`
|
|
var target_ratio = task.ratio.target_ratio <= 0 ? '0:0' : `${task.ratio.target_ratio}:1`
|
|
data.ratio = {
|
|
data.ratio = {
|
|
@@ -507,6 +506,7 @@ Page({
|
|
}
|
|
}
|
|
if(values[7]){
|
|
if(values[7]){
|
|
let data = values[7].data.data;
|
|
let data = values[7].data.data;
|
|
|
|
+ app.globalData.config=data;
|
|
let menuList=JSON.parse(JSON.stringify( that.data.menuList))
|
|
let menuList=JSON.parse(JSON.stringify( that.data.menuList))
|
|
if(data.shop_status==1){
|
|
if(data.shop_status==1){
|
|
if(menuList[menuList.length-2].name!='福利兑换'){
|
|
if(menuList[menuList.length-2].name!='福利兑换'){
|